igul222 / improved_wgan_training

Code for reproducing experiments in "Improved Training of Wasserstein GANs"
MIT License
2.35k stars 668 forks source link

Conditioning Generator with label information #55

Closed ghost closed 6 years ago

ghost commented 6 years ago

Thank you for sharing the code. Can you please provide insights of Supervised WGAN with label input:

  1. how is generator conditioned with label information? There is no one-hot label vector concat to the latent variable input. The label information is only used at the Conditional batch norm of the generator.

  2. At the inference time, how do you force the Generator to produce certain class image? Where does the class input is used in the generator network?

ghost commented 6 years ago

The Conditional batch norm does the trick:)

Never knew that a small set of shift&scale parameters encodes class information. Kudos!

ysharma1126 commented 6 years ago

So how do you force the generator to produce a certain class image at inference time?

ghost commented 6 years ago

The batch-norm layer in the Generator is conditioned on the label information. It has unique scale & shift normalization parameters for each label.

Based on the label input at inference time, it chooses the corresponding params to produce a class-specific image from the given latent vector

pierremac commented 6 years ago

I understand that it makes the implementation lighter, especially when you want to reuse the same code for classic and conditional WGAN. But do you (or anyone) know how this compares to actually feeding the label as an input (like concatenating the conditions to the noise) to the generator, like in some other implementations? Also, I guess that this works for categorical conditions with one-hot encoding, but doesn't really apply to continuous conditions or non-exclusive categories, right?

ghost commented 6 years ago

The current code is conditioned in a discrete way, selecting single class only.

Having said that, I came across some works on WGAN-GP in ICLR 2018- Projection Discriminator GAN, Spectral Normalization GAN, where the conditional batch-norm params of two classes are interpolated to produce a morphed image. please check for demo.. https://www.youtube.com/watch?v=hgJpyW4WIko

you may use this technique to enforce a continuous conditioning at inference time.

And even i didn't come across the comparative study of one-hot concat conditioning vs conditional batch norm.

pierremac commented 6 years ago

I had not come across those yet! Thanks a lot for the pointers.

HarveyYan commented 6 years ago

What looks weird is this conditional batch norm doesn't track statistics such as moving mean and moving variance when training. At inference, it normalize a batch of test samples using its empirical mean and variance only. So why not building a conditional batch norm on top of a full batch norm?