MatchFormer: Interleaving Attention in Transformers for Feature Matching

Qing Wang, Jiaming Zhang, Kailun Yang, Kunyu Peng, Rainer Stiefelhagen
3/17/2022
cs.CVcs.ROeess.IV
transformer-attention

Official code: InSAI-Lab/MatchFormer (194 stars, Python, Apache-2.0, last commit 2026-10-16).

Abstract

Local feature matching is a computationally intensive task at the subpixel level. While detector-based methods coupled with feature descriptors struggle in low-texture scenes, CNN-based methods with a sequential extract-to-match pipeline, fail to make use of the matching capacity of the encoder and tend to overburden the decoder for matching.

Show full abstract

In contrast, we propose a novel hierarchical extract-and-match transformer, termed as MatchFormer. Inside each stage of the hierarchical encoder, we interleave self-attention for feature extraction and cross-attention for feature matching, yielding a human-intuitive extract-and-match scheme. Such a match-aware encoder releases the overloaded decoder and makes the model highly efficient. Further, combining self- and cross-attention on multi-scale features in a hierarchical architecture improves matching robustness, particularly in low-texture indoor scenes or with less outdoor training data. Thanks to such a strategy, MatchFormer is a multi-win solution in efficiency, robustness, and precision. Compared to the previous best method in indoor pose estimation, our lite MatchFormer has only 45% GFLOPs, yet achieves a +1.3% precision gain and a 41% running speed boost. The large MatchFormer reaches state-of-the-art on four different benchmarks, including indoor pose estimation (ScanNet), outdoor pose estimation (MegaDepth), homography estimation and image matching (HPatch), and visual localization (InLoc).

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Repository of MatchFormer

19410PythonMar 16, 20221 months agoApache-2.0

Similar Papers

Cite this paper

@article{wang2022matchformer,
  title  = {MatchFormer: Interleaving Attention in Transformers for Feature Matching},
  author = {Qing Wang and Jiaming Zhang and Kailun Yang and Kunyu Peng and Rainer Stiefelhagen},
  year   = {2022},
  eprint = {2203.09645},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2203.09645}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2203.09645.svg)](https://codeofpaper.com/paper/2203.09645)

Discussion