Wasserstein GAN and Improved Training of Wasserstein GANs
Paper:
WGAN:https://arxiv.org/pdf/1701.07875.pdf
WGAN-GP:https://arxiv.org/pdf/1704.00028.pdf
参考:
https://lilianweng.github.io/lil-log/2017/08/20/from-GAN-to-WGAN.html
https://vincentherrmann.github.io/blog/wasserstein/
recommend:https://www.depthfirstlearning.com/2019/WassersteinGAN
(阅读笔记)
1.Intro
- 得到目标概率密度一般就利用极大似然估计的方法,而不同分布之间则一般用散度衡量。
- 模型生成得到的分布与原始真实的分布不太可能有交叉的地方。两个分布都仅仅只是各自有各自的,而不是联合的,得到的这种形式的目标分布是不理想的。It is then unlikely that…have a non-negligible intersection.
- 所以很多文献都是通过给目标分布添加噪声来尽量覆盖所有的例子,但是会使图像受损。
- 而GAN就是通过生成器让低维流形产生高维的分布,当下效果也不是很理想。
- 主要目标是衡量分布之间的距离。we direct our attention on the various ways to measure how close the model distribution and the real distribution are, or equivalently.
- 研究了EM距离。we provide a comprehensive theoretical analysis of how the Earth Mover (EM) distance behaves in comparison to popular probability distances and divergences used in the context of learning distributions.
- 定义了WGAN。we de fine a form of GAN called Wasserstein-GAN that minimizes a reasonable and efficient approximation of the EM distance, and we theoretically show that the corresponding optimization problem is sound.
2.Distances
-
各种 : ; ; 等(可见论文 -GAN),而 - 如下:
的联合分布集为 ; 是其中一种联合分布;从 中抽样得到所有 ,用范数衡量距离后再求均值;在所有联合分布集 中, 使该期望达到下界,该最小值即是 - 。
所以具体实现就是类似推土的意思,主要目标是保证每一组抽样点相似:
-
假设有均匀分布 ,现有真实分布 ,类似在二维坐标图中,点分布于 轴 到 。而目标使分布 去拟合 。
所以有如下距离定义,只有当 时,才能达到最小,但是除了 ,均达不到最下值。:
-
Why Wasserstein is indeed weak?(有待研究更新)
论文还叙述了为什么Wasserstein距离是比 距离差的,但作者仍然用Wasserstein距离。证明用到了一些泛函的概念。 为 中的一组集,即 ; 是将 映射到 的函数的空间( 中每一个元素都是函数,它是一集合):
当有 后,按照矩阵的方式理解则有,所以 的无穷范数即是得到的 空间结果的绝对值最大值:
给集合 赋予一范数进行约束得到一个赋范向量空间 ( 范数诱导的自然拓扑)
3.WGAN
- 利用Kantorovich-Rubinstein对偶性,将推土距离转换如下(but why?有待研究更新),其中
代表
,约束函数平稳,斜率不能太大:
所以有 函数 ,判别器需要学到一个好的 ,并且要求损失函数如下进行收敛:
正如算法流程所述, 以便使用梯度下降,所以文中使用约束权重范围的方法,以防止改变权重造成很大的改变,确保 。
4.WGAN-GP
Intro
- 在WGAN-GP的文章中提出了使用权重约束的问题,会不收敛或者仅产生较差的样本。but sometimes can still generate only poor samples or fail to converge.
- 提出了新的裁剪权重的方法(梯度惩罚gradient penalty)。We propose an alternative to clipping weights: penalize the norm of gradient of the critic with respect to its input.
Details
- 对于
的函数
意味这
之间的梯度不会超过1,所以惩罚梯度的意思就是惩罚大于1的情况。所以损失就如下改变:
前一部分很容易理解即是GAN的标准损失,后面一项就是超参数 下对梯度进行约束的表达。 - 由上述式子理应该对所有的数据进行惩罚,但是这样却很棘手,无法对所有的数据都保证斜率小于1,所以是重新随机抽出一个数据集 ,仅对其进行惩罚。
- 没有BN层, 设置为10。
- 理论上惩罚应该仅仅对所有的大于1,而小于1的部分不用管 ,但是让其靠近1理论上更好。We encourage the norm of the gradient to go towards 1 (two-sided penalty) instead of just staying below 1 (one-sided penalty).