gan loss gan_我的GAN怎么了?

本文深入探讨了GAN(生成对抗网络)在训练过程中遇到的问题,主要关注GAN损失的变化及其对模型性能的影响。通过对损失函数的分析,帮助读者理解如何解决训练中的不稳定性与模式崩溃等常见问题。
摘要由CSDN通过智能技术生成

gan loss gan

Generative Adversarial Networks are a novel class of deep generative models, that have recently gained a lot of attention. I’ve covered them in the past ( Tabular synthetic data — Part 1 and Tabular synthetic data — Part 2), in very general terms, and with particular attention to their application to synthesize tabular data. But today, the focus will be a bit different — in a series of articles, I’ll be covering the challenges that you can find while training GANs, the most common solutions, and future directions in literature. This review was inspired by this amazing article about GANs challenges, solutions, and future — I strongly advise you to have a deeper look.

生成对抗网络是一类新型的深度生成模型,最近引起了很多关注。 过去,我已经非常笼统地介绍了它们( 表格综合数据 -第1部分和表格综合数据 -第2部分),并且特别注意了它们在综合表格数据中的应用。 但是今天,重点将有所不同-在一系列文章中,我将介绍您在培训GAN时发现的挑战,最常见的解决方案以及文学的未来方向。 这篇评论的灵感来自于有关GAN的挑战,解决方案和未来的精彩文章 -我强烈建议您更深入地了解。

生成对抗网络 (Generative Adversarial Networks)

Generative models have been widely used in the latest years in a broad and varied number of real applications. Generative Models’ can be defined as models that compute the density estimation where model distribution is learned to approximate the real data distribution.

生成模型已在最近几年中广泛应用于各种实际应用中。 生成模型可以定义为计算密度估计值的模型,其中学习模型分布以近似实际数据分布。

This brings some challenges, as researches have shown that maximum likelihood is not a good option — leads to overgeneralized and unplausible samples.

由于研究表明最大可能性不是一个好的选择,这带来了一些挑战-导致样本过于笼统和不合理。

Generative Adversarial Nets (GANs) can solve this by introducing a Discriminator network that brings the capacity to discriminate original data samples, and samples generated by a model.

生成对抗网络(GAN)可以通过引入Discriminator网络来解决此问题,该网络具有区分原始数据样本和模型生成的样本的能力。

They have a wide scope of application, as they are able to learn implicitly over images, audio, and data which are challenging to model with an explicit likelihood.

它们具有广泛的应用范围,因为它们能够隐式学习图像,音频和数据,而这些图像,音频和数据很难以明确的可能性进行建模。

挑战 (The challenges)

GANs can be very helpful and pretty disruptive in some areas of application, but, as in everything, it’s a trade-off between their benefits and the challenges that we easily find while working with them. We can break down GANs challenges in 3 main problems:

GAN在某些应用领域中可能非常有帮助,并且具有破坏性,但是,就像在所有方面一样,这是在其收益与我们在与他们合作时容易发现的挑战之间进行权衡的。 我们可以将GAN的挑战分解为三个主要问题:

  • Mode collapse

    模式崩溃
  • Non-convergence and instability

    不收敛和不稳定
  • Highly sensibility to hyperparameters and evaluation metrics

    对超参数和评估指标高度敏感

模式为何崩溃? 🔥 (Why mode collapse? 🔥)

GANs can sometimes suffer from the limitation of generating samples with little representative of the population, which means that, for example, after training a GAN on the MNIST dataset, it may happen that our Generator is unable to generate digits different from digit 0. This condition is called mode collapse.

GAN有时会受到生成样本数量很少代表的限制,这意味着,例如,在MNIST数据集上训练GAN之后,我们的生成器可能无法生成与数字0不同的数字。这种情况称为模式崩溃。

The main drawback is related to the fact that GANs are to able to focus on the whole data distribution due to its objective function. Some experiments have shown that even for bi-modal distribution, GANs tend to produce a good fit to the principal mode, struggling to generalize. In summary, mode collapse is a consequence of poor generalization and can be classified into two different types:

主要缺点与以下事实有关:GAN具有目标功能,因此能够专注于整个数据分发。 一些实验表明,即使对于双峰分布,GAN仍倾向于与主模产生很好的匹配,难以一概而论。 总而言之,模式崩溃是普遍性不佳的结果,可以分为两种不同的类型:

  • Most of the modes from the input data are absent from the generated data

    输入数据中的大多数模式都不在生成数据中
  • Only a subset of particular modes is learned by the Generator.

    生成器仅学习特定模式的子集。
Image for post
Example of mode collapse while training with Vanilla GAN. Credits to: https://arxiv.org/pdf/1612.02136.pdf
使用Vanilla GAN训练时模式崩溃的示例。 学分至: https : //arxiv.org/pdf/1612.02136.pdf

