Chapter8 GANs
Chapter8 GANs
Adversarial Networks
1
Learning Outcomes
2
PLAN
• GANs Applications
• What are Generative Adversarial Networks
• How Do GANs Work?
• GANs Architecture:
• Generator
• Discrimanator
• Algorithm of GANs
• Steps to train GANs
• Different types of GANs
3
GANs Applications
• GANs can be trained on the
images of humans to generate
realistic faces.
Karras et al. , “PROGRESSIVE GROWING OF GANS FOR IMPROVED QUALITY, STABILITY, AND VARIATION”, 4
Published as a conference paper at ICLR 2018
GANs Applications
5
GANs Applications
• Style transfer
6
GANs Applications
• Image inpainting
7
GANs Applications
• GANs can build realistic images from textual descriptions of objects like birds,
humans, and other animals. We input a sentence and generate multiple images
fitting the description. .
8
What are Generative Adversarial
Networks
• Generative Adversarial Networks (GANs) introduced by Ian J.
Goodfellow and al. in 2014.
9
What are Generative Adversarial
Networks
• GANs perform unsupervised learning tasks.
10
How GANS work?
Real
Fake
Generator 11
How GANS work?
• GANs consists of two neural networks.
• There is a Generator G(x) and a Discriminator D(x). Both of them play an adversarial game.
• The generator's aim is to fool the discriminator by producing data that are similar to those in the
training set.
• The discriminator will try not to be fooled by identifying fake data from real data.
• Both of them work simultaneously to learn and train complex data like audio, video, or image files.
• The Generator network takes a sample and generates a fake sample of data. The Generator is
trained to increase the Discriminator network's probability of making mistakes.
12
GANs architecture
Generator
• In GANs, a generator is a neural network that generates fictitious data to train the discriminator on.
• The main aim of the Generator is to make the discriminator classify its output as real.
• It gains to produce reliable data.
• The generated samples/instances serve as the discriminator's negative training examples.
• It takes a fixed-length random vector carrying noise as input and generates a sample. .
13
GANs architecture
Generator
ii. to obtain gradients and these gradients can help change the generator weights
14
GANs architecture
Discriminator
• The Discriminator is a neural network that identifies real data from the fake data created by the
Generator. The discriminator's training data comes from different two sources:
o The real data instances, such as real pictures of currency notes, humans, animals, etc., are used by the
discriminator as positive samples during training.
o The fake data instances created by the Generator are used as negative examples during the training process.
Real
Discriminator
Predicted label
Fake 15
GANs architecture
Discriminator
• While training the discriminator, it connects to two loss functions (generator loss and discriminator loss) .
• During discriminator training, the discriminator ignores the generator loss and just uses the discriminator loss.
• The discriminator loss penalizes the discriminator for misclassifying a real data instance as fake or a fake data
instance as real.
• The discriminator updates its weights through backpropagation from the discriminator loss through the discriminator
network.
16
Loss functions
*Goodfellow, I.; Pouget-Abadie, J.; Mirza, M.; Xu, B.; Warde-Farley, D.; Ozair, S.; Courville, A.; Bengio, Y. Generative adversarial nets. In Proceedings of the
Advances in Neural Information Processing Systems,Montreal, QC, Canada, 8–13 December 2014; pp. 2672–2680. 18
Steps for training GAN
23 4,
**** Güemes, A., Vila, C. S., and Discetti, S. (2022). Super-resolution generative adversarial networks of randomly-seeded fields. Nat. Mach. Intell.
1165–1173. doi: 10.1038/s42256-022-00572-7
References
• Goodfellow, I.; Pouget-Abadie, J.; Mirza, M.; Xu, B.; Warde-Farley, D.; Ozair, S.; Courville, A.;
Bengio, Y. Generative adversarial nets. In Proceedings of the Advances in Neural Information
Processing Systems,Montreal, QC, Canada, 8–13 December 2014; pp. 2672–2680.
• Mirza M, Osindero S. Conditional generative adversarial nets. 2014. arXiv: 1411. 1784
• Güemes, A., Vila, C. S., and Discetti, S. (2022). Super-resolution generative adversarial
networks of randomly-seeded fields. Nat. Mach. Intell. 4, 1165–1173. doi: 10.1038/s42256-
022-00572-7
24