-
Notifications
You must be signed in to change notification settings - Fork 202
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
Are conv2d_transpose layers shift variant, too? #8
Comments
Thanks for the question. Upsampling convolution is shift-invariant, but if you do it naively, it is aliased and leads to stippling patterns. If you do bilinear upsampling (convolve with a [1 2 1] filter after doing the naive upsampling), then you are better antialiased. The StyleGAN paper does this, for example. |
@richzhang Can I ask one more question? In case of the strided convolutions, does the performance vary depending on whether the BlurPool is put before or after the convolution? Could you share your thoughts or experiences on this? Thank you! |
Yes, it makes a difference. The second (BlurPool-->Conv-->ReLU) works worse, because it destroys information as the first step. |
but subpixel upscale layer is not antialiased? |
In paper there is not much information on antialiased upsampling(or I just don't get it):
Is it should be done via torch.nn.ConvTranspose2d with groups= in_channels and with same filter as in downsampling code? Also seems there is not groups parameter in TensorFlow for conv_transpose, is there any workaround? i.e. use some layer that can do x2 upscale(bilinear resize, conv_traspose, pixel_shuffle, etc) and then add 'blur' layer(avr pool with stride 1 and kernel size 2x2) on top? |
Thanks for the question! Yes, upsample with For TensorFlow, perhaps you can refer to the StyleGan2 code/paper, which does smoothed upsampling as well. |
Looking at StyleGan2 code, seems they are doing it like: blur(upsample(x)): downsample(blur(x)): I wonder is this approach(i.e. via 2 steps) is different from resampling-by-convolution(i.e. via 1 step) ? https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html |
It's the same. The two steps can be folded into one. We don't actually blur the whole map at every spatial location and then subsample by factor of 2, since many of the calculations are thrown away. We simply evaluate the blur at every other location. |
Hi, thanks for sharing the code!
I really enjoyed reading your paper.
As I understand, you have mainly considered downsampling layers (pool, strided convolution)
does the same shift variance issue exist for conv2d_transpose layers as well?
If it does, could you share your insights on how to replace the layer?
Thanks very much!
The text was updated successfully, but these errors were encountered: