Professional Documents
Culture Documents
Generative Models: Lecture 13 - May 18, 2017 Lecture 13 - May 18, 2017 1
Generative Models: Lecture 13 - May 18, 2017 Lecture 13 - May 18, 2017 1
Generative Models
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 1 May 18, 2017
Administrative
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 2 May 18, 2017
Overview
● Unsupervised Learning
● Generative Models
○ PixelRNN and PixelCNN
○ Variational Autoencoders (VAE)
○ Generative Adversarial Networks (GAN)
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 3 May 18, 2017
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.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 4 May 18, 2017
Supervised vs Unsupervised Learning
Supervised Learning
Data: (x, y)
x is data, y is label
Cat
Goal: Learn a function to map x -> y
Examples: Classification,
regression, object detection, Classification
semantic segmentation, image
captioning, etc.
This image is CC0 public domain
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 5 May 18, 2017
Supervised vs Unsupervised Learning
Supervised Learning
Data: (x, y)
x is data, y is label
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 6 May 18, 2017
Supervised vs Unsupervised Learning
Supervised Learning
Data: (x, y)
x is data, y is label
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 7 May 18, 2017
Supervised vs Unsupervised Learning
Supervised Learning
Data: (x, y)
x is data, y is label
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 8 May 18, 2017
Supervised vs Unsupervised Learning
Unsupervised Learning
Data: x
Just data, no labels!
Examples: Clustering,
dimensionality reduction, feature
learning, density estimation, etc.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 9 May 18, 2017
Supervised vs Unsupervised Learning
Unsupervised Learning
Data: x
Just data, no labels!
Examples: Clustering,
K-means clustering
dimensionality reduction, feature
learning, density estimation, etc.
This image is CC0 public domain
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 10 May 18, 2017
Supervised vs Unsupervised Learning
Unsupervised Learning
Data: x
Just data, no labels!
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 11 May 18, 2017
Supervised vs Unsupervised Learning
Unsupervised Learning
Data: x
Just data, no labels!
Examples: Clustering,
dimensionality reduction, feature Autoencoders
learning, density estimation, etc. (Feature learning)
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 12 May 18, 2017
Supervised vs Unsupervised Learning
Unsupervised Learning
Examples: Clustering,
dimensionality reduction, feature 2-d density estimation
learning, density estimation, etc.
2-d density images left and right
are CC0 public domain
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 13 May 18, 2017
Supervised vs Unsupervised Learning
Supervised Learning Unsupervised Learning
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 14 May 18, 2017
Supervised vs Unsupervised Learning
Supervised Learning Unsupervised Learning
Training data is cheap
Data: (x, y) Data: x Holy grail: Solve
x is data, y is label Just data, no labels! unsupervised learning
=> understand structure
of visual world
Goal: Learn a function to map x -> y Goal: Learn some underlying
hidden structure of the data
Examples: Classification,
regression, object detection, Examples: Clustering,
semantic segmentation, image dimensionality reduction, feature
captioning, etc. learning, density estimation, etc.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 15 May 18, 2017
Generative Models
Given training data, generate new samples from same distribution
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 16 May 18, 2017
Generative Models
Given training data, generate new samples from same distribution
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 17 May 18, 2017
Why Generative Models?
- Realistic samples for artwork, super-resolution, colorization, etc.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 18 May 18, 2017
Taxonomy of Generative Models Direct
GAN
Generative models
Markov Chain
Tractable density Approximate density
GSN
Fully Visible Belief Nets
- NADE
- MADE Variational Markov Chain
- PixelRNN/CNN
Variational Autoencoder Boltzmann Machine
Change of variables models
(nonlinear ICA)
Figure copyright and adapted from Ian Goodfellow, Tutorial on Generative Adversarial Networks, 2017.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 19 May 18, 2017
Taxonomy of Generative Models Direct
Today: discuss 3 most GAN
popular types of generative Generative models
models today
Markov Chain
Tractable density Approximate density
GSN
Fully Visible Belief Nets
- NADE
- MADE Variational Markov Chain
- PixelRNN/CNN
Variational Autoencoder Boltzmann Machine
Change of variables models
(nonlinear ICA)
Figure copyright and adapted from Ian Goodfellow, Tutorial on Generative Adversarial Networks, 2017.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 20 May 18, 2017
PixelRNN and PixelCNN
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 21 May 18, 2017
Fully visible belief network
Explicit density model
Use chain rule to decompose likelihood of an image x into product of 1-d
distributions:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 22 May 18, 2017
Fully visible belief network
Explicit density model
Use chain rule to decompose likelihood of an image x into product of 1-d
distributions:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 23 May 18, 2017
Fully visible belief network
Explicit density model
Use chain rule to decompose likelihood of an image x into product of 1-d
distributions:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 24 May 18, 2017
PixelRNN [van der Oord et al. 2016]
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 25 May 18, 2017
PixelRNN [van der Oord et al. 2016]
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 26 May 18, 2017
PixelRNN [van der Oord et al. 2016]
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 27 May 18, 2017
PixelRNN [van der Oord et al. 2016]
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 28 May 18, 2017
PixelCNN [van der Oord et al. 2016]
Figure copyright van der Oord et al., 2016. Reproduced with permission.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 29 May 18, 2017
PixelCNN [van der Oord et al. 2016]
Softmax loss at each pixel
Figure copyright van der Oord et al., 2016. Reproduced with permission.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 30 May 18, 2017
PixelCNN [van der Oord et al. 2016]
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 31 May 18, 2017
Generation Samples
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 32 May 18, 2017
PixelRNN and PixelCNN
Pros: Improving PixelCNN performance
- Can explicitly compute likelihood - Gated convolutional layers
p(x) - Short-cut connections
- Explicit likelihood of training - Discretized logistic loss
data gives good evaluation - Multi-scale
metric - Training tricks
- Good samples - Etc…
Con: See
- Sequential generation => slow - Van der Oord et al. NIPS 2016
- Salimans et al. 2017
(PixelCNN++)
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 33 May 18, 2017
Variational
Autoencoders (VAE)
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 34 May 18, 2017
So far...
PixelCNNs define tractable density function, optimize likelihood of training data:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 35 May 18, 2017
So far...
PixelCNNs define tractable density function, optimize likelihood of training data:
Cannot optimize directly, derive and optimize lower bound on likelihood instead
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 36 May 18, 2017
Some background first: Autoencoders
Unsupervised approach for learning a lower-dimensional feature representation
from unlabeled training data
Features
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 37 May 18, 2017
Some background first: 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
Features
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 38 May 18, 2017
Some background first: Autoencoders
Unsupervised approach for learning a lower-dimensional feature representation
from unlabeled training data
Features
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 39 May 18, 2017
Some background first: Autoencoders
Unsupervised approach for learning a lower-dimensional feature representation
from unlabeled training data
A: Want features to
capture meaningful Features
factors of variation in
data Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 40 May 18, 2017
Some background first: Autoencoders
How to learn this feature representation?
Features
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 41 May 18, 2017
Some background first: Autoencoders
How to learn this feature representation?
Train such that features can be used to reconstruct original data
“Autoencoding” - encoding itself
Reconstructed
input data
Decoder
Features
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 42 May 18, 2017
Some background first: Autoencoders
How to learn this feature representation?
Train such that features can be used to reconstruct original data
“Autoencoding” - encoding itself
Originally: Linear +
nonlinearity (sigmoid)
Reconstructed Later: Deep, fully-connected
input data Later: ReLU CNN (upconv)
Decoder
Features
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 43 May 18, 2017
Some background first: Autoencoders Reconstructed data
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 44 May 18, 2017
Some background first: Autoencoders Reconstructed data
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 45 May 18, 2017
Some background first: Autoencoders Reconstructed data
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 46 May 18, 2017
Some background first: Autoencoders
Reconstructed
input data
Decoder
Features After training,
throw away decoder
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 47 May 18, 2017
Some background first: Autoencoders
Loss function
(Softmax, etc) bird plane
dog deer truck
Predicted Label
Fine-tune Train for final task
Classifier (sometimes with
Encoder can be encoder
jointly with small data)
used to initialize a Features
supervised model classifier
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 48 May 18, 2017
Some background first: Autoencoders
Autoencoders can reconstruct
data, and can learn features to
initialize a supervised model
Encoder
Input data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 49 May 18, 2017
Variational Autoencoders
Probabilistic spin on autoencoders - will let us sample from the model to generate data!
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 50 May 18, 2017
Variational Autoencoders
Probabilistic spin on autoencoders - will let us sample from the model to generate data!
Sample from
true conditional
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 51 May 18, 2017
Variational Autoencoders
Probabilistic spin on autoencoders - will let us sample from the model to generate data!
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 52 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from
true conditional
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 53 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from How should we represent this model?
true conditional
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 54 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from How should we represent this model?
true conditional
Choose prior p(z) to be simple, e.g.
Gaussian. Reasonable for latent attributes,
e.g. pose, how much smile.
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 55 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from How should we represent this model?
true conditional
Choose prior p(z) to be simple, e.g.
Decoder Gaussian.
network
Sample from Conditional p(x|z) is complex (generates
true prior image) => represent with neural network
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 56 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from
How to train the model?
true conditional
Decoder
network
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 57 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from
How to train the model?
true conditional
Remember strategy for training generative
Decoder models from FVBNs. Learn model parameters
network
to maximize likelihood of training data
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 58 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from
How to train the model?
true conditional
Remember strategy for training generative
Decoder models from FVBNs. Learn model parameters
network
to maximize likelihood of training data
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 59 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from
How to train the model?
true conditional
Remember strategy for training generative
Decoder models from FVBNs. Learn model parameters
network
to maximize likelihood of training data
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 60 May 18, 2017
Variational Autoencoders
We want to estimate the true parameters
of this generative model.
Sample from
How to train the model?
true conditional
Remember strategy for training generative
Decoder models from FVBNs. Learn model parameters
network
to maximize likelihood of training data
Sample from
true prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 61 May 18, 2017
Variational Autoencoders: Intractability
Data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 62 May 18, 2017
Variational Autoencoders: Intractability
✔
Data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 63 May 18, 2017
Variational Autoencoders: Intractability
✔ ✔
Data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 64 May 18, 2017
Variational Autoencoders: Intractability
✔ ✔
Data likelihood:
Intractible to compute
p(x|z) for every z!
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 65 May 18, 2017
Variational Autoencoders: Intractability
✔ ✔
Data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 66 May 18, 2017
Variational Autoencoders: Intractability
✔ ✔
Data likelihood:
✔ ✔
Posterior density also intractable:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 67 May 18, 2017
Variational Autoencoders: Intractability
✔ ✔
Data likelihood:
✔ ✔
Posterior density also intractable:
Will see that this allows us to derive a lower bound on the data likelihood that is
tractable, which we can optimize
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 68 May 18, 2017
Variational Autoencoders
Since we’re modeling probabilistic generation of data, encoder and decoder networks are probabilistic
(parameters ɸ) (parameters θ)
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 69 May 18, 2017
Variational Autoencoders
Since we’re modeling probabilistic generation of data, encoder and decoder networks are probabilistic
(parameters ɸ) (parameters θ)
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 70 May 18, 2017
Variational Autoencoders
Since we’re modeling probabilistic generation of data, encoder and decoder networks are probabilistic
(parameters ɸ) (parameters θ)
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 71 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 72 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 73 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 74 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 75 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 76 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 77 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 78 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Decoder network gives pθ(x|z), can This KL term (between pθ(z|x) intractable (saw
compute estimate of this term through Gaussians for encoder and z earlier), can’t compute this KL
sampling. (Sampling differentiable prior) has nice closed-form term :( But we know KL
through reparam. trick, see paper.) solution! divergence always >= 0.
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 79 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 80 May 18, 2017
Variational Autoencoders
Now equipped with our encoder and decoder networks, let’s work out the (log) data likelihood:
Make approximate
Reconstruct posterior distribution
the input data close to prior
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 83 May 18, 2017
Variational Autoencoders
Putting it all together: maximizing the
likelihood lower bound
Input Data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 84 May 18, 2017
Variational Autoencoders
Putting it all together: maximizing the
likelihood lower bound
Encoder network
Input Data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 85 May 18, 2017
Variational Autoencoders
Putting it all together: maximizing the
likelihood lower bound
Make approximate
posterior distribution
close to prior
Encoder network
Input Data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 86 May 18, 2017
Variational Autoencoders
Putting it all together: maximizing the
likelihood lower bound
Sample z from
Make approximate
posterior distribution
close to prior
Encoder network
Input Data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 87 May 18, 2017
Variational Autoencoders
Putting it all together: maximizing the
likelihood lower bound
Decoder network
Sample z from
Make approximate
posterior distribution
close to prior
Encoder network
Input Data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 88 May 18, 2017
Variational Autoencoders
Maximize
Putting it all together: maximizing the likelihood of Sample x|z from
likelihood lower bound original input
being
reconstructed
Decoder network
Sample z from
Make approximate
posterior distribution
close to prior
Encoder network
Input Data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 89 May 18, 2017
Variational Autoencoders
Maximize
Putting it all together: maximizing the likelihood of Sample x|z from
likelihood lower bound original input
being
reconstructed
Decoder network
Sample z from
Make approximate
posterior distribution
close to prior
Encoder network
For every minibatch of input
data: compute this forward
pass, and then backprop! Input Data
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 90 May 18, 2017
Variational Autoencoders: Generating Data!
Use decoder network. Now sample z from prior!
Decoder network
Sample z from
Kingma and Welling, “Auto-Encoding Variational Bayes”, ICLR 2014
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 91 May 18, 2017
Variational Autoencoders: Generating Data!
Use decoder network. Now sample z from prior!
Decoder network
Sample z from
Kingma and Welling, “Auto-Encoding Variational Bayes”, ICLR 2014
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 92 May 18, 2017
Variational Autoencoders: Generating Data!
Use decoder network. Now sample z from prior! Data manifold for 2-d z
Decoder network
Sample z from
Kingma and Welling, “Auto-Encoding Variational Bayes”, ICLR 2014 Vary z2
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 93 May 18, 2017
Variational Autoencoders: Generating Data!
Diagonal prior on z
=> independent
Degree of smile
latent variables
Different
dimensions of z Vary z1
encode
interpretable factors
of variation
Head pose
Kingma and Welling, “Auto-Encoding Variational Bayes”, ICLR 2014 Vary z2
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 94 May 18, 2017
Variational Autoencoders: Generating Data!
Diagonal prior on z
=> independent
Degree of smile
latent variables
Different
dimensions of z Vary z1
encode
interpretable factors
of variation
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 95 May 18, 2017
Variational Autoencoders: Generating Data!
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 96 May 18, 2017
Variational Autoencoders
Probabilistic spin to traditional autoencoders => allows generating data
Defines an intractable density => derive and optimize a (variational) lower bound
Pros:
- Principled approach to generative models
- Allows inference of q(z|x), can be useful feature representation for other tasks
Cons:
- Maximizes lower bound of likelihood: okay, but not as good evaluation as
PixelRNN/PixelCNN
- Samples blurrier and lower quality compared to state-of-the-art (GANs)
Active areas of research:
- More flexible approximations, e.g. richer approximate posterior instead of diagonal
Gaussian
- Incorporating structure in latent variables
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 97 May 18, 2017
Generative Adversarial
Networks (GAN)
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 98 May 18, 2017
So far...
PixelCNNs define tractable density function, optimize likelihood of training data:
Cannot optimize directly, derive and optimize lower bound on likelihood instead
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - 99 May 18, 2017
So far...
PixelCNNs define tractable density function, optimize likelihood of training data:
Cannot optimize directly, derive and optimize lower bound on likelihood instead
What if we give up on explicitly modeling density, and just want ability to sample?
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
0
So far...
PixelCNNs define tractable density function, optimize likelihood of training data:
Cannot optimize directly, derive and optimize lower bound on likelihood instead
What if we give up on explicitly modeling density, and just want ability to sample?
Solution: Sample from a simple distribution, e.g. random noise. Learn transformation to
training distribution.
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
2
Ian Goodfellow et al., “Generative
Generative Adversarial Networks Adversarial Nets”, NIPS 2014
Solution: Sample from a simple distribution, e.g. random noise. Learn transformation to
training distribution.
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
3
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
4
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
Real or Fake
Discriminator Network
Generator Network
Random noise z
Fake and real images copyright Emily Denton et al. 2015. Reproduced with permission.
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
5
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
6
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
7
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
- 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)
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
8
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
Alternate between:
1. Gradient ascent on discriminator
10
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
9
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
Alternate between:
1. Gradient ascent on discriminator
Gradient signal
dominated by region
where sample is
2. Gradient descent on generator already good
Alternate between:
1. Gradient ascent on discriminator
Instead of minimizing likelihood of discriminator being correct, now High gradient signal
maximize likelihood of discriminator being wrong.
Same objective of fooling discriminator, but now higher gradient
signal for bad samples => works much better! Standard in practice. Low gradient signal
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
1
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
Instead of minimizing likelihood of discriminator being correct, now High gradient signal
maximize likelihood of discriminator being wrong.
Same objective of fooling discriminator, but now higher gradient
signal for bad samples => works much better! Standard in practice. Low gradient signal
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
2
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
3
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
4
Ian Goodfellow et al., “Generative
Training GANs: Two-player game Adversarial Nets”, NIPS 2014
Real or Fake
Discriminator Network
Generator Network
After training, use generator network to
Random noise z generate new images
Fake and real images copyright Emily Denton et al. 2015. Reproduced with permission.
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
5
Ian Goodfellow et al., “Generative
Adversarial Nets”, NIPS 2014
Generative Adversarial Nets
Generated samples
Nearest neighbor from training set Figures copyright Ian Goodfellow et al., 2014. Reproduced with permission.
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
6
Ian Goodfellow et al., “Generative
Adversarial Nets”, NIPS 2014
Generative Adversarial Nets
Generated samples (CIFAR-10)
Nearest neighbor from training set Figures copyright Ian Goodfellow et al., 2014. Reproduced with permission.
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
7
Generative Adversarial Nets: Convolutional Architectures
Radford et al, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, ICLR 2016
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
8
Generative Adversarial Nets: Convolutional Architectures
Generator
Radford et al, “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”, ICLR 2016
11
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
9
Generative Adversarial Nets: Convolutional Architectures
Samples
from the
model look
amazing!
Radford et al,
ICLR 2016
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
0
Generative Adversarial Nets: Convolutional Architectures
Interpolating
between
random
points in latent
space
Radford et al,
ICLR 2016
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
1
Generative Adversarial Nets: Interpretable Vector Math
Radford et al, ICLR 2016
Smiling woman Neutral woman Neutral man
Samples
from the
model
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
2
Generative Adversarial Nets: Interpretable Vector Math
Radford et al, ICLR 2016
Smiling woman Neutral woman Neutral man
Samples
from the
model
Average Z
vectors, do
arithmetic
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
3
Generative Adversarial Nets: Interpretable Vector Math
Radford et al, ICLR 2016
Smiling woman Neutral woman Neutral man
Smiling Man
Samples
from the
model
Average Z
vectors, do
arithmetic
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
4
Generative Adversarial Nets: Interpretable Vector Math
Glasses man No glasses man No glasses woman
Radford et al,
ICLR 2016
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
5
Generative Adversarial Nets: Interpretable Vector Math
Glasses man No glasses man No glasses woman Radford et al,
ICLR 2016
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
6
2017: Year of the GAN Text -> Image Synthesis
https://github.com/hindupuravinash/the-gan-zoo
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
8
See also: https://github.com/soumith/ganhacks for tips
https://github.com/hindupuravinash/the-gan-zoo
12
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
9
GANs
Don’t work with an explicit density function
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)
13
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
0
Recap
Generative Models
- PixelRNN and PixelCNN Explicit density model, optimizes exact likelihood, good
samples. But inefficient sequential generation.
13
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
1
Recap
Generative Models
- PixelRNN and PixelCNN Explicit density model, optimizes exact likelihood, good
samples. But inefficient sequential generation.
13
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
2
Recap
Generative Models
- PixelRNN and PixelCNN Explicit density model, optimizes exact likelihood, good
samples. But inefficient sequential generation.
13
Fei-Fei Li & Justin Johnson & Serena Yeung Lecture 13 - May 18, 2017
3