-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
Fix possible image drawing issues #13423
Conversation
Fixed non-meaningful labels in the top right (row 1, column 4) plots when batch size is larger than max_subplots. Signed-off-by: zzzer <[email protected]>
👋 Hello @zhixuwei, thank you for submitting an
Furthermore, for bug fixes, we request a Minimum Reproducible Example (MRE) if possible. If you haven't already provided it, this aids in understanding and verifying the fix. For more guidance, please refer to our Contributing Guide. An Ultralytics engineer will review your PR shortly. Feel free to reach out with any questions or comments. Thanks again for your contribution! 🎉 |
@zhixuwei thank you for your observation. It seems there might be an issue with how labels are being drawn when the batch size exceeds |
@pderrenger Most people don't notice this when training a model on a personal computer because the batch size is not set very large. I also stumbled upon this while tuning the training parameters. This was indeed a bug, so I submitted a PR to fix it. |
Signed-off-by: Glenn Jocher <[email protected]>
@zhixuwei PR merged! |
@glenn-jocher Thanks PR, but the correct number of draws can be satisfied by using |
Ah yes, you are correct! Can you open a second PR to fix this? Thank you! |
Can you test also with batch size argument larger than dataset size, i.e. with COCO8 and batch=16 |
This reverts commit 81ac034.
I resubmitted a PR in a concise manner |
@glenn-jocher I tested batch sizes of 5, 16, 17, and 32 on my own data set, and used bs as a loop condition. |
@glenn-jocher The formula for bs is similar to: |
Fixed non-meaningful labels in the top right (row 1, column 4) plots when batch size is larger than max_subplots.
Fixed non-meaningful labels in the top right (row 1, column 4) plots when batch size is larger than max_subplots.
The reason is that when the batch size is larger than max_subplots, the pre-repair plots will be looped one more time, and the unnecessary looping may accidentally draw the labels of the images indexed as max_subplots in the batch to the top-right corner of the image.
I fix the situation in this PR by using bs instead of i+1, plus I is not suitable for handling other logic as part of the for loop above.
I have read the CLA Document and I sign the CLA
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Improved the loop control in the image annotation function to prevent out-of-bounds errors.
📊 Key Changes
plot_images()
function to usemin(bs, i + 1)
instead ofi + 1
.🎯 Purpose & Impact