Source: Deep Learning on Medium
Have you heard of Generative Adversarial Networks, the hottest development in machine learning right now?
GANs are made up of two competing neural networks: a generator that tries to create an image, and a discriminator that tries to detect which images are real and which images are fakes created by the generator.
Both networks compete with each other during training, until eventually the generator becomes smart enough to create spectacular images that fool the discriminator every time.
You can use GANs to create virtually any kind of image…
Like for example these stunning pictures of people:
All these pictures were generated by a machine learning app hosted at NVIDIA, the company famous for its high-performance graphics cards.
But none of these people actually exist!
The GAN is simply conjuring up new images, based on what it has learned about human faces. And after millions of training iterations, the generator has become so good at drawing faces that it manages to fool the discriminator every time!
NVIDIA has now opened up their GAN to the public. Just click the link below, and you’ll be rewarded with a new face every time:
See if you can find mistakes in the generated faces. Can you do a better job than the discriminator?
So if you’re super excited right now and want to experiment with GANs in C# yourself, I totally understand.
And guess what? It’s actually very easy.
I wrote a small C# app that runs a GAN to generate pictures of frogs. Here’s what that looks like, this is the code that sets up the convolutional- and deconvolutional parts of the GAN:
And after tens of thousands of training iterations, my result looks like this:
These images are tiny, but that’s because I’m running my GAN on a simple laptop with an underpowered GPU. You can do a lot more with powerful hardware.
This C# code can generate any kind of image. The quality and size only depends on how long the GAN is trained.
Is that cool or what?
So what kind of images would you generate with a GAN?
Write a comment and let me know!