Caffe Installation安装笔记

转载自https://gist.github.com/titipata/f0ef48ad2f0ebc07bcb9

Note on how to install caffe on Ubuntu. Sucessfully install using CPU, more information for GPU see this link

Installation

verify all the preinstallation according to CUDA guide e.g.

lspci | grep -i nvidia
uname -m && cat /etc/*release
 gcc --version

install CUDA on Ubuntu, following this site to install CUDA. We get .deb file and dpkg from CUDA download page (add CUDA path to .bashrc, see below)

wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo apt-get update
sudo apt-get install cuda

More to do see post installion at this link where we change directory to ~/NVIDIA_CUDA-6.5_Samples then type make. Afterward, run deviceQuery under ~/NVIDIA_CUDA-6.5_Samples

install BLAS (from libopenblas) and git (and unzip for opencv)

sudo apt-get install libopenblas-dev git unzip
install opencv, follow this site where I use this bash script to install opencv
wget https://raw.githubusercontent.com/jayrambhia/Install-OpenCV/master/Ubuntu/2.4/opencv2_4_9.sh
chmod +x opencv2_4_9.sh 
./opencv2_4_9.sh 

install Anaconda from this link then run

wget http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-2.1.0-Linux-x86_64.sh
bash Anaconda-2.1.0-Linux-x86.sh

(add Anaconda path to .bashrc, see below)

install Boost using this command:

sudo apt-get install libboost-all-dev
install others by following Caffe documentation
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler

Get latest version of protobuf using pip

pip install protobuf

Then clone caffe and follow the instruction

git clone https://github.com/BVLC/caffe
cp Makefile.config.example Makefile.config

Adjust Makefile.config (for example, if using Anaconda Python)

make all
make test
make runtest

Note that we apply this to anaconda according to Caffe issue

rm ~/anaconda/lib/libm.*

And I also do something like in /usr/lib/x86_64-linux-gnu/:

sudo cp libhdf5_hl.so.7 libhdf5_hl.so.8
sudo cp libhdf5.so.7 libhdf5.so.8

(according to this issue on Caffe)

另外我还做了如下步骤

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ and
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/

After that we can make python interface for caffe - make pycaffe (in caffe/python)

Customization Caffe

This is what I added to .bashrc 添加./.bashrc文件内容

CUDA

export PATH=/usr/local/cuda-6.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH
export PATH

Anaconda

export PATH=/home/ubuntu/anaconda/bin:$PATH

Caffe Root

export CAFFE_ROOT=/home/ubuntu/caffe

Error Found

According to tutorial When running ./examples/mnist/train_lenet.sh, I got following error:
libdc1394 error: Failed to initialize libdc1394
I0109 02:31:21.168457 30295 caffe.cpp:99] Use GPU with device ID 0
F0109 02:31:21.168894 30295 common.cpp:53] CPU-only Mode: cannot make GPU call.
Above problem solved by changing solver_mode: GPU to CPU in /caffe/examples/mnist/lenet_solver.prototxt
More installation:

pip install protobuf

To do list

Set python path for caffe so we are able to import caffe see more on http://caffe.berkeleyvision.org/tutorial/interfaces.html
See more in IPython notebook example from Caffe

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值