Installation Script for Caffe & DeepDream on Debian 8

752 views
Skip to first unread message

T

unread,
Jul 10, 2015, 11:05:31 PM7/10/15
to caffe...@googlegroups.com
Hi All,

I've made a script that does most of the install on Debian 8. Details below.
If you have any issues, feel free to reply to this post and i will reply as soon as i can

The script contains 3 files, as follows:
"dp.sh"
#!/bin/bash
sudo apt-get install ipython python-pil python-numpy python-scipy libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev python-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler libblas-common libblas-dev libblas-doc libblas-test libblas3 libblas3gf hdf5-helpers hdf5-tools libhdf5-8 libhdf5-8-dbg libhdf5-cpp-8 libhdf5-cpp-8-dbg libhdf5-dev libhdf5-doc libhdf5-mpi-dev libhdf5-mpich-8 libhdf5-mpich-8-dbg libhdf5-mpich-dev libhdf5-mpich2-dev libhdf5-openmpi-8 libhdf5-openmpi-8-dbg libhdf5-openmpi-dev libhdf5-serial-dev libhdf5-8 libhdf5-8-dbg libhdf5-dev libpdl-io-hdf5-perl libatlas-base-dev libatlas-dev libatlas-doc libatlas-test libatlas3-base libatlas3gf-base python-protobuf python-snappy libgflags-dev leveldb-doc snappy lmdb-utils lmdb-doc lmdb-dbg liblmdb0 liblmdb-dev nvidia-cuda-toolkit curl ipython-notebook Cython python-dateutil python-gflags python-numpy-dbg python-numpy-doc python-numpydoc python3-numpy python3-numpy-dbg python-scipy-dbg python-scipy-doc python-sciscipy python3-scipy python3-scipy-dbg python-matplotlib python-matplotlib-data python-matplotlib-dbg python-matplotlib-doc python-matplotlib-venn python3-matplotlib python3-matplotlib-dbg python3-matplotlib-venn python-h5py python-h5py-doc python3-h5py golang-goleveldb-dev libleveldb-api-java libleveldb-cil-dev libleveldb-dbg libleveldb-java libleveldb1 libleveldb1.2-cil python-leveldb python3-leveldb python-networkx python-networkx-doc python3-networkx python-django-nose python-nose python-nose-doc python-nose-parameterized python-nose-testconfig python-nose-timer python-nose-yanc python-nose2 python-nose2-cov python-nose2-doc python-nosehtmloutput python-nosexcover python-openstack.nose-plugin python-rednose python3-django-nose python3-nose python3-nose-parameterized python3-nose-timer python3-nose2 python3-nose2-cov python3-nosexcover python3-openstack.nose-plugin python3-rednose python-pandas python-pandas-doc python-pandas-lib python3-pandas python3-pandas-lib python-pil.imagetk python-sane python-pyocr python3-pyocr python-pil python-syck python-pip python-yaml

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

cd /usr/lib/x86_64-linux-gnu
sudo ln -s libhdf5_serial.so.8.0.2 libhdf5.so
sudo cp libhdf5.so libhdf5.so.10 
sudo ln -s libhdf5_serial_hl.so.8.0.2 libhdf5_hl.so
sudo cp libhdf5_hl.so libhdf5_hl.so.10 

# PROTOBUF
cd ~/Downloads
sudo rm master.zip
tar -zxvf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1/
sudo ./configure
sudo make
sudo make check
sudo make install

# SCIKIT
sudo pip install -U scikit-image

# CAFFE
cd ~/Downloads
sudo rm master.zip
unzip master.zip
cp ~/Downloads/Makefile.config ~/Downloads/caffe-master
cd caffe-master/
sudo make all -j8
sudo make test
sudo make runtest
sudo make pycaffe
sudo make distribute

# DEEPDREAM
cd ~/Downloads
sudo rm master.zip
unzip master.zip
sudo rm master.zip

# FINAL UPDATES
sudo apt-get update
sudo apt-get upgrade



Makefile.config
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1

# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1

# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++

# CUDA directory contains bin/ and lib/ directories that we need.
# CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
CUDA_DIR := /usr

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_50,code=compute_50

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := atlas
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas

# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib

# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
# MATLAB_DIR := /usr/local
# MATLAB_DIR := /Applications/MATLAB_R2012b.app

# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
ANACONDA_HOME := $(HOME)/anaconda
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
$(ANACONDA_HOME)/include/python2.7 \
$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib
PYTHON_LIB := $(ANACONDA_HOME)/lib

# Homebrew installs numpy in a non standard path (keg only)
# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
# PYTHON_LIB += $(shell brew --prefix numpy)/lib

# Uncomment to support layers written in Python (will link against Python libs)
# WITH_PYTHON_LAYER := 1

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib

# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1

BUILD_DIR := build
DISTRIBUTE_DIR := distribute

# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1

# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0

# enable pretty build (comment to see full commands)
Q ?= @


README
1. Download and install Anaconda from https://store.continuum.io/cshop/anaconda/
2. Place Makefile.config and dp.sh in ~/Downloads type in "./dp.sh"
3. Run "export PYTHONPATH=/home/USERID/Downloads/caffe-master/python:$PYTHONPATH"
4. Run "sudo python /home/USERID/Downloads/caffe-master/scripts/download_model_binary.py /home/USERID/Downloads/caffe-master/models/bvlc_googlenet/"
5. Run "cd deepdream-master/"
6. Run "ipython notebook ./dream.ipynb"

7. Change the following:
"model_path = '../caffe/models/bvlc_googlenet/' # substitute your path here" TO model_path = '/home/USERID/Downloads/caffe-master/models/bvlc_googlenet/' # substitute your path here

T

unread,
Jul 13, 2015, 3:42:38 AM7/13/15
to caffe...@googlegroups.com
*** NOTE: USERID IN THE README IS YOUR DEBIAN USERID ***
Reply all
Reply to author
Forward
0 new messages