際際滷

際際滷Share a Scribd company logo
Variational Autoencoder
nonezerok@gmail.com
1
VAE
Variational Autoencoder
2
3
Autoencoder
?1: ? ★ ? ?2: ? ★ ?
encoder decoder
? ?
?1
?2
?3
4
Autoencoder
?1: ? ★ ? ?2: ? ★ ?
encoder decoder
? ?
??? ???,
??? ??.
deterministic function
non-deterministic?? ?? ??.
?1
?2
?3
5
Autoencoder
?1: ? ★ ? ?2: ?> ★ ?
???? ???!
(???? ???)
encoder decoder
? ?
?1
?2
?3
6
credit: https://www.topbots.com/intuitively-understanding-variational-autoencoders/
?? ??? ????!
7
credit: https://www.topbots.com/intuitively-understanding-variational-autoencoders/
?(?)
8
credit: https://www.topbots.com/intuitively-understanding-variational-autoencoders/
?(?|?)
?
is given
?? ???? ? ? ???
9
credit: https://www.topbots.com/intuitively-understanding-variational-autoencoders/
?(?|?)
?? = sampling
? ~ ? (?|?)
?????, ??????
sample
?
10
credit: https://www.topbots.com/intuitively-understanding-variational-autoencoders/
Variational Autoencoder (VAE)
? ??(??)? ???? ?? ?? ???!
? ??? ?? ? ?? ? ? ???
?? ??!
? ?? ?!
?(?|?)
?(?|?)
?
11
?, ?
Gaussian (distribution) function
12
credit: https://www.topbots.com/intuitively-understanding-variational-autoencoders/
Variational Autoencoder (VAE)
?(?|?)
?~?(?|?)
??? ??? Loss ??? ????,
Backpropagation?? ??? ??? ??.
?? ???? ?? ??? ???? ??.
? ???? ??? ??? ?????
?
13
credit: https://www.topbots.com/intuitively-understanding-variational-autoencoders/
Variational Autoencoder (VAE)
?(?|?)
?~?(?|?)
?(?) = ?? + ?
??? ???,
???, ??? ?? ???? ??? ??.
??(?)
??
= ?,
??(?)
??
= 1
?? (sampling)? ????
????? ???.
?
reparameterization trick
?
?
? ?|?
? ?|?
?
14
?1
?2
?1
?2
Sampling ? ?? ??????
?i ~? ??, ??
2
?i = ?? + ?? ? ? ? ~ ? 0,1
??
??
?i
??? ??? ??? ???
????! ?~? 0, 1
15
https://www.youtube.com/watch?v=rZufA635dq4
16
credit: https://www.topbots.com/intuitively-understanding-variational-autoencoders/
Variational Autoencoder (VAE)
??:
q? p? ??? ????? ???? ?????? ??.
? ??? ??? ????? ??
??? ???? ??? ??? ???
???, ??? ??
Bayesian Theorem(Rule), Information Theory
?? ??!
?(?|?)
?(?|?)
??? ??? ???? ??? ??? ???,
????? ??? ??? ???
17
?(?|?) ?(?|?)
?? ???? ??? ??? ??
??? ???,
?? ??? ???? ???? ?? ???? ?? ??
? ?? ??? ??? ?????
? ?
? ?? ???? ?? ???
??? ???? ??? ? ? ??.
KL divergence ?? ?? ??.
(? ??? ??? ???? ?)
? ?? ???? ??? ??? ??.
????? ???? ????.
???? ??(????)? ??? ???? ?
KL divergence ?? ????? ???? ??!
????
? ?, ? = ? ? ? ?|? = ? ? ?(?|?)
? ? = ?
?
? ?, ?
? ? = ?
?
? ? ? ? ? ? = ?
?
? ? ? ?
18
??(?)[?]
joint pdf, marginal pdf, conditional pdf
random variable, ?
? ? = ? , ?? ? , ?(?)
Bayes¨ Rule
? ?|? =
? ?, ?
? ?
=
? ?|? ? ?
? ?
=
? ?|? ? ?
σ? ? ?, ?
=
? ?|? ? ?
σ? ? ?|? ? ?
19
? ?, ? = ? ? ? ?|?
Bayesian Inference
? ?|? =
? ?|? ? ?
? ?
posterior
likelihood prior
Posterior(????) ???
20
?? ?
??? ?? ??? ?? ? ? ? ? ? ?|? ? ?
???? ?? ??.
( ?? )
? = ?
?
? ? = ?
?
? ?|? ? ?
=
c. f) classification ? ?|? 『 ? ?|? ? ?
?? ???? ?? ?? ?? ? ???
intractable
Information, Entropy
21
? ? = ???
1
?(?)
? ? = ? ????? ? = ? ?
?
? ? ???? ?
Expectation of Information
? ?(?)
??(?| ? = ? ? ? ? ????(?)
?? ? ? ? ? ? ????(?)
?? = ? ? ? ? log
? ?
? ?
??
?(?)? ??
?(?)? ????
?(?)? ??
?(?)? ????
22
???? ??????? ??
??(?| ? − 0
??(?| ? 』 ??(?| ?
> 0
? ? ? ? ? 「
?(?)
?(?)
???? ?? ?
? ??? ?????,
? ??? ???? ??? ???
????? ??? ??
KL-divergence
23
? ?? ??? ?? ??
? ??? ??? ?? ??? ???? ????
credit: https://wiseodd.github.io/techblog/2016/12/21/forward-reverse-kl/
Variational Inference
? ?|?
? ?|?
??? ???.
? ?? ?
??
??? ?? ?? ?? ??; ????? ????.
? ?|? 「 ? ?|?
??:
KL ???
min KL ? ?|? ||? ?|?
24
Posterior ???
??(??) ???? ??
? ?|?
Reverse KL? ??
VI : biased, low variance
MC: unbiased, high variance
?? ? ?|? ||? ?|? = ? ? ? ?|? ???
? ?|?
? ?|?
= ? ? ? ?|? ???
? ?, ?
? ?
? ?|?
1
= ? ? ? ?|? ???
? ?, ?
? ?|?
1
? ?
= ? ? ? ?|? ???
? ?, ?
? ?|?
+ ???
1
? ?
= ? ? ? ?|? ???
? ?, ?
? ?|?
+ ?
?
? ?|? ??? ? ?
= ? ? ? ?|? ???
? ?, ?
? ?|?
+ ??? ? ? ?
?
? ?|?
= ? ? ? ?|? ???
? ?, ?
? ?|?
+ ??? ? ?
1
??? ? ? = ?? ? ?|? ||? ?|? + ? ? ?|? ???
? ?, ?
? ?|?
? is given, then it is fixed
25
https://www.youtube.com/watch?v=uaaqyVS9-rM
??? ? ? −
???
???
???
?? ??.
? ?? ?
− 0
? ? ?|? ???
? ?, ?
? ?|?
? in black: a random variable
? in gray: a fixed value of the random variable ?
?? ? ?|? ||? ?|? = ? ? ? ?|? ???
? ?|?
? ?|?
= ? ? ? ?|? ???
? ?, ?
? ?
? ?|?
1
= ? ? ? ?|? ???
? ?, ?
? ?|?
1
? ?
= ? ? ? ?|? ???
? ?, ?
? ?|?
+ ???
1
? ?
= ? ? ? ?|? ???
? ?, ?
? ?|?
+ ?
?
? ?|? ??? ? ?
= ? ? ? ?|? ???
? ?, ?
? ?|?
+ ??? ? ? ?
?
? ?|?
= ? ? ? ?|? ???
? ?, ?
? ?|?
+ ??? ? ?
1
??? ? ? = ?? ? ?|? ||? ?|? + ? ? ?|? ???
? ?, ?
? ?|?
? is given, then it is fixed
26
https://www.youtube.com/watch?v=uaaqyVS9-rM
− 0
lower bound
??? ? ? −
variational
???
???
???
?? ??.
? ?? ?
Log-Likelihood
?? ?? ?
? in black: a random variable
? in gray: a fixed value of the random variable ?
? ? ?|? ???
? ?, ?
? ?|?
= ? ? ?|? ???
? ?|? ? ?
? ?|?
= ? ? ?|? ??? ? ?|? + ???
? ?
? ?|?
= ? ? ?|? ??? ? ?|? + ? ? ?|? ???
? ?
? ?|?
= ?? ?|? ??? ? ?|? ? ?? ? ?|? ||? ?
27
Evidence Lower BOund (ELBO)
lower bound
? ?|? ? ?
when ? is given
??? ? ? −
Log-Likelihood
?? ?? ?
28
Z
X
?(?|?) ?(?|?)
? | ? ★ ?
? | ? ★ ?
?(?|?)
?
?
?(?|?) ?
?
??? ?|? ??? ? ?|? + ?? ? ?|? ||? ?
deterministic
function
= neural network
? ??
?? ???;
???? ?? ??? ??? ??
Cross Entropy Loss
Loss for a given ?:
「 ?(?|?)
29
? ?(?|?)
??
??
?
??, ??
??? ???? ??? ????? ??
Loss Function ??
? ??? ?|??
??? ? ??|? + ?? ? ?|?? ||? ?
30
? ?? ?? ???? ??
reconstruction term
regularizer term
???? ??? ??
? ??? ?|??
??? ? ??|? + ?? ? ?|?? ||? ?
「
1
?
? ??? ? ??|??
「 ??? ? ??|?1
= ??? ?
?=1
?
? ??,?|?1
= ?
?=1
?
??? ? ??,?|?1
= ?
?=1
?
??? ??
??,?
? 1 ? ??
1???,?
= ?
?=1
?
??,???? ?? + 1 ? ??,? ??? 1 ? ??
Monte Carlo Sampling
???
31
network output
cross-entropy
network input (target)
N
??
j?? ?? ??? 1? ??
???? ??? ??
? ??? ?|??
??? ? ??|? + ?? ? ?|?? ||? ?
「
1
?
? ??? ? ??|??
「 ??? ? ??|?1
= ??? ? ??, ??
2
?
= ? ?
?=1
?
1
2
??? ??,?
2
+
??,? ? ??,?
2
2??,?
2
Monte Carlo Sampling
32
??? ? ??, ?2
?
『 ? ?
?=1
?
??,? ? ??,?
2
???
??? ?? ??? ??
mean squared loss
N
??
2N
??
??
?
KL regularizer term
33
?? ? ??, ??
2
? ||? 0, ?
=
1
2
?? ??
2
? + ??
?
?? ? ? ? ??? ?
?=1
?
??,?
2
=
1
2
?
?=1
?
??,?
2
+ ?
?=1
?
??,?
2
? ?
?=1
?
1 ? ?
?=1
?
??? ??,?
2
=
1
2
?
?=1
?
??,?
2
+ ??,?
2
? ??? ??,?
2
? 1
??? ?? ???? ??
??? ??
??
??
? ?|??
covariance 0 ??,
?? K?, ??
2
K?
? ??? ?|??
??? ? ??|? + ?? ? ?|?? ||? ?
=
1
2
?
?=1
?
exp(log _??,?
2
) + ??,?
2
? log _??,?
2
? 1
?????´
Loss for a given ??
34
?? ?, ?, ?? = ? ?
?=1
?
??,???? ?>? + 1 ? ??,? ??? 1 ? ?>? +
1
2
?
?=1
?
??,?
2
+ ??,?
2
? ??? ??,?
2
? 1
?? ?, ?, ?? = ?
?=1
?
1
2
??? ??,?
2
+
??,? ? ??,?
2
2??,?
2 +
1
2
?
?=1
?
??,?
2
+ ??,?
2
? ??? ??,?
2
? 1
?? ?, ?, ?? = ?
?=1
?
??,? ? ??,?
2
+
1
2
?
?=1
?
??,?
2
+ ??,?
2
? ??? ??,?
2
? 1
??? ?? ??? ??
??
35
36
https://www.youtube.com/watch?v=rZufA635dq4
37
https://www.youtube.com/watch?v=rZufA635dq4
38
https://www.youtube.com/watch?v=rZufA635dq4
39
https://www.youtube.com/watch?v=rZufA635dq4
40
https://www.youtube.com/watch?v=rZufA635dq4
41
https://www.youtube.com/watch?v=rZufA635dq4
42
https://www.youtube.com/watch?v=rZufA635dq4
43
https://www.youtube.com/watch?v=rZufA635dq4
44
https://www.youtube.com/watch?v=rZufA635dq4
45
https://www.youtube.com/watch?v=rZufA635dq4
?? ??
46
? Conditional VAE
? ? ?VAE
? Adversarial Autoencoder
? VQ-VAE
47
https://ijdykeman.github.io/ml/2016/12/21/cvae.html
48
https://ijdykeman.github.io/ml/2016/12/21/cvae.html
49
https://ijdykeman.github.io/ml/2016/12/21/cvae.html
50
https://ijdykeman.github.io/ml/2016/12/21/cvae.html
?? ??
51
? Conditional VAE
? ? ?VAE
? Adversarial Autoencoder
? VQ-VAE
52
https://www.youtube.com/watch?v=rZufA635dq4
53
https://www.youtube.com/watch?v=rZufA635dq4
54
https://www.youtube.com/watch?v=rZufA635dq4
55
https://www.youtube.com/watch?v=rZufA635dq4
56
Pose! + ?
?-VAE (ICLR 2017)
57
?-VAE (ICLR 2017)
58
?? ??
59
hidden code learns
to represent the style of the image
? Conditional VAE
? ? ?VAE
? Adversarial Autoencoder
? VQ-VAE
https://arxiv.org/pdf/1511.05644.pdf
60
https://arxiv.org/pdf/1511.05644.pdf
?? ??
61
? Conditional VAE
? ? ?VAE
? Adversarial Autoencoder
? VQ-VAE
https://proceedings.neurips.cc/paper/2017/file/7a98af17e63a0ac09ce2e96d03992fbc-Paper.pdf
????
62
? Tutorial on Autoencoder, https://arxiv.org/pdf/1606.05908.pdf (2016)
? https://www.youtube.com/watch?v=uaaqyVS9-rM
? https://wiseodd.github.io/techblog/2016/12/10/variational-autoencoder/
? /NaverEngineering/ss-96581209

More Related Content

?? ??? ?? Variational Autoencoder (VAE)