Thank you to Changjiang as most of the code here comes from this tutorial and I have only added a few lines in order to get caffe working.
Install Anaconda (for Python 2.7) Then clone the caffe repository somewhere:
git clone git@github.com:BVLC/caffe.git
You will want to install CUDA in order to be able to run models on the GPU: Follow the tutorial here: https://developer.nvidia.com/cuda-downloads
conda update conda
conda install -c menpo opencv3
conda install libgcc
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 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 libopencv-dev libhdf5-serial-dev
sudo apt-get -y install build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
cd path/caffe_repository
cp Makefile.config.example Makefile.config
Change the settings in Makefile.config (namely uncomment settings for anaconda).
mkdir build
cd build
cmake ..
make all
make install
make runtest
If there is no error, then run
conda install cython scikit-image ipython h5py nose pandas protobuf pyyaml jupyter
cd ../python
Add the module directory to your $PYTHONPATH by
export PYTHONPATH=`pwd`${PYTHONPATH:+:${PYTHONPATH}}
First verify the installation:
python -c "import caffe;print caffe.__version__"
If the Caffe version number is shown up correctly, then change directory to examples, execute command:
jupyter notebook
Choose one of the notebook examples to test the Caffe installation.