GithubHelp home page GithubHelp logo

mftnakrsu / deepdream Goto Github PK

View Code? Open in Web Editor NEW
24.0 3.0 1.0 11.51 MB

Generative deep learning: DeepDream

License: MIT License

Jupyter Notebook 97.67% Python 2.33%
deepdream inception convnets gans generative-models octaves gradient-ascent upscale deep-learning image-processing python

deepdream's Introduction

DeepDream

DeepDream is an artistic image-modification technique that uses the representations learnd by CNN. It was firstt released by Google in the summer of 2015, as an implementation written using the Caffe framework.

Table of Content

alt text

It quickly became an internet sensation thanks to the trippy pictures it could generate. DeepDream convnet was trained on ImageNet, where dog breeds and bird species are vastly overpresented.

The DeepDream algorithm is almost identical to the convnet filter-visualization technique, consisting of running a convnet in reverse: doing gradient ascent on the input to the convnet in order to maximize the activation of a spesific filter in an upper layer of the convnet.

DeepDream uses this same idea, with a few simple differences:

  • With DeepDream, you try to maximize the activation of entire layers rather than of a spesific filter, thus mixing together vis of large numbers of features at once.
  • You start not from blank, slighlty noisy input, but rather from an existing image-thus the resulting effects latch on to preexisting visual patters, distorting elements of the images in a somewhat artistic fashion.
  • The input images are processed at different scales (callede octaves), which improves the quality of the visualization.

In Keras, many such convnets are avaliable: VGG16, VGG19, Xception, ResNet50 and so on . In this application, I used inception_v3 convnets.

alt text

If you want to more about "Inception", you should check this out this paper.

The DeepDream process:

The method is to process images at a list of “scales” and run gradient ascent to maximize the loss at this scale. With each successive scale, upscale the image by 40%. In order to avoid the lose of image detail when upscaling image from small to large, also inserted the lost details back by using the larger original image.

alt text
Successive scales of spatial processing(octaves) and detail reinjection upon upscaling.

Quick Start Examples

Installation

$ git clone https://github.com/mftnakrsu/DeepDream.git  
$ cd DeepDream  
$ pip install -r requirements.txt  

Usage

$ python -m main.py --image /path/to/image
                 --step /numberofstep
                 --iterations /numberofiterations
                 --max_loss /maxlose/

If you want different variations, you can change the layers:

layer_settings = {
"mixed7": 1.5,
"mixed8":1.5,
"mixed5":1.0,
}

You can check the model layers with these commands:

print(model.summary())

Some Results:

References:

https://ai.googleblog.com/2015/06/inceptionism-going-deeper-into-neural.html  
https://arxiv.org/abs/1512.00567  
https://www.amazon.com/Deep-Learning-Python-Francois-Chollet/dp/1617294438

deepdream's People

Contributors

mftnakrsu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

melikeetoksoz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.