[关闭]
@huangzhengsjtu 2015-05-23T07:00:38.000000Z 字数 1881 阅读 10375

运行Fast R-CNN的代码

CNN Computer Vision

FR-CNN是Ross Girshick的新作,从文章来看FR-CNN比R-CNN和SPPNet都快很多。当然R-CNN和SPPNet也都是Girshick的作品,FR-CNN的正确率不仅超越Girshick自己的嫡出,也超过了DPM等其他方法。

FR-CNN正如文章所说的是一个简单,并且Elegant的框架。和那些Pipeline的模型相比,的确是优雅很多的。当然FR-CNN本身也可以看作是一个Pipeline,只不过这个Pipeline只有两个步骤,一是Pretrain的CNN,第二个是Region Pooling和Fully connected Network(FC)。

我认为优雅之处在于:

Contents

  1. Basic system information
  2. Basic Hardware info

Basic Hardware info

  1. For training smaller networks (CaffeNet, VGG_CNN_M_1024) a good GPU (e.g., Titan, K20, K40, ...) with at least 3G of memory suffices
  2. For training with VGG16, you'll need a K40 (~11G of memory)
    目前的GPU只有GTX750i,显存只有2G,按照说明如果要使用GPU至少要3G的显存。所以只能在CPU上面Run这个代码。

Basic system information

使用Ubuntu Linux 14.04桌面版:

  1. ~$ uname -a
  2. Linux cis-ubuntu-1 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

需要安装的基础软件

可能你的机器上没有cython, easydict

  1. sudo pip install cython
  2. sudo pip install easydict

安装Opencv

按照这个网页的方法:
http://www.samontab.com/web/2014/06/installing-opencv-2-4-9-in-ubuntu-14-04-lts/

最后测试一下python

  1. python ~/opencv-2.4.9/samples/python2/turing.py

courtesy of www.samontab.com

安装Caffe (berkeley开发的一个Deep Learning的框架)

参考:我的安装Caffe的过程


安装 Fast R-CNN

  1. 下载源代码:
  1. git clone --recursive https://github.com/rbgirshick/fast-rcnn.git

下载代码的目录,命名为$FRCN_ROOT。

  1. 编译Cython:
  1. cd $FRCN_ROOT/lib
  2. make
  1. 编译Caffe and pycaffe:
  1. cd $FRCN_ROOT/caffe-fast-rcnn
  2. cp Makefile.config.example Makefile.config #用例子文件作为模板
  3. vi Makefile.config # 按照你的机器设置进行修改。
  4. make -j8 && make pycaffe
  1. 下载pre-computed Fast R-CNN detectors
    大概985M, 用了一个小时。
  1. cd $FRCN_ROOT
  2. ./data/scripts/fetch_fast_rcnn_models.sh

运行演示

  1. cd $FRCN_ROOT
  2. ./tools/demo.py --cpu

碰到的问题:
1. 错误: ImportError: No module named skimage.io

  1. sudo pip install scikit-image
  1. 错误: ImportError: No module named google.protobuf.internal
  1. sudo find / -name protobuf
  2. /usr/include/google/protobuf # 只有C版本的protobuf
  3. apt-get install python-protobuf

然后终于可以运行了。

运行的结果看起来还不错,对路边的车辆都能识别出来。
运行结果

对代码还有很多不明白之处(150523)。

  1. 为什么安装好了Caffe以后,安装Fast R-CNN的时候,还需要make caffe?
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注