@Namespace(value="cv::ml") @Properties(inherit=opencv_ml.class) public class ANN_MLP extends StatModel
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.
ml_intro_ann
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Modifier and Type | Field and Description |
---|---|
static int |
ANNEAL
enum cv::ml::ANN_MLP::TrainingMethods
|
static int |
BACKPROP
enum cv::ml::ANN_MLP::TrainingMethods
|
static int |
GAUSSIAN
enum cv::ml::ANN_MLP::ActivationFunctions
|
static int |
IDENTITY
enum cv::ml::ANN_MLP::ActivationFunctions
|
static int |
LEAKYRELU
enum cv::ml::ANN_MLP::ActivationFunctions
|
static int |
NO_INPUT_SCALE
enum cv::ml::ANN_MLP::TrainFlags
|
static int |
NO_OUTPUT_SCALE
enum cv::ml::ANN_MLP::TrainFlags
|
static int |
RELU
enum cv::ml::ANN_MLP::ActivationFunctions
|
static int |
RPROP
enum cv::ml::ANN_MLP::TrainingMethods
|
static int |
SIGMOID_SYM
enum cv::ml::ANN_MLP::ActivationFunctions
|
static int |
UPDATE_WEIGHTS
enum cv::ml::ANN_MLP::TrainFlags
|
COMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL
Constructor and Description |
---|
ANN_MLP(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
static ANN_MLP |
create()
\brief Creates empty model
|
double |
getAnnealCoolingRatio() |
double |
getAnnealFinalT() |
double |
getAnnealInitialT() |
int |
getAnnealItePerStep() |
double |
getBackpropMomentumScale() |
double |
getBackpropWeightScale() |
Mat |
getLayerSizes()
Integer vector specifying the number of neurons in each layer including the input and output layers.
|
double |
getRpropDW0() |
double |
getRpropDWMax() |
double |
getRpropDWMin() |
double |
getRpropDWMinus() |
double |
getRpropDWPlus() |
TermCriteria |
getTermCriteria() |
int |
getTrainMethod()
Returns current training method
|
Mat |
getWeights(int layerIdx) |
static ANN_MLP |
load(BytePointer filepath)
\brief Loads and creates a serialized ANN from a file
Use ANN::save to serialize and store an ANN to disk.
|
static ANN_MLP |
load(String filepath) |
void |
setActivationFunction(int type) |
void |
setActivationFunction(int type,
double param1,
double param2)
Initialize the activation function for each neuron.
|
void |
setAnnealCoolingRatio(double val)
\copybrief getAnnealCoolingRatio @see getAnnealCoolingRatio
|
void |
setAnnealEnergyRNG(RNG rng)
\brief Set/initialize anneal RNG
|
void |
setAnnealFinalT(double val)
\copybrief getAnnealFinalT @see getAnnealFinalT
|
void |
setAnnealInitialT(double val)
\copybrief getAnnealInitialT @see getAnnealInitialT
|
void |
setAnnealItePerStep(int val)
\copybrief getAnnealItePerStep @see getAnnealItePerStep
|
void |
setBackpropMomentumScale(double val)
\copybrief getBackpropMomentumScale @see getBackpropMomentumScale
|
void |
setBackpropWeightScale(double val)
\copybrief getBackpropWeightScale @see getBackpropWeightScale
|
void |
setLayerSizes(GpuMat _layer_sizes) |
void |
setLayerSizes(Mat _layer_sizes)
Integer vector specifying the number of neurons in each layer including the input and output layers.
|
void |
setLayerSizes(UMat _layer_sizes) |
void |
setRpropDW0(double val)
\copybrief getRpropDW0 @see getRpropDW0
|
void |
setRpropDWMax(double val)
\copybrief getRpropDWMax @see getRpropDWMax
|
void |
setRpropDWMin(double val)
\copybrief getRpropDWMin @see getRpropDWMin
|
void |
setRpropDWMinus(double val)
\copybrief getRpropDWMinus @see getRpropDWMinus
|
void |
setRpropDWPlus(double val)
\copybrief getRpropDWPlus @see getRpropDWPlus
|
void |
setTermCriteria(TermCriteria val)
\copybrief getTermCriteria @see getTermCriteria
|
void |
setTrainMethod(int method) |
void |
setTrainMethod(int method,
double param1,
double param2)
Sets training method and common parameters.
|
calcError, calcError, calcError, empty, getVarCount, isClassifier, isTrained, predict, predict, predict, predict, predict, predict, train, train, train, train, train
loadANN_MLP, loadANN_MLP, loadBoost, loadBoost, loadDTrees, loadDTrees, loadEM, loadEM, loadKNearest, loadKNearest, loadLogisticRegression, loadLogisticRegression, loadNormalBayesClassifier, loadNormalBayesClassifier, loadRTrees, loadRTrees, loadSVM, loadSVM
clear, getDefaultName, position, read, save, save, write, write, write
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
public static final int BACKPROP
public static final int RPROP
public static final int ANNEAL
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 ANN_MLP(Pointer p)
Pointer.Pointer(Pointer)
.public 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)
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)
public void setLayerSizes(@ByVal Mat _layer_sizes)
getLayerSizes
@ByVal public Mat getLayerSizes()
setLayerSizes
@ByVal public TermCriteria getTermCriteria()
setTermCriteria
public void setTermCriteria(@ByVal TermCriteria val)
public double getBackpropWeightScale()
setBackpropWeightScale
public void setBackpropWeightScale(double val)
public double getBackpropMomentumScale()
setBackpropMomentumScale
public void setBackpropMomentumScale(double val)
public double getRpropDW0()
setRpropDW0
public void setRpropDW0(double val)
public double getRpropDWPlus()
setRpropDWPlus
public void setRpropDWPlus(double val)
public double getRpropDWMinus()
setRpropDWMinus
public void setRpropDWMinus(double val)
public double getRpropDWMin()
setRpropDWMin
public void setRpropDWMin(double val)
public double getRpropDWMax()
setRpropDWMax
public void setRpropDWMax(double val)
public double getAnnealInitialT()
setAnnealInitialT
public void setAnnealInitialT(double val)
public double getAnnealFinalT()
setAnnealFinalT
public void setAnnealFinalT(double val)
public double getAnnealCoolingRatio()
setAnnealCoolingRatio
public void setAnnealCoolingRatio(double val)
public int getAnnealItePerStep()
setAnnealItePerStep
public void setAnnealItePerStep(int val)
public void setAnnealEnergyRNG(@Const @ByRef RNG rng)
@opencv_core.Ptr public static ANN_MLP create()
Use StatModel::train to train the model, Algorithm::load\
@opencv_core.Ptr public static ANN_MLP load(@opencv_core.Str BytePointer filepath)
filepath
- path to serialized ANN@opencv_core.Ptr public static ANN_MLP load(@opencv_core.Str String filepath)
Copyright © 2020. All rights reserved.