What should I do if the targets empty in loss.py ?
Search before asking
- [X] I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
I change the yolov5's output from(cls,x,y,w,h,conf) to (cls,x1,y1,x2,y2,x3,y3,x4,y4,conf) which is the polygon. But when I put the big datasets to train I get the fault tip.
File "/home/rp/DeepLearning/RobotPilots-master/utils/loss.py", line 648, in build_targets
gi, gj = gij.T # grid xy indices
ValueError: not enough values to unpack (expected 2, got 0)
And I found that in loss.py the targets empty just like that:
Could you give me some suggestions to search why the targets zeros? Thanks.
Additional
No response
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 🚀 resources:
- Wiki – https://github.com/ultralytics/yolov5/wiki
- Tutorials – https://docs.ultralytics.com/yolov5
- Docs – https://docs.ultralytics.com
Access additional Ultralytics ⚡ resources:
- Ultralytics HUB – https://ultralytics.com/hub
- Vision API – https://ultralytics.com/yolov5
- About Us – https://ultralytics.com/about
- Join Our Team – https://ultralytics.com/work
- Contact Us – https://ultralytics.com/contact
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!
@broalantaps hi there! It looks like you've modified the YOLOv5's output format to accommodate polygons, which is a neat idea. It seems that you're encountering an issue with empty targets in loss.py while training on large datasets. The error you're seeing in loss.py is likely related to the change in output format.
Based on the error message, it seems that the grid indices (gi, gj) are not being set properly, resulting in empty targets. You may need to update the targets calculation in build_targets to accommodate the new output format. It's essential to ensure that the targets are being populated correctly based on your custom output.
I would recommend thoroughly checking your modifications in the output format and verifying that the targets are being correctly populated for the new polygon-based format. You may also want to review the build_targets function and its interaction with your custom output format.
Feel free to consult the YOLOv5 documentation for more information on customizing the model's output format and handling targets in training. I hope this helps, and good luck with your customization!