Pytorch-cyclegan-and-pix2pix: Why did you only multiply Discriminator loss by 0.5?

Created on 20 Apr 2018  路  1Comment  路  Source: junyanz/pytorch-CycleGAN-and-pix2pix

Why did you only multiply Discriminator loss by 0.5?

def backward_D_basic(self, netD, real, fake):
        # Real
        pred_real = netD(real)
        loss_D_real = self.criterionGAN(pred_real, True)
        # Fake
        pred_fake = netD(fake.detach())
        loss_D_fake = self.criterionGAN(pred_fake, False)
        # Combined loss
        loss_D = (loss_D_real + loss_D_fake) * 0.5
        # backward
        loss_D.backward()
        return loss_D

For lsgan, multiply both D and G by 0.5. But you did not.
Why? Is there a difference in the results?

Most helpful comment

0.5 applies to both LSGAN and DCGAN. criterionGAN is a class for both objectives. 0.5 should make no big difference. In practice, we divide the objective by 2 while optimizing D, which slows down the rate at which D learns relatively to G.

>All comments

0.5 applies to both LSGAN and DCGAN. criterionGAN is a class for both objectives. 0.5 should make no big difference. In practice, we divide the objective by 2 while optimizing D, which slows down the rate at which D learns relatively to G.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShaniGam picture ShaniGam  路  4Comments

khryang picture khryang  路  3Comments

nootfly picture nootfly  路  4Comments

JamesChenChina picture JamesChenChina  路  3Comments

AlexanLee picture AlexanLee  路  4Comments