pub struct SemanticConfig { /* private fields */ }Expand description
Static description of a semantic output, usually built from the model’s
edgefirst.json by SemanticConfig::from_logical.
Implementations§
Source§impl SemanticConfig
impl SemanticConfig
Sourcepub fn scores(
shape: &[usize],
class_axis: usize,
height_axis: usize,
width_axis: usize,
) -> DecoderResult<Self>
pub fn scores( shape: &[usize], class_axis: usize, height_axis: usize, width_axis: usize, ) -> DecoderResult<Self>
Score map of shape, with the class, height and width axes at the
given positions. Every other axis must have size 1.
Defaults: bilinear upsampling with align_corners = false,
DecodeMode::Accurate, no activation applied, not quantized.
Sourcepub fn class_map(
shape: &[usize],
height_axis: usize,
width_axis: usize,
) -> DecoderResult<Self>
pub fn class_map( shape: &[usize], height_axis: usize, width_axis: usize, ) -> DecoderResult<Self>
Class map of shape with the height and width axes at the given
positions. Every other axis must have size 1.
Sourcepub fn from_logical(logical: &LogicalOutput) -> DecoderResult<Self>
pub fn from_logical(logical: &LogicalOutput) -> DecoderResult<Self>
Builds the configuration of a segmentation or masks logical output
with decoder: semantic, or of a ModelPack segmentation output, which
is NHWC and decoded in DecodeMode::Fast unless it says otherwise.
Sourcepub fn with_upsample(self, upsample: Upsample) -> DecoderResult<Self>
pub fn with_upsample(self, upsample: Upsample) -> DecoderResult<Self>
Sets the score-map upsampling. Bicubic is not supported.
Sourcepub fn with_mode(self, mode: DecodeMode) -> Self
pub fn with_mode(self, mode: DecodeMode) -> Self
Sets the default decode mode.
Sourcepub fn with_threshold(self, threshold: f32) -> Self
pub fn with_threshold(self, threshold: f32) -> Self
Sets the single-channel foreground threshold, in the space of the
scores after activation.
Sourcepub fn with_activation(self, activation: Activation) -> DecoderResult<Self>
pub fn with_activation(self, activation: Activation) -> DecoderResult<Self>
Declares an activation the model already applied to the scores.
§Errors
Sourcepub fn with_activation_required(
self,
activation: Activation,
) -> DecoderResult<Self>
pub fn with_activation_required( self, activation: Activation, ) -> DecoderResult<Self>
Declares the activation the scores still need. It is applied after
resampling, as reference pipelines do, so it leaves the class map
unchanged and sets how decode_semantic computes confidence.
§Errors
DecoderError::InvalidConfig when an activation is both applied
and required, or a single channel declares softmax;
DecoderError::NotSupported for tanh.
Sourcepub fn with_quantization(self, quantization: Quantization) -> Self
pub fn with_quantization(self, quantization: Quantization) -> Self
Quantization of integer scores, used when the tensor carries none.
Sourcepub fn with_name(self, name: impl Into<String>) -> Self
pub fn with_name(self, name: impl Into<String>) -> Self
Names the output so select_output prefers the tensor of that name.
Sourcepub fn with_position(self, index: usize, count: usize) -> Self
pub fn with_position(self, index: usize, count: usize) -> Self
Records the output’s index among the model’s count outputs, which
select_output uses when several outputs share its shape.
Sourcepub fn input(&self) -> SemanticInput
pub fn input(&self) -> SemanticInput
What the output holds.
Sourcepub fn layout(&self) -> SemanticLayout
pub fn layout(&self) -> SemanticLayout
Axis positions in Self::shape.
Sourcepub fn classes(&self) -> usize
pub fn classes(&self) -> usize
Number of classes the decoded class map can contain: the channel count, 2 for a single thresholded channel, 0 when unknown (a class map).
Sourcepub fn mode(&self) -> DecodeMode
pub fn mode(&self) -> DecodeMode
Default decode mode.
Trait Implementations§
Source§impl Clone for SemanticConfig
impl Clone for SemanticConfig
Source§impl Debug for SemanticConfig
impl Debug for SemanticConfig
Source§impl PartialEq for SemanticConfig
impl PartialEq for SemanticConfig
impl StructuralPartialEq for SemanticConfig
Auto Trait Implementations§
impl Freeze for SemanticConfig
impl RefUnwindSafe for SemanticConfig
impl Send for SemanticConfig
impl Sync for SemanticConfig
impl Unpin for SemanticConfig
impl UnsafeUnpin for SemanticConfig
impl UnwindSafe for SemanticConfig
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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