Arvin Liu @ 新竹AIA
image resource: 李宏毅老師的投影片
Given skill points to generate something.
Skill points
image resource: 李宏毅老師的投影片
能力值 -G-> 角色
image resource: 李宏毅老師的投影片, anime image powered by http://mattya.github.io/chainer-DCGAN/
image resource: 李宏毅老師的投影片
image resource: 李宏毅老師的投影片
image resource: 李宏毅老師的投影片
image resource: https://www.cnblogs.com/huangshiyu13/p/6209016.html
image resource: 李宏毅老師的投影片
Comment by 凱哥
DCGAN(ICLR'16) : https://arxiv.org/abs/1511.06434
BN-> ReLU
tanh
DCGAN deconv: kernel size (5,5) , stride (2,2)
BN + lReLU
lReLU
score
* resolution is not high due to image size(64x64).
DCGAN WITHOUT ANY TIPS
* resolution = 128x128.
I use tensorflow to train my GAN.
picture resource: https://www.tensorflow.org/
picture resource: my code displayed on sublime text3
Convolution 128
f : (5,5) , s : (2,2)
Convolution 256
f : (5,5) , s : (2,2)
Convolution 512
f : (5,5) , s : (2,2)
Convolution 1024
f : (5,5) , s : (2,2)
Dense 1
Score
64x64x3 image
picture resource: my code displayed on sublime text3
Conv^T 512
f : (5,5) , s : (2,2)
Conv^T 256
f : (5,5) , s : (2,2)
Conv^T 128
f : (5,5) , s : (2,2)
Conv^T 3
f : (5,5) , s : (2,2)
Dense 2^14
64x64x3 image
latent 100~N(0,1)
picture resource: my code displayed on sublime text3,
note that the latent in original paper is sampled from uniform distribution.
picture resource: my code displayed on sublime text3
picture resource: my code displayed on sublime text3
fake_score = discriminator(fake_data)
real_score = discriminator(real_data)
https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_logits
picture resource: 宏毅老師投影片
picture resource: 宏毅老師投影片
picture resource: 宏毅老師投影片
學生被洗腦,老師痛罵學生。
老師被洗腦,學生騙過老師。
picture resource: 宏毅老師投影片
Reminder:
variable_scope(reuse = tf.AUTO_REUSE)
picture resource: my code displayed on sublime text3
That is, before training, define the computational graphs.
1step = 5 Discriminator iters + 1 Generator iter.
picture resource: GAN result from Arvin Liu (myself).
picture resource: GAN result by Arvin Liu (myself).
picture resource: GAN result by Arvin Liu (myself).
picture resource: GAN result by Arvin Liu (myself).
picture resource: GAN result by Arvin Liu (myself).
Student
Teacher
img created
by myself.
img created
by myself.
image resource: 李宏毅老師的投影片
Distribution(Mode) Collapse!
Student
Teacher
Question : Generate a code for sorting
到底是誰的錯?
image resource: 李宏毅老師的投影片
Discri-
minator
score
All possible data
image resource https://www.offconvex.org/2016/03/22/saddlepoints/
Early stopping +
validation
HUMAN!
Save your model everytime,
save your whole life time.
Diminished Gradient
Mode Collapse or
Gradient Explode
Non-convergence
Solve Diminished Gradient
https://arxiv.org/abs/1611.04076
image resource: 李宏毅老師的投影片
(with sigmoid)
(without sigmoid)
Discriminator score
image resource: 李宏毅老師的投影片
Discriminator score
image resource: 李宏毅老師的投影片
Discriminator score
picture resource: my code displayed on sublime text3
Solve Mode Collapse
你潮棒der。
Mode Collapse
Mode Collapse
你潮棒der。
Nice Choice!
img resource:https://9gag.com/gag/aeexzeO/drake-meme
??????
Solve Diminished Gradient & Mode Collapse
Improved WGAN(NIPS '17): https://arxiv.org/abs/1704.00028
if D is 1-lipschitz -> must be smooth
Weight Clipping once parameter update
Too complicated
1-lipschitz : |f(x)-f(y)| <= |x-y|
image resource: 李宏毅老師的投影片
They don't move.
Why?
Gradient too steep!
(slope is too steep.)
Discriminator score
All possible data
Diminished Gradient
Explode Score
(because of 1-lipschitz function)
image resource: 李宏毅老師的投影片
Q: How to smooth the gradient?
A: Regularization
(give it penalty)
Too Steep.
More Flat.
image resource: 李宏毅老師的投影片
Discriminator score
All possible data
Target is between the real data and fake data.
B
-
α=0.1
α=0.9
B
-
α=0.1
α=0.9
Note that 2-norm,
image resource: 李宏毅老師的投影片
Personal comment: gradient不能太高因為Loss,
gradient不能太低因為 diminished gradient,而1剛剛好。
* lambda = 10 in paper
(Not mentioned but very powerful)
* resolution is not high due to image size(64x64).
D:G = 4:1 , 5500 iterations
picture resource: GAN result by Arvin Liu (myself).
If real data & G distribution....
A
B
C
A
B
C
A
B
C
A
B
C
A
B
C
Easy to minimize G_loss for G's data
Mode Collapse!
Discriminator do well on class B,C
A
B
C
Easy to minimize G_loss for G's data
Mode Collapse!
A
B
C
Mode Collapse!
A
B
C
-
-
-
-
Easy to minimize G_loss for G's data
A
B
C
-
-
-
-
Easy to minimize G_loss for G's data
A
B
C
A
B
C
Easy to minimize G_loss for G's data
DCGAN structure, image size 128x128
picture resource: GAN result by Arvin Liu (myself).
picture resource: GAN result by Arvin Liu (myself).
picture resource: GAN result by Arvin Liu (myself).
picture resource: GAN result by Arvin Liu (myself).
Solve Mode Collapse
Ian Goodfellow : https://arxiv.org/pdf/1606.03498.pdf
img resource: https://arxiv.org/pdf/1606.03498.pdf
F: raw
feature from each data
T: Projection
c: calculate difference
o: calculate diversity
picture resource: my code displayed on sublime text3
這會放在zip檔,有興趣可以看看or跑跑看。
picture resource: GAN result by Arvin Liu (myself).
picture resource: GAN result by Arvin Liu (myself).
https://affinelayer.com/pixsrv/
Memes Generation: https://arxiv.org/pdf/1806.04510.pdf
https://arxiv.org/pdf/1711.08447.pdf
In classification problem...
image resource: https://chtseng.wordpress.com/2017/11/11/data-augmentation-%E8%B3%87%E6%96%99%E5%A2%9E%E5%BC%B7/
class A
class B
class C
real data
GAN ganerator
simple augmentation
???
???
???
[Lab talk]
Dataset A | Dataset B | is_pair? |
---|---|---|
exist | exist | Yes |
not exist | exist | No |
exist | not exist | No |
not exist | not exist | ??? |
Conditional
Generative Adversarial Network
image resource: 李宏毅老師的投影片
你開心就好:)
例如 classify 一個分數,real/fake 一個分數?
看看就好,拿來作弊用的
Use STRONGER D to filter G's data.
"Stronger" means train D lonely in the end.
When you think G is good enough, lower the learning rate, brighter image you get.
https://arxiv.org/pdf/1611.07004v1.pdf
i.e.: Maxpooling, ReLU(but G can use it.)
Maybe ReLU is suitible for "edge"?
ICLR'2017 (rejected)
https://openreview.net/forum?id=SypU81Ole
https://en.wikipedia.org/wiki/Linear_interpolation
D:G = 4:1 , 5500 iterations
picture resource: GAN result by Arvin Liu (myself).
D:G = 4:1 , 5500 iterations
picture resource: GAN result by Arvin Liu (myself).
image resource: https://www.cnblogs.com/punkcure/p/7873566.html
D output C/S
Thus, Having Classification & Synthesis(合成) eror.
In this task, I change some loss function.
(For G, +log(z) -> -log(1-z))
Ls : loss in original GAN.
Lc : binary cross entropy
(tag loss, not softmax.)
image resource: 李宏毅老師的投影片
picture resource: GAN result by Arvin Liu (myself).
conditional GAN
ACGAN (Auxiliary Classifier GAN)