The causes for mode collapse can vary, from an ill-suited objective function to the impact of the chosen GAN architecture having in consideration the data under analysis. But fear no more, there are options to solve this many have been the efforts dedicated to this particular challenge.

模式崩溃的原因可能有所不同,从不合适的目标函数到考虑了分析数据的所选GAN架构的影响。 但是,别再担心了,有很多解决方案可供选择,这些都是针对这一特殊挑战的努力。

不收敛和不稳定 (Non-convergence and instability)

The fact that GANs are composed by two networks, and each one of them has its loss function, results in the fact that GANs are inherently unstable- diving a bit deeper into the problem, the Generator (G) loss can lead to the GAN instability, which can be the cause of the gradient vanishing problem when the Discriminator (D) can easily distinguish between real and fake samples.

GAN由两个网络组成,并且每个网络都有其损失功能,这一事实导致GAN本质上不稳定-深入研究问题, 生成器(G)的损失会导致GAN不稳定,当鉴别器 (D)可以轻松地区分真实样本和假样本时,这可能是导致梯度消失的原因。

Image for post
Discriminator loss function
鉴别器损失函数

In GANs architecture, the D tries to minimize a cross-entropy while the G tries to maximize it. When D confidence is high and starts to reject the samples that are produced by G leads to G’s gradient vanishes.

在GAN架构中, D尝试使交叉熵最小化,而G尝试使交叉熵最大化。 当D的置信度很高并开始拒绝G产生的样本时,导致G的梯度消失。

Image for post
https://machinelearningmastery.com/practical-guide-to-gan-failure-modes/ https://machinelearningmastery.com/practical-guide-to-gan-failure-modes/

This might refer to the hypothesis of the existence of local equilibria in the non-convex game that we are targeting when training GANs, as proposed in an article about GANs convergence and stability. There are some options already proposed in the literature to mitigate this problem, such as reversing the target employed for construction the cross-entropy cost or the application of gradient penalty to avoid local equilibria.

如关于GAN收敛性和稳定性的文章所述,这可能是指我们在训练GAN时针对的非凸博弈中存在局部均衡的假设。 文献中已经提出了一些缓解此问题的选择,例如反转用于构建交叉熵成本的目标或应用梯度罚分以避免局部平衡。

那超参数和评估呢? (What about hyperparameters and evaluation?)

No cost function will work without the selection of good hyperparameters, and GANs are not an exception they are even more sensitive to the selection of the network hyperparameters. The right selection of hyperparameters can be tedious and time-consuming, and so far the majority of the efforts have been in topics such as mode-collapse or GAN’s struggles to converge.

如果没有选择好的超参数,任何成本函数都将无法工作,并且GAN也不例外,它们对网络超参数的选择更加敏感。 正确选择超参数可能是乏味且耗时的,到目前为止,大多数努力都集中在诸如模式崩溃或GAN努力收敛的主题上。

No cost function will work without the selection of good hyperparameters!

如果没有选择好的超参数,任何成本函数都将失效!

Moreover, GANs lack meaningful measures to evaluate the quality of their output. Since its creation, GANs have been widely used with a variety of application areas, from supervised representation learning, semi-supervised learning, inpainting, denoising, and synthetic data creation. The extensive applications brings along a lot of heterogeneity, which makes it harder to define how we can evaluate the equality of these networks. Because there are no robust or consistent metrics defined, in particular for image generation, it is difficult to evaluate which GANs algorithms outperform others. A series of evaluation methods have been proposed in the literature, to overcome this challenge — you can find interesting details about GANs evaluation metrics in this article.

此外,GAN缺乏有意义的措施来评估其输出的质量。 自创建以来,GAN已在监督表示学习,半监督学习,修复,修复,去噪和合成数据创建等各种应用领域中得到广泛使用。 广泛的应用带来了很多异质性,这使得定义我们如何评估这些网络的相等性变得更加困难。 因为没有定义健壮或一致的指标,尤其是在图像生成方面,所以很难评估哪些GAN算法优于其他算法。 文献中提出了一系列评估方法来克服这一挑战-您可以在本文中找到有关GAN评估指标的有趣细节。

解决方案 (The solutions)

Challenges covered, it’s time to check the solutions that have been proposed and most widely applied to GANs.

面对挑战,现在该是检查已提出并广泛应用于GAN的解决方案的时候了。

As mentioned before, although there are many challenges related to GANs training, there’s a lot of research for mode collapse and non-convergence issues’ solutions. The image below depicts an interesting taxonomy for GANs challenges solutions, which leaves us with a pretty good idea of the options that we’ve available in literature.

如前所述,尽管与GAN训练相关的挑战很多,但是对于模式崩溃和非收敛问题的解决方案有很多研究。 下图描绘了GAN挑战解决方案的有趣分类法,这使我们对文献中提供的选项有了很好的了解。

Image for post
Image from the article about GANs challenges, solutions, and future. Credits to: https://arxiv.org/pdf/2005.00065.pdf
图片来自有关GAN的挑战,解决方案和未来的文章。 致谢: https : //arxiv.org/pdf/2005.00065.pdf

