Comments (8)
Thanks for the question!
Yes, upsample with ConvTranspose2d
with groups=in_channels
, and then use [1, 1]
or [1, 2, 1]
as your weights.
For TensorFlow, perhaps you can refer to the StyleGan2 code/paper, which does smoothed upsampling as well.
from antialiased-cnns.
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.
from antialiased-cnns.
Yes, it makes a difference. The second (BlurPool-->Conv-->ReLU) works worse, because it destroys information as the first step.
from antialiased-cnns.
@richzhang
Thanks for the answer (and also the reference to StyleGAN example)!
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?
(i.e., Conv (stride 1) -> ReLU -> BlurPool (stride 2) vs. BlurPool (stride 2) -> Conv (stride 1) -> ReLU)
It seems that putting BlurPool before Conv could save computation, but I wonder how the performance would be.
Could you share your thoughts or experiences on this?
Thank you!
from antialiased-cnns.
but subpixel upscale layer is not antialiased?
from antialiased-cnns.
In paper there is not much information on antialiased upsampling(or I just don't get it):
We mirror the downsampling by applying the same filter after upsampling. Note that applying the Rect-2 and Tri-3 filters while upsampling correspond to “nearest” and “bilinear” upsampling, respectively
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?
from antialiased-cnns.
Looking at StyleGan2 code, seems they are doing it like:
blur(upsample(x)):
https://github.com/NVlabs/stylegan2/blob/7d3145d23013607b987db30736f89fb1d3e10fad/training/networks_stylegan.py#L519
downsample(blur(x)):
https://github.com/NVlabs/stylegan2/blob/7d3145d23013607b987db30736f89fb1d3e10fad/training/networks_stylegan.py#L607
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
from antialiased-cnns.
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.
from antialiased-cnns.
Related Issues (20)
- Is the blur_kernel trainable or parametric? HOT 1
- RuntimeError when training resnext50_32x4d HOT 2
- can Downsample use tensorflow? HOT 1
- Depthwise convolutions HOT 1
- 3D implementation ? HOT 4
- Larger strides/downsampling factors HOT 2
- About Internal feature distance for shift Equivariance visualization HOT 2
- Increased memory usage vs. torchvision equivalent HOT 3
- ResNet parameter "pool_only=True" HOT 1
- Max-blur-pool used in text recognition model (CRNN) HOT 1
- HTTP Error 403: Forbidden when loading weights HOT 2
- Any plans to explore using sinc filter for downsampling? HOT 1
- Padding size issue for small images HOT 2
- Could you please provide a 3D implementation in pytorch?
- Feature Req: Making the channel argument optional
- Feature Req: Separable Convolution
- Is there any particular reason for puting Blurpool before the skip-connection layers? HOT 3
- Why do deeper CNNs have better shift consistency? HOT 2
- If stride=1, is there a difference between BlurPool and maxpool
- HTTP Error 403: Forbidden when loading weights HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from antialiased-cnns.