DeepSight SDK  3.0.0
DeepSight SDK - crowd face analysis
ds::Settings Class Reference

DeepSight SDK settings class. More...

Public Types

enum  OperationMode : int { OperationMode::DEVELOPMENT, OperationMode::RELEASE_LIFETIME, OperationMode::RELEASE_SESSION }
 The mode the SDK should operate when authenticating. More...
 
enum  LogLevel : int {
  LogLevel::TRACE, LogLevel::DEBUG, LogLevel::INFO, LogLevel::WARN,
  LogLevel::ERR, LogLevel::CRITICAL
}
 The log-level that should internally be used by the SDK. More...
 
enum  DnnTarget : int { DnnTarget::CPU, DnnTarget::GPU, DnnTarget::GPU_MT }
 Target processor on which the SDK's neural networks should execute. More...
 
enum  TrackerFps : int { TrackerFps::DYNAMIC, TrackerFps::FPS_30, TrackerFps::FPS_10, TrackerFps::FPS_5 }
 Frame processing speed for which the face counting or people counting algorithm should be tuned. More...
 
enum  Range : int { Range::REGULAR, Range::LONG }
 Selector for switching the type of Face Detector to use. More...
 
enum  NetworkType : int { NetworkType::NORMAL, NetworkType::QUANTIZED }
 Selector for the type of network to use when performing analysis. The SDK offers two types of networks to use, normal or quantized networks. The normal networks are used for the best accuracy while the quantized networks are optimized faster execution. More...
 

Public Member Functions

void load (const std::string &filePath)
 Loads an ini settings file into the ds::Settings instance. More...
 
void save (const std::string &filePath)
 Saves the object's parameters into a DeepSight settings ini file. More...
 
bool operator!= (const Settings &settings) const
 Returns true if the this object is not equal to settings. Inequality is tested member-wise.
 
bool operator== (const Settings &settings) const
 Returns true if the this object is equal to settings. Equality is tested member-wise.
 
bool cpuTargetEnabled () const
 Returns true if the dnnTarget value for this settings object is set to 'CPU'.
 
bool gpuTargetEnabled () const
 Returns true if the dnnTarget value for this settings object is set to 'GPU' or 'GPU_MT'.
 

Public Attributes

std::string neuralNetworksPath = ""
 Path of the directory containing the SDK neural network files. More...
 
std::string licenseKey = ""
 License key used for authenticating the SDK.
 
std::string lifetimeAuthFile = ""
 Path to file where the authorization for the lifetime release license is saved. More...
 
OperationMode operationMode = OperationMode::DEVELOPMENT
 Operation mode the SDK should authenticate with.
 
LogLevel logLevel = LogLevel::INFO
 Log-level the SDK should operate with. Accepted enum values are 'INFO', 'WARN', 'ERR', and 'CRITICAL'. 'TRACE' and 'DEBUG' are reserved for internal use.
 
DnnTarget dnnTarget = DnnTarget::CPU
 Target processor on which the SDK's neural networks should execute. Accepted enum values are 'CPU', 'GPU', and 'GPU_MT'. More...
 
TrackerFps bodyTrackFps = TrackerFps::DYNAMIC
 Tunes the people counting algorithm to the video input fps. Use ds::Settings::DYNAMIC for live feed input cameras and use ds::Settings::FPS_30 for video files (most commonly encoded at 30 fps).
 
TrackerFps faceTrackFps = TrackerFps::DYNAMIC
 Tunes the face counting algorithm to the video input fps. Use ds::Settings::DYNAMIC for live feed input cameras and use ds::Settings::FPS_30 for video files (most commonly encoded at 30 fps).
 
NetworkType networkType = NetworkType::NORMAL
 Selects the type of networks that the SDK should use. Accepted enum values are 'NORMAL' and 'QUANTIZED'.
 
bool useAge = true
 Tells the SDK whether it should perform age estimation for each detected face.
 
bool useGender = true
 Tells the SDK whether it should perform gender estimation for each detected face.
 
bool useHeadpose = true
 Tells the SDK whether it should perform head pose estimation for each detected face.
 
bool useSmile = true
 Tells the SDK whether it should perform smile estimation for each detected face.
 
