-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFaceDetector.h
71 lines (52 loc) · 1.14 KB
/
FaceDetector.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
//
// Created by dl on 19-7-19.
//
#ifndef FACE_DETECTOR_H
#define FACE_DETECTOR_H
#include <opencv2/opencv.hpp>
#include <string>
#include <stack>
#include "net.h"
#include <chrono>
using namespace std::chrono;
struct Point {
float _x;
float _y;
};
struct bbox {
float x1;
float y1;
float x2;
float y2;
float s;
Point point[5];
};
struct box {
float cx;
float cy;
float sx;
float sy;
};
class Detector
{
public:
Detector();
void Init(const std::string& model_param, const std::string& model_bin);
Detector(const std::string& model_param, const std::string& model_bin);
inline void Release();
void nms(std::vector<bbox>& input_boxes, float NMS_THRESH);
void Detect(cv::Mat& bgr, std::vector<bbox>& boxes);
void create_anchor(std::vector<box>& anchor, int w, int h);
void create_anchor_retinaface(std::vector<box>& anchor, int w, int h);
inline void SetDefaultParams();
static inline bool cmp(bbox a, bbox b);
~Detector();
public:
float _nms;
float _threshold;
float _mean_val[3];
bool _retinaface;
ncnn::Net* Net;
};
#endif //