Advertisement

caffe编译py-faster-rcnn问题汇总

阅读量:

1.进入 py-faster-rcnn/lib/ make之后出现错误

错误1:AttributeError: ‘dict’ object has no attribute 'iteritems’
解决:将setup.py文件中
for k, v in cudaconfig.iteritems():
修改为:
for k, v in cudaconfig.items():

错误2:cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
解决:在setup.py文件中加入
import os
from distutils.sysconfig import get_config_vars

(opt,) = get_config_vars(‘OPT’)
os.environ[‘OPT’] = " ".join(
flag for flag in opt.split() if flag != ‘-Wstrict-prototypes’
)

错误3:
./build/tools/caffe: error while loading shared libraries: libcudnn.so.5: cannot open shared object file: No such file or directory

解决:
sudo cp /usr/local/cuda/lib64/libcudnn.so.5 /usr/local/lib/libcudnn.so.5
sudo ldconfig

2.进入caffe-fast-rcnn目录下进行编译

错误4:编译make all -j8出现错误:
#error incompatible with your Protocol Buffer headers. Please
^
.build_release/src/caffe/proto/caffe.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.

错误原因:
因为它所要求的protobuf版本是2.6.0或2.6.1,高于或低于都会出现error
此时需要查看系统的protobuf的版本是多少:
命令行输入 protoc --version
显示:libprotoc 3.5.0
在运行程序时protoc的版本是3.5.0,但是程序中的caffe.pb.h文件是由2.6.1版本的protoc生成的,所以产生了上述error。

解决方案:
在caffe-fast-rcnn目录下重新编译:
make clean
make all -j4

错误5:编译make all -j8出现错误:/usr/bin/ld: cannot find -lcudart

解决:
之前跟着某教程对/usr/local/cuda-8.0/lib64下的libcudart.so文件和libcudart.so.8.0.bak进行了mv操作,之后在此目录下执行ls -l文件,发现此文件标红,证明这文件链接有错,后来仔细回想了以下,把文件改回一开始的状态,则错误消失。

错误6:
编译 make test -j8出现错误:src/caffe/test/test_smooth_L1_loss_layer.cpp:11:35: fatal error: caffe/vision_layers.hpp

解决方法:
找到文件$CAFFE_ROOT/src/caffe/test/test_smooth_L1_loss_layer.cpp
删除第十一行
11 #include “caffe/vision_layers.hpp”

错误7:
编译make runtest -j8出现错误:
F0401 10:46:54.969575 9984 db_leveldb.cpp:16] Check failed: status.ok() Failed to open leveldb Deconvolution

解决方案:找到src/caffe/test/test_layer_factory.cpp:line 33
将第33行的if (iter->first == “Data”)
修改为
if(iter->first == “Data” || iter->first == “BoxData”)

3.代码测试

错误8:运行测试代码时,报错:
Check failed: status == CUDNN_STATUS_SUCCESS (3 vs. 0) CUDNN_STATUS_BAD_PARAM

解决办法:
之前配置是cuda8.0+cudnn6.0,cuda8.0+cudnn5.0,编译后还是报错。
最后将cudnn换成5.1版本,将caffe中的Makefile.conig文件,注释掉USE_CUDNN := 1
之后重新编译,成功运行。
之前在网上查到的解决办法:
1.在训练加载文件中在每个convolution_param中添加engine:CAFFE(此方法对我无效)
2.caffe版本与cudnn版本冲突问题(此方法对我无效)
解决如下:
cd caffe-fast-rcnn
git remote add caffe https://github.com/BVLC/caffe.git
git fetch caffe
git merge -X theirs caffe/master

融合之后删除掉include/caffe/layers/python_layer.hpp文件中的 self_.attr(“phase”) = static_cast(this->phase_);
然后升级cudnnv6.0 for CUDA8.0, 重新编译即可。

错误9:运行demo.py时,报错:
raise ValueError, “Can’t create weekday with n == 0”
^
SyntaxError: invalid syntax

解决办法:
在命令行输入sudo pip install python-dateutil --upgrade

全部评论 (0)

还没有任何评论哟~