@Namespace(value="cv::ml") public static class opencv_ml.ANN_MLP extends opencv_ml.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.
\sa \ref ml_intro_ann
| 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(org.bytedeco.javacpp.Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static opencv_ml.ANN_MLP |
create()
\brief Creates empty model
|
double |
getAnnealCoolingRatio() |
double |
getAnnealFinalT() |
double |
getAnnealInitialT() |
int |
getAnnealItePerStep() |
double |
getBackpropMomentumScale() |
double |
getBackpropWeightScale() |
opencv_core.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() |
opencv_core.TermCriteria |
getTermCriteria() |
int |
getTrainMethod()
Returns current training method
|
opencv_core.Mat |
getWeights(int layerIdx) |
static opencv_ml.ANN_MLP |
load(org.bytedeco.javacpp.BytePointer filepath)
\brief Loads and creates a serialized ANN from a file
Use ANN::save to serialize and store an ANN to disk.
|
static opencv_ml.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(opencv_core.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(opencv_core.GpuMat _layer_sizes) |
void |
setLayerSizes(opencv_core.Mat _layer_sizes)
Integer vector specifying the number of neurons in each layer including the input and output layers.
|
void |
setLayerSizes(opencv_core.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(opencv_core.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, trainloadANN_MLP, loadANN_MLP, loadBoost, loadBoost, loadDTrees, loadDTrees, loadEM, loadEM, loadKNearest, loadKNearest, loadLogisticRegression, loadLogisticRegression, loadNormalBayesClassifier, loadNormalBayesClassifier, loadRTrees, loadRTrees, loadSVM, loadSVMclear, getDefaultName, position, read, save, save, write, write, writeaddress, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic 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(org.bytedeco.javacpp.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, \f$\alpha\f$. Default value is 0.param2 - The second parameter of the activation function, \f$\beta\f$. Default value is 0.public void setActivationFunction(int type)
public void setLayerSizes(@ByVal
opencv_core.Mat _layer_sizes)
public void setLayerSizes(@ByVal
opencv_core.UMat _layer_sizes)
public void setLayerSizes(@ByVal
opencv_core.GpuMat _layer_sizes)
@ByVal public opencv_core.Mat getLayerSizes()
@ByVal public opencv_core.TermCriteria getTermCriteria()
setTermCriteriapublic void setTermCriteria(@ByVal
opencv_core.TermCriteria val)
public double getBackpropWeightScale()
setBackpropWeightScalepublic void setBackpropWeightScale(double val)
public double getBackpropMomentumScale()
setBackpropMomentumScalepublic void setBackpropMomentumScale(double val)
public double getRpropDW0()
setRpropDW0public void setRpropDW0(double val)
public double getRpropDWPlus()
setRpropDWPluspublic void setRpropDWPlus(double val)
public double getRpropDWMinus()
setRpropDWMinuspublic void setRpropDWMinus(double val)
public double getRpropDWMin()
setRpropDWMinpublic void setRpropDWMin(double val)
public double getRpropDWMax()
setRpropDWMaxpublic void setRpropDWMax(double val)
public double getAnnealInitialT()
setAnnealInitialTpublic void setAnnealInitialT(double val)
public double getAnnealFinalT()
setAnnealFinalTpublic void setAnnealFinalT(double val)
public double getAnnealCoolingRatio()
setAnnealCoolingRatiopublic void setAnnealCoolingRatio(double val)
public int getAnnealItePerStep()
setAnnealItePerSteppublic void setAnnealItePerStep(int val)
public void setAnnealEnergyRNG(@Const @ByRef
opencv_core.RNG rng)
@ByVal public opencv_core.Mat getWeights(int layerIdx)
@opencv_core.Ptr public static opencv_ml.ANN_MLP create()
Use StatModel::train to train the model, Algorithm::load\
@opencv_core.Ptr public static opencv_ml.ANN_MLP load(@opencv_core.Str org.bytedeco.javacpp.BytePointer filepath)
filepath - path to serialized ANN@opencv_core.Ptr public static opencv_ml.ANN_MLP load(@opencv_core.Str String filepath)
Copyright © 2018. All rights reserved.