Trait ClassificationModelTrait

Source
pub trait ClassificationModelTrait: ClassificationModelTraitConst + ModelTrait {
    // Required method
    fn as_raw_mut_ClassificationModel(&mut self) -> *mut c_void;

    // Provided methods
    fn set_enable_softmax_post_processing(
        &mut self,
        enable: bool,
    ) -> Result<ClassificationModel> { ... }
    fn classify(
        &mut self,
        frame: &impl ToInputArray,
    ) -> Result<Tuple<(i32, f32)>> { ... }
    fn classify_1(
        &mut self,
        frame: &impl ToInputArray,
        class_id: &mut i32,
        conf: &mut f32,
    ) -> Result<()> { ... }
}
Expand description

Mutable methods for crate::dnn::ClassificationModel

Required Methods§

Provided Methods§

Source

fn set_enable_softmax_post_processing( &mut self, enable: bool, ) -> Result<ClassificationModel>

Set enable/disable softmax post processing option.

If this option is true, softmax is applied after forward inference within the classify() function to convert the confidences range to [0.0-1.0]. This function allows you to toggle this behavior. Please turn true when not contain softmax layer in model.

§Parameters
  • enable: Set enable softmax post processing within the classify() function.
Source

fn classify(&mut self, frame: &impl ToInputArray) -> Result<Tuple<(i32, f32)>>

Given the @p input frame, create input blob, run net and return top-1 prediction.

§Parameters
  • frame: The input image.
Source

fn classify_1( &mut self, frame: &impl ToInputArray, class_id: &mut i32, conf: &mut f32, ) -> Result<()>

Given the @p input frame, create input blob, run net and return top-1 prediction.

§Parameters
  • frame: The input image.
§Overloaded parameters

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§