TL;DR
Standard convolutional neural networks (CNNs) are surprisingly bad at simple spatial tasks, like mapping a coordinate to a specific pixel. This paper introduces CoordConv, a simple yet powerful modification that adds coordinate information as extra input channels, enabling networks to learn spatial transforms with perfect generalization and massive efficiency gains across GANs, object detection, and reinforcement learning.
What Problem Does This Paper Address?
Deep learning's reliance on convolution is based on the intuition of translation invariance: a filter that detects a "cat" should work the same way whether the cat is in the top-left or bottom-right corner. However, many tasks require translation dependence—knowing exactly where something is.
The authors identify a fundamental "coordinate transform problem." They show that standard CNNs struggle to map between dense Cartesian $(x, y)$ coordinates and sparse, pixel-based representations (like a one-hot pixel map). Even on seemingly trivial toy tasks, standard CNNs fail to generalize to unseen areas of an image, often resorting to brute-force memorization of the training set.
Methods
The proposed solution is the CoordConv layer. It is a simple peer-to-peer replacement for the standard convolutional layer.
Instead of just receiving the input feature map, the CoordConv layer concatenates extra channels that contain hard-coded coordinates. For a 2D image, it adds two channels:
- An $i$-coordinate channel (rows filled with 0, 1, 2...).
- A $j$-coordinate channel (columns filled with 0, 1, 2...).
These coordinates are normalized to the range $[-1, 1]$. Because these channels are just extra inputs, the network can choose to use them (learning spatial dependence) or ignore them by setting their weights to zero (reverting to standard translation-invariant convolution). This makes CoordConv a flexible generalization of standard convolution.
Datasets
The authors used a mix of toy and real-world datasets:
- Not-so-Clevr: A new toy dataset introduced in this paper consisting of 9x9 squares on a 64x64 canvas. It includes Cartesian coordinates, one-hot center pixels, and rendered images.
- Sort-of-CLEVR: Used to evaluate GANs and VAEs on colored shape generation.
- MNIST (Modified): Digits scattered on a canvas to test object detection.
- LSUN Bedrooms: A large-scale dataset for high-resolution generative modeling.
- Atari Games: Used to test the impact of CoordConv on Reinforcement Learning agents.
Key Insights and Ideas
- The "Blind" Filter: Standard convolutional filters are spatially "blind." They have no idea where they are located on the image canvas. CoordConv gives them a "GPS."
- Generalization vs. Memorization: In the "quadrant split" test (where the model is trained on three quadrants and tested on the fourth), standard CNNs fail completely. They cannot extrapolate spatial rules to new regions. CoordConv, however, learns the underlying mathematical relationship and generalizes perfectly.
- Mode Collapse in GANs: The authors hypothesize that some "mode collapse" (where a GAN only generates a few types of images) is actually a spatial failure. If a GAN finds it too hard to learn how to place objects in different $(x, y)$ positions, it might just give up and place them in the same spot every time. CoordConv makes this mapping easier, leading to more diverse samples.
- Efficiency: Because CoordConv doesn't have to "reinvent" spatial awareness through complex combinations of filters, it often requires 10–100 times fewer parameters and trains significantly faster.
Key Results
- Coordinate Classification: On the task of turning $(x, y)$ into a pixel, standard CNNs reached only 86% accuracy after an hour of training. CoordConv reached 100% accuracy in seconds.
- Object Detection: Adding CoordConv to a Faster R-CNN model improved the Intersection over Union (IOU) by 24% on a digit detection task.
- Generative Modeling: GANs using CoordConv showed much less mode collapse. When interpolating in latent space, CoordConv GANs showed smooth geometric translations (objects moving across the screen), whereas standard GANs often showed objects "fading" in and out.
- Reinforcement Learning: RL agents playing Atari games saw score improvements in 6 out of 9 games tested, with no significant performance drops in the others.
Limitations and Future Work
- Image Classification: The authors note that CoordConv provides negligible benefits for standard ImageNet classification. This makes sense, as classification is the one task where pure translation invariance is actually a feature, not a bug.
- Future Directions: The authors suggest exploring CoordConv's impact on relational reasoning, language tasks, and video prediction. They also release their code to allow the community to use it as a "drop-in" replacement for standard convolution in any architecture.
Summary updated