facecomparison.h
1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#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