1.依赖项:
(1): sudo apt-get update #更新软件列表
sudo apt-get upgrade #更新软件
sudo apt-get install build-essential #安装build essentialsl
sudo apt-get install linux-headers-'uname -r' #安装最新版本的kernel headers
上面这句话报错,用下面这句
sudo apt-get install linux-headers-$(uname -r) #安装最新版本的kernel headers
(2): sudo apt-get install libatlas-base-dev
(3): sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
(4): sudo apt-get install --no-install-recommends libboost-all-dev
(5): sudo apt-get install python-dev
(6): sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install python-pip
2.下载caffe安装包
(1):git clone https://github.com/BVLC/caffe.git
我在这里又出现了问题。
Cloning into 'caffe'...
remote: Enumerating objects: 64638, done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
原因:
curl的postBuffer默认值太小,需要在终端重新配置这个值
解决:
git config --global http.postBuffer 524288000
检查:
git config --list
显示:http.postbuffer=524288000
依然不ok?
尝试这个:git clone https://github.com/BVLC/caffe.git --depth 1
cd caffe(路径修改到caffe所在路径,以下不再做注释)
cp Makefile.config.example Makefile.config
(2):修改Makefile.config配置文件
在~/caffe目录下:
A、先将Makefile.config.example复制为Makefile.config
cp Makefile.config.example Makefile.config
B、去掉 # CPU_ONLY: = 1 的注释
(3):添加hdf5库文件(Makefile.config文件)
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/hdf5/serial/
接着需要更改相应的"Makefile"文件,找到
LIBRARIES +=glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
更改最http://www.codesec.net/view/468583.html后两项为:
LIBRARIES +=glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
(4):cd caffe;make all;make test;make runtest
第四步骤我这里有问题,于是改用第二中方法:
5、测试阶段
安装完了,自然要测试一下能不能用咯。首先cd到caffe目录,然后输入命令:
把lenet_solver.prototxt里面的solver_mode 改为 CPU。因为我们还没装GPU,暂时只使用CPU就好了。
然后我们运行脚本:
ok!