ONNX to TensorRT error: Failed to parse the ONNX file

Description

Hello.
I am testing the yolov3-tiny model of darknet on jetson-nx device.
I try to convert the yolov3-tiny model to tensorrt model,
First, with the yolov3_to_onnx.py yolov3-tiny is converted to onnx model successfully.
Then, with the onnx_to_tensorrt.py the onnx model failed to convert to tensorrt model.
Error Info:
contec@contec:/usr/src/tensorrt/samples/python/yolov3_onnx$ sudo python onnx_to_tensorrt.py
[sudo] password for contec:
Loading ONNX file from path yolov3_tiny.onnx…
Beginning ONNX file parsing
[TensorRT] ERROR: 021_route: all concat input tensors must have the same dimensions except on the concatenation axis (1), but dimensions mismatched at index 2. Input 0 shape: [1,128,832,832], Input 1 shape: [1,256,416,416]
[TensorRT] ERROR: 021_route: all concat input tensors must have the same dimensions except on the concatenation axis (1), but dimensions mismatched at index 2. Input 0 shape: [1,128,832,832], Input 1 shape: [1,256,416,416]
[TensorRT] ERROR: 021_route: all concat input tensors must have the same dimensions except on the concatenation axis (1), but dimensions mismatched at index 2. Input 0 shape: [1,128,832,832], Input 1 shape: [1,256,416,416]
ERROR: Failed to parse the ONNX file.
In node -1 (importConv): UNSUPPORTED_NODE: Assertion failed: nbSpatialDims == kernelWeights.shape.nbDims - 2
Traceback (most recent call last):
*File “onnx_to_tensorrt.py”, line 187, in *
*main() *
File “onnx_to_tensorrt.py”, line 158, in main
with get_engine(onnx_file_path, engine_file_path) as engine, engine.create_execution_context() as context:
AttributeError: enter

Environment

  • NVIDIA Jetson Xavier NX
    • Jetpack 4.4 DP [L4T 32.4.2]
  • Libraries:
    • CUDA: 10.2.89
    • cuDNN: 8.0.0.145
    • TensorRT: 7.1.0.16
    • Visionworks: 1.6.0.501
    • OpenCV: 4.1.1 compiled CUDA: NO
    • VPI: 0.2.0
    • Vulkan: 1.2.70
  • Python: 3.6.9

Relevant Files

yolov3 model link: https://github.com/pjreddie/darknet

Hi @yalisun,
Can you please help us with your onnx model and script, so that we can help you better.
Thanks!

Hi @AakankshaS,
I pushed onnx model and script to https://github.com/alexxxsun/yolov3ToTensorrt, please help me. Thanks.

I added code to support [‘maxpool’] node in yolov3_to_onnx.py, then it works.