DetectionModel
This class represents high-level API for object detection networks.
DetectionModel allows to set params for preprocessing input image. DetectionModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and return result detections. For DetectionModel SSD, Faster R-CNN, YOLO topologies are supported.
Member of Dnn
-
Create detection 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
modelBinary file contains trained weights.
configText file contains network configuration.
-
Create detection 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
modelBinary file contains trained weights.
-
Given the @p input frame, create input blob, run net and return result detections.
Declaration
Objective-C
- (void)detect:(nonnull Mat *)frame classIds:(nonnull IntVector *)classIds confidences:(nonnull FloatVector *)confidences boxes:(nonnull NSMutableArray<Rect2i *> *)boxes confThreshold:(float)confThreshold nmsThreshold:(float)nmsThreshold;Swift
func detect(frame: Mat, classIds: IntVector, confidences: FloatVector, boxes: NSMutableArray, confThreshold: Float, nmsThreshold: Float)Parameters
classIdsClass indexes in result detection.
confidencesA set of corresponding confidences.
boxesA set of bounding boxes.
confThresholdA threshold used to filter boxes by confidences.
nmsThresholdA threshold used in non maximum suppression.
-
Given the @p input frame, create input blob, run net and return result detections.
Declaration
Objective-C
- (void)detect:(nonnull Mat *)frame classIds:(nonnull IntVector *)classIds confidences:(nonnull FloatVector *)confidences boxes:(nonnull NSMutableArray<Rect2i *> *)boxes confThreshold:(float)confThreshold;Swift
func detect(frame: Mat, classIds: IntVector, confidences: FloatVector, boxes: NSMutableArray, confThreshold: Float)Parameters
classIdsClass indexes in result detection.
confidencesA set of corresponding confidences.
boxesA set of bounding boxes.
confThresholdA threshold used to filter boxes by confidences.
-
Given the @p input frame, create input blob, run net and return result detections.
Declaration
Objective-C
- (void)detect:(nonnull Mat *)frame classIds:(nonnull IntVector *)classIds confidences:(nonnull FloatVector *)confidences boxes:(nonnull NSMutableArray<Rect2i *> *)boxes;Swift
func detect(frame: Mat, classIds: IntVector, confidences: FloatVector, boxes: NSMutableArray)Parameters
classIdsClass indexes in result detection.
confidencesA set of corresponding confidences.
boxesA set of bounding boxes.
View on GitHub
DetectionModel Class Reference