#ifndef __YOLOV5_FACE_H__ #define __YOLOV5_FACE_H__ /************************************************************************* * * deepCam Shenzhen CONFIDENTIAL * FILE: * * [2016] - [2019] DeepCam Shenzhen * All Rights Reserved. NOTICE: * All information contained herein is, and remains the property of DeepCam Shenzhen. * The intellectual and technical concepts contained herein are proprietary to DeepCam * Shenzhen and may be covered by China and Foreign Patents,patents in process, and * are protected by trade secret or copyright law. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * DeepCam Shenzhen. * * * Written: Jing.Yi 2021-01-6 * Updated: **************************************************************************/ #include "ncnn/net.h" #include "opencv2/opencv.hpp" //#include "common/Extractor.h" #include "anchor.h" #include "dims.h" #include class yoloV5_face_ncnn { public: static yoloV5_face_ncnn* getInstance(); S32 loadModel(std::string model_path, DimsNCHW dim_ifm = DimsNCHW(1,3,320,320)); // S32 loadModel(std::string model_path, DimsNCHW dim_ifm = DimsNCHW(1,3,192,256)); std::vector& Detect(cv::Mat &image); private: yoloV5_face_ncnn() {}; ~yoloV5_face_ncnn() {}; yoloV5_face_ncnn(const yoloV5_face_ncnn&) = delete; yoloV5_face_ncnn& operator=(const yoloV5_face_ncnn&) = delete; std::vector LetterboxImage(const cv::Mat& src, cv::Mat& dst, const cv::Size& out_size); void decode(ncnn::Mat& output, std::vector& info, std::vector anchor,int net_w, int net_h, std::vector& result); void nms(std::vector &input_boxes, float NMS_THRESH); private: std::shared_ptr m_net; DimsNCHW m_dimIfm; std::vector m_result; // float m_confThreshold = 0.4; std::vector m_anchor8 = { 4,5, 8,10, 13,16 }; std::vector m_anchor16 = { 23,29, 43,55, 73,105 }; std::vector m_anchor32 = { 146,217, 231,300, 335,433 }; }; #endif