OpenCV for Unity  2.6.3
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.
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
OpenCVForUnity.MlModule.ANN_MLP Class Reference

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

Inheritance diagram for OpenCVForUnity.MlModule.ANN_MLP:
OpenCVForUnity.MlModule.StatModel OpenCVForUnity.CoreModule.Algorithm OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

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

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

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.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- 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

◆ 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,
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.

◆ 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)

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()

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

◆ setTrainMethod() [1/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.

◆ 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)

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

◆ BACKPROP

const int OpenCVForUnity.MlModule.ANN_MLP.BACKPROP = 0

◆ GAUSSIAN

const int OpenCVForUnity.MlModule.ANN_MLP.GAUSSIAN = 2

◆ IDENTITY

const int OpenCVForUnity.MlModule.ANN_MLP.IDENTITY = 0

◆ LEAKYRELU

const int OpenCVForUnity.MlModule.ANN_MLP.LEAKYRELU = 4

◆ NO_INPUT_SCALE

const int OpenCVForUnity.MlModule.ANN_MLP.NO_INPUT_SCALE = 2

◆ NO_OUTPUT_SCALE

const int OpenCVForUnity.MlModule.ANN_MLP.NO_OUTPUT_SCALE = 4

◆ RELU

const int OpenCVForUnity.MlModule.ANN_MLP.RELU = 3

◆ RPROP

const int OpenCVForUnity.MlModule.ANN_MLP.RPROP = 1

◆ SIGMOID_SYM

const int OpenCVForUnity.MlModule.ANN_MLP.SIGMOID_SYM = 1

◆ UPDATE_WEIGHTS

const int OpenCVForUnity.MlModule.ANN_MLP.UPDATE_WEIGHTS = 1

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