Aliasing occurs when fine-grained information is sampled into a smaller representation. Distinct inputs can collapse into the same output, producing block-like artifacts and lost detail; shrinking more aggressively worsens the problem. section 14.1
In convolutional neural networks, aliasing matters because it:
- Appears visibly as pixelated or garbled patterns when max pooling reduces detailed images, such as zebra stripes. section 14.1
- Makes different one-dimensional patterns produce identical max-pooled outputs. section 14.1
- Compromises translation invariance, so predictions can fluctuate as image content shifts by a few pixels. section 14.1.1
- Also affects average pooling and convolutions with stride two or greater. section 14.1.3
Anti-aliased pooling
Reduce aliasing by separating selection from downsampling: apply max pooling with stride 1, then blur the result with a binomial-kernel convolution using the desired stride. In PyTorch, MaxPool2dAA follows this pattern and can replace ordinary max pooling. The resulting CNN gives more consistent predictions across shifted CIFAR-10 crops, although it does not eliminate aliasing completely. section 14.1.2 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
Inspect the MaxPool2dAA implementation, which performs stride-1 max pooling followed by a larger blur layer. section 14.1.3

