Qidian213 / deep_sort_yolov3

Real-time Multi-person tracker using YOLO v3 and deep_sort with tensorflow
GNU General Public License v3.0
1.66k stars 595 forks source link

IndexError: index 6 is out of bounds for axis 0 with size #136

Open noticeable opened 4 years ago

noticeable commented 4 years ago

你好,我想用这个工程测试一下我自己训练好的模型加入Deep-sort后的效果,但是我的类别并不像coco数据集那样多。我的模型已经转换成功了,并且我已经修改了coco.classes.txt文件为我的类别。但是还是出现了以下问题: Traceback (most recent call last): File "demo.py", line 113, in main(YOLO()) File "C:\Users\admin\Desktop\deep_sort_yolov3\yolo.py", line 33, in init self.boxes, self.scores, self.classes = self.generate() File "C:\Users\admin\Desktop\deep_sort_yolov3\yolo.py", line 72, in generate score_threshold=self.score, iou_threshold=self.iou) File "C:\Users\admin\Desktop\deep_sort_yolov3\yolo3\model.py", line 170, in yolo_eval anchors[anchor_mask[l]], num_classes, input_shape, image_shape) IndexError: index 6 is out of bounds for axis 0 with size 6

请问是我的什么地方修改有问题吗?

kutsenkoilya commented 4 years ago

@noticeable looks like you're trying to run Yolov3-tiny model, it has 6 anchors when full-sized model is using 9. You have to reference this project: https://github.com/qqwweee/keras-yolo3 Copy code from yolov3/model.py and make followig modifications in yours yolov3/model.py:

robin-shaun commented 4 years ago

@noticeable looks like you're trying to run Yolov3-tiny model, it has 6 anchors when full-sized model is using 9. You have to reference this project: https://github.com/qqwweee/keras-yolo3 Copy code from yolov3/model.py and make followig modifications in yours yolov3/model.py:

  • add num_layers param where needed
  • set anchor_mask depending on num_layers
  • replace range(3) with range(num_layers) At least it worked for me.

That's quite good!