py-faster-rcnn安装与配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/abc8730866/article/details/70232525

(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

报错:Error: No module named cv2
解决方法:参考自(http://stackoverflow.com/questions/23040428/error-no-module-named-cv2
1.在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下错了,注意一下)
这里写图片描述

猜你喜欢

转载自blog.csdn.net/abc8730866/article/details/70232525