Spoofing Detection Engine  1.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core::NeuralBase Class Reference
Inheritance diagram for core::NeuralBase:
Inheritance graph
[legend]

Public Member Functions

std::string getName ()
 Gets the name of the neural network. More...
 
double getInferenceTime ()
 Gets the inference time of the network. More...
 
void loadNetwork (std::string framework, std::string modelWeightsFile, std::string classesFile="", std::string modelConfigurationFile="", std::string inputLayerName="", std::string outputLayerName="")
 Loads the neural network from memory buffer. More...
 
void configureNetwork (std::string name, int inputWidth, int inputHeight, double scale, double mean0, double mean1, double mean2, std::string configBackend, std::string configTarget, double confidenceThreshold)
 Configures the network with various parameters. More...
 
std::vector< std::string > getOutputsNames (const cv::dnn::Net &net)
 Gets the names of the output layers of the network. More...
 

Protected Member Functions

void readClassNames (const std::string &filePath)
 

Protected Attributes

std::string mFramework
 
std::string mInputLayerName
 
std::string mOutputLayerName
 
std::string mName
 
cv::dnn::Net mNet
 
std::vector< std::string > classes
 
double scaleFactor = 1.0
 
cv::Scalar mean { 0.0, 0.0, 0.0 }
 
cv::Size size { 128, 128 }
 
cv::dnn::Backend selectedBackend
 
cv::dnn::Target selectedTarget
 
float confThreshold = 0.5F
 
std::map< std::string, cv::dnn::Backend > backends
 
std::map< std::string, cv::dnn::Target > targets
 

Member Function Documentation

◆ configureNetwork()

void core::NeuralBase::configureNetwork ( std::string  name,
int  inputWidth,
int  inputHeight,
double  scale,
double  mean0,
double  mean1,
double  mean2,
std::string  configBackend,
std::string  configTarget,
double  confidenceThreshold 
)

Configures the network with various parameters.

Parameters
nameThe name of the network.
inputWidthThe width of the network input.
inputHeightThe height of the network input.
scaleThe scaling factor for the input.
mean0The mean value for the first channel.
mean1The mean value for the second channel.
mean2The mean value for the third channel.
configBackendThe backend to be used for computation.
configTargetThe target device for computation.
confidenceThresholdThe threshold for filtering weak detections.
Here is the caller graph for this function:

◆ getInferenceTime()

double core::NeuralBase::getInferenceTime ( )

Gets the inference time of the network.

Returns
The inference time in milliseconds.

◆ getName()

std::string core::NeuralBase::getName ( )

Gets the name of the neural network.

Returns
A string representing the name of the network.

◆ getOutputsNames()

std::vector< std::string > core::NeuralBase::getOutputsNames ( const cv::dnn::Net &  net)

Gets the names of the output layers of the network.

Parameters
netThe neural network.
Returns
A vector of strings representing the names of the output layers.

◆ loadNetwork()

void core::NeuralBase::loadNetwork ( std::string  framework,
std::string  modelWeightsFile,
std::string  classesFile = "",
std::string  modelConfigurationFile = "",
std::string  inputLayerName = "",
std::string  outputLayerName = "" 
)

Loads the neural network from memory buffer.

Parameters
frameworkThe framework used for the network.
modelWeightsFileThe memory buffer containing the model weights.
classesFileThe memory buffer containing the class names.
modelConfigurationFileThe memory buffer containing the model configuration. You can leave it empty if there is no configuration file.
inputLayerNameThe name of the input layer. You can leave it empty if there is no multiple input.
outputLayerNameThe name of the output layer. You can leave it empty. You can leave itempty if there are no specific outputs to read.
Here is the caller graph for this function:

Member Data Documentation

◆ backends

std::map<std::string, cv::dnn::Backend> core::NeuralBase::backends
protected
Initial value:
= {
{"DNN_BACKEND_DEFAULT", cv::dnn::DNN_BACKEND_DEFAULT},
{"DNN_BACKEND_HALIDE", cv::dnn::DNN_BACKEND_HALIDE},
{"DNN_BACKEND_INFERENCE_ENGINE", cv::dnn::DNN_BACKEND_INFERENCE_ENGINE},
{"DNN_BACKEND_OPENCV", cv::dnn::DNN_BACKEND_OPENCV},
{"DNN_BACKEND_CUDA", cv::dnn::DNN_BACKEND_CUDA}
}

◆ selectedBackend

cv::dnn::Backend core::NeuralBase::selectedBackend
protected
Initial value:
=
cv::dnn::DNN_BACKEND_OPENCV

◆ selectedTarget

cv::dnn::Target core::NeuralBase::selectedTarget
protected
Initial value:
=
cv::dnn::DNN_TARGET_CPU

◆ targets

std::map<std::string, cv::dnn::Target> core::NeuralBase::targets
protected
Initial value:
= {
{"DNN_TARGET_CPU", cv::dnn::DNN_TARGET_CPU},
{"DNN_TARGET_CUDA", cv::dnn::DNN_TARGET_CUDA},
{"DNN_TARGET_OPENCL", cv::dnn::DNN_TARGET_OPENCL},
{"DNN_TARGET_OPENCL_FP16", cv::dnn::DNN_TARGET_OPENCL_FP16},
{"DNN_TARGET_MYRIAD", cv::dnn::DNN_TARGET_MYRIAD} }

The documentation for this class was generated from the following files: