2. 2
Agenda
1. Introduction to generative adversarial network
2. What can be done with GANs?
3. Pros and cons
4. How to train it? How to construct your own GAN
5. Application examples
1. Faces in-painting
2. Lesion segmentation
6. Cool results
7. Conclusion
3. 3
Generative vs discriminative models
• Pros:
• Know about
data distribution
• Cons:
• Very expensive
to get
• Need lots of
data
• Pros:
• Easy to model
• Cons:
• Can classify,
but not
generate data
Generative Discriminative
P(c|x)
4. 4
Generative adversarial network. Architecture
• GAN – two neural networks competing against
each other in a zero-sum game framework.
(Ian Goodfellow et al. in 2014)
• G tries to “trick” D by generating samples that
are hard for D to distinguish from data
• Some kind of unsupervised learning
• Networks try to:
• D(G(z)) => max
• D(x)(1 — D(G(z))) => max
=> Nash equilibrium:
Credit:
https://www.slideshare.net/xavigiro/deep-learning-for-computer-vision-generati
ve-models-and-adversarial-training-upc-2016
5. 5
What can be done with GANs?
• Simulated environments and training data
• Missing data
• Multiple correct answers
• Realistic generation tasks
• Super-resolution
• Learn useful embeddings
6. 6
Simulated environments and training data
• Good generator, but too few real data
• Can’t use real data
• Medical data (EHR, EMR, ...)
• Drug discovery
• Autonomous driving data
• Many others..
13. 13
• “Unsupervised Representation Learning with Deep Convolutional
Generative Adversarial Models”. https://arxiv.org/pdf/1511.06434.pdf
Vector Space Arithmetics
14. 14
GAN Pros and Cons
• Pros
• Provide great results
• Vector Space Arithmetics
• Designing loss function
• Cons
• Generality penalty:
for any given problem, application-tailored solutions might work better
• It is very hard to train it (properly)
■ Sometimes training longer makes it worse
■ Discriminator almost always wins
■ Mode-collapse
• Hard to evaluate
19. 19
• Optimization criteria:
• We want to make distributions equal
• It is equivalent to maximizing log-likelihood or
• KL-divergence:
• We can use other divergence too
• Jensen-Shannon divergence
GAN. How to train?
True data Noise for generating data
22. 22
• Introduced other metric: Wasserstein metric (earth mover's distance)
• Summary about wGAN:
• For mathematicians: it uses Wasserstein distance instead of
Jensen-Shannon divergence to compare distributions
• For engineers: it gets rid of a few unnecessary logarithms, and clips
weights
• For others: it employs an art critic instead of forgery expert
• More math details: https://www.cph-ai-lab.com/wasserstein-gan-wgan
Fixing mode collapse. wGAN(s)
Wasserstein GAN. https://arxiv.org/pdf/1701.07875.pdf
23. 23
Fixing mode collapse. Improved wGAN.
• Penalize the norm of the gradient
of the critic with respect to its
input instead of clipping weights.
• This ‘gradient penalty’ is simply
added to the Wasserstein
distance for the total loss.
Improved training of Wasserstein GAN. https://arxiv.org/pdf/1704.00028.pdf
38. 38
GAN hacks
• https://github.com/soumith/ganhacks
• About 17 hacks:
• Normalize the inputs
• Use Soft and Noisy Labels
• Avoid Sparse Gradients: ReLU,
MaxPool. Use LeakyReLU
• Use SGD for discriminator and
ADAM for generator
• …
• Sample from a gaussian
distribution
• Batch Normalization
57. 57
Conclusions
• GANs can do very cool things
• GANs training is hard and slow
• GANs is an architecture that is rapidly developing
• Three view of GANs:
• Generative models: G(z) - unsupervised learning
• Trainable regression loss .
Learn L - what should I do.
• Domain matching loss
■ Domain adaptation - train on source, adapt to target
■ Adversarial Discriminative Domain Adaptation
https://arxiv.org/pdf/1702.05464.pdf
58. 58
References
• Good tutorials from Ian Goodfellow:
• https://arxiv.org/pdf/1701.00160.pdf
• https://arxiv.org/pdf/1406.2661.pdf
• https://youtu.be/RvgYvHyT15E
• Training hacks:
• https://github.com/soumith/ganhacks
• Simplest GAN:
• https://deeplearning4j.org/generative-adversarial-network
• GAN collections:
• https://github.com/nightrome/really-awesome-gan
• https://github.com/wiseodd/generative-models
• https://github.com/hindupuravinash/the-gan-zoo