ray0809 / simple-wgan-with-minist

simple WGAN implementated by keras
9 stars 5 forks source link

a problem of your wasserstein_loss #1

Open yutian-wang opened 7 years ago

yutian-wang commented 7 years ago

hi, I just start to learn Keras and GAN. Fortunately, I found your codes which inspire me very much. but there is a point I can not figure out. in the original paper the wasserstein loss is E(fake)-E(ture) for critic and -E(fake) for generator, but in your codes you just use K.mean(y_true*y_pred) to calculate it. can you explain why you calculate it in this form? thanks very much

ray0809 commented 7 years ago

From the formula, It means

sum{ 1fake + (-1)true } and sum{ (-1)*fake }

where the 1 or -1 is the label, you can see the definition in the code of line 182,185,193

yutian-wang commented 7 years ago

It is genius idea! From the search result on Github, this is the only one example implemented in this form. but now there is a new improve about WGAN which add a penalty item. how can I do it in your style? the paper is https://arxiv.org/abs/1704.00028 and some others implement it by mixture of tensorflow and keras, https://github.com/rarilurelo/keras_improved_wgan

ray0809 commented 7 years ago

Sorry,I can not implement with keras,It's difficult to define the loss when compiling model I think using tensorflow to compute loss is a better way