#[non_exhaustive]pub struct ModelOverrides {
pub task: Option<ModelTask>,
pub normalize: Option<NormalizeOverride>,
pub resize: Option<ResizeOverride>,
pub decode: Option<DecodeMode>,
pub labels: Option<Vec<String>>,
}Expand description
Values that replace what discovery found, applied after every source and
recorded as ConfigSource::Override.
use edgefirst_decoder::model_config::{ModelOverrides, ResizeOverride};
use edgefirst_tensor::LetterboxPlacement;
let mut o = ModelOverrides::default();
o.set("resize", "letterbox-topleft").unwrap();
o.set("labels", "background, person").unwrap();
assert_eq!(o.resize, Some(ResizeOverride::Letterbox(Some(LetterboxPlacement::TopLeft))));
assert_eq!(o.labels.as_deref(), Some(&["background".to_string(), "person".to_string()][..]));
assert!(o.set("resize", "fill").is_err());Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.task: Option<ModelTask>What the outputs decode to.
normalize: Option<NormalizeOverride>Input normalization.
resize: Option<ResizeOverride>Resize mode.
decode: Option<DecodeMode>Semantic decode mode.
labels: Option<Vec<String>>Class names, in channel order. Resolution checks their number only against a class count the model’s outputs state; end-to-end detections and class maps state none, so any number is accepted there and the caller checks it.
Implementations§
Source§impl ModelOverrides
impl ModelOverrides
Sourcepub fn set(&mut self, key: &str, value: &str) -> Result<(), ModelConfigError>
pub fn set(&mut self, key: &str, value: &str) -> Result<(), ModelConfigError>
Sets the override named key (task, normalize, resize,
decode or labels) from its string form. labels is a
comma-separated list of non-empty names.
§Errors
ModelConfigError::Override for an unknown key or a value outside
the key’s grammar.
Trait Implementations§
Source§impl Clone for ModelOverrides
impl Clone for ModelOverrides
Source§impl Debug for ModelOverrides
impl Debug for ModelOverrides
Source§impl Default for ModelOverrides
impl Default for ModelOverrides
Source§impl PartialEq for ModelOverrides
impl PartialEq for ModelOverrides
impl StructuralPartialEq for ModelOverrides
Auto Trait Implementations§
impl Freeze for ModelOverrides
impl RefUnwindSafe for ModelOverrides
impl Send for ModelOverrides
impl Sync for ModelOverrides
impl Unpin for ModelOverrides
impl UnsafeUnpin for ModelOverrides
impl UnwindSafe for ModelOverrides
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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