![]() |
Visual Servoing Platform version 3.5.0
|
#include <vpDetectorDNN.h>
Inheritance diagram for vpDetectorDNN:Public Member Functions | |
| vpDetectorDNN () | |
| virtual | ~vpDetectorDNN () |
| virtual bool | detect (const vpImage< unsigned char > &I) |
| virtual bool | detect (const vpImage< vpRGBa > &I, std::vector< vpRect > &boundingBoxes) |
| std::vector< vpRect > | getDetectionBBs (bool afterNMS=true) const |
| std::vector< int > | getDetectionClassIds (bool afterNMS=true) const |
| std::vector< float > | getDetectionConfidence (bool afterNMS=true) const |
| void | readNet (const std::string &model, const std::string &config="", const std::string &framework="") |
| void | setConfidenceThreshold (float confThreshold) |
| void | setInputSize (int width, int height) |
| void | setMean (double meanR, double meanG, double meanB) |
| void | setNMSThreshold (float nmsThreshold) |
| void | setPreferableBackend (int backendId) |
| void | setPreferableTarget (int targetId) |
| void | setScaleFactor (double scaleFactor) |
| void | setSwapRB (bool swapRB) |
Inherited functionalities from vpDetectorBase | |
| vpRect | getBBox (size_t i) const |
| vpImagePoint | getCog (size_t i) const |
| std::vector< std::string > & | getMessage () |
| std::string & | getMessage (size_t i) |
| size_t | getNbObjects () const |
| std::vector< std::vector< vpImagePoint > > & | getPolygon () |
| std::vector< vpImagePoint > & | getPolygon (size_t i) |
| void | setTimeout (unsigned long timeout_ms) |
Protected Attributes | |
| std::vector< std::vector< vpImagePoint > > | m_polygon |
| std::vector< std::string > | m_message |
| size_t | m_nb_objects |
| unsigned long | m_timeout_ms |
This class is a wrapper over the OpenCV DNN module and specialized to handle object detection task.
Example is provided in tutorial-dnn-object-detection-live.cpp
Definition at line 52 of file vpDetectorDNN.h.
| vpDetectorDNN::vpDetectorDNN | ( | ) |
Definition at line 41 of file vpDetectorDNN.cpp.
|
virtual |
Definition at line 45 of file vpDetectorDNN.cpp.
|
virtual |
Object detection using OpenCV DNN module.
| I | : Input image. |
Implements vpDetectorBase.
Definition at line 55 of file vpDetectorDNN.cpp.
References vpImageConvert::convert(), and detect().
Referenced by detect().
|
virtual |
Object detection using OpenCV DNN module.
| I | : Input image. |
| boundingBoxes | : Vector of detection bounding boxes. |
Definition at line 69 of file vpDetectorDNN.cpp.
References vpImageConvert::convert(), vpDetectorBase::m_message, vpDetectorBase::m_nb_objects, and vpDetectorBase::m_polygon.
|
inherited |
Return the bounding box of the ith object.
Definition at line 92 of file vpDetectorBase.cpp.
References vpDetectorBase::m_polygon.
|
inherited |
Return the center of gravity location of the ith object.
Definition at line 79 of file vpDetectorBase.cpp.
References vpDetectorBase::m_polygon.
| std::vector< vpRect > vpDetectorDNN::getDetectionBBs | ( | bool | afterNMS = true | ) | const |
Get raw detection bounding boxes.
| afterNMS | If true, return detection bounding boxes after NMS |
Definition at line 118 of file vpDetectorDNN.cpp.
| std::vector< int > vpDetectorDNN::getDetectionClassIds | ( | bool | afterNMS = true | ) | const |
Get detection class ids.
| afterNMS | If true, returns class ids after NMS |
Definition at line 142 of file vpDetectorDNN.cpp.
| std::vector< float > vpDetectorDNN::getDetectionConfidence | ( | bool | afterNMS = true | ) | const |
Get detection confidences.
Definition at line 158 of file vpDetectorDNN.cpp.
|
inlineinherited |
Returns the contained message of the ith object if there is one.
Definition at line 106 of file vpDetectorBase.h.
|
inherited |
Returns the contained message of the ith object if there is one.
Definition at line 67 of file vpDetectorBase.cpp.
References vpException::badValue, vpDetectorBase::m_message, and vpDetectorBase::m_polygon.
|
inlineinherited |
Return the number of objects that are detected.
Definition at line 116 of file vpDetectorBase.h.
|
inlineinherited |
Returns object container box as a vector of points.
Definition at line 121 of file vpDetectorBase.h.
|
inherited |
Returns ith object container box as a vector of points.
Definition at line 55 of file vpDetectorBase.cpp.
References vpException::badValue, and vpDetectorBase::m_polygon.
| void vpDetectorDNN::readNet | ( | const std::string & | model, |
| const std::string & | config = "", |
||
| const std::string & | framework = "" |
||
| ) |
Read a network, see OpenCV readNet documentation for more information.
| model | Path to a binary file of model containing trained weights. The following file extensions are expected for models from different frameworks:
|
| config | Path to a text file of model containing network configuration. It could be a file with the following extensions:
|
| framework | Optional name of an origin framework of the model. Automatically detected if it is not set. |
Definition at line 355 of file vpDetectorDNN.cpp.
| void vpDetectorDNN::setConfidenceThreshold | ( | float | confThreshold | ) |
Set confidence threshold to filter the detections.
| confThreshold | Confidence threshold between [0, 1] |
Definition at line 369 of file vpDetectorDNN.cpp.
| void vpDetectorDNN::setInputSize | ( | int | width, |
| int | height | ||
| ) |
Set dimension to resize the image to the input blob.
| width | If <= 0, blob width is set to image width |
| height | If <= 0, blob height is set to image height |
Definition at line 379 of file vpDetectorDNN.cpp.
| void vpDetectorDNN::setMean | ( | double | meanR, |
| double | meanG, | ||
| double | meanB | ||
| ) |
Set mean subtraction values.
| meanR | Mean value for R-channel |
| meanG | Mean value for G-channel |
| meanB | Mean value for R-channel |
Definition at line 391 of file vpDetectorDNN.cpp.
| void vpDetectorDNN::setNMSThreshold | ( | float | nmsThreshold | ) |
Set Non-Maximum Suppression threshold, used to filter multiple detections at approximatively the same location.
| nmsThreshold | Non-Maximum Suppression threshold between [0, 1] |
Definition at line 401 of file vpDetectorDNN.cpp.
| void vpDetectorDNN::setPreferableBackend | ( | int | backendId | ) |
Set preferable backend for inference computation. See OpenCV setPreferableBackend documentation for more information.
| backendId | Backend identifier |
Definition at line 411 of file vpDetectorDNN.cpp.
| void vpDetectorDNN::setPreferableTarget | ( | int | targetId | ) |
Set preferable target for inference computation. See OpenCV setPreferableTarget documentation for more information.
| targetId | Target identifier |
Definition at line 421 of file vpDetectorDNN.cpp.
| void vpDetectorDNN::setScaleFactor | ( | double | scaleFactor | ) |
Set scale factor to normalize the range of pixel values.
Definition at line 428 of file vpDetectorDNN.cpp.
| void vpDetectorDNN::setSwapRB | ( | bool | swapRB | ) |
If true, swap R and B channel for mean subtraction. For instance when the network has been trained on RGB image format (OpenCV uses BGR convention).
Definition at line 437 of file vpDetectorDNN.cpp.
|
inlineinherited |
Set detector timeout in milli-seconds. When set to 0, there is no timeout.
Definition at line 129 of file vpDetectorBase.h.
Referenced by vpDetectorDataMatrixCode::vpDetectorDataMatrixCode().
|
protectedinherited |
Message attached to each object.
Definition at line 68 of file vpDetectorBase.h.
Referenced by vpDetectorAprilTag::detect(), vpDetectorDataMatrixCode::detect(), vpDetectorQRCode::detect(), detect(), and vpDetectorBase::getMessage().
|
protectedinherited |
Number of detected objects.
Definition at line 69 of file vpDetectorBase.h.
Referenced by vpDetectorAprilTag::detect(), vpDetectorDataMatrixCode::detect(), vpDetectorQRCode::detect(), and detect().
|
protectedinherited |
For each object, defines the polygon that contains the object.
Definition at line 67 of file vpDetectorBase.h.
Referenced by vpDetectorAprilTag::detect(), vpDetectorDataMatrixCode::detect(), vpDetectorQRCode::detect(), detect(), vpDetectorBase::getBBox(), vpDetectorBase::getCog(), vpDetectorBase::getMessage(), vpDetectorBase::getPolygon(), and vpDetectorAprilTag::getTagsCorners().
|
protectedinherited |
Detection timeout.
Definition at line 70 of file vpDetectorBase.h.
Referenced by vpDetectorDataMatrixCode::detect().