trtexec on ONNX with dynamic input shape fails on Linux, succeeds on Windows (same net & args)

I have a network in ONNX format. I installed trt 7.0.0.11 with CUDA 10.0 on a Windows 10 and an Ubuntu 16.04 system. On both system, I type

trtexec --onnx="net.onnx" --minShapes='ph:0':1x174x174x1 --optShapes='ph:0':1x238x238x1 --maxShapes='ph:0':1x430x430x1 --saveEngine="net.trt"

On Windows, trtexec succeeds and outputs

&&&& RUNNING TensorRT.trtexec # trtexec --onnx=net.onnx --minShapes='ph:0':1x174x174x1 --optShapes='ph:0':1x238x238x1 --maxShapes='ph:0':1x430x430x1 --saveEngine=net.trt
...
[02/04/2020-10:53:39] [I] Input build shape: ph:0=1x174x174x1+1x238x238x1+1x430x430x1
...
&&&& PASSED TensorRT.trtexec # trtexec --onnx=net.onnx --minShapes='ph:0':1x174x174x1 --optShapes='ph:0':1x238x238x1 --maxShapes='ph:0':1x430x430x1 --saveEngine=net.trt

On Linux, the same command line fails:

&&&& RUNNING TensorRT.trtexec # trtexec --onnx=net.onnx --minShapes=ph:0:1x174x174x1 --optShapes=ph:0:1x238x238x1 --maxShapes=ph:0:1x430x430x1 --saveEngine=net.trt
...
[02/04/2020-11:08:49] [I] Input build shape: ph=0+0+0
...
[02/04/2020-11:08:50] [W] Dynamic dimensions required for input: ph:0, but no shapes were provided. Automatically overriding shape to: 1x1x1x1
[02/04/2020-11:08:54] [F] [TRT] Assertion failed: SymbolicCoord(p) >= 0
../builder/tacticOptimizer.cpp:439
Aborting...

Why is there this discrepency in behavior, and how to make the compilation work on Linux?

Hi,

Your network definition must be created with the explicitBatch flag set ("–explicitBatch").
Please refer below link for more details:
https://docs.nvidia.com/deeplearning/sdk/tensorrt-archived/tensorrt-700/tensorrt-release-notes/tensorrt-7.html#tensorrt-7

If issue persist, please share the model file so we can help better.

Thanks

I have the same behavior with the --explcitBatch command line argument (success on Windows, failure on Linux).

How do I share the model file with you?

Hi,

You can either upload the zip model file on dev forum or on any other third party drive.

Thanks

Oh ok I didn’t see the option, here is the zip.

Hi,

In above case you need to pass the complete input id.
Please use the below command, it worked on my system (keep \ before all ')

./trtexec --onnx=net.onnx --minShapes=\'dtc/input/ph_im:0\':1x174x174x1 --optShapes=\'dtc/input/ph_im:0\':1x238x238x1 --maxShapes=\'dtc/input/ph_im:0\':1x430x430x1 --saveEngine=net.trt --verbose --explicitBatch

Thanks

Oh I see, the backslash did the trick. Thanks!