In a convolutional neural network, anti-aliased pooling reduces artifacts during spatial downsampling by blurring the pooled result. A PyTorch MaxPool2dAA implementation applies max pooling with stride 1, then blurs with a filter whose size scales with the pooling factor; its default filter ratio is 1.7. section 14.1.3
class MaxPool2dAA(nn.Module):
def __init__(self, kernel_size=2, ratio=1.7):
"""
kernel_size: how much to pool by
ratio: how much larger the blurring filter should be than the
pooling size
"""
super(MaxPool2dAA, self).__init__()
blur_ks = int(ratio*kernel_size) #1
self.blur = BlurLayer(kernel_size=blur_ks, #2
stride=kernel_size, D=2)
self.kernel_size = kernel_size #3
def forward(self, x):
ks = self.kernel_size
tmp = F.max_pool2d(x, ks, stride=1, padding=ks//2) #4
return self.blur(tmp) #5
#1 Makes a slightly larger filter for blurring
#2 Creates the blur kernel
#3 Stores the pooling size
#4 Applies pooling with stride=1
#5 Blurs the result
The implementation shows the stride-1 max-pooling step followed by blurring. section 14.1.3
Testing shifted images
On CIFAR-10, compare the correct-class probabilities for an image across 64 pixel shifts. Anti-aliased pooling makes predictions more consistent than regular pooling in the reported test, but does not eliminate aliasing. section 14.1.3

