SlideShare a Scribd company logo
1 of 34
Download to read offline
Semi-supervised
learning with GANs
Olga Petrova, ML Engineer
Semi-supervised
learning with GANs
or
What happens when Dogs and Cats are left
unsupervised
Olga Petrova, ML Engineer
Outline
1. Theory
A. Semi-supervised learning

B. Generative Adversarial Networks

C. Semi-supervised learning with GANs

2. Practice
A Tale of Cats and Dogs
Outline
1. Theory
A. Semi-supervised learning

B. Generative Adversarial Networks

C. Semi-supervised learning with GANs

2. Practice
A Tale of Cats and Dogs
Semi-Supervised Learning: what
• Unsupervised learning (unlabelled training data): e.g. clustering, GAN

• Supervised learning (labelled training data): e.g. regression,
classification

• Semi-supervised learning:

- a subset of the training data is labeled

- the rest is unlabelled

- supervised learning tasks
Semi-Supervised Learning: why
• In practice, many tasks of interest come from supervised learning

• Deep learning: models need a lot of training data

• Labelling data is expensive

• Unlabelled data: easier to collect

• Semi-supervised learning: use unlabelled data to boost the
performance of supervised ML models
Outline
1. Theory
A. Semi-supervised learning

B. Generative Adversarial Networks

C. Semi-supervised learning with GANs

2. Practice
A Tale of Cats and Dogs
GANs: Generative Adversarial NetworksGANs: Generative Adversarial Networks
Ref: Ian Goodfellow et al., 2014

• Unsupervised learning: unlabelled training data (e.g., MNIST images)

• Goal: generate data from the same distribution (e.g. new images that look like MNIST)

• Generator: deConv network that generates an image from random input noise

• Discriminator: binary classifier that is trained to accept Real images and reject Fake ones
Image source
GANs: Generative Adversarial Networks
Ref: Ian Goodfellow et al., 2014

• Unsupervised learning: unlabelled training data (e.g., MNIST images)

• Goal: generate data from the same distribution (e.g. new images that look like MNIST)

• Generator: deConv network that generates an image from random input noise

• Discriminator: binary classifier that is trained to accept Real images and reject Fake ones
Image source
GANs: Generative Adversarial Networks
Ref: Ian Goodfellow et al., 2014

• Unsupervised learning: unlabelled training data (e.g., MNIST images)

• Goal: generate data from the same distribution (e.g. new images that look like MNIST)

• Generator: deConv network that generates an image from random input noise

• Discriminator: binary classifier that is trained to accept Real images and reject Fake ones
Image source
GANs: Generative Adversarial Networks
Ref: Ian Goodfellow et al., 2014

• Unsupervised learning: unlabelled training data (e.g., MNIST images)

• Goal: generate data from the same distribution (e.g. new images that look like MNIST)

• Generator: deConv network that generates an image from random input noise

• Discriminator: binary classifier that is trained to accept Real images and reject Fake ones
Image source
GANs: Generative Adversarial Networks
Ref: Ian Goodfellow et al., 2014

Training of the Discriminator
• Straightforward binary classification (Real for the training set, Fake for the generated images)

Training of the Generator
• We pass the generated image as input to the Discriminator

• If the image is classified as Fake, we adjust the Generator to produce better images
Image source
Ref: Ian Goodfellow et al., 2014

• In practice: G and D are trained separately, one after another, for each batch:
GANs: Generative Adversarial Networks
Pytorch GAN tutorial
Ref: Ian Goodfellow et al., 2014

• Real data: x ~ p(x)

• Generated data: x ~ pG(x) (Actually, x ~ pG(x|z))

• Goal: pG(x) ≈ p(x)

• Discriminator D is trained to assign the correct label (Real vs Fake)

• Generator G is trained to produce images that will fool the Discriminator D
GANs: Generative Adversarial Networks
Outline
1. Theory
A. Semi-supervised learning

B. Generative Adversarial Networks

C. Semi-supervised learning with GANs

2. Practice
A Tale of Cats and Dogs
Ref: Improved Techniques for Training GANs, 2016

Basic idea:
• Our training data has a certain distribution

• The GAN will attempt to learn that distribution

• ≈ “clustering” + using the labeled samples to assign labels to classes
Semi-supervised learning with GANs
Example:
• 2D data: two circles = two classes, but only a few of
the points are labeled

• GAN will learn that there are two circles and the
labeled points will help classify them as two classes
Ref: Improved Techniques for Training GANs, 2016

Basic idea:
• Our training data has a certain distribution

• The GAN will attempt to learn that distribution

• ≈ “clustering” + using the labeled samples to assign labels to classes
Semi-supervised learning with GANs
Example:
• 2D data: two circles = two classes, but only a few of
the points are labeled

• GAN will learn that there are two circles and the
labeled points will help classify them as two classes
Ref: Improved Techniques for Training GANs, 2016

Basic idea:
• Our training data has a certain distribution

• The GAN will attempt to learn that distribution

• ≈ “clustering” + using the labeled samples to assign labels to classes
Semi-supervised learning with GANs
Example:
• 2D data: two circles = two classes, but only a few of
the points are labeled

• GAN will learn that there are two circles and the
labeled points will help classify them as two classes
Ref: Improved Techniques for Training GANs, 2016

Basic idea:
• Our training data has a certain distribution

• The GAN will attempt to learn that distribution

• ≈ “clustering” + using the labeled samples to assign labels to classes
Semi-supervised learning with GANs
Example:
• 2D data: two circles = two classes, but only a few of
the points are labeled

• GAN will learn that there are two circles and the
labeled points will help classify them as two classes
Ref: Improved Techniques for Training GANs, 2016

Basic idea:
• Our training data has a certain distribution

• The GAN will attempt to learn that distribution

• ≈ “clustering” + using the labeled samples to assign labels to classes
Semi-supervised learning with GANs
Example:
• 2D data: two circles = two classes, but only a few of
the points are labeled

• GAN will learn that there are two circles and the
labeled points will help classify them as two classes
Ref: Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks, 2016

• Unsupervised GAN: Generator + Discriminator (Real vs. Fake)

• Supervised classifier: K classes

• Semi-supervised: Discriminator = Classifier into K+1 classes

• The first K classes are Real; the added (K+1) class is Fake

• Semi-supervised GAN: Generator + the new Discriminator/Classifier

Training
SSL with GANs: how?
• Discriminator is trained to assign:

- labeled data to correct classes

- unlabelled data to one of K classes

- generated data to (K+1) class
• Generator is trained to:

- produce images that the Discriminator
would assign to one of K classes
Ref: Good Semi-supervised Learning that Requires a Bad GAN, 2017

• State-of-the-art GANs achieve very impressive results (e.g.,
www.thispersondoesnotexist.com)

• However, the GANs used for semi-supervised learning do not
• To get a good classifier, the Generator should be “bad” = complement
(generates complement samples in feature space)
How good is the resulting Generator? 🤔
• Generating more points for the two circles would not
help us

• Generating Fake points between circles

→ better decision boundary between classes
Ref: Good Semi-supervised Learning that Requires a Bad GAN, 2017

• State-of-the-art GANs achieve very impressive results (e.g.,
www.thispersondoesnotexist.com)

• However, the GANs used for semi-supervised learning do not
• To get a good classifier, the Generator should be “bad” = complement
(generates complement samples in feature space)
How good is the resulting Generator? 🤔
• Generating more points for the two circles would not
help us

• Generating Fake points between circles

→ better decision boundary between classes
Ref: Good Semi-supervised Learning that Requires a Bad GAN, 2017

• State-of-the-art GANs achieve very impressive results (e.g.,
www.thispersondoesnotexist.com)

• However, the GANs used for semi-supervised learning do not
• To get a good classifier, the Generator should be “bad” = complement
(generates complement samples in feature space)
How good is the resulting Generator? 🤔
• Generating more points for the two circles would not
help us

• Generating Fake points between circles

→ better decision boundary between classes
Ref: Good Semi-supervised Learning that Requires a Bad GAN, 2017

• State-of-the-art GANs achieve very impressive results (e.g.,
www.thispersondoesnotexist.com)

• However, the GANs used for semi-supervised learning do not
• To get a good classifier, the Generator should be “bad” = complement
(generates complement samples in feature space)
How good is the resulting Generator? 🤔
• Generating more points for the two circles would not
help us

• Generating Fake points between circles

→ better decision boundary between classes
• Simple Generator + Classifier GAN has a problem:

Classifier has two conflicting goals, classifying Real and rejecting Fake
• Solution: Triple GAN = Generator + Discriminator + Classifier

Ref: Triple Generative Adversarial Nets, 2017 

• The Good, the Bad, and the GAN: 

get both a good Classifier and a good Generator (UGAN)

Ref: Semi-supervised Learning using Adversarial Training with Good and Bad
Samples, 2019
What is next?
Ref: Semi-supervised Learning using Adversarial Training with Good and Bad Samples, 2019
Results
Outline
1. Theory
A. Semi-supervised learning

B. Generative Adversarial Networks

C. Semi-supervised learning with GANs

2. Practice
A Tale of Cats and Dogs
Outline
1. Theory
A. Semi-supervised learning

B. Generative Adversarial Networks

C. Semi-supervised learning with GANs

2. Practice
A Tale of Cats and Dogs
• Let’s implement a simple SSL GAN: Generator + Classifier

• Dog vs. Cat binary classification

• Option I:

- add a third (Fake) class; increase dim_out of Classifier by one

- Unlabelled data: D wants to minimize probability of 3rd class

- Generated data: D wants to minimize probability of 1 and 2 classes, .
G wants to minimize probability of 3rd class

• Option II:

- do not increase dim_out of Classifier 

- output a strong class prediction for Real examples, and small class predictions for Fake examples



Ref: Improved Techniques for Training GANs, 2016, Unsupervised and Semi-supervised Learning with
Categorical Generative Adversarial Networks, 2016
Moral of the story: read the fine print
• Let’s implement a simple SSL GAN: Generator + Classifier

• Dog vs. Cat binary classification

• Option I:

- add a third (Fake) class; increase dim_out of Classifier by one

- Unlabelled data: D wants to minimize probability of 3rd class

- Generated data: D wants to minimize probability of 1 and 2 classes, .
G wants to minimize probability of 3rd class

• Option II:

- do not increase dim_out of Classifier 

- output a strong class prediction for Real examples, and small class predictions for Fake examples



Ref: Improved Techniques for Training GANs, 2016, Unsupervised and Semi-supervised Learning with
Categorical Generative Adversarial Networks, 2016
Moral of the story: read the fine print
• Let’s implement a simple SSL GAN: Generator + Classifier

• Dog vs. Cat binary classification

• Option I:

- add a third (Fake) class; increase dim_out of Classifier by one

- Unlabelled data: D wants to minimize probability of 3rd class

- Generated data: D wants to minimize probability of 1 and 2 classes, .
G wants to minimize probability of 3rd class

• Option II:

- do not increase dim_out of Classifier 

- output a strong class prediction for Real examples, and small class predictions for Fake examples



Ref: Improved Techniques for Training GANs, 2016, Unsupervised and Semi-supervised Learning with
Categorical Generative Adversarial Networks, 2016
Moral of the story: read the fine print
• Let’s implement a simple SSL GAN: Generator + Classifier

• Dog vs. Cat binary classification

• Option I:

- add a third (Fake) class; increase dim_out of Classifier by one

- Unlabelled data: D wants to minimize probability of 3rd class

- Generated data: D wants to minimize probability of 1 and 2 classes, .
G wants to minimize probability of 3rd class

• Option II:

- do not increase dim_out of Classifier 

- output a strong class prediction for Real examples, and small class predictions for Fake examples



Ref: Improved Techniques for Training GANs, 2016, Unsupervised and Semi-supervised Learning with
Categorical Generative Adversarial Networks, 2016
Moral of the story: read the fine print
https://github.com/opetrova/SemiSupervisedPytorchGAN

More Related Content

Similar to Semi-Supervised Learning with GANs by Olga Petrova, Machine Learning Engineer @Scaleway

Reading group gan - 20170417
Reading group   gan - 20170417Reading group   gan - 20170417
Reading group gan - 20170417Shuai Zhang
 
ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...
ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...
ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...宏毅 李
 
From Labelling Open data images to building a private recommender system
From Labelling Open data images to building a private recommender systemFrom Labelling Open data images to building a private recommender system
From Labelling Open data images to building a private recommender systemPierre Gutierrez
 
Generative Adversarial Networks 2
Generative Adversarial Networks 2Generative Adversarial Networks 2
Generative Adversarial Networks 2Alireza Shafaei
 
The Frontier of Deep Learning in 2020 and Beyond
The Frontier of Deep Learning in 2020 and BeyondThe Frontier of Deep Learning in 2020 and Beyond
The Frontier of Deep Learning in 2020 and BeyondNUS-ISS
 
Generative Adversarial Network (+Laplacian Pyramid GAN)
Generative Adversarial Network (+Laplacian Pyramid GAN)Generative Adversarial Network (+Laplacian Pyramid GAN)
Generative Adversarial Network (+Laplacian Pyramid GAN)NamHyuk Ahn
 
Search, Discovery and Questions at Quora
Search, Discovery and Questions at QuoraSearch, Discovery and Questions at Quora
Search, Discovery and Questions at QuoraNikhil Dandekar
 
Predict oscars (4:17)
Predict oscars (4:17)Predict oscars (4:17)
Predict oscars (4:17)Thinkful
 
brief Introduction to Different Kinds of GANs
brief Introduction to Different Kinds of GANsbrief Introduction to Different Kinds of GANs
brief Introduction to Different Kinds of GANsParham Zilouchian
 
Deep Dive to Learning to Rank for Graph Search.pptx
Deep Dive to Learning to Rank for Graph Search.pptxDeep Dive to Learning to Rank for Graph Search.pptx
Deep Dive to Learning to Rank for Graph Search.pptxanirudhk46
 
Generative Adversarial Networks and Their Applications
Generative Adversarial Networks and Their ApplicationsGenerative Adversarial Networks and Their Applications
Generative Adversarial Networks and Their ApplicationsArtifacia
 
Computer Vision image classification
Computer Vision image classificationComputer Vision image classification
Computer Vision image classificationWael Badawy
 
CM20315_01_Intro_Machine_Learning_ap.pptx
CM20315_01_Intro_Machine_Learning_ap.pptxCM20315_01_Intro_Machine_Learning_ap.pptx
CM20315_01_Intro_Machine_Learning_ap.pptxIgnajavier
 
CS 151 Classes lecture
CS 151 Classes lectureCS 151 Classes lecture
CS 151 Classes lectureRudy Martinez
 
GAN Deep Learning Approaches to Image Processing Applications (1).pptx
GAN Deep Learning Approaches to Image Processing Applications (1).pptxGAN Deep Learning Approaches to Image Processing Applications (1).pptx
GAN Deep Learning Approaches to Image Processing Applications (1).pptxRMDAcademicCoordinat
 
07-Classification.pptx
07-Classification.pptx07-Classification.pptx
07-Classification.pptxShree Shree
 
Knowledge Graph Embedding
Knowledge Graph EmbeddingKnowledge Graph Embedding
Knowledge Graph Embeddingssuserf2f0fe
 
20+ ways to Add Game-like Elements to Your Learning Designs
20+ ways to Add Game-like Elements to Your Learning Designs20+ ways to Add Game-like Elements to Your Learning Designs
20+ ways to Add Game-like Elements to Your Learning DesignsBrett Bixler
 
Generative Adversarial Network (GANs).
Generative  Adversarial  Network (GANs).Generative  Adversarial  Network (GANs).
Generative Adversarial Network (GANs).kgandham169
 
[CVPR 2018] Visual Search (Image Retrieval) and Metric Learning
[CVPR 2018] Visual Search (Image Retrieval) and Metric Learning[CVPR 2018] Visual Search (Image Retrieval) and Metric Learning
[CVPR 2018] Visual Search (Image Retrieval) and Metric LearningNAVER Engineering
 

Similar to Semi-Supervised Learning with GANs by Olga Petrova, Machine Learning Engineer @Scaleway (20)

Reading group gan - 20170417
Reading group   gan - 20170417Reading group   gan - 20170417
Reading group gan - 20170417
 
ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...
ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...
ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...
 
From Labelling Open data images to building a private recommender system
From Labelling Open data images to building a private recommender systemFrom Labelling Open data images to building a private recommender system
From Labelling Open data images to building a private recommender system
 
Generative Adversarial Networks 2
Generative Adversarial Networks 2Generative Adversarial Networks 2
Generative Adversarial Networks 2
 
The Frontier of Deep Learning in 2020 and Beyond
The Frontier of Deep Learning in 2020 and BeyondThe Frontier of Deep Learning in 2020 and Beyond
The Frontier of Deep Learning in 2020 and Beyond
 
Generative Adversarial Network (+Laplacian Pyramid GAN)
Generative Adversarial Network (+Laplacian Pyramid GAN)Generative Adversarial Network (+Laplacian Pyramid GAN)
Generative Adversarial Network (+Laplacian Pyramid GAN)
 
Search, Discovery and Questions at Quora
Search, Discovery and Questions at QuoraSearch, Discovery and Questions at Quora
Search, Discovery and Questions at Quora
 
Predict oscars (4:17)
Predict oscars (4:17)Predict oscars (4:17)
Predict oscars (4:17)
 
brief Introduction to Different Kinds of GANs
brief Introduction to Different Kinds of GANsbrief Introduction to Different Kinds of GANs
brief Introduction to Different Kinds of GANs
 
Deep Dive to Learning to Rank for Graph Search.pptx
Deep Dive to Learning to Rank for Graph Search.pptxDeep Dive to Learning to Rank for Graph Search.pptx
Deep Dive to Learning to Rank for Graph Search.pptx
 
Generative Adversarial Networks and Their Applications
Generative Adversarial Networks and Their ApplicationsGenerative Adversarial Networks and Their Applications
Generative Adversarial Networks and Their Applications
 
Computer Vision image classification
Computer Vision image classificationComputer Vision image classification
Computer Vision image classification
 
CM20315_01_Intro_Machine_Learning_ap.pptx
CM20315_01_Intro_Machine_Learning_ap.pptxCM20315_01_Intro_Machine_Learning_ap.pptx
CM20315_01_Intro_Machine_Learning_ap.pptx
 
CS 151 Classes lecture
CS 151 Classes lectureCS 151 Classes lecture
CS 151 Classes lecture
 
GAN Deep Learning Approaches to Image Processing Applications (1).pptx
GAN Deep Learning Approaches to Image Processing Applications (1).pptxGAN Deep Learning Approaches to Image Processing Applications (1).pptx
GAN Deep Learning Approaches to Image Processing Applications (1).pptx
 
07-Classification.pptx
07-Classification.pptx07-Classification.pptx
07-Classification.pptx
 
Knowledge Graph Embedding
Knowledge Graph EmbeddingKnowledge Graph Embedding
Knowledge Graph Embedding
 
20+ ways to Add Game-like Elements to Your Learning Designs
20+ ways to Add Game-like Elements to Your Learning Designs20+ ways to Add Game-like Elements to Your Learning Designs
20+ ways to Add Game-like Elements to Your Learning Designs
 
Generative Adversarial Network (GANs).
Generative  Adversarial  Network (GANs).Generative  Adversarial  Network (GANs).
Generative Adversarial Network (GANs).
 
[CVPR 2018] Visual Search (Image Retrieval) and Metric Learning
[CVPR 2018] Visual Search (Image Retrieval) and Metric Learning[CVPR 2018] Visual Search (Image Retrieval) and Metric Learning
[CVPR 2018] Visual Search (Image Retrieval) and Metric Learning
 

More from Paris Women in Machine Learning and Data Science

More from Paris Women in Machine Learning and Data Science (20)

Managing international tech teams, by Natasha Dimban
Managing international tech teams, by Natasha DimbanManaging international tech teams, by Natasha Dimban
Managing international tech teams, by Natasha Dimban
 
Optimizing GenAI apps, by N. El Mawass and Maria Knorps
Optimizing GenAI apps, by N. El Mawass and Maria KnorpsOptimizing GenAI apps, by N. El Mawass and Maria Knorps
Optimizing GenAI apps, by N. El Mawass and Maria Knorps
 
Perspectives, by M. Pannegeon
Perspectives, by M. PannegeonPerspectives, by M. Pannegeon
Perspectives, by M. Pannegeon
 
Evaluation strategies for dealing with partially labelled or unlabelled data
Evaluation strategies for dealing with partially labelled or unlabelled dataEvaluation strategies for dealing with partially labelled or unlabelled data
Evaluation strategies for dealing with partially labelled or unlabelled data
 
Combinatorial Optimisation with Policy Adaptation using latent Space Search, ...
Combinatorial Optimisation with Policy Adaptation using latent Space Search, ...Combinatorial Optimisation with Policy Adaptation using latent Space Search, ...
Combinatorial Optimisation with Policy Adaptation using latent Space Search, ...
 
An age-old question, by Caroline Jean-Pierre
An age-old question, by Caroline Jean-PierreAn age-old question, by Caroline Jean-Pierre
An age-old question, by Caroline Jean-Pierre
 
Applying Churn Prediction Approaches to the Telecom Industry, by Joëlle Lautré
Applying Churn Prediction Approaches to the Telecom Industry, by Joëlle LautréApplying Churn Prediction Approaches to the Telecom Industry, by Joëlle Lautré
Applying Churn Prediction Approaches to the Telecom Industry, by Joëlle Lautré
 
How to supervise a thesis in NLP in the ChatGPT era? By Laure Soulier
How to supervise a thesis in NLP in the ChatGPT era? By Laure SoulierHow to supervise a thesis in NLP in the ChatGPT era? By Laure Soulier
How to supervise a thesis in NLP in the ChatGPT era? By Laure Soulier
 
Global Ambitions Local Realities, by Anna Abreu
Global Ambitions Local Realities, by Anna AbreuGlobal Ambitions Local Realities, by Anna Abreu
Global Ambitions Local Realities, by Anna Abreu
 
Plug-and-Play methods for inverse problems in imagine, by Julie Delon
Plug-and-Play methods for inverse problems in imagine, by Julie DelonPlug-and-Play methods for inverse problems in imagine, by Julie Delon
Plug-and-Play methods for inverse problems in imagine, by Julie Delon
 
Sales Forecasting as a Data Product by Francesca Iannuzzi
Sales Forecasting as a Data Product by Francesca IannuzziSales Forecasting as a Data Product by Francesca Iannuzzi
Sales Forecasting as a Data Product by Francesca Iannuzzi
 
Identifying and mitigating bias in machine learning, by Ruta Binkyte
Identifying and mitigating bias in machine learning, by Ruta BinkyteIdentifying and mitigating bias in machine learning, by Ruta Binkyte
Identifying and mitigating bias in machine learning, by Ruta Binkyte
 
“Turning your ML algorithms into full web apps in no time with Python" by Mar...
“Turning your ML algorithms into full web apps in no time with Python" by Mar...“Turning your ML algorithms into full web apps in no time with Python" by Mar...
“Turning your ML algorithms into full web apps in no time with Python" by Mar...
 
Nature Language Processing for proteins by Amélie Héliou, Software Engineer @...
Nature Language Processing for proteins by Amélie Héliou, Software Engineer @...Nature Language Processing for proteins by Amélie Héliou, Software Engineer @...
Nature Language Processing for proteins by Amélie Héliou, Software Engineer @...
 
Sandrine Henry presents the BechdelAI project
Sandrine Henry presents the BechdelAI projectSandrine Henry presents the BechdelAI project
Sandrine Henry presents the BechdelAI project
 
Anastasiia Tryputen_War in Ukraine or how extraordinary courage reshapes geop...
Anastasiia Tryputen_War in Ukraine or how extraordinary courage reshapes geop...Anastasiia Tryputen_War in Ukraine or how extraordinary courage reshapes geop...
Anastasiia Tryputen_War in Ukraine or how extraordinary courage reshapes geop...
 
Khrystyna Grynko WiMLDS - From marketing to Tech.pdf
Khrystyna Grynko WiMLDS - From marketing to Tech.pdfKhrystyna Grynko WiMLDS - From marketing to Tech.pdf
Khrystyna Grynko WiMLDS - From marketing to Tech.pdf
 
Iana Iatsun_ML in production_20Dec2022.pdf
Iana Iatsun_ML in production_20Dec2022.pdfIana Iatsun_ML in production_20Dec2022.pdf
Iana Iatsun_ML in production_20Dec2022.pdf
 
41 WiMLDS Kyiv Paris Poznan.pdf
41 WiMLDS Kyiv Paris Poznan.pdf41 WiMLDS Kyiv Paris Poznan.pdf
41 WiMLDS Kyiv Paris Poznan.pdf
 
Emergency plan to secure winter: what are the measures set up by RTE?
Emergency plan to secure winter: what are the measures set up by RTE?Emergency plan to secure winter: what are the measures set up by RTE?
Emergency plan to secure winter: what are the measures set up by RTE?
 

Recently uploaded

Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 

Recently uploaded (20)

Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 

Semi-Supervised Learning with GANs by Olga Petrova, Machine Learning Engineer @Scaleway

  • 2. Semi-supervised learning with GANs or What happens when Dogs and Cats are left unsupervised Olga Petrova, ML Engineer
  • 3. Outline 1. Theory A. Semi-supervised learning B. Generative Adversarial Networks C. Semi-supervised learning with GANs 2. Practice A Tale of Cats and Dogs
  • 4. Outline 1. Theory A. Semi-supervised learning B. Generative Adversarial Networks C. Semi-supervised learning with GANs 2. Practice A Tale of Cats and Dogs
  • 5. Semi-Supervised Learning: what • Unsupervised learning (unlabelled training data): e.g. clustering, GAN • Supervised learning (labelled training data): e.g. regression, classification • Semi-supervised learning: - a subset of the training data is labeled - the rest is unlabelled - supervised learning tasks
  • 6. Semi-Supervised Learning: why • In practice, many tasks of interest come from supervised learning • Deep learning: models need a lot of training data • Labelling data is expensive • Unlabelled data: easier to collect • Semi-supervised learning: use unlabelled data to boost the performance of supervised ML models
  • 7. Outline 1. Theory A. Semi-supervised learning B. Generative Adversarial Networks C. Semi-supervised learning with GANs 2. Practice A Tale of Cats and Dogs
  • 8. GANs: Generative Adversarial NetworksGANs: Generative Adversarial Networks Ref: Ian Goodfellow et al., 2014 • Unsupervised learning: unlabelled training data (e.g., MNIST images) • Goal: generate data from the same distribution (e.g. new images that look like MNIST) • Generator: deConv network that generates an image from random input noise • Discriminator: binary classifier that is trained to accept Real images and reject Fake ones Image source
  • 9. GANs: Generative Adversarial Networks Ref: Ian Goodfellow et al., 2014 • Unsupervised learning: unlabelled training data (e.g., MNIST images) • Goal: generate data from the same distribution (e.g. new images that look like MNIST) • Generator: deConv network that generates an image from random input noise • Discriminator: binary classifier that is trained to accept Real images and reject Fake ones Image source
  • 10. GANs: Generative Adversarial Networks Ref: Ian Goodfellow et al., 2014 • Unsupervised learning: unlabelled training data (e.g., MNIST images) • Goal: generate data from the same distribution (e.g. new images that look like MNIST) • Generator: deConv network that generates an image from random input noise • Discriminator: binary classifier that is trained to accept Real images and reject Fake ones Image source
  • 11. GANs: Generative Adversarial Networks Ref: Ian Goodfellow et al., 2014 • Unsupervised learning: unlabelled training data (e.g., MNIST images) • Goal: generate data from the same distribution (e.g. new images that look like MNIST) • Generator: deConv network that generates an image from random input noise • Discriminator: binary classifier that is trained to accept Real images and reject Fake ones Image source
  • 12. GANs: Generative Adversarial Networks Ref: Ian Goodfellow et al., 2014 Training of the Discriminator • Straightforward binary classification (Real for the training set, Fake for the generated images) Training of the Generator • We pass the generated image as input to the Discriminator • If the image is classified as Fake, we adjust the Generator to produce better images Image source
  • 13. Ref: Ian Goodfellow et al., 2014 • In practice: G and D are trained separately, one after another, for each batch: GANs: Generative Adversarial Networks Pytorch GAN tutorial
  • 14. Ref: Ian Goodfellow et al., 2014 • Real data: x ~ p(x) • Generated data: x ~ pG(x) (Actually, x ~ pG(x|z)) • Goal: pG(x) ≈ p(x) • Discriminator D is trained to assign the correct label (Real vs Fake) • Generator G is trained to produce images that will fool the Discriminator D GANs: Generative Adversarial Networks
  • 15. Outline 1. Theory A. Semi-supervised learning B. Generative Adversarial Networks C. Semi-supervised learning with GANs 2. Practice A Tale of Cats and Dogs
  • 16. Ref: Improved Techniques for Training GANs, 2016 Basic idea: • Our training data has a certain distribution • The GAN will attempt to learn that distribution • ≈ “clustering” + using the labeled samples to assign labels to classes Semi-supervised learning with GANs Example: • 2D data: two circles = two classes, but only a few of the points are labeled • GAN will learn that there are two circles and the labeled points will help classify them as two classes
  • 17. Ref: Improved Techniques for Training GANs, 2016 Basic idea: • Our training data has a certain distribution • The GAN will attempt to learn that distribution • ≈ “clustering” + using the labeled samples to assign labels to classes Semi-supervised learning with GANs Example: • 2D data: two circles = two classes, but only a few of the points are labeled • GAN will learn that there are two circles and the labeled points will help classify them as two classes
  • 18. Ref: Improved Techniques for Training GANs, 2016 Basic idea: • Our training data has a certain distribution • The GAN will attempt to learn that distribution • ≈ “clustering” + using the labeled samples to assign labels to classes Semi-supervised learning with GANs Example: • 2D data: two circles = two classes, but only a few of the points are labeled • GAN will learn that there are two circles and the labeled points will help classify them as two classes
  • 19. Ref: Improved Techniques for Training GANs, 2016 Basic idea: • Our training data has a certain distribution • The GAN will attempt to learn that distribution • ≈ “clustering” + using the labeled samples to assign labels to classes Semi-supervised learning with GANs Example: • 2D data: two circles = two classes, but only a few of the points are labeled • GAN will learn that there are two circles and the labeled points will help classify them as two classes
  • 20. Ref: Improved Techniques for Training GANs, 2016 Basic idea: • Our training data has a certain distribution • The GAN will attempt to learn that distribution • ≈ “clustering” + using the labeled samples to assign labels to classes Semi-supervised learning with GANs Example: • 2D data: two circles = two classes, but only a few of the points are labeled • GAN will learn that there are two circles and the labeled points will help classify them as two classes
  • 21. Ref: Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks, 2016 • Unsupervised GAN: Generator + Discriminator (Real vs. Fake) • Supervised classifier: K classes • Semi-supervised: Discriminator = Classifier into K+1 classes • The first K classes are Real; the added (K+1) class is Fake • Semi-supervised GAN: Generator + the new Discriminator/Classifier Training SSL with GANs: how? • Discriminator is trained to assign: - labeled data to correct classes - unlabelled data to one of K classes - generated data to (K+1) class • Generator is trained to: - produce images that the Discriminator would assign to one of K classes
  • 22. Ref: Good Semi-supervised Learning that Requires a Bad GAN, 2017 • State-of-the-art GANs achieve very impressive results (e.g., www.thispersondoesnotexist.com) • However, the GANs used for semi-supervised learning do not • To get a good classifier, the Generator should be “bad” = complement (generates complement samples in feature space) How good is the resulting Generator? 🤔 • Generating more points for the two circles would not help us • Generating Fake points between circles → better decision boundary between classes
  • 23. Ref: Good Semi-supervised Learning that Requires a Bad GAN, 2017 • State-of-the-art GANs achieve very impressive results (e.g., www.thispersondoesnotexist.com) • However, the GANs used for semi-supervised learning do not • To get a good classifier, the Generator should be “bad” = complement (generates complement samples in feature space) How good is the resulting Generator? 🤔 • Generating more points for the two circles would not help us • Generating Fake points between circles → better decision boundary between classes
  • 24. Ref: Good Semi-supervised Learning that Requires a Bad GAN, 2017 • State-of-the-art GANs achieve very impressive results (e.g., www.thispersondoesnotexist.com) • However, the GANs used for semi-supervised learning do not • To get a good classifier, the Generator should be “bad” = complement (generates complement samples in feature space) How good is the resulting Generator? 🤔 • Generating more points for the two circles would not help us • Generating Fake points between circles → better decision boundary between classes
  • 25. Ref: Good Semi-supervised Learning that Requires a Bad GAN, 2017 • State-of-the-art GANs achieve very impressive results (e.g., www.thispersondoesnotexist.com) • However, the GANs used for semi-supervised learning do not • To get a good classifier, the Generator should be “bad” = complement (generates complement samples in feature space) How good is the resulting Generator? 🤔 • Generating more points for the two circles would not help us • Generating Fake points between circles → better decision boundary between classes
  • 26. • Simple Generator + Classifier GAN has a problem: Classifier has two conflicting goals, classifying Real and rejecting Fake • Solution: Triple GAN = Generator + Discriminator + Classifier Ref: Triple Generative Adversarial Nets, 2017 • The Good, the Bad, and the GAN: get both a good Classifier and a good Generator (UGAN) Ref: Semi-supervised Learning using Adversarial Training with Good and Bad Samples, 2019 What is next?
  • 27. Ref: Semi-supervised Learning using Adversarial Training with Good and Bad Samples, 2019 Results
  • 28. Outline 1. Theory A. Semi-supervised learning B. Generative Adversarial Networks C. Semi-supervised learning with GANs 2. Practice A Tale of Cats and Dogs
  • 29. Outline 1. Theory A. Semi-supervised learning B. Generative Adversarial Networks C. Semi-supervised learning with GANs 2. Practice A Tale of Cats and Dogs
  • 30. • Let’s implement a simple SSL GAN: Generator + Classifier • Dog vs. Cat binary classification • Option I: - add a third (Fake) class; increase dim_out of Classifier by one - Unlabelled data: D wants to minimize probability of 3rd class - Generated data: D wants to minimize probability of 1 and 2 classes, . G wants to minimize probability of 3rd class • Option II: - do not increase dim_out of Classifier - output a strong class prediction for Real examples, and small class predictions for Fake examples Ref: Improved Techniques for Training GANs, 2016, Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks, 2016 Moral of the story: read the fine print
  • 31. • Let’s implement a simple SSL GAN: Generator + Classifier • Dog vs. Cat binary classification • Option I: - add a third (Fake) class; increase dim_out of Classifier by one - Unlabelled data: D wants to minimize probability of 3rd class - Generated data: D wants to minimize probability of 1 and 2 classes, . G wants to minimize probability of 3rd class • Option II: - do not increase dim_out of Classifier - output a strong class prediction for Real examples, and small class predictions for Fake examples Ref: Improved Techniques for Training GANs, 2016, Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks, 2016 Moral of the story: read the fine print
  • 32. • Let’s implement a simple SSL GAN: Generator + Classifier • Dog vs. Cat binary classification • Option I: - add a third (Fake) class; increase dim_out of Classifier by one - Unlabelled data: D wants to minimize probability of 3rd class - Generated data: D wants to minimize probability of 1 and 2 classes, . G wants to minimize probability of 3rd class • Option II: - do not increase dim_out of Classifier - output a strong class prediction for Real examples, and small class predictions for Fake examples Ref: Improved Techniques for Training GANs, 2016, Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks, 2016 Moral of the story: read the fine print
  • 33. • Let’s implement a simple SSL GAN: Generator + Classifier • Dog vs. Cat binary classification • Option I: - add a third (Fake) class; increase dim_out of Classifier by one - Unlabelled data: D wants to minimize probability of 3rd class - Generated data: D wants to minimize probability of 1 and 2 classes, . G wants to minimize probability of 3rd class • Option II: - do not increase dim_out of Classifier - output a strong class prediction for Real examples, and small class predictions for Fake examples Ref: Improved Techniques for Training GANs, 2016, Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks, 2016 Moral of the story: read the fine print