Visual Servoing Platform  version 3.5.1 under development (2023-06-13)
vpDetectorDNNOpenCV::NetConfig Struct Reference

#include <visp3/detection/vpDetectorDNNOpenCV.h>

Public Member Functions

 NetConfig (float confThresh, const float &nmsThresh, const std::vector< std::string > &classNames, const cv::Size &dnnInputSize, const double &filterSizeRatio=0.)
 
 NetConfig (float confThresh, const float &nmsThresh, const std::string &classNamesFile, const cv::Size &dnnInputSize, const double &filterSizeRatio=0.)
 

Static Public Member Functions

static std::vector< std::string > parseClassNamesFile (const std::string &filename)
 

Public Attributes

float m_confThreshold
 
float m_nmsThreshold
 
std::vector< std::string > m_classNames
 
cv::Size m_inputSize
 
double m_filterSizeRatio
 

Detailed Description

Structure containing some information required for the configuration of a vpDetectorDNNOpenCV object.

Examples
tutorial-dnn-object-detection-live.cpp.

Definition at line 171 of file vpDetectorDNNOpenCV.h.

Constructor & Destructor Documentation

◆ NetConfig() [1/2]

vpDetectorDNNOpenCV::NetConfig::NetConfig ( float  confThresh,
const float &  nmsThresh,
const std::vector< std::string > &  classNames,
const cv::Size &  dnnInputSize,
const double &  filterSizeRatio = 0. 
)
inline

Construct a new Net Config object.

Parameters
confThreshThe confidence threshold to keep a detection.
nmsThreshThe Non-Maximum Suppression threshold to merge overlapping detections.
classNamesA vector containing the list of classes the DNN can detect.
dnnInputSizeThe size of the input that the DNN is expecting.
filterSizeRatioThe threshold for the size filter that the user can chose to activate or not (see vpDetectorDNNOpenCV::filterDetectionSingleClassInput and vpDetectorDNNOpenCV::filterDetectionMultiClassInput methods for more information).

Definition at line 241 of file vpDetectorDNNOpenCV.h.

◆ NetConfig() [2/2]

vpDetectorDNNOpenCV::NetConfig::NetConfig ( float  confThresh,
const float &  nmsThresh,
const std::string &  classNamesFile,
const cv::Size &  dnnInputSize,
const double &  filterSizeRatio = 0. 
)
inline

Construct a new Net Config object.

Parameters
confThreshThe confidence threshold to keep a detection.
nmsThreshThe Non-Maximum Suppression threshold to merge overlapping detections.
classNamesFileThe path towards the file containing the classes names, written as a YAML string array or one class name by line.
dnnInputSizeThe size of the input that the DNN is expecting.
filterSizeRatioThe threshold for the size filter that the user can chose to activate or not (see vpDetectorDNNOpenCV::filterDetectionSingleClassInput and vpDetectorDNNOpenCV::filterDetectionMultiClassInput methods for more information).

Definition at line 260 of file vpDetectorDNNOpenCV.h.

Member Function Documentation

◆ parseClassNamesFile()

static std::vector<std::string> vpDetectorDNNOpenCV::NetConfig::parseClassNamesFile ( const std::string &  filename)
inlinestatic

Parse the file containing the list of classes the DNN can detect. These classes can be written either as a YAML array (i.e. ["classname_0", ... ,"classname_last"]) or with one classname by row (without quotes).

For example, in the case of a yaml file called my-classes.yaml, one content could be:

$ cat my-classes.yaml
[ "person", "bicycle", "car"]

And in the case of a text file called my-classes.txt, similar content could be:

$ cat my-classes.txt
person
bicycle
car
Parameters
filenameThe path towards the file containing the list of classes the DNN can detect.
Returns
std::vector<std::string> The list of classes the DNN can detect.

Definition at line 202 of file vpDetectorDNNOpenCV.h.

Referenced by vpDetectorDNNOpenCV::parseClassNamesFile().

Member Data Documentation

◆ m_classNames

std::vector<std::string> vpDetectorDNNOpenCV::NetConfig::m_classNames

Vector containing the names of the different classes the DNN can detect.

Definition at line 175 of file vpDetectorDNNOpenCV.h.

Referenced by vpDetectorDNNOpenCV::detect().

◆ m_confThreshold

◆ m_filterSizeRatio

◆ m_inputSize

cv::Size vpDetectorDNNOpenCV::NetConfig::m_inputSize

Size of the images the DNN can manipulate. The input images will be resized to match these dimensions.

Definition at line 176 of file vpDetectorDNNOpenCV.h.

Referenced by vpDetectorDNNOpenCV::detect(), vpDetectorDNNOpenCV::postProcess_YoloV5_V7(), vpDetectorDNNOpenCV::postProcess_YoloV8(), and vpDetectorDNNOpenCV::setInputSize().

◆ m_nmsThreshold

float vpDetectorDNNOpenCV::NetConfig::m_nmsThreshold

Threshold for Non-Maximum Suppression.

Definition at line 174 of file vpDetectorDNNOpenCV.h.

Referenced by vpDetectorDNNOpenCV::postProcess(), and vpDetectorDNNOpenCV::setNMSThreshold().