Ambiguous Digits 2: Generative Adversarial Network

I’m still interested in making ambiguous-looking numbers. Last time, I trained a neural network to identify pictures of handwritten numbers, and then used that to create images that look like one digit when right-side-up, and a different one when upside-down. This time, I’ll use a Generative Adversarial Network (GAN).

A GAN is a pair of neural networks that play off of each other. The Generator makes images that attempt that attempt to look like the input data (the MNIST dataset of handwritten numbers). The Generator’s output is then mixed with some of the MNIST numbers, and the Adversary tries to decide which are real and which are synthesized by the Generator. Through their training, the Generator gets better at making images that look like handwritten digits.

Great! I have to make one key change, though. Since I’m generating digits that look sort of right both upside-down and right-side-up, I will train the GAN on both right-side-up and up-side-down numbers.

I hang on to the classifier that I used before, and use it with the generator. Here’s its attempt at 0-9:Those look reasonably hand-written! Now, how about the pairs of ambiguous digits? The following images show the same generated digits, but the second is rotated by 180° (because the generator is not rotationally symmetric):

In each picture, thesse seem like they could be the result of someone being really terrible at writing, and generally look like the correct number as you scan across each row, despite the rotation. I’d say this is a qualified success!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.