Faster R-CNN,TensorFlow版本训练过程中出现:keep_inds = np.append(fg_inds, bg_inds) (Pdb)
> /data/sam.yi/Image_manipulation_detection/lib/layer_utils/proposal_target_layer.py(139)_sample_rois()
-> keep_inds = np.append(fg_inds, bg_inds)
(Pdb)
(Pdb)
(Pdb)
(Pdb)
(Pdb)
解决方法:
参考 https://github.com/dBeker/Faster-RCNN-TensorFlow-Python3/issues/31中的几种方法
-
修改config.py中的两个阈值:
tf.app.flags.DEFINE_float(‘roi_bg_threshold_high’, 0.5, “Overlap threshold for a ROI to be considered background (class = 0 if overlap in [LO, HI))”)
tf.app.flags.DEFINE_float(‘roi_bg_threshold_low’, 0.1, “Overlap threshold for a ROI to be considered background (class = 0 if overlap in [LO, HI))”)
将两个值0.5设置为0.3,0.1设置为0.0。 -
修改lr学习率,0.1降为0.0001
-
修改SCALES,比如: SCALES = [1,2,4,8,16], RATIOS = [0.5,1,2]
-
修改pascal_voc.py中的四行代码,将-1去掉
x1 = float(bbox.find('xmin').text) - 1
y1 = float(bbox.find('ymin').text