Code Monkey home page Code Monkey logo

vae's Introduction

Variational Autoencoder

This is an implementation of a simple variational autoencoder which trains on the MNIST dataset and generates similar images of digits.

Requirements:

  1. CUDA toolkit 7.5
  2. cuDNN v5
  3. TensorFlow (https://github.com/tensorflow/tensorflow/tree/r0.10) from r0.10 branch, select binary compatible with the above.

Instructions to run:

Run python trainScriptClass.py. It will train a simple 2 layer VAE generator with 2 layer encoder for training. The parameters are defined below:

  1. batch_size: size of the training and testing batch (for batch size of 20, it nearly reached 11 GB on NVIDIA-Titan X Maxwell)
  2. X_size: size of the input (here it is the total number of pixels)
  3. hidden_enc_1_size: hidden layer 1 size in the encoder
  4. hidden_enc_2_size: hidden layer 2 size in the encoder
  5. hidden_gen_1_size: hidden layer 1 size in the generator
  6. hidden_gen_2_size: hidden layer 2 size in the generator
  7. z_size: size of the latent variable

The model trains with a default learning rate of 1e-4 using the adam optimizer.

The model is trained for 200000 iterations and 20 randomly generated samples and the checkpoint of the corresponding model are saved in `generated_class/' directory after every 50000 iterations.

References:

  1. This was implemented based on the Carl Doersch's tutorial available at: https://arxiv.org/abs/1606.05908
  2. Another useful reference for implementing VAEs is: https://jmetzen.github.io/2015-11-27/vae.html

Changelog:

Feb 10, 2017

  • Added convolution + deconvolution based VAE
  • Batch size is again fixed at initialization, have to alter the technique.

======================================

  • Added support for a Beta weighting term in the KL Divergence loss
  • Batch size is no longer fixed at initialization
  • Added functions to encode a given x and decode a given z, and also to perform both these operations to generate an image "like" the given one.
  • beta_trainScriptClass_conditional.py adds visualization of latent features

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.