Anti-aliasing reduces prediction changes caused by image shifts by filtering around spatial reduction. In convolutional networks, anti-aliased pooling replaces regular pooling while preserving the surrounding architecture. 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
Implement anti-aliased max pooling by applying max pooling with stride 1, then passing the result through a blur layer whose filter size scales with the pooling size. section 14.1.3
A practical implementation follows these choices:
- Use the pooling kernel size to control spatial reduction and multiply it by a ratio, defaulting to 1.7, to select the blur filter size. section 14.1.3
- Replace each regular pooling operation with MaxPool2dAA while leaving the network, optimizer, scheduler, and training procedure unchanged. section 14.1.3
Shifted-image predictions
Evaluating all 64 pixel shifts of a CIFAR-10 image produces more consistent correct-class probabilities with anti-aliased pooling, although aliasing is not eliminated. section 14.1.3 section 14.4

