MCPcopy Create free account
hub / github.com/FeiYull/TensorRT-Alpha / Detect

Function Detect

examples/python_with_dll/c_files/pch.cpp:71–94  ·  view source on GitHub ↗

2. img inference

Source from the content-addressed store, hash-verified

69
70// 2. img inference
71void Detect(void* yolo, int rows, int cols, unsigned char* src_data, float(*res_array)[6])
72
73{
74 YOLOV8* yolov8 = (YOLOV8*)yolo;
75
76 cv::Mat frame = cv::Mat(rows, cols, CV_8UC3, src_data);
77
78 std::vector<cv::Mat> imgs_batch(1, frame.clone());
79
80 yolov8->reset();
81
82 yolov8->copy(imgs_batch);
83
84 utils::DeviceTimer d_t1; yolov8->preprocess(imgs_batch); float t1 = d_t1.getUsedTime();
85 utils::DeviceTimer d_t2; yolov8->infer(); float t2 = d_t2.getUsedTime();
86 utils::DeviceTimer d_t3; yolov8->postprocess(imgs_batch); float t3 = d_t3.getUsedTime();
87
88 sample::gLogInfo <<
89 "preprocess time = " << t1 << "; "
90 "infer time = " << t2 << "; "
91 "postprocess time = " << t3 << std::endl;
92
93 getAimsInfo(yolov8->getObjectss(), res_array);
94}

Callers

nothing calls this directly

Calls 8

getAimsInfoFunction · 0.85
getUsedTimeMethod · 0.80
resetMethod · 0.45
copyMethod · 0.45
preprocessMethod · 0.45
inferMethod · 0.45
postprocessMethod · 0.45
getObjectssMethod · 0.45

Tested by

no test coverage detected