faster-rcnn caffe 实践和问题总结(Python)
2018-03-10 14:57
369 查看
写在前面的话:请使用Python2,千万不要用Python3 否则会有无数的问题在等着你。
github官方版本:https://github.com/rbgirshick/py-faster-rcnn
第一步:下载faster-rcnn python版本源码
github官方版本:https://github.com/rbgirshick/py-faster-rcnn
第一步:下载faster-rcnn python版本源码
git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git[/code]
第二步:进入/py-faster-rcnn/lib 进行编译,build the Cython modulescd py-faster-rcnn cd lib make
这里有个问题,当你修改你的Python版本或numpy版本时,需要将之前make的文件删除。我看了看也不知道那个是make的文件,所以就将make之后的lib文件删除,从新从原始的py-faster-rcnn中的lib文件复制过去。
第三步:Build Caffe and pycaffe
修改你的makefile.config和makefile文件,我将我之前安装caffe时修改的makefile.config和makefile复制过来。
note:如果你之前makefile.config文件中是用的Python3.x,请将此处修改为Python2.7cd $FRCN_ROOT/caffe-fast-rcnn make -j8 && make pycaffe
到这里你会遇到一个很严重的问题,那就是py-faster-rcnn与你电脑上的cudnn版本冲突,我的是cudnn6.0遇到如下了错误,cudnn5.1也会遇到该错误
解决办法:
将caffe/include/caffe/layers/cudnn*.hpp(所有的cudnn文件例如:cudnn_relu_layer.hpp)文件复制的/home/ubuntu/py-faster-rcnn/caffe-fast-rcnn/include/caffe/layers中,替换掉该目录中原有的文件
用/home/ubuntu/caffe/include/caffe/util/cudnn.hpp文件替换/home/ubuntu/py-faster-rcnn/caffe-fast-rcnn/include/caffe/util/cudnn.hpp文件
将/home/ubuntu/caffe/src/caffe/layers/cudnn*(所有的cudnn文件例如:cudnn_relu_layer.cpp,cudnn_relu_layer.cu)文件复制的/home/ubuntu/py-faster-rcnn/caffe-fast-rcnn/src/caffe/layers中,替换掉该目录中原有的文件
第四步:下载 Fas
4000
ter R-CNN 预训练模型cd $FRCN_ROOT ./data/scripts/fetch_faster_rcnn_models.sh
这里你会遇到模型下载不下来的问题,因为dl.dropboxusercontent.com网站我们上不去需要翻墙,这里是我从网上下载的预训练模型。
百度网盘:
下载之后,会发现它是.7z文件。这里需要下载p7zipsudo apt-get install p7zip
解压输入:7z x filename
第五步:运行demo.py文件cd $FRCN_ROOT ./tools/demo.py
这是过程中遇到的一些问题:
问题1:`.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)' . .build_release/lib/libcaffe.so: undefined reference to`cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned
解决办法: 配置makefile文件
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
替换为:
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs
问题2:
make pycaffe时出错CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp python/caffe/_caffe.cpp:11:31: **fatal error:** numpy/arrayobject.h: No such file or directory compilation terminated. Makefile:489: recipe for target 'python/caffe/_caffe.so' failed make: *** [python/caffe/_caffe.so] Error 1
解决办法:sudo apt-get install python-numpy
因为这里的makefile.config文件中Python的路径没有修改,而之前的caffe是在anaconda3的基础上安装的,这里也可以将之间修改的makefile文件和makefile.config文件复制到当前文件夹,重新进行make问题也会解决。
问题3:from .proto.caffe_pb2 import TRAIN, TEST File "/home/ubuntu/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/proto/caffe_pb2.py", line 6, in <module> from google.protobuf.internal import enum_type_wrapper ImportError: No module named 'google'
解决办法:pip install protobuf
问题4:ImportError: No module named 'cPickle'
解决办法:在该语句前加上import pandas
问题5:ImportError: No module named gpu_nms
解决办法:将你的lib文件删除,从新复制一个没有make过的lib文件,从新make一遍。
相关文章推荐
- Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks程序(Python)配置问题总结
- Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks程序(Python)配置问题总结
- Faster-Rcnn caffe 安装碰到的一些问题(ubuntu 16.04环境下)
- wider face data 在 faster rcnn 上的实践记录(caffe)
- wider face data 在 faster rcnn 上的实践记录(caffe)
- ubuntu安装faster r-cnn(caffe,python,only cpu)
- cuDNN兼容性问题造成的caffe/mnist,py-faster-rcnn/demo运行结果错误
- caffe加自己的python形式的data出错问题总结
- eclipse调用caffe后py-faster-rcnn出现的问题几解决方法(cuda8.0+cudnn.V5 )
- Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks程序(Python)配置问题总结
- caffe平台python版本faster rcnn错误集萃
- 使用caffe训练faster-rcnn时遇到的问题总结
- caffe - faster r-cnn(python)之路
- Caffe:python版本Faster R-CNN测试
- 目标检测Faster_r_cnn代码的使用(python+caffe版本)
- 使用caffe训练faster-rcnn时遇到的问题总结
- cuDNN兼容性问题造成的caffe/mnist,py-faster-rcnn/demo运行结果错误
- 使用caffe训练faster-rcnn时遇到的问题总结
- 【Caffe】Python版本Faster R-CNN+ZF代码运行
- Python_Kivy_问题总结