facecomparison.h 1.45 KB
#ifndef FACECOMPARISON_H
#define FACECOMPARISON_H


#include "facerecognize.h"
#include "retinaface.h"
#include "facelandmarks.h"


class FaceComparison{
    public:
        // 人脸检测阈值
        float confidence_threshold = 0.2;
        // 是否进行人脸外廓
        bool is_bbox_process = true;

        // 人脸比对相似度阈值
        float face_recongnize_thr = 0.5;

        // 线程个数
        int num_thread = 2;

        // 推理方式
        MNNForwardType forward_type = MNN_FORWARD_CPU;


        //接口
        bool inference(string image_path1,string image_path2);
        bool inference(Mat image1,Mat image2);

    private:
        RetinaFace face_det;
        FaceLandmarks face_landm;
        FaceRecognize face_rec;

    public:
        FaceComparison(){};
        FaceComparison(string face_det_model,string face_landm_model,string face_rec_model){
            face_det = RetinaFace(face_det_model);
            face_det.confidence_threshold = confidence_threshold;
            face_det.is_bbox_process = is_bbox_process;
            face_det.num_thread=num_thread;
            face_det.forward_type = forward_type;
            face_landm =FaceLandmarks(face_landm_model);
            face_landm.num_thread=num_thread;
            face_landm.forward_type=forward_type;
            face_rec =FaceRecognize(face_rec_model);
            face_rec.num_thread=num_thread;
            face_rec.forward_type=forward_type;
        }
};
#endif