digiKam
dnnfacedetectoryolo.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam
4  *
5  * Date : 2019-08-08
6  * Description : Derived class to perform YOLO neural network inference
7  * for face detection. Credit: Ayoosh Kathuria (for Yolov3 blog post),
8  * sthanhng (for example of face detection with Yolov3).
9  * More information with Yolov3:
10  * https://towardsdatascience.com/yolo-v3-object-detection-53fb7d3bfe6b
11  * sthanhng github on face detection with Yolov3:
12  * https://github.com/sthanhng/yoloface
13  *
14  * Copyright (C) 2019 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
15  * Copyright (C) 2020-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
16  *
17  * This program is free software; you can redistribute it
18  * and/or modify it under the terms of the GNU General
19  * Public License as published by the Free Software Foundation;
20  * either version 2, or (at your option)
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * ============================================================ */
29 
30 #ifndef DIGIKAM_FACESENGINE_DNN_FACE_DETECTOR_YOLO_H
31 #define DIGIKAM_FACESENGINE_DNN_FACE_DETECTOR_YOLO_H
32 
33 // Local includes
34 
35 #include "dnnfacedetectorbase.h"
36 
37 namespace Digikam
38 {
39 
41 {
42 
43 public:
44 
45  explicit DNNFaceDetectorYOLO();
46  ~DNNFaceDetectorYOLO() override;
47 
48  bool loadModels();
49 
50  void detectFaces(const cv::Mat& inputImage,
51  const cv::Size& paddedSize,
52  std::vector<cv::Rect>& detectedBboxes) override;
53 
54 private:
55 
56  std::vector<cv::String> getOutputsNames() const;
57 
58  void postprocess(const std::vector<cv::Mat>& outs,
59  const cv::Size& paddedSize,
60  std::vector<cv::Rect>& detectedBboxes) const;
61 
62 private:
63 
64  // Disable
66  DNNFaceDetectorYOLO& operator=(const DNNFaceDetectorYOLO&) = delete;
67 };
68 
69 } // namespace Digikam
70 
71 #endif // DIGIKAM_FACESENGINE_DNN_FACE_DETECTOR_YOLO_H
Definition: dnnfacedetectorbase.h:44
Definition: dnnfacedetectoryolo.h:41
bool loadModels()
Definition: dnnfacedetectoryolo.cpp:60
~DNNFaceDetectorYOLO() override
Definition: dnnfacedetectoryolo.cpp:56
DNNFaceDetectorYOLO()
Definition: dnnfacedetectoryolo.cpp:50
void detectFaces(const cv::Mat &inputImage, const cv::Size &paddedSize, std::vector< cv::Rect > &detectedBboxes) override
Definition: dnnfacedetectoryolo.cpp:117
Definition: datefolderview.cpp:43