Caffe Windows Installation
Deep Dream is an algorithm that makes an pattern detection algorithm over-interpret patterns. The Deep Dream algorithm is a modified neural network. Instead of identifying objects in an input image, it changes the image into the direction of its training data set, which produces impressive surrealistic, dream-like images.(read the original Google blog https://research.googleblog.com/2015/06/inceptionism-going-deeper-into-neural.html)
31 rows Aug 08, 2017 Caffe is a deep learning framework made with expression, speed,. Jump to Installing DIGITS - python -m pip install -r requirements.txt. You may see an error about. If this is the case, download Pillow Windows Installer.
The result are beautiful hallucinations like the one below. The neural network amplified the perceived objects that it is being trained to recognized. I wondered if this is the same effects on our visual cortex subdued by some drugs?
Figure. Vangogh’s “Starry Night” Deep Dream transformation
This article is a continuation of my previous blog on Deep Learning with GPU on Windows 10. You may want to read how to setup NVidia CUDA 8.0 to utilize your GPU for speeding up Deep Dream calcuations.
Caffe
Caffe is perhaps the first mainstream industry-grade deep learning toolkit, started in late 2013, due to its excellent convolutional neural network implementation (at the time). It is still the most popular toolkit within the computer vision community, with many extensions being actively added. Especially, there are many popular pre-trained neural network (aka. Caffe Model Zoo) can be easily downloaded and used.
The Deep Dream script is using Google’s award winning entry of ILSVRC 2014 GoogLeNet, a 22 layers deep network trained to regconize images. (explained in http://joelouismarino.github.io/blog_posts/blog_googlenet_keras.html)GoogLeNet achieved the classification of the ImageNet dataset (all sorts of animals, household objects, vehicles, etc.), 93.33% of the time the correct object class will be contained in the GoogLeNet ensemble’s top five predictions.
Figure. Showing the GoogLeNet CNN 22 layers deep network
The Caffe’s pre-trained model that we downloaded and used is the iteration 2,400,000 snapshot (60 epochs) using quick_solver.prototxt.
name | caffemodel | caffemodel_url |
---|---|---|
BVLC GoogleNet Model | bvlc_googlenet.caffemodel | http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel |
Further Caffe info can be found:
- BVLC Reference Models and the Community Model Zoo
Prepare Python Virtual Environment
Note: this article assumes you are using bash
shell on Windows.The recommended bash
shell comes from Git for Windows https://git-for-windows.github.io installation. Business penmanship practice sheet.
You can install either Anaconda Python 2.7 or Anaconda Python 3.5 on Windows 10. Later, we would create a virtual environment to isolate our Deep Dream tools installation. We shall refer to your Anaconda installation location as {path_to_anaconda_location}
later.
Define Anaconda Virtual Environment
By experience, hacking on a new tools suite are usually messy and full of conflicts. Using an isolated Python virtual environment will protect you from headaches and disaster of installations.In bash
shell, enter the following where caffe
(or your choice of name) is the name of the virtual environment, and python=2.7
is the Python version you wish to use.
Press y to proceed. This will install the Python version and all the associated anaconda
packaged libraries at {path_to_anaconda_location}/envs/caffe
Install Support Packages on Virtual Environment
Once the caffe
virtual environment has been installed, activate
the virtualenv by
Continue to install all the shell script commands,
Then install Caffe’s dependencies
also you will need a Google’s protobuf python package that is compatible with pre-built dependencies. This package can be installed this way:
Install Caffe on Windows 10
The lazy way to install Caffe on Windows 10 is downloading the prebuilt binaries from Caffe’s Windows branch on Github:https://github.com/BVLC/caffe/tree/windows
For my Windows 10 setup, I can choose either of these,
- Visual Studio 2015, CUDA 8.0, Python 3.5: Caffe Release (64 bits)
- Visual Studio 2015, CUDA 8.0, Python 2.7: Caffe Release (64 bits)
Since we have created the Anaconda Python 2.7 virtual environment to host our experiment, we choose to install Visual Studio 2015, CUDA 8.0, Python 2.7: Caffe Release
package.
After completing the install, ensure to add the following into your Windows’s environment variable, {path_to_caffe}
refers to Caffe’s installation.
Deep Dream Python Script
Install Deep Dream Script
You can clone the Deep Dream script from GitHub repositoryhttps://github.com/bennycheung/PyDeepDream
Email templates sound like a relatively new concept but they are already in such huge demand that most small and big enterprises now make use of free html email templates. A good and suitable email template plays a vital role as a marketing tool. Free html email form download pdf. Download page. Free HTML / CSS Contact Forms / Live demo. This contact form is available in a light theme, a dark theme, a blue, green and red color. Download page. This form lets you send fully supported HTML based email with multiple attachments. Get this script, customize settings and upload at your server or integrate it in your current. All the source codes of this contact page are entirely free, and you can download it. This contact form has three input fields. They are email, subject, and message. This contact form also includes antispam question feature to avoid spam messages. It also consists of another area to input answer of the user. In this list, we have collected modern free HTML contact forms for modern websites. For developers, we have managed to collect the forms that reduce code editing work. All you have to do is to select the form you like and start integrating it with your template or with the platform you like. This article focuses on a selection of free HTML contact form templates you can use to create your contat page. Contact forms are crucial for any website. Without a contact form you are forced to directly display your email address and this leaves in vulnerable to email collecting bots.
([2017/08/02] make correction to the git repository path to PyDeepDream.git
)
Then install of the Deep Dream script’s dependencies from requirements.txt
list
See the commandline options,
Install the GoogLeNet Caffe pre-trained model
download from http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel (~54 MB)and save the model here at bvlc_googlenet/bvlc_googlenet.caffemodel
. The deepdream.py
assumes it can find the model there.
How to Use
Don’t forget to activate your prepared caffe
virtual environment.
Use -i
to specify your input content image. It will deep dream at a random layer.
If you want to start Deep Dream at a layer depth, type and octave manually:
Running All Layers Experiment
We are using -d
to define which layer that we shall perform the Deep Dream. The level number will be mapped to a GoogLeNet layer name.
The output dream images are stored with the original photo and tagged with a inception layer name. For example, Style_StarryNight.jpg
with -d 1
will produce the Deep Dream result Style_StrarryNight_inception_3a_1x1_dream.jpg
.
Here are the images of the Deep Dreaming,
Figure. Deep Dream results from the inception into different levels of the neural network. Lower levels amplify the NN patterns. Higher levels amplify the NN objects
Deep Dream on the Raspberry Pi 3
Deep Dream can actually be run on the Raspberry Pi 3 and Raspbian Jessie; find out how from this excellent tutorial:
Notes:Running on Raspberry Pi 3 is not fast (as expected due to a weaker CPU and no GPU acceleration). Each snapshot will take 5 to 20 minutes. Also due to the memory limitation, it can not Deep Dream beyond layer level 6 (i.e. inception_4d_1x1 is the limit).