Description
We want to utilize polygraphy
tool for some kind of integration test for YOLO8 in onnx vs. its corresponding TensorRT (TRT) model.
- When converting YOLO8 model to onnx and running
polygraphy run
on it, there’s one specific output which fails the comparison:Unnamed Layer* 311
. When looking in Netron we can see it corresponds to a Shape layer. - This happens with the original YOLO8 model without any changes to it, as seen in the attached code below:
import torch
from ultralytics import YOLO
original_model = YOLO("yolov8n.pt")
dummy_input = torch.zeros(1, 3, 192, 1440, requires_grad=True)
original_model.export(format='onnx', imgsz=(192, 1440),
opset=12, verbose=True)
- Polygraphy logs are attached here. Note the lines:
Comparing Output: '(Unnamed Layer* 311) [ElementWise]_output' (dtype=int32, shape=(3,)) with '311' (dtype=int64, shape=(4,))
[I] Tolerance: [abs=0.001, rel=0.001] | Checking elemwise error
[E] Will not compare outputs of different shapes. Note: Output shapes are (3,) and (4,).
Note: Use --no-shape-check or set check_shapes=False to attempt to compare values anyway.
[E] FAILED | Output: '(Unnamed Layer* 311) [ElementWise]_output' | Difference exceeds tolerance (rel=0.001, abs=0.001)
Environment
TensorRT Version: 8.5.2
GPU Type: Jetson AGX Orin NX
Nvidia Driver Version:
CUDA Version: 11.4
CUDNN Version: 8.6.0.
Operating System + Version: Ubuntu 20.04
Python Version (if applicable): Python 3.8.10
PyTorch Version (if applicable): 2.0.1
Baremetal or Container (if container which image + tag): We utilzie the polygraphy installed from nvcr.io/nvidia/l4t-tensorrt:r8.5.2.2-devel base image
onnxruntime version used for polygraphy: onnxruntime==1.15.1
numpy version used for polygraphy: numpy==1.21.6
Relevant Files
- onnx file for reproducing: yolov8n_original.onnx (12.2 MB)
- Polygraphy logs
Steps To Reproduce
- download the onnx file
- run polygraphy on this model:
polygraphy run <path_to_onnx_model> --trt --onnxrt --onnx-outputs mark all --trt-outputs mark all --atol 1e-3 --rtol 1e-3
Note: When writing this issue in yolo8 issues
they said they don’t provide support for 3rd party tools so I put my question here instead.