NVIDIA / NVIDIA/TensorRT

Inconsistency between the outputs of dino onnx and dino trt engine

Open
#4,404 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module:Accuracy triaged
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

Hi team,

I'm using trtexec to convert dino onnx to trt engine. however I'm seeing different outputs compared to dino onnx. here is what I found: Would appreciate it if you could share your insights. Thanks!

  • I tested the outputs on 2 images and visualized the results
  • dino torch vs dino onnx: quite similar
    • conf score: almost same
    • bbox: shifted a little bit, but it's okay
  • dino onnx vs dino trtr: totally different
    • conf score: is decreased by one order of magnitude.
    • bbox: totally different

Some context:

I'm using mmdeploy to convert dino torch -> dino onnx -> dino trt,

    • I need to build custom ops (gird_sampler ) for onnxruntime and trt separately to support the conversion. Everything looks good to me and I built these dynamic libraries successfully. They are used to complete the conversion and launch triton server for inference. I attached them too for further debug

I used the following cmd to do the conversion, (I'm assuming dino torch->dino onnx succeeded because the outputs are consistent) so I only post the cmd that I used in the 2nd stage(dino onnx -> dino trt)

/azureuser/TensorRT-10.3.0.26/targets/x86_64-linux-gnu/bin/trtexec --onnx=mmdeploy_model/dino_trt_aman_fp16_0304_torchscript/end2end.onnx  --saveEngine=mmdeploy_model/dino_trt_aman_fp16_0304_torchscript/end2end_fp16.plan --minShapes=input:1x3x240x240 --optShapes=input:2x3x240x240 --maxShapes=input:4x3x240x240 --useCudaGraph --plugins=mmdeploy/mmdeploy/lib/libmmdeploy_tensorrt_ops.so --verbose

dependencies:
Github repo: https://github.com/open-mmlab/mmdeploy/tree/main

My VM:
Cuda 12.6
Standard NC4as T4 v3

Dependencies:
Torch 2.1.0
Onnx 1.19.0
TensorRT 10.3.0
Torchscript https://download.pytorch.org/libtorch/cu121
Triton 24.08

full logs

trtexec.log

my PR for mmdeploy to build custom ops
https://github.com/Desperado721/mmdeploy/pull/1

the virualization of dino onnx, dino torch, dino trt

Image
Image
Image

the dynamic libraries that I built

dynamic_libraries.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached trtexec.log and the reported ONNX-to-TRT command, then inspect the custom grid_sampler implementation in the mmdeploy TensorRT plugin referenced by libmmdeploy_tensorrt_ops.so. Compare the ONNX Runtime and TensorRT outputs for the same two images and determine whether the plugin or conversion causes the confidence and bounding-box differences. Done means documenting a reproducible cause and the required correction or configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.