ONNX conversion, Error: Tensor is already set as an output


Error converting an ONNX model to TensorRT:

[TensorRT] ERROR: Tensor 592 is already set as an output

My model has 3 inputs:
{'input.1': (1,3,736,1280), 'input.4': (1,3,736,1280), 'input.7', (1,1,736,1280)}

And 6 outputs:
'580': (1,6,184,320)
'583': (1,4,184,320)
'586': (1,2,184,320)
'589': (1,2,184,320)
'592': (1,2,184,320)


TensorRT Version:
GPU Type: EC2 p3 .8xlarge, 4x V100
Nvidia Driver Version: 440.33.01
CUDA Version: V11.0.167
CUDNN Version: 8.0.1
Operating System + Version: Ubuntu 18.04
Python Version (if applicable): 3.6.10
TensorFlow Version (if applicable):
PyTorch Version (if applicable): 1.5.1
Baremetal or Container (if container which image + tag): nvcr.io/nvidia/pytorch:20.06-py3

Relevant Files

Dropbox link to onnx model and conversion script (centertrack_noDCN.onnx and onnx_to_tensorrt.py):

Alternatively, Docker image with above files already included at /root/CenterTrack/models/: https://hub.docker.com/r/austinmw/onnx-to-tensorrt

Steps To Reproduce

  1. docker pull austinmw/onnx-to-tensorrt:latest
  2. cd /root/CenterTrack/models/
  3. python onnx_to_tensorrt.py

For reference, the outputs of centertrack_noDCN.onnx look like this in Netron app:

I’ve never used TensorRT before, so I’m not quite sure how to set this onnx_to_tensorrt conversion script up when I have multiple inputs and outputs. I think I may be doing the network.mark_output step incorrectly.

Any help would be greatly appreciated!

Hi @austinmw,
I tried converting your model and it works fine for me.
Request you to refer to the below link

Alternatively, you can use trtexec command for the conversion.


1 Like

Thanks, did not know about the trtexec tool. Really appreciate the help!