The DeepDream

The neuron activations can be amplified at some layer in the network rather than synthesizing the image. This concept of amplifying the original image to see the effect of features is called DeepDream. The steps for creating the DeepDream are:

  1. Take an image and pick a layer from CNN.
  2. Take the activations at a particular layer.
  3. Modify the gradient such that the gradient and activations are equal.
  4. Compute the gradients of the image and backpropagate.
  5. The image has to be jittered and normalized using regularization.
  6. The pixel values should be clipped.
  7. Multi-scale processing of the image is done for the effect of fractal.

Let's start by importing the relevant packages:

import osimport numpy as npimport PIL.Imageimport urllib.request ...

Get Python: Advanced Guide to Artificial Intelligence now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.