forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass_detector.h
More file actions
80 lines (60 loc) · 1.25 KB
/
Copy pathclass_detector.h
File metadata and controls
80 lines (60 loc) · 1.25 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef CLASS_DETECTOR_H_
#define CLASS_DETECTOR_H_
#include "API.h"
#include <iostream>
#include <opencv2/opencv.hpp>
namespace tensor_rt
{
struct Result
{
int id = -1;
float prob = 0.f;
cv::Rect rect;
Result(int id_, float prob_, cv::Rect r)
: id(id_), prob(prob_), rect(r)
{
}
};
typedef std::vector<Result> BatchResult;
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.9f;
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);
cv::Size get_input_size() const;
private:
Detector(const Detector &);
const Detector &operator =(const Detector &);
class Impl;
Impl *_impl = nullptr;
};
}
#endif // !CLASS_QH_DETECTOR_H_