Coder Social home page Coder Social logo

gan-mnist's Introduction

Hand written number generation using GAN

This is a PyTorch implementation of DCGAN and SimpleGAN that can generate handwritten digits similar to that of a human's.

Feel free to play around! dcgan output

Getting started

You can install the required dependency with

pip install -r requirements.txt

And you can just run below to train

python main.py

I've tested on Python 3.7 on Ubuntu, but should work on both Windows and MacOS with most recent versions of Python & Pytorch.

Note, training GANs can take a very long time especially if you're running it on CPU, although it is supported.

With GTX 1660Ti, it took me about 20 minutes of training for simpleGAN with 200 epochs & 128 batch size.

The final model weights are saved in "model_weights" folder after training. I've already included my model weights for both DCGAN and SimpleGAN if you just want to use the model for generating the digits.

Results

Generated images are saved under 'images' folder. Generally, DCGAN outperforms a simple GAN using linear layers, but that can be further improved with more training and fine-tuning of the parameters.

As you train, it would save the generated image from the generator progressively, so you can compare how it has improved over the epochs.

Human digits

original

SimpleGAN output

generated output

DCGAN output

dcgan output

Could still use some work, but not too bad! :)

Todo

  • Add image generation mode separate from training

Author

  • Richie Youm

Credit

This project was inspired by deeplearning.ai specialization for GANs. I have referenced their model parameters and visualization techniques for convenience.

gan-mnist's People

Contributors

richieyoum avatar

Watchers

 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.