tanluren / yolov3-channel-and-layer-pruning

yolov3 yolov4 channel and layer pruning, Knowledge Distillation 层剪枝,通道剪枝,知识蒸馏
Apache License 2.0
1.5k stars 446 forks source link

IndexError: index -1 is out of bounds for axis 0 with size 0 #22

Open deep-practice opened 4 years ago

deep-practice commented 4 years ago

训练自己的数据集,同样的配置在darknet下面可以正常训练,但使用本项目跑完一轮就报错 Corrupt JPEG data: 2 extraneous bytes before marker 0xd9 0/99 8.39G 1.26 1.18 8.95 11.4 0 162 416: 100%|████████████████████████████████████████████████████████████████████████████| 1228/1228 [07:18<00:00, 2.80it/s] Traceback (most recent call last): File "train.py", line 527, in train() # train normally File "train.py", line 404, in train save_json=final_epoch and epoch > 0 and 'coco.data' in data) File "/home/work/deep_learning/yolov3-channel-and-layer-pruning/test.py", line 50, in test dataset = LoadImagesAndLabels(test_path, img_size, batch_size) File "/home/work/deep_learning/yolov3-channel-and-layer-pruning/utils/datasets.py", line 270, in init nb = bi[-1] + 1 # number of batches IndexError: index -1 is out of bounds for axis 0 with size 0 进入报错位置,打印了n和bi的值,分别为0和[] 请问有人碰到过吗

zbyuan commented 4 years ago

参考这个:https://blog.csdn.net/qq_34795071/article/details/90769094

deep-practice commented 4 years ago

数据集里面是不是不能包含没有目标的图片?

tanluren commented 4 years ago

可以包含,即有image没label文件,但train.txt要指定所有image的路径,你上面的错误很可能是train.txt为空

deep-practice commented 4 years ago

train.txt为空,怎么会跑完一轮呢 我里面image存在,但label为空的情况,即背景图片,按照pj给的代码生成的

deep-practice commented 4 years ago

但是想不明白为什么第一轮有数据,第二轮就全部变为0了

tanluren commented 4 years ago

嗯,是我没看仔细。但问题还是差不多,你去到test那一步了,测试集读取为空,构建dataset失败, 你看看你的test.txt里面是不是空的,或者图片是否符合以下格式:'.bmp', '.jpg', '.jpeg', '.png', '.tif'

deep-practice commented 4 years ago

@tanluren 你提到test.txt 我想应该是这个问题了 之前数据少 就全部拿去训练了 用这个项目跑的模型 拿到原版去运行会有精度损失吗

tanluren commented 4 years ago

源码的推理计算和u版有点不一样,具体差异未研究。源码训练的weights可以直接在u用,但u转化后的weights在源码跑的置信度偏低,但框是准的。目前解决方法是拿到源码稍微微调一下就正常了

fraduq commented 4 years ago

Has your problem been solved? I also encountered a similar problem. I would like to ask you how to solve it