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

Apple MPS -> CPU NMS fallback strategy #9600

Merged
merged 1 commit into from
Sep 26, 2022
Merged

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Sep 26, 2022

Until more ops are fully supported this update will allow for seamless MPS inference (but slower MPS to CPU transfer before NMS, so slower NMS times).

python detect.py --device mps

Partially resolves #9596

Signed-off-by: Glenn Jocher glenn.jocher@ultralytics.com

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced compatibility for Metal Performance Shaders (MPS) in non_max_suppression function.

πŸ“Š Key Changes

  • Added a check to see if the MPS backend is being used.
  • Converting prediction tensors to CPU if they are on an MPS device before Non-Maximum Suppression (NMS).

🎯 Purpose & Impact

  • Purpose: To ensure the non_max_suppression function works even if the MPS backend is used, preventing any potential issues due to incomplete MPS support.
  • Impact: Users working on Apple silicon Macs that leverage MPS for accelerated machine learning tasks will now experience smoother operation with YOLOv5, ensuring wider hardware compatibility. πŸπŸ’»βœ¨

Until more ops are fully supported this update will allow for seamless MPS inference (but slower MPS to CPU transfer before NMS, so slower NMS times).

Partially resolves #9596

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher glenn-jocher merged commit c4c0ee8 into master Sep 26, 2022
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-2 branch September 26, 2022 12:13
@glenn-jocher glenn-jocher self-assigned this Sep 26, 2022
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.

Apple MPS inference with detect.py
1 participant