本文介绍在Ubuntu16.04上安装Caffe。
1.首先假定已经安装Ubuntu16.04,cuda , cndnn和opencv。
2.系统安装完成后,打开命令行控制台,输入以下命令,安装基本依赖(General dependencies)。
1、sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
2、sudo apt-get install --no-install-recommends libboost-all-dev
3、安装ATLAS,输入下述命令:
sudo apt-get install libatlas-base-dev
4.安装剩余依赖:
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
5.下载Caffe:
sudo apt-get install git
git clone https://github.com/BVLC/caffe.git
6.修改Makefile.config:
首先进入caffe目录,并创建Makefile.config文件:
cd caffe
gedit Makefile.config
复制Makefile.config.example的内容到Makefile.config中,并修改以下内容:
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
修改为:
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/i386-linux-gnu/hdf5/serial
Makefile中
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
7.进行编译
make all
make test
make runtest
8.编译完成