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

Detect.inplace=False for multithread-safe inference #8801

Merged
merged 1 commit into from
Jul 30, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Jul 30, 2022

Detect.inplace=False for safe multithread inference when loading YOLOv5 AutoShape models with PyTorch Hub.

May resolve #8565

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved thread safety for multi-threaded inference in the YOLOv5 model.

📊 Key Changes

  • Set Detect.inplace attribute to False during model creation for safer multithreading.
  • Tidy-up in the yolo.py comments without changing functionality (changed 'in-place' to 'inplace').

🎯 Purpose & Impact

  • 🧵 The modification ensures thread safety, reducing the risk of issues when the YOLOv5 model is used in environments with multiple threads making inferences simultaneously.
  • 🚀 Potential impact includes more robust performance in multi-threaded applications, improving the model's reliability and usability in production environments.

@glenn-jocher glenn-jocher self-assigned this Jul 30, 2022
@glenn-jocher glenn-jocher changed the title Detect.inplace=False for safe multithread inference Detect.inplace=False for multithread-safe inference Jul 30, 2022
@glenn-jocher glenn-jocher merged commit 1e89807 into master Jul 30, 2022
@glenn-jocher glenn-jocher deleted the update/inplace branch July 30, 2022 20:19
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
Detect.inplace=False for safe multithread inference
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.

Detect(inplace=True) multithreaded detection RuntimeError
1 participant