ttanzhiqiang / onnx_tensorrt_project

Support Yolov5(4.0)/Yolov5(5.0)/YoloR/YoloX/Yolov4/Yolov3/CenterNet/CenterFace/RetinaFace/Classify/Unet. use darknet/libtorch/pytorch/mxnet to onnx to tensorrt
210 stars 43 forks source link

yolov5-v5的yolov5x模型,在python版本测试结果和该项目tensorrt下跑的结果不一致问题? #14

Open zsffuture opened 3 years ago

zsffuture commented 3 years ago

如题,不知道作者是否遇到过,训练完成的yolov5x模型,在python版本正确率为98%,但是转换为tensorrt后经过测试,正确率只有90%左右,其中模型转换过程log如下: [09/27/2021-11:27:04] [I] Host Latency [09/27/2021-11:27:04] [I] min: 11.3848 ms (end to end 21.3677 ms) [09/27/2021-11:27:04] [I] max: 13.1256 ms (end to end 24.1753 ms) [09/27/2021-11:27:04] [I] mean: 11.67 ms (end to end 21.9034 ms) [09/27/2021-11:27:04] [I] median: 11.5836 ms (end to end 21.7285 ms) [09/27/2021-11:27:04] [I] percentile: 12.5283 ms at 99% (end to end 23.6667 ms at 99%) [09/27/2021-11:27:04] [I] throughput: 0 qps [09/27/2021-11:27:04] [I] walltime: 3.03151 s [09/27/2021-11:27:04] [I] Enqueue Time [09/27/2021-11:27:04] [I] min: 1.04535 ms [09/27/2021-11:27:04] [I] max: 4.6637 ms [09/27/2021-11:27:04] [I] median: 1.61969 ms [09/27/2021-11:27:04] [I] GPU Compute [09/27/2021-11:27:04] [I] min: 10.8311 ms [09/27/2021-11:27:04] [I] max: 12.5458 ms [09/27/2021-11:27:04] [I] mean: 11.0955 ms [09/27/2021-11:27:04] [I] median: 11.0142 ms [09/27/2021-11:27:04] [I] percentile: 11.9821 ms at 99% [09/27/2021-11:27:04] [I] total compute time: 3.01798 s &&&& PASSED TensorRT.trtexec # trtexec.exe --onnx=best.onnx --saveEngine=best.engine --fp16

ttanzhiqiang commented 3 years ago

看看你的python代码的输入和输出,与Tensorrt的输入输出是否一样

zsffuture commented 3 years ago

我从别的架构测试后输出是正确的,但是同样的onnx输入这个类别就错误,或者有的检测不出来,用的是yolov5x.onnx 模型,目前不知道啥原因,我跟踪了你的代码,你的解码方式是onnx的三个输出分别进行解码,然后进行后续操作,我测试的另一个是把三个输出合在一起的输出,然后进行解码,这个结果和python一样很精准,所以我猜测是不是bondbox数量少?还是什么原因?

zsffuture commented 3 years ago

存在的现象是有的可以检测出来,有的也能检测对,但是有的类别就检测错了,有的就检测不出来

zsffuture commented 3 years ago

存在的现象是有的可以检测出来,有的也能检测对,但是有的类别就检测错了,有的就检测不出来

zsffuture commented 3 years ago

297fede19e82491218e1bcbd4d969d8

ttanzhiqiang commented 3 years ago

yolox模型的anchor机制使用了自动求anchor的算法,和之前的yolov5是不一样的,你可以参考一下我写的代码