16.03.2021 Views

Advanced Deep Learning with Keras

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Generative Adversarial Networks (GANs)

A great example of the advanced features of GANs [4] can be seen with this

YouTube video (https://youtu.be/G06dEcZ-QTg). The video, which shows how

GANs can be utilized to produce realistic faces just shows how powerful they can

be. This topic is much more advanced than anything we've looked at before in this

book. For example, the above video is something that can't be accomplished easily

by autoencoders, which we covered in Chapter 3, Autoencoders.

GANs are able to learn how to model the input distribution by training two

competing (and cooperating) networks referred to as generator and discriminator

(sometimes known as critic). The role of the generator is to keep on figuring out

how to generate fake data or signals (this includes, audio and images) that can

fool the discriminator. Meanwhile, the discriminator is trained to distinguish

between fake and real signals. As the training progresses, the discriminator will

no longer be able to see the difference between the synthetically generated data

and the real ones. From there, the discriminator can be discarded, and the generator

can now be used to create new realistic signals that have never been observed before.

The underlying concept of GANs is straightforward. However, one thing

we'll find is that the most challenging aspect is how do we achieve stable training

of the generator-discriminator network? There must be a healthy competition

between the generator and discriminator in order for both networks to be able

to learn simultaneously. Since the loss function is computed from the output

of the discriminator, its parameters update is fast. When the discriminator

converges faster, the generator no longer receives sufficient gradient updates for

its parameters and fails to converge. Other than being hard to train, GANs can also

suffer from either a partial or total modal collapse, a situation wherein the generator

is producing almost similar outputs for different latent encodings.

Principles of GANs

As shown in Figure 4.1.1 a GAN is analogous to a counterfeiter (generator) - police

(discriminator) scenario. At the academy, the police are taught how to determine if

a dollar bill is either genuine or fake. Samples of real dollar bills from the bank and

fake money from the counterfeiter are used to train the police. However, from time

to time, the counterfeiter will attempt to pretend that he printed real dollar bills.

Initially, the police will not be fooled and will tell the counterfeiter why the money

is fake. Taking into consideration this feedback, the counterfeiter hones his skills

again and attempts to produce new fake dollar bills. As expected the police will

be able to both spot the money as fake and justify why the dollar bills are fake.

[ 100 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!