File indexing completed on 2025-03-09 03:54:58

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam
0004  *
0005  * Date        : 2019-08-08
0006  * Description : Derived class to perform SSD neural network inference
0007  *               for face detection
0008  *
0009  * SPDX-FileCopyrightText: 2019 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
0010  * SPDX-FileCopyrightText: 2020-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_FACESENGINE_DNN_FACE_DETECTOR_SSD_H
0017 #define DIGIKAM_FACESENGINE_DNN_FACE_DETECTOR_SSD_H
0018 
0019 // Local includes
0020 
0021 #include "dnnfacedetectorbase.h"
0022 
0023 namespace Digikam
0024 {
0025 
0026 class DIGIKAM_EXPORT DNNFaceDetectorSSD: public DNNFaceDetectorBase
0027 {
0028 
0029 public:
0030 
0031     explicit DNNFaceDetectorSSD();
0032     ~DNNFaceDetectorSSD()                                         override;
0033 
0034     bool loadModels();
0035 
0036     void detectFaces(const cv::Mat& inputImage,
0037                      const cv::Size& paddedSize,
0038                      std::vector<cv::Rect>& detectedBboxes)       override;
0039 
0040 private:
0041 
0042     void postprocess(cv::Mat detectionMat,
0043                      const cv::Size& paddedSize,
0044                      std::vector<cv::Rect>& detectedBboxes) const;
0045 
0046 private:
0047 
0048     // Disable
0049     DNNFaceDetectorSSD(const DNNFaceDetectorSSD&)            = delete;
0050     DNNFaceDetectorSSD& operator=(const DNNFaceDetectorSSD&) = delete;
0051 };
0052 
0053 } // namespace Digikam
0054 
0055 #endif // DIGIKAM_FACESENGINE_DNN_FACE_DETECTOR_SSD_H