使用gpu(gtx1080) cudnn 5.1下编译faster rcnn
来源:互联网 发布:网络攻击防御软件 编辑:程序博客网 时间:2024/05/29 18:57
GPU (CUDA 8.0,Cudnn5.1 ) Faster-rcnn
在caffe都弄好的情况下~~~~(现在的版本faster-rcnn据说只支持cudnn 3版本的,所以在这之上要是想使用cudnn的都需要经过替换文件,下面有提到)
特别注意,你每一次编译的时候都需要把之前编译好的文件清除,否则编译不成功,在 ~/py-faster-rcnn/caffe-fast-rcnn下执行 make clean 操作就是清除上一次编译(没有成功的编译在你希望重新编译的时候都需要make clean)
一:
Clone the Faster R-CNN repository
# Make sure toclone with --recursive
git clone--recursive https://github.com/rbgirshick/py-faster-rcnn.git
We'll call the directory that you cloned Faster R-CNN into
FRCN_ROOT
Ignore notes 1 and 2 if you followedstep 1 above.
Note 1:If you didn't clone Faster R-CNN with the--recursive
flag, then you'll need to manually clone thecaffe-fast-rcnn
submodule:
git submoduleupdate --init --recursive
Note 2:Thecaffe-fast-rcnn
sub moduleneeds to be on thefaster-rcnn
branch(or equivalent detached state). This will happen automaticallyifyou followed step 1 instructions.
上面就是官方文档给出的正确clonefasterrcnn的方法和如果不按照这个给定方法执行所产生的后果:漏装了caffe-fast-rcnn(这个文件在后面很重要,如果没有它,下面的工作无法执行)
二:
下载demo模型数据
cd $FRCN_ROOT
$./data/scripts/fetch_faster_rcnn_models.sh
This will populate the $FRCN_ROOT/data
folder withfaster_rcnn_models
. Seedata/README.md
for details. These modelswere trained on VOC 2007 trainval.
到py-faster-rcnn的路径下找到执行后面到文件./data/scripts/fetch_faster_rcnn_models.sh,所下载的模型会放在py-faster-rcnn的路径下的data文件夹下,名为faster_rcnn_models.(其实也可以不用执行指令下载的,你可以在其他地方下载好了,放在data目录下就好了~)
三:
修改文件:
1. 执行:cp Makefile.config.exampleMakefile.config (在caffe-fast-rcnn目录下)
$ cp Makefile.config.exampleMakefile.config(在caffe-fast-rcnn目录下)
2. 打开Makefile.config:文件找到相应的地方添加下面的黄色的内容,修改
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/
保存退出,注意新加的内容和原来的有空格隔开
(
否则会出现什么hdf5.o文件找不到~
)
3. 更改Makefile.config文件:去掉use_cudnn前面的注释 #
#Unrelatedly, it's also recommended that you use CUDNN
USE_CUDNN:= 1
4. 因为这个版本所用的cudnn为旧版本的,可能与新环境的cudnn不兼容
所以你需要:
1).将/py-faster-rcnn/caffe-fast-rcnn/include/caffe/util/cudnn.hpp换成最新版的caffe里的cudnn的实现,即相应的cudnn.hpp.
2).把/py-faster-rcnn/caffe-fast-rcnn/include/caffe/layers中所有以cudnn开头的文件都(建议到该目录下了之后,使用文件搜索功能替换)用最新caffe源码的以下文件替换掉fasterrcnn的对应文件(一般在caffe目录下的相同目录下:~caffe/include/caffe/layers/xx文件)
3).把/py-faster-rcnn/caffe-fast-rcnn/src/caffe/layers中所有以cudnn开头的文件都(建议到该目录下了之后,使用文件搜索功能替换)用最新caffe(就是贾阳青的那个框架里面的文件)源码的中对应文件替换掉(一般在caffe目录下的相同目录下:~caffe/src/caffe/layers/xx文件)
注意是所有文件哦~所有以cudnn开头的文件拉~
否则导致出现如下错误:
(
In file includedfrom ./include/caffe/util/device_alternate.hpp:40:0,
from ./include/caffe/common.hpp:19,
from ./include/caffe/blob.hpp:8,
from ./include/caffe/layer.hpp:8,
from src/caffe/layer_factory.cpp:8:
./include/caffe/util/cudnn.hpp:In function ‘voidcaffe::cudnn::createPoolingDesc(cudnnPoolingStruct**,caffe::PoolingParameter_PoolMethod, cudnnPoolingMode_t*, int, int,int, int, int, int)’:
./include/caffe/util/cudnn.hpp:127:41: error:too few arguments to function ‘cudnnStatus_t
)
5.把Makefile.config文件中的WITH_PYTHON_LAYER:= 1前面的注释#去掉~
WITH_PYTHON_LAYER:= 1 (Makefile.config文件中)
一定要注意把这个的注释也去掉了,否则下面会出现这种类似的问题(也就是去掉“# ”)
( 类似的问题:
F110302:52:40.782572 12953 layer_factory.hpp:81] Check failed:registry.count(type) == 1 (0 vs. 1) Unknown layer type:Python (knowntypes: AbsVal, Accuracy, ArgMax, BNLL, BatchNorm, BatchReindex, Bias,Concat, ContrastiveLoss, Convolution, Data, Deconvolution, Dropout,DummyData, ELU, Eltwise, Embed, EuclideanLoss, Exp, Filter, Flatten,HDF5Data, HDF5Output, HingeLoss, Im2col, ImageData, InfogainLoss,InnerProduct, LRN, Log, MVN, MemoryData, MultinomialLogisticLoss,PReLU, Pooling, Power, ROIPooling, ReLU, Reduction, Reshape, SPP,Scale, Sigmoid, SigmoidCrossEntropyLoss, Silence, Slice,SmoothL1Loss, Softmax, SoftmaxWithLoss, Split, TanH, Threshold, Tile,WindowData)
*** Check failurestack trace: ***
)
6.安装easydict
$ sudo pip installl easydict (在ubuntu根目录下执行,其实哪里执行都ok吧)
一般不建议这样子安装,因为很多时候会出现问题,建议自己去下载压缩包,解压,cd到解压后的文件目录下,你就会看到setup.py文件,在该目录下执行
$ sudo pythonsetup.py install 就可以安装这个库了(这是必须要的库文件,否则编译的时候会出现类似说没有easydict库文件的问题)
不建议使用$python setup.pyinstall来安装setup.py,因为我遇到过下面这种问题
(
siahooar@siahooar:~/pip-1.5.6$python setup.py install
running install
error:can't create or remove files in install directory
siahooar@siahooar:~/pip-1.5.6$sudo python setup.py install (换成sudoxxx 就好了)
running install
running bdist_egg
running egg_info
)
四。
编译Cpython(Build the Cython modules)
$ cd $FRCN_ROOT/lib (到py-faster-rcnn/lib目录下)
$ make
五。
编译caffe-fast-rcnn(Build Caffe and pycaffe)
cd$FRCN_ROOT/caffe-fast-rcnn (到py-faster-rcnn/caffe-fast-rcnn目录下)
然后在该目录下执行:make–j4 && make pycaffe
$ make -j4 &&make pycaffe
六:
运行程序自带的一个例子验证你的faster-rcnn
$ cd py-faster-rcnn
$ ./tools/demo.py
后面就不贴图了 成功了都一样
- 使用gpu(gtx1080) cudnn 5.1下编译faster rcnn
- 使用gpu(gtx1080) cudnn 5.1下编译faster rcnn
- faster rcnn在ubuntu环境下使用GPU模式并用cuDNN v5加速
- faster rcnn+gtx1080+caffe
- faster rcnn +cudnn V5
- Windows下faster-rcnn编译
- py faster rcnn caffe模块编译时报cudnn错误
- GTX1080+Cuda8.0+Cudnnv5+caffe+faster-rcnn
- GTX1080+Cuda8.0+Cudnnv5+caffe+faster-rcnn
- 使用cuDNN5编译py-faster-rcnn错误:cudnn.hpp(126): error: argument of type "int" is incompatible ...
- cudnn 5.1版本下跑通 py-faster-rcnn的demo
- windows下编译py-faster-rcnn
- faster rcnn +GPU+配置+训练
- faster rcnn cudnn版本不兼容问题
- faster-rcnn 编译问题
- faster-rcnn 安装编译
- 编译 Faster Rcnn
- 如何在py-faster-rcnn上使用最新的cudnn v5加速库
- 使用ImageLoader的相关常用设置
- SpringMVC、Tomcat怎样完成一次Http请求的?
- Guava(三)CharStreams和ByteStreams
- Maven的配置安装到MyEclipse2014
- 练习1-5 修改温度转换程序,要求以逆序(从300度到0度的顺序)打印温度转换表
- 使用gpu(gtx1080) cudnn 5.1下编译faster rcnn
- java中获取真实的客户端的IP的方法
- PHP,将html转为pdf(ThinkPHP框架)
- Docker的save和export命令的区别
- tortoisegit集成git-review
- IOS打包流程---之-------创建证书----------创建应用--提交审核
- 在线广告预估ctr的AUC计算方法
- 关于Android消息机制你所需要知道的
- HDU 6129 Just do it【杨辉三角+思维+Lucas定理】