1. 程式人生 > >py-faster-rcnn安裝與配置

py-faster-rcnn安裝與配置

(1)安裝cython, python-opencv,easydict

pip install cython  
pip install easydict  
apt-get install python-opencv  

(2)下載py-faster-rcnn

git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git  

(3)進入py-faster-rcnn/lib,執行make

cd ~/py-faster-rcnn/lib
make

(4)進入py-faster-rcnn\caffe-fast-rcnn

cd ~/py-faster-rcnn/caffe-fast-rcnn
cp Makefile.config.example Makefile.config

修改配置Makefile.config檔案:去掉以下的註釋

WITH_PYTHON_LAYER := 1
USE_CUDNN := 1

配置好Makefile.config檔案後,執行:

make -j8 && make pycaffe  

報錯:error: argument of type “int” is incompatible with parameter of type “cudnnNanPropagation_t”


解決方案:參考(http://www.voidcn.com/blog/10km/article/p-6514306.html

(5)下載fetch_fast_rcnn_models

cd ~/py-faster-rcnn
./data/scripts/fetch_faster_rcnn_models.sh

如果網路連線不上外網,可以去網路上找網盤資源下載。
下載後存放在:~/py-faster-rcnn/data/faster_rcnn_models/XXXX.caffemodel
這裡寫圖片描述
(6)執行演示檔案demo.py

cd ~/py-faster-rcnn/tools
./demo.py
import
sys sys.path.append('/opt/ros/hydro/lib/python2.7/dist-packages')

2.複製 cv2.sosys.path 中的任何一個資料夾

#檢視sys.path
python
>>>import sys
>>>>sys.path

我是把/usr/local/lib/python2.7/dist-packages/cv2.so複製到/home/just/caffe/python

結果:(一開始沒有圖片顯示,是因為我model下錯了,注意一下)
這裡寫圖片描述