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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

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

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 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的方法和如果不按照這個給定方法執行所產生的后果:漏裝了caffe-fast-rcnn(這個文件在后面很重要,如果沒有它,下面的工作無法執行)

二:

下載demo模型數據

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的路徑下找到執行后面到文件./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.

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

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

注意是所有文件哦~所有以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后面就不貼圖了 成功了都一樣 與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。