-
Notifications
You must be signed in to change notification settings - Fork 313
/
class_detector.h
72 lines (52 loc) · 1.07 KB
/
class_detector.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
72
#ifndef CLASS_DETECTOR_H_
#define CLASS_DETECTOR_H_
#include "API.h"
#include <iostream>
#include <opencv2/opencv.hpp>
struct Result
{
int id = -1;
float prob = 0.f;
cv::Rect rect;
};
using BatchResult = std::vector<Result>;
enum ModelType
{
YOLOV2 = 0,
YOLOV3,
YOLOV2_TINY,
YOLOV3_TINY,
YOLOV4,
YOLOV4_TINY,
YOLOV5
};
enum Precision
{
INT8 = 0,
FP16,
FP32
};
struct Config
{
std::string file_model_cfg = "configs/yolov3.cfg";
std::string file_model_weights = "configs/yolov3.weights";
float detect_thresh = 0.9;
ModelType net_type = YOLOV3;
Precision inference_precison = FP32;
int gpu_id = 0;
std::string calibration_image_list_file_txt = "configs/calibration_images.txt";
};
class API Detector
{
public:
explicit Detector();
~Detector();
void init(const Config &config);
void detect(const std::vector<cv::Mat> &mat_image, std::vector<BatchResult> &vec_batch_result);
private:
Detector(const Detector &);
const Detector &operator =(const Detector &);
class Impl;
Impl *_impl;
};
#endif // !CLASS_QH_DETECTOR_H_