Vanilla-GAN

PyTorch implementation of Generative Adversarial Networks by Ian Goodfellow et al. on the MNIST dataset.

progress

GAN Loss and training

The training of the generator and discriminator networks is based on the following MiniMax game played between the two.

minimax

The training algorithm is described in the paper as below.

minimax

Binary Cross Entropy loss was used to train both generator and discriminator. Generator was trained my maximising discriminators probability of being real on fake data instead of other way round, because as mentioned in the paper, it provides stronger gradients early.

loss_curve

Model

The generator model file is available. Load it like this

import torch

...

model = Generator()
state = torch.load('mnist_generator.pth')
model.load_state_dict(state)
model.eval()

...

References

  1. Ian Goodfellow, et al. Generative Adversarial Networks. NIPS 2014 [arxiv]
  2. Yann LeCun, et al. MNIST Database of Handwritten Digits [webpage]