Class 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.
    • Constructor Detail

      • ClassificationModel

        protected ClassificationModel​(long addr)
      • 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.
      • ClassificationModel

        public ClassificationModel​(Net network)
        Create model from deep learning network.
        Parameters:
        network - Net object.
    • Method Detail

      • setEnableSoftmaxPostProcessing

        public ClassificationModel setEnableSoftmaxPostProcessing​(boolean enable)
        Set enable/disable softmax post processing option. If this option is true, softmax is applied after forward inference within the classify() function to convert the confidences range to [0.0-1.0]. This function allows you to toggle this behavior. Please turn true when not contain softmax layer in model.
        Parameters:
        enable - Set enable softmax post processing within the classify() function.
        Returns:
        automatically generated
      • getEnableSoftmaxPostProcessing

        public boolean getEnableSoftmaxPostProcessing()
        Get enable/disable softmax post processing option. This option defaults to false, softmax post processing is not applied within the classify() function.
        Returns:
        automatically generated
      • 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