In this post, we will learn to develop a generative adversarial network (GAN) for generating realistic manga or anime characters.

I’ve always been amazed by vivid animations, especially Manga and their bold looks and strokes. Wouldn’t it be awesome to be able to draw a few ourselves, to experience the thrill of creating them with the help of a self-developed neural network?!

So what makes a GAN different?

The best way to master a skill is to practice and improvise it until you’re satisfied with yourself and your efforts. For a machine or a neural network, the best output it can generate is the one that matches human-generated outputs—or even fool a human to believe that a human actually produced the output. That’s exactly what a GAN does—well, at least figuratively ;)

Generative adversarial networks have lately been a hot topic in deep learning. Introduced by Ian Goodfellow et al., they have the ability to generate outputs from scratch.

Quick Overview of Generative Adversarial Networks

In generative adversarial networks, two networks train and compete against each other, resulting in mutual improvisation. The generator misleads the discriminator by creating compelling fake inputs and tries to fool the discriminator into thinking of these as real inputs . The discriminator tells if an input is real or fake.

GAN Architecture

There are 3 major steps in the training of a GAN:

Using the generator to create fake inputs based on random noise or in our case, random normal noise. Training the discriminator with both real and fake inputs (either simultaneously by concatenating real and fake inputs, or one after the other, the latter being preferred). Train the whole model: the model is built with the discriminator combined with the generator.

An important point to note is that the discriminator’s weights are frozen during the last step.

The reason for combining both networks is that there is no feedback on the generator’s outputs. The ONLY guide is if the discriminator accepts the generator’s output.

the minimax objective function

You can say that they are rivals destined for each other. The main character is the generator who strives to be better and better to make our purpose realized by learning from the fight with its rival, the discriminator.

That was a brief overview of GAN’s architecture. If that doesn’t suffice, you can refer to this elaborate introduction.