Caffe - Jupyter - Ubuntu Install Guide

This guide is for Caffe installation on your local system without Cuda/Cudnn support.  You are supposed to run your codes on this local setup for debugging purposes. The final code will run on the Cuda/Cudnn enabled workstation in Room no. 2106.  Feel free to drop a line to dey.1@iitj.ac.in for any queries.

Downloads

  1. caffe github clone or download caffe-master.zip - link

Install Caffe

Open Terminal

cd Downloads/caffe-master/

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install -y build-essential cmake git pkg-config

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

sudo apt-get install -y libatlas-base-dev

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

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

sudo apt-get install -y python-pip

sudo apt-get install -y python-dev

sudo apt-get install -y python-numpy python-scipy

sudo apt-get install -y libopencv-dev

cp Makefile.config.example Makefile.config

sudo apt-get install kate

kate ./Makefile.config &

Uncomment

WITH_PYTHON_LAYER := 1

Change

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 /usr/lib/x86_64-linux-gnu/hdf5/serial

 

Open Terminal

cd Downloads/caffe-master/

find . -type f -exec sed -i -e 's^"hdf5.h"^"hdf5/serial/hdf5.h"^g' -e 's^"hdf5_hl.h"^"hdf5/serial/hdf5_hl.h"^g' '{}' \;

cd /usr/lib/x86_64-linux-gnu

sudo ln -s libhdf5_serial.so.10.1.0 libhdf5.so

sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so

 

cd Downloads/caffe-master/python

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

cd ..

 

kate ./Makefile

and replace this line:

NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

with the following line

NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

Open Terminal

make all

make test

make runtest

make pycaffe

make distribute

 

gedit ~/.bashrc

add this line at the end of the file

export PYTHONPATH=/home/arka/Downloads/caffe-master/python:$PYTHONPATH

export PATH=$PATH:/home/arka/Downloads/caffe-master/build/tools

export PATH=".:$PATH"

*use your username in place of  ‘arka

Reboot

Open Terminal

caffe

 

  

Install Jupyter Notebook

Open Terminal

sudo apt-get update

sudo apt-get -y install python2.7 python-pip python-dev

sudo apt-get -y install ipython ipython-notebook

sudo -H pip install jupyter

jupyter notebook

 

 

Try out Deep Dream

https://github.com/google/deepdream/blob/master/dream.ipynb   *


*get bvlc_googlenet.caffemodel file from https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet