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

fix bug for trt inference #12209

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Conversation

AllenZYJ
Copy link

@AllenZYJ AllenZYJ commented Oct 8, 2023

When I was doing inference with ”engine“ on “Nvidia agx” device, I found that ”segment/predict.py“ would report a dimension mismatch error. The reason was that the output branch selection was wrong. This simple change fixes that error, and allows smooth inference on trt devices.

🤖 Generated by Copilot at 19c8663

Summary

🐛🚀🧠

Fix output order bug in models/common.py for TensorRT. Hardcode output names to match YOLOv5 output layers.

y variable
hardcoded for TensorRT
autumn bug fixing

Walkthrough

  • Fix incorrect detection results when using TensorRT by hardcoding output names to match output layers in YOLOv5 model (link)

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

📊 Key Changes

  • Adjusted tensor output retrieval in forward method during TensorRT inference.

🎯 Purpose & Impact

  • 🛠️ Fixes a bug in TensorRT inference that could lead to incorrect tensor outputs, ensuring the model's predictions are accurate.
  • 🏃‍♂️ Increases reliability for users deploying YOLOv5 models with TensorRT, which can improve performance on compatible hardware.

🌟 Summary

Fixed a crucial bug in YOLOv5's TensorRT inference to ensure correct output tensors are retrieved, bolstering performance and reliability. 🐛➡️🔧

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hello @AllenZYJ, thank you for submitting a YOLOv5 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • ✅ Verify your PR is up-to-date with ultralytics/yolov5 master branch. If your PR is behind you can update your code by clicking the 'Update branch' button or by running git pull and git merge master locally.
  • ✅ Verify all YOLOv5 Continuous Integration (CI) checks are passing.
  • ✅ Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

@glenn-jocher
Copy link
Member

@AllenZYJ thanks for bringing this to our attention! We'll review the proposed changes and assess their compatibility with our general code structure.

It's great to see the community actively working to improve the YOLOv5 codebase for various inference and deployment scenarios. We appreciate your effort and contribution to making YOLOv5 more versatile.

@AllenZYJ
Copy link
Author

@AllenZYJ thanks for bringing this to our attention! We'll review the proposed changes and assess their compatibility with our general code structure.

It's great to see the community actively working to improve the YOLOv5 codebase for various inference and deployment scenarios. We appreciate your effort and contribution to making YOLOv5 more versatile.

thanks, it just a simple modified,and I tested it locally.

@glenn-jocher
Copy link
Member

@AllenZYJ your contribution is appreciated, AllenZYJ. We value your testing and input, which helps ensure the stability and functionality of YOLOv5 across diverse deployment scenarios.

@AllenZYJ
Copy link
Author

AllenZYJ commented Nov 14, 2023

@AllenZYJ your contribution is appreciated, AllenZYJ. We value your testing and input, which helps ensure the stability and functionality of YOLOv5 across diverse deployment scenarios.

hello,@glenn-jocher,I was wondering if you've been able to complete testing this PR and if everything passed?

@glenn-jocher
Copy link
Member

@AllenZYJ Thanks for your patience. I have not been able to test the PR yet, but I will definitely do so at the earliest opportunity. Your effort and the community's support are invaluable in maintaining the stability and functionality of YOLOv5 in diverse deployment scenarios.

Copy link
Contributor

github-actions bot commented Apr 9, 2024

All Contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@AllenZYJ
Copy link
Author

AllenZYJ commented Apr 9, 2024

I have read the CLA Document and I sign the CLA

@AllenZYJ
Copy link
Author

@glenn-jocher please review this merge,thank you very much.

@glenn-jocher
Copy link
Member

@AllenZYJ Thank you for your contribution! We'll review the merge as soon as possible. Your patience and efforts are much appreciated! 🙌

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

Successfully merging this pull request may close these issues.

None yet

3 participants