您的位置:首页 > 其它

ubuntu14.04配置faster-rcnn

2016-05-13 15:49 405 查看
1 首先要保证安装了cython, python-opencv, easydict,如果没有请执行以下命令:

sudo apt-get install cython

sudo apt-get install python-opencv

sudo pip install easydict

2 Clone the Faster R-CNN repository:

git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git
3 Build the Cython modules:

cd $FRCN_ROOT/lib

make -j16

4 Build Caffe and pycaffe

cd $FRCN_ROOT/caffe-fast-rcnn

cp Makefile.config.example Makefile.config

打开 USE_CUDNN = 1,这个选项默认情况下时关闭的,让CUDA支持DNN(我没做)

打开 WITH_PYTHON_LAYER = 1,这个在默认情况下也是关闭的,FastRCNN需要支持Python接口,因此需要打开

Fast RCNN需要hdf5的支持,这个根据自己的Linux里的库文件安装路径添加,不清楚的可以find一下,不过一般情况下,INCLUDE_DIRS 应该添加上
/usr/include/hdf5/serial LIBRARY_DIRS 添加上 /usr/lib/x86_x64-linux-gnu/hdf5/serial (我没做)

另外把USE_PKG_CONFIG = 1 记得打开,要不然会找不到一些库文件,PKG是linux用来管理库文件

make -j16

make pycaffe -j16

环境配置就结束了,下面就是下载模型进行demo测试

5 Download pre-computed Faster R-CNN detectors

cd $FRCN_ROOT

./data/scripts/fetch_faster_rcnn_models.sh

(可能下载的比较慢,你可以打开data/scripts/fetch_faster_rcnn_models.sh文件,里面有网址,直接去网址下载可能会快一点,顺便将ImageNet models也下载,后面训练要用)

6 To run the demo

cd $FRCN_ROOT

先在demo.py里加入

import sys

sys.path.append('/home/zc/faster-rcnn/py-faster-rcnn/lib')

之后

./tools/demo.py

遇到的报错

ImportError: cannot import name symbol_database

sudo pip install --upgrade protobuf

ImportError: No module named yaml
sudo apt-get install Python-yaml
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: