Package org.opencv.dnn
Class DetectionModel
- java.lang.Object
-
- org.opencv.dnn.Net
-
- org.opencv.dnn.Model
-
- org.opencv.dnn.DetectionModel
-
public class DetectionModel extends Model
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.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DetectionModel(long addr)
DetectionModel(java.lang.String model)
Create detection model from network represented in one of the supported formats.DetectionModel(java.lang.String model, java.lang.String config)
Create detection model from network represented in one of the supported formats.DetectionModel(Net network)
Create model from deep learning network.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DetectionModel
__fromPtr__(long addr)
void
detect(Mat frame, MatOfInt classIds, MatOfFloat confidences, MatOfRect boxes)
Given theinput
frame, create input blob, run net and return result detections.void
detect(Mat frame, MatOfInt classIds, MatOfFloat confidences, MatOfRect boxes, float confThreshold)
Given theinput
frame, create input blob, run net and return result detections.void
detect(Mat frame, MatOfInt classIds, MatOfFloat confidences, MatOfRect boxes, float confThreshold, float nmsThreshold)
Given theinput
frame, create input blob, run net and return result detections.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, setInputsNames, setParam, setPreferableBackend, setPreferableTarget
-
-
-
-
Constructor Detail
-
DetectionModel
protected DetectionModel(long addr)
-
DetectionModel
public DetectionModel(Net network)
Create model from deep learning network.- Parameters:
network
- Net object.
-
DetectionModel
public DetectionModel(java.lang.String model, java.lang.String config)
Create detection model from network represented in one of the supported formats. An order ofmodel
andconfig
arguments does not matter.- Parameters:
model
- Binary file contains trained weights.config
- Text file contains network configuration.
-
DetectionModel
public DetectionModel(java.lang.String model)
Create detection model from network represented in one of the supported formats. An order ofmodel
andconfig
arguments does not matter.- Parameters:
model
- Binary file contains trained weights.
-
-
Method Detail
-
__fromPtr__
public static DetectionModel __fromPtr__(long addr)
-
detect
public void detect(Mat frame, MatOfInt classIds, MatOfFloat confidences, MatOfRect boxes, float confThreshold, float nmsThreshold)
Given theinput
frame, create input blob, run net and return result detections.- Parameters:
classIds
- Class indexes in result detection.confidences
- A set of corresponding confidences.boxes
- A set of bounding boxes.confThreshold
- A threshold used to filter boxes by confidences.nmsThreshold
- A threshold used in non maximum suppression.frame
- automatically generated
-
detect
public void detect(Mat frame, MatOfInt classIds, MatOfFloat confidences, MatOfRect boxes, float confThreshold)
Given theinput
frame, create input blob, run net and return result detections.- Parameters:
classIds
- Class indexes in result detection.confidences
- A set of corresponding confidences.boxes
- A set of bounding boxes.confThreshold
- A threshold used to filter boxes by confidences.frame
- automatically generated
-
detect
public void detect(Mat frame, MatOfInt classIds, MatOfFloat confidences, MatOfRect boxes)
Given theinput
frame, create input blob, run net and return result detections.- Parameters:
classIds
- Class indexes in result detection.confidences
- A set of corresponding confidences.boxes
- A set of bounding boxes.frame
- automatically generated
-
-