Hi,
Optimization profiles are meant to be used with dynamic shape. I believe you can create an optimization profile for a fixed shape model, but then kMIN==kOPT==kMAX has to equal the shape of the model (1, 3, 224, 224) in this case.
Generally, you have to export the model to ONNX with dynamic shape support from the original framework for correct results.
Trying to change a fixed shape ONNX model to dynamic shape may not always work correctly, for example, if any of the ops/layers had a hard-coded shape/parameter or something, that wouldn’t translate correctly when replacing a one of the dimensions with -1 manually.
This PyTorch tutorial shows how to export an ONNX model with dynamic shape: torch.onnx — PyTorch 1.12 documentation. You could probably try to replace torchvision.models.alexnet with torchvision.models.mobilenet_v2 in the tutorial, and most other things are probably about the same.
I would also recommend using TensorRT 7 (and possibly building the Open Source Components from GitHub - NVIDIA/TensorRT: TensorRT is a C++ library for high performance inference on NVIDIA GPUs and deep learning accelerators. if still unable to parse the ONNX model) for this if possible to have the most up to date ONNX op support.