-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdetector.h
120 lines (64 loc) · 1.92 KB
/
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef DETECTOR_H
#define DETECTOR_H
#include <vector>
#include <iostream>
#include <mutex>
#include <queue>
#include <opencv2/opencv.hpp>
#include "box.h"
#include "struct.h"
using namespace std;
class detector {
public:
detector(string & _json, string & _params, string & _mean, string & _device, vector <string> & _classes, Size & _size, bool switching);
~ detector();
void convert(vector <NDArray> & ndout, vector <vector <bbox>> & bboxes, Size & size_);
int visualize(cv::Mat & in, vector <vector <bbox>> & bboxes);
int detect(int tid);
void detect_image(string & image);
//int detect(cv::Mat & in);
int capture(DetectType & dt, string & filename);
int guard();
void sw();
int batch = 1;
int cbatch = 1;
int way = 1;
bool switching = false;
map <string, bool> alive;
Size size, osize;
Symbol net;
float threshold = 0.5;
vector <Executor *> E;
string json, params;
vector <string> classes;
vector <cv::Mat> frames;
vector <cv::Mat> input;
vector <vector <cv::Mat>> tinput = vector <vector <cv::Mat>> (2);
deque <cv::Mat> MatQueue;
deque <cv::Mat> FrameQueue;
deque <vector <vector <bbox>>> BoxesQueue;
/*
map <string, NDArray> args;
map <string, NDArray> args2;
map <string, NDArray> auxs;
map <string, NDArray> auxs2;
map <string, NDArray> grad;
map <string, OpReqType> req;
*/
vector <map <string, NDArray>> args = vector <map <string, NDArray>> (2);
vector <map <string, NDArray>> auxs = vector <map <string, NDArray>> (2);
map <string, NDArray> nds;
map <string, NDArray> grad;
map <string, OpReqType> req;
unsigned int wait = 100;
Context * ctx;
//map <string, vector <mutex>> lock;
vector <mutex> lock = vector <mutex> (2);
mutex mMatQueue, mBoxesQueue, mFrames;
int post(bool v); // visualize
private:
int request();
void unload(int no);
void load(int no);
};
#endif