pdfcoffee

soumyasankar99
from soumyasankar99 More from this publisher
09.05.2023 Views

GenerativeAdversarial NetworksIn this chapter we will discuss Generative Adversarial Networks (GANs) andits variants. GANs have been defined as the most interesting idea in the last 10 yearsin ML (https://www.quora.com/What-are-some-recent-and-potentiallyupcoming-breakthroughs-in-deep-learning)by Yann LeCun, one of the fathersof deep learning. GANs are able to learn how to reproduce synthetic data that looksreal. For instance, computers can learn how to paint and create realistic images.The idea was originally proposed by Ian Goodfellow (for more information refer toNIPS 2016 Tutorial: Generative Adversarial Networks, by I. Goodfellow, 2016); he hasworked with the University of Montreal, Google Brain, and OpenAI, and is presentlyworking in Apple Inc as the Director of Machine Learning.In this chapter we will cover different types of GANs and see some of theirimplementation in TensorFlow 2.0. Broadly we will cover the following topics:• What is a GAN?• Deep convolutional GANs• SRGAN• CycleGAN• Applications of GANsWhat is a GAN?The ability of GANs to learn high-dimensional, complex data distributions havemade them very popular with researchers in recent years. Between 2016, whenthey were first proposed by Ian Goodfellow, up to 2019, we have more than 40,000research papers related to GANs. This is in the space of just three years![ 191 ]

Generative Adversarial NetworksThe applications of GANs include creating images, videos, music, and even naturallanguages. They have been employed in tasks like image-to-image translation, imagesuper resolution, drug discovery, and even next-frame prediction in video.The key idea of GAN can be easily understood by considering it analogous to "artforgery," which is the process of creating works of art that are falsely credited toother usually more famous artists. GANs train two neural nets simultaneously. Thegenerator G(Z) is the one that makes the forgery, and the discriminator D(Y) is theone that can judge how realistic the reproductions are, based on its observations ofauthentic pieces of art and copies. D(Y) takes an input Y (for instance, an image), andexpresses a vote to judge how real the input is. In general, a value close to 1 denotes"real," while a value close to 0 denotes "forgery." G(Z) takes an input from randomnoise Z and it trains itself to fool D into thinking that whatever G(Z) produces is real.The goal of training the discriminator D(Y) is to maximize D(Y) for every imagefrom the true data distribution, and to minimize D(Y) for every image not fromthe true data distribution. So, G and D play opposite games: hence the nameadversarial training. Note that we train G and D in an alternating manner, whereeach one of their objectives is expressed as a loss function optimized via a gradientdescent. The generative model continues to improve its forgery capabilities, andthe discriminative model continues to improve its forgery recognition capabilities.The discriminator network (usually a standard convolutional neural network)tries to classify if an input image is real or generated. The important new idea isto backpropagate through both the discriminator and the generator to adjust thegenerator's parameters in such a way that the generator can learn how to fool thediscriminator more often. At the end the generator will learn how to produce imagesthat are indistinguishable from the real ones:Of course, GANs involve working towards an equilibrium in a game involving twoplayers. Let us first understand what we mean by equilibrium here. When we start,one of the two players are hopefully better than the other. This pushes the other toimprove and this way both generator and discriminator push each other towardsimprovement.[ 192 ]

Generative Adversarial Networks

The applications of GANs include creating images, videos, music, and even natural

languages. They have been employed in tasks like image-to-image translation, image

super resolution, drug discovery, and even next-frame prediction in video.

The key idea of GAN can be easily understood by considering it analogous to "art

forgery," which is the process of creating works of art that are falsely credited to

other usually more famous artists. GANs train two neural nets simultaneously. The

generator G(Z) is the one that makes the forgery, and the discriminator D(Y) is the

one that can judge how realistic the reproductions are, based on its observations of

authentic pieces of art and copies. D(Y) takes an input Y (for instance, an image), and

expresses a vote to judge how real the input is. In general, a value close to 1 denotes

"real," while a value close to 0 denotes "forgery." G(Z) takes an input from random

noise Z and it trains itself to fool D into thinking that whatever G(Z) produces is real.

The goal of training the discriminator D(Y) is to maximize D(Y) for every image

from the true data distribution, and to minimize D(Y) for every image not from

the true data distribution. So, G and D play opposite games: hence the name

adversarial training. Note that we train G and D in an alternating manner, where

each one of their objectives is expressed as a loss function optimized via a gradient

descent. The generative model continues to improve its forgery capabilities, and

the discriminative model continues to improve its forgery recognition capabilities.

The discriminator network (usually a standard convolutional neural network)

tries to classify if an input image is real or generated. The important new idea is

to backpropagate through both the discriminator and the generator to adjust the

generator's parameters in such a way that the generator can learn how to fool the

discriminator more often. At the end the generator will learn how to produce images

that are indistinguishable from the real ones:

Of course, GANs involve working towards an equilibrium in a game involving two

players. Let us first understand what we mean by equilibrium here. When we start,

one of the two players are hopefully better than the other. This pushes the other to

improve and this way both generator and discriminator push each other towards

improvement.

[ 192 ]

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

Saved successfully!

Ooh no, something went wrong!