faster-rcnn 安装

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版本源码

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git  


3. 进入/py-faster-rcnn/lib 进行编译

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. cd py-faster-rcnn/lib  
  2. make  


4.编译/py-faster-rcnn/caffe-fast-rcnn

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. cd py-faster-rcnn/caffe-fast-rcnn  

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. cp Makefile.config.example Makefile.config  

更改Makefile.config文件:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. # In your Makefile.config, make sure to have this line uncommented  
  2. WITH_PYTHON_LAYER := 1  
  3. # Unrelatedly, it's also recommended that you use CUDNN  
  4. USE_CUDNN := 1  

进行编译:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. make -j8 && make pycaffe  

因为这个版本所用的cudnn为旧版本的,可能与新环境的cudnn不兼容,导致出现如下错误:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. In file included from ./include/caffe/util/cudnn.hpp:5:0,  
  2.                  from ./include/caffe/util/device_alternate.hpp:40,  
  3.                  from ./include/caffe/common.hpp:19,  
  4.                  from ./include/caffe/util/db.hpp:6,  
  5.                  from src/caffe/util/db.cpp:1:  
  6. /usr/local/cuda/include/cudnn.h:803:27: note: declared here  
  7.  cudnnStatus_t CUDNNWINAPI cudnnSetPooling2dDescriptor(  
  8.                            ^  
  9. make: *** [.build_release/src/caffe/util/db.o] Error 1  
  10. 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里的相应的同名文件。


  1. src/caffe/layers/cudnn_relu_layer.cpp: In member function ‘virtual void caffe::CuDNNReLULayer<Dtype>::LayerSetUp(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&)’:  
  2. src/caffe/layers/cudnn_relu_layer.cpp:16:45: error: ‘activ_desc_’ was not declared in this scope  
  3.    cudnn::createActivationDescriptor<Dtype>(&activ_desc_, CUDNN_ACTIVATION_RELU);  
  4.                                              ^  
  5. make: *** [.build_release/src/caffe/layers/cudnn_relu_layer.o] 错误 1

将./include/caffe/layers的,所有以cudnn开头的文件,例如cudnn_conv_layer.hpp,cudnn_lcn_laye.hpp</p>   都替换成最新版的caffe里的相应的同名文件  


5.运行faster-rcnn里的demo

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. cd py-faster-rcnn/tools  
  2. ./tools/demo.py  



  • 3
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值