#[repr(u32)]pub enum Nms {
Auto = 1,
ClassAware = 2,
ClassAgnostic = 3,
}Expand description
NMS (Non-Maximum Suppression) mode for filtering overlapping detections.
This enum is used with Option<Nms>:
Some(Nms::Auto)— resolve from config or fall back toClassAwareSome(Nms::ClassAgnostic)— class-agnostic NMS: suppress overlapping boxes regardless of class labelSome(Nms::ClassAware)— class-aware NMS: only suppress boxes that share the same class label AND overlap above the IoU thresholdNone— bypass NMS entirely (for end-to-end models with embedded NMS)
The code is the one the C EF_NMS_* enumerators and the Python Nms
enum use. Code 0 is reserved for None (NMS off), which has no
variant here; see NMS_OFF_CODE.
Variants§
Auto = 1
Let the builder resolve NMS mode from the model config (e.g.
edgefirst.json). Falls back to Nms::ClassAware when no
config specifies a mode. This is the builder default — callers
should only use an explicit variant when they need to override
the config.
ClassAware = 2
Only suppress boxes with the same class label that overlap (default concrete behavior; matches trainer and COCO evaluation).
ClassAgnostic = 3
Suppress overlapping boxes regardless of class label.
Implementations§
Source§impl Nms
impl Nms
Sourcepub const fn code(self) -> u32
pub const fn code(self) -> u32
The shared code for this variant. Identical on every surface.
const, deliberately: a downstream binding that cannot
write Variant = OtherEnum::Variant.code() in a #[pyclass]
discriminant position (PyO3 requires a literal there) can
still pin that literal to this value with a
const _: () = assert!(...) – a build-time check instead
of a hand-synced comment. See PyTensorMemory/PyPixelFormat
in crates/python-common/src/tensor.rs for the consumer.
Sourcepub fn from_code(code: u32) -> Option<Self>
pub fn from_code(code: u32) -> Option<Self>
Reject an unknown code rather than guessing at one.
Sourcepub fn from_str_code(s: &str) -> Option<Self>
pub fn from_str_code(s: &str) -> Option<Self>
Reject an unknown string rather than guessing at one.
Source§impl Nms
impl Nms
Sourcepub const fn option_code(nms: Option<Nms>) -> u32
pub const fn option_code(nms: Option<Nms>) -> u32
The code for an optional mode, None (NMS off) included.
Sourcepub fn from_option_code(code: u32) -> Option<Option<Nms>>
pub fn from_option_code(code: u32) -> Option<Option<Nms>>
Decode an optional mode, NMS_OFF_CODE included. The outer None
is an unknown code; Some(None) is NMS off.
Trait Implementations§
impl Copy for Nms
Source§impl<'de> Deserialize<'de> for Nms
impl<'de> Deserialize<'de> for Nms
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Nms
impl StructuralPartialEq for Nms
Auto Trait Implementations§
impl Freeze for Nms
impl RefUnwindSafe for Nms
impl Send for Nms
impl Sync for Nms
impl Unpin for Nms
impl UnsafeUnpin for Nms
impl UnwindSafe for Nms
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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