Few ideas have enjoyed as large an impact on deep learning as the convolution operation. For any problem involving pixels or spatial representations, common intuition holds that convolutional neural networks (CNNs) are the appropriate tool. However, standard CNNs harbor a surprising blind spot: they are remarkably poor at simple coordinate transforms, such as mapping $(x, y)$ Cartesian coordinates to a specific pixel in one-hot space.
In this summary, we explore a striking counterexample to the intuition of universal CNN applicability and introduce CoordConv, a simple architectural fix that enables perfect generalization and massive efficiency gains across tasks ranging from object detection to generative modeling.
The Coordinate Transform Problem
The core strength of a CNN is translation invariance. A filter trained to detect a "cat" works identically whether that cat appears in the top-left or bottom-right of an image. This efficiency is achieved by sharing weights across all spatial locations.
However, this very strength becomes a liability for tasks requiring coordinate awareness. Mapping between a dense Cartesian representation (like $(x, y)$ coordinates) and a sparse pixel-based representation (like a one-hot image) is fundamentally difficult for standard convolutions. While a CNN can eventually learn to track its position by using the edges of the image as anchors, this workaround is computationally expensive, parameter-heavy, and often fails to generalize to unseen spatial locations.
The CoordConv Solution
The proposed solution, CoordConv, is elegantly simple. Instead of providing a convolutional layer with only the standard input features, CoordConv concatenates extra channels that contain the hard-coded coordinates of each pixel.
- Standard Conv: Maps an input of shape $h \times w \times c$ to an output.
- CoordConv: Adds two extra channels—one for the $i$ (row) coordinate and one for the $j$ (column) coordinate—resulting in an input of $h \times w \times (c+2)$.
These coordinates are typically normalized to the range $[-1, 1]$. In some experiments, a third radial coordinate $r = \sqrt{i^2 + j^2}$ is also added to provide distance-from-center information. Because these coordinates are simply appended as extra channels, the rest of the network remains a standard CNN. If a specific task does not require coordinate information, the network can simply learn to set the weights for those coordinate channels to zero, effectively reverting to a standard convolution.
Experimental Tasks and Datasets
To demonstrate the efficacy of CoordConv, the authors evaluated the layer across a wide spectrum of tasks:
- Not-so-Clevr: A custom toy dataset consisting of $9 \times 9$ squares randomly positioned on a $64 \times 64$ canvas. It is used to test supervised coordinate classification, regression, and rendering.
- Sort-of-CLEVR: Used to evaluate Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs).
- LSUN (Bedroom scenes): A large-scale dataset used to test if CoordConv improves high-resolution generative modeling.
- MNIST Detection: An object detection task where digits are scattered across a larger canvas.
- Atari: Nine different games used to evaluate Reinforcement Learning (RL) agents.
Key Insights and Results
The inclusion of CoordConv yields dramatic improvements in both efficiency and performance across multiple domains:
Solving the Generalization Gap and Efficiency On the "Not-so-Clevr" dataset, standard CNNs could memorize the training set but failed spectacularly on a "quadrant split" (where one corner of the image was reserved exclusively for testing). CoordConv, by contrast, achieved perfect generalization. Furthermore, to solve a simple coordinate mapping, a standard CNN required 200,000 parameters and over an hour of training to reach 86% accuracy. CoordConv reached 100% accuracy in just 15 seconds using only 7,500 parameters.
Fixing GAN Mode Collapse In GANs, "mode collapse"—where the generator only produces a limited variety of images—often occurs because the network struggles to map latent spatial variables to pixel space. CoordConv makes this mapping trivial. As a result, CoordConv GANs achieved higher entropy (indicating less mode collapse) while using only 7% of the parameters of the convolutional baseline. In LSUN bedroom generation, standard GANs often show objects "fading in and out" during latent space interpolation. CoordConv GANs instead demonstrate smooth geometric translation, where objects physically move across the generated room.
Object Detection and Reinforcement Learning Adding CoordConv to a Faster R-CNN model on the scattered MNIST task improved the Intersection over Union (IOU) by a massive 24%. In the RL domain, agents using CoordConv saw significant score improvements in 6 out of 9 Atari games, as the explicit coordinate information helped the agent better track moving entities on screen.
Preserving Translation Invariance Interestingly, CoordConv provided almost no benefit for standard ImageNet classification (+0.04% accuracy). Rather than a failure, this confirms the intuition that pure object recognition is (and should be) largely translation invariant. The network simply learns to ignore the coordinate channels when they aren't useful.
Limitations and Future Work
The authors acknowledge that CoordConv is not a universal "silver bullet." Its benefits are heavily concentrated in problems where the spatial location of features is just as important as the features themselves. Future work suggests testing CoordConv's impact on relational reasoning (understanding the distance and position between multiple objects), applying the layer to language tasks or video prediction, and investigating how CoordConv handles spatial perturbations or adversarial attacks.
Summary updated