Generative adversarial networks (GANs) are another form of deep neural network architecture, and is a combination of two networks that compete and cooperate with each other. It was introduced by Ian Goodfellow and Yoshua Bengio in 2014.
GANs can learn to mimic any distribution of data, which ideally means that GANs can be taught to create an object that's similar to an existing one in any domain, such as images, music, speech, and prose. It can create photos of any object that has never existed before. They are robot artists in a sense, and their output is impressive.
It falls under unsupervised learning wherein both of the networks learn their task upon training. One of the networks is called the generator and the other is called the discriminator.
To make this more understandable, we can think of a GAN as a case of a counterfeiter (generator) and a cop (discriminator). At the outset, the counterfeiter shows the cop fake money. The cop works like a detective and finds out that it is a fake money (you can think of D as a detective too if you want to understand how a discriminator works). The cop passes his feedback to the counterfeiter, explaining why the money is fake. The counterfeiter makes a few adjustments and makes new, fake money based on the feedback it received. The cop says that the money is still fake and he shares his new feedback with the counterfeiter. The counterfeiter then attempts to make new, fake money based on the latest feedback. The cycle continues indefinitely until the cop is fooled by the fake money because it looks real. When a GAN model is being created, the generator and discriminator start to learn from scratch and from each other. It may seem that they are pitted against each other, but they are helping each other learn. The feedback mechanism between these two is helping the model to be more robust.
A discriminator is quite a good learner, since it is capable of learning anything from the real world. That is, if you want it to learn about images of cats and dogs, and its 1,000 different categories where it's asked to differentiate between the images, it will be able to do so without any hassle, like so:
Noise goes into the generator; then, the output of the generator goes through the discriminator and we get an output. Simultaneously, the discriminator is being trained on the images of dogs. However, in the very beginning, even the dog images can be classified by the discriminator as being non-dog images, and it picks up on this error. This error gets back propagated through the network.