主要照这篇博客进行训练配置,因为没有GPU所以好多坑,CPU训练可以参见这篇博客
正所谓,跑通了的都一样,错误千万样。按照教程来也是坑多
训练:
python train_faster_rcnn_alt_opt.py --net_name ZF --weights /home/lys/py-faster-rcnn/data/imagenet_models/ZF.v2.caffemodel --cfg /home/lys/py-faster-rcnn/experiments/cfgs/faster_rcnn_alt_opt.yml --imdb voc_2007_trainval
error1:
Cannot use GPU in CPU-only Caffe: check mode.
solution1:
把py-faster-rcnn/tools/下的所有py文件中的GPU注释掉,然后mode设为cpu。示例如下:
# caffe.set_mode_gpu()
caffe.set_mode_cpu()
# if args.gpu_id is not None:
# caffe.set_device(args.gpu_id)
error2:
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "train_faster_rcnn_alt_opt.py", line 125, in train_rpn
roidb, imdb = get_roidb(imdb_name)
File "train_faster_rcnn_alt_opt.py", line 62, in get_roidb
imdb = get_imdb(imdb_name)
File "/home/lys/py-faster-rcnn/tools/../lib/datasets/factory.py", line 38, in get_imdb
return __sets[name]()
File "/home/lys/py-faster-rcnn/tools/../lib/datasets/factory.py", line 20, in <lambda>
__sets[name] = (lambda split=split, year=year: pascal_voc(split, year))
File "/home/lys/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 39, in __init__
self._image_index = self._load_image_set_index()
File "/home/lys/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 83, in _load_image_set_index
'Path does not exist: {}'.format(image_set_file)
AssertionError: Path does not exist: /home/lys/py-faster-rcnn/data/VOCdevkit2007/VOC2007/ImageSets/Main/trainval.txt
solution2:
智障错误。只顾了查看trainval.txtz在不在了,没有创建VOCdevkit2007文件夹,直接就VOC2007了
error3:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "train_faster_rcnn_alt_opt.py", line 125, in train_rpn
roidb, imdb = get_roidb(imdb_name)
File "train_faster_rcnn_alt_opt.py", line 68, in get_roidb
roidb = get_training_roidb(imd