martinarjovsky / WassersteinGAN

BSD 3-Clause "New" or "Revised" License
3.21k stars 725 forks source link

Quetions about the D out #27

Closed yichuan9527 closed 7 years ago

yichuan9527 commented 7 years ago

D for real images output is always negative, for generated images, the output is always positive. Why does this happen? And, I find that training for a long time later, D's Loss tends to 0, and G's Loss also tends to 0. I think if D and G to achieve game balance, G's Loss should tend to 0.5. How do you see this question? Thanks very much

martinarjovsky commented 7 years ago

This is not a classification problem, the loss of the discriminator should be negative (since outputting 0 would get a 0 loss and it's trying to minimize), see equation 3 of the paper.

The negative loss of the discriminator is an estimate for the Wasserstein distance, under a perfect generator the loss of the discriminator should be 0.

yichuan9527 commented 7 years ago

Thank you for your answer. I would like to know the value of the convergence of G‘s loss in your experiment. is 0.5?

martinarjovsky commented 7 years ago

I haven't plotted it. Note however that the loss of the generator doesn't have to be meaningful, only it's gradient. If you change the critif f(x) to be f(x) + a for some positive constant a, the generator loss would shift by a, even though the gradient of the generator and the critic's loss are unaffected.

That being said assuming E_gen[ f(x) ] is similar to - E_real[ f(x) ], the generator's loss should converge to 0.

Note that 0.5 is not really a meaningful number in here. It is in a normal gan setting since this would mean the discriminator assigns the same probability for examples to be real or fake, but in here the critic is not trained with a classification loss or with a sigmoid at the end, so a number like 0.5 shouldn't really appear (or as much as any other random number).