ObjectDetectionRuntimeParameters Class Reference

Structure containing a set of runtime parameters for the object detection module. More...

Functions

 ObjectDetectionRuntimeParameters (const float detection_confidence_threshold=20.f, const std::vector< OBJECT_CLASS > &object_class_filter=std::vector< OBJECT_CLASS >{}, const std::map< OBJECT_CLASS, float > &object_class_detection_confidence_threshold=std::map< OBJECT_CLASS, float >{})
 Default constructor. More...
 
bool save (const String &filename, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON) const
 Saves the current set of parameters into a file to be reloaded with the load() method. More...
 
bool load (const String &filename, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON)
 Loads a set of parameters from the values contained in a previously saved file. More...
 
bool encode (String &serialized_content, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON) const
 Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string. More...
 
bool decode (const String &serialized_content, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON)
 Fill the structure from the serialized json object contained in the input string. More...
 
bool operator== (const ObjectDetectionRuntimeParameters &param1) const
 
bool operator!= (const ObjectDetectionRuntimeParameters &param1) const
 

Attributes

float detection_confidence_threshold
 Confidence threshold. More...
 
std::vector< OBJECT_CLASSobject_class_filter
 Defines which object types to detect and track. More...
 
std::map< OBJECT_CLASS, float > object_class_detection_confidence_threshold
 Map of confidence thresholds for each class (can be empty for some classes). More...
 

Detailed Description

Structure containing a set of runtime parameters for the object detection module.

The default constructor sets all parameters to their default settings.

Note
Parameters can be adjusted by the user.

Constructor and Destructor

◆ ObjectDetectionRuntimeParameters()

ObjectDetectionRuntimeParameters ( const float  detection_confidence_threshold = 20.f,
const std::vector< OBJECT_CLASS > &  object_class_filter = std::vector< OBJECT_CLASS >{},
const std::map< OBJECT_CLASS, float > &  object_class_detection_confidence_threshold = std::map< OBJECT_CLASS, float >{} 
)

Default constructor.

Parameters
detection_confidence_thresholdConfidence threshold.
object_class_filterObject class filter.
object_class_detection_confidence_thresholdMap of confidence threshold per classes.

Functions

◆ save()

bool save ( const String filename,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
) const

Saves the current set of parameters into a file to be reloaded with the load() method.

Parameters
filename: Name of the file which will be created to store the parameters (extension '.yml' will be added if not set).
Returns
True if the file was successfully saved, otherwise false.
Warning
For security reasons, the file must not already exist.
In case a file already exists, the method will return false and existing file will not be updated.

◆ load()

bool load ( const String filename,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
)

Loads a set of parameters from the values contained in a previously saved file.

Parameters
filename: Path to the file from which the parameters will be loaded (extension '.yml' will be added at the end of the filename if not detected).
Returns
True if the file was successfully loaded, otherwise false.

◆ encode()

bool encode ( String serialized_content,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
) const

Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string.

Parameters
serialized_contentoutput string containing the JSON Object
formatserialization format, default is JSON
Returns
True if file was successfully saved, otherwise false.

◆ decode()

bool decode ( const String serialized_content,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
)

Fill the structure from the serialized json object contained in the input string.

Parameters
serialized_contentinput string containing the JSON Object
formatserialization format, default is JSON
Returns
True if the decoding was successful, otherwise false.

◆ operator==()

bool operator== ( const ObjectDetectionRuntimeParameters param1) const

Comparison operator ==

Parameters
ObjectDetectionRuntimeParametersto compare
Returns
true if the two struct are identical

◆ operator!=()

bool operator!= ( const ObjectDetectionRuntimeParameters param1) const

Comparison operator !=

Parameters
ObjectDetectionRuntimeParametersto compare
Returns
true if the two struct are different

Variables

◆ detection_confidence_threshold

float detection_confidence_threshold

Confidence threshold.

From 1 to 100, with 1 meaning a low threshold, more uncertain objects and 99 very few but very precise objects.
Default: 20.f

Note
If the scene contains a lot of objects, increasing the confidence can slightly speed up the process, since every object instance is tracked.
detection_confidence_threshold is used as a fallback when sl::ObjectDetectionRuntimeParameters.object_class_detection_confidence_threshold is partially set.

◆ object_class_filter

std::vector<OBJECT_CLASS> object_class_filter

Defines which object types to detect and track.

Default: {} (all classes are tracked)

Note
Fewer object types can slightly speed up the process since every object is tracked.
Will output only the selected classes.

In order to get all the available classes, the filter vector must be empty :

std::vector< OBJECT_CLASS > object_class_filter
Defines which object types to detect and track.
Definition: Camera.hpp:1645

To select a set of specific object classes, like vehicles, persons and animals for instance:

◆ object_class_detection_confidence_threshold

std::map<OBJECT_CLASS, float> object_class_detection_confidence_threshold

Map of confidence thresholds for each class (can be empty for some classes).

Note
sl::ObjectDetectionRuntimeParameters.detection_confidence_threshold will be taken as fallback/default value.