WongKinYiu / ScaledYOLOv4

Scaled-YOLOv4: Scaling Cross Stage Partial Network
GNU General Public License v3.0
2.02k stars 574 forks source link

"__getitem__" in LoadImagesAndLabels class #322

Open jackhu-bme opened 3 years ago

jackhu-bme commented 3 years ago

Hi, I found something strange in loadImagesAndLabels class when I tried to use "image_weight", which is a policy of upadating the weight of each class when training based on map. The error I 'm faced with is actually almost the same as the one in this link: https://github.com/ultralytics/yolov5/issues/885 the same attribute error: 'LoadImagesAndLabels' object has no attribute 'indices' and found almost the same code in places linked to this error. So I guess it's the same way to fix it.

jackhu-bme commented 3 years ago

@WongKinYiu

jackhu-bme commented 3 years ago

Actually, this is how to fix the bug, I guess. https://github.com/ultralytics/yolov5/commit/69ff781ca5fa995ce2eeae215a486ab9f7ff566c

jackhu-bme commented 3 years ago

Well,I tried the way I mentioned to fix it, and it worked. Meanwhile, it greatly accelerated the training process and improved the performance on classes with relatively little training data, so I believe it worths to be fixed.