如何解释生成对抗网络中的歧视者损失和生成者损失? [英] How to interpret the discriminator's loss and the generator's loss in Generative Adversarial Nets?

查看:1021
本文介绍了如何解释生成对抗网络中的歧视者损失和生成者损失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读人们对DCGAN的实现,尤其是在Tensorflow中的.

在该实现中,作者绘制了鉴别器和生成器的损耗,如下所示(图像来自解决方案

不幸的是,就像您对GAN所说的那样,损失是非常不直观的.主要是由于生成器和鉴别器相互竞争这一事实,因此,一方面改进意味着另一方损失更高,直到另一方更好地了解接收到的损失,从而加剧了竞争对手的竞争等. >

现在应该经常发生的一件事(取决于您的数据和初始化)是鉴别器和生成器损耗都收敛到一些永久性数字,例如: (损失可以反弹一点是可以的-这只是模型试图自我完善的证据)

这种损失收敛通常表示GAN模型找到了一些最佳值,无法进一步提高,这也意味着它已经学到了足够的知识. (还请注意,数字本身通常并不能提供很多信息.)

以下是一些注意事项,希望对您有所帮助:

I am reading people's implementation of DCGAN, especially this one in tensorflow.

In that implementation, the author draws the losses of the discriminator and of the generator, which is shown below (images come from https://github.com/carpedm20/DCGAN-tensorflow):

Both the losses of the discriminator and of the generator don't seem to follow any pattern. Unlike general neural networks, whose loss decreases along with the increase of training iteration. How to interpret the loss when training GANs?

解决方案

Unfortunately, like you've said for GANs the losses are very non-intuitive. Mostly it happens down to the fact that generator and discriminator are competing against each other, hence improvement on the one means the higher loss on the other, until this other learns better on the received loss, which screws up its competitor, etc.

Now one thing that should happen often enough (depending on your data and initialisation) is that both discriminator and generator losses are converging to some permanent numbers, like this: (it's ok for loss to bounce around a bit - it's just the evidence of the model trying to improve itself)

This loss convergence would normally signify that the GAN model found some optimum, where it can't improve more, which also should mean that it has learned well enough. (Also note, that the numbers themselves usually aren't very informative.)

Here are a few side notes, that I hope would be of help:

  • if loss haven't converged very well, it doesn't necessarily mean that the model hasn't learned anything - check the generated examples, sometimes they come out good enough. Alternatively, can try changing learning rate and other parameters.
  • if the model converged well, still check the generated examples - sometimes the generator finds one/few examples that discriminator can't distinguish from the genuine data. The trouble is it always gives out these few, not creating anything new, this is called mode collapse. Usually introducing some diversity to your data helps.
  • as vanilla GANs are rather unstable, I'd suggest to use some version of the DCGAN models, as they contain some features like convolutional layers and batch normalisation, that are supposed to help with the stability of the convergence. (the picture above is a result of the DCGAN rather than vanilla GAN)
  • This is some common sense but still: like with most neural net structures tweaking the model, i.e. changing its parameters or/and architecture to fit your certain needs/data can improve the model or screw it.

这篇关于如何解释生成对抗网络中的歧视者损失和生成者损失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