SlideShare a Scribd company logo
1
Introduction to Generative
Adversarial Networks
Vladyslav Kolbasin
Lead Software Developer, Consultant
14.03.2018
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
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
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
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
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..
7
Missing data. Image inpainting
8
Multiple correct answers
9
Multiple correct answers
(Lotter et al 2016)
10
Realistic generation tasks
11
Realistic generation tasks
https://github.com/tkarras/progressive_growing_of_gans
https://arxiv.org/abs/1710.10196
12
Linear Latent Space
G(z0
) Linear Interpolation in z space: G(z0
+t*(z1
-z0
)) G(z1
)
13
• “Unsupervised Representation Learning with Deep Convolutional
Generative Adversarial Models”. https://arxiv.org/pdf/1511.06434.pdf
Vector Space Arithmetics
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
15
Design loss function
• No need in hand-engineering our loss functions for Img2Img task
16
Design loss function
• No need in hand-engineering our loss functions for Img2Img task
17
Design loss function
• No need in hand-engineering our loss functions for Img2Img task
1818
Demo. Mode-collapse.
Oscillations in GAN
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
20
KL-divergence
21
KL-divergence
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
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
24
Improved WGAN: +gradient penalty
2525
Demo. Mode-collapse.
Fixing oscillations in GANs
2626
How to train it?
27
GAN. Training Discriminator
Credit: https://www.slideshare.net/xavigiro/deep-learning-for-computer-vision-generative-models-and-adversarial-training-upc-2016
28
GAN. Training Generator
Credit: https://www.slideshare.net/xavigiro/deep-learning-for-computer-vision-generative-models-and-adversarial-training-upc-2016
29
GAN. Training algorithm
3030
Let’s construct GAN
31
Generator
32
Discriminator
33
Init GAN
34
Init GAN
35
Train
36
Train
37
Train
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
39
GANs Taxonomy
4040
Application Examples
41
1. Faces in-painting
• Can we restore image with
distortion?
• Faces dataset: CelebA
• Solution: Conditional GAN
42
1. Faces mode-collapse
3800 4250 11000
12000 12300 14300
43
• Competition Skin Lesion Analysis Towards Melanoma Detection
• Segment image - find lesion in the picture
• https://challenge.kitware.com/#challenge/560d7856cad3a57cfde481ba
• Solution: Analogue of pix2pix architecture
2. Lesion segmentation
44
45
4646
Cool Results
47
Updates at the GAN Zoo
https://github.com/hindupuravinash/the-gan-zoo
48
StackGAN
• Text-to-Image Synthesis https://github.com/hanzhanggit/StackGAN
49
50
51
medGAN
• “Generating Multi-label Discrete Patient Records using Generative
Adversarial Network” https://arxiv.org/pdf/1703.06490.pdf
52
Pix2Pix
• Image-to-image translation with conditional adversarial nets
• https://github.com/phillipi/pix2pix
53
CycleGAN
• Does image-to-image translation
without input-output pairs
• Unsupervised learning
• https://github.com/junyanz/CycleGAN
54
CycleGAN
55
UNIT
• Unsupervised Image-to-Image Translation Networks
• https://arxiv.org/pdf/1703.00848.pdf
• https://github.com/mingyuliutw/unit
56
UNIT
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
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
59
Vladyslav Kolbasin
Lead Software Developer, Consultant
vladyslav.kolbasin@globallogic.com
ва
Thank you!

More Related Content

PDF
Generative Adversarial Network (+Laplacian Pyramid GAN)
PDF
DiscoGAN - Learning to Discover Cross-Domain Relations with Generative Advers...
PPTX
Generative Adversarial Networks (GAN)
PDF
EuroSciPy 2019 - GANs: Theory and Applications
PDF
오토인코더의 모든 것
PDF
PDF
11_gan.pdf
PPTX
Reading group gan - 20170417
Generative Adversarial Network (+Laplacian Pyramid GAN)
DiscoGAN - Learning to Discover Cross-Domain Relations with Generative Advers...
Generative Adversarial Networks (GAN)
EuroSciPy 2019 - GANs: Theory and Applications
오토인코더의 모든 것
11_gan.pdf
Reading group gan - 20170417

Similar to Vladislav Kolbasin “Introduction to Generative Adversarial Networks (GANs)” (20)

PDF
Generative Adversarial Networks : Basic architecture and variants
PPTX
GAN_SANTHOSH KUMAR_Architecture_in_network
PDF
Deep Generative Models - Kevin McGuinness - UPC Barcelona 2018
PPTX
# Can we trust ai. the dilemma of model adjustment
PDF
Tutorial on Theory and Application of Generative Adversarial Networks
PDF
Generative adversarial networks
PDF
DiscoGAN
PPTX
Problem of Non-Convergence Assessment-Presentation.pptx
PDF
Using GANs to improve generalization in a semi-supervised setting - trying it...
PDF
Semi-supervised learning with GANs
PDF
Deep Learning for Computer Vision: Generative models and adversarial training...
PPTX
brief Introduction to Different Kinds of GANs
PPTX
Musings of kaggler
PPTX
Generative Adversarial Network (GAN) for Image Synthesis
PDF
Distributed deep learning
PDF
KaoNet: Face Recognition and Generation App using Deep Learning
PDF
Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...
PDF
Project_Final_Review.pdf
PDF
contrastive-learning2.pdf
PDF
DutchMLSchool. Logistic Regression, Deepnets, Time Series
Generative Adversarial Networks : Basic architecture and variants
GAN_SANTHOSH KUMAR_Architecture_in_network
Deep Generative Models - Kevin McGuinness - UPC Barcelona 2018
# Can we trust ai. the dilemma of model adjustment
Tutorial on Theory and Application of Generative Adversarial Networks
Generative adversarial networks
DiscoGAN
Problem of Non-Convergence Assessment-Presentation.pptx
Using GANs to improve generalization in a semi-supervised setting - trying it...
Semi-supervised learning with GANs
Deep Learning for Computer Vision: Generative models and adversarial training...
brief Introduction to Different Kinds of GANs
Musings of kaggler
Generative Adversarial Network (GAN) for Image Synthesis
Distributed deep learning
KaoNet: Face Recognition and Generation App using Deep Learning
Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...
Project_Final_Review.pdf
contrastive-learning2.pdf
DutchMLSchool. Logistic Regression, Deepnets, Time Series
Ad

