jkjung-avt / tensorrt_demos

TensorRT MODNet, YOLOv4, YOLOv3, SSD, MTCNN, and GoogLeNet
https://jkjung-avt.github.io/
MIT License
1.75k stars 547 forks source link

onnx 1.4.1 dependency #539

Closed tnaduc closed 2 years ago

tnaduc commented 2 years ago

Hi Jk, Thank you for the tutorials. They are extremely helpful.

Could you please help to look into the onnx==1.4.1 dependency for the yolov4/yolov3 demo and shine some lights on how can we overcame this dependency to use later onnx version to potentially open up to more models.

I understand it is mentioned here: https://forums.developer.nvidia.com/t/tensorrt-backend-for-onnx-on-jetson-nano/74980/6

jkjung-avt commented 2 years ago

This onnx==1.4.1 requirement is due to the use of ONNX "Upsample" op to implement "upsample" layer in DarkNet models, e.g. a example "upsample" layer in the yolov4 model.

The ONNX "Upsample" op is only available in python onnx==1.4.1 (ONNX opset 9). It has been deprecated since ONNX opset 10. That's why my current code in this repo only works with onnx==1.4.1.

You could reference NVIDIA's latest TensorRT/samples/python/yolov3_onnx code for how to solve this. It has been updated to onnx==1.9.0. And it uses ONNX "Resize" op to implement DarkNet's "upsample" layer instead.

I might look into this and update the code when I have time. Otherwise, I also welcome such a pull request...

jkjung-avt commented 2 years ago

@tnaduc I've updated the "yolo_to_onnx.py" code. It now works for onnx==1.9.0 (but won't work for onnx==1.4.1 anymore). I've only tested it with TensorRT 8.0 so far, but I think it should work for TensorRT 7 as well.

Please give it a try.

sachinkmohan commented 2 years ago

@tnaduc I've updated the "yolo_to_onnx.py" code. It now works for onnx==1.9.0 (but won't work for onnx==1.4.1 anymore). I've only tested it with TensorRT 8.0 so far, but I think it should work for TensorRT 7 as well.

Please give it a try.

Awesome! Thanks! Will test this!

tnaduc commented 2 years ago

Thank you @jkjung-avt you are amazing.