1、
问题:
gph@gph-pc:~/Desktop/py-faster-rcnn-master/lib$ make
python setup.py build_ext --inplace
Traceback (most recent call last):
File "setup.py", line 12, in <module>
from Cython.Distutils import build_ext
ImportError: No module named Cython.Distutils
make: *** [all] Error 1
解决:
安装cython
sudo pip install cython
2、
问题:
Makefile:554: recipe for target '.build_release/lib/libcaffe.so.1.0.0-rc3' failed
解决:
修改Makefile 文件:
将
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
改为
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
3、参考博客:https://blog.csdn.net/l_ml_m_lm_m/article/details/80449410
问题:
File "mtrand.pyx", line 1192, in mtrand.RandomState.choice
TypeError: 'numpy.float64' object cannot be interpreted as an index
网上很多解决办法是这样的,降低numpy版本:
调整numpy版本
ubuntu@ubuntu-System-Product-Name:~/py-faster-rcnn$ python
>>> import numpy
>>> print numpy.version.version
1.14.3
>>> quit()
ubuntu@ubuntu-System-Product-Name:~/py-faster-rcnn$ pip install -U numpy==1.11.0
但是之后会遇到以下问题或者其他问题,总之我降低numpy版本后并没有解决问题,这个可能因人而异。
安装之后遇到问题:
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: numpy.core.multiarray failed to import
解决:
(1)
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)
但是呢,还没有完,你还会遇到提示你:
TypeError: slice indices must be integers or None or have an __index__ method
然后继续修改:
(2)修改/home/ubuntu/py-faster-rcnn/lib/roi_data_layer/minibatch.py
从第172行 开始的一个for
语句
for ind in inds:
ind = int(ind)
cls = clss[ind]
start = int(4 * cls)
end = int(start + 4)
bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
bbox_inside_weights[ind, start:end] = cfg.TRAIN.BBOX_INSIDE_WEIGHTS
return bbox_targets, bbox_inside_weights
(3)修改/home/ubuntu/py-faster-rcnn/lib/rpn/proposal_target_layer.py
从124行开始的for
语句,与之前的文件中的语句相同,都是将其改为:
for ind in inds:
ind = int(ind)
cls = clss[ind]
start = int(4 * cls)
end = int(start + 4)
bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
bbox_inside_weights[ind, start:end] = cfg.TRAIN.BBOX_INSIDE_WEIGHTS
return bbox_targets, bbox_inside_weights
因为原先的for
语句中的ind,start,end
都是 numpy.int
类型,这种类型的数据不能作为索引,所以必须对其进行强制类型转换。
4、参考博客:https://blog.csdn.net/l_ml_m_lm_m/article/details/80449410
问题:
pb2.text_format.Merge(f.read(), self.solver_param)
AttributeError: 'module' object has no attribute 'text_format'
解决:
方法一:(这是因为protobuf版本的问题)在文件./lib/fast_rcnn/train.py增加一行import google.protobuf.text_format
方法二:sudo pip install protobuf==2.5.0
******如果遇到新的问题还会继续更新******
关于对faster rcnn配置、运行、测试、pascal voc训练、自己数据集训练等步骤或者问题,在我的其他博客中。如果还有其他问题,可以评论或者私信我,能解决的我尽量帮助大家解决!