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:
In practice, the generator is instead trained to maximize 。因爲這樣可以規避當判別器飽和時的梯度消失。
Wasserstein GANs
The WGAN value function is constructed using the Kantorovich-Rubinstein duality to obtain
其中是 1-Lipschitz functions。爲了使判別器滿足 k-Lipschitz 限制,需要將權重固定在,k是由和模型結構所決定。
Difficulties with weight constraints
如下圖所示,發現進行 weight clipping 有兩個特點,一是會使得權重集中在所設範圍的兩端,二是會很容易造成梯度爆炸或梯度消失。這是因爲判別器要滿足 Lipschitz 條件,但是判別器的目標是使得真假樣本判別時差別越大越好,經過訓練後,權值的絕對值就集中在最大值附近了。
Gradient penalty
Algorithm 1 WGAN with gradient penalty. We use default values of , , KaTeX parse error: Expected 'EOF', got '\apha' at position 1: \̲a̲p̲h̲a̲=0.0001, , .
Require: The gradient penalty coefficient , the number of critic iterations per generator iteration , the batch size , Adam hyperparameters .
Require: initial critic parameters , initial generator parameters .
- while has not converged do
- for do
- for do
- Sample real data , latent variable , a random number .
- end for
- end for
- Sample a batch of latent variables .
- end while
WGAN-GP 的創新點在與優化了代價函數
對權重增加懲罰項,使得在原始數據和生成數據中間地帶的權重的儘量小,相當於把 WGAN 的硬閾值轉化爲了軟閾值。
Experiments
Conclusion
從實驗上來看效果好於其他 GAN 方法,但是看其他資料說不一定好於WGAN,以後有空實驗一下看看效果。