Convolutional Neural Networks (CNNs) are theoretically celebrated for their translation invariance. In a perfectly translation-invariant system, a filter’s response should depend only on the local pattern it encounters, regardless of where that pattern appears in the frame. However, empirical evidence suggests that modern CNNs possess a surprising awareness of absolute spatial coordinates.
This spatial awareness is not a bug, but a byproduct of a standard architectural choice: zero-padding. By padding the borders of an image with zeros to maintain spatial resolution, we inadvertently provide the network with a set of fixed landmarks.
The Boundary as a Spatial Anchor
In a standard convolutional layer, a filter slides across the input. When that filter reaches the edge of the image, it encounters the zero-padded boundary. This creates a unique signature—a transition from data to "nothingness"—that does not exist anywhere else in the interior of the image.
Md. Amirul Islam, Sen Jia, and Neil D. B. Bruce demonstrate in How much Position Information Do Convolutional Neural Networks Encode? that these boundaries act as "spatial anchors." A filter can learn to detect the presence of these zeros. Once a single layer identifies its distance from a boundary, subsequent layers can propagate this information deeper into the network.
Through successive convolutions, the network "triangulates" its position. If a feature map knows how far it is from the top-left corner and the bottom-right corner, it effectively possesses a global coordinate system. This allows the network to break translation invariance and learn features that are specific to certain regions of the image.
Localization Without Coordinate Grids
This implicit encoding explains how architectures that appear to be "fully convolutional" (and thus theoretically invariant) can perform tasks that require absolute localization.
A prime example is YOLACT: Real-Time Instance Segmentation. In this work, Daniel Bolya and colleagues developed a system that generates global "prototype masks." These masks are not tied to specific bounding boxes; instead, they are image-sized maps that often highlight specific spatial regions (e.g., a mask that only activates on the left side of the image).
The researchers found that YOLACT’s fully convolutional backbone could generate these spatially-grounded masks without any explicit coordinate inputs or positional embeddings. The network simply leverages the implicit spatial information provided by the zero-padding at the image boundaries to "know" where it is producing a mask.
Why It Works: The Propagation of Bias
The intuition behind this phenomenon can be summarized in three steps:
- Detection: Filters at the edge of the feature map detect the sharp transition between image pixels and padded zeros.
- Propagation: Because kernels have a receptive field larger than a single pixel, the "knowledge" of the boundary leaks into the interior pixels in the next layer.
- Integration: As the network gets deeper, the receptive field grows. Eventually, neurons in the center of the feature map have a receptive field that touches the padded boundaries, allowing them to calculate their exact offset from the edges.
This discovery shifts our understanding of CNNs from purely local pattern matchers to models that inherently understand the global geometry of their input canvas, provided that the canvas has a defined border.