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

Grid indices overflow bug fix #1313

Merged
merged 1 commit into from
Nov 6, 2020
Merged

Grid indices overflow bug fix #1313

merged 1 commit into from
Nov 6, 2020

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Nov 6, 2020

This PR addresses bug report #1312. In extremely rare cases, when training with mixed precision the grid index values in compute_targets() may experience overflow. This solves this problem by clamping the indices to their limits.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improvements to grid clamping in build targets and dynamic image resizing in plot images.

📊 Key Changes

  • Imported math module is moved to organize imports in general.py.
  • Updated grid clamping logic in the build_targets function to prevent out-of-bound grid indices.
  • Modified image resizing behavior in plot_images to cap the image size for enhancing visualization and reducing memory usage.

🎯 Purpose & Impact

  • 🎲 Grid Clamping: To ensure generated grid indices do not exceed model's grid dimensions, enhancing model stability.
  • 🔍 Dynamic Image Resizing: To dynamically adjust the image size during plotting to optimize for visibility while keeping file sizes manageable.
  • 🖼️ Visualization Improvement: Better plotting of images without degradation or excessive resizing, resulting in improved user experience when reviewing output images.

@glenn-jocher glenn-jocher linked an issue Nov 6, 2020 that may be closed by this pull request
@glenn-jocher
Copy link
Member Author

Also observed in YOLOv3 ultralytics/yolov3#1551

@glenn-jocher glenn-jocher merged commit fed5d9c into master Nov 6, 2020
@glenn-jocher glenn-jocher deleted the patch branch November 6, 2020 12:40
burglarhobbit pushed a commit to burglarhobbit/yolov5 that referenced this pull request Jan 1, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this pull request May 12, 2021
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 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.

Error in training my data
1 participant