前言
fast rcnn是Ross B. Girshick对RCNN的一个优化,性能上有了显著提升,然而在现在看来这个模型已经相对过时,在性能较低的设备上难以做到实时.但github上的fast-rcnn项目中包含大量工具脚本,是一个caffe入门的优秀选择,在这里简单介绍一下环境的搭建以及版本问题的解决.
环境介绍
- x86_64,arm均尝试过
- ubuntu 16.04 LTS
项目下载:
- git clone –recursive https://github.com/rbgirshick/py-fast-rcnn.git
- 安装好caffe需要的所有环境
- cuda
- atlas/openBlas
- boost-dev
- lmdb
- leveldb
- protobuf,glog,gflags,hdf5
等等,如果装不全,编译过程中会有相关错误,及时安装即可
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
- 在这里选择Python接口,按照说明把所有的依赖项走一遍就可以了
for req in $(cat requirements.txt); do pip install $req; done
- 然而这里的一个额外问题是fast-rcnn需要其他的库,如果缺少这些库,在运行时会报错,并且会推荐你安装这些库(形如python-xxx),这时apt install它们就可以了,大概有这些
- python-opencv python-yaml python-gtk(??印象中有,错误由plt.show()调用报出): apt install
- cython easydict: pip[2(可选)] install
编译
- 设置Makefile.config,这里把我使用的贴过来:
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0
# uncomment to allow MDB_NOLOCK when reading LMDB files (only if nec