Skip to content

Instantly share code, notes, and snippets.

@kphretiq
Last active July 27, 2016 15:04
Show Gist options
  • Save kphretiq/7fc07f4f3e91246a2c3e0fddc2a00044 to your computer and use it in GitHub Desktop.
Save kphretiq/7fc07f4f3e91246a2c3e0fddc2a00044 to your computer and use it in GitHub Desktop.

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