4 #include <opencv2/dnn.hpp>
5 #include <opencv2/objdetect/face.hpp>
53 void init(std::string framework,
54 std::string modelWeightsFile,
55 std::string classesFile,
56 std::string modelConfigurationFile,
57 std::string inputLayerName,
58 std::string outputLayerName,
59 std::string networkName,
66 std::string configBackend,
67 std::string configTarget,
68 double confidenceThreshold = 0.9,
69 double nmsThreshold = 0.3,
79 std::vector<core::Detection>
process(
const cv::Mat& frame);
82 cv::Ptr<cv::FaceDetectorYN> mDetector;
84 double maxWidthOrHeight;
87 std::map<std::string, cv::dnn::Backend> backends = {
88 {
"DNN_BACKEND_DEFAULT", cv::dnn::DNN_BACKEND_DEFAULT},
89 {
"DNN_BACKEND_HALIDE", cv::dnn::DNN_BACKEND_HALIDE},
90 {
"DNN_BACKEND_INFERENCE_ENGINE", cv::dnn::DNN_BACKEND_INFERENCE_ENGINE},
91 {
"DNN_BACKEND_OPENCV", cv::dnn::DNN_BACKEND_OPENCV},
92 {
"DNN_BACKEND_CUDA", cv::dnn::DNN_BACKEND_CUDA}
96 std::map<std::string, cv::dnn::Target> targets = {
97 {
"DNN_TARGET_CPU", cv::dnn::DNN_TARGET_CPU},
98 {
"DNN_TARGET_CUDA", cv::dnn::DNN_TARGET_CUDA},
99 {
"DNN_TARGET_OPENCL", cv::dnn::DNN_TARGET_OPENCL},
100 {
"DNN_TARGET_OPENCL_FP16", cv::dnn::DNN_TARGET_OPENCL_FP16},
101 {
"DNN_TARGET_MYRIAD", cv::dnn::DNN_TARGET_MYRIAD}
Face detection class utilizing OpenCV's FaceDetectorYN model with DNN support.
Definition: FaceDetectorYunet.h:18
FaceDetectorYunet()=default
Default constructor for FaceDetectorYunet.
std::vector< core::Detection > process(const cv::Mat &frame)
Processes an image frame to detect faces and returns a list of detections.
Definition: FaceDetectorYunet.cpp:70
void init(std::string framework, std::string modelWeightsFile, std::string classesFile, std::string modelConfigurationFile, std::string inputLayerName, std::string outputLayerName, std::string networkName, int inputWidth, int inputHeight, double scale, double mean0, double mean1, double mean2, std::string configBackend, std::string configTarget, double confidenceThreshold=0.9, double nmsThreshold=0.3, double maxWH=312.0, int topK=5000)
Initializes the face detector with specified parameters and model configurations.
Definition: FaceDetectorYunet.cpp:11
~FaceDetectorYunet()=default
Default destructor for FaceDetectorYunet.