Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in adaptive instance normalization in residual blocks of generator (decoder) ? #12

Open
prashnani opened this issue Dec 10, 2018 · 4 comments

Comments

@prashnani
Copy link

Hi, thanks for this Tensorflow implementation!

I was wondering if there is an error in the way adaptive instance normalization is performed in the generator (line 135 in MUNIT.py)?

In the original code by the authors, it seems that they compute mu and sigma for each of the layers of residual blocks of decoder (see assign_adain_params - line 130 in networks.py ). But in your code, it seems like mu and sigma are the same across all of the residual blocks. Could you please clarify?

@taki0112
Copy link
Owner

I may not be able to understand your question because I am not good at English.

To answer your question, adain_params is gamma and beta values obtained from MLP. (The author code is mean, std, but the article is written as gamma, beta.)

Use adain_params for the residual block value using AdaptiveInstanceNorm2d in weight, bias

At this time, gamma and beta are not different for each layer.
Gamma, beta with the same value obtained from the MLP.

If you do not understand, you can ask me again, I'm fine.

@prashnani
Copy link
Author

Thanks for your prompt reply!

Your code has same gamma and beta for each of the 'adaptive_resblock' of the generator.

The original author's code has different gamma and beta for each resblock of the generator.

I was just thinking about the reason behind this difference?

@taki0112
Copy link
Owner

taki0112 commented Dec 11, 2018

I think original author's code has not different gamma, beta.. SAME !

Because assign_adain_params takes gamma and beta from the adain_params whose values are fixed while for the for statement.

@prashnani
Copy link
Author

prashnani commented Dec 11, 2018

Thanks for your reply! Perhaps I am missing something...here is how I understood it:

In the original author code, the num_adain_params returned by get_num_adain_params function is 4096. That is, there are total 4096 parameters for adaIN operation.

These 4096 parameters in the original author code represent the total number of gamma and beta values of each of the 256 feature maps of 4 residual blocks of the decoder.
That is, 4096 = 256 (number of feature maps) * 4 (number of residual blocks) * 2 (number of conv layers per residual block) * 2 (gamma and beta).
These 4096 entries are then assigned to their respective residual block by assign_adain_params function.

In your current code, the number of adaIN parameters are 256 for gamma + 256 for beta (total 512 adain_params).

So I was a bit confused by this difference (512 vs 4096 adaIN parameters). Perhaps 512 is the intended choice of your implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants