Padding is a ubiquitous "hack" in deep learning used to maintain spatial dimensions across convolutional layers. However, by adding artificial pixels at boundaries, standard padding introduces artifacts, spatial bias, and physical inconsistencies. This paper presents a mathematically rigorous alternative that eliminates the need for padding by reframing convolution as a local differential operator. By preserving the differential characteristics of kernels, the proposed method significantly reduces edge artifacts and improves model accuracy across diverse tasks.
The Problem with Padding
In standard convolutional neural networks (CNNs), padding (e.g., zero, reflection, or circular) is used to ensure output feature maps match input dimensions. While effective for data alignment, padding is fundamentally flawed for several reasons:
- Artifacts: It introduces "fake" information, leading to visible boundary artifacts.
- Spatial Bias: It can inadvertently teach networks to rely on absolute pixel positions rather than relative features.
- Physics Incompatibility: In physics-informed machine learning, padding often imposes incorrect boundary conditions (like a forced zero-value), violating the underlying partial differential equations (PDEs) the model aims to solve.
Methodology: Preservation of Differential Characteristics
The core innovation of this work is treating convolution not as a discrete sliding window, but as a linear differential operator evaluated on a continuous representation of the image. The authors utilize Lagrange interpolating polynomials to represent the image locally within a sliding window.
When a sliding window hits a boundary and becomes "incomplete" (Window B in the figure above), the method does not pad. Instead, it identifies the nearest valid, complete window (Window A) and calculates a transformed kernel. Applying this transformed kernel to the valid window yields the same differential result as if the missing pixels for the boundary window were present. This transformation is a precomputable matrix operation based on the kernel size, making the method nearly as computationally efficient as standard padding.
Experimental Results
The authors evaluated their "Diff" method against standard techniques across analytical fields (Chebyshev polynomials, Spherical harmonics), physical simulations (Navier-Stokes), and computer vision benchmarks (Caltech-101, Cityscapes).
Key Insights
- Filtering Accuracy: In image filtering tasks, the "Diff" method achieved errors 1–2 orders of magnitude lower than standard extrapolation or padding techniques.
- Classification Performance: On the Caltech-101 dataset, a U-Net using the "Diff" method reached 55.8% accuracy, significantly outperforming zero-padding (30.7%) and competing with more complex explicit boundary handling (EBH) methods (53.2%).
- Artifact Reduction: In super-resolution tasks using geospatial data (ETOPO-15''), the method almost entirely eliminated the grid-like boundary artifacts common in padding-based models.
- Efficiency: Training time remained comparable to circular padding and was approximately 8x faster than EBH.
Conclusion and Future Work
By treating kernels as differential operators, this approach provides a theoretically grounded solution to the boundary problem in CNNs. While the method relies on local smoothness assumptions for polynomial interpolation, it consistently outperforms traditional padding. Future work will explore applications in specific PDE-constrained learning and adapt the formulation for irregular or even-sized kernels.
Summary updated