4 #include <opencv2/dnn.hpp>
50 std::string framework,
51 std::string modelWeightsFile,
52 std::string classesFile =
"",
53 std::string modelConfigurationFile =
"",
54 std::string inputLayerName =
"",
55 std::string outputLayerName =
""
81 std::string configBackend,
82 std::string configTarget,
84 double confidenceThreshold);
96 void readClassNames(
const std::string& filePath);
98 std::string mFramework;
99 std::string mInputLayerName;
100 std::string mOutputLayerName;
107 std::vector<std::string> classes;
112 double scaleFactor = 1.0;
113 cv::Scalar mean{ 0.0, 0.0, 0.0 };
114 cv::Size size{ 128, 128 };
117 cv::dnn::Backend selectedBackend =
118 cv::dnn::DNN_BACKEND_OPENCV;
120 cv::dnn::Target selectedTarget =
121 cv::dnn::DNN_TARGET_CPU;
124 float confThreshold = 0.5F;
127 std::map<std::string, cv::dnn::Backend> backends = {
128 {
"DNN_BACKEND_DEFAULT", cv::dnn::DNN_BACKEND_DEFAULT},
129 {
"DNN_BACKEND_HALIDE", cv::dnn::DNN_BACKEND_HALIDE},
130 {
"DNN_BACKEND_INFERENCE_ENGINE", cv::dnn::DNN_BACKEND_INFERENCE_ENGINE},
131 {
"DNN_BACKEND_OPENCV", cv::dnn::DNN_BACKEND_OPENCV},
132 {
"DNN_BACKEND_CUDA", cv::dnn::DNN_BACKEND_CUDA}
135 std::map<std::string, cv::dnn::Target> targets = {
136 {
"DNN_TARGET_CPU", cv::dnn::DNN_TARGET_CPU},
137 {
"DNN_TARGET_CUDA", cv::dnn::DNN_TARGET_CUDA},
138 {
"DNN_TARGET_OPENCL", cv::dnn::DNN_TARGET_OPENCL},
139 {
"DNN_TARGET_OPENCL_FP16", cv::dnn::DNN_TARGET_OPENCL_FP16},
140 {
"DNN_TARGET_MYRIAD", cv::dnn::DNN_TARGET_MYRIAD} };
Definition: NeuralBase.h:20
double getInferenceTime()
Gets the inference time of the network.
Definition: NeuralBase.cpp:110
std::vector< std::string > getOutputsNames(const cv::dnn::Net &net)
Gets the names of the output layers of the network.
Definition: NeuralBase.cpp:93
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.
Definition: NeuralBase.cpp:41
std::string getName()
Gets the name of the neural network.
Definition: NeuralBase.cpp:8
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.
Definition: NeuralBase.cpp:10