环境:ubantu18.04 anaconda3 python3.6
1.在py-faster-rcnn/lib下make报错
Traceback (most recent call last):
File "setup.py", line 59, in
CUDA = locate_cuda()
File "setup.py", line 56, in locate_cuda
raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))
EnvironmentError: The CUDA lib64 path could not be located in /usr/lib64
Makefile:2: recipe for target 'all' failed
解决方法:将setup.py中的iteritems改为如下
for k, v in cudaconfig.items():
if not os.path.exists(v):
raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))
如果还继续报错
g++: error: unrecognized command line option ‘-R’
error: command 'g++' failed with exit status 1
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1
/home/junjun/anaconda3/lib/python3.6/distutils 那么继续修改该路径下的unixcompiler.py文件修改如下
# No idea how --enable-new-dtags would be passed on to
# ld if this system was using GNU ld. Don't know if a
# system like this even exists.
return "-Wl,-rpath=" + dir
2.依照Github上的说明配置,在sudo make all -j4后出现下面的错误(绿框):
参考链接 https://blog.csdn.net/ytusdc/article/details/77994430
下面的错误主要是py2和py3不同的错误,我反复的运行最后反复的寻找错误原因,所有的print错误都需要修改。
3.报错 ModuleNotFoundError: No module named 'cPickle'
Traceback (most recent call last):
File "./tools/demo.py", line 18, in
from fast_rcnn.test import im_detect
File "/home/junjun/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 18, in
import cPickle
ModuleNotFoundError: No module named 'cPickle'
修改方法:将文件中的cPickle改为pickle
4.ModuleNotFoundError: No module named 'generate_anchors'
将/home/junjun/py-faster-rcnn/lib/rpn路径下的
proposal_layer.py 文件中的"from generate_anchors import generate_anchors"
改为
"from rpn.generate_anchors import generate_anchors"
改完之后可能会报print错误,改为python3支持的格式就好了
5.NameError: name 'xrange' is not defined
将报错文件中的xrange改为range,凡是遇到这种错将文件中进行修改就好了
6.AttributeError: 'NoneType' object has no attribute 'format'
将demo.py中的改为这样的print (('Detection took {:.3f}s for '
'{:d} object proposals').format(timer.total_time, boxes.shape[0]))