OpenCV for Unity 2.6.5
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.MlModule.ANN_MLP Class Reference

Artificial Neural Networks - Multi-Layer Perceptrons. More...

Public Member Functions

double getAnnealCoolingRatio ()
 
double getAnnealFinalT ()
 
double getAnnealInitialT ()
 
int getAnnealItePerStep ()
 
double getBackpropMomentumScale ()
 
double getBackpropWeightScale ()
 
Mat getLayerSizes ()
 
double getRpropDW0 ()
 
double getRpropDWMax ()
 
double getRpropDWMin ()
 
double getRpropDWMinus ()
 
double getRpropDWPlus ()
 
TermCriteria getTermCriteria ()
 
double double double epsilon getTermCriteriaAsValueTuple ()
 
Vec3d getTermCriteriaAsVec3d ()
 
int getTrainMethod ()
 
Mat getWeights (int layerIdx)
 
void setActivationFunction (int type)
 
void setActivationFunction (int type, double param1)
 
void setActivationFunction (int type, double param1, double param2)
 
void setAnnealCoolingRatio (double val)
 
void setAnnealFinalT (double val)
 
void setAnnealInitialT (double val)
 
void setAnnealItePerStep (int val)
 
void setBackpropMomentumScale (double val)
 
void setBackpropWeightScale (double val)
 
void setLayerSizes (Mat _layer_sizes)
 
void setRpropDW0 (double val)
 
void setRpropDWMax (double val)
 
void setRpropDWMin (double val)
 
void setRpropDWMinus (double val)
 
void setRpropDWPlus (double val)
 
void setTermCriteria (in Vec3d val)
 
void setTermCriteria (in(double type, double maxCount, double epsilon) val)
 
void setTermCriteria (TermCriteria val)
 
void setTrainMethod (int method)
 
void setTrainMethod (int method, double param1)
 
void setTrainMethod (int method, double param1, double param2)
 
- Public Member Functions inherited from OpenCVForUnity.MlModule.StatModel
float calcError (TrainData data, bool test, Mat resp)
 Computes error on the training or test dataset.
 
override bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
int getVarCount ()
 Returns the number of variables in training samples.
 
bool isClassifier ()
 Returns true if the model is classifier.
 
bool isTrained ()
 Returns true if the model is trained.
 
virtual float predict (Mat samples)
 Predicts response(s) for the provided sample(s)
 
virtual float predict (Mat samples, Mat results)
 Predicts response(s) for the provided sample(s)
 
virtual float predict (Mat samples, Mat results, int flags)
 Predicts response(s) for the provided sample(s)
 
bool train (Mat samples, int layout, Mat responses)
 Trains the statistical model.
 
bool train (TrainData trainData)
 Trains the statistical model.
 
bool train (TrainData trainData, int flags)
 Trains the statistical model.
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
virtual void clear ()
 Clears the algorithm state.
 
virtual string getDefaultName ()
 
IntPtr getNativeObjAddr ()
 
void save (string filename)
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new ANN_MLP __fromPtr__ (IntPtr addr)
 
static ANN_MLP create ()
 Creates empty model.
 
static ANN_MLP load (string filepath)
 Loads and creates a serialized ANN from a file.
 
- Static Public Member Functions inherited from OpenCVForUnity.MlModule.StatModel
static new StatModel __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
static Algorithm __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Public Attributes

double double maxCount
 
double type
 

Static Public Attributes

const int ANNEAL = 2
 
const int BACKPROP = 0
 
const int GAUSSIAN = 2
 
const int IDENTITY = 0
 
const int LEAKYRELU = 4
 
const int NO_INPUT_SCALE = 2
 
const int NO_OUTPUT_SCALE = 4
 
const int RELU = 3
 
const int RPROP = 1
 
const int SIGMOID_SYM = 1
 
const int UPDATE_WEIGHTS = 1
 
- Static Public Attributes inherited from OpenCVForUnity.MlModule.StatModel
const int COMPRESSED_INPUT = 2
 
