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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Ubuntu >内容正文

Ubuntu

ubuntu运行Faster R-CNN

發布時間:2025/3/21 Ubuntu 107 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ubuntu运行Faster R-CNN 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

轉載自:http://blog.csdn.net/helloeveryon/article/details/48789079

論文名:FasterR-CNN: Towards Real-Time Object Detection?with Region Proposal Networks

代碼鏈接:https://github.com/ShaoqingRen/faster_rcnn

查閱的博客:http://blog.csdn.net/qq_30040223/article/details/48491997

?

接下來是各種版本號:

openCVversion

命令:$ pkg-config --modversion opencv???????????????????????????????????????????????????????????????????????

輸出:3.0.0

Cuda版本號:7.0

…..

?

錯誤類型

../lib/libcaffe.so: undefined reference tocv::imread(cv::String const&, int)' collect2: error: ld returned 1 exitstatus make[2]: *** [tools/compute_image_mean] Error 1 make[2]: Leaving

解決:

open yourMakefile with some text editor, locate line 164 (in my case), addopencv_imgcodecs behind.

?LIBRARIES += glog gflags protobuf leveldbsnappy \

? lmdb boost_system hdf5_hl hdf5 m \

? opencv_core opencv_highgui opencv_imgprocopencv_imgcodecs

?(鏈接: https://github.com/BVLC/caffe/issues/1276)

錯誤類型

LD -o .build_release/lib/libcaffe.so

/usr/bin/ld:/usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_32S against`.rodata' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libgflags.a: error addingsymbols: Bad value

collect2: error: ld returned 1 exit status

make: *** [.build_release/lib/libcaffe.so]Error 1

解決:

?

Ubuntu下運行Faster-Rcn

Faster-Rcnn 介紹

前幾天Shaoqing Ren放出了Faster-Rcnn的代碼,可以在他的Github上下載得到,上面也有詳細的配置說明。?
我下載下來,在自己的虛擬機上測試了一下,速度上確實比之前的Fast-Rcnn有提高。

SPP-Net,Fast-Rcnn,Faster-Rcnn都是在Ross Girshick2014年發布的RCNN上面的改進與提高,其中SPP-Net,Faster-Rcnn都是Shaoqing Ren的作品,當然其中還有Kaiming He以及Ross Girshick等微軟亞研院研究員的貢獻。Shaoqing Ren也是個牛人啊,可以去他的個人主頁看看他做的一些工作,ICCV,CVPR,ECCV三大會,PAMI都發過論文,今年Faster-Rcnn還發表在了NIPS上,是我的奮斗目標!

Faster-Rcnn相對于Fast-Rcnn的改進在于將Object Proposal利用CNN網絡實現,并與Detection的CNN網絡結合實現了一個端到端的Object Detection框架。之前Fast-Rcnn的Proposal是利用Selective Search實現的,SS方法雖然得到的Proposal相對于其他方法是較好的,但是其速度比較慢,更不用說跟利用GPU進行加速的Detection步驟相比,由此Proposal的產生便成為了一個瓶頸。

而Faster-Rcnn便解決了這個問題,不單單是加速了Proposal的產生,還將兩個網絡結合進行優化,于是原本跟Detection任務分離的Proposal步驟被結合了起來,Detection的結果好壞會通過梯度的回傳影響到Proposal網絡的參數,Faster-Rcnn實現優化的思路采用的是常見的固定一個更新另一個的策略,固定Proposal網絡,更新Detection網絡,再固定Detection網絡,更新Proposal網絡。

Faster-Rcnn 配置

參考Shaoqing Ren的配置說明:

(1) 安裝Matlab 2014a?
(2) 下載源代碼

Git
clone
--recursive https:
//github.com/ShaoqingRen/faster_rcnn.git

(3)配置Caffe?

將你之前配置過的CaffeMakefile.config拷貝至./faster-rcnn/external/caffe,記得修改Matlab接口,接著編譯就可以了。

make -j$(nproc)make?

matcaffe -j$(nproc)

(4) 運行Faster-Rcnn?

A. 在faster-rcnn路徑下打開Matlab,或者直接打開Matlab再切換到faster-rcnn路徑,運行faster_rcnn_build.m,沒有GPU的話在Compiling nms_gpu_mex時會出錯,但其他是能夠正常編譯的,所以沒有關系。?
B. 運行startup.m,會加入其所需路徑。?
C. 運行fetch_data/fetch_faster_rcnn_final_model.m,下載所需模型。推薦在作者Github上找百度云盤的下載鏈接,速度會快上不少,下載完將output文件夾解壓至./faster-rcnn目錄下。?
D. 打開experiments/script_faster_rcnn_demo.m測試文件,沒有GPU不要直接運行,其代碼默認是用GPU進行測試的,因此在CPU模式下會出錯。?
修改下代碼,不使用GPU即可:?
修改前:

%% -------------------- CONFIG -------------------- opts.caffe_version = 'caffe_faster_rcnn'; opts.gpu_id = auto_select_gpu; active_caffe_mex(opts.gpu_id, opts.caffe_version);opts.per_nms_topN = 6000; opts.nms_overlap_thres = 0.7; opts.after_nms_topN = 300; opts.use_gpu = True;opts.test_scales = 600;

修改后:

%% -------------------- CONFIG -------------------- opts.caffe_version = 'caffe_faster_rcnn'; %opts.gpu_id = auto_select_gpu; %active_caffe_mex(opts.gpu_id, opts.caffe_version);opts.per_nms_topN = 6000; opts.nms_overlap_thres = 0.7; opts.after_nms_topN = 300; opts.use_gpu = false;opts.test_scales = 600;

E.運行該測試文件?

默認載入的模型是VGG16網絡,如果運行過程中出現kill,那就把模型換成ZF的好了。?
VGG16網絡比較大,可能會出現內存不足,所以在虛擬機或者內存較小的機器上推薦使用小模型ZF來進行測試。

%% -------------------- INIT_MODEL -------------------- %model_dir = fullfile(pwd, 'output', 'faster_rcnn_final', 'faster_rcnn_VOC0712_vgg_16layers'); %% VGG-16 model_dir = fullfile(pwd, 'output', 'faster_rcnn_final', 'faster_rcnn_VOC0712_ZF'); %% ZF proposal_detection_model = load_proposal_detection_model(model_dir);

F.測試結果?

我的CPU是I5-4460,測試速度是比Fast-Rcnn更快的。

%% -------------------- INIT_MODEL -------------------- %model_dir = fullfile(pwd, 'output', 'faster_rcnn_final', 'faster_rcnn_VOC0712_vgg_16layers'); %% VGG-16 model_dir = fullfile(pwd, 'output', 'faster_rcnn_final', 'faster_rcnn_VOC0712_ZF'); %% ZF proposal_detection_model = load_proposal_detection_model(model_dir);

?

總結

以上是生活随笔為你收集整理的ubuntu运行Faster R-CNN的全部內容,希望文章能夠幫你解決所遇到的問題。

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