GAN Lecture
GAN Lecture
Today’s class
• Unsupervised Learning
• Generative Models
• Autoencoders (AE)
• Generative Adversarial Networks (GAN)
• GANs: Recent Trends
Supervised vs Unsupervised Learning
Supervised Learning
Data: (x, y)
x is data, y is label
Examples: Classification,
regression, object detection,
semantic segmentation,
image captioning, etc.
Credit: cs231n, Stanford
Supervised vs Unsupervised Learning
Supervised Learning
Data: (x, y)
x is data, y is label
Cat
Goal: Learn a function to map x -> y
Data: (x, y)
x is data, y is label
Examples: Classification,
regression, object detection, Object Detection
semantic segmentation,
image captioning, etc.
Credit: cs231n, Stanford
Supervised vs Unsupervised Learning
Supervised Learning
Data: (x, y)
x is data, y is label
Examples: Classification,
regression, object detection,
semantic segmentation, Semantic Segmentation
image captioning, etc.
Credit: cs231n, Stanford
Supervised vs Unsupervised Learning
Supervised Learning
Data: (x, y)
x is data, y is label
Examples: Classification,
regression, object detection,
semantic segmentation, Image Captioning
image captioning, etc.
Credit: cs231n, Stanford
Supervised vs Unsupervised Learning
Unsupervised Learning
Data: x
Just data, no labels!
Examples: Clustering,
dimensionality reduction, feature
learning, density estimation, etc.
Credit: cs231n, Stanford
Supervised vs Unsupervised Learning
Unsupervised Learning
Data: x
Just data, no labels!
Examples: Clustering,
dimensionality reduction, feature K-Means Clustering
learning, density estimation, etc.
Credit: cs231n, Stanford
Supervised vs Unsupervised Learning
Unsupervised Learning
Data: x
Just data, no labels!
Examples: Clustering,
dimensionality reduction, feature (Principal Component Analysis)
Dimensionality Reduction
learning, density estimation, etc.
Credit: cs231n, Stanford
Supervised vs Unsupervised Learning
Unsupervised Learning
Data: x
Just data, no labels!
Examples: Clustering,
dimensionality reduction, feature Generative Advarsarial Networks
(Distribution learning)
learning, density estimation, etc.
Credit: cs231n, Stanford
Autoencoders
Unsupervised approach for learning a lower-dimensional feature
representation from unlabeled training data
Originally: Linear +
nonlinearity (sigmoid)
Later: Deep, fully-connected
Later: ReLU CNN
Originally: Linear +
nonlinearity (sigmoid)
Later: Deep, fully-connected
Later: ReLU CNN
Input Data
Input Data
Input Data
Loss Function
(Softmax, etc.)
Loss Function
(Softmax, etc.)
Fine-
tune
encoder Train for final task
jointly (sometimes with
with small data)
classifier
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Generative Adversarial Networks
Sample from a simple distribution, e.g. random noise.
Learn transformation to training distribution.
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Generator network: try to fool the discriminator by generating real-looking images
Discriminator network: try to distinguish between real and fake images
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Generator network: try to fool the discriminator by generating real-looking images
Discriminator network: try to distinguish between real and fake images
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Fake and real images copyright Emily Denton et al. 2015. Credit: cs231n, Stanford
Training GANs: Two-player game
Generator network: try to fool the discriminator by generating real-looking images
Discriminator network: try to distinguish between real and fake images
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Figure: Ian Goodfellow NIPS Talk
Training GANs: Two-player game
Generator network: try to fool the discriminator by generating real-looking images
Discriminator network: try to distinguish between real and fake images
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Generator network: try to fool the discriminator by generating real-looking images
Discriminator network: try to distinguish between real and fake images
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Generator network: try to fool the discriminator by generating real-looking images
Discriminator network: try to distinguish between real and fake images
• Discriminator (θd) wants to maximize objective such that D(x) is close to 1 (real)
and D(G(z)) is close to 0 (fake)
• Generator (θg) wants to minimize objective such that D(G(z)) is close to 1
(discriminator is fooled into thinking generated G(z) is real)
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Credit: cs231n, Stanford
Training GANs: Two-player game
Ian Goodfellow et al., “Generative Adversarial Nets”, NIPS 2014 Fake and real images copyright Emily Denton et al. 2015. Credit: cs231n, Stanford
Generative Adversarial Nets
Generated Samples [MNIST Database, Toronto Face Database (TFD)]
Generator
Radford et al, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, ICLR 2016
DCGAN
Deep Convolutional Generative Adversarial Nets
❖ Generator is an upsampling network with fractionally-strided convolutions.
❖ Discriminator is a convolutional network.
Radford et al, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, ICLR 2016
DCGAN
Deep Convolutional Generative Adversarial Nets
❖ Generator is an upsampling network with fractionally-strided convolutions.
❖ Discriminator is a convolutional network.
Radford et al, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, ICLR 2016
DCGAN
Deep Convolutional Generative Adversarial Nets
Generated bedrooms after one training pass through the LSUN dataset.
Amazing!
Radford et al, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, ICLR 2016
Image-to-Image Translation
• Conditional GAN1
• Dual GAN3
1. Mirza, Mehdi, and Simon Osindero. "Conditional generative adversarial nets." arXiv preprint
arXiv:1411.1784 (2014).
2. Zhu, Jun-Yan, et al. Unpaired Image-To-Image Translation Using Cycle-Consistent Adversarial
Networks. CVPR 2017.
3. Yi, Zili, et al. DualGAN: Unsupervised Dual Learning for Image-To-Image Translation. CVPR 2017.
Slide Credit: Kishan Babu, PhD Student, IIIT Sri City Phillip et al. 2017
Unpaired image to image translation using cycle
consistency adversarial networks
Slide Credit: Kishan Babu, PhD Student, IIIT Sri City Jun-Yan Zhu et al. 2017
“The GAN Zoo”
https://github.com/hindupuravinash/the-gan-zoo
“The GAN Zoo”
https://github.com/hindupuravinash/the-gan-zoo
“The GAN Zoo”
https://github.com/hindupuravinash/the-gan-zoo
GANs: Things to Remember
Take game-theoretic approach: learn to generate from training distribution
through 2-player game
Pros:
- Beautiful, state-of-the-art samples!
Cons:
- Trickier / more unstable to train
- Can’t solve inference queries such as p(x), p(z|x)