Generative Adversarial Networks (GANs)
Generative Adversarial Networks (GANs)
Generative Adversarial Networks (GANs)
(GANs)
Hoàng Minh Thanh (21C11029)
Nguyễn Trần Khánh Nguyên (21C11017)
Nguyễn Thanh Tùng (18120104)
Lê Minh Đức (18120164)
Team 07
(*) The Big Book of Dashboards Visualizing Your Data Using Real-World Business Scenarios by Steve Wexler Jeffrey Shaffer Andy Cotgreave (z-lib.org)
1
1. Introduction of GANs
2. DCGANs
Content
3. Cycle GANs
2
Overview of GAN
3
What are GANs ?
4
What are GANs ?
5
6 Steps for Training GANs
● Step 1: Generate a noise vector
● Step 2: Pass this noise through Generator to generate an
actual image
● Step 3: Mix authentic images and synthetic images
● Step 4: Using this mixed set for training Discriminator
● Step 5: Once again generate random noise and label each
noise vector as a “real image”
● Step 6: Train the GAN using the noise vectors and “real
image” labels
6
GANs Training
7
Types of GANs
● Foundation level
○ Deep Convolutional GAN (DCGAN)
● Extensions
○ Conditional GAN (cGAN)
○ Information Maximizing GAN (InfoGAN)
○ Stacked GAN (StackGAN)
○ Auxiliary Classifier GAN (AC-GAN)
○ Context Encoders
○ Pix2Pix
● Advanced level
○ Cycle-Consistent GAN (CycleGAN)
○ Big GAN (BigGAN)
○ Style-Based GAN (StyleGAN)
○ Wasserstein GAN (WGAN)
○ Progressive Growing GAN (Progressive GAN)
8
Applications of GANs
9
Applications of GANs
12
Applications of GANs
15
What is the goal of GAN?
The goal: The main focus for GAN (Generative Adversarial
Networks) is to generate data from scratch, mostly images
but other domains including music have been done.
16
Main idea of DCGAN
18
GAN: Model Overview
19
Generator: From Vector to Image
20
Generator: From Vector to Image
21
Discriminator is a classification
22
Discriminator: From Image to Binary
23
How to training
Alternating minimization
24
Update the Discriminator
25
Update the Generator
26
Update the Generator
Connect the generator and discriminator (freeze
discriminator’s parameters).
Minimize Loss = Dist (True, ) w.r.t.generator.
(Encourage be True.)
27
Update the Generator
• Use the same vector.
• Generate a fake image using the updated generator.
• The discriminator thinks the new fake image more “real”
than before.
28
Loss function
Probability of real image: D(x)
Probability of fake image: 1 - D(x)
p_data(x) : distribution of real image
p_z(z) : distribution of fake image
29
Discriminator Shouldn’t Be Too Good
• Generator: a forger who wants to create a fake Picasso painting.
• Discriminator: an art dealer providing feedbacks.
30
Discriminator Shouldn’t Be Too Bad
… Vanishing gradient… !
• Suppose the discriminator is perfect.
• Whatever the generators forged is recognized fake by the
discriminator.
→The gradient is near zero.
31
Discriminator Shouldn’t Be Too Good
• Generator: a forger who wants to create a fake Picasso painting.
• Discriminator: an art dealer providing feedbacks.
32
Solutions to training DCGAN
1. Carefully tune the learning rates.
• If the discriminator improves too fast,
→ classification accuracy can be 100%,
→ vanishing gradient,
→ the generator is dead.
• If the discriminator improves too slowly,
→ the discriminator cannot provide useful feedback,
→ the generator has to wait for the discriminator,
→ slow convergence.
33
Solutions to training DCGAN
2. Add noise to the real and fake images; decay
the noise over time.
• When training the discriminator, perturb the inputs (both
real and fake images).
34
Experiment
35
Experiment
● Datasets:
MNIST
Celeb-A
36
Experiment
● DCGAN Architecture for MNIST
Generator
Discriminator
37
Experiment
● DCGAN Architecture for Celeb-A
Generator
Discriminator
38
Demo
39
Cycle GAN
40
Introduction Cycle GAN
41
CycleGAN Architecture
42
CycleGAN Architecture
43
Cycle Consistency Loss
44
Cycle Consitency Loss
45
Applications of CycleGAN
46
Applications of CycleGAN
Object transfiguration
47
Applications of CycleGAN
49
Resource
DCGAN Report (Overleaf) :
https://www.overleaf.com/7297748965xsdcptbdddbk
DCGAN Colab:
https://colab.research.google.com/drive/1pRVH4srQyT_ri-I
a4c3_uauTfcIMSQN8?usp=sharing#scrollTo=eJHN40X0Mr
bV
CycleGAN Colab:
https://colab.research.google.com/drive/1pRVH4srQyT_ri-I
a4c3_uauTfcIMSQN8?usp=sharing#scrollTo=eJHN40X0Mr
bV
50
Q&A
51