Code Monkey home page Code Monkey logo

audio_visualization_gan's Introduction

GANs Implementations in Keras

Keras implementation of:

The DCGAN code was inspired by Jeremy Howard's course

Requirements:

You will need Keras 1.2.2 with a Tensorflow backend.
To install dependencies, run pip install -r requirements.txt
For command line parameters explanations:

python3 main.py -h

DCGAN

Deep Convolutional GANs was one of the first modifications made to the original GAN architecture to avoid mode collapsing. Theses improvements include:

  • Replacing pooling with strided convolutions
  • Using Batch-Normalization in both G and D
  • Starting G with a single Fully-Connected layer, end D with a flattening layer. The rest should be Fully-Convolutional
  • Using LeakyReLU activations in D, ReLU in G, with the exception of the last layer of G which should be tanh


python3 main.py --type DCGAN --no-train --model weights/DCGAN.h5 # Running pretrained model
python3 main.py --type DCGAN # Retraining

WGAN

Following up on the DCGAN architecture, the Wasserstein GAN aims at leveraging another distance metric between distribution to train G and D. More specifically, WGANs use the EM distance, which has the nice property of being continuous and differentiable for feed-forward networks. In practice, computing the EM distance is intractable, but we can approximate it by clipping the discriminator weights. The insures that D learns a K-Lipschitz function to compute the EM distance. Additionally, we:

  • Remove the sigmoid activation from D, leaving no constraint to its output range
  • Use RMSprop optimizer over Adam
python3 main.py --type WGAN --no-train --model weights/WGAN.h5 # Running pretrained model
python3 main.py --type WGAN # Retraining

cGAN

Conditional GANs are a variant to classic GANs, that allow one to condition both G and D on an auxiliary input y. We do so simply feeding y through an additional input layer to both G and D. In practice we have it go through an initial FC layer. This allows us to have two variables when generating new images:

  • The random noise vector z
  • The conditional label y
python3 main.py --type CGAN --no-train --model weights/CGAN.h5 # Running pretrained model
python3 main.py --type CGAN # Retraining

InfoGAN

The motivation behind the InfoGAN architecture is to learn a smaller dimensional, "disentangled" representation of the images to be generated. To do so, we introduce a latent code c, that is concatenated with the noise vector z. When training, we then want to maximize the mutual information between the latent code c and the generated image G(z,c). In practice, we:

  • Feed c in G through an additional input layer
  • Create an auxiliary head Q that shares some of its weights with D, and train it to maximize the mutual information I(c, G(z,c))
python3 main.py --type InfoGAN --no-train --model weights/InfoGAN_D.h5 # Running pretrained model
python3 main.py --type InfoGAN # Retraining

audio_visualization_gan's People

Contributors

danieltea avatar

Watchers

 avatar  avatar  avatar  avatar

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.