Further, will be covered the three main techniques to improve GANs training and overall results.

此外,将涵盖改善GAN训练和总体效果的三种主要技术。

探索新的网络架构 (Exploring new network architectures)

Better design of GAN models architectures is definitely one valid option. In fact, there are several GANs in the literature that result from exploring new architectures to solve particular data challenges — for example, CGAN is a conditional version of the first proposed GAN architecture, that undoubtedly leads to better results when synthesizing data, on the other hand, VAE-GAN follows an encoder-encoder architecture, that leverages learned representations to better measure similarities in the data space which results to improved visual fidelity and, finally, for example, Memory GAN follows a memory architecture that can alleviate two of the main issues related to unsupervised learning, the ability of the Generators to learn correctly the representation of the training samples, and Discriminators to better memorize already seen generated samples.

GAN模型架构的更好设计绝对是一种有效的选择。 实际上,在文献中有许多GAN是通过探索新的体系结构来解决特定数据挑战而产生的-例如, CGAN是最早提出的GAN体系结构的有条件版本,无疑在合成数据时会产生更好的结果,另一方面另一方面, VAE-GAN遵循编码器-编码器体系结构,该体系结构利用学习的表示来更好地测量数据空间中的相似性,从而提高视觉保真度,最后例如是Memory GAN 遵循一种内存架构,可以缓解与无监督学习有关的两个主要问题, 生成器正确学习训练样本表示的能力以及鉴别器更好地记住已经看到的生成样本的能力。

Memory GAN follows a memory architecture that can alleviate two of the main issues related to unsupervised learning

记忆甘 遵循内存架构,可以缓解与无监督学习有关的两个主要问题

In summary, in what concerns architecture re-engineering, the research positions the solutions as following:

总而言之,在涉及架构再造的方面,研究将解决方案定位为:

  • Conditional generation

    有条件的产生
  • Generative-discriminative network pair

    生成-区分网络对
  • Join architecture leveraging encoders

    加入架构杠杆编码器
  • Improved Discriminator architectures

    改进的鉴别器架构
  • Exploration of Memory networks

    内存网络探索

引入新的损失函数 (Introducing new loss functions)

As the model parameters oscillate a lot, and can vary in a way that never converge, some have decided to explore new loss functions, to help GANs to reach a better optimum. In fact, several researchers have pointed out that the selection of the right loss function can effectively tackle the training instability. Improvements in the loss functions can be categorized as the proposal of a new probability distance and divergence, that can solve the mode collapse problem as it stabilized the GAN training as observed in WGAN or, with the introduction of Regularization or Gradient Penalty, as observed in WGAN-GP, which improved previously proposed WGAN, training stability.

由于模型参数波动很大,并且可能以从未收敛的方式变化,因此有些人决定探索新的损失函数,以帮助GAN达到更好的最优值。 实际上,一些研究人员指出,选择正确的损失函数可以有效地解决训练的不稳定问题。 损失函数的改进可以归类为新的概率距离和散度的提议,它可以解决模式崩溃问题,因为它可以稳定WGAN中观察到的GAN训练,或者可以引入正则化或梯度罚分,如WGAN-GP改进了先前提出的WGAN的训练稳定性。

检查替代优化算法 (Checking alternative optimization algorithms)

The concept behind GANs optimization is a min-max game, which often results in during the training process we are unable to find a local nash-equilibria, meaning, they fail to converge. In some articles found in the literature the use of Simultaneous Gradient Descent has been proposed, leading to a more stable training and improved convergence even on GAN architectures that are known to be hard to train.

GAN优化背后的概念是一个最小-最大游戏,它经常导致在训练过程中我们无法找到局部纳什均衡,这意味着它们无法收敛。 在一些文章中使用的文献中发现的同时梯度Descen已经提出了T,从而导致更稳定的培训和提高收敛甚至被称为是努力培养GAN架构。

GAN的未来 (The future of GANs)

Congratulations! In a nutshell, you’ve learned about the most commons challenges found when working with GANs along with some of the most commonly proposed solutions in the literature! From this review, it’s possible to understand that, although there are many challenges to be solved when working with GANs, they are without a doubt one of the most important findings in the area of Machine Learning in the latest years.

恭喜你! 简而言之,您已经了解了与GAN一起使用时发现的最常见挑战以及文献中最常见的解决方案! 从这篇评论中,可以理解,尽管使用GAN时有许多挑战需要解决,但是毫无疑问,它们是最近几年机器学习领域最重要的发现之一。

Hopefully, this review inspires you to start digging these amazing algorithms and explore new applications!

希望这篇评论能激发您开始挖掘这些惊人的算法并探索新的应用程序!

翻译自: https://towardsdatascience.com/what-is-going-on-with-my-gan-13a00b88519e

gan loss gan

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值