ClassificationModel

Objective-C

@interface ClassificationModel : Model

Swift

class ClassificationModel : 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.

Member of Dnn

Methods

  • Create model from deep learning network.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithNetwork:(nonnull Net *)network;

    Swift

    init(network: Net)

    Parameters

    network

    Net object.

  • Create classification model from network represented in one of the supported formats. An order of @p model and @p config arguments does not matter.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithModel:(nonnull NSString *)model
                                   config:(nonnull NSString *)config;

    Swift

    init(model: String, config: String)

    Parameters

    model

    Binary file contains trained weights.

    config

    Text file contains network configuration.

  • Create classification model from network represented in one of the supported formats. An order of @p model and @p config arguments does not matter.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithModel:(nonnull NSString *)model;

    Swift

    init(model: String)

    Parameters

    model

    Binary file contains trained weights.

  • Declaration

    Objective-C

    - (void)classify:(Mat*)frame classId:(int*)classId conf:(float*)conf NS_SWIFT_NAME(classify(frame:classId:conf:));

    Swift

    func classify(frame: Mat, classId: UnsafeMutablePointer<Int32>, conf: UnsafeMutablePointer<Float>)