Struct opencv::dnn::ClassificationModel
source · pub struct ClassificationModel { /* private fields */ }
Expand description
This class represents high-level API for classification models.
ClassificationModel allows to set params for preprocessing input image. ClassificationModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and return top-1 prediction.
Implementations§
source§impl ClassificationModel
impl ClassificationModel
pub fn default() -> Result<ClassificationModel>
sourcepub fn new(model: &str, config: &str) -> Result<ClassificationModel>
pub fn new(model: &str, config: &str) -> Result<ClassificationModel>
Create classification model from network represented in one of the supported formats. An order of @p model and @p config arguments does not matter.
Parameters
- model: Binary file contains trained weights.
- config: Text file contains network configuration.
C++ default parameters
- config: “”
sourcepub fn new_def(model: &str) -> Result<ClassificationModel>
pub fn new_def(model: &str) -> Result<ClassificationModel>
Create classification model from network represented in one of the supported formats. An order of @p model and @p config arguments does not matter.
Parameters
- model: Binary file contains trained weights.
- config: Text file contains network configuration.
Note
This alternative version of [new] function uses the following default values for its arguments:
- config: “”
sourcepub fn new_1(network: &Net) -> Result<ClassificationModel>
pub fn new_1(network: &Net) -> Result<ClassificationModel>
Trait Implementations§
source§impl Boxed for ClassificationModel
impl Boxed for ClassificationModel
source§impl ClassificationModelTrait for ClassificationModel
impl ClassificationModelTrait for ClassificationModel
fn as_raw_mut_ClassificationModel(&mut self) -> *mut c_void
source§fn set_enable_softmax_post_processing(
&mut self,
enable: bool
) -> Result<ClassificationModel>
fn set_enable_softmax_post_processing( &mut self, enable: bool ) -> Result<ClassificationModel>
Set enable/disable softmax post processing option. Read more
source§fn classify(&mut self, frame: &impl ToInputArray) -> Result<Tuple<(i32, f32)>>
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. Read more
source§fn classify_1(
&mut self,
frame: &impl ToInputArray,
class_id: &mut i32,
conf: &mut f32
) -> Result<()>
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. Read more
source§impl Clone for ClassificationModel
impl Clone for ClassificationModel
source§impl Debug for ClassificationModel
impl Debug for ClassificationModel
source§impl Drop for ClassificationModel
impl Drop for ClassificationModel
source§impl From<ClassificationModel> for Model
impl From<ClassificationModel> for Model
source§fn from(s: ClassificationModel) -> Self
fn from(s: ClassificationModel) -> Self
Converts to this type from the input type.
source§impl ModelTrait for ClassificationModel
impl ModelTrait for ClassificationModel
fn as_raw_mut_Model(&mut self) -> *mut c_void
source§fn set_input_size_1(&mut self, width: i32, height: i32) -> Result<Model>
fn set_input_size_1(&mut self, width: i32, height: i32) -> Result<Model>
Set input size for frame. Read more
source§fn set_input_mean(&mut self, mean: Scalar) -> Result<Model>
fn set_input_mean(&mut self, mean: Scalar) -> Result<Model>
Set mean value for frame. Read more
source§fn set_input_scale(&mut self, scale: Scalar) -> Result<Model>
fn set_input_scale(&mut self, scale: Scalar) -> Result<Model>
Set scalefactor value for frame. Read more
source§fn set_input_swap_rb(&mut self, swap_rb: bool) -> Result<Model>
fn set_input_swap_rb(&mut self, swap_rb: bool) -> Result<Model>
Set flag swapRB for frame. Read more
source§fn set_input_params(
&mut self,
scale: f64,
size: Size,
mean: Scalar,
swap_rb: bool,
crop: bool
) -> Result<()>
fn set_input_params( &mut self, scale: f64, size: Size, mean: Scalar, swap_rb: bool, crop: bool ) -> Result<()>
Set preprocessing parameters for frame. Read more
source§fn set_input_params_def(&mut self) -> Result<()>
fn set_input_params_def(&mut self) -> Result<()>
Set preprocessing parameters for frame. Read more
fn get_network__1(&mut self) -> Result<Net>
source§impl ModelTraitConst for ClassificationModel
impl ModelTraitConst for ClassificationModel
fn as_raw_Model(&self) -> *const c_void
source§fn predict(
&self,
frame: &impl ToInputArray,
outs: &mut impl ToOutputArray
) -> Result<()>
fn predict( &self, frame: &impl ToInputArray, outs: &mut impl ToOutputArray ) -> Result<()>
Given the @p input frame, create input blob, run net and return the output @p blobs. Read more
fn get_network_(&self) -> Result<Net>
impl Send for ClassificationModel
Auto Trait Implementations§
impl RefUnwindSafe for ClassificationModel
impl !Sync for ClassificationModel
impl Unpin for ClassificationModel
impl UnwindSafe for ClassificationModel
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