org.opencv.ml

## Class ANN_MLP

- java.lang.Object
- - org.opencv.core.Algorithm
  - - org.opencv.ml.StatModel
    - - org.opencv.ml.ANN_MLP

- Direct Known Subclasses:
    ANN_MLP_ANNEAL

      public class ANN_MLP
      extends StatModel

  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: REF: ml_intro_ann

- - ### Field Summary

    Fields
    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`

    - ### Fields inherited from class org.opencv.ml.StatModel

      `COMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL`

    - ### Fields inherited from class org.opencv.core.Algorithm

      `nativeObj`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ANN_MLP(long addr)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class org.opencv.ml.StatModel

      `calcError, empty, getVarCount, isClassifier, isTrained, predict, predict, predict, train, train, train`

    - ### Methods inherited from class org.opencv.core.Algorithm

      `clear, getDefaultName, getNativeObjAddr, save`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### IDENTITY

          public static final int IDENTITY

      See Also:
        Constant Field Values

    - #### SIGMOID_SYM

          public static final int SIGMOID_SYM

      See Also:
        Constant Field Values

    - #### GAUSSIAN

          public static final int GAUSSIAN

      See Also:
        Constant Field Values

    - #### RELU

          public static final int RELU

      See Also:
        Constant Field Values

    - #### LEAKYRELU

          public static final int LEAKYRELU

      See Also:
        Constant Field Values

    - #### BACKPROP

          public static final int BACKPROP

      See Also:
        Constant Field Values

    - #### RPROP

          public static final int RPROP

      See Also:
        Constant Field Values

    - #### ANNEAL

          public static final int ANNEAL

      See Also:
        Constant Field Values

    - #### UPDATE_WEIGHTS

          public static final int UPDATE_WEIGHTS

      See Also:
        Constant Field Values

    - #### NO_INPUT_SCALE

          public static final int NO_INPUT_SCALE

      See Also:
        Constant Field Values

    - #### NO_OUTPUT_SCALE

          public static final int NO_OUTPUT_SCALE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ANN_MLP

          protected ANN_MLP(long addr)

  - ### Method Detail

    - #### __fromPtr__

          public static ANN_MLP __fromPtr__(long addr)

    - #### getLayerSizes

          public Mat 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: setLayerSizes
      Returns:
        automatically generated

    - #### getWeights

          public Mat getWeights(int layerIdx)

    - #### create

          public 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. Note that the train method has optional flags: ANN_MLP::TrainFlags.
      Returns:
        automatically generated

    - #### load

          public 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. Load the ANN from this file again, by calling this function with the path to the file.
      Parameters:
        `filepath` - path to serialized ANN
      Returns:
        automatically generated

    - #### getTermCriteria

          public TermCriteria getTermCriteria()

      SEE: setTermCriteria
      Returns:
        automatically generated

    - #### getAnnealCoolingRatio

          public double getAnnealCoolingRatio()

      SEE: setAnnealCoolingRatio
      Returns:
        automatically generated

    - #### getAnnealFinalT

          public double getAnnealFinalT()

      SEE: setAnnealFinalT
      Returns:
        automatically generated

    - #### getAnnealInitialT

          public double getAnnealInitialT()

      SEE: setAnnealInitialT
      Returns:
        automatically generated

    - #### getBackpropMomentumScale

          public double getBackpropMomentumScale()

      SEE: setBackpropMomentumScale
      Returns:
        automatically generated

    - #### getBackpropWeightScale

          public double getBackpropWeightScale()

      SEE: setBackpropWeightScale
      Returns:
        automatically generated

    - #### getRpropDW0

          public double getRpropDW0()

      SEE: setRpropDW0
      Returns:
        automatically generated

    - #### getRpropDWMax

          public double getRpropDWMax()

      SEE: setRpropDWMax
      Returns:
        automatically generated

    - #### getRpropDWMin

          public double getRpropDWMin()

      SEE: setRpropDWMin
      Returns:
        automatically generated

    - #### getRpropDWMinus

          public double getRpropDWMinus()

      SEE: setRpropDWMinus
      Returns:
        automatically generated

    - #### getRpropDWPlus

          public double getRpropDWPlus()

      SEE: setRpropDWPlus
      Returns:
        automatically generated

    - #### getAnnealItePerStep

          public int getAnnealItePerStep()

      SEE: setAnnealItePerStep
      Returns:
        automatically generated

    - #### getTrainMethod

          public int getTrainMethod()

      Returns current training method
      Returns:
        automatically generated

    - #### setActivationFunction

          public void 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:
        `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.

    - #### setActivationFunction

          public void 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:
        `type` - The type of activation function. See ANN_MLP::ActivationFunctions.
        `param1` - The first parameter of the activation function, \(\alpha\). Default value is 0.

    - #### setActivationFunction

          public void 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:
        `type` - The type of activation function. See ANN_MLP::ActivationFunctions.

    - #### setAnnealCoolingRatio

          public void setAnnealCoolingRatio(double val)

      getAnnealCoolingRatio SEE: getAnnealCoolingRatio
      Parameters:
        `val` - automatically generated

    - #### setAnnealFinalT

          public void setAnnealFinalT(double val)

      getAnnealFinalT SEE: getAnnealFinalT
      Parameters:
        `val` - automatically generated

    - #### setAnnealInitialT

          public void setAnnealInitialT(double val)

      getAnnealInitialT SEE: getAnnealInitialT
      Parameters:
        `val` - automatically generated

    - #### setAnnealItePerStep

          public void setAnnealItePerStep(int val)

      getAnnealItePerStep SEE: getAnnealItePerStep
      Parameters:
        `val` - automatically generated

    - #### setBackpropMomentumScale

          public void setBackpropMomentumScale(double val)

      getBackpropMomentumScale SEE: getBackpropMomentumScale
      Parameters:
        `val` - automatically generated

    - #### setBackpropWeightScale

          public void setBackpropWeightScale(double val)

      getBackpropWeightScale SEE: getBackpropWeightScale
      Parameters:
        `val` - automatically generated

    - #### setLayerSizes

          public void 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: getLayerSizes
      Parameters:
        `_layer_sizes` - automatically generated

    - #### setRpropDW0

          public void setRpropDW0(double val)

      getRpropDW0 SEE: getRpropDW0
      Parameters:
        `val` - automatically generated

    - #### setRpropDWMax

          public void setRpropDWMax(double val)

      getRpropDWMax SEE: getRpropDWMax
      Parameters:
        `val` - automatically generated

    - #### setRpropDWMin

          public void setRpropDWMin(double val)

      getRpropDWMin SEE: getRpropDWMin
      Parameters:
        `val` - automatically generated

    - #### setRpropDWMinus

          public void setRpropDWMinus(double val)

      getRpropDWMinus SEE: getRpropDWMinus
      Parameters:
        `val` - automatically generated

    - #### setRpropDWPlus

          public void setRpropDWPlus(double val)

      getRpropDWPlus SEE: getRpropDWPlus
      Parameters:
        `val` - automatically generated

    - #### setTermCriteria

          public void setTermCriteria(TermCriteria val)

      getTermCriteria SEE: getTermCriteria
      Parameters:
        `val` - automatically generated

    - #### setTrainMethod

          public void setTrainMethod(int method,
                                     double param1,
                                     double param2)

      Sets training method and common parameters.
      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.

    - #### setTrainMethod

          public void setTrainMethod(int method,
                                     double param1)

      Sets training method and common parameters.
      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.

    - #### setTrainMethod

          public void setTrainMethod(int method)

      Sets training method and common parameters.
      Parameters:
        `method` - Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods.

    - #### finalize

          protected void finalize()
                           throws Throwable

      Overrides:
        `finalize` in class `StatModel`
      Throws:
        `Throwable`

Generated on Wed Oct 9 2019 16:55:37 UTC / OpenCV 3.4.8