YunYang1994 / tensorflow-yolov3

🔥 TensorFlow Code for technical report: "YOLOv3: An Incremental Improvement"
https://yunyang1994.gitee.io/2018/12/28/YOLOv3-算法的一点理解/
MIT License
3.63k stars 1.36k forks source link

IndexError: index 69 is out of bounds for axis 1 with size 52 #201

Open DeeeeepL opened 5 years ago

DeeeeepL commented 5 years ago

错误出现在dataset.py文件里 train loss: 1137.87: 100%|██████████████████████| 46/46 [00:26<00:00, 1.71it/s] Traceback (most recent call last): File "train.py", line 184, in if name == 'main': YoloTrain().train() File "train.py", line 161, in train for test_data in self.testset: File "/home/hyk/学习/tf_yolo_v3/tensorflow-yolov3-master/core/dataset.py", line 82, in next label_sbbox, label_mbbox, label_lbbox, sbboxes, mbboxes, lbboxes = self.preprocess_true_boxes(bboxes) File "/home/hyk/学习/tf_yolo_v3/tensorflow-yolov3-master/core/dataset.py", line 244, in preprocess_true_boxes label[best_detect][yind, xind, best_anchor, :] = 0 IndexError: index 69 is out of bounds for axis 1 with size 52

DeeeeepL commented 5 years ago

有人遇到过类似的问题吗

HtutLynn commented 5 years ago

This is what I did to the preprocess_true_boxes func in dataset.py : xind,yind = abs(xind),abs(yind) if yind >= label[best_detect].shape[1]: yind = label[best_detect].shape[1] - 1 if xind >= label[best_detect].shape[0]: xind = label[best_detect].shape[0] -1

This solved the problem and I think it would work fine too.