本文安装python版本的faster-rcnn项目。
matlab版本请移步:https://github.com/ShaoqingRen/faster_rcnn
python版本项目主页:https://github.com/rbgirshick/py-faster-rcnn
下面分两部分来讲解,第一部分为py-faster-rcnn及caffe框架安装。第二部分讲解如何修改相关文件,训练自己的数据集。
第一部分 安装
把项目代码clone下来, 注意是递归下载,里面包含项目自带的caffe,跟原版的caffe略有不同,一定要注意:
git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git
安装python包cython, 使用pip安装:
sudo pip install cython
编译cython
cd /py-faster-rcnn/lib
修改setup.py文件,注释掉GPU相关代码,如下:
#CUDA = locate_cuda()
#self.set_executable('compiler_so', CUDA['nvcc'])
# Extension('nms.gpu_nms',
['nms/nms_kernel.cu', 'nms/gpu_nms.pyx'],
library_dirs=[CUDA['lib64']],
libraries=['cudart'],
language='c++',
runtime_library_dirs=[CUDA['lib64']],
# this syntax is specific to this build system
# we're only going to use certain compiler args with nvcc and not with
# gcc the implementation of this trick is in customize_compiler() below extra_compile_args={'gcc': ["-Wno-unused-function"],
'nvcc': ['-arch=sm_35','--ptxas-options=-v','-c','--compiler-options',"'-fPIC'"]},
include_dirs = [numpy_include, CUDA['include']]
),
setup.py修改完成后,执行make
编译caffe(项目自带的caffe-fast-rcnn)
具体安装方法,详见我的另一篇博客,地址:http://blog.csdn.net/zhang_shuai12/article/details/52289825
注意执行完make, 别