Main steps are from: https://github.com/ShaoqingRen/faster_rcnn, and there are some changes in Preparation step to make it more adaptive and clearer.
Requirements:software
- Caffe build for Faster R-CNN (included in this repository, see external/caffe)
- If you are using Windows, you may download a compiled mex file by running fetch_data/fetch_caffe_mex_windows_vs2013_cuda65.m
- If you are using Linux or you want to compile for Windows, please follow the instructions on our Caffe branch.
- MATLAB
- CUDA
- Visual Studio
( I run the deep neural network withwindows10, matlab 2016a, cuda7.5, visual studio 2013 );
Requirements:hardware
GPU: Titan, Titan Black, Titan X, K20, K40,K80.
- Region Proposal Network (RPN)
- 2GB GPU memory for ZF net
- 5GB GPU memory for VGG-16 net
- Object Detection Network (Fast R-CNN)
- 3GB GPU memory for ZF net
- 8GB GPU memory for VGG-16 net
Preparation forTesting:
- Run fetch_data/fetch_caffe_mex_windows_vs2013_cuda65.m to download a compiled Caffe mex (for Windows only).
- In China, dowmload from BaiduYun is a better choice. Unzip and move the file to ~\faster_rcnn-master\external. The final direct is as follows:
- ~\faster_rcnn-master\external\caffe\matlab\caffe_faster_rcnn
- ~\faster_rcnn-master\external\caffe\matlab\caffe_faster_rcnn_dbg
- If you using cuda6.5, you can operate as the readme file directly, otherwise when you run the demo it might report an error as follow:
- In China, dowmload from BaiduYun is a better choice. Unzip and move the file to ~\faster_rcnn-master\external. The final direct is as follows:
"Invalid MEX-file '~\faster_rcnn-master\external\caffe\matlab\caffe_faster_rcnn\caffe_.mexw64':The specified
module could notbe found."
It is because the auther uses cuda6.5 while userschoose some different version. If you use cuda7.5, you can follow http://blog.csdn.net/Swordddddd/article/details/51555128. However, if you apply a higher verion like8.0, you have to build the caffe yourself, refer to instructions.
- Run faster_rcnn_build.m
- Run startup.m
Testing Demo:
- Run fetch_data/fetch_faster_rcnn_final_model.m to download our trained models.
- In China, dowmload from BaiduYun is a better choice. Unzip and move the file to ~\faster_rcnn-master\output. Put test pictures (000456.jpg, …) in root dir of Faster R-CNN.
- Copy experiments/script_faster_rcnn_demo.m to the root dir of Faster R-CNN, and add a directory name 'faster_rcnn-master' to the path in script_faster_demo.m, line 6, before 'start up' .
- Run experiments/script_faster_rcnn_demo.m to test a single demo image.
- You will see the timing information as below. We get the following running time on K40 @ 875 MHz and Intel Xeon CPU E5-2650 v2 @ 2.60GHz for the demo images with VGG-16:
001763.jpg (500x375): time 0.201s (resize+conv+proposal: 0.150s, nms+regionwise: 0.052s)
004545.jpg (500x375): time 0.201s (resize+conv+proposal: 0.151s, nms+regionwise: 0.050s)
000542.jpg (500x375): time 0.192s (resize+conv+proposal: 0.151s, nms+regionwise: 0.041s)
000456.jpg (500x375): time 0.202s (resize+conv+proposal: 0.152s, nms+regionwise: 0.050s)
001150.jpg (500x375): time 0.194s (resize+conv+proposal: 0.151s, nms+regionwise: 0.043s)
mean time: 0.198s
and with ZF net:
001763.jpg (500x375): time 0.061s (resize+conv+proposal: 0.032s, nms+regionwise: 0.029s)
004545.jpg (500x375): time 0.063s (resize+conv+proposal: 0.034s, nms+regionwise: 0.029s)
000542.jpg (500x375): time 0.052s (resize+conv+proposal: 0.034s, nms+regionwise: 0.018s)
000456.jpg (500x375): time 0.062s (resize+conv+proposal: 0.034s, nms+regionwise: 0.028s)
001150.jpg (500x375): time 0.058s (resize+conv+proposal: 0.034s, nms+regionwise: 0.023s)
mean time: 0.059s - The visual results might be different from those in the paper due to numerical variations.
- Running time on other GPUs
GPU / mean time | VGG-16 | ZF
:------------------------:|:--------------------:|:--------------------: K40 | 198ms | 59ms
Titan Black | 174ms | 56ms
Titan X | 151ms | 59ms
- You will see the timing information as below. We get the following running time on K40 @ 875 MHz and Intel Xeon CPU E5-2650 v2 @ 2.60GHz for the demo images with VGG-16:
Reference :
https://github.com/ShaoqingRen/faster_rcnn#introduction
http://blog.csdn.net/Swordddddd/article/details/51555128