Thursday, July 9, 2015

Fiddling Around With Google's Deep Dream... Day 1

I stumbled upon an interesting post about mining Google Images through a neural network that alters any input image.

http://googleresearch.blogspot.com/2015/07/deepdream-code-example-for-visualizing.html

Wikipedia has this to say about Neural Networks:
In machine learning and cognitive scienceartificial neural networks (ANNs) are a family of statistical learning models inspired by biological neural networks (the central nervous systems of animals, in particular the brain) and are used to estimate or approximate functions that can depend on a large number of inputs and are generally unknown. Artificial neural networks are generally presented as systems of interconnected "neurons" which send messages to each other. The connections have numeric weights that can be tuned based on experience, making neural nets adaptive to inputs and capable of learning. Source: https://en.wikipedia.org/wiki/Artificial_neural_network


In short any given input image can be subject to various layers, zoom levels, and how many iterations this process will take data mining the web. Google research showed these two images, the top image was the input, and the bottom image was the eventual output:



Day 1 

I fired up terminal to see which version of Python I had:
$ python --version
Python 2.7.6

Next I updated MacPorts which I had installed previously. 

$ sudo ports upgrade

I then installed the necessary dependencies (libraries or bits of code that are needed to make the Google Deep Dream code work within the Python programming language).  For this I used MacPorts again. 

Going back to Terminal (using OS X Mavericks by the way...)

Dependencies: py-numpy, py-scipy, py-pil, py-ipython
Of course you can do this in one big happy command line, but I chose to do each one separately.

$ sudo port install py-numpy
password
--->  Computing dependencies for py-numpy...

This took a while, as I guess there are numerous libraries within py-numpy.

// This I thought was taking way too long so I researched Anaconda, which installs, "over 195 of the most popular Python packages for science, math, engineering, data analysis." 

I then reconsidered that I only needed four packages so back to MacPorts and port install py-numpy!

Stuck on building (more like compiling) llvm-3.5

I'll just let it run... if it is still hung in an hour or so I guess I will use Anaconda. 

Wow finally... 
--->  Cleaning py-numpy
--->  Updating database of binaries
--->  Scanning binaries for linking errors               
--->  No broken files found.

It only took about an hour or so!