More from Lviv Startup Club (20)

PDF
Oleksandr Ivakhnenko: LinkedIn Marketing і Content Marketing: розширений підх...
PDF
Maksym Vyshnivetskyi: PMO Quality Management (UA)
PDF
Oleksandr Ivakhnenko: Вступ до генерації лідів для ІТ-аутсорсингу (UA)
PDF
Oleksandr Osypenko: Поради щодо іспиту та закриття курсу (UA)
PDF
Oleksandr Osypenko: Пробний іспит + аналіз (UA)
PDF
Oleksandr Osypenko: Agile / Hybrid Delivery (UA)
PDF
Oleksandr Osypenko: Стейкхолдери та їх вплив (UA)
PDF
Rostyslav Chayka: Prompt Engineering для проєктного менеджменту (Advanced) (UA)
PPTX
Dmytro Liesov: PMO Tools and Technologies (UA)
PDF
Rostyslav Chayka: Управління командою за допомогою AI (UA)
PDF
Oleksandr Osypenko: Tailoring + Change Management (UA)
PDF
Maksym Vyshnivetskyi: Управління закупівлями (UA)
PDF
Oleksandr Osypenko: Управління ризиками (UA)
PPTX
Dmytro Zubkov: PMO Resource Management (UA)
PPTX
Rostyslav Chayka: Комунікація за допомогою AI (UA)
PDF
Ihor Pavlenko: Комунікація за допомогою AI (UA)
PDF
Maksym Vyshnivetskyi: Управління якістю (UA)
PDF
Ihor Pavlenko: Робота зі стейкхолдерами за допомогою AI (UA)
PDF
Maksym Vyshnivetskyi: Управління вартістю (Cost) (UA)
PDF
Oleksandr Osypenko: Управління часом та ресурсами (UA)
Oleksandr Ivakhnenko: LinkedIn Marketing і Content Marketing: розширений підх...
Maksym Vyshnivetskyi: PMO Quality Management (UA)
Oleksandr Ivakhnenko: Вступ до генерації лідів для ІТ-аутсорсингу (UA)
Oleksandr Osypenko: Поради щодо іспиту та закриття курсу (UA)
Oleksandr Osypenko: Пробний іспит + аналіз (UA)
Oleksandr Osypenko: Agile / Hybrid Delivery (UA)
Oleksandr Osypenko: Стейкхолдери та їх вплив (UA)
Rostyslav Chayka: Prompt Engineering для проєктного менеджменту (Advanced) (UA)
Dmytro Liesov: PMO Tools and Technologies (UA)
Rostyslav Chayka: Управління командою за допомогою AI (UA)
Oleksandr Osypenko: Tailoring + Change Management (UA)
Maksym Vyshnivetskyi: Управління закупівлями (UA)
Oleksandr Osypenko: Управління ризиками (UA)
Dmytro Zubkov: PMO Resource Management (UA)
Rostyslav Chayka: Комунікація за допомогою AI (UA)
Ihor Pavlenko: Комунікація за допомогою AI (UA)
Maksym Vyshnivetskyi: Управління якістю (UA)
Ihor Pavlenko: Робота зі стейкхолдерами за допомогою AI (UA)
Maksym Vyshnivetskyi: Управління вартістю (Cost) (UA)
Oleksandr Osypenko: Управління часом та ресурсами (UA)
Ad

Recently uploaded (20)

PDF
.pdf is not working space design for the following data for the following dat...
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PPTX
1_Introduction to advance data techniques.pptx
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PDF
Fluorescence-microscope_Botany_detailed content
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
Supervised vs unsupervised machine learning algorithms
PDF
Foundation of Data Science unit number two notes
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
Business Acumen Training GuidePresentation.pptx
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
.pdf is not working space design for the following data for the following dat...
Introduction-to-Cloud-ComputingFinal.pptx
IBA_Chapter_11_Slides_Final_Accessible.pptx
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Business Ppt On Nestle.pptx huunnnhhgfvu
1_Introduction to advance data techniques.pptx
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Fluorescence-microscope_Botany_detailed content
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
Clinical guidelines as a resource for EBP(1).pdf
IB Computer Science - Internal Assessment.pptx
Supervised vs unsupervised machine learning algorithms
Foundation of Data Science unit number two notes
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Business Acumen Training GuidePresentation.pptx
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Acceptance and paychological effects of mandatory extra coach I classes.pptx
oil_refinery_comprehensive_20250804084928 (1).pptx
Recruitment and Placement PPT.pdfbjfibjdfbjfobj

Vladislav Kolbasin “Introduction to Generative Adversarial Networks (GANs)”