Ubuntu16.04+Faster R-CNN编译

2017-02-28  本文已影响0人  izhangxm

准备

请参考 深度学习:Ubuntu16.04+双TitanX+CUDA8.0+CUDNN5.1+Caffe 搭建起深度学习基础平台

安装

git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git
cd caffe-fast-rcnn
git remote add caffe https://github.com/BVLC/caffe.git
git fetch caffe
git merge -X theirs caffe/master

然后删除 self_.attr("phase") = static_cast<int>(this->phase_);include/caffe/layers/python_layer.hpp 中,当合并结束后

cd $FRCN_ROOT/lib
make
USE_CUDNN := 1 (可选)
USE_OPENCV := 1 (可选)
OPENCV_VERSION := 3 (如果打开了USE_OPENCV,而且opencv版本为3时)
PYTHON_INCLUDE := /usr/include/python2.7 /usr/lib/python2.7/dist-packages/numpy/core/include
WITH_PYTHON_LAYER := 1
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /usr/local/share/OpenCV/3rdparty/lib
将下面这一行:
NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
替换为:
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

当使用opencv3 出现错误 imread,imencode,imdecode 或者 VideoCapture 时,编辑Makefile :

 LIBRARIES += glog gflags protobuf leveldb snappy \
  lmdb boost_system boost_filesystem hdf5_hl hdf5 m \
  opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_videoio
cd $FRCN_ROOT/caffe-fast-rcnn
# Now follow the Caffe installation instructions here:
#   http://caffe.berkeleyvision.org/installation.html
# If you're experienced with Caffe and have all of the requirements installed
# and your Makefile.config in place, then simply do:
make -j8 && make pycaffe

一些可能的错误

直接删除这一行就好了
上一篇 下一篇

猜你喜欢

热点阅读