top of page

Why a One-Pixel Shift Can Change a CNN Prediction

Oct 5
2 min read

Same part. Same defect. One pixel to the right—and a different prediction.


A CNN can behave this way without anything random happening. One reason is how it downsamples its feature maps.


The sampling grid matters


Stride-one convolution is translation-equivariant away from image boundaries: move the input, and the feature map moves with it. That is different from invariance, where the output stays unchanged.


Downsampling complicates this. Consider a toy feature-map row, keeping every second position:


Original:       [0, 0, 1, 0, 0, 0] → [0, 1, 0]
Shifted right:  [0, 0, 0, 1, 0, 0] → [0, 0, 0]

The peak still exists. It simply falls between the retained positions.


This illustrates the sampling step, not a complete CNN. But strided convolutions and pooling contain this step—and learned filters are not guaranteed to prevent aliasing. Zhang, 2019.


Filter before downsampling


Anti-aliasing applies a low-pass filter before reducing spatial resolution. It suppresses rapid spatial variations that the coarser grid cannot reliably represent.


For max-pooling, the BlurPool approach separates the operations: evaluate the maximum at stride one, blur the resulting feature map, then subsample. This can improve prediction consistency under small shifts. BlurPool paper.


It is not a guarantee. Nonlinearities such as ReLU can still turn small differences into different outputs, while padding creates separate boundary effects. Excessive smoothing can also sacrifice useful detail. Chaman & Dokmanić, 2021.


What I’d test in an inspection system


Before changing the architecture, I’d compare predictions across small horizontal and vertical shifts:


  • Keep the defect fully visible; document cropping and padding.

  • Measure score changes and pass/fail disagreements.

  • Check tiny defects separately when evaluating anti-aliasing.


A consistent prediction can still be consistently wrong, so stability must be checked alongside accuracy.


A one-pixel shift is a small input change—not automatically a small computational change.

Recent Posts

See All
Every Part Looks Fine. The Assembly Is Wrong.

Imagine inspecting an assembly kit. The tray should contain five washers. This one contains four. Every washer looks perfect. No scratches, no contamination, no unusual shape. The kit is still wrong.

 
 

Let's talk industrial AI, engineering, and teams.

Thank you for reaching out!

© 2026 by Zeeshan Karamat. All rights reserved.

bottom of page