COTR: Correspondence Transformer for Matching Across Images

Wei Jiang, Eduard Trulls, Jan Hosang, Andrea Tagliasacchi, Kwang Moo Yi

Introduction

Finding correspondences—identifying the same physical point across different images—is a fundamental task in computer vision. Traditionally, the field has been bifurcated into sparse methods, which match a limited set of salient keypoints, and dense methods, which estimate a match for every pixel. While sparse methods excel in 3D reconstruction but fail in textureless regions, dense methods capture smooth motion but struggle with large displacements or distinct object boundaries.

COTR (Correspondence Transformer) proposes a unified framework that treats image matching as a functional mapping problem. By formulating matching as a function $\text{COTR}(x \mid I, I') = x'$, the model can predict the corresponding location $x'$ in image $I'$ for any arbitrary query point $x$ in image $I$. This approach bridges the gap between sparse and dense correspondence, allowing for flexible querying across various tasks.

COTR treats matching as a functional mapping $x \to x'$ across diverse scenarios, including wide-baseline stereo (a), object-level matching (b), and multi-view/lighting variations (c).

Methodology

The COTR architecture leverages the global context-capturing capabilities of Transformers to perform coordinate regression.

Architecture

The pipeline begins with a shared ResNet-50 backbone that extracts feature maps from the input image pair $(I, I')$. Unlike traditional methods that use correlation layers, COTR concatenates these feature maps side-by-side. A linear positional encoding is added to these maps to provide the network with spatial awareness and the ability to distinguish between the two images.

The concatenated maps are processed by a Transformer encoder-decoder. The decoder receives the query point $x$ as input and produces a latent vector, which is then passed through a Multi-Layer Perceptron (MLP) head to regress the 2D coordinates of the corresponding point $x'$.

The COTR architecture: Feature maps from images $I$ and $I'$ are concatenated with positional encodings and fed into a Transformer ($\mathcal{T}$) and MLP head ($\mathcal{D}$) to map a query point $x$ to its correspondence $x'$.

Recursive Zoom-in

To overcome the resolution limitations of Transformer feature maps, COTR employs a recursive "zoom-in" strategy. After an initial coarse prediction, the model iteratively crops patches around the query and the estimated correspondence, re-running the network at higher resolutions. By zooming in by a factor of 2 over four iterations, COTR achieves high-precision, sub-pixel accuracy.

Experimental Results

COTR was trained exclusively on the MegaDepth dataset, which consists of static urban scenes. Despite this restricted training set, the model demonstrates remarkable zero-shot generalization across diverse benchmarks.

  • Optical Flow: On the KITTI-2015 benchmark, COTR achieved an Average End Point Error (AEPE) of 2.62, significantly outperforming previous state-of-the-art dense methods like RAFT (5.04).
  • Wide-Baseline Stereo: In the Image Matching Challenge 2020, COTR using only 512 random matches surpassed SuperGlue (which uses 2000 keypoints) in pose accuracy (mAA).
  • Dense and Sparse Tasks: COTR outperformed specialized methods like GLU-Net and GOCor on the HPatches and ETH3D datasets, proving its versatility across planar and multi-view scenarios.

Conclusion

COTR introduces a powerful, unified approach to image correspondence by leveraging Transformers for coordinate regression. Its ability to handle arbitrary queries and generalize to unseen dynamic scenes marks a significant step toward a universal matching engine. While current computational costs for per-point querying remain a challenge, the framework's accuracy and robustness across sparse and dense tasks establish a new state-of-the-art in the field.

Summary updated

Abstract

We propose a novel framework for finding correspondences in images based on a deep neural network that, given two images and a query point in one of them, finds its correspondence in the other. By doing so, one has the option to query only the points of interest and retrieve sparse correspondences, or to query all points in an image and obtain dense mappings. Importantly, in order to capture both local and global priors, and to let our model relate between image regions using the most relevant among said priors, we realize our network using a transformer. At inference time, we apply our correspondence network by recursively zooming in around the estimates, yielding a multiscale pipeline able to provide highly-accurate correspondences. Our method significantly outperforms the state of the art on both sparse and dense correspondence problems on multiple datasets and tasks, ranging from wide-baseline stereo to optical flow, without any retraining for a specific dataset. We commit to releasing data, code, and all the tools necessary to train from scratch and ensure reproducibility.
BibTeX
@misc{jiang2021cotr,
  author = {Wei Jiang and Eduard Trulls and Jan Hosang and Andrea Tagliasacchi and Kwang Moo Yi},
  title = {{COTR: Correspondence Transformer for Matching Across Images}},
  year = {2021},
  eprint = {2103.14167},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2103.14167},
}
Figure