One-by-off errors in Computer Vision
We describe the diagnosis of a subtle off-by-one bug in an image segmentation pipeline built on segmentation-models.pytorch (SMP), used to detect Retrogressive Thaw-Slumps in satellite imagery. Large satellite scenes are cropped into overlapping tiles and stitched back together with a triangular-weighted blending scheme, but predictions from certain encoder-decoder architectures were occasionally shifted by one pixel toward the center of their tile. Through toy-dataset reproductions and controlled retraining across four architecture-encoder combinations, we trace the shift to an internal size mismatch in SMP's decoder: rather than rescaling feature maps to the expected output size, the library silently pads them, introducing a directional one-pixel offset near tile borders. We document the debugging process, the workaround we applied, and the broader lesson that even mature, widely used computer vision libraries can hide small but consequential bugs.