TensorRT warnings : Dynamic dimensions required for input: input, but no shapes were provided

Description

I’m trying to convert MobileNetV2 ONNX model to TRT file. I’m using the following command for the batch size of 32 images:

trtexec --workspace=4096 --onnx=mobilenetv2-7.onnx --shapes=data:32x3x224x224 --saveEngine=mobilenet_engine_int8_32.trt --int8 --explicitBatch

I always get this warning

[03/31/2021-00:48:51] [W] Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding shape to: 1x3x224x224

How to fix it and enable custom batch sizes? Ideally what I want is 32x3x224x224

Environment

TensorRT Version: 7.2.2.3
GPU Type: A100-40GB
Nvidia Driver Version: 460.39
CUDA Version: 11.1
CUDNN Version:
Operating System + Version: Ubuntu 20.04
Python Version (if applicable):
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag): nvcr.io/nvidia/tensorflow:21.02-tf1-py3

Relevant Files

ONNX model Link : models/vision/classification/mobilenet/model at master · onnx/models · GitHub

Steps To Reproduce

  1. Download and start the container: nvcr.io/nvidia/tensorflow:21.02-tf1-py3
  2. Download the ONNX file from github: models/vision/classification/mobilenet/model at main · onnx/models · GitHub
  3. Install trtexec and execute the following command:
    trtexec --workspace=4096 --onnx=mobilenetv2-7.onnx --shapes=data:32x3x224x224 --saveEngine=mobilenet_engine_int8_32.trt --int8 --explicitBatch

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered

Hi @hkr1990,

We tried reproducing the issue, identified that input layer name is wrongly mentioned.
Its working fine now.
Please try with following command.
trtexec --workspace=4096 --onnx=mobilenetv2-7.onnx --shapes=input:32x3x224x224 --saveEngine=mobilenet_engine_int8_32.trt --int8 --explicitBatch

Thank you.