Ubuntu16.04+cuda8.0+cudnnV5.1配置faster-rcnn的方法
2017-08-02 15:00
567 查看
Python版本可以按以下步骤DIY训练Faster-RCNN
1.下载Faster-RCNN源代码并安装
通过git工具直接下载,在Linux 命令行输入:
$ git clone —recursive https://github.com/rbgirshick/py-faster-rcnn.git
PS : —recursive 是用来caffe-fast-rcnn (也就是caffe branch)的,这个必须要加上,否则此文件夹为空
2. 编译Cython模块
在 /py-faster-rcnn/lib directory 目录下执行命令:
$ cd py-faster-rcnn/lib
3.拷贝Makefile.config,并修改Makefile.config
$
cd py-faster-rcnn/caffe-fast-rcnn
$ cp Makefile.config.example Makefile.config
更改Makefile.config文件:
1)#USE_CUDNN := 1行,去掉#变为 USE_CUDNN := 1 ,如果你的计算机的计算能力能够支持cudnn 。
2)Add the following lines in
不然编译的时候会报错,如果不加这两行,会出hdf5.h找不到的错误,还有其他的错误,总之,加上就对了。
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include/usr/include/hdf5/serial/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
/usr/lib/x86_64-linux-gnu/hdf5/serial/
注意:新加的行前面需空一个空格。
3)
:= 1[/code],因为faster R-CNN是要python接口的,所以这一项要有,不能注释。
否则会在运行demo.py的时候遇到这样错误:
4.编译Caffe和Pycaffe
$
make: *** [.build_release/src/caffe/util/db.o] Error 1
make: *** Waiting for unfinished jobs....
03. make: *** [.build_release/src/caffe/layers/cudnn_relu_layer.o] 错误 1
,即相应的cudnn.hpp.[/code]
3)将
[/code]
$
注意这个脚本中提供的网址现在需要翻墙才能连接并下载,不过如果实在下载不了的话就自己训练吧。
6. 运行python的demo
执行以下命令:
缺少Python库easydict,所以安装 pip install easydict,执行以下命令:
$ sudo pip install easydict
2)出现如下错误:ImportError: No module named cv2
缺少Python库cv2,这个是openCV里面的。执行以下命令来装openCV python库
$ sudo apt-get install python-opencv
3)出现如下错误:ImportError: No module named _tkinter, please install the python-tk package
由于Python的版本没有包含tkinter的模块,执行以下命令安装tk的package。
$ sudo apt-get install python-tk
接下来运行基于Python的demo,大功告成。
$ /home/bay/py-faster-rcnn/tools/demo.py
7.执行demo.py的效果图
1.下载Faster-RCNN源代码并安装
通过git工具直接下载,在Linux 命令行输入:
$ git clone —recursive https://github.com/rbgirshick/py-faster-rcnn.git
PS : —recursive 是用来caffe-fast-rcnn (也就是caffe branch)的,这个必须要加上,否则此文件夹为空
2. 编译Cython模块
在 /py-faster-rcnn/lib directory 目录下执行命令:
$ cd py-faster-rcnn/lib
$ make
3.拷贝Makefile.config,并修改Makefile.config
$
cd py-faster-rcnn/caffe-fast-rcnn
$ cp Makefile.config.example Makefile.config
更改Makefile.config文件:
1)#USE_CUDNN := 1行,去掉#变为 USE_CUDNN := 1 ,如果你的计算机的计算能力能够支持cudnn 。
2)Add the following lines in
Makefile.config
不然编译的时候会报错,如果不加这两行,会出hdf5.h找不到的错误,还有其他的错误,总之,加上就对了。
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include/usr/include/hdf5/serial/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
/usr/lib/x86_64-linux-gnu/hdf5/serial/
注意:新加的行前面需空一个空格。
3)
4000行#WITH_PYTHON_LAYER := 1
,去掉#变为WITH_PYTHON_LAYER
:= 1[/code],因为faster R-CNN是要python接口的,所以这一项要有,不能注释。
否则会在运行demo.py的时候遇到这样错误:
4.编译Caffe和Pycaffe
$
make -j4 && make pycaffe
因为这个版本所用的cudnn为旧版本的,可能与新环境的cudnn不兼容,导致出现如下错误:
make: *** [.build_release/src/caffe/util/db.o] Error 1
make: *** Waiting for unfinished jobs....
03. make: *** [.build_release/src/caffe/layers/cudnn_relu_layer.o] 错误 1
解决办法:
1)将文件替换为[code]caffe/include/caffe/util/cudnn.hpppy-faster-rcnn/caffe-fast-rcnn/include/caffe/util/cudnn.hpp
,即相应的cudnn.hpp.[/code]
2)将文件夹中相应的py-faster-rcnn/caffe-fast-rcnn/include/caffe/layers文件夹中所有以cudnn的文件替换[code]为caffe/include/caffe/layers
cudnn开头文件。
3)将
py-faster-rcnn/caffe-fast-rcnn/src/caffe/layers文件夹中所有以cudnn开头的文件替换为
caffe/src/caffe/layers文件夹中相应的cudnn开头的文件,例如cudnn_lrn_layer.cu,cudnn_pooling_layer.cpp等。
[/code]
5.下载已训练好的Faster R-CNN模型
$
cd py-faster-rcnn
注意这个脚本中提供的网址现在需要翻墙才能连接并下载,不过如果实在下载不了的话就自己训练吧。
6. 运行python的demo
执行以下命令:
$ cdpy-faster-rcnn
./tools/demo.py
1)出现如下错误ImportError: No module named easydict
缺少Python库easydict,所以安装 pip install easydict,执行以下命令:
$ sudo pip install easydict
2)出现如下错误:ImportError: No module named cv2
缺少Python库cv2,这个是openCV里面的。执行以下命令来装openCV python库
$ sudo apt-get install python-opencv
3)出现如下错误:ImportError: No module named _tkinter, please install the python-tk package
由于Python的版本没有包含tkinter的模块,执行以下命令安装tk的package。
$ sudo apt-get install python-tk
接下来运行基于Python的demo,大功告成。
$ /home/bay/py-faster-rcnn/tools/demo.py
7.执行demo.py的效果图
相关文章推荐
- Ubuntu16.04+cuda8.0+cudnn5.1配置faster-rcnn的方法以及训练自己的数据出现的问题
- Ubuntu16.04+GTX1070+cuda8.0+cudnn5.1配置faster-rcnn的方法
- ubuntu16.04 cuda8.0 cudnn6.0 faster-rcnn配置
- Ubuntu16.04+CUDA8.0+OpenCV3.1+python+caffe+faster-rcnn环境配置
- Ubuntu16.04 cuda8.0+cudnn5.1 opencv3.3 caffe-faster-rcnn
- Ubuntu16.04+Cuda8.0+1080ti+caffe+免OpenCV3.2.0+faster-rCNN教程
- 深度环境配置ubuntu16.04 cuda8.0 cudnnv5.1
- ubuntu16.04 cuda9 faster-rcnn配置
- Ubuntu16.04 cuda8.0+cudnn5.1 opencv3.3 caffe-faster-rcnn 服务器配置
- Ubuntu16.04+GT720M + Cuda8.0+py-faster-rcnn(caffe)
- Ubuntu16.04+cuda8.0+cudnnV5.1 caffe SSD配置、训练及测试过程
- 深度学习主机环境配置: Ubuntu16.04+Nvidia GTX 1080+CUDA8.0
- Ubuntu16.04安装cuda8.0,cudnn6.0,并在conda里安tensorflow1.3(与cuda8.0匹配),pycharm的gpu加速环境变量配置
- Ubuntu16.04+Cuda8.0+cuDNN6配置py-faster rcnn
- Ubuntu16.04 +cuda8.0+cudnn+caffe+theano+tensorflow配置明细
- Ubuntu 16.04+CUDA8+CUDNN v5配置faster rcnn
- 配置yolo2(ubuntu16.04+cuda8.0)
- 神舟z7-kp7s1-GTX1060+ubuntu16.04+cuda8.0+cudnn5.1+GPU配置教程
- faster rcnn配置 cuda8.0
- Ubuntu16.04 +cuda8.0+cudnn+caffe+theano+tensorflow配置明细