-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_tvm_ssd.cc
71 lines (47 loc) · 1.62 KB
/
test_tvm_ssd.cc
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
#include <dlpack/dlpack.h>
#include <tvm/runtime/module.h>
#include <tvm/runtime/registry.h>
#include <tvm/runtime/packed_func.h>
#include <fstream>
#include <iterator>
#include <thread>
#include <algorithm>
#include "src/pipe.hh"
#include "src/executor.hh"
#include "src/detector.hh"
#include "src/box.hh"
#include "src/ssd.hh"
#include <opencv2/opencv.hpp>
#include <chrono>
using namespace std;
using namespace cv;
using namespace flt::detector;
int main(){
vector <string> classes = { "aeroplane", "bicycle", "bird", "boat", "bottle", \
"bus", "car", "cat", "chair", "cow",
"diningtable", "dog", "horse", "motorbike",
"person", "pottedplant", "sheep", "sofa", "train", "tvmonitor" };
string network = "ssd-inceptionv3-512";
string device = "gpu";
map <string, vector <int64_t>> det_in, det_out, nms_out;
det_in["data"] = {1, 512, 512, 3};
det_in["mean"] = {1, 3, 1, 1};
det_out["cls_prob"] = {1, 21, 5186};
det_out["loc_preds"] = {1, 20744};
det_out["anchor_boxes"] = {1, 5186, 4};
nms_out["nms0_output"] = {1, 5186, 6};
Size size(512, 512);
ssd s(network, device, size, classes, det_in, det_out, nms_out);
//s.detect_image("dog1.jpg");
//
<<<<<<< HEAD
=======
>>>>>>> 3df6457f817f3ee5923f83d0c9377e0a1a19fc2e
string video = "123.mp4";
DetectType dt = DetectType::video;
thread capture (& ssd::capture_thread, & s, ref(dt), ref(video));
thread detect (& ssd::detect_thread, & s);
s.post_thread(true);
capture.join();
detect.join();
}