Generative Adversarial Network - an example in Keras (Python)

Author: Goran Trlin

A simple Generative Adversarial Network (GAN) example written using Keras library in Python.

The objective of this small program is to generate new hand-drawn circles based on a small input dataset.

Key notes:

  • The GAN is based on the CNN network from the previous article and enhanced with a generator network
  • Binary cross-entropy is used as the loss function for both the discriminator and the generator network
  • Adam algorithm is used as the optimizer
  • The training dataset is very small, but the network is still able to create new images similar to the ones found in the input dataset.

Full source code can be found on GitHub.