bool useFaceMask = true
 Tells the SDK whether it should perform face mask estimation for each detected face.
 
bool useEmotions = true
 Tells the SDK whether it should perform emotion estimation for each detected face.
 
float faceConfidenceThreshold = 0.8f
 Face confidence threshold. More...
 
int maxNumFaces = -1
 Controls the maximum number of faces that will be returned per frame after detection. A value of -1 (default) indicates no limit.
 
int minFaceSize = 0
 Unless set to 0, faces smaller than this value will be discarded after detection.
 
int maxFaceSize = 0
 Unless set to 0, faces bigger than this value will be discarded after detection.
 
Range detectionRange = Range::REGULAR
 Selects the face detector to be used. More...
 
int numThreads = -1
 Controls the number of threads used to execute parallel computation regions, like inference. More...
 

Detailed Description

DeepSight SDK settings class.

The ds::Settings class is a container for configuration parameters used during runtime. By changing the settings values it is possible to control the SDK behavior.

Member Enumeration Documentation

◆ DnnTarget

enum ds::Settings::DnnTarget : int
strong

Target processor on which the SDK's neural networks should execute.

Enumerator
CPU 

Uses the CPU for performing inference on the networks.

GPU 

Uses the GPU for accelerating the inference on the networks. Refer to the OpenCL acceleration OpenCL section.

GPU_MT 

Uses the GPU for accelerating the inference performed on the SDK's networks. Inference of the different networks will be performed in parallel. Refer to the OpenCL acceleration OpenCL section.

◆ LogLevel

enum ds::Settings::LogLevel : int
strong

The log-level that should internally be used by the SDK.

Enumerator
TRACE 

Trace logging level (reserved for internal use).

DEBUG 

Debug logging level (reserved for internal use).

INFO 

Info logging level.

WARN 

Warning logging level.

ERR 

Error logging level.

CRITICAL 

Critical logging level.

◆ NetworkType

enum ds::Settings::NetworkType : int
strong

Selector for the type of network to use when performing analysis. The SDK offers two types of networks to use, normal or quantized networks. The normal networks are used for the best accuracy while the quantized networks are optimized faster execution.

Enumerator
NORMAL 

Use the default networks for optimal accuracy.

QUANTIZED 

Use the quantized networks for higher performance.

◆ OperationMode

enum ds::Settings::OperationMode : int
strong

The mode the SDK should operate when authenticating.

The SDK license can operate in different modalities. This enumerations holds the modalities the SDK can use the license with.

Enumerator
DEVELOPMENT 

Uses the license in development mode.

RELEASE_LIFETIME 

Uses the license in lifetime release mode.

RELEASE_SESSION 

Uses the license in session release mode.

◆ Range

enum ds::Settings::Range : int
strong

Selector for switching the type of Face Detector to use.

Enumerator
REGULAR 

Use the regular range Face Detector. This detector is useful if you want to detect people on a short to medium range and save on computation resources. This is the default Face Detector and detects at the same range compared to previous versions of the SDK.

LONG 

Use the long range Face Detector. This detector is useful if you want to detect people on a medium to long range and is computationally more expensive.

◆ TrackerFps

enum ds::Settings::TrackerFps : int
strong

Frame processing speed for which the face counting or people counting algorithm should be tuned.

Enumerator
DYNAMIC 

Dynamically tunes the tracker to the current fps speed. To be used with real-time input like webcams of IP cameras.

FPS_30 

Tunes the tracker to an input speed of 30 fps. To be used only with video files encoded at about 30 fps (most common encoding).

FPS_10 

Tunes the tracker to an input speed of 10 fps. To be used only with video files encoded at about 10 fps (almost never used).

FPS_5 

Tunes the tracker to an input speed of 5 fps. To be used only with video files encoded at about 5 fps (almost never used).

Member Function Documentation

◆ load()

void ds::Settings::load ( const std::string &  filePath)

Loads an ini settings file into the ds::Settings instance.

Parameters
filePathPath of a file storing DeepSight settings.

Throws an std::runtime_error if the file cannot be loaded.

Example usage:

