forked from suixin1424/crossfire-yolo-TensorRT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
50 lines (36 loc) · 1.3 KB
/
main.cpp
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
#include<config.h>
using namespace std;
int main(int argc, char** argv){
string model_file = "./cf.FP16.trtmodel";
string onnx_file = "cf.onnx";
auto int8process = [=](int current, int count, const vector<string>& files, shared_ptr<TRT::Tensor>& tensor) {
//INFO("Int8 %d / %d", current, count);
for (int i = 0; i < files.size(); ++i) {
auto image = cv::imread(files[i]);
Yolo::image_to_tensor(image, tensor, Yolo::Type::V5, i);
}
};
if (! iLogger::exists(model_file)) {
TRT::compile(
TRT::Mode::FP16, // FP32、FP16、INT8
16, // max batch size
onnx_file, // source
model_file, // save to
{},
int8process,
"inference"
);
}
options option;
option.init();
cout << "is show windows?" << endl;
cin >> option.is_show_windows;
cout << "ok" << endl;
std::thread main_Thread(&options::sendWrapper, &option);
std::thread move_Thread(&pid_move::receiveWrapper2, &option.mouse.pid);
std::thread smooth_Thread(&pid_move::receiveWrapper3, &option.mouse.pid);
main_Thread.join();
move_Thread.join();
smooth_Thread.join();
return 0;
}