安装fast-rcnn前需要装一堆配置文件和驱动,基本上照着以下步骤,在控制台执行一遍即可。
1.依赖包
sudo apt-get install build-essential # basic requirement
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 #required by caffe
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
2.安装cuda 7.5
cuda显卡驱动是必须要安装的,不然检测和训练的速度都会非常慢
下载地址是:https://developer.nvidia.com/cuda-downloads
根据你的系统,下载相应的cuda驱动
dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
apt-get update
apt-get install -y cuda
reboot //重启电脑
3.设置环境变量
在/etc/profile中添加CUDA环境变量
sudo gedit /etc/profile
添加以下两句话
PATH=/usr/local/cuda/bin:$PATH
export PATH
保存后, 执行下列命令, 使环境变量立即生效
source /etc/profile
同时需要添加lib库路径: 在 /etc/ld.so.conf.d/加入文件 cuda.conf, 内容如下
/usr/local/cuda/lib64
保存后,执行下列命令使之立刻生效
ldconfig
4.安装CUDA SAMPLE
进入/usr/local/cuda/samples, 执行下列命令来build samples
make all -j4
整个过程大概10分钟左右, 全部编译完成后, 进入 samples/bin/x86_64/linux/release, 运行deviceQuery
./deviceQuery
如果出现显卡信息, 则驱动及显卡安装成功
5.Python库的安装
export CPLUS_INClUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/python2.7
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/include/python2.7
apt-get -y install python-numpy
apt-get -y install python-setuptools
easy_install easydict
easy_install leveldb
easy_install snappy
easy_install lmdb
easy_install glog
apt-get -y install python-pip
apt-get install cython
apt-get -y install python-skimage
apt-get -y install python-protobuf
6.安装opencv
https://github.com/jayrambhia/Install-OpenCV
$ cd Ubuntu
$ chmod +x *
$ ./opencv_latest.sh
7.fast-rcnn的获取
这是作者在github上的fast-rcnn的主页https://github.com/rbgirshick/fast-rcnn。
里面描述了具体的安装步骤。
1.克隆这个项目
git clone --recursive https://github.com/rbgirshick/fast-rcnn.git
首先直接将整个项目克隆下来。
如果报错找不到git命令,就先安装git
2.Build the Cython modules
cd $FRCN_ROOT/lib
make
这里的$FRCN_ROOT目录就是指代你的fast rcnn的目录
3.Build Caffe and pycaffe
cd $FRCN_ROOT/caffe-fast-rcnn
# 这里要注意一个地方,就是要提前修改makefile.config文件
# WITH_PYTHON_LAYER := 1
# 文件中找到这一行,把这一行前面的注释符号取消,然后再编译
make -j8 && make pycaffe