faster-rcnn提出論文: 《Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks》
faster-rcnn 的算法詳解可看這篇博文(清晰易懂,良心博文!):
http://blog.csdn.net/shenxiaolu1984/article/details/51152614
faster-rcnn python版本源碼地址:https://github.com/rbgirshick/py-faster-rcnn
這篇文章主要介紹搭建用faster-rcnn進行目標檢測所需的環境。
1.電腦上已經有可運行caffe所需的環境
2.下載faster-rcnn python版本源碼
git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git
3. 進入/py-faster-rcnn/lib 進行編譯
cd py-faster-rcnn/lib
make
4.編譯/py-faster-rcnn/caffe-fast-rcnn
cd py-faster-rcnn/caffe-fast-rcnn
cp Makefile.config.example Makefile.config
更改Makefile.config文件:
# In your Makefile.config, make sure to have this line uncommented
WITH_PYTHON_LAYER := 1
# Unrelatedly, it's also recommended that you use CUDNN
USE_CUDNN := 1
進行編譯:
make -j8 && make pycaffe
因爲這個版本所用的cudnn爲舊版本的,可能與新環境的cudnn不兼容,導致出現如下錯誤:
In file included from ./include/caffe/util/cudnn.hpp:5:0,
from ./include/caffe/util/device_alternate.hpp:40,
from ./include/caffe/common.hpp:19,
from ./include/caffe/util/db.hpp:6,
from src/caffe/util/db.cpp:1:
/usr/local/cuda/include/cudnn.h:803:27: note: declared here
cudnnStatus_t CUDNNWINAPI cudnnSetPooling2dDescriptor(
^
make: *** [.build_release/src/caffe/util/db.o] Error 1
make: *** Waiting for unfinished jobs....
解決辦法:
1).將/py-faster-rcnn/caffe-fast-rcnn/include/caffe/util/cudnn.hpp 換成最新版的caffe裏的cudnn的實現,即相應的cudnn.hpp.
2).將/py-faster-rcnn/caffe-fast-rcnn/src/caffe/layer裏的,所有以cudnn開頭的文件,例如cudnn_lrn_layer.cu,cudnn_pooling_layer.cpp,cudnn_sigmoid_layer.cu。
都替換成最新版的caffe裏的相應的同名文件。5.運行faster-rcnn裏的demo
cd py-faster-rcnn/tools
./tools/demo.py