训练过程中错误
error 1:assert (boxes[:, 2] >= boxes[:, 0]).all()
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 "./tools/train_faster_rcnn_alt_opt.py", line 123, in train_rpn
roidb, imdb = get_roidb(imdb_name)
File "./tools/train_faster_rcnn_alt_opt.py", line 68, in get_roidb
roidb = get_training_roidb(imdb)
File "/home/microway/test/pytest/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 121, in get_training_roidb
imdb.append_flipped_images()
File "/home/microway/test/pytest/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 108, in append_flipped_images
assert (boxes[:, 2] >= boxes[:, 0]).all()
AssertionError
error1 解决办法:
将py-faster-rcnn/lib/datasets/imdb.py中的相应代码改成如下代码即可:
def append_flipped_images(self):
num_images = self.num_images
widths = [PIL.Image.open(self.image_path_at(i)).size[0]
for i in xrange(num_images)]
for i in xrange(num_images):
boxes = self.roidb[i]['boxes'].copy()
oldx1 = boxes[:, 0].copy()
oldx2 = boxes[:, 2].copy()
boxes[:, 0] = widths[i] - oldx2 - 1
boxes[:, 2] = widths[i] - oldx1 - 1
for b in range(len(boxes)):
if boxes[b][2] < boxes[b][0]:
boxes[b][0] = 0
assert (boxes[:, 2] >= boxes[:, 0]).all()
error 2:IndexError: list index out of range
File "./tools/train_net.py", line 85, in
roidb = get_training_roidb(imdb)
File "/usr/local/fast-rcnn/tools/../lib/fast_rcnn/train.py", line 111, in get_training_roidb
rdl_roidb.prepare_roidb(imdb)
File "/usr/local/fast-rcnn/tools/../lib/roi_data_layer/roidb.py", line 23, in prepare_roidb
roidb[i]['image'] = imdb.image_path_at(i)
IndexError: list index out of range
error2 解决办法:
删除fast-rcnn-master/data/cache/ 文件夹下的.pkl文件,或者改名备份,重新训练即可。