1.下載py-R-FCN
git clone https://github.com/Orpine/py-R-FCN.git
2.下載caffe
cd $RFCN_ROOT git clone https://github.com/Microsoft/caffe.git
3.替換cudnn
由於cudnn版本問題,所以重新拷貝(家目錄):
cp caffe/include/caffe/util/cudnn.hpp py-R-FCN/caffe/include/caffe/util/cudnn.hpp cp caffe/src/caffe/layers/cudnn_* py-R-FCN/caffe/src/caffe/layers/ cp caffe/include/caffe/layers/cudnn_* py-R-FCN/caffe/include/caffe/layers/
4. lib目錄下編譯
cd /home/user/py-R-FCN/lib make
5.編譯caffe和pycaffe
拷貝自己的Makefile.config,注釋掉Makefile.config目錄下的Anaconda的部分,編譯:
cd $RFCN_ROOT/caffe make -j8 && make pycaffe
6.測試demo
需要下載resnet50_rfcn_final.caffemodel和resnet101_rfcn_final.caffemodel。
放在RFCN_ROOT/data/rfcn_models/路徑下。
直接運行demo會報錯:
Demo for data/demo/000456.jpg Detection took 0.069s for 300 object proposals This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". Available platform plugins are: minimal, offscreen, xcb. Reinstalling the application may fix this problem. Aborted (core dumped)
所以先注釋掉環境變量中的Anaconda。
運行demo會報錯:
Traceback (most recent call last): File "./tools/demo_rfcn.py", line 17, in <module> from fast_rcnn.config import cfg File "/home/user/py-R-FCN/tools/../lib/fast_rcnn/config.py", line 23, in <module> from easydict import EasyDict as edict ImportError: No module named easydict
安裝easydict:
pip install easydict
運行demo:
./tools/demo_rfcn.py --net ResNet-50
成功。