Skip to content

Instantly share code, notes, and snippets.

@kphretiq

kphretiq/caffe-install.md

Last active Jul 27, 2016
Embed
What would you like to do?

Caffe Installation

Steps followed on Ubuntu Server 16.04, CPU-only install, with pycaffe.

Install Dependencies

sudo apt install build-essential python-dev python-pip libprotobuf-dev libleveldb-dev\
libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libhdf5-dev libgflags-dev\
libgoogle-glog-dev liblmdb-dev libatlas-base-dev

# make sure we have libboost
sudo apt-get install --no-install-recommends libboost-all-dev

# Upgrade pip (optional)
sudo -H pip install pip --upgrade

Caffe Configuration

git clone https://github.com/BVLC/caffe.git
cd ~/caffe/python
sudo -H pip install requirements.txt
cd ~/caffe
cp Makefile.config.example Makefile.config

Makefile.config

# uncomment CPU_ONLY if you have no cuda gpu. Weep, for you shall be
# waiting long for your psychedelic animal faces.
CPU_ONLY := 1

# change /usr to /usr/local, since we installed from pip.
PYTHON_INCLUDE := /usr/include/python2.7 \
        /usr/local/lib/python2.7/dist-packages/numpy/core/include

# add the hdf5 includes and libs, since they are elusive
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/

Build caffe and pycaffe

cd ~/caffe
make all && make test && make runtest
make pycaffe

Helpful Refs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment