Skip to main content

Fashion MNIST GAN

A simple GAN model applied to a fashion MNIST and a look at latent space traversal
Created on May 8|Last edited on June 25

Introduction

In this report I explore Weights & Biases by creating a DCGAN to generate fashion items using the Fashion MNIST dataset. Briefly, the Fashion MNIST dataset is an improvement over the original MNIST dataset, where instead of having hand written numbers the images are small images of fashion items like coats, shoes, dresses and more .

Original MNIST Dataset:

image.png

Fashion MNIST Dataset:

image.png

The original MNIST dataset is a well known baseline, but is widely considered to be too easy, with CNNs obtaining classification accuracies of about 99.7%, is overused and is considered to be unable to represent modern CV tasks.

DCGAN uses CNNs with the GAN framework to generate images that closely resemble the underlying dataset. I've created a small DCGAN using Pytorch. In this report I will

  • Show the results of a randomized search sweep, where we aim to minimize the generator Loss.
  • Use the W&B report to show the development of of generated images through training.
  • Use the W&B report to show what happens when we traverse the latent space for the generator.



Sweep: q2vyv976
14


Generated Images from All Runs

Here I'd like to show what generated images from each run look like. We can get a feel for how the GANs evolve over time and what a total failure looks like.

In the grid below we see the development of the same example through training. At the beginning (left) the generator outputs noise, but as training continues the image quality generally improves. Not all runs are created equal and we can see some runs lead to better creation, and also some runs go through a phase of improvement, followed by failure, followed by improvement again.

The first run in the grid below shows a total failure. Looking above, we can see that this run had an extremely low discriminator loss. This happens when the generator isn't making good enough images, and the discriminator just keeps ahead. In this case the generator can't learn how to make realistic images.




Run set
15


Successful Run Exploration: solar-sweep-7

Here we explore a good run. We explore the latent space throughout training, and show the development of a random set of samples throughout training.

First, let's look at the parallel coordinate plots. We see that the final discriminator and generator loss are both relatively low. This run uses the highest value for β1\beta_1 and β2\beta_2, which are the same values given in the DCGAN paper. If the value tracked was something less noisey and more related to image quality, I may be able to make better conclusions from these plots.




Run set
1


Unsuccesful Run Exploration: vague-sweep-14

Here we explore an unsuccessful run. We see that the discriminator "won" which lead to the generator being unable to catch up. This relatively high generator loss and relatively low discriminator loss is a common failure mode of GANs.

I was hoping to have an example of mode collapse in the sweep, but didn't have one. So I'll show a video of this common problem below:

Mode Collapse




Run set
1


Conclusion

Fashion MNIST is an interesting problem to explore, and a great first step for someone new to GANs. It seems relatively forgiving, showing only a handful of runs that failed, so is robust to hypersparameters, and has a lot of great tutorials out there for first timers. Weights & Biases gives users a simple method of showing what the generator is outputting, presenting latent space traversal and to run hyperparameter sweeps.