日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

使用gpu(gtx1080) cudnn 5.1下编译faster rcnn

發(fā)布時(shí)間:2024/9/21 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用gpu(gtx1080) cudnn 5.1下编译faster rcnn 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

GPU (CUDA 8.0,Cudnn5.1 ) Faster-rcnn

caffe都弄好的情況下~~~~(現(xiàn)在的版本faster-rcnn據(jù)說(shuō)只支持cudnn 3版本的,所以在這之上要是想使用cudnn的都需要經(jīng)過(guò)替換文件,下面有提到)

特別注意,你每一次編譯的時(shí)候都需要把之前編譯好的文件清除,否則編譯不成功,在 ~/py-faster-rcnn/caffe-fast-rcnn下執(zhí)行 make clean 操作就是清除上一次編譯(沒(méi)有成功的編譯在你希望重新編譯的時(shí)候都需要make clean)

一:

Clone the Faster R-CNN repository

# Make sure to clone with --recursivegit clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git
  • We'll call the directory that you cloned Faster R-CNN intoFRCN_ROOT

Ignore notes 1 and 2 if you followedstep 1 above.

Note 1:If you didn't clone Faster R-CNN with the--recursiveflag, then you'll need to manually clone thecaffe-fast-rcnnsubmodule:

git submodule update --init --recursive

Note 2:Thecaffe-fast-rcnn sub moduleneeds to be on the faster-rcnn branch(or equivalent detached state). This will happen automaticallyifyou followed step 1 instructions.

上面就是官方文檔給出的正確clonefasterrcnn的方法和如果不按照這個(gè)給定方法執(zhí)行所產(chǎn)生的后果:漏裝了caffe-fast-rcnn(這個(gè)文件在后面很重要,如果沒(méi)有它,下面的工作無(wú)法執(zhí)行)

二:

下載demo模型數(shù)據(jù)

cd $FRCN_ROOT$ ./data/scripts/fetch_faster_rcnn_models.sh

This will populate the $FRCN_ROOT/datafolder withfaster_rcnn_models. Seedata/README.md for details. These modelswere trained on VOC 2007 trainval.

py-faster-rcnn的路徑下找到執(zhí)行后面到文件./data/scripts/fetch_faster_rcnn_models.sh,所下載的模型會(huì)放在py-faster-rcnn的路徑下的data文件夾下,名為faster_rcnn_models.(其實(shí)也可以不用執(zhí)行指令下載的,你可以在其他地方下載好了,放在data目錄下就好了~)

三:

修改文件:

1.  執(zhí)行:cp Makefile.config.exampleMakefile.config (caffe-fast-rcnn目錄下)

$ cp Makefile.config.exampleMakefile.config(caffe-fast-rcnn目錄下)

2.  打開(kāi)Makefile.config:文件找到相應(yīng)的地方添加下面的黃色的內(nèi)容,修改

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/

保存退出,注意新加的內(nèi)容和原來(lái)的有空格隔開(kāi)

否則會(huì)出現(xiàn)什么hdf5.o文件找不到~

3.  更改Makefile.config文件:去掉use_cudnn前面的注釋 #


#Unrelatedly, it's also recommended that you use CUDNN

USE_CUDNN:= 1


4.  因?yàn)檫@個(gè)版本所用的cudnn為舊版本的,可能與新環(huán)境的cudnn不兼容

 所以你需要:

1)./py-faster-rcnn/caffe-fast-rcnn/include/caffe/util/cudnn.hpp換成最新版的caffe里的cudnn的實(shí)現(xiàn),即相應(yīng)的cudnn.hpp.

)./py-faster-rcnn/caffe-fast-rcnn/include/caffe/layers中所有以cudnn開(kāi)頭的文件都(建議到該目錄下了之后,使用文件搜索功能替換)用最新caffe源碼的以下文件替換掉fasterrcnn的對(duì)應(yīng)文件(一般在caffe目錄下的相同目錄下:~caffe/include/caffe/layersxx文件)

)./py-faster-rcnn/caffe-fast-rcnn/src/caffe/layers中所有以cudnn開(kāi)頭的文件都(建議到該目錄下了之后,使用文件搜索功能替換)用最新caffe(就是賈陽(yáng)青的那個(gè)框架里面的文件)源碼的中對(duì)應(yīng)文件替換掉(一般在caffe目錄下的相同目錄下:~caffe/src/caffe/layersxx文件)

注意是所有文件哦~所有以cudnn開(kāi)頭的文件拉~

否則導(dǎo)致出現(xiàn)如下錯(cuò)誤:

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文件中)

一定要注意把這個(gè)的注釋也去掉了,否則下面會(huì)出現(xiàn)這種類似的問(wèn)題(也就是去掉“# ”)

( 類似的問(wèn)題:

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根目錄下執(zhí)行,其實(shí)哪里執(zhí)行都ok吧)

一般不建議這樣子安裝,因?yàn)楹芏鄷r(shí)候會(huì)出現(xiàn)問(wèn)題,建議自己去下載壓縮包,解壓,cd到解壓后的文件目錄下,你就會(huì)看到setup.py文件,在該目錄下執(zhí)行

$ sudo pythonsetup.py install 就可以安裝這個(gè)庫(kù)了(這是必須要的庫(kù)文件,否則編譯的時(shí)候會(huì)出現(xiàn)類似說(shuō)沒(méi)有easydict庫(kù)文件的問(wèn)題)

不建議使用$ python setup.pyinstall來(lái)安裝setup.py,因?yàn)槲矣龅竭^(guò)下面這種問(wèn)題

( 

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目錄下)

然后在該目錄下執(zhí)行:make–j4 && make pycaffe

$ make -j4 && make pycaffe六:運(yùn)行程序自帶的一個(gè)例子驗(yàn)證你的faster-rcnn$ cd py-faster-rcnn$ ./tools/demo.py后面就不貼圖了 成功了都一樣 與50位技術(shù)專家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的使用gpu(gtx1080) cudnn 5.1下编译faster rcnn的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。