MASt3R

Leroy 2024 · Paper

One-line summary — Grounds image matching in 3D by adding a dense local-feature head to DUSt3R, combining foundation-model robustness to extreme viewpoint change with the pixel-accurate correspondences of classical matchers.

Problem

Image matching is a core component of all best-performing 3D vision pipelines, yet “despite matching being fundamentally a 3D problem, intrinsically linked to camera pose and scene geometry, it is typically treated as a 2D problem”. Classical and learned 2D matchers collapse under extreme viewpoint change — LoFTR scores only 34% VCRE precision on Map-free; DUSt3R’s pointmap regression is remarkably robust to exactly those conditions and tops the Map-free leaderboard, yet its matches are imprecise since regression is inherently noisy and DUSt3R was never trained for matching. MASt3R (“Matching And Stereo 3D Reconstruction”) keeps the robustness and fixes the accuracy.

Method & architecture

Base (DUSt3R framework): Siamese ViT encoder H1=Encoder(I1)H^1 = \text{Encoder}(I^1), H2=Encoder(I2)H^2 = \text{Encoder}(I^2), two intertwined decoders exchanging information via cross-attention, H1,H2=Decoder(H1,H2)H'^1, H'^2 = \text{Decoder}(H^1, H^2), and 3D heads that regress pointmaps + confidences from concatenated encoder/decoder features: X1,1,C1=Head3D1([H1,H1])X^{1,1}, C^1 = \text{Head}^1_{3D}([H^1, H'^1]), both pointmaps expressed in camera 1’s frame.

Metric predictions: DUSt3R’s regression loss regr(v,i)=Xiv,1/zX^iv,1/z^\ell_{\text{regr}}(v,i) = \| X_i^{v,1}/z - \hat{X}_i^{v,1}/\hat{z} \| normalizes both prediction and ground truth by scale factors; MASt3R sets z:=z^z := \hat{z} whenever the ground truth is metric, so the network learns metric-scale geometry — a prerequisite for map-free localization. The confidence-weighted loss Lconf=viCivregr(v,i)αlogCiv\mathcal{L}_{\text{conf}} = \sum_{v} \sum_{i} C_i^v \ell_{\text{regr}}(v,i) - \alpha \log C_i^v is kept.

Matching head: a new head (2-layer MLP with GELU, outputs normalized to unit norm) attached to each decoder regresses dense dd-dim feature maps D1,D2RH×W×dD^1, D^2 \in \mathbb{R}^{H \times W \times d}. It is trained with an InfoNCE loss over ground-truth correspondences M^={(i,j)X^i1,1=X^j2,1}\hat{\mathcal{M}} = \{(i,j) \mid \hat{X}_i^{1,1} = \hat{X}_j^{2,1}\}:

Lmatch=(i,j)M^logsτ(i,j)kP1sτ(k,j)+logsτ(i,j)kP2sτ(i,k),sτ(i,j)=exp[τDi1Dj2].\mathcal{L}_{\text{match}} = -\sum_{(i,j) \in \hat{\mathcal{M}}} \log \frac{s_\tau(i,j)}{\sum_{k \in \mathcal{P}^1} s_\tau(k,j)} + \log \frac{s_\tau(i,j)}{\sum_{k \in \mathcal{P}^2} s_\tau(i,k)}, \qquad s_\tau(i,j) = \exp\left[-\tau D_i^{1\top} D_j^2\right].

This is essentially cross-entropy classification: contrary to regression, the network is only rewarded for getting the exact pixel right, which forces high-precision descriptors. Total objective: Ltotal=Lconf+βLmatch\mathcal{L}_{\text{total}} = \mathcal{L}_{\text{conf}} + \beta \mathcal{L}_{\text{match}}.

Fast reciprocal matching (FRM): extracting mutual nearest neighbours M={(i,j)j=NN2(Di1) and i=NN1(Dj2)}\mathcal{M} = \{(i,j) \mid j = \text{NN}_2(D_i^1) \text{ and } i = \text{NN}_1(D_j^2)\} naively costs O(W2H2)O(W^2H^2) — slower than the network inference itself. FRM instead starts from kk pixels on a regular grid and iterates NN round-trips UtVtUt+1U^t \to V^t \to U^{t+1}, collecting pixels that return to their start (cycles = reciprocal matches) and filtering converged ones. Complexity drops to O(kWH)O(kWH), almost two orders of magnitude faster, with convergence guarantees — and its implicit outlier filtering improves pose accuracy over exhaustive matching.

Coarse-to-fine matching: attention is quadratic in image area, so MASt3R handles at most 512 px on the largest side. High-resolution images are matched coarsely first; the coarse correspondences then guide matching of enumerated local crops, and fine matches are mapped back to full resolution.

Results

Why it matters for SLAM

MASt3R turned the DUSt3R family from a reconstruction curiosity into a practical front-end: correspondences plus metric pointmaps from a single forward pass, usable for relocalisation, SfM, and SLAM. For the SLAM pipeline it collapses several classical stages — feature detection, description, matching, and two-view geometry — into one learned component whose failure modes are those of a foundation model rather than corner scarcity or viewpoint change. It is the direct foundation of MASt3R-SLAM, MASt3R-SfM, and MASt3R-Fusion.