【阅读笔记】Improved Training of Wasserstein GANs

Improved Training of Wasserstein GANs

Gulrajani I, Ahmed F, Arjovsky M, et al. Improved training of wasserstein gans[C]//Advances in Neural Information Processing Systems. 2017: 5767-5777.
GitHub: https://github.com/igul222/improved_wgan_training

Abstract

GAN虽然是个强有力的生成模型,但是训练不稳定的缺点影响它的使用。刚刚提出的 Wasserstein GAN (WGAN) 使得 GAN 的训练变得稳定,但是有时也会产生很差的样本和不收敛。我们发现这些问题的原因常常是因为 weight clipping 来满足 判别器(critic,os.坑,研究了半天才领会这个意思)的 Lipschitz constraint。我们把 weight clipping 转化为成 判别器 的梯度范数关于输入的惩罚。我们的方法优于 standard WGAN 和大部分的 GAN 的变种。

Introduction

Generative adversarial networks

Formally, the game between the generator G and the discriminator D is the minimax objective:
minGmaxDExpr[logD(x)]+Ex^pg[log(1D(x^))]min_Gmax_DE_{x\sim p_r}[logD(x)]+E_{\hat{x}\sim p_g}[log(1-D(\hat{x}))]

In practice, the generator is instead trained to maximize Ex^pg[log(D(x^))]E_{\hat{x}\sim p_g}[log(D(\hat{x}))]。因为这样可以规避当判别器饱和时的梯度消失。

Wasserstein GANs

The WGAN value function is constructed using the Kantorovich-Rubinstein duality to obtain
minGmaxDDExpr[D(x)]Ex^pg[D(x^)]min_Gmax_{D\in\mathscr{D}}E_{x\sim p_r}[D(x)]-E_{\hat{x}\sim p_g}[D(\hat{x})]

其中D\mathscr{D}是 1-Lipschitz functions。为了使判别器满足 k-Lipschitz 限制,需要将权重固定在[c,c][-c,c],k是由cc和模型结构所决定。

Difficulties with weight constraints

如下图所示,发现进行 weight clipping 有两个特点,一是会使得权重集中在所设范围的两端,二是会很容易造成梯度爆炸或梯度消失。这是因为判别器要满足 Lipschitz 条件,但是判别器的目标是使得真假样本判别时差别越大越好,经过训练后,权值的绝对值就集中在最大值附近了。
在这里插入图片描述

Gradient penalty

Algorithm 1 WGAN with gradient penalty. We use default values of λ=10\lambda=10, ncritic=5n_{critic}=5, KaTeX parse error: Expected 'EOF', got '\apha' at position 1: \̲a̲p̲h̲a̲=0.0001, β1=0\beta_1=0, β2=0.9\beta_2=0.9.
Require: The gradient penalty coefficient λ\lambda, the number of critic iterations per generator iteration ncriticn_critic, the batch size mm, Adam hyperparameters α,β1,β2\alpha,\beta_1,\beta_2.
Require: initial critic parameters w0w_0, initial generator parameters θ0\theta_0.

  • while θ\theta has not converged do
    • for t=1,...,ncritict=1, ..., n_{critic} do
      • for i=1,...,mi = 1, ..., m do
        • Sample real data xPrx\sim P_r, latent variable zp(z)z\sim p(z), a random number ϵU[0,1]\epsilon\sim U[0, 1].
        • x~Gθ(z)\tilde{x}\leftarrow G_{\theta}(z)
        • x^ϵx+(1ϵ)x^\hat{x}\leftarrow\epsilon x + (1 −\epsilon)\hat{x}
        • L(i)Dw(x)Dw(x~)+λ(x^Dw(x^)21)2L^{(i)}\leftarrow D_w(x) − D_w(\tilde{x}) + \lambda(||\nabla_{\hat{x}}D_w(\hat{x})||_2-1)^2
      • end for
      • wAdam(w1mi=1mL(i),w,α,β1,β2)w\leftarrow Adam(\nabla_w\frac{1}{m}\sum_{i=1}^mL^(i), w, \alpha, \beta_1, \beta_2)
    • end for
    • Sample a batch of latent variables {z(i)}i=1mp(z)\{z^{(i)}\}^m_{i=1}\sim p(z).
    • θAdam(θ1mI=1mDw(Gtheta(z)),θ,α,β1,β2)\theta\leftarrow Adam(\nabla_{\theta}\frac{1}{m}\sum_{I=1}^m−D_w(G_{theta}(z)), θ, \alpha, \beta_1, \beta_2)
  • end while

WGAN-GP 的创新点在与优化了代价函数
L=ExprDw(x)Expg[Dw(x~)]+λEx^px^[x^Dw(x^)21)2]L= E_{x\sim p_r}D_w(x) − E_{x\sim p_g}[D_w(\tilde{x})] + \lambda E_{\hat{x}\sim p_{\hat{x}}}[||\nabla_{\hat{x}}D_w(\hat{x})||_2-1)^2]

对权重增加惩罚项,使得在原始数据和生成数据中间地带的权重的尽量小,相当于把 WGAN 的硬阈值转化为了软阈值。
在这里插入图片描述

Experiments

在这里插入图片描述
在这里插入图片描述

Conclusion

从实验上来看效果好于其他 GAN 方法,但是看其他资料说不一定好于WGAN,以后有空实验一下看看效果。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章