本文首发于个人博客https://kezunlin.me/post/b90033a9/,欢迎阅读!
Install and Configure Caffe on ubuntu 16.04
Series
- Part 1: Install and Configure Caffe on windows 10
- Part 2: Install and Configure Caffe on ubuntu 16.04
Guide
requirements:
- NVIDIA driver 396.54
CUDA 8.0 cudnn 6.0.21- CUDA 9.2 cudnn 7.1.4
- opencv 3.1.0 --->3.3.0
- python 2.7 numpy 1.15.1
python 3.5.2 numpy 1.16.2- protobuf 3.6.1 (static)
- caffe latest
默认的protobuf,2.6.1测试通过。
此处,使用最新的3.6.1 也可以,编译caffe需要加上
-std=c 11
install CUDA cudnn
see install and configure cuda 9.2 with cudnn 7.1 on ubuntu 16.04
tips: we need to recompile caffe with cudnn 7.1
before we compile caffe, move caffe/python/caffe/selective_search_ijcv_with_python
folder outside caffe source folder, otherwise error occurs.
install protobuf
see Part 1: compile protobuf-cpp on ubuntu 16.04
which protoc
/usr/local/bin/protoc
protoc --version
libprotoc 3.6.1
caffe使用static的libprotoc 3.6.1
install opencv
see compile opencv on ubuntu 16.04
which opencv_version
/usr/local/bin/opencv_version
opencv_version
3.3.0
python
python --version
Python 2.7.12
check numpy
version
import numpy
numpy.__version__
'1.15.1'
import numpy
import inspect
inspect.getfile(numpy)
'/usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc'
compile caffe
clone repo
git clone https://github.com/BVLC/caffe.git
cd caffe
update repo
update at 20180822.
if you change your local Makefile and git pull origin master
merge conflict, solution
git checkout HEAD Makefile
git pull origin master
configure
mkdir build && cd build && cmake-gui ..
cmake-gui options
USE_CUDNN ON
USE_OPENCV ON
Build_python ON
Build_python_layer ON
BLAS atlas
CMAKE_CXX_FLGAS -std=c 11
CMAKE_INSTALL_PREFIX /home/kezunlin/program/caffe/build/install
使用
-std=c 11
configure output
Dependencies:
BLAS : Yes (Atlas)
Boost : Yes (ver. 1.66)
glog : Yes
gflags : Yes
protobuf : Yes (ver. 3.6.1)
lmdb : Yes (ver. 0.9.17)
LevelDB : Yes (ver. 1.18)
Snappy : Yes (ver. 1.1.3)
OpenCV : Yes (ver. 3.1.0)
CUDA : Yes (ver. 9.2)
NVIDIA CUDA:
Target GPU(s) : Auto
GPU arch(s) : sm_61
cuDNN : Yes (ver. 7.1.4)
Python:
Interpreter : /usr/bin/python2.7 (ver. 2.7.12)
Libraries : /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
NumPy : /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.51.1)
Documentaion:
Doxygen : /usr/bin/doxygen (1.8.11)
config_file : /home/kezunlin/program/caffe/.Doxyfile
<