Class ANN_MLP
- Namespace
- OpenCvSharp.ML
- Assembly
- OpenCvSharp.dll
Artificial Neural Networks - Multi-Layer Perceptrons.
public class ANN_MLP : StatModel, IDisposable, ICvPtrHolder
- Inheritance
-
ANN_MLP
- Implements
- Inherited Members
Constructors
ANN_MLP(nint)
Creates instance by raw pointer cv::ml::ANN_MLP*
protected ANN_MLP(nint p)
Parameters
pnint
Properties
BackpropMomentumScale
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.
public double BackpropMomentumScale { get; set; }
Property Value
BackpropWeightScale
Strength of the weight gradient term. The recommended value is about 0.1. Default value is 0.1.
public double BackpropWeightScale { get; set; }
Property Value
RpropDW0
Initial value Delta_0 of update-values Delta_{ij}. Default value is 0.1.
public double RpropDW0 { get; set; }
Property Value
RpropDWMax
Update-values upper limit Delta_{max}. It must be >1. Default value is 50.
public double RpropDWMax { get; set; }
Property Value
RpropDWMin
Update-values lower limit Delta_{min}. It must be positive. Default value is FLT_EPSILON.
public double RpropDWMin { get; set; }
Property Value
RpropDWMinus
Decrease factor eta^-. It must be >1. Default value is 0.5.
public double RpropDWMinus { get; set; }
Property Value
RpropDWPlus
Increase factor eta^+. It must be >1. Default value is 1.2.
public double RpropDWPlus { get; set; }
Property Value
TermCriteria
Termination criteria of the training algorithm.
public TermCriteria TermCriteria { get; set; }
Property Value
Methods
Create()
Creates the empty model.
public static ANN_MLP Create()
Returns
DisposeManaged()
Releases managed resources
protected override void DisposeManaged()
GetLayerSizes()
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.
public virtual Mat GetLayerSizes()
Returns
GetTrainMethod()
Returns current training method
public virtual ANN_MLP.TrainingMethods GetTrainMethod()
Returns
Load(string)
Loads and creates a serialized ANN from a file. Use ANN::save to serialize and store an ANN to disk. Load the ANN from this file again, by calling this function with the path to the file.
public static ANN_MLP Load(string filePath)
Parameters
filePathstringpath to serialized ANN
Returns
LoadFromString(string)
Loads algorithm from a String.
public static ANN_MLP LoadFromString(string strModel)
Parameters
strModelstringhe string variable containing the model you want to load.
Returns
SetActivationFunction(ActivationFunctions, double, double)
Initialize the activation function for each neuron. Currently the default and the only fully supported activation function is ANN_MLP::SIGMOID_SYM.
public virtual void SetActivationFunction(ANN_MLP.ActivationFunctions type, double param1 = 0, double param2 = 0)
Parameters
typeANN_MLP.ActivationFunctionsThe type of activation function. See ANN_MLP::ActivationFunctions.
param1doubleThe first parameter of the activation function, \f$\alpha\f$. Default value is 0.
param2doubleThe second parameter of the activation function, \f$\beta\f$. Default value is 0.
SetLayerSizes(InputArray)
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.
public virtual void SetLayerSizes(InputArray layerSizes)
Parameters
layerSizesInputArray
SetTrainMethod(TrainingMethods, double, double)
Sets training method and common parameters.
public virtual void SetTrainMethod(ANN_MLP.TrainingMethods method, double param1 = 0, double param2 = 0)
Parameters
methodANN_MLP.TrainingMethodsDefault value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods.
param1doublepassed to setRpropDW0 for ANN_MLP::RPROP and to setBackpropWeightScale for ANN_MLP::BACKPROP and to initialT for ANN_MLP::ANNEAL.
param2doublepassed to setRpropDWMin for ANN_MLP::RPROP and to setBackpropMomentumScale for ANN_MLP::BACKPROP and to finalT for ANN_MLP::ANNEAL.