Week 3 - Post - GAN
Week 3 - Post - GAN
Week 3 - Post - GAN
Visual Generative
AI Application
Generative Adversarial Networks (GAN)
Week 3
AY 24/25
S PEC IALIST D IPLOMA IN APPLIE D GE NE RATIV E AI ( S D GAI)
Official Open
Official Open
Official Open
Official Open
Objectives
• By the end of this module, learners will be able to
• Describe the concepts of Generative Adversarial Networks (GAN)
• Train GAN model to generate output
Official Open
Solution to this game is the Nash Equilibrium: G(z) being drawn from the same
distribution as the training data and D(x) = 0.5
Official Open
Applications: StyleGAN
• Human Face Generation(StyleGAN)
• Go to StyleGAN or StyleGAN3
• Generate a few images on a human face.
Applications: CycleGAN
Applications: GauGAN
Translating Scribbles
into Images
Generator Discriminator
function, G function, D
Discriminator Function
• A discriminator is a classifier model.
• It can be implemented using a Feedforward Neural Network.
• It classifies if a given sample is real or fake.
Prob (y | x)
Samples, x Probability (Fake,
given Sample)
Discriminator D(x)
Official Open
Generator Function
• Given some simple prior distribution (e.g. Gaussian or z), the
generator gives a sample of 𝑥 drawn ideally from the distribution of
the training data.
• Generator can either be Feedforward Neural Networks or
Convolutional Neural Networks
Generator G(z)
Generated
Input, z Samples, 𝑋
Sampling
Prior Distribution
Official Open
Discriminator will
minimize the cost Generator will Captures the Adversarial Implementation
maximize the cost (Zero sum Game)
Official Open
Official Open
Generator
Aim: Make the fakes look reals
Official Open
Training a Discriminator
Both real and fake examples Discriminator
are used in training Parameters
Update
Generator
Aim: Make the fakes look reals
Official Open
Training a Generator
Generator
Parameters
Update
Practical 3
Generative Adversarial Networks
• Vanila GAN
• Deep Convolutional GAN
Official Open
Hand-digits Generation
• In this practical we will learn to generate a 28 X 28 grayscale image
of handwritten digits (numbered from 0 to 9).
• We will train a GAN model using the MNIST dataset
Official Open
Vanilla GAN
• Generator model: Noise vector z as input and
repeating blocks that transform and scale up
the vector to the required dimensions.
• Each block consists of a dense layer
• Leaky ReLU activation
• Batch-normalization layer.
• We simply reshape the output from the final block
to transform it into the required output image size
• The discriminator is a simple feedforward
network.
• This model takes an image as input (a real image or
the fake output from the generator) and
• Classifies it as real or fake.
Official Open
Alec Radford et. al, Unsupervised Representation learning with Deep convolutional Generative Adversarial Networks
Official Open
Official Open
Official Open
Official Open
Official Open
Official Open
Official Open
Official Open
Official Open
Official Open
Official Open
Official Open
Official Open