The notes of installing caffe on ubuntu14.04 without GPU and CUDA

The installation of ubuntu 14.04

Please visit this notes:
The installation and Configuration of ubuntu 14.04


General dependencies

1
2
3
4
5
6
7
8
9
10
11
12
13
sudo apt-get update

sudo apt-get install apt-get install build-essential

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler

sudo apt-get install --no-install-recommends libboost-all-dev

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

sudo apt-get install libatlas-base-dev

sudo apt-get install python

Download Caffe

1
2
3
cd ~

sudo git clone git://github.com/BVLC/caffe.git

Python interface

1
2
3
4
5
sudo apt-get install python-pip

cd caffe/python

for req in $(cat requirements.txt); do sudo pip install $req; done

Compilation

<1> config:

1
2
3
4
5
6
7
8
cd caffe
sudo cp Makefile.config.example Makefile.config

# edit Makefile.config
sudo vim Makefile.config

# remove the comment '#'
CPU_ONLY := 1

<2> add path

1
2
3
4
5
6
7
# in .bashrc or /etc/profile

sudo vim .bashrc

# add python path
export PYTHONPATH=/home/xxxx/caffe/python:$PYTHONPATH
source .bashrc # or source /etc/profile

Save the Makefile.config and Make:

1
2
3
4
5
6
cd caffe

sudo make all
sudo make test
sudo make runtest
sudo make pycaffe

If you meet the errors just like this:

ERRORS: src/caffe/net.cpp:8:18: fatal error: hdf5.h: No such file or directory

Please solver as flow:

1
2
3
4
5
6
7
8
9
10
11
cd /usr/lib/x86_64-linux-gnu
sudo ln -s libhdf5_serial.so.10.1.0 libhdf5_serial.so
sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_serial_hl.so
```

Then update the file "Makefile.config":

```bash
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/

Run examples

<1> Mnist:

1
2
3
4
5
6
7
8
9
10
11
12
cd caffe

# get datas
sudo sh data/mnist/get_mnist.sh

# rebulid lmdb/leveldb files, generates mnist-train-lmdb and mnist-train-lmdb
sudo sh examples/mnist/create_mnist.sh

# change caffe/examples/mnist/lenet_solver.prototxt to solver_mode: CPU.

# train
sudo sh examples/mnist/train_lenet.sh

<2> Cifar10:

1
2
3
4
5
6
7
8
9
10
# get datas
sudo sh data/cifar10/get_cifar10.sh

# rebulid lmdb/leveldb files
sudo sh examples/cifar10/create_cifar10.sh

# change solver.prototxt to solver_mode: CPU.

# train
sudo sh examples/cifar10/train_quick.sh

Reference

[1] http://sunshineatnoon.github.io/How-to-install-caffe/
[2] http://caffe.berkeleyvision.org/installation.html
[3] http://caffe.berkeleyvision.org/install_apt.html
[4] https://github.com/NVIDIA/DIGITS/issues/156

END


Enjoy it ? Donate me ! 求鼓励,求支持!
0%