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

Loss and IoU speed improvements #7361

Merged
merged 5 commits into from
Apr 10, 2022
Merged

Loss and IoU speed improvements #7361

merged 5 commits into from
Apr 10, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Apr 10, 2022

Last index slicing in build_targes() 3x faster (3us to 1us) in ec5ccde

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Refactor of bounding box operations and loss calculations in YOLOv5 for enhanced clarity and efficiency.

πŸ“Š Key Changes

  • πŸ”§ Modified bbox_iou function to handle box coordinates more consistently and cleanly.
  • πŸ’‘ Changed how targets are built by simplifying tensor concatenation.
  • 🧹 Cleaned up usage of tensor operations by applying squeeze() and more expressive slicing.
  • πŸ” Refined computation of IoU by directly using box_area and avoiding unnecessary transposes.
  • πŸ›  Relocated box_iou from metrics.py to general.py to consolidate IoU related operations.

🎯 Purpose & Impact

  • πŸ’Ž Improved Code Quality: The simpler, more legible code will be easier to maintain and less prone to bugs.
  • πŸš€ Increased Efficiency: The changes potentially make the code execute faster and use less memory by optimizing tensor operations.
  • πŸ› Cleaner Interfaces: Users will experience cleaner internal operations, leading to potentially fewer errors and improved performance when training or using YOLOv5 models.

@glenn-jocher glenn-jocher self-assigned this Apr 10, 2022
@glenn-jocher glenn-jocher changed the title Loss speed improvements Loss and IoU speed improvements Apr 10, 2022
@glenn-jocher glenn-jocher merged commit 406ee52 into master Apr 10, 2022
@glenn-jocher glenn-jocher deleted the update/loss_speed branch April 10, 2022 11:46
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Loss speed improvements

* bbox_iou speed improvements

* bbox_ioa speed improvements

* box_iou speed improvements

* box_iou speed improvements
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.

1 participant