文章目录
前言
本文为7月28日深度学习笔记,分为两个章节:
- Feature Extraction:InfoGAN、VAE-GAN、BiGAN;
- Intelligent Photo Editing:GAN + Autoencoder.
一、Feature Extraction
The colors represents the characteristics.
1、InfoGAN
2、VAE-GAN
(1)、Algorithm
- Intialize Encoder, Decoder, and Discriminator;
- In each iteration:
- Sample M images { x 1 , x 2 , … , x M } \{x^1, x^2, …, x^M\} {x1,x2,…,xM} from database;
- Generate M codes { z ~ 1 , z ~ 2 , … , z ~ M } \{\tilde{z}^1, \tilde{z}^2, …, \tilde{z}^M \} {z~1,z~2,…,z~M} from encoder: z ~ i = E n ( x i ) \tilde{z}^i = En(x^i) z~i=En(xi);
- Generate M images { x ^ 1 , x ^ 2 , … , x ^ M } \{\hat{x}^1, \hat{x}^2, …, \hat{x}^M \} {x^1,x^2,…,x^M} from decoder: x ^ i = D e ( z ~ i ) \hat{x}^i = De(\tilde{z}^i) x^i=De(z~i);
- Sample M codes { z 1 , z 2 , … , z M } \{z^1, z^2, …, z^M \} {z1,z2,…,zM} from prior P ( z ) P(z) P(z);
- Generate M images { x ^ 1 , x ^ 2 , … , x ^ M } \{\hat{x}^1, \hat{x}^2, …, \hat{x}^M \} {x^1,x^2,…,x^M} from decoder: x ^ i = D e ( z i ) \hat{x}^i = De(z^i) x^i=De(zi);
- Update En to decrese ∣ ∣ x ~ i − x i ∣ ∣ ||\tilde{x}^i - x^i|| ∣∣x~i−xi∣∣, decrease K L ( P ( z ^ i ∣ x i ) ) ∣ ∣ P ( z ) KL(P(\hat{z}^i|x^i)) || P(z) KL(P(z^i∣xi))∣∣P(z);
- Update De to decrese ∣ ∣ x ~ i − x i ∣ ∣ ||\tilde{x}^i - x^i|| ∣∣x~i−xi∣∣, increse D i s ( x ~ i ) Dis(\tilde{x}^i) Dis(x~i) and D i s ( x ^ i ) Dis(\hat{x}^i) Dis(x^i);
- Update Dis to increase D i s ( x i ) Dis(x^i) Dis(xi), decrese D i s ( x ~ i ) Dis(\tilde{x}^i) Dis(x~i) and D i s ( x ^ i ) Dis(\hat{x}^i) Dis(x^i).
3、BiGAN
(1)、Algorithm
- Intialize Encoder, Decoder, and Discriminator;
- In each iteration:
- Sample M images { x 1 , x 2 , … , x M } \{x^1, x^2, …, x^M\} {x1,x2,…,xM} from database;
- Generate M codes { z ~ 1 , z ~ 2 , … , z ~ M } \{\tilde{z}^1, \tilde{z}^2, …, \tilde{z}^M \} {z~1,z~2,…,z~M} from encoder: z ~ i = E n ( x i ) \tilde{z}^i = En(x^i) z~i=En(xi);
- Generate M images { x ^ 1 , x ^ 2 , … , x ^ M } \{\hat{x}^1, \hat{x}^2, …, \hat{x}^M \} {x^1,x^2,…,x^M} from decoder: x ^ i = D e ( z ~ i ) \hat{x}^i = De(\tilde{z}^i) x^i=De(z~i);
- Sample M codes { z 1 , z 2 , … , z M } \{z^1, z^2, …, z^M \} {z1,z2,…,zM} from prior P ( z ) P(z) P(z);
- Generate M codes { x ~ 1 , x ~ 2 , … , x ~ M } \{\tilde{x}^1, \tilde{x}^2, …, \tilde{x}^M \} {x~1,x~2,…,x~M} from decoder: x ~ i = D e ( z i ) \tilde{x}^i = De(z^i) x~i=De(zi);
- Update Dis to increase D i s ( x i , z ~ i ) Dis(x^i, \tilde{z}^i) Dis(xi,z~i), decrease D i s ( x i , z i ) Dis(x^i, z^i) Dis(xi,zi);
- Update En and De to decrease D i s ( x i , z ~ i ) Dis(x^i, \tilde{z}^i) Dis(xi,z~i), increse D i s ( x ~ i , z i ) Dis(\tilde{x}^i, z^i) Dis(x~i,zi).
二、Intelligent Photo Editing
1、GAN + Autoencoder
(1)、Attribute Representation
z
l
o
n
g
1
N
1
∑
x
∈
l
o
n
g
E
n
(
x
)
−
1
N
2
∑
x
′
∉
l
o
n
g
E
n
(
x
′
)
z_{long} \frac{1}{N_1}\sum_{x\in long}En(x) - \frac{1}{N_2}\sum_{x'\notin long}En(x')
zlongN11x∈long∑En(x)−N21x′∈/long∑En(x′)
(2)、Basic Idea
(3)、Back to z
-
Methode 1:
z ∗ = a r g m i n L ( G ( z ) , x T ) z^* = arg\ min\ L(G(z), x^T) z∗=arg min L(G(z),xT) -
Methode 2:
-
Methode 3:
Using the results from method 2 as the initialization of method 1.
(4)、Editing Photos
z
0
z_0
z0 is the code of the input image.
z
∗
=
a
r
g
m
i
n
U
(
G
(
z
)
)
+
λ
1
∣
∣
z
−
z
0
∣
∣
2
−
λ
2
D
(
G
(
z
)
)
z^* = arg\ min\ U(G(z)) + \lambda_1 ||z - z_0||^2 - \lambda_2 D(G(z))
z∗=arg min U(G(z))+λ1∣∣z−z0∣∣2−λ2D(G(z))