Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significant errors in confidence scores after TensorRT conversion #306

Open
vtyw opened this issue Nov 28, 2023 · 0 comments
Open

Significant errors in confidence scores after TensorRT conversion #306

vtyw opened this issue Nov 28, 2023 · 0 comments

Comments

@vtyw
Copy link

vtyw commented Nov 28, 2023

TL;DR: After TensorRT model conversion, confidence scores drop in accuracy much more than bounding box values. What property of TensorRT or the YOLO architecture causes this?

I use tkDNN for converting yolov4 and yolov4-csp models. The detections using the converted TensorRT engines look very similar visually to the original darknet detections, but on closer inspection, there are some noticeable differences.

Bounding box values before and after conversion are very very similar, with only a few outliers (< 0.1%) of values shifting in value by more than 0.02. In contrast, confidence scores before and after conversion can differ significantly, even as much as by 0.5! Of course, the converted network won't perform the same as before, but it seems surprising that bounding box values are highly consistent post-conversion, while confidence values can be occasionally inconsistent by a high margin.

Here's an example of before and after detections to illustrate the behavior I mean. Note that some detection inputs and networks perform much worse than this, e.g. for yolov4 pretrained weights I can get as much as one third of confidence scores shifting in value by more than 0.05.

tkdnn-fp32-accuracy

Possible explanations that I've ruled out:

  • Floating point precision seems unrelated. Performance differences between FP32 and FP16 variants of a network are negligible.
  • This occurs with yolov4 and yolov4-csp, both pretrained and custom trained weights.
  • This phenomenon isn't unique to tkDNN, i.e., I observe very similar properties when converting a network within DeepStream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant