SlideShare a Scribd company logo
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

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 ...
宏毅 李
 
Predict oscars (4:17)
Predict oscars (4:17)Predict oscars (4:17)
Predict oscars (4:17)
Thinkful
 
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
RMDAcademicCoordinat
 
07-Classification.pptx
07-Classification.pptx07-Classification.pptx
07-Classification.pptx
Shree Shree
 

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)

Sequential and reinforcement learning for demand side management by Margaux B...
Sequential and reinforcement learning for demand side management by Margaux B...Sequential and reinforcement learning for demand side management by Margaux B...
Sequential and reinforcement learning for demand side management by Margaux B...
 
How and why AI should fight cybersexism, by Chloe Daudier
How and why AI should fight cybersexism, by Chloe DaudierHow and why AI should fight cybersexism, by Chloe Daudier
How and why AI should fight cybersexism, by Chloe Daudier
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
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
 

Recently uploaded

Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
Kamal Acharya
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
Kamal Acharya
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
Kamal Acharya
 

Recently uploaded (20)

Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
 
Peek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdfPeek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answer
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxThe Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data Stream
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data StreamKIT-601 Lecture Notes-UNIT-3.pdf Mining Data Stream
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data Stream
 
Pharmacy management system project report..pdf
Pharmacy management system project report..pdfPharmacy management system project report..pdf
Pharmacy management system project report..pdf
 

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