【问题标题】:Why we use two losses while compiling the combined GAN (SRGAN) network为什么我们在编译组合 GAN (SRGAN) 网络时使用两个损失
【发布时间】:2020-11-01 05:31:20
【问题描述】:

我正在研究 SRGAN(超分辨率 GAN)。我遇到了一个代码,其中作者在编译鉴别器时使用了 MSE 损失。和两个损失,即二元交叉熵和 MSE,同时编译组合 GAN 模型。我不明白这些损失函数的用途。这是代码。 编译判别器的代码是:

discriminator = build_discriminator()
discriminator.compile(loss='mse', optimizer=common_optimizer, metrics=['accuracy']

而编译组合GAN模型的代码是:

adversarial_model = Model([input_low_resolution, input_high_resolution], [probs, features])
adversarial_model.compile(loss=['binary_crossentropy', 'mse'], loss_weights=[1e-3, 1],
                      optimizer=common_optimizer)

还有一件事.. 对于下面的代码行,我得到如下所示的输出。我不明白这个输出是什么意思。

g_loss = adversarial_model.train_on_batch([low_resolution_images, high_resolution_images],
                                          [real_labels, image_features])

Result of the above mentioned code

【问题讨论】:

    标签: loss-function loss generative-adversarial-network


    【解决方案1】:

    如果是生成器生成的假图像,则对真实图像进行 MSE 损失。如果是判别器判断的假图像,使用BCE损失。

    【讨论】:

    • 我两者都用,结合损失,使网络更强大,经过验证。
    猜你喜欢
    • 2019-04-17
    • 2018-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-27
    • 1970-01-01
    • 1970-01-01
    • 2019-11-26
    相关资源
    最近更新 更多