const int PREPROCESSED_INPUT = 4
 
const int RAW_OUTPUT = 1
 
const int UPDATE_MODEL = 1
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.MlModule.StatModel
override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Package Functions inherited from OpenCVForUnity.MlModule.StatModel
- Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject
- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

Artificial Neural Networks - Multi-Layer Perceptrons.

Unlike many other models in ML that are constructed and trained at once, in the MLP model these steps are separated. First, a network with the specified topology is created using the non-default constructor or the method ANN_MLP.create. All the weights are set to zeros. Then, the network is trained using a set of input and output vectors. The training procedure can be repeated more than once, that is, the weights can be adjusted based on the new training data.

Additional flags for StatModel.train are available: ANN_MLP::TrainFlags.

See also
ml_intro_ann

Member Function Documentation

◆ __fromPtr__()

static new ANN_MLP OpenCVForUnity.MlModule.ANN_MLP.__fromPtr__ ( IntPtr addr)
static

◆ create()

static ANN_MLP OpenCVForUnity.MlModule.ANN_MLP.create ( )
static

Creates empty model.

Use StatModel.train to train the model, Algorithm::load<ANN_MLP>(filename) to load the pre-trained model. Note that the train method has optional flags: ANN_MLP::TrainFlags.

◆ Dispose()

override void OpenCVForUnity.MlModule.ANN_MLP.Dispose ( bool disposing)
protectedvirtual

◆ getAnnealCoolingRatio()

double OpenCVForUnity.MlModule.ANN_MLP.getAnnealCoolingRatio ( )

◆ getAnnealFinalT()

double OpenCVForUnity.MlModule.ANN_MLP.getAnnealFinalT ( )
See also
setAnnealFinalT

◆ getAnnealInitialT()

double OpenCVForUnity.MlModule.ANN_MLP.getAnnealInitialT ( )

◆ getAnnealItePerStep()

int OpenCVForUnity.MlModule.ANN_MLP.getAnnealItePerStep ( )

◆ getBackpropMomentumScale()

double OpenCVForUnity.MlModule.ANN_MLP.getBackpropMomentumScale ( )

◆ getBackpropWeightScale()

double OpenCVForUnity.MlModule.ANN_MLP.getBackpropWeightScale ( )

◆ getLayerSizes()

Mat OpenCVForUnity.MlModule.ANN_MLP.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.

See also
setLayerSizes

◆ getRpropDW0()

double OpenCVForUnity.MlModule.ANN_MLP.getRpropDW0 ( )
See also
setRpropDW0

◆ getRpropDWMax()

double OpenCVForUnity.MlModule.ANN_MLP.getRpropDWMax ( )
See also
setRpropDWMax

◆ getRpropDWMin()

double OpenCVForUnity.MlModule.ANN_MLP.getRpropDWMin ( )
See also
setRpropDWMin

◆ getRpropDWMinus()

double OpenCVForUnity.MlModule.ANN_MLP.getRpropDWMinus ( )
See also
setRpropDWMinus

◆ getRpropDWPlus()

double OpenCVForUnity.MlModule.ANN_MLP.getRpropDWPlus ( )
See also
setRpropDWPlus

◆ getTermCriteria()

TermCriteria OpenCVForUnity.MlModule.ANN_MLP.getTermCriteria ( )
See also
setTermCriteria

◆ getTermCriteriaAsValueTuple()

double double double epsilon OpenCVForUnity.MlModule.ANN_MLP.getTermCriteriaAsValueTuple ( )

◆ getTermCriteriaAsVec3d()

Vec3d OpenCVForUnity.MlModule.ANN_MLP.getTermCriteriaAsVec3d ( )
See also
setTermCriteria

◆ getTrainMethod()

int OpenCVForUnity.MlModule.ANN_MLP.getTrainMethod ( )

Returns current training method

◆ getWeights()

