pub enum PosteriorPrecision {
F32,
F16,
}Expand description
Storage for the posteriors, n_labels values per voxel of the network’s grid.
Variants§
F32
Single precision, as the SynthSeg CLI keeps them.
F16
Half precision (IEEE binary16, about 3 significant digits): half the memory. The
arithmetic stays in single precision; only the stored values are rounded. With
FullVolume and flip averaging, the first pass’s posteriors are rounded to half
precision before the flipped pass runs, so the two passes are never held in full
precision at once.
No accuracy cost on three 1 mm scans: with windows, Dice and soft volumes match single
precision to 4 digits; on the whole volume the lowest label’s Dice against single
precision is 0.9993. It saved 0.4 GB natively on a 192×256×128 grid (0.8 GB on
192×256×256) and 0.39 GB of WASM heap with 96³ windows (2418 → 2025 MB). Conversions go
through slices (see Posterior::load), so it runs as fast as single precision.
16-bit fixed point on [0, 1] was tried as an alternative and rejected: it rounds the
many tiny posteriors to zero, shifting small labels’ soft volumes by up to 0.4 %.
Trait Implementations§
Source§impl Clone for PosteriorPrecision
impl Clone for PosteriorPrecision
Source§fn clone(&self) -> PosteriorPrecision
fn clone(&self) -> PosteriorPrecision
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PosteriorPrecision
Source§impl Debug for PosteriorPrecision
impl Debug for PosteriorPrecision
Source§impl Default for PosteriorPrecision
impl Default for PosteriorPrecision
Source§fn default() -> PosteriorPrecision
fn default() -> PosteriorPrecision
impl Eq for PosteriorPrecision
Source§impl PartialEq for PosteriorPrecision
impl PartialEq for PosteriorPrecision
Source§impl Serialize for PosteriorPrecision
impl Serialize for PosteriorPrecision
impl StructuralPartialEq for PosteriorPrecision
Auto Trait Implementations§
impl Freeze for PosteriorPrecision
impl RefUnwindSafe for PosteriorPrecision
impl Send for PosteriorPrecision
impl Sync for PosteriorPrecision
impl Unpin for PosteriorPrecision
impl UnsafeUnpin for PosteriorPrecision
impl UnwindSafe for PosteriorPrecision
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more