SlideShare a Scribd company logo
Generative Modeling with
Convolutional Neural Networks
Denis Dus
Lead Data Scientist at InData Labs
What we will discuss
1. Discriminative vs Generative modeling
2. Convolutional Neural Networks
3. How to train a neural network to fool a discriminative deep
learning model?
4. How to train a neural network to produce photorealistic
images?
5. What difficulties can we face and how to avoid them?
6. How could GAN framework be used to solve real problems?
Data Modeling
Discriminative model
Goal - to find a separating surface of classes
A posterior distribution is calculated P(y|x; θ)
Example: Logistic regression
Generative model
Goal - to recover the joint distribution P(x, y; θ)
P(y|x) = P(x, y; θ) / P(x) = P(y)P(x|y; θ) / P(x)
Example: Naive bayes
Discriminative vs Generative
CNNs: Motivation
Operation of discrete two-dimensional convolution:
CNNs: Motivation
CNNs: Motivation
We are aiming:
● to find weights of filters based on data
● to achieve invariance to small distortions
Having:
● specified network architecture
● training data (X, Y)
● loss function L
We can optimize weights of filters to minimize the error value L by
(X,Y).
CNNs: Pooling
Operation of spatial subsampling (pooling):
● doesn’t have trainable parameters
● reduces convolutions activation maps in spatial dimensions
● makes filters more invariant to small distortions
● Alternative: Conv2D + Stride > 1
CNNs: Architectures
1. Typical architecture of Convolutional Neural Networks
2. Variations
3. Tendencies
A. Fully Convolutional Networks
B. Reduction of the number of parameters and computational
complexity
INPUT→[[CONV→ReLU] * N→POOL?] * M→[FC→ReLU] * K→FC
ResNet / Inception / …
CNNs: VGG16
CNNs: VGG16 Graph
224x224x64 ≈ 3.2 mln activations ≈ 103 mln parameters
Convolutional part
(feature extraction)
CNNs: Hierarchical Representation
CNNs: Hierarchical Representation
CNNs: Imagenet
https://m2dsupsdlclass.github.io
Generative CNNs: Idea
1. The joint distribution of image pixels is very complex.
2. It is impossible to approximate it with classical methods.
3. We’ll look for a parametric transformation of the following type:
Generative CNNs: Idea
● We have strong discriminative networks
D(x): VGG-16, ResNet-50, …
● Weights of the networks trained on ImageNet dataset are
publicly available
https://github.com/fchollet/deep-learning-models
● If you have such network, for every image x you can get
Generative CNNs: Idea
Let’s look for G(z|θ) so that D(G(z|θ)) is close to predefined distribution.
What should you do to generate images for the class “Cup”?
Generative CNNs: Practice - VGG -16
Before training the transformation G(z|θ)
Generative CNNs: Practice - VGG -16
After training the transformation G(z|θ)
Generative CNNs: Practice - ResNet-50
Before training the transformation G(z|θ)
Generative CNNs: Practice - ResNet-50
After training the transformation G(z|θ)
Generative CNNs: Bad News
● How many images of shape 224x224 pixel exists?
● Natural images are only a small part of this number
● In the statement of the problem, we did not require
“naturalness” from G(z|θ)!
● Only a predetermined classification was required
CNNs: Hack’em all!
Let’s consider the following optimization problem
CNNs: Hack’em all - ResNet-50
CNNs: Hack’em all - GoogLeNet
CNNs: Adversarial Attack Competition
Generative Adversarial Networks
The statement of the problem lacks the requirement of image
“naturalness”. Let’s add it:
Generative Adversarial Networks
GAN: Discriminator
GAN: Generator
GAN Framework: Real Data
GAN Framework: Generator Evolution
GAN: Difficulties
1. Generation of large-sized images (more than 128x128 pixels)
2. The variability of real-world images
3. There is no guarantee that the game converges to an
equilibrium state
4. It is difficult to keep D(x) and G(z) “on the same quality level”
5. Initially, D(x) has a very simple problem (in comparison with G(z))
6. Quality assessment of G(z)
GAN: State of the Art
GAN: State of the Art
GAN: Variability and Size
GAN: Designing the D(x)
1. Normalize the input images in [-1.0, 1.0]
2. Should have less parameters than G(x)
3. Use Dropout/Spatial Dropout
4. 2x2 MaxPooling→Convolution2D + Stride = 2
5. ReLU→LeakyReLU/ELU (SELU?)
6. Adaptive L2 regularization
7. Label Smoothing
8. Instance Noise
9. Balancing of the min-max the game
https://github.com/soumith/ganhacks
Ian Goodfellow, Improved Techniques of Training GANs
GAN: Designing the G(x)
1. Tanh on the last layer
2. min log(1-D(G(z))→max log(D(G(z))
3. Should have more parameters than D(x)
4. Use Dropout/Spatial Dropout
5. UpSampling2D/Deconvoluniun2D
6. ReLU→LeakyReLU/ELU
7. Batch Normalization (SELU?)
https://github.com/soumith/ganhacks
Ian Goodfellow, Improved Techniques of Training GANs
GAN: Image Segmentation
● One of the main Computer Vision tasks
● Optimization uses per-pixel loss functions
GAN: Image Segmentation
● The optimization uses per-pixel loss functions
● Per-pixel losses do not reflect many aspects of
segmentation quality
https://github.com/alexgkendall/SegNet-Tutorial
GAN: Image Segmentation
GAN: Image Segmentation
Many other interesting things
1. Types of GAN: Conditional Gan, Stacked GAN, Cycle GAN, …
2. Alternative models: VAE, Pix2Pix, ...
3. Other areas of application: generation of text/audio/video
4. Other practical tasks: Image Super-Resolution, ...
Summary
1. Convolutional neural networks perfectly cope with the CV
tasks
2. But there is a serious problem with “Adversarial Examples”
3. GAN - is a very interesting idea at the intersection of areas
of mathematics
4. GAN is not only fun, but also useful
5. Future improvements in this area are expected
Thank you!
Denis Dus
Lead Data Scientist
d_dus@indatalabs.com
facebook: dzianis.dus
www.indatalabs.com @indatalabs @indatalabs

More Related Content

What's hot (20)

PPTX
Generative Adversarial Networks (GAN)
Manohar Mukku
 
PDF
Deep Learning for Computer Vision: Generative models and adversarial training...
Universitat Politècnica de Catalunya
 
PDF
Deep Generative Models II (DLAI D10L1 2017 UPC Deep Learning for Artificial I...
Universitat Politècnica de Catalunya
 
PDF
MLIP - Chapter 3 - Introduction to deep learning
Charles Deledalle
 
PDF
MLIP - Chapter 2 - Preliminaries to deep learning
Charles Deledalle
 
PDF
Generative adversarial networks
Yunjey Choi
 
PDF
MLIP - Chapter 6 - Generation, Super-Resolution, Style transfer
Charles Deledalle
 
PDF
Chapter 1 - Introduction
Charles Deledalle
 
PDF
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
NAVER Engineering
 
PDF
Introduction to Generative Adversarial Networks
BennoG1
 
PDF
[PR12] PR-036 Learning to Remember Rare Events
Taegyun Jeon
 
PDF
Backpropagation (DLAI D3L1 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
 
PDF
The Perceptron - Xavier Giro-i-Nieto - UPC Barcelona 2018
Universitat Politècnica de Catalunya
 
PDF
Generative Models and Adversarial Training (D3L4 2017 UPC Deep Learning for ...
Universitat Politècnica de Catalunya
 
PDF
Convolutional Neural Networks (DLAI D5L1 2017 UPC Deep Learning for Artificia...
Universitat Politècnica de Catalunya
 
PDF
Unsupervised learning represenation with DCGAN
Shyam Krishna Khadka
 
PDF
DRAW: Deep Recurrent Attentive Writer
Mark Chang
 
PDF
PixelCNN, Wavenet, Normalizing Flows - Santiago Pascual - UPC Barcelona 2018
Universitat Politècnica de Catalunya
 
PDF
The Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
 
PDF
Generative adversarial networks
남주 김
 
Generative Adversarial Networks (GAN)
Manohar Mukku
 
Deep Learning for Computer Vision: Generative models and adversarial training...
Universitat Politècnica de Catalunya
 
Deep Generative Models II (DLAI D10L1 2017 UPC Deep Learning for Artificial I...
Universitat Politècnica de Catalunya
 
MLIP - Chapter 3 - Introduction to deep learning
Charles Deledalle
 
MLIP - Chapter 2 - Preliminaries to deep learning
Charles Deledalle
 
Generative adversarial networks
Yunjey Choi
 
MLIP - Chapter 6 - Generation, Super-Resolution, Style transfer
Charles Deledalle
 
Chapter 1 - Introduction
Charles Deledalle
 
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
NAVER Engineering
 
Introduction to Generative Adversarial Networks
BennoG1
 
[PR12] PR-036 Learning to Remember Rare Events
Taegyun Jeon
 
Backpropagation (DLAI D3L1 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
 
The Perceptron - Xavier Giro-i-Nieto - UPC Barcelona 2018
Universitat Politècnica de Catalunya
 
Generative Models and Adversarial Training (D3L4 2017 UPC Deep Learning for ...
Universitat Politècnica de Catalunya
 
Convolutional Neural Networks (DLAI D5L1 2017 UPC Deep Learning for Artificia...
Universitat Politècnica de Catalunya
 
Unsupervised learning represenation with DCGAN
Shyam Krishna Khadka
 
DRAW: Deep Recurrent Attentive Writer
Mark Chang
 
PixelCNN, Wavenet, Normalizing Flows - Santiago Pascual - UPC Barcelona 2018
Universitat Politècnica de Catalunya
 
The Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intelligence)
Universitat Politècnica de Catalunya
 
Generative adversarial networks
남주 김
 

Similar to Generative modeling with Convolutional Neural Networks (20)

PDF
EuroSciPy 2019 - GANs: Theory and Applications
Emanuele Ghelfi
 
PDF
[AI07] Revolutionizing Image Processing with Cognitive Toolkit
de:code 2017
 
PDF
Introduction to Applied Machine Learning
SheilaJimenezMorejon
 
PDF
gans_copy.pdfhjsjsisidkskskkskwkduydjekedj
fahid32446
 
PDF
Introduction to Generative Adversarial Network
vaidehimadaan041
 
PPTX
Introduction to Deep Learning and Tensorflow
Oswald Campesato
 
PDF
gan.pdf
Dr.rukmani Devi
 
PDF
Deep Generative Modelling
Petko Nikolov
 
PDF
"Let us talk about output features! by Florence d’Alché-Buc, LTCI & Full Prof...
Paris Women in Machine Learning and Data Science
 
PPTX
Module4_GAN.pptxgdgdijehejejjejejejhehjdd
HrushikeshDandu
 
PPTX
Android and Deep Learning
Oswald Campesato
 
PPTX
presentation of IntroductionDeepLearning.pptx
andani26
 
PPTX
GAN Deep Learning Approaches to Image Processing Applications (1).pptx
RMDAcademicCoordinat
 
PDF
Tutorial on Theory and Application of Generative Adversarial Networks
MLReview
 
PPTX
Diving into Deep Learning (Silicon Valley Code Camp 2017)
Oswald Campesato
 
PPT
one shot15729752 Deep Learning for AI and DS
ManiMaran230751
 
PPTX
Keras on tensorflow in R & Python
Longhow Lam
 
PDF
Master defence 2020 - Vadym Korshunov - Region-Selected Image Generation with...
Lviv Data Science Summer School
 
PDF
Neo4j MeetUp - Graph Exploration with MetaExp
Adrian Ziegler
 
PDF
Learning in Networks: were Pavlov and Hebb right?
Victor Miagkikh
 
EuroSciPy 2019 - GANs: Theory and Applications
Emanuele Ghelfi
 
[AI07] Revolutionizing Image Processing with Cognitive Toolkit
de:code 2017
 
Introduction to Applied Machine Learning
SheilaJimenezMorejon
 
gans_copy.pdfhjsjsisidkskskkskwkduydjekedj
fahid32446
 
Introduction to Generative Adversarial Network
vaidehimadaan041
 
Introduction to Deep Learning and Tensorflow
Oswald Campesato
 
Deep Generative Modelling
Petko Nikolov
 
"Let us talk about output features! by Florence d’Alché-Buc, LTCI & Full Prof...
Paris Women in Machine Learning and Data Science
 
Module4_GAN.pptxgdgdijehejejjejejejhehjdd
HrushikeshDandu
 
Android and Deep Learning
Oswald Campesato
 
presentation of IntroductionDeepLearning.pptx
andani26
 
GAN Deep Learning Approaches to Image Processing Applications (1).pptx
RMDAcademicCoordinat
 
Tutorial on Theory and Application of Generative Adversarial Networks
MLReview
 
Diving into Deep Learning (Silicon Valley Code Camp 2017)
Oswald Campesato
 
one shot15729752 Deep Learning for AI and DS
ManiMaran230751
 
Keras on tensorflow in R & Python
Longhow Lam
 
Master defence 2020 - Vadym Korshunov - Region-Selected Image Generation with...
Lviv Data Science Summer School
 
Neo4j MeetUp - Graph Exploration with MetaExp
Adrian Ziegler
 
Learning in Networks: were Pavlov and Hebb right?
Victor Miagkikh
 
Ad

More from Denis Dus (7)

PDF
Probabilistic modeling in deep learning
Denis Dus
 
PDF
Sequence prediction with TensorFlow
Denis Dus
 
PDF
Reproducibility and automation of machine learning process
Denis Dus
 
PDF
Assignment of arbitrarily distributed random samples to the fixed probability...
Denis Dus
 
PDF
word2vec (часть 2)
Denis Dus
 
PPTX
word2vec (part 1)
Denis Dus
 
PPTX
Using spark 1.2 with Java 8 and Cassandra
Denis Dus
 
Probabilistic modeling in deep learning
Denis Dus
 
Sequence prediction with TensorFlow
Denis Dus
 
Reproducibility and automation of machine learning process
Denis Dus
 
Assignment of arbitrarily distributed random samples to the fixed probability...
Denis Dus
 
word2vec (часть 2)
Denis Dus
 
word2vec (part 1)
Denis Dus
 
Using spark 1.2 with Java 8 and Cassandra
Denis Dus
 
Ad

Recently uploaded (20)

PPTX
办理学历认证InformaticsLetter新加坡英华美学院毕业证书,Informatics成绩单
Taqyea
 
PDF
CT-2-Ancient ancient accept-Criticism.pdf
DepartmentofEnglishC1
 
PPTX
Feb 2021 Ransomware Recovery presentation.pptx
enginsayin1
 
PDF
A Web Repository System for Data Mining in Drug Discovery
IJDKP
 
PPTX
Generative AI Boost Data Governance and Quality- Tejasvi Addagada
Tejasvi Addagada
 
PPTX
Artificial intelligence Presentation1.pptx
SaritaMahajan5
 
PDF
Exploiting the Low Volatility Anomaly: A Low Beta Model Portfolio for Risk-Ad...
Bradley Norbom, CFA
 
PPTX
Cultural Diversity Presentation.pptx
Shwong11
 
PDF
GOOGLE ADS (1).pdf THE ULTIMATE GUIDE TO
kushalkeshwanisou
 
PDF
TCU EVALUATION FACULTY TCU Taguig City 1st Semester 2017-2018
MELJUN CORTES
 
PPTX
How to Add Columns and Rows in an R Data Frame
subhashenia
 
PPTX
covid 19 data analysis updates in our municipality
RhuAyungon1
 
PPTX
Presentation abdominal distension (1).pptx
ChZiaullah
 
PPTX
Data Analytics using sparkabcdefghi.pptx
KarkuzhaliS3
 
PDF
5991-5857_Agilent_MS_Theory_EN (1).pdf. pdf
NohaSalah45
 
DOCX
ACCOMPLISHMENT AS OF MAY 15 RCT ACCOMPLISHMENT AS OF MAY 15 RCT ACCOMPLISHMEN...
JoemarAgbayani1
 
PDF
Business Automation Solution with Excel 1.1.pdf
Vivek Kedia
 
PPTX
在线购买英国本科毕业证苏格兰皇家音乐学院水印成绩单RSAMD学费发票
Taqyea
 
PPTX
big data eco system fundamentals of data science
arivukarasi
 
PPTX
MENU-DRIVEN PROGRAM ON ARUNACHAL PRADESH.pptx
manvi200807
 
办理学历认证InformaticsLetter新加坡英华美学院毕业证书,Informatics成绩单
Taqyea
 
CT-2-Ancient ancient accept-Criticism.pdf
DepartmentofEnglishC1
 
Feb 2021 Ransomware Recovery presentation.pptx
enginsayin1
 
A Web Repository System for Data Mining in Drug Discovery
IJDKP
 
Generative AI Boost Data Governance and Quality- Tejasvi Addagada
Tejasvi Addagada
 
Artificial intelligence Presentation1.pptx
SaritaMahajan5
 
Exploiting the Low Volatility Anomaly: A Low Beta Model Portfolio for Risk-Ad...
Bradley Norbom, CFA
 
Cultural Diversity Presentation.pptx
Shwong11
 
GOOGLE ADS (1).pdf THE ULTIMATE GUIDE TO
kushalkeshwanisou
 
TCU EVALUATION FACULTY TCU Taguig City 1st Semester 2017-2018
MELJUN CORTES
 
How to Add Columns and Rows in an R Data Frame
subhashenia
 
covid 19 data analysis updates in our municipality
RhuAyungon1
 
Presentation abdominal distension (1).pptx
ChZiaullah
 
Data Analytics using sparkabcdefghi.pptx
KarkuzhaliS3
 
5991-5857_Agilent_MS_Theory_EN (1).pdf. pdf
NohaSalah45
 
ACCOMPLISHMENT AS OF MAY 15 RCT ACCOMPLISHMENT AS OF MAY 15 RCT ACCOMPLISHMEN...
JoemarAgbayani1
 
Business Automation Solution with Excel 1.1.pdf
Vivek Kedia
 
在线购买英国本科毕业证苏格兰皇家音乐学院水印成绩单RSAMD学费发票
Taqyea
 
big data eco system fundamentals of data science
arivukarasi
 
MENU-DRIVEN PROGRAM ON ARUNACHAL PRADESH.pptx
manvi200807
 

Generative modeling with Convolutional Neural Networks

  • 1. Generative Modeling with Convolutional Neural Networks Denis Dus Lead Data Scientist at InData Labs
  • 2. What we will discuss 1. Discriminative vs Generative modeling 2. Convolutional Neural Networks 3. How to train a neural network to fool a discriminative deep learning model? 4. How to train a neural network to produce photorealistic images? 5. What difficulties can we face and how to avoid them? 6. How could GAN framework be used to solve real problems?
  • 3. Data Modeling Discriminative model Goal - to find a separating surface of classes A posterior distribution is calculated P(y|x; θ) Example: Logistic regression Generative model Goal - to recover the joint distribution P(x, y; θ) P(y|x) = P(x, y; θ) / P(x) = P(y)P(x|y; θ) / P(x) Example: Naive bayes
  • 5. CNNs: Motivation Operation of discrete two-dimensional convolution:
  • 7. CNNs: Motivation We are aiming: ● to find weights of filters based on data ● to achieve invariance to small distortions Having: ● specified network architecture ● training data (X, Y) ● loss function L We can optimize weights of filters to minimize the error value L by (X,Y).
  • 8. CNNs: Pooling Operation of spatial subsampling (pooling): ● doesn’t have trainable parameters ● reduces convolutions activation maps in spatial dimensions ● makes filters more invariant to small distortions ● Alternative: Conv2D + Stride > 1
  • 9. CNNs: Architectures 1. Typical architecture of Convolutional Neural Networks 2. Variations 3. Tendencies A. Fully Convolutional Networks B. Reduction of the number of parameters and computational complexity INPUT→[[CONV→ReLU] * N→POOL?] * M→[FC→ReLU] * K→FC ResNet / Inception / …
  • 11. CNNs: VGG16 Graph 224x224x64 ≈ 3.2 mln activations ≈ 103 mln parameters Convolutional part (feature extraction)
  • 15. Generative CNNs: Idea 1. The joint distribution of image pixels is very complex. 2. It is impossible to approximate it with classical methods. 3. We’ll look for a parametric transformation of the following type:
  • 16. Generative CNNs: Idea ● We have strong discriminative networks D(x): VGG-16, ResNet-50, … ● Weights of the networks trained on ImageNet dataset are publicly available https://github.com/fchollet/deep-learning-models ● If you have such network, for every image x you can get
  • 17. Generative CNNs: Idea Let’s look for G(z|θ) so that D(G(z|θ)) is close to predefined distribution. What should you do to generate images for the class “Cup”?
  • 18. Generative CNNs: Practice - VGG -16 Before training the transformation G(z|θ)
  • 19. Generative CNNs: Practice - VGG -16 After training the transformation G(z|θ)
  • 20. Generative CNNs: Practice - ResNet-50 Before training the transformation G(z|θ)
  • 21. Generative CNNs: Practice - ResNet-50 After training the transformation G(z|θ)
  • 22. Generative CNNs: Bad News ● How many images of shape 224x224 pixel exists? ● Natural images are only a small part of this number ● In the statement of the problem, we did not require “naturalness” from G(z|θ)! ● Only a predetermined classification was required
  • 23. CNNs: Hack’em all! Let’s consider the following optimization problem
  • 24. CNNs: Hack’em all - ResNet-50
  • 25. CNNs: Hack’em all - GoogLeNet
  • 27. Generative Adversarial Networks The statement of the problem lacks the requirement of image “naturalness”. Let’s add it:
  • 33. GAN: Difficulties 1. Generation of large-sized images (more than 128x128 pixels) 2. The variability of real-world images 3. There is no guarantee that the game converges to an equilibrium state 4. It is difficult to keep D(x) and G(z) “on the same quality level” 5. Initially, D(x) has a very simple problem (in comparison with G(z)) 6. Quality assessment of G(z)
  • 34. GAN: State of the Art
  • 35. GAN: State of the Art
  • 37. GAN: Designing the D(x) 1. Normalize the input images in [-1.0, 1.0] 2. Should have less parameters than G(x) 3. Use Dropout/Spatial Dropout 4. 2x2 MaxPooling→Convolution2D + Stride = 2 5. ReLU→LeakyReLU/ELU (SELU?) 6. Adaptive L2 regularization 7. Label Smoothing 8. Instance Noise 9. Balancing of the min-max the game https://github.com/soumith/ganhacks Ian Goodfellow, Improved Techniques of Training GANs
  • 38. GAN: Designing the G(x) 1. Tanh on the last layer 2. min log(1-D(G(z))→max log(D(G(z)) 3. Should have more parameters than D(x) 4. Use Dropout/Spatial Dropout 5. UpSampling2D/Deconvoluniun2D 6. ReLU→LeakyReLU/ELU 7. Batch Normalization (SELU?) https://github.com/soumith/ganhacks Ian Goodfellow, Improved Techniques of Training GANs
  • 39. GAN: Image Segmentation ● One of the main Computer Vision tasks ● Optimization uses per-pixel loss functions
  • 40. GAN: Image Segmentation ● The optimization uses per-pixel loss functions ● Per-pixel losses do not reflect many aspects of segmentation quality https://github.com/alexgkendall/SegNet-Tutorial
  • 43. Many other interesting things 1. Types of GAN: Conditional Gan, Stacked GAN, Cycle GAN, … 2. Alternative models: VAE, Pix2Pix, ... 3. Other areas of application: generation of text/audio/video 4. Other practical tasks: Image Super-Resolution, ...
  • 44. Summary 1. Convolutional neural networks perfectly cope with the CV tasks 2. But there is a serious problem with “Adversarial Examples” 3. GAN - is a very interesting idea at the intersection of areas of mathematics 4. GAN is not only fun, but also useful 5. Future improvements in this area are expected
  • 45. Thank you! Denis Dus Lead Data Scientist [email protected] facebook: dzianis.dus www.indatalabs.com @indatalabs @indatalabs