Namespace(batch_size=8, class_path='data/custom/classes.names', conf_thres=0.001, data_config='config/custom.data', img_size=416, iou_thres=0.5, model_def='config/yolov3-custom.cfg', n_cpu=8, nms_thres=0.5, weights_path='checkpoints/yolov3_ckpt_195.pth')
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1741, in
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/caochenghua/Documents/GitHub/Pytorch-Yolov3---Remote-sensing-image-master/test.py", line 83, in
model = Darknet(opt.model_def).to(device)
File "/Users/caochenghua/Documents/GitHub/Pytorch-Yolov3---Remote-sensing-image-master/models.py", line 241, in init
self.yolo_layers = [layer[0] for layer in self.module_list if hasattr(layer[0], "metrics")]
File "/Users/caochenghua/Documents/GitHub/Pytorch-Yolov3---Remote-sensing-image-master/models.py", line 241, in
self.yolo_layers = [layer[0] for layer in self.module_list if hasattr(layer[0], "metrics")]
File "/anaconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 68, in getitem
return self._get_item_by_idx(self._modules.values(), idx)
File "/anaconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 60, in _get_item_by_idx
raise IndexError('index {} is out of range'.format(idx))
IndexError: index 0 is out of range
请问这是什么原因呢?
下载了训练好的yolov3_ckpt_195.pth 修改了yolov3-custom.cfg里面 [yolo]节点下面的classes=2 不然int(空字符串的时候)报错 之后运行加载权重文件报错
Namespace(batch_size=8, class_path='data/custom/classes.names', conf_thres=0.001, data_config='config/custom.data', img_size=416, iou_thres=0.5, model_def='config/yolov3-custom.cfg', n_cpu=8, nms_thres=0.5, weights_path='checkpoints/yolov3_ckpt_195.pth') Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1741, in
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/caochenghua/Documents/GitHub/Pytorch-Yolov3---Remote-sensing-image-master/test.py", line 83, in
model = Darknet(opt.model_def).to(device)
File "/Users/caochenghua/Documents/GitHub/Pytorch-Yolov3---Remote-sensing-image-master/models.py", line 241, in init
self.yolo_layers = [layer[0] for layer in self.module_list if hasattr(layer[0], "metrics")]
File "/Users/caochenghua/Documents/GitHub/Pytorch-Yolov3---Remote-sensing-image-master/models.py", line 241, in
self.yolo_layers = [layer[0] for layer in self.module_list if hasattr(layer[0], "metrics")]
File "/anaconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 68, in getitem
return self._get_item_by_idx(self._modules.values(), idx)
File "/anaconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 60, in _get_item_by_idx
raise IndexError('index {} is out of range'.format(idx))
IndexError: index 0 is out of range
请问这是什么原因呢?