public class ANN_MLP extends StatModel
Modifier and Type | Field and Description |
---|---|
static int |
ANNEAL |
static int |
BACKPROP |
static int |
GAUSSIAN |
static int |
IDENTITY |
static int |
LEAKYRELU |
static int |
NO_INPUT_SCALE |
static int |
NO_OUTPUT_SCALE |
static int |
RELU |
static int |
RPROP |
static int |
SIGMOID_SYM |
static int |
UPDATE_WEIGHTS |
COMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL
Modifier | Constructor and Description |
---|---|
protected |
ANN_MLP(long addr) |
Modifier and Type | Method and Description |
---|---|
static ANN_MLP |
__fromPtr__(long addr) |
static ANN_MLP |
create()
Creates empty model
Use StatModel::train to train the model, Algorithm::load<ANN_MLP>(filename) to load the pre-trained model.
|
protected void |
finalize() |
double |
getAnnealCoolingRatio()
SEE: setAnnealCoolingRatio
|
double |
getAnnealFinalT()
SEE: setAnnealFinalT
|
double |
getAnnealInitialT()
SEE: setAnnealInitialT
|
int |
getAnnealItePerStep()
SEE: setAnnealItePerStep
|
double |
getBackpropMomentumScale()
SEE: setBackpropMomentumScale
|
double |
getBackpropWeightScale()
SEE: setBackpropWeightScale
|
Mat |
getLayerSizes()
Integer vector specifying the number of neurons in each layer including the input and output layers.
|
double |
getRpropDW0()
SEE: setRpropDW0
|
double |
getRpropDWMax()
SEE: setRpropDWMax
|
double |
getRpropDWMin()
SEE: setRpropDWMin
|
double |
getRpropDWMinus()
SEE: setRpropDWMinus
|
double |
getRpropDWPlus()
SEE: setRpropDWPlus
|
TermCriteria |
getTermCriteria()
SEE: setTermCriteria
|
int |
getTrainMethod()
Returns current training method
|
Mat |
getWeights(int layerIdx) |
static ANN_MLP |
load(String filepath)
Loads and creates a serialized ANN from a file
Use ANN::save to serialize and store an ANN to disk.
|
void |
setActivationFunction(int type)
Initialize the activation function for each neuron.
|
void |
setActivationFunction(int type,
double param1)
Initialize the activation function for each neuron.
|
void |
setActivationFunction(int type,
double param1,
double param2)
Initialize the activation function for each neuron.
|
void |
setAnnealCoolingRatio(double val)
getAnnealCoolingRatio SEE: getAnnealCoolingRatio
|
void |
setAnnealFinalT(double val)
getAnnealFinalT SEE: getAnnealFinalT
|
void |
setAnnealInitialT(double val)
getAnnealInitialT SEE: getAnnealInitialT
|
void |
setAnnealItePerStep(int val)
getAnnealItePerStep SEE: getAnnealItePerStep
|
void |
setBackpropMomentumScale(double val)
getBackpropMomentumScale SEE: getBackpropMomentumScale
|
void |
setBackpropWeightScale(double val)
getBackpropWeightScale SEE: getBackpropWeightScale
|
void |
setLayerSizes(Mat _layer_sizes)
Integer vector specifying the number of neurons in each layer including the input and output layers.
|
void |
setRpropDW0(double val)
getRpropDW0 SEE: getRpropDW0
|
void |
setRpropDWMax(double val)
getRpropDWMax SEE: getRpropDWMax
|
void |
setRpropDWMin(double val)
getRpropDWMin SEE: getRpropDWMin
|
void |
setRpropDWMinus(double val)
getRpropDWMinus SEE: getRpropDWMinus
|
void |
setRpropDWPlus(double val)
getRpropDWPlus SEE: getRpropDWPlus
|
void |
setTermCriteria(TermCriteria val)
getTermCriteria SEE: getTermCriteria
|
void |
setTrainMethod(int method)
Sets training method and common parameters.
|
void |
setTrainMethod(int method,
double param1)
Sets training method and common parameters.
|
void |
setTrainMethod(int method,
double param1,
double param2)
Sets training method and common parameters.
|
calcError, empty, getVarCount, isClassifier, isTrained, predict, predict, predict, train, train, train
clear, getDefaultName, getNativeObjAddr, save
public static final int IDENTITY
public static final int SIGMOID_SYM
public static final int GAUSSIAN
public static final int RELU
public static final int LEAKYRELU
public static final int UPDATE_WEIGHTS
public static final int NO_INPUT_SCALE
public static final int NO_OUTPUT_SCALE
public static final int BACKPROP
public static final int RPROP
public static final int ANNEAL
public static ANN_MLP __fromPtr__(long addr)
public Mat getLayerSizes()
public Mat getWeights(int layerIdx)
public static ANN_MLP create()
public static ANN_MLP load(String filepath)
filepath
- path to serialized ANNpublic TermCriteria getTermCriteria()
public double getAnnealCoolingRatio()
public double getAnnealFinalT()
public double getAnnealInitialT()
public double getBackpropMomentumScale()
public double getBackpropWeightScale()
public double getRpropDW0()
public double getRpropDWMax()
public double getRpropDWMin()
public double getRpropDWMinus()
public double getRpropDWPlus()
public int getAnnealItePerStep()
public int getTrainMethod()
public void setActivationFunction(int type, double param1, double param2)
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.public void setActivationFunction(int type, double param1)
type
- The type of activation function. See ANN_MLP::ActivationFunctions.param1
- The first parameter of the activation function, \(\alpha\). Default value is 0.public void setActivationFunction(int type)
type
- The type of activation function. See ANN_MLP::ActivationFunctions.public void setAnnealCoolingRatio(double val)
val
- automatically generatedpublic void setAnnealFinalT(double val)
val
- automatically generatedpublic void setAnnealInitialT(double val)
val
- automatically generatedpublic void setAnnealItePerStep(int val)
val
- automatically generatedpublic void setBackpropMomentumScale(double val)
val
- automatically generatedpublic void setBackpropWeightScale(double val)
val
- automatically generatedpublic void setLayerSizes(Mat _layer_sizes)
_layer_sizes
- automatically generatedpublic void setRpropDW0(double val)
val
- automatically generatedpublic void setRpropDWMax(double val)
val
- automatically generatedpublic void setRpropDWMin(double val)
val
- automatically generatedpublic void setRpropDWMinus(double val)
val
- automatically generatedpublic void setRpropDWPlus(double val)
val
- automatically generatedpublic void setTermCriteria(TermCriteria val)
val
- automatically generatedpublic void setTrainMethod(int method, double param1, double param2)
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.public void setTrainMethod(int method, double param1)
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.public void setTrainMethod(int method)
method
- Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods.Generated on Wed Oct 9 2019 23:24:43 UTC / OpenCV 4.1.2