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

Update metrics.py with IoU protected divides #8550

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

glenn-jocher
Copy link
Member

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

Resolve #8549

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improved numerical stability in bounding box operations.

πŸ“Š Key Changes

  • Added an eps (epsilon) parameter to the box_iou, bbox_ioa, and wh_iou functions to prevent division by zero errors.
  • The default value for eps is set to 1e-7 for all three functions.

🎯 Purpose & Impact

  • 🎯 Prevents Division by Zero: The addition of an epsilon term in the denominator ensures there’s no division by zero, which can occur if bounding boxes have zero area during calculations.
  • πŸ“ˆ Increases Numeric Stability: Small denominators can cause numeric instability in computations, so introducing eps helps maintain reliable results.
  • πŸ” Enhances General Robustness: By making these functions more robust, users can expect more consistent and error-free performance when dealing with a variety of different sized bounding boxes.

@glenn-jocher glenn-jocher self-assigned this Jul 11, 2022
@glenn-jocher glenn-jocher merged commit 0414637 into master Jul 11, 2022
@glenn-jocher glenn-jocher deleted the update/protect-divide branch July 11, 2022 23:58
Shivvrat pushed a commit to Shivvrat/epic-yolov5 that referenced this pull request Jul 12, 2022
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 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.

Bug in Metrics.py: Division by 0
1 participant