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.
|
Artificial Neural Networks - Multi-Layer Perceptrons. More...
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] |
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.
|
static |
|
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.
|
protectedvirtual |
Reimplemented from OpenCVForUnity.CoreModule.Algorithm.
double OpenCVForUnity.MlModule.ANN_MLP.getAnnealCoolingRatio | ( | ) |
double OpenCVForUnity.MlModule.ANN_MLP.getAnnealFinalT | ( | ) |
double OpenCVForUnity.MlModule.ANN_MLP.getAnnealInitialT | ( | ) |
int OpenCVForUnity.MlModule.ANN_MLP.getAnnealItePerStep | ( | ) |
double OpenCVForUnity.MlModule.ANN_MLP.getBackpropMomentumScale | ( | ) |
double OpenCVForUnity.MlModule.ANN_MLP.getBackpropWeightScale | ( | ) |
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.
double OpenCVForUnity.MlModule.ANN_MLP.getRpropDW0 | ( | ) |
double OpenCVForUnity.MlModule.ANN_MLP.getRpropDWMax | ( | ) |
double OpenCVForUnity.MlModule.ANN_MLP.getRpropDWMin | ( | ) |
double OpenCVForUnity.MlModule.ANN_MLP.getRpropDWMinus | ( | ) |
double OpenCVForUnity.MlModule.ANN_MLP.getRpropDWPlus | ( | ) |
TermCriteria OpenCVForUnity.MlModule.ANN_MLP.getTermCriteria | ( | ) |
int OpenCVForUnity.MlModule.ANN_MLP.getTrainMethod | ( | ) |
Returns current training method
Mat OpenCVForUnity.MlModule.ANN_MLP.getWeights | ( | int | layerIdx | ) |
|
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.
filepath | path to serialized ANN |
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.
type | The type of activation function. See ANN_MLP::ActivationFunctions. |
param1 | The first parameter of the activation function, \(\alpha\). Default value is 0. |
param2 | The second parameter of the activation function, \(\beta\). Default value is 0. |
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.
type | The type of activation function. See ANN_MLP::ActivationFunctions. |
param1 | The first parameter of the activation function, \(\alpha\). Default value is 0. |
param2 | The second parameter of the activation function, \(\beta\). Default value is 0. |
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.
type | The type of activation function. See ANN_MLP::ActivationFunctions. |
param1 | The first parameter of the activation function, \(\alpha\). Default value is 0. |
param2 | The second parameter of the activation function, \(\beta\). Default value is 0. |
void OpenCVForUnity.MlModule.ANN_MLP.setAnnealCoolingRatio | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setAnnealFinalT | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setAnnealInitialT | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setAnnealItePerStep | ( | int | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setBackpropMomentumScale | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setBackpropWeightScale | ( | double | val | ) |
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.
void OpenCVForUnity.MlModule.ANN_MLP.setRpropDW0 | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setRpropDWMax | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setRpropDWMin | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setRpropDWMinus | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setRpropDWPlus | ( | double | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setTermCriteria | ( | TermCriteria | val | ) |
void OpenCVForUnity.MlModule.ANN_MLP.setTrainMethod | ( | int | method, |
double | param1, | ||
double | param2 | ||
) |
Sets training method and common 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. |
void OpenCVForUnity.MlModule.ANN_MLP.setTrainMethod | ( | int | method, |
double | param1 | ||
) |
Sets training method and common 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. |
void OpenCVForUnity.MlModule.ANN_MLP.setTrainMethod | ( | int | method | ) |
Sets training method and common 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. |
const int OpenCVForUnity.MlModule.ANN_MLP.ANNEAL = 2 |
const int OpenCVForUnity.MlModule.ANN_MLP.BACKPROP = 0 |
const int OpenCVForUnity.MlModule.ANN_MLP.GAUSSIAN = 2 |
const int OpenCVForUnity.MlModule.ANN_MLP.IDENTITY = 0 |
const int OpenCVForUnity.MlModule.ANN_MLP.LEAKYRELU = 4 |
const int OpenCVForUnity.MlModule.ANN_MLP.NO_INPUT_SCALE = 2 |
const int OpenCVForUnity.MlModule.ANN_MLP.NO_OUTPUT_SCALE = 4 |
const int OpenCVForUnity.MlModule.ANN_MLP.RELU = 3 |
const int OpenCVForUnity.MlModule.ANN_MLP.RPROP = 1 |
const int OpenCVForUnity.MlModule.ANN_MLP.SIGMOID_SYM = 1 |
const int OpenCVForUnity.MlModule.ANN_MLP.UPDATE_WEIGHTS = 1 |