Trait opencv::prelude::ANN_MLPTrait
source · pub trait ANN_MLPTrait: ANN_MLPTraitConst + StatModelTrait {
Show 17 methods
// Required method
fn as_raw_mut_ANN_MLP(&mut self) -> *mut c_void;
// Provided methods
fn set_train_method(
&mut self,
method: i32,
param1: f64,
param2: f64
) -> Result<()> { ... }
fn set_activation_function(
&mut self,
typ: i32,
param1: f64,
param2: f64
) -> Result<()> { ... }
fn set_layer_sizes(
&mut self,
_layer_sizes: &impl ToInputArray
) -> Result<()> { ... }
fn set_term_criteria(&mut self, val: TermCriteria) -> Result<()> { ... }
fn set_backprop_weight_scale(&mut self, val: f64) -> Result<()> { ... }
fn set_backprop_momentum_scale(&mut self, val: f64) -> Result<()> { ... }
fn set_rprop_dw0(&mut self, val: f64) -> Result<()> { ... }
fn set_rprop_dw_plus(&mut self, val: f64) -> Result<()> { ... }
fn set_rprop_dw_minus(&mut self, val: f64) -> Result<()> { ... }
fn set_rprop_dw_min(&mut self, val: f64) -> Result<()> { ... }
fn set_rprop_dw_max(&mut self, val: f64) -> Result<()> { ... }
fn set_anneal_initial_t(&mut self, val: f64) -> Result<()> { ... }
fn set_anneal_final_t(&mut self, val: f64) -> Result<()> { ... }
fn set_anneal_cooling_ratio(&mut self, val: f64) -> Result<()> { ... }
fn set_anneal_ite_per_step(&mut self, val: i32) -> Result<()> { ... }
fn set_anneal_energy_rng(&mut self, rng: &RNG) -> Result<()> { ... }
}
Expand description
Mutable methods for crate::ml::ANN_MLP
Required Methods§
fn as_raw_mut_ANN_MLP(&mut self) -> *mut c_void
Provided Methods§
sourcefn set_train_method(
&mut self,
method: i32,
param1: f64,
param2: f64
) -> Result<()>
fn set_train_method( &mut self, method: i32, param1: f64, param2: f64 ) -> Result<()>
Sets training method and common parameters.
Parameters
- method: Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods.
- param1: passed to setRpropDW0 for ANN_MLP::RPROP and to setBackpropWeightScale for ANN_MLP::BACKPROP and to initialT for ANN_MLP::ANNEAL.
- param2: passed to setRpropDWMin for ANN_MLP::RPROP and to setBackpropMomentumScale for ANN_MLP::BACKPROP and to finalT for ANN_MLP::ANNEAL.
C++ default parameters
- param1: 0
- param2: 0
sourcefn set_activation_function(
&mut self,
typ: i32,
param1: f64,
param2: f64
) -> Result<()>
fn set_activation_function( &mut self, typ: i32, param1: f64, param2: f64 ) -> Result<()>
Initialize the activation function for each neuron. Currently the default and the only fully supported activation function is ANN_MLP::SIGMOID_SYM.
Parameters
- type: The type of activation function. See ANN_MLP::ActivationFunctions.
- param1: The first parameter of the activation function,
. Default value is 0.
- param2: The second parameter of the activation function,
. Default value is 0.
C++ default parameters
- param1: 0
- param2: 0
sourcefn set_layer_sizes(&mut self, _layer_sizes: &impl ToInputArray) -> Result<()>
fn set_layer_sizes(&mut self, _layer_sizes: &impl ToInputArray) -> Result<()>
Integer vector specifying the number of neurons in each layer including the input and output layers. The very first element specifies the number of elements in the input layer. The last element - number of elements in the output layer. Default value is empty Mat.
See also
getLayerSizes
sourcefn set_term_criteria(&mut self, val: TermCriteria) -> Result<()>
fn set_term_criteria(&mut self, val: TermCriteria) -> Result<()>
Termination criteria of the training algorithm. You can specify the maximum number of iterations (maxCount) and/or how much the error could change between the iterations to make the algorithm continue (epsilon). Default value is TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, 0.01).
See also
setTermCriteria getTermCriteria
sourcefn set_backprop_weight_scale(&mut self, val: f64) -> Result<()>
fn set_backprop_weight_scale(&mut self, val: f64) -> Result<()>
BPROP: Strength of the weight gradient term. The recommended value is about 0.1. Default value is 0.1.
See also
setBackpropWeightScale getBackpropWeightScale
sourcefn set_backprop_momentum_scale(&mut self, val: f64) -> Result<()>
fn set_backprop_momentum_scale(&mut self, val: f64) -> Result<()>
BPROP: Strength of the momentum term (the difference between weights on the 2 previous iterations). This parameter provides some inertia to smooth the random fluctuations of the weights. It can vary from 0 (the feature is disabled) to 1 and beyond. The value 0.1 or so is good enough. Default value is 0.1.
See also
setBackpropMomentumScale getBackpropMomentumScale
sourcefn set_rprop_dw0(&mut self, val: f64) -> Result<()>
fn set_rprop_dw0(&mut self, val: f64) -> Result<()>
sourcefn set_rprop_dw_plus(&mut self, val: f64) -> Result<()>
fn set_rprop_dw_plus(&mut self, val: f64) -> Result<()>
RPROP: Increase factor .
It must be >1. Default value is 1.2.
See also
setRpropDWPlus getRpropDWPlus
sourcefn set_rprop_dw_minus(&mut self, val: f64) -> Result<()>
fn set_rprop_dw_minus(&mut self, val: f64) -> Result<()>
RPROP: Decrease factor .
It must be <1. Default value is 0.5.
See also
setRpropDWMinus getRpropDWMinus
sourcefn set_rprop_dw_min(&mut self, val: f64) -> Result<()>
fn set_rprop_dw_min(&mut self, val: f64) -> Result<()>
RPROP: Update-values lower limit .
It must be positive. Default value is FLT_EPSILON.
See also
setRpropDWMin getRpropDWMin
sourcefn set_rprop_dw_max(&mut self, val: f64) -> Result<()>
fn set_rprop_dw_max(&mut self, val: f64) -> Result<()>
RPROP: Update-values upper limit .
It must be >1. Default value is 50.
See also
setRpropDWMax getRpropDWMax
sourcefn set_anneal_initial_t(&mut self, val: f64) -> Result<()>
fn set_anneal_initial_t(&mut self, val: f64) -> Result<()>
ANNEAL: Update initial temperature. It must be >=0. Default value is 10.
See also
setAnnealInitialT getAnnealInitialT
sourcefn set_anneal_final_t(&mut self, val: f64) -> Result<()>
fn set_anneal_final_t(&mut self, val: f64) -> Result<()>
ANNEAL: Update final temperature. It must be >=0 and less than initialT. Default value is 0.1.
See also
setAnnealFinalT getAnnealFinalT
sourcefn set_anneal_cooling_ratio(&mut self, val: f64) -> Result<()>
fn set_anneal_cooling_ratio(&mut self, val: f64) -> Result<()>
ANNEAL: Update cooling ratio. It must be >0 and less than 1. Default value is 0.95.
See also
setAnnealCoolingRatio getAnnealCoolingRatio
sourcefn set_anneal_ite_per_step(&mut self, val: i32) -> Result<()>
fn set_anneal_ite_per_step(&mut self, val: i32) -> Result<()>
ANNEAL: Update iteration per step. It must be >0 . Default value is 10.
See also
setAnnealItePerStep getAnnealItePerStep
sourcefn set_anneal_energy_rng(&mut self, rng: &RNG) -> Result<()>
fn set_anneal_energy_rng(&mut self, rng: &RNG) -> Result<()>
Set/initialize anneal RNG