Faster_rcnn论文阅读及caffe训练实践(2)——faster_rcnn-caffe源码安装

这里主要介绍下faster_rcnn的安装

1.安装平台和准备事项:

我使用的ubuntu14.04

opencv-2 (sudo apt-get install 安装比较容易,opencv3安装相对比较难)

2.去github下,clone官方源码包

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

3.参照github上官方地址的readme进行安装

Contents

  1. Requirements: software
  2. Requirements: hardware
  3. Basic installation
  4. Demo
  5. Beyond the demo: training and testing
  6. Usage

Requirements: software

NOTE If you are having issues compiling and you are using a recent version of CUDA/cuDNN, please consult this issue for a workaround

  1. Requirements for Caffe and pycaffe (see: Caffe installation instructions)

Note: Caffe must be built with support for Python layers!

# 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

You can download my Makefile.config for reference.2. Python packages you might not have: cython, python-opencv, easydict3. [Optional] MATLAB is required for official PASCAL VOC evaluation only. The code now includes unofficial Python evaluation code.

Requirements: hardware

  1. For training smaller networks (ZF, VGG_CNN_M_1024) a good GPU (e.g., Titan, K20, K40, ...) with at least 3G of memory suffices
  2. For training Fast R-CNN with VGG16, you'll need a K40 (~11G of memory)
  3. For training the end-to-end version of Faster R-CNN with VGG16, 3G of GPU memory is sufficient (using CUDNN)

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
  1. 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.

  2. Build the Cython modules

    cd $FRCN_ROOT/lib
    make
  3. 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
  4. 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.

Demo

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

To run the demo

cd $FRCN_ROOT
./tools/demo.py

上面是官方的教程,但是需要注意的是cudnn经常出问题,这是因为这里的cudnn的版本较老,解决办法是去github上下载最新的caffe,地址如下: 

https://github.com/BVLC/caffe

并且把所有cudnn的cpp和.h都替换成最新版本caffe底下的,这一步如果有不明白的,可以参照如下博客:

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

当然还有一种比较简单的方法,就是编译caffe时直接不使用cudnn(这样会导致训练速度较慢,但是也没有慢到像cpu那样子了啦,如果只是为了跑实验连连手可以直接使用这种方法)


安装完之后,参照官方readme一步步实验就可以了,一般是可以跑出结果的,值得注意的是官方使用的网络vgg16\zf网络等在2018年来看都已经完全过时,现在主流的识别网络已经替换成resnet/densenet等。建议自行使用resnet模型替换掉这部分,可以去caffe-zoo上面找一下,或者自行使用resnet在imagenet进行训练。

resnet论文和resnet-caffe实现 分别在arxiv和github上搜索一下就很容易得到了。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值