try
{
s.load( "/path/to/settings" )
}
catch( const std::runtime_error & e )
{
std::cerr << "Could not load settings : " << e.what() << std::endl;
}

◆ save()

void ds::Settings::save ( const std::string &  filePath)

Saves the object's parameters into a DeepSight settings ini file.

Parameters
filePathPath of a file where to store DeepSight settings.

Throws an std::runtime_error if the file cannot be saved.

Example usage:

try
{
s.save( "/path/to/settings" )
}
catch( const std::runtime_error & e )
{
std::cerr << "Could not save settings : " << e.what() << std::endl;
}

Member Data Documentation

◆ detectionRange

ds::Settings::Range ds::Settings::detectionRange = Range::REGULAR

Selects the face detector to be used.

Two face detector neural networks are available as part of the SDK. One is optimized for long range detection, the other for medium range.

Note
The long rage face detector is slower than the regular one.
Faces detected on longer distances are smaller than the faces close by. Accuracy of features (eg. age, gender, headpose and so on) on smaller faces is lower.

◆ dnnTarget

ds::Settings::DnnTarget ds::Settings::dnnTarget = DnnTarget::CPU

Target processor on which the SDK's neural networks should execute. Accepted enum values are 'CPU', 'GPU', and 'GPU_MT'.

To enable GPU acceleration refer to OpenCL acceleration.

Note
The GPU_MT option is currently experimental and enables concurrent GPU network inference. This may cause a gradual loss of performance over time.

◆ faceConfidenceThreshold

float ds::Settings::faceConfidenceThreshold = 0.8f

Face confidence threshold.

This threshold controls the confidence level the SDK returns faces with. Faces detected during ds::DeepSight::analyze and ds::DeepSight::analyzeSingleImage with a confidence lower than the specified faceConfidenceThreshold will be discarded. Valid values are in the range [0, 1].

◆ lifetimeAuthFile

std::string ds::Settings::lifetimeAuthFile = ""

Path to file where the authorization for the lifetime release license is saved.

Use in combination with ds::Settings::operationMode set to ds::Settings::OperationMode::RELEASE_LIFETIME.

Example:

s.lifetimeAuthFile = "/path/to/lifetime_authorization.bin";
ds::DeepSight ds{ settings };

◆ neuralNetworksPath

std::string ds::Settings::neuralNetworksPath = ""

Path of the directory containing the SDK neural network files.

Failing to properly set this parameter causes the ds::DeepSight constructor to fail and throw an exception.

◆ numThreads

int ds::Settings::numThreads = -1

Controls the number of threads used to execute parallel computation regions, like inference.

This parameter controls how much CPU is used on multicore systems. Set to -1 to use the system default. Setting this parameter to a value lower than the number of CPU cores will leave the remaining CPU cores available for other computation. Eg. On a 4-core setup, setting ds::Settings::numThreads to 2 will leave ~50% of CPU available for other processes.

Note
This parameter is set internally using cv::setNumThreads() at the beginning of each ds::DeepSight::analyze or ds::DeepSight::analyzeSingleImage call. If cv::setNumThreads() is used externally, the number of threads will be set to ds::Settings::numThreads at the next call of ds::DeepSight::analyze or ds::DeepSight::analyzeSingleImage.
ds::Settings::load
void load(const std::string &filePath)
Loads an ini settings file into the ds::Settings instance.
ds::Settings::OperationMode::RELEASE_LIFETIME
@ RELEASE_LIFETIME
Uses the license in lifetime release mode.
ds::DeepSight
DeepSight SDK engine class.
Definition: ds_deepsight.h:28
ds::Settings::save
void save(const std::string &filePath)
Saves the object's parameters into a DeepSight settings ini file.
ds::DeepSight::authenticate
void authenticate()
Authenticates the SDK.
ds::Settings
DeepSight SDK settings class.
Definition: ds_settings.h:19
ds::Settings::operationMode
OperationMode operationMode
Operation mode the SDK should authenticate with.
Definition: ds_settings.h:43
ds::Settings::lifetimeAuthFile
std::string lifetimeAuthFile
Path to file where the authorization for the lifetime release license is saved.
Definition: ds_settings.h:41