Hi support team,
I’m using deepstream-test 3 python example to run RetinaFace resnet50 model.
I get this model from repo: GitHub - biubug6/Pytorch_Retinaface: Retinaface get 80.99% in widerface hard val using mobilenet0.25.
Link download: Retinaface_model_v2 - Google Drive (file Resnet50_Final.pth)
Base on convert_to_onnx.py file in github repo, I converted .pth file to onnx file without error.
To run deepstream, I convert onnx file to .engine file with –explicit _batch param:
/usr/src/tensorrt/bin/trtexec --explicitBatch --onnx=FaceDetector_3x720x1280.onnx --minShapes=input:1x3x720x1280 --optShapes=input:32x3x720x1280 --maxShapes=input:32x3x720x1280 --saveEngine=model.batch1-32-720x1280.engine
I write a custom code for pad probe function after PGIE to do some postprocessing, convert tensorrt model outputs into coordinates of bounding boxes. But the final tensorrt bboxes output seem to unmatch the onnx model output. Below are some first rows of outputs coordinates in format [4 bboxes] [1 confidence]
ONNX input image: 1280x720
-> bboxes, conf:
(180.20432, 376.52902, 248.42604, 457.669, 0.99970335)
(652.8903, 399.71368, 718.46405, 473.9985, 0.99964297)
(814.8349, 117.745026, 880.6983, 196.94049, 0.99956053)
(124.28804, 516.43823, 187.45502, 590.3951, 0.99950266)
(872.94556, 454.53992, 932.13556, 534.32825, 0.99934095)
(953.01324, 281.43137, 1015.52014, 350.7596, 0.9993309)
TensorRT input image: 1280x720
-> bboxes, conf:
(888.7898, 382.60144, 1010.4221, 428.3359, 0.999685)
(1160.0034, 413.8329, 1277.151, 455.6716, 0.99967617)
(604.57526, 391.67694, 724.69055, 436.8149, 0.99958414)
(168.39978, 138.1584, 285.6008, 182.83948, 0.9995832)
(789.9761, 524.51733, 902.11475, 565.9892, 0.9995227)
(129.55733, 302.13498, 241.45831, 341.36035, 0.99936026)
(414.65784, 480.48514, 519.47003, 525.595, 0.9993399)
...
But when we use the image input with the same width and height (eg. 800x800), the results of onnx and deepstream tensorrt model are quite similar.
ONNX input image: 800x800
-> bboxes, conf:
(175.73035, 15.69736, 218.86465, 83.27333, 0.99593616)
(406.31818, 446.80933, 450.3378, 519.4465, 0.99531084)
(591.0689, 318.55777, 636.0353, 385.14783, 0.9951623)
(85.07462, 326.9187, 130.29005, 398.35226, 0.9948461)
(573.6182, 3.2033205, 617.547, 66.30011, 0.9943182)
(507.7378, 134.5662, 553.2838, 216.61005, 0.9939587)
...
TensorRT input image: 800x800
(176.44965, 15.834936, 219.82768, 83.319435, 0.99557555)
(406.9334, 448.04874, 450.62445, 519.9374, 0.994955)
(85.84751, 327.6398, 131.38907, 398.96964, 0.9947095)
(591.5082, 319.41702, 636.5945, 386.33548, 0.9946694)
(574.3133, 3.5823674, 618.08594, 66.684364, 0.99455625)
(508.14825, 134.8997, 553.753, 216.69969, 0.99305314)
...
So what is the problem here and how to fix it?
Thank you so much!
Link source code: File on MEGA
Environment
• Hardware Platform: Tesla T4
• DeepStream Version: 5.0
• TensorRT Version: 7.2.1
• PyTorch 1.6
• ONNX v6
• NVIDIA GPU: Driver Version 455.32, CUDA Version 11.1
• OS: Ubuntu 18.04