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

Bug in Metrics.py: Division by 0 #8549

Closed
2 tasks done
UnglvKitDe opened this issue Jul 11, 2022 · 3 comments · Fixed by #8550
Closed
2 tasks done

Bug in Metrics.py: Division by 0 #8549

UnglvKitDe opened this issue Jul 11, 2022 · 3 comments · Fixed by #8550
Labels
bug Something isn't working

Comments

@UnglvKitDe
Copy link
Contributor

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Training, Validation

Bug

@glenn-jocher Maybe similar to #8539, divisions with 0 may occur in methods box_iou(...) and wh_iou(...).

yolov5/utils/metrics.py

Lines 279 to 280 in a84cd02

# IoU = inter / (area1 + area2 - inter)
return inter / (box_area(box1.T)[:, None] + box_area(box2.T) - inter)

return inter / (wh1.prod(2) + wh2.prod(2) - inter) # iou = inter / (area1 + area2 - inter)

Environment

YOLOv5 torch 1.11 (cuda 11.3) and 1.12 (cuda 11.6)

Minimal Reproducible Example

By using torch.zeros(...) for both arguments (extreme case)

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@glenn-jocher
Copy link
Member

@UnglvKitDe good news 😃! Your original issue may now be fixed ✅ in PR #8550. To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

@UnglvKitDe
Copy link
Contributor Author

@glenn-jocher Thank you :)

@glenn-jocher
Copy link
Member

@UnglvKitDe you're welcome! 😊 I'm glad I could help. If you have any more questions or need further assistance, feel free to reach out. Good luck with your YOLOv5 projects!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants