In this tutorial, I will detail the steps for installing Caffe on a non-GPU(CPU) machine with Ubuntu 14.04 OS. Once we are done with the installation, we’ll also test the GOOGLE INCEPTIONISM (
deepdream) code which uses Caffe. This is a follow up post to my last post – Generating images with Google’s “INCEPTIONISM” – deepdream where I had shared some awesome images generated using
deepdream code. So, let’s get our hands dirty straight away .
Firstly, let’s make a directory named
deep-learning in the
$HOME folder where we will download all the packages.
1. Installing the dependencies
To successfully compile Caffe we need to install a few packages first. Execute the below command in the terminal. (These commands will require root access)
NOTE -> Since we will not be using GPUs, we do not require CUDA installation.
2. Compile and Install Caffe
The Caffe repository is hosted on GitHub. To clone the repository enter the below command in the terminal.
Makefile.config.example contains the template for configuration file. We’ll use it to write the
Makefile.config configuration file.
Makefile.config file we need to set options if we want to use a CPU or a GPU. Open your favorite editor and uncomment the line
CPU_ONLY := 1(most probably, line number 8) as shown below.
1 CPU_ONLY := 1
After setting the configuration, the next step is to make Caffe or brew Caffe .
If you get an OpenCV
undefined reference error in
make all as shown below follow the instructions below else move to the section 3.
(Check this issue) for more details. In order to fix the errror, append
opencv_imgcodecs on line 176(most probably) as shown below.
1 2 3 LIBRARIES += glog gflags protobuf leveldb snappy \ mdb boost_system hdf5_hl hdf5 m \ opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs
Now clear of the contents of
build. This is important else the error will persist.
Now rerun the previous commands.
3. Adding PYTHON support
To add PYTHON support, run the below commands in the terminal. We need Python support to run the
4. Running the INCEPTIONISM code
Read the INCEPTIONISM post by Google Research here
To run the INCEPTIONISM code follow the below instructions.
4.1. Download the GoogLeNet model and clone the deepdream GitHub repository.
4.2. Install the dependencies
4.3. Run the IPython Notebook
Now the IPython notebook dashboard will open up in your default browser as shown below.
In the list of files, click on
dream.ipynb and you will get an output as shown in the figure below.
So, this is it ! Use this IPython Notebook to play with the
deepdream code to generate some awesome images. I hope you liked the post and THANK YOU for reading.