Welcome to GAN Playground
GAN Playground lets you play around with Generative Adversarial Networks right in your browser. Currently, it contains three built-in datasets: MNIST, Fashion MNIST, and CIFAR-10.
GAN Playground provides you the ability to set your models' hyperparameters and build up your discriminator and generator layer-by-layer. You can observe the network learn in real time as the generator produces more and more realistic images, or more likely, gets stuck in failure modes such as mode collapse.
What are Generative Adversarial Networks?
From Wikipedia, "Generative Adversarial Networks, or GANs, are a class of artifical intelligence algorithms used in unsupervised machine learning, implemented by a system of two neural networks contesting with each other in a zero-sum game framework. They were introduced by Ian Goodfellow et al. in 2014."
In my own words, GANs are composed of two neural networks, each one trying to outcompete the other. The discriminator tries to figure out whether a given image is real or synthetically generated by the other neural network. The generator attempts to output images that are indistinguishable from real ones in an attempt to fool the discriminator. The hope is that the generator learns enough to create realistic images that can fool humans. If you want more information, there are tons of great resources on the internet that give a good introduction to GANs. Here's the original paper on GANs.
.Why did you make this?
My hope is that this project gives beginners a bit of exposure in training GANs with as little setup as possible. The easiest way to do this is through the browser, and with deeplearn.JS, it's now finally possible. In fact, when I started this project, I didn't have any experience with GANs, and my target audience was myself!
How long should I wait / what's the best set of parameters to see realistic images?
To be honest, I'm not sure. GANs are notoriously hard to train, and even I haven't found the right set of parameters and layers for this demo that'd produce very realistic images consistently. The default parameters are still prone to randomly failing... Either way, if you do find a good set of parameters and layers, please file an issue or submit a pull request, and I'll add it to this demo. I challenge you to get good generated images on CIFAR-10.
On a related note, those with some background in neural networks will note that there are a lot of missing operations that are crucial for more stable GANs e.g. batch normalization, transpose convolutions. So far, deeplearn.JS does not have these operations built in to their Training API, but I'll add them as soon as possible.
This looks like the deeplearn.JS Model Builder demo
Yup, this is pretty much deeplearn.JS's Model Builder demo repurposed for training GANs! I just ripped out the parts I didn't need and replaced it with the parts I do need.
Is the code open source?
Yup! Visit https://github.com/reiinakano/gan-playground to examine the code. Also, feel free to submit any issues or pull requests to the repository as well.
Credits
This demo was put together by Reiichiro Nakano and was repurposed from deeplearn.JS's Model Builder demo. Shout out to the awesome deeplearn.JS library and of course to Ian Goodfellow et al.