Coder Social home page Coder Social logo

mohith-sakthivel / infogan-pytorch Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 513 KB

Implementation of InfoGAN using PyTorch lightning

License: MIT License

Python 87.48% Jupyter Notebook 12.52%
gans infogan pytorch pytorch-lightning spectral-normalization

infogan-pytorch's Introduction

Infogan

This project is an implementation of the paper infoGAN using Pytorch Lightning.

Setup

git clone https://github.com/mohith-sakthivel/infogan-pytorch.git infogan_pl
cd infogan_pl

conda env create -f environment.yml
conda activate infogan_pl

Run

To train the model on MNIST dataset , use

python -m infogan.infogan_module --dataset mnist --max_epochs 50

Arguments:

dataset     - Dataset to train on. Configured datasets are MNIST (use 'mnist') and CelebA (use 'celeba').
batch_size  - Batch size to use for training
datadir     - Directory to log data
gpus        - Number of GPUs to use
num_workers - Number of workers for loading data
max_epochs  - Maximum number of training epochs

Note:

  • CelebA dataset has to be downloaded and placed in the desired directory manually. This is due to a bug in the torchvision package.

Learnt Latent factors

InfoGAN can learn meaningul disentangled features in an unsupervised fashion. The following figures illustrate the high level image features captured by the latent factors when trained on the MNIST and celebA datasets.

For the MNIST dataset, the code is sampled from a uniform categorical distribution with 10 classes and a gaussian distrbution with 2 independent random variables. For the celebA dataset, the code comprises of 10 categorical distriubtions with 10 classes each.

Categorical Latents

  • The follwing figures show the variation in the generated images with each class of the categorical distribution.
  • For the MNIST dataset, the categorical latents captures the 10 digit classes


  • For the celebA dataset, the latents capture features like gender, hair length, hair colour, etc.




Gaussian Latents

  • The follwing figures show the variation in the generated images when a single gaussian variable is gradually changed from -4 to +4.

  • One of the gaussian latent code captures the orientation (or) slant of the digit

  • The other gaussian latent code learns to capture the thickness of the text

References

  1. X Chen, Y Duan, R Houthooft, J Schulman, I Sutskever, P Abbeel - InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets, NeurIPS 2016. (paper)
  2. T Miyato, T Kataoka, M Koyama, Y Yoshida - Spectral Normalization for Generative Adverserial Networks, ICLR 2018. (paper)
  3. A Radford, L Metz, S Chintala - Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks, ICLR 2016. (paper)

infogan-pytorch's People

Contributors

mohith-sakthivel avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

astorfi

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.