Pytorch implementation of DeepDream on VGG16 Network
The code consists of mainly two functions:
-
deep_dream_vgg : This is a recursive function. It is used to create octaves, and to merge (or blend) the image generated by a recursive call with the image at one (recursive) level higher.
-
dd_helper : This is the actual code for deep dream. The gradients at a particular layer are set equal to the activation of that layer. This results in the maximization of the activations at that particular layer. In other words, we are enhancing the features detected by a layer. Gradient ascent is applied to the input images (i.e. octaves).
- pytorch
- torchvision
- PIL
- numpy
- matplotlib
Note : In case you don't have a GPU, remove all instances of .cuda()
from the code.
- Clone this repository
- Change into this directory
cd deep-dream-pytorch
- Run a
jupyter notebook