Package org.opencv.dnn

## Class ClassificationModel

- java.lang.Object
- - org.opencv.dnn.Net
  - - org.opencv.dnn.Model
    - - org.opencv.dnn.ClassificationModel

-     public class ClassificationModel
      extends Model

  This class represents high-level API for classification models. ClassificationModel allows to set params for preprocessing input image. ClassificationModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and return top-1 prediction.

- - ### Field Summary

    - ### Fields inherited from class org.opencv.dnn.Net

      `nativeObj`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `ClassificationModel​(long addr)` |
    `` | `ClassificationModel​(java.lang.String model)` | Create classification model from network represented in one of the supported formats.
    `` | `ClassificationModel​(java.lang.String model, java.lang.String config)` | Create classification model from network represented in one of the supported formats.
    `` | `ClassificationModel​(Net network)` | Create model from deep learning network.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static ClassificationModel` | `__fromPtr__​(long addr)` |
    `void` | `classify​(Mat frame, int[] classId, float[] conf)` |
    `protected void` | `finalize()` |

    - ### Methods inherited from class org.opencv.dnn.Model

      `predict, setInputCrop, setInputMean, setInputParams, setInputParams, setInputParams, setInputParams, setInputParams, setInputParams, setInputScale, setInputSize, setInputSize, setInputSwapRB`

    - ### Methods inherited from class org.opencv.dnn.Net

      `connect, dump, dumpToFile, empty, enableFusion, forward, forward, forward, forward, forward, getFLOPS, getFLOPS, getFLOPS, getFLOPS, getLayer, getLayerId, getLayerNames, getLayersCount, getLayerTypes, getMemoryConsumption, getMemoryConsumption, getMemoryConsumption, getNativeObjAddr, getParam, getParam, getPerfProfile, getUnconnectedOutLayers, getUnconnectedOutLayersNames, readFromModelOptimizer, readFromModelOptimizer, setHalideScheduler, setInput, setInput, setInput, setInput, setInputShape, setInputsNames, setParam, setPreferableBackend, setPreferableTarget`

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

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

- - ### Constructor Detail

    - #### ClassificationModel

          protected ClassificationModel​(long addr)

    - #### ClassificationModel

          public ClassificationModel​(Net network)

      Create model from deep learning network.
      Parameters:
        `network` - Net object.

    - #### ClassificationModel

          public ClassificationModel​(java.lang.String model,
                                     java.lang.String config)

      Create classification model from network represented in one of the supported formats. An order of `model` and `config` arguments does not matter.
      Parameters:
        `model` - Binary file contains trained weights.
        `config` - Text file contains network configuration.

    - #### ClassificationModel

          public ClassificationModel​(java.lang.String model)

      Create classification model from network represented in one of the supported formats. An order of `model` and `config` arguments does not matter.
      Parameters:
        `model` - Binary file contains trained weights.

  - ### Method Detail

    - #### __fromPtr__

          public static ClassificationModel __fromPtr__​(long addr)

    - #### classify

          public void classify​(Mat frame,
                               int[] classId,
                               float[] conf)

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `Model`
      Throws:
        `java.lang.Throwable`