SlideShare a Scribd company logo
Generative Adversarial
Networks
Rubens Zimbres
Data Scientist
Machine Learning for IoT at Vecto Mobile
Generative
Models
Discriminative
Models
Game Theory
Prisoner’s
Dillemma
Nash Equilibrium
Rational choice
Bounded
Rationality
Non cooperative
Game
Training GANs
Some examples
+ Noise
Player 1 (D)
Player 2 (G)
Generative Models
• Probabilistic, samples from joint distribution P(x,y)
• Generate samples (latent variables) following a distribution
• Maximum Likelihood
• Range of values belong to a class
Generative Models
• Latent Dirichlet Allocation (NLP)
• Mixture Gaussians
• Hidden Markov Model
• VAE
• RBM
• GANs
Mixture of Gaussians
X
X
Linear Discriminant Analysis
X
Variational Autoencoders
Encoder Decoder
Blurred
Backprop
Kullback–Leibler divergence KL (surprise)
Restricted Boltzmann Machines
Generative Models
X1 X2
Buy Recommend
Y2
Y1
Discriminative Models
• Observed variables: target, infer outputs, conditional
• Function maps from x to Y
• Conditional density function
• P(Y|x) subsample
• Decision bounday
• Computationally expensive
Discriminative Models
• Logistic Regression
• SVMs
• Neural Networks
GANs Deep Learning Summer School
Decision Trees
Occam’s razor Principle
Generative vs Discriminative
• Generative learns joint probability distribution = P(x,y)
• Discriminative learns conditional probability distribution = P(y|x)
GAN Advantages over Generative Models
• D & G = Multi Layer Perceptron
• Regular backpropagation like VAE (G and D differentiable)
• Does not necessarily involve Maximum Likelihood estimation
• No need to use Markov Chains
• Subject but robust to overfitting
Game Theory
• 2 Player Game – Zero Sum
• Minimax solution: Nash Equilibrium
• Unique solution: D=1/2 everywhere
GANs Deep Learning Summer School
Nash Equilibrium
• Sub optimal
• Non cooperative
• Emulate human behavior: bounded rationality (Herbert Simon)
• Simultaneous but not equivalent ** (GANs)
GANs
• Semi Supervised Learning: missing labels
• Inverse Reinforcement Learning
GANs Deep Learning Summer School
G
D
1
Latent Variables
(add noise)
Fake
Training Data
Real
MLP
MLP
Encoder
Decoder
Latent Variables
(add noise)
MLP
MLP
Real MNIST
ADVERSARIAL
(0,0)
COOPERATIVE
(1,1)
Question
• How can we change GAN’s strategy to create e WIN-WIN
situation with payoff equal to (1,1) ?
G
D
1
Latent Variables
Add (noise)
Fake
Training Data
Real
MLP
MLP
ADVERSARIAL
(0,0)
G
COOPERATIVE
(1,1)
Infiltrated Cop
MLP
Training Data
Real
GAN Tuning
• Neural Network architecture
• Hyperparameters
• Game Theory strategies
GANs Deep Learning Summer School
GANs
• Train Simultaneously (no freeze)
• Train Discriminator one step
• Train Generator k steps (no Nash)
• Until pG=pdata (global optimum)
• Discriminator cannot distinguish both distributions
GANs
• x comes from pdata y=1 (Real)
• x comes from pG y=0 (Fake)
• Optimize θ rather than pG
• G: Relu (vanishing gradient)
• Dropout
• Supervised Learning in D:
• Beginning: high confidence
• Usually D is bigger/deeper than G
Vanishing Gradient
Image source: Andrej Karpathy
-25% each activation
Coefficient and Intercept: Regularization
Dropout
• Generator: Gradient Descent on V
• Discriminator: Gradient Ascent on V
• Minibatch
• Batch Normalization in G ***
• To minimize Cross Entropy
• Minimax Game
• Regular cross entropy
Training GANs
Training GANs
• Discriminator minimize J(D)(θD, θG) controlling θD
• Generator minimize J(G)(θD, θG) controlling θG
• Cannot control each other
(G still learns)
Training Challenges
• Non convergence: Nash Equilibrium, harder to optimize than
objective function
• Mode collapse: G fails to output diversity (few good samples)
• D converges to right distribution
• G generates samples in the most probable point
• Solution: k steps for D training for 1 step G training
Training Challenges
Tips and Tricks for GANs
• Normalize data (-1,1)
• Activation function Tanh output of Generative
• Sample from gaussian distribution instead of uniform distribution
• Develop different mini-batches in Discriminator:
• All real
• All fake
• Use Batch Normalization
Tips and Tricks for GANs
• Use DCGANs or VAE+GAN
• Adam in Generator (exp. momentum decay)
(Adaptive Moment Estimation)
• SGD in Discriminator
• If Generator loss high = garbage to Discriminator
• Dropouts in Generator (overfitting)
GANs Deep Learning Summer School
GANs Deep Learning Summer School
Gradient Descent
Nesterov Momentum
Adam Optimizer
Momentum w/ exponential decay according to derivative of error
Optimizers: generalization
Wilson et al, 2017
GAN Examples: Vector Arithmetic
Vector Arithmetic
Radford et al, 2015
Matrix Multiplication
DCGAN
• Deep Convolutional GAN
• Batch Norm not in end of Generator and NOT in
Discriminator (x covariate shift - Kaggle)
• To increase dimension, Upsampling: convo2D.T with
stride > 1
• Downsampling: average pooling + conv2D + stride
Convolutions
Convolution2D Convo2DTranspose
3x3 kernel 4x4 input stride=1 3x3 kernel 2x2 input stride=1
DCGAN Architecture
DCGAN Training
DCGAN Output
DCGAN Output
DCGAN – Face Recognition
Info GAN
• Based in Mutual Information and Entropy (uncertainty)
Coin toss
G
D
Latent Variables
(add noise)
Fake
Training Data
Real
MLP
MLP
Relu
B
A
b b=[1,1,1,1,1,1,1,1,1,1] N=10
B=[0,0,0,0,0,1,1,1,1,1]
P(B=b) = 0.5
H(B)=-SumP(B=b).logP(B=b)
H(B)=-0.5.log(0.5)
H(B)=-0.15
H(A|B=b)=-0.8.log(0.8)
H(A|B=b)=-0.04
B=[0,0,0,0,0,1,1,1,1,1]
A=[0,0,0,0,0,0,1,1,1,1]
P(A|B=b) = 4/5= 0.8 (subsample)
Info GAN Output
Info GAN Output
Info GAN Output
cGAN: Conditional GANs
GAN Examples
• Next frame prediction
• Image-to-image translation
Lotter et al, 2016
Isola et al, 2016
GAN Examples
• Text-to-Image generation Image Inpainting
Reed et al, 2016 Pathak et al, 2016
Cycle GAN: Style Transfer
Zhu et al, 2017
GANs Deep Learning Summer School
GANs Deep Learning Summer School
GANs Deep Learning Summer School
Different Game Strategies
• “Rather than” tuning architecture and hyperparameters
• Freeze layers (unofficial implementation)
• Discriminator : Generator
• 1:1
• 5:1
• 1:5
• Cooperation
• Random strategy update
• Tit-for-Tat strategy
Architecture: Denoising Autoencoders
Convolution
2D
MaxPooling
UpSampling
Backprop
Convolution
2D
MaxPooling
Convolution
2D
UpSampling
Convolution
2D
Gan Structure
One Pixel Attack to Fool Neural Nets
GANs Deep Learning Summer School
Generated Samples
𝒏𝒐𝒊𝒔𝒆 = 𝒙 + 𝟎. 𝟏 ∗ 𝒓𝒏𝒅 𝟎, 𝟏 𝒙 = 𝟎 𝝈 = 𝟏
Update strategy
Synchronous Asynchronous
http://www.nytimes.com/interactive/science/rock-paper-
scissors.html
1:1 Update (Vanilla GAN)
G
D
1
Latent Variables
(add noise)
Fake
Training Data
Real
MLP
MLP
Train Simultaneously
Accuracy Training Set: .92
Accuracy Test Set: .914
Nash Equilibrium: Sub-optimal
Train SimultaneouslyLearning Rate: 0.008
Epochs: 1,000 each
Generator optmiz: Adam
Discriminator optimiz: SGD
Decay Rate: 5e-5
Momentum: 0.9
5:1 Update
G
D
1
Latent Variables
(add noise)
Fake
Training Data
Real
MLP
MLP
Train 1 time
Learning Rate: 0.008
Epochs: 1,000 each
Generator optmiz: Adam
Discriminator optimiz: SGD
Decay Rate: 5e-5
Momentum: 0.9
Accuracy Training Set: .91
Accuracy Test Set: .91
Train 5 times
1:5 Update
G
D
1
Latent Variables
(add noise)
Fake
Training Data
Real
MLP
MLP
Train 5 times
Learning Rate: 0.008
Epochs: 1,000 each
Generator optmiz: Adam
Discriminator optimiz: SGD
Decay Rate: 5e-5
Momentum: 0.9
Accuracy Training Set: .92
Accuracy Test Set: .91
Train 1 time
Cooperation
G
D
1
Latent Variables
(add noise)
Fake
MLP
MLP
Train at once
Learning Rate: 0.008
Epochs: 1,000 each
Generator optmiz: Adam
Discriminator optimiz: SGD
Decay Rate: 5e-5
Momentum: 0.9
Accuracy Training Set: .99
Accuracy Test Set: .93
Train at once
x sigmoid
Vanishing gradient
Training Data
Real
Random Strategy
G
D
1
Latent Variables
(add noise)
Fake
MLP
MLP
Train at chance
Learning Rate: 0.008
Epochs: 1,500
Generator optmiz: Adam
Discriminator optimiz: SGD
Decay Rate: 5e-5
Momentum: 0.9
Accuracy Test Set: .98
Accuracy Test Set: .96
Polarization of Game until
Train at chance
𝑁 = ∞
𝑥 ≈ 0.5
Training Data
Real
x sigmoid
Vanishing gradient Relu
Tit-For-Tat Strategy
G
D
1
Latent Variables
(add noise)
Fake
MLP
MLP
Train with penalty
if provides noisy
samples
Learning Rate: 0.008
Epochs: 1,500
Generator optmiz: Adam
Discriminator optimiz: SGD
Decay Rate: 5e-5
Momentum: 0.9
𝒏𝒐𝒊𝒔𝒆 = 𝒙 + 𝟎. 𝟏 ∗ 𝒓𝒏𝒅 𝟎, 𝟏 𝒙 = 𝟎 𝝈 = 𝟏
Accuracy Test Set: .96
Accuracy Test Set: .92
Train
Training Data
Real
In GAN training:
% noisy samples
𝒏𝒐𝒊𝒔𝒆 = 𝒙 + 𝟎. 𝟒 ∗ 𝒓𝒏𝒅 𝟎, 𝟏 𝒙 = 𝟎 𝝈 = 𝟏
Accuracy Test Set: .92
Accuracy Test Set: .91
Freeze Layers
G
D
1
Latent Variables
(add noise)
Fake
Training Data
Real
MLP
MLP
Train First
Freeze weights
Train Second
Learning Rate: 0.008
Epochs: 1,000 each
Generator optmiz: Adam
Discriminator optimiz: SGD
Decay Rate: 5e-5
Momentum: 0.9
Accuracy Training Set: .63
Accuracy Test Set: .12
x sigmoid
Vanishing gradient Relu
* SYNCHRONICITY
Experiment Results

More Related Content

PDF
오토인코더의 모든 것
PPTX
Attention Is All You Need
PDF
GAN in medical imaging
PDF
PFP:材料探索のための汎用Neural Network Potential - 2021/10/4 QCMSR + DLAP共催
PDF
[DL輪読会]近年のエネルギーベースモデルの進展
PDF
Variational AutoEncoder
PDF
[DL輪読会]Weakly-Supervised Disentanglement Without Compromises
PPTX
【DL輪読会】Flow Matching for Generative Modeling
오토인코더의 모든 것
Attention Is All You Need
GAN in medical imaging
PFP:材料探索のための汎用Neural Network Potential - 2021/10/4 QCMSR + DLAP共催
[DL輪読会]近年のエネルギーベースモデルの進展
Variational AutoEncoder
[DL輪読会]Weakly-Supervised Disentanglement Without Compromises
【DL輪読会】Flow Matching for Generative Modeling

What's hot (20)

PDF
[DLHacks]PyTorch, PixyzによるGenerative Query Networkの実装
PDF
Generative adversarial networks
PDF
Introduction to A3C model
PDF
【DL輪読会】マルチエージェント強化学習における近年の 協調的方策学習アルゴリズムの発展
PPTX
PyTorch, PixyzによるGenerative Query Networkの実装
PDF
(DL hacks輪読) How to Train Deep Variational Autoencoders and Probabilistic Lad...
PPTX
A (Very) Gentle Introduction to Generative Adversarial Networks (a.k.a GANs)
PPTX
A3C解説
PPTX
Generative Adversarial Networks (GANs)
PDF
変分推論法(変分ベイズ法)(PRML第10章)
PDF
はじめてのKrylov部分空間法
PPTX
[DL輪読会]逆強化学習とGANs
PDF
一般向けのDeep Learning
PPTX
Transfer Learning and Fine-tuning Deep Neural Networks
PDF
12. Diffusion Model の数学的基礎.pdf
PPTX
金融時系列のための深層t過程回帰モデル
PPTX
[DL輪読会]Peeking into the Future: Predicting Future Person Activities and Locat...
PDF
ニューラルネットと深層学習の歴史
PPTX
ResNetの仕組み
PDF
ICML 2021 Workshop 深層学習の不確実性について
[DLHacks]PyTorch, PixyzによるGenerative Query Networkの実装
Generative adversarial networks
Introduction to A3C model
【DL輪読会】マルチエージェント強化学習における近年の 協調的方策学習アルゴリズムの発展
PyTorch, PixyzによるGenerative Query Networkの実装
(DL hacks輪読) How to Train Deep Variational Autoencoders and Probabilistic Lad...
A (Very) Gentle Introduction to Generative Adversarial Networks (a.k.a GANs)
A3C解説
Generative Adversarial Networks (GANs)
変分推論法(変分ベイズ法)(PRML第10章)
はじめてのKrylov部分空間法
[DL輪読会]逆強化学習とGANs
一般向けのDeep Learning
Transfer Learning and Fine-tuning Deep Neural Networks
12. Diffusion Model の数学的基礎.pdf
金融時系列のための深層t過程回帰モデル
[DL輪読会]Peeking into the Future: Predicting Future Person Activities and Locat...
ニューラルネットと深層学習の歴史
ResNetの仕組み
ICML 2021 Workshop 深層学習の不確実性について
Ad

Similar to GANs Deep Learning Summer School (20)

PPTX
GAN_SANTHOSH KUMAR_Architecture_in_network
PDF
M4L19 Generative Models - Slides v 3.pdf
PDF
Deep Generative Models II (DLAI D10L1 2017 UPC Deep Learning for Artificial I...
PPTX
Gans - Generative Adversarial Nets
PDF
[GAN by Hung-yi Lee]Part 1: General introduction of GAN
PDF
PDF
InfoGAN and Generative Adversarial Networks
PDF
Generative adversarial networks
PDF
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
PPTX
GAN Deep Learning Approaches to Image Processing Applications (1).pptx
PDF
Generative Adversarial Networks
PDF
Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018
PDF
Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...
PPTX
Synthetic Image Data Generation using GAN &Triple GAN.pptx
PPTX
Self Play Networks and Generative Artificial Networks
PPTX
gan-190318135433 (1).pptx
PDF
Exploring Generative AI with GAN Models
PPTX
ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...
PPT
GNA 13552928 deep learning for GAN a.ppt
PDF
Tutorial on Theory and Application of Generative Adversarial Networks
GAN_SANTHOSH KUMAR_Architecture_in_network
M4L19 Generative Models - Slides v 3.pdf
Deep Generative Models II (DLAI D10L1 2017 UPC Deep Learning for Artificial I...
Gans - Generative Adversarial Nets
[GAN by Hung-yi Lee]Part 1: General introduction of GAN
InfoGAN and Generative Adversarial Networks
Generative adversarial networks
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
GAN Deep Learning Approaches to Image Processing Applications (1).pptx
Generative Adversarial Networks
Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018
Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...
Synthetic Image Data Generation using GAN &Triple GAN.pptx
Self Play Networks and Generative Artificial Networks
gan-190318135433 (1).pptx
Exploring Generative AI with GAN Models
ICASSP 2018 Tutorial: Generative Adversarial Network and its Applications to ...
GNA 13552928 deep learning for GAN a.ppt
Tutorial on Theory and Application of Generative Adversarial Networks
Ad

More from Rubens Zimbres, PhD (20)

PDF
Portfolio 8.2 - 2017
PDF
Portfolio 8.1 2017
PDF
Portfolio 7.9 - 2017
PDF
Portfolio 7.8 en 2017
PDF
Portfolio 7.8 - 2016
PDF
My Portfolio 7.7 - Dec 2016
PDF
MNIST_HOT.5.FULL.OK
PDF
Nikola Tesla Magnifying transmitter Patent
PDF
Social Network - Simple
PDF
Mnist Solution with Wolfram Mathematica
PDF
Iris Dataset Mathematica
PDF
Sentiment Analysis with Wolfram Mathematica
PDF
Support Vector Machines - Wolfram Mathematica
PDF
Support Vector Machine
PDF
Disease Epidemics and Vaccine Effects
PDF
Quantitative Methods
PPT
Ovation semead
PDF
Scientific Market Research
PDF
Social Network drawing using Wolfram Mathematica
Portfolio 8.2 - 2017
Portfolio 8.1 2017
Portfolio 7.9 - 2017
Portfolio 7.8 en 2017
Portfolio 7.8 - 2016
My Portfolio 7.7 - Dec 2016
MNIST_HOT.5.FULL.OK
Nikola Tesla Magnifying transmitter Patent
Social Network - Simple
Mnist Solution with Wolfram Mathematica
Iris Dataset Mathematica
Sentiment Analysis with Wolfram Mathematica
Support Vector Machines - Wolfram Mathematica
Support Vector Machine
Disease Epidemics and Vaccine Effects
Quantitative Methods
Ovation semead
Scientific Market Research
Social Network drawing using Wolfram Mathematica

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
KodekX | Application Modernization Development
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
A Presentation on Artificial Intelligence
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
KodekX | Application Modernization Development
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Diabetes mellitus diagnosis method based random forest with bat algorithm
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25 Week I
The Rise and Fall of 3GPP – Time for a Sabbatical?
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation theory and applications.pdf
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Understanding_Digital_Forensics_Presentation.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf

GANs Deep Learning Summer School