Incorrect TensorRT inference after ONNX export with dynamic shapes (batch size >= 1)
Author: DLegushevCreated Jan 22, 2026Updated Jan 22, 2026
Description: When exporting a YOLOX-S model to ONNX with dynamic input shapes, the subsequent conversion to TensorRT produces incorrect inference results for batch size >= 1.
Observed behavior:
- ONNX model exported with dynamic batch dimension
- TensorRT engine built from this ONNX model
- Inference results are incorrect for batch size >= 1
- Bounding boxes are corrupted, inconsistent, or mismatched to inputs
Expected behavior:
- TensorRT inference should produce correct bounding boxes for any batch size, consistent with PyTorch / static-shape ONNX results
Notes:
- Issue does not occur with static-shape ONNX export
- Suspected problem in ONNX export or dynamic shape handling during TensorRT conversion
Source: Megvii-BaseDetection/YOLOX