enazoe / yolo-tensorrt

TensorRT8.Support Yolov5n,s,m,l,x .darknet -> tensorrt. Yolov4 Yolov3 use raw darknet *.weights and *.cfg fils. If the wrapper is useful to you,please Star it.
MIT License
1.18k stars 313 forks source link

GpuMat as input buffer #86

Closed jstumpin closed 3 years ago

jstumpin commented 3 years ago

Any idea why the following codes (excerpt from https://www.learnopencv.com/how-to-run-inference-using-tensorrt-c-api/):

std::vector< cv::cuda::GpuMat > chw;
    for (size_t i = 0; i < channels; ++i)
    {
        chw.emplace_back(cv::cuda::GpuMat(input_size, CV_32FC1, gpu_input + i * input_width * input_height));
    }
    cv::cuda::split(flt_image, chw);
}

works on https://github.com/CaoWGG/TensorRT-YOLOv4 but not here (i.e. no detection)?

Thanks.

jstumpin commented 3 years ago

My bad, pre-processing was wee-bit off. This repo has an auto-scaling plugin baked into the engine whereas the other one doesn't. Simply omitting the scaling procedure fixed the issue. Anyhow was able to shave 1ms off from YOLOv3 via GpuMat but did not improve on YOLOv4. Mind the resolution difference though (416 vs. 320), which could have affected the outcome.