bobchennan / Wasserstein-GAN-Keras

Keras implementation of Wasserstein GAN. Modified from the ACGAN example.
39 stars 14 forks source link

Confusion with Wasserstein about Implementations #1

Closed pengpaiSH closed 7 years ago

pengpaiSH commented 7 years ago

@bobchennan Hi Chennan, glad to see your implementations of WGANs. Thank you for your contribution. When reading your codes, I see two main changes that you have made: (1) Line 55: K.mean(target*output) (2) Line 133: replace 'linear' with 'sigmoid' in the original GANs. Could you please explain why these changes could implement the WGAN? Besides, are you computing Wasserstein Distance by using K.mean(target*output)? Looking forward to your reply.

bobchennan commented 7 years ago

You can read the original paper or this tutorial. Briefly speaking for the first WGAN used a the difference between two expectation as the objective function, so we used +1 -1 to represent that.

pengpaiSH commented 7 years ago

@bobchennan Thank you for your feedback! One question is is: any difference when we define y_true = -1 or y_true = +1?

bobchennan commented 7 years ago

I am not sure but I think it is different.

appierys commented 7 years ago

changing y_true = -1 or y_true = +1 would reverse the sign of the loss, which clearly is undesirable.