Write in front: Before has been engaged in Keras, recently due to some needs, need to learn Caffe, this record Caffe installation record. The Cuda is already installed by default
If you are migrating from another deep learning platform to Caffe, follow this tutorial.
First step: Git clone https://github.com/BVLC/caffe.git, then install the following pair of dependent files.
Apt-get Install Libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev Libboost-all-dev Libhdf5-serial-dev Libgflags-dev Libgoogle-glog-dev Liblmdb-dev Protobuf-compiler
The second step, to install OPENCV, I do not know why to install, do not install is not, note, be sure to enter into the Caffe directory below.
CD Caffe
sudo git clone https://github.com/jayrambhia/Install-OpenCV
CD Install-opencv/ubuntu
sudo sh dependencies.sh
CD 2.4
sudo sh opencv2_4_10.sh
The third step, if you install the CUDNN, then do not rush to compile, modify the makefile file so that you can use CUDNN acceleration
sudo vi makefile.config
The comment symbol # of the USE_CUDNN line is removed, i.e. use_cudnn: = 1, about the 5th line, and can be looked up when using Vim.
Fourth step, compile, but here may encounter a small problem, that is "fatal error:hdf5.h", the solution is as follows
1: In the Makefile.config file, add /usr/include/hdf5/serial/ to Include_dirs, that is, the following first line of code is changed to the second line of code.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
2: In the makefile file, change hdf5_hl and Hdf5 to hdf5_serial_hl and hdf5_serial, that is, the following first line of code is changed to the second line of code.
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
接下来就可以正常编译了
CD ~/caffe
sudo cp Makefile.config.example Makefile.config
Make all
So that's it, enter echo $ on the command line? If the return is 0, then the compilation is successful, and the next step is to test a small example.
ubuntu166.04 Installation of Caffe