Tensorrt: Using trtexec to build engine for onnx model

Created on 3 Nov 2019  Â·  2Comments  Â·  Source: NVIDIA/TensorRT

I downloaded a RetinaNet model in ONNX format from the resources provided in an NVIDIA webinar on Deepstream SDK. I am trying to use trtexec to build an inference engine for this model. This model was trained with pytorch, so no deploy file (model.prototxt) was generated as would be the case for a caffe2 model. Thus, trtexec errors out because no deploy file was specified. Is there a way out of this problem? I suppose I could convert onnx to caffe2 with the command line utility that comes with caffe2, and provide that model to trtexec, but I would prefer if I can build the engine directly from onnx.

agx@agx-desktop:/usr/src/tensorrt/bin$ ./trtexec --model=/home/agx/agxnvme/stanford_dataset/DS_webinar_sources/stanford_resnext50.onnx --batch=1 --output=Sigmoid_4 --saveEngine=resnext50.trt
&&&& RUNNING TensorRT.trtexec # ./trtexec --model=/home/agx/agxnvme/stanford_dataset/DS_webinar_sources/stanford_resnext50.onnx --batch=1 --output=Sigmoid_4 --saveEngine=resnext50.trt
[I] model: /home/agx/agxnvme/stanford_dataset/DS_webinar_sources/stanford_resnext50.onnx
[I] batch: 1
[I] output: Sigmoid_4
[I] saveEngine: resnext50.trt
[E] Deploy file not specified
[E] Engine could not be created
&&&& FAILED TensorRT.trtexec # ./trtexec --model=/home/agx/agxnvme/stanford_dataset/DS_webinar_sources/stanford_resnext50.onnx --batch=1 --output=Sigmoid_4 --saveEngine=resnext50.trt
ONNX question

All 2 comments

Hi @dataplayer12,

Off the top of my head, I think you're supposed to use the --onnx flag instead of --model, see this similar post: https://github.com/NVIDIA/tensorrt-laboratory/issues/28#issuecomment-499434686

You can also probably confirm that with trtexec -h or trtexec --help to see available flags.

Worked perfectly. Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sbbug picture sbbug  Â·  5Comments

aininot260 picture aininot260  Â·  3Comments

MachineJeff picture MachineJeff  Â·  5Comments

peijason picture peijason  Â·  3Comments

SyGoing picture SyGoing  Â·  4Comments