Mat OpenCVForUnity.MlModule.ANN_MLP.getWeights ( int layerIdx)

◆ load()

static ANN_MLP OpenCVForUnity.MlModule.ANN_MLP.load ( string filepath)
static

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.

Parameters
filepathpath to serialized ANN

◆ setActivationFunction() [1/3]

void OpenCVForUnity.MlModule.ANN_MLP.setActivationFunction ( int type)

Initialize the activation function for each neuron. Currently the default and the only fully supported activation function is ANN_MLP.SIGMOID_SYM.

Parameters
typeThe type of activation function. See ANN_MLP::ActivationFunctions.
param1The first parameter of the activation function, \(\alpha\). Default value is 0.
param2The second parameter of the activation function, \(\beta\). Default value is 0.

◆ setActivationFunction() [2/3]

void OpenCVForUnity.MlModule.ANN_MLP.setActivationFunction ( int type,
double param1 )

Initialize the activation function for each neuron. Currently the default and the only fully supported activation function is ANN_MLP.SIGMOID_SYM.

Parameters
typeThe type of activation function. See ANN_MLP::ActivationFunctions.
param1The first parameter of the activation function, \(\alpha\). Default value is 0.
param2The second parameter of the activation function, \(\beta\). Default value is 0.

◆ setActivationFunction() [3/3]

void OpenCVForUnity.MlModule.ANN_MLP.setActivationFunction ( int type,
double param1,
double param2 )

Initialize the activation function for each neuron. Currently the default and the only fully supported activation function is ANN_MLP.SIGMOID_SYM.

Parameters
typeThe type of activation function. See ANN_MLP::ActivationFunctions.
param1The first parameter of the activation function, \(\alpha\). Default value is 0.
param2The second parameter of the activation function, \(\beta\). Default value is 0.

◆ setAnnealCoolingRatio()

void OpenCVForUnity.MlModule.ANN_MLP.setAnnealCoolingRatio ( double val)

◆ setAnnealFinalT()

void OpenCVForUnity.MlModule.ANN_MLP.setAnnealFinalT ( double val)
See also
getAnnealFinalT

◆ setAnnealInitialT()

void OpenCVForUnity.MlModule.ANN_MLP.setAnnealInitialT ( double val)

◆ setAnnealItePerStep()

void OpenCVForUnity.MlModule.ANN_MLP.setAnnealItePerStep ( int val)

◆ setBackpropMomentumScale()

void OpenCVForUnity.MlModule.ANN_MLP.setBackpropMomentumScale ( double val)

◆ setBackpropWeightScale()

void OpenCVForUnity.MlModule.ANN_MLP.setBackpropWeightScale ( double val)

◆ setLayerSizes()

void OpenCVForUnity.MlModule.ANN_MLP.setLayerSizes ( Mat _layer_sizes)

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

◆ setRpropDW0()

void OpenCVForUnity.MlModule.ANN_MLP.setRpropDW0 ( double val)
See also
getRpropDW0

◆ setRpropDWMax()

void OpenCVForUnity.MlModule.ANN_MLP.setRpropDWMax ( double val)
See also
getRpropDWMax

◆ setRpropDWMin()

void OpenCVForUnity.MlModule.ANN_MLP.setRpropDWMin ( double val)
See also
getRpropDWMin

◆ setRpropDWMinus()

void OpenCVForUnity.MlModule.ANN_MLP.setRpropDWMinus ( double val)
See also
getRpropDWMinus

◆ setRpropDWPlus()

void OpenCVForUnity.MlModule.ANN_MLP.setRpropDWPlus ( double val)
See also
getRpropDWPlus

◆ setTermCriteria() [1/3]

void OpenCVForUnity.MlModule.ANN_MLP.setTermCriteria ( in Vec3d val)
See also
getTermCriteria

◆ setTermCriteria() [2/3]

void OpenCVForUnity.MlModule.ANN_MLP.setTermCriteria ( in(double type, double maxCount, double epsilon) val)
See also
getTermCriteria

◆ setTermCriteria() [3/3]

void OpenCVForUnity.MlModule.ANN_MLP.setTermCriteria ( TermCriteria val)
See also
getTermCriteria

◆ setTrainMethod() [1/3]

void OpenCVForUnity.MlModule.ANN_MLP.setTrainMethod ( int method)

Sets training method and common parameters.

Parameters
methodDefault value is ANN_MLP.RPROP. See ANN_MLP::TrainingMethods.
param1passed to setRpropDW0 for ANN_MLP.RPROP and to setBackpropWeightScale for ANN_MLP.BACKPROP and to initialT for ANN_MLP.ANNEAL.
param2passed to setRpropDWMin for ANN_MLP.RPROP and to setBackpropMomentumScale for ANN_MLP.BACKPROP and to finalT for ANN_MLP.ANNEAL.

◆ setTrainMethod() [2/3]

void OpenCVForUnity.MlModule.ANN_MLP.setTrainMethod ( int method,
double param1 )

Sets training method and common parameters.

Parameters
methodDefault value is ANN_MLP.RPROP. See ANN_MLP::TrainingMethods.
param1passed to setRpropDW0 for ANN_MLP.RPROP and to setBackpropWeightScale for ANN_MLP.BACKPROP and to initialT for ANN_MLP.ANNEAL.
param2passed to setRpropDWMin for ANN_MLP.RPROP and to setBackpropMomentumScale for ANN_MLP.BACKPROP and to finalT for ANN_MLP.ANNEAL.

◆ setTrainMethod() [3/3]

void OpenCVForUnity.MlModule.ANN_MLP.setTrainMethod ( int method,
double param1,
double param2 )

Sets training method and common parameters.

Parameters
methodDefault value is ANN_MLP.RPROP. See ANN_MLP::TrainingMethods.
param1passed to setRpropDW0 for ANN_MLP.RPROP and to setBackpropWeightScale for ANN_MLP.BACKPROP and to initialT for ANN_MLP.ANNEAL.
param2passed to setRpropDWMin for ANN_MLP.RPROP and to setBackpropMomentumScale for ANN_MLP.BACKPROP and to finalT for ANN_MLP.ANNEAL.

Member Data Documentation

◆ ANNEAL

const int OpenCVForUnity.MlModule.ANN_MLP.ANNEAL = 2
static

◆ BACKPROP

const int OpenCVForUnity.MlModule.ANN_MLP.BACKPROP = 0
static

◆ GAUSSIAN

const int OpenCVForUnity.MlModule.ANN_MLP.GAUSSIAN = 2
static

◆ IDENTITY

const int OpenCVForUnity.MlModule.ANN_MLP.IDENTITY = 0
static

◆ LEAKYRELU

const int OpenCVForUnity.MlModule.ANN_MLP.LEAKYRELU = 4
static

◆ maxCount

double double OpenCVForUnity.MlModule.ANN_MLP.maxCount

◆ NO_INPUT_SCALE

const int OpenCVForUnity.MlModule.ANN_MLP.NO_INPUT_SCALE = 2
static

◆ NO_OUTPUT_SCALE

const int OpenCVForUnity.MlModule.ANN_MLP.NO_OUTPUT_SCALE = 4
static

◆ RELU

const int OpenCVForUnity.MlModule.ANN_MLP.RELU = 3
static

◆ RPROP

const int OpenCVForUnity.MlModule.ANN_MLP.RPROP = 1
static

◆ SIGMOID_SYM

const int OpenCVForUnity.MlModule.ANN_MLP.SIGMOID_SYM = 1
static

◆ type

double OpenCVForUnity.MlModule.ANN_MLP.type
See also
setTermCriteria

◆ UPDATE_WEIGHTS

const int OpenCVForUnity.MlModule.ANN_MLP.UPDATE_WEIGHTS = 1
static

The documentation for this class was generated from the following files: