SlideShare a Scribd company logo
Generative Adversarial Networks
Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza Machine Learning Group
University de Montreal
2014, Cited by 10479
Aug 01, 2019
SMC AI Research Center
Kyuri Kim
PR-001: Generative adversarial nets by Jaejun Yoo (2017/4/13)
Introduction
1.1 Supervised vs Unsupervised Learning
- Supervised Learning
- Unsupervised Learning
Variational Auto Encoder(VAE), GAN,
Clustering, Dimension Reduction, etc.
Data: (x, y)
x is data, y is label
Learn a function to map x → y
Data: (x)
Just data, no label
𝒈 𝜽(𝒙|𝒛)𝒒∅(𝒛|𝒙)
Introduction
1.1 Supervised vs Unsupervised Learning
- Supervised Learning
- Unsupervised Learning
Data: (x, y)
x is data, y is label
Learn a function to map x → y
mean
‘Sampling’
Introduction
1.1 Supervised vs Unsupervised Learning
- Supervised Learning
- Unsupervised Learning
Data: (x, y)
x is data, y is label
Learn a function to map x → y
NIPS 2016 Tutorial: generative adversarial networks paper
Introduction
1.2 Generative Adversarial Networks
Generated Image by Neural Network
Figure adopted from BEGAN paper released at 31. Mar.
2017, Google
- Generative Model - Adversial
Real or Fake?
Generator Discriminator
Fake
Money
Real
Money
Introduction
1.3 Probability Distribution
Eyeglasses Wavy Hair Wearing Hat
𝑃𝑑𝑎𝑡𝑎 𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑠 𝑡ℎ𝑒 𝑑𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛 𝑜𝑓 𝑎𝑐𝑡𝑢𝑎𝑙 𝑖𝑚𝑎𝑔𝑒𝑠.
Introduction
1.3 Probability Distribution
𝐺𝑜𝑎𝑙 𝑖𝑠 𝑡𝑜 𝑓𝑖𝑛𝑑 𝑎 𝑃 𝑚𝑜𝑑𝑒𝑙 𝑡ℎ𝑎𝑡 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒𝑑 𝑃𝑑𝑎𝑡𝑎 𝑤𝑒𝑙𝑙.
Data Generating Distribution
Discriminator Distribution
Generative Distribution
Generative Adversarial Networks
2.1 Intuition of GAN
D
Discriminator
G
Generater
D
Discriminator
Real Image
Fake Image
D(x)
D(G(z))
May be High
The probability of that x came
from the real data (0~1)
May be low
z
Latent Code
D
Discriminator
G
Generater
D
Discriminator
D(x)
D(G(z))z
The discriminator should
classify a real image as real.
Real Image (64x64x3)
This value should be
close to 1.
Generative Adversarial Networks
2.1 Intuition of GAN
D
Discriminator
G
Generater
D
Discriminator
D(x)
D(G(z))
This value should
be close to 0.
z
The discriminator should
classify a fake image as fake.
Generative Adversarial Networks
2.1 Intuition of GAN
Fake Image generated by the generator
(64x64x3)
D
Discriminator
G
Generater
D
Discriminator
Generated Image (64x64x3)
D(x)
D(G(z))
This value should
be close to 1.
z
Latent Code
(100)
Generative Adversarial Networks
2.1 Intuition of GAN
Generative Adversarial Networks
2.2 Objective Function of GAN
Objective Function.
x
D
Discriminator
D(x)
G
Generater
D
Discriminator
G(z)
D(G(z))z
Generative Adversarial Networks
2.2 Objective Function of GAN
x
D
Discriminator
D(x)
G
Generater
D
Discriminator
G(z)
D(G(z))z
Objective Function.
Implementation
3.1 GAN Tensorflow code
mnist = input_data.read_data_sets("./mnist/data/",
one_hot=True)
total_epoch = 100
batch_size = 50
learning_rate = 0.0001
n_hidden = 256
n_input = 28 * 28
n_noise = 128
X = tf.placeholder(tf.float32, [None, n_input])
Z = tf.placeholder(tf.float32, [None, n_noise])
1. Requirements and Dataset
2. Generator Network
G_W1 = tf.Variable(tf.random_normal([n_noise, n_hidden],
stddev=0.01))
G_b1 = tf.Variable(tf.zeros([n_hidden]))
G_W2 = tf.Variable(tf.random_normal([n_hidden, n_input],
stddev=0.01))
G_b2 = tf.Variable(tf.zeros([n_input]))
def generator(noise_z):
hidden = tf.nn.relu(tf.matmul(noise_z, G_W1) + G_b1)
output = tf.nn.sigmoid(tf.matmul(hidden, G_W2) + G_b2)
return output
D D(x)x
G D D(G(z))z G(z)
Training with real Image
Training with fake Image
128
256
784
1
256784
Implementation
3.1 GAN Tensorflow code
3. Discriminator Network
4. Generate Fake Image, Loss & Optimizer
D_W2 = tf.Variable(tf.random_normal([n_hidden, 1],
stddev=0.01))
D_b2 = tf.Variable(tf.zeros([1]))
def discriminator(inputs):
hidden = tf.nn.relu(tf.matmul(inputs, D_W1) + D_b1)
output = tf.nn.sigmoid(tf.matmul(hidden, D_W2) + D_b2)
return output
G = generator(Z)
D_gene = discriminator(G)
D_real = discriminator(X)
loss_D = tf.reduce_mean(tf.log(D_real) + tf.log(1 - D_gene))
loss_G = tf.reduce_mean(tf.log(D_gene))
train_D = tf.train.AdamOptimizer(learning_rate).minimize(-
loss_D, var_list=D_var_list)
train_G = tf.train.AdamOptimizer(learning_rate).minimize(-
loss_G, var_list=G_var_list)
Training with real Image
Training with fake Image
D D(x)x
G D D(G(z))z G(z)
CE(pred, y) = −y⋅log(pred)−(1−y)⋅log(1−pred)
Dloss = CE(D(x),1)+CE(D(G(z)),0) = −log(D(x))−log(1−D(g(z)) )
Gloss = CE(D(G(z)),1) = −log(D(G(z))
Implementation
3.1 GAN Tensorflow code
5. Training & Testing
sess = tf.Session()
sess.run(tf.global_variables_initializer())
total_batch = int(mnist.train.num_examples/batch_size)
loss_val_D, loss_val_G = 0, 0
for epoch in range(total_epoch):
for i in range(total_batch):
batch_xs, batch_ys =
mnist.train.next_batch(batch_size)
noise = get_noise(batch_size, n_noise)
# 판별기와 생성기 신경망을 각각 학습
_, loss_val_D = sess.run([train_D, loss_D],
feed_dict={X: batch_xs,
Z: noise})
_, loss_val_G = sess.run([train_G, loss_G],
feed_dict={Z: noise})
print('Epoch:', '%04d' % epoch,
'D loss: {:.4}'.format(loss_val_D),
'G loss: {:.4}'.format(loss_val_G))
Training with real Image
Training with fake Image
D D(x)x
G D D(G(z))z G(z)
noise = get_noise(sample_size, n_noise)
samples = sess.run(G, feed_dict={Z: noise})
Get Closer to 1.
Get Closer to 0.
Implementation
3.1 GAN Tensorflow code
5. Training & Testing
sess = tf.Session()
sess.run(tf.global_variables_initializer())
total_batch = int(mnist.train.num_examples/batch_size)
loss_val_D, loss_val_G = 0, 0
for epoch in range(total_epoch):
for i in range(total_batch):
batch_xs, batch_ys =
mnist.train.next_batch(batch_size)
noise = get_noise(batch_size, n_noise)
# 판별기와 생성기 신경망을 각각 학습
_, loss_val_D = sess.run([train_D, loss_D],
feed_dict={X: batch_xs,
Z: noise})
_, loss_val_G = sess.run([train_G, loss_G],
feed_dict={Z: noise})
print('Epoch:', '%04d' % epoch,
'D loss: {:.4}'.format(loss_val_D),
'G loss: {:.4}'.format(loss_val_G))
Training with real Image
Training with fake Image
D D(x)x
G D D(G(z))z G(z)
noise = get_noise(sample_size, n_noise)
samples = sess.run(G, feed_dict={Z: noise})
Get Closer to 1.
Implementation
3.1 GAN Tensorflow code
6. Generate Image Sample saved
Training with real Image
Training with fake Image
D D(x)x
G D D(G(z))z G(z)
After training
Experiments
y = log(1-x) y = log(x)
The gradient is relatively small at D(G(z))=0. The gradient is very large at D(G(z))=0.
4.1 Non-Saturating game
Result & Conclusion
Yellow boxes are real data
samples that are nearest matches
to last column of fake images.
This shows the generator didn’t
merely memorize training
examples.

More Related Content

What's hot

00463517b1e90c1e63000000
00463517b1e90c1e6300000000463517b1e90c1e63000000
00463517b1e90c1e63000000Ivonne Liu
 
(DL輪読)Matching Networks for One Shot Learning
(DL輪読)Matching Networks for One Shot Learning(DL輪読)Matching Networks for One Shot Learning
(DL輪読)Matching Networks for One Shot Learning
Masahiro Suzuki
 
Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018
Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018
Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018
Universitat Politècnica de Catalunya
 
Variational Autoencoders For Image Generation
Variational Autoencoders For Image GenerationVariational Autoencoders For Image Generation
Variational Autoencoders For Image Generation
Jason Anderson
 
Anomaly Detection and Localization Using GAN and One-Class Classifier
Anomaly Detection and Localization  Using GAN and One-Class ClassifierAnomaly Detection and Localization  Using GAN and One-Class Classifier
Anomaly Detection and Localization Using GAN and One-Class Classifier
홍배 김
 
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Universitat Politècnica de Catalunya
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function
홍배 김
 
The Perceptron (D1L2 Deep Learning for Speech and Language)
The Perceptron (D1L2 Deep Learning for Speech and Language)The Perceptron (D1L2 Deep Learning for Speech and Language)
The Perceptron (D1L2 Deep Learning for Speech and Language)
Universitat Politècnica de Catalunya
 
Predicting organic reaction outcomes with weisfeiler lehman network
Predicting organic reaction outcomes with weisfeiler lehman networkPredicting organic reaction outcomes with weisfeiler lehman network
Predicting organic reaction outcomes with weisfeiler lehman network
Kazuki Fujikawa
 
机器学习Adaboost
机器学习Adaboost机器学习Adaboost
机器学习Adaboost
Shocky1
 
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Universitat Politècnica de Catalunya
 
Function Approx2009
Function Approx2009Function Approx2009
Function Approx2009
Imthias Ahamed
 
Rabbit challenge 3 DNN Day2
Rabbit challenge 3 DNN Day2Rabbit challenge 3 DNN Day2
Rabbit challenge 3 DNN Day2
TOMMYLINK1
 
Siamese networks
Siamese networksSiamese networks
Siamese networks
Nicholas McClure
 
Variational Auto Encoder and the Math Behind
Variational Auto Encoder and the Math BehindVariational Auto Encoder and the Math Behind
Variational Auto Encoder and the Math Behind
Varun Reddy
 
C++ and Deep Learning
C++ and Deep LearningC++ and Deep Learning
C++ and Deep Learning
Oswald Campesato
 
Scala and Deep Learning
Scala and Deep LearningScala and Deep Learning
Scala and Deep Learning
Oswald Campesato
 
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
홍배 김
 
ECCV2010: feature learning for image classification, part 4
ECCV2010: feature learning for image classification, part 4ECCV2010: feature learning for image classification, part 4
ECCV2010: feature learning for image classification, part 4zukun
 
Deep Learning: R with Keras and TensorFlow
Deep Learning: R with Keras and TensorFlowDeep Learning: R with Keras and TensorFlow
Deep Learning: R with Keras and TensorFlow
Oswald Campesato
 

What's hot (20)

00463517b1e90c1e63000000
00463517b1e90c1e6300000000463517b1e90c1e63000000
00463517b1e90c1e63000000
 
(DL輪読)Matching Networks for One Shot Learning
(DL輪読)Matching Networks for One Shot Learning(DL輪読)Matching Networks for One Shot Learning
(DL輪読)Matching Networks for One Shot Learning
 
Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018
Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018
Generative Adversarial Networks GAN - Santiago Pascual - UPC Barcelona 2018
 
Variational Autoencoders For Image Generation
Variational Autoencoders For Image GenerationVariational Autoencoders For Image Generation
Variational Autoencoders For Image Generation
 
Anomaly Detection and Localization Using GAN and One-Class Classifier
Anomaly Detection and Localization  Using GAN and One-Class ClassifierAnomaly Detection and Localization  Using GAN and One-Class Classifier
Anomaly Detection and Localization Using GAN and One-Class Classifier
 
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
Deep Generative Models I (DLAI D9L2 2017 UPC Deep Learning for Artificial Int...
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function
 
The Perceptron (D1L2 Deep Learning for Speech and Language)
The Perceptron (D1L2 Deep Learning for Speech and Language)The Perceptron (D1L2 Deep Learning for Speech and Language)
The Perceptron (D1L2 Deep Learning for Speech and Language)
 
Predicting organic reaction outcomes with weisfeiler lehman network
Predicting organic reaction outcomes with weisfeiler lehman networkPredicting organic reaction outcomes with weisfeiler lehman network
Predicting organic reaction outcomes with weisfeiler lehman network
 
机器学习Adaboost
机器学习Adaboost机器学习Adaboost
机器学习Adaboost
 
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
Convolutional Neural Networks - Veronica Vilaplana - UPC Barcelona 2018
 
Function Approx2009
Function Approx2009Function Approx2009
Function Approx2009
 
Rabbit challenge 3 DNN Day2
Rabbit challenge 3 DNN Day2Rabbit challenge 3 DNN Day2
Rabbit challenge 3 DNN Day2
 
Siamese networks
Siamese networksSiamese networks
Siamese networks
 
Variational Auto Encoder and the Math Behind
Variational Auto Encoder and the Math BehindVariational Auto Encoder and the Math Behind
Variational Auto Encoder and the Math Behind
 
C++ and Deep Learning
C++ and Deep LearningC++ and Deep Learning
C++ and Deep Learning
 
Scala and Deep Learning
Scala and Deep LearningScala and Deep Learning
Scala and Deep Learning
 
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
 
ECCV2010: feature learning for image classification, part 4
ECCV2010: feature learning for image classification, part 4ECCV2010: feature learning for image classification, part 4
ECCV2010: feature learning for image classification, part 4
 
Deep Learning: R with Keras and TensorFlow
Deep Learning: R with Keras and TensorFlowDeep Learning: R with Keras and TensorFlow
Deep Learning: R with Keras and TensorFlow
 

Similar to Generative adversarial networks

GAN in medical imaging
GAN in medical imagingGAN in medical imaging
GAN in medical imaging
Cheng-Bin Jin
 
Generative modeling with Convolutional Neural Networks
Generative modeling with Convolutional Neural NetworksGenerative modeling with Convolutional Neural Networks
Generative modeling with Convolutional Neural Networks
Denis Dus
 
EuroSciPy 2019 - GANs: Theory and Applications
EuroSciPy 2019 - GANs: Theory and ApplicationsEuroSciPy 2019 - GANs: Theory and Applications
EuroSciPy 2019 - GANs: Theory and Applications
Emanuele Ghelfi
 
Introduction to Deep Learning and Tensorflow
Introduction to Deep Learning and TensorflowIntroduction to Deep Learning and Tensorflow
Introduction to Deep Learning and Tensorflow
Oswald Campesato
 
Unsupervised learning represenation with DCGAN
Unsupervised learning represenation with DCGANUnsupervised learning represenation with DCGAN
Unsupervised learning represenation with DCGAN
Shyam Krishna Khadka
 
Machine Learning: Make Your Ruby Code Smarter
Machine Learning: Make Your Ruby Code SmarterMachine Learning: Make Your Ruby Code Smarter
Machine Learning: Make Your Ruby Code Smarter
Astrails
 
Introduction
IntroductionIntroduction
Introductionbutest
 
C3_W2.pdf
C3_W2.pdfC3_W2.pdf
C3_W2.pdf
ShaheenKolimi
 
GAN - Theory and Applications
GAN - Theory and ApplicationsGAN - Theory and Applications
GAN - Theory and Applications
Emanuele Ghelfi
 
Generative adversarial networks
Generative adversarial networksGenerative adversarial networks
Generative adversarial networks
Yunjey Choi
 
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
NAVER Engineering
 
GAN Generative Adversarial Networks.pptx
GAN Generative Adversarial Networks.pptxGAN Generative Adversarial Networks.pptx
GAN Generative Adversarial Networks.pptx
ssuser2624f71
 
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
 
Generation of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.pptGeneration of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.ppt
DivyaGugulothu
 
Machine learning
Machine learningMachine learning
Machine learning
Nicolas Rougier
 
Intelligent Ruby + Machine Learning
Intelligent Ruby + Machine LearningIntelligent Ruby + Machine Learning
Intelligent Ruby + Machine LearningIlya Grigorik
 
isabelle_webinar_jan..
isabelle_webinar_jan..isabelle_webinar_jan..
isabelle_webinar_jan..butest
 
Generative Adversarial Networks and Their Applications
Generative Adversarial Networks and Their ApplicationsGenerative Adversarial Networks and Their Applications
Generative Adversarial Networks and Their Applications
Artifacia
 
slides_security_and_privacy_in_machine_learning.pptx
slides_security_and_privacy_in_machine_learning.pptxslides_security_and_privacy_in_machine_learning.pptx
slides_security_and_privacy_in_machine_learning.pptx
ssuserabf73f
 
Generative Adversarial Networks
Generative Adversarial NetworksGenerative Adversarial Networks
Generative Adversarial Networks
Mustafa Yagmur
 

Similar to Generative adversarial networks (20)

GAN in medical imaging
GAN in medical imagingGAN in medical imaging
GAN in medical imaging
 
Generative modeling with Convolutional Neural Networks
Generative modeling with Convolutional Neural NetworksGenerative modeling with Convolutional Neural Networks
Generative modeling with Convolutional Neural Networks
 
EuroSciPy 2019 - GANs: Theory and Applications
EuroSciPy 2019 - GANs: Theory and ApplicationsEuroSciPy 2019 - GANs: Theory and Applications
EuroSciPy 2019 - GANs: Theory and Applications
 
Introduction to Deep Learning and Tensorflow
Introduction to Deep Learning and TensorflowIntroduction to Deep Learning and Tensorflow
Introduction to Deep Learning and Tensorflow
 
Unsupervised learning represenation with DCGAN
Unsupervised learning represenation with DCGANUnsupervised learning represenation with DCGAN
Unsupervised learning represenation with DCGAN
 
Machine Learning: Make Your Ruby Code Smarter
Machine Learning: Make Your Ruby Code SmarterMachine Learning: Make Your Ruby Code Smarter
Machine Learning: Make Your Ruby Code Smarter
 
Introduction
IntroductionIntroduction
Introduction
 
C3_W2.pdf
C3_W2.pdfC3_W2.pdf
C3_W2.pdf
 
GAN - Theory and Applications
GAN - Theory and ApplicationsGAN - Theory and Applications
GAN - Theory and Applications
 
Generative adversarial networks
Generative adversarial networksGenerative adversarial networks
Generative adversarial networks
 
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
 
GAN Generative Adversarial Networks.pptx
GAN Generative Adversarial Networks.pptxGAN Generative Adversarial Networks.pptx
GAN Generative Adversarial Networks.pptx
 
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
 
Generation of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.pptGeneration of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.ppt
 
Machine learning
Machine learningMachine learning
Machine learning
 
Intelligent Ruby + Machine Learning
Intelligent Ruby + Machine LearningIntelligent Ruby + Machine Learning
Intelligent Ruby + Machine Learning
 
isabelle_webinar_jan..
isabelle_webinar_jan..isabelle_webinar_jan..
isabelle_webinar_jan..
 
Generative Adversarial Networks and Their Applications
Generative Adversarial Networks and Their ApplicationsGenerative Adversarial Networks and Their Applications
Generative Adversarial Networks and Their Applications
 
slides_security_and_privacy_in_machine_learning.pptx
slides_security_and_privacy_in_machine_learning.pptxslides_security_and_privacy_in_machine_learning.pptx
slides_security_and_privacy_in_machine_learning.pptx
 
Generative Adversarial Networks
Generative Adversarial NetworksGenerative Adversarial Networks
Generative Adversarial Networks
 

More from Kyuri Kim

GPT-Series.pdf
GPT-Series.pdfGPT-Series.pdf
GPT-Series.pdf
Kyuri Kim
 
BERT- Pre-training of Deep Bidirectional Transformers for Language Understand...
BERT- Pre-training of Deep Bidirectional Transformers for Language Understand...BERT- Pre-training of Deep Bidirectional Transformers for Language Understand...
BERT- Pre-training of Deep Bidirectional Transformers for Language Understand...
Kyuri Kim
 
Future semantic segmentation with convolutional LSTM
Future semantic segmentation with convolutional LSTMFuture semantic segmentation with convolutional LSTM
Future semantic segmentation with convolutional LSTM
Kyuri Kim
 
Exploring uncertainty measures in deep networks for sclerosis
Exploring uncertainty measures in deep networks for sclerosisExploring uncertainty measures in deep networks for sclerosis
Exploring uncertainty measures in deep networks for sclerosis
Kyuri Kim
 
Convolutional neural network based metal artifact reduction in x ray computed...
Convolutional neural network based metal artifact reduction in x ray computed...Convolutional neural network based metal artifact reduction in x ray computed...
Convolutional neural network based metal artifact reduction in x ray computed...
Kyuri Kim
 
Automated bone metastasis detection
Automated bone metastasis detection Automated bone metastasis detection
Automated bone metastasis detection
Kyuri Kim
 

More from Kyuri Kim (6)

GPT-Series.pdf
GPT-Series.pdfGPT-Series.pdf
GPT-Series.pdf
 
BERT- Pre-training of Deep Bidirectional Transformers for Language Understand...
BERT- Pre-training of Deep Bidirectional Transformers for Language Understand...BERT- Pre-training of Deep Bidirectional Transformers for Language Understand...
BERT- Pre-training of Deep Bidirectional Transformers for Language Understand...
 
Future semantic segmentation with convolutional LSTM
Future semantic segmentation with convolutional LSTMFuture semantic segmentation with convolutional LSTM
Future semantic segmentation with convolutional LSTM
 
Exploring uncertainty measures in deep networks for sclerosis
Exploring uncertainty measures in deep networks for sclerosisExploring uncertainty measures in deep networks for sclerosis
Exploring uncertainty measures in deep networks for sclerosis
 
Convolutional neural network based metal artifact reduction in x ray computed...
Convolutional neural network based metal artifact reduction in x ray computed...Convolutional neural network based metal artifact reduction in x ray computed...
Convolutional neural network based metal artifact reduction in x ray computed...
 
Automated bone metastasis detection
Automated bone metastasis detection Automated bone metastasis detection
Automated bone metastasis detection
 

Recently uploaded

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
AafreenAbuthahir2
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
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
Pipe Restoration Solutions
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 

Recently uploaded (20)

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
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
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
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 

Generative adversarial networks

  • 1. Generative Adversarial Networks Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza Machine Learning Group University de Montreal 2014, Cited by 10479 Aug 01, 2019 SMC AI Research Center Kyuri Kim PR-001: Generative adversarial nets by Jaejun Yoo (2017/4/13)
  • 2. Introduction 1.1 Supervised vs Unsupervised Learning - Supervised Learning - Unsupervised Learning Variational Auto Encoder(VAE), GAN, Clustering, Dimension Reduction, etc. Data: (x, y) x is data, y is label Learn a function to map x → y Data: (x) Just data, no label 𝒈 𝜽(𝒙|𝒛)𝒒∅(𝒛|𝒙)
  • 3. Introduction 1.1 Supervised vs Unsupervised Learning - Supervised Learning - Unsupervised Learning Data: (x, y) x is data, y is label Learn a function to map x → y mean ‘Sampling’
  • 4. Introduction 1.1 Supervised vs Unsupervised Learning - Supervised Learning - Unsupervised Learning Data: (x, y) x is data, y is label Learn a function to map x → y NIPS 2016 Tutorial: generative adversarial networks paper
  • 5. Introduction 1.2 Generative Adversarial Networks Generated Image by Neural Network Figure adopted from BEGAN paper released at 31. Mar. 2017, Google - Generative Model - Adversial Real or Fake? Generator Discriminator Fake Money Real Money
  • 6. Introduction 1.3 Probability Distribution Eyeglasses Wavy Hair Wearing Hat 𝑃𝑑𝑎𝑡𝑎 𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑠 𝑡ℎ𝑒 𝑑𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛 𝑜𝑓 𝑎𝑐𝑡𝑢𝑎𝑙 𝑖𝑚𝑎𝑔𝑒𝑠.
  • 7. Introduction 1.3 Probability Distribution 𝐺𝑜𝑎𝑙 𝑖𝑠 𝑡𝑜 𝑓𝑖𝑛𝑑 𝑎 𝑃 𝑚𝑜𝑑𝑒𝑙 𝑡ℎ𝑎𝑡 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒𝑑 𝑃𝑑𝑎𝑡𝑎 𝑤𝑒𝑙𝑙. Data Generating Distribution Discriminator Distribution Generative Distribution
  • 8. Generative Adversarial Networks 2.1 Intuition of GAN D Discriminator G Generater D Discriminator Real Image Fake Image D(x) D(G(z)) May be High The probability of that x came from the real data (0~1) May be low z Latent Code
  • 9. D Discriminator G Generater D Discriminator D(x) D(G(z))z The discriminator should classify a real image as real. Real Image (64x64x3) This value should be close to 1. Generative Adversarial Networks 2.1 Intuition of GAN
  • 10. D Discriminator G Generater D Discriminator D(x) D(G(z)) This value should be close to 0. z The discriminator should classify a fake image as fake. Generative Adversarial Networks 2.1 Intuition of GAN Fake Image generated by the generator (64x64x3)
  • 11. D Discriminator G Generater D Discriminator Generated Image (64x64x3) D(x) D(G(z)) This value should be close to 1. z Latent Code (100) Generative Adversarial Networks 2.1 Intuition of GAN
  • 12. Generative Adversarial Networks 2.2 Objective Function of GAN Objective Function. x D Discriminator D(x) G Generater D Discriminator G(z) D(G(z))z
  • 13. Generative Adversarial Networks 2.2 Objective Function of GAN x D Discriminator D(x) G Generater D Discriminator G(z) D(G(z))z Objective Function.
  • 14. Implementation 3.1 GAN Tensorflow code mnist = input_data.read_data_sets("./mnist/data/", one_hot=True) total_epoch = 100 batch_size = 50 learning_rate = 0.0001 n_hidden = 256 n_input = 28 * 28 n_noise = 128 X = tf.placeholder(tf.float32, [None, n_input]) Z = tf.placeholder(tf.float32, [None, n_noise]) 1. Requirements and Dataset 2. Generator Network G_W1 = tf.Variable(tf.random_normal([n_noise, n_hidden], stddev=0.01)) G_b1 = tf.Variable(tf.zeros([n_hidden])) G_W2 = tf.Variable(tf.random_normal([n_hidden, n_input], stddev=0.01)) G_b2 = tf.Variable(tf.zeros([n_input])) def generator(noise_z): hidden = tf.nn.relu(tf.matmul(noise_z, G_W1) + G_b1) output = tf.nn.sigmoid(tf.matmul(hidden, G_W2) + G_b2) return output D D(x)x G D D(G(z))z G(z) Training with real Image Training with fake Image 128 256 784 1 256784
  • 15. Implementation 3.1 GAN Tensorflow code 3. Discriminator Network 4. Generate Fake Image, Loss & Optimizer D_W2 = tf.Variable(tf.random_normal([n_hidden, 1], stddev=0.01)) D_b2 = tf.Variable(tf.zeros([1])) def discriminator(inputs): hidden = tf.nn.relu(tf.matmul(inputs, D_W1) + D_b1) output = tf.nn.sigmoid(tf.matmul(hidden, D_W2) + D_b2) return output G = generator(Z) D_gene = discriminator(G) D_real = discriminator(X) loss_D = tf.reduce_mean(tf.log(D_real) + tf.log(1 - D_gene)) loss_G = tf.reduce_mean(tf.log(D_gene)) train_D = tf.train.AdamOptimizer(learning_rate).minimize(- loss_D, var_list=D_var_list) train_G = tf.train.AdamOptimizer(learning_rate).minimize(- loss_G, var_list=G_var_list) Training with real Image Training with fake Image D D(x)x G D D(G(z))z G(z) CE(pred, y) = −y⋅log(pred)−(1−y)⋅log(1−pred) Dloss = CE(D(x),1)+CE(D(G(z)),0) = −log(D(x))−log(1−D(g(z)) ) Gloss = CE(D(G(z)),1) = −log(D(G(z))
  • 16. Implementation 3.1 GAN Tensorflow code 5. Training & Testing sess = tf.Session() sess.run(tf.global_variables_initializer()) total_batch = int(mnist.train.num_examples/batch_size) loss_val_D, loss_val_G = 0, 0 for epoch in range(total_epoch): for i in range(total_batch): batch_xs, batch_ys = mnist.train.next_batch(batch_size) noise = get_noise(batch_size, n_noise) # 판별기와 생성기 신경망을 각각 학습 _, loss_val_D = sess.run([train_D, loss_D], feed_dict={X: batch_xs, Z: noise}) _, loss_val_G = sess.run([train_G, loss_G], feed_dict={Z: noise}) print('Epoch:', '%04d' % epoch, 'D loss: {:.4}'.format(loss_val_D), 'G loss: {:.4}'.format(loss_val_G)) Training with real Image Training with fake Image D D(x)x G D D(G(z))z G(z) noise = get_noise(sample_size, n_noise) samples = sess.run(G, feed_dict={Z: noise}) Get Closer to 1. Get Closer to 0.
  • 17. Implementation 3.1 GAN Tensorflow code 5. Training & Testing sess = tf.Session() sess.run(tf.global_variables_initializer()) total_batch = int(mnist.train.num_examples/batch_size) loss_val_D, loss_val_G = 0, 0 for epoch in range(total_epoch): for i in range(total_batch): batch_xs, batch_ys = mnist.train.next_batch(batch_size) noise = get_noise(batch_size, n_noise) # 판별기와 생성기 신경망을 각각 학습 _, loss_val_D = sess.run([train_D, loss_D], feed_dict={X: batch_xs, Z: noise}) _, loss_val_G = sess.run([train_G, loss_G], feed_dict={Z: noise}) print('Epoch:', '%04d' % epoch, 'D loss: {:.4}'.format(loss_val_D), 'G loss: {:.4}'.format(loss_val_G)) Training with real Image Training with fake Image D D(x)x G D D(G(z))z G(z) noise = get_noise(sample_size, n_noise) samples = sess.run(G, feed_dict={Z: noise}) Get Closer to 1.
  • 18. Implementation 3.1 GAN Tensorflow code 6. Generate Image Sample saved Training with real Image Training with fake Image D D(x)x G D D(G(z))z G(z) After training
  • 19. Experiments y = log(1-x) y = log(x) The gradient is relatively small at D(G(z))=0. The gradient is very large at D(G(z))=0. 4.1 Non-Saturating game
  • 20. Result & Conclusion Yellow boxes are real data samples that are nearest matches to last column of fake images. This shows the generator didn’t merely memorize training examples.