D‘ARC, J. - A variety of organic and fair trade garments

How does a GAN work?

GANs consist of two neural networks: a discriminator and a generator.

The DISCRIMINATOR is a classifier. Its job is to look at an image and decide if said image is real or fake. The images can either come from the original dataset (pictures of cats, pizza, people…), or are creations of the generator. The discriminator outputs a number between 0, if it thinks the image is fake, and 1, if it thinks the image is real.

The GENERATOR creates new images. It is initially fed with random noise from which it generates a new image. The random noise allows it to create multiple valid outputs.

The GAN has an architecture that makes these two networks compete against each other in a min-max game. In short, they are fighting over one number: the output – or error rate – of the discriminator. One network wants the error rate to be as high as possible (the generator), the other one wants it to be as low as possible (the discriminator). If the generator produces an image, which the discriminator can easily classify as fake, it is trained to not repeat its mistake again. On the other hand, if it produces an image which the discriminator can not easily classify, it learns to do it again. The quality of the output results from the way the networks are trained.