-
Notifications
You must be signed in to change notification settings - Fork 222
/
Copy pathtrt_yolov8_sample2.cpp
36 lines (30 loc) · 1.52 KB
/
trt_yolov8_sample2.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
#include "../nodes/vp_file_src_node.h"
#include "../nodes/infers/vp_trt_yolov8_detector.h"
#include "../nodes/infers/vp_trt_yolov8_classifier.h"
#include "../nodes/osd/vp_osd_node_v3.h"
#include "../nodes/vp_screen_des_node.h"
#include "../utils/analysis_board/vp_analysis_board.h"
/*
* ## trt yolov8 sample2 ##
* detection/classification using yolov8 based on tensorrt
*/
int main() {
VP_SET_LOG_LEVEL(vp_utils::vp_log_level::INFO);
VP_LOGGER_INIT();
// create nodes
auto file_src_0 = std::make_shared<vp_nodes::vp_file_src_node>("file_src_0", 0, "./vp_data/test_video/mask_rcnn.mp4");
auto yolo8_detector = std::make_shared<vp_nodes::vp_trt_yolov8_detector>("yolo8_detector", "./vp_data/models/trt/others/yolov8s_v8.5.engine", "./vp_data/models/coco_80classes.txt");
auto yolo8_classifier = std::make_shared<vp_nodes::vp_trt_yolov8_classifier>("yolo8_classifier", "./vp_data/models/trt/others/yolov8s-cls_v8.5.engine", "./vp_data/models/imagenet_1000labels1.txt");
auto osd = std::make_shared<vp_nodes::vp_osd_node_v3>("osd", "./vp_data/font/NotoSansCJKsc-Medium.otf");
auto screen_des_0 = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_0", 0);
// construct pipeline
yolo8_detector->attach_to({file_src_0});
yolo8_classifier->attach_to({yolo8_detector});
osd->attach_to({yolo8_classifier});
screen_des_0->attach_to({osd});
// start pipeline
file_src_0->start();
// visualize pipeline for debug
vp_utils::vp_analysis_board board({file_src_0});
board.display();
}