Main Content

监控GaN培训进度并确定常见的失败模式

Training GANs can be a challenging task. This is because the generator and the discriminator networks compete against each other during the training. In fact, if one network learns too quickly, then the other network may fail to learn. This can often result in the network not being able to converge. To diagnose issues and monitor on a scale from 0 to 1 how well the generator and discriminator achieve their respective goals you can plot their scores. For an example showing how to train a GAN and plot the generator and discriminator scores, see火车生成对抗网络(GAN)

The discriminator learns to classify input images as "real" or "generated". The output of the discriminator corresponds to a probability y ^ that the input images belong to the class "real".

发电机分数是对应于生成的图像的鉴别器输出的概率的平均值:

刻痕 = mean y ^ Generated 的)

在哪里 y ^ Generated contains the probabilities for the generated images.

鉴于 1 - y ^ 是属于类学“生成”的图像的概率,鉴别器分数是属于正确类的输入图像的概率的平均值:

scoreDiscriminator = 1 2 mean y ^ Real 的) + 1 2 mean 1 - y ^ Generated 的)

在哪里 y ^ Real contains the discriminator output probabilities for the real images and the numbers of real and generated images passed to the discriminator are equal.

在理想情况下,两个分数都是0.5。这是因为鉴别者无法讲述真假图像之间的差异。但是,在实践中,这种情况不是您可以实现成功GaN的唯一案例。

要监控培训进度,您可以随时随地检查图像并检查它们是否正在改进。如果图像没有改进,那么您可以使用分数图来帮助您诊断一些问题。在某些情况下,分数绘图可以告诉您没有关键培训,而且您应该停止,因为发生了故障模式,培训无法从中恢复。以下部分告诉您要在分数图中寻找什么,并在生成的图像中诊断某些常见的故障模式(收敛失败和模式崩溃),并表明您可以采取的动作来提高培训。

收敛失败

当发电机和鉴别器在训练期间没有达到平衡时,会发生收敛失败。

歧视者占主导地位

当发电机分数达到零或接近零时,这种情况发生这种情况,判别符分数到达一个或接近一个。

This plot shows an example of the discriminator overpowering the generator. Notice that the generator score approaches zero and does not recover. In this case, the discriminator classifies most of the images correctly. In turn, the generator cannot produce any images that fool the discriminator and thus fails to learn.

如果分数没有从这些值中恢复许多迭代,那么最好停止培训。如果发生这种情况,请尝试平衡发电机和鉴别器的性能:

  • 通过随机向真正的图像(单面标签翻转)将假标签进行虚假标签损害鉴别符

  • Impairing the discriminator by adding dropout layers

  • 通过增加其卷积层中的过滤器数量,提高发电机创建更多功能的能力

  • 通过减少其过滤器数量损害鉴别者

有关展示如何翻转真实图像标签的示例,请参阅火车生成对抗网络(GAN)

Generator Dominates

当发电机分数到达一个或接近一个时,这种情况发生了这种情况。

This plot shows an example of the generator overpowering the discriminator. Notice that the generator score goes to one for a many iterations. In this case, the generator learns how to fool the discriminator almost always. When this happens very early in the training process, the generator is likely to learn a very simple feature representation which fools the discriminator easily. This means that the generated images can be very poor, despite having high scores. Note that in this example, the score of the discriminator does not go very close to zero because it is still able to classify correctly some real images.

如果分数没有从这些值中恢复许多迭代,那么最好停止培训。如果发生这种情况,请尝试平衡发电机和鉴别器的性能:

  • 通过增加过滤器数量,提高鉴别者了解更多功能的能力

  • Impairing the generator by adding dropout layers

  • 通过减少其滤波器数量损害发电机

Mode Collapse

模式崩溃是甘甘产生具有许多重复项(模式)的少量图像时。当生成器无法学习丰富的特征表示时,会发生这种情况,因为它学会将类似的输出与多个不同的输入相关联。要检查模式折叠,请检查生成的图像。如果输出中几乎没有多样性,其中一些几乎相同,则可能的模式崩溃。

This plot shows an example of mode collapse. Notice that the generated images plot contains a lot of almost identical images, even though the inputs to the generator were different and random.

如果您遵守此操作,请尝试提高生成器创建更多不同输出的能力:

  • 将输入数据的尺寸增加到发电机

  • 增加发电机的过滤器数量,以允许它产生更广泛的功能

  • 通过随机向真正的图像(单面标签翻转)将假标签进行虚假标签损害鉴别符

有关展示如何翻转真实图像标签的示例,请参阅火车生成对抗网络(GAN)

也可以看看

||||||

Related Topics