Ubuntu16.04 + cudnn5.0 + py-faster-rcnn + gpu

从github  git 代码

https://github.com/rbgirshick/py-faster-rcnn


1.Requirements for Caffe and pycaffe

根据一下2博文的编译caffe和pycaffe

ubuntu16.04+caffe+GPU Ubuntu16.04+CUDA8.0+caffe配置

http://blog.csdn.net/zhuiqiuk/article/details/54020688

Caffe学习系列(13):数据可视化环境(python接口)配置

http://blog.csdn.net/zhuiqiuk/article/details/54093149


Installation (sufficient for the demo)

  1. Clone the Faster R-CNN repository

    # Make sure to clone with --recursive
    git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git
  2. We'll call the directory that you cloned Faster R-CNN into FRCN_ROOT

    Ignore notes 1 and 2 if you followed step 1 above.

    Note 1: If you didn't clone Faster R-CNN with the --recursive flag, then you'll need to manually clone the caffe-fast-rcnn submodule:

    git submodule update --init --recursive

    Note 2: The caffe-fast-rcnn submodule needs to be on the faster-rcnn branch (or equivalent detached state). This will happen automatically if you followed step 1 instructions.

  3. Build the Cython modules

    cd $FRCN_ROOT/lib
    make
  4. Build Caffe and pycaffe

    cd $FRCN_ROOT/caffe-fast-rcnn
    # Now follow the Caffe installation instructions here:
    #   http://caffe.berkeleyvision.org/installation.html
    
    # If you're experienced with Caffe and have all of the requirements installed
    # and your Makefile.config in place, then simply do:
    make -j8 && make pycaffe
  5. Download pre-computed Faster R-CNN detectors

    cd $FRCN_ROOT
    ./data/scripts/fetch_faster_rcnn_models.sh

    This will populate the $FRCN_ROOT/data folder with faster_rcnn_models. See data/README.md for details.These models were trained on VOC 2007 trainval.

此过程中出现:cudnn报错。根据下面的博客处理

faster rcnn +cudnn V5

http://blog.csdn.net/u010733679/article/details/52221404

faster rcnn 代码默认是使用的cudnn v4, 但是为了体验最新的v5, 或者使用GTX1080 ,我们编译faster rcnn的时候就会报错:

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 src/caffe/data_reader.cpp:6:
/usr/local/cuda/include/cudnn.h:799:27: note: declared here

 cudnnStatus_t CUDNNWINAPI cudnnSetPooling2dDescriptor(

为此提供2种解决方案:

(1)取自github @manipopopo

cd caffe-fast-rcnn  
Git remote add caffe https://github.com/BVLC/caffe.git  
git fetch caffe  
git merge caffe/master 
Remove self_.attr("phase") = static_cast<int>(this->phase_); from include/caffe/layers/python_layer.hpp after merging.


(2)手动修改文件,参考了卜居大神的博客 http://blog.csdn.net/kkk584520/article/details/51163564

方案1简单方便,但是当我们编译的是其他人修改过得源码,可能就会出错。方案2 步骤如下:


1. 用最新caffe源码的以下文件替换掉faster rcnn 的对应文件

include/caffe/layers/cudnn_relu_layer.hpp, src/caffe/layers/cudnn_relu_layer.cpp, src/caffe/layers/cudnn_relu_layer.cu

include/caffe/layers/cudnn_sigmoid_layer.hpp, src/caffe/layers/cudnn_sigmoid_layer.cpp, src/caffe/layers/cudnn_sigmoid_layer.cu

include/caffe/layers/cudnn_tanh_layer.hpp, src/caffe/layers/cudnn_tanh_layer.cpp, src/caffe/layers/cudnn_tanh_layer.cu

2. 用caffe源码中的这个文件替换掉faster rcnn 对应文件

include/caffe/util/cudnn.hpp


3. 将 faster rcnn 中的 src/caffe/layers/cudnn_conv_layer.cu 文件中的所有

cudnnConvolutionBackwardData_v3 函数名替换为 cudnnConvolutionBackwardData

cudnnConvolutionBackwardFilter_v3函数名替换为 cudnnConvolutionBackwardFilter


Demo

After successfully completing basic installation, you'll be ready to run the demo.

To run the demo

cd $FRCN_ROOT
./tools/demo.py
./tools/demo.py --net zf


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值