解决方案:
(1)经过google之后发现是protobuf的本版发生了变换,之前在配置caffe的时候手动安装了protbuf,版本是2.5.0,后来安装了tensorflow 我回忆了一下,protobuf的版本貌似是发生了变换。所以解决办法:sudo pip install protobuf==2.5.0
(2)/lib/fast_rcnn/train.py增加一行import google.protobuf.text_format
2、ImportError: numpy.core.multiarray failed to import
解决方案:sudo -H pip install --upgrade numpy(升级后的numpy版本1.14.2)3、TypeError: ‘numpy.float64’ object cannot be interpreted as an index
解决方案:
1) /home/xxx/py-faster-rcnn/lib/roi_data_layer/minibatch.py
将第26行:fg_rois_per_image = np.round(cfg.TRAIN.FG_FRACTION * rois_per_image)改为:fg_rois_per_image = np.round(cfg.TRAIN.FG_FRACTION * rois_per_image).astype(np.int)
2) /home/xxx/py-faster-rcnn/lib/datasets/ds_utils.py
将第12行:hashes = np.round(boxes * scale).dot(v)
改为:hashes = np.round(boxes * scale).dot(v).astype(np.int)
3) /home/xxx/py-faster-rcnn/lib/fast_rcnn/test.py
将第129行: hashes = np.round(blobs['rois'] * cfg.DEDUP_BOXES).dot(v)
改为: hashes = np.round(blobs['rois'] * cfg.DEDUP_BOXES).dot(v).astype(np.int)
4) /home/xxx/py-faster-rcnn/lib/rpn/proposal_target_layer.py
将第60行:fg_rois_per_image = np.round(cfg.TRAIN.FG_FRACTION * rois_per_image)
改为:fg_rois_per_image = np.round(cfg.TRAIN.FG_FRACTION * rois_per_image).astype(np.int)
4、TypeError: slice indices must be integers or None or have an __index__ method
解决方案:
/home/xxx/py-faster-rcnn/lib/rpn/proposal_target_layer.py,转到126行:
start = 4 * cls这里的ind,start,end都是 numpy.int 类型,这种类型的数据不能作为索引,所以必须对其进行强制类型转换,改成
start = int(4 * cos)
end = int(start + 4)
5、operands could not be broadcast together with shapes (84,4096) (12,1)
解决方案:
出现这种错误主要是train.prototxt中的文件类别没改过来,可以下载原来的VOC的num_classes进行修改
6、Cannot copy param 0 weights from layer 'cls_score'; shape mismatch. Source param shape is 21 1024(21504); target param shape is 4 1024(4096). To learn this layer's parameters from scratch rather than
copying from a saved net, rename the layer.
解决方案:
要把对应的测试层中的"cls_score"、"bbox_pred"重命名。比如把cls_score改为cls_score1、把bbox_pred改为bbox_pred1。
7、KeyError: 'max_overlaps'
解决方案:
删除py-faster-rcnn/data/VOCdevkit2007/annotations_cache这个文件夹;
删除py-faster-rcnn/data/cache文件夹。
8、smooth_L1_loss_layer.cpp:28] Check failed: bottom[0]->channels() == bottom[1]->channels() (16 vs. 84)
解决方案:
一般都是end2end中的train.prototxt的类别没有改好导致的。
检查train.prototx中的input-data层的num_classes: n (自己要训练的类别+1,1代表背景)
、roi-data层的num_classes:n、cls_score层的num_output:n、bbox_preda层的num_output : 4*n。