RoMa

Edstedt 2024 · Paper

One-line summary — Robust dense feature matching that fuses frozen DINOv2 foundation-model features (robust but coarse) with specialized VGG19 fine features (precise but brittle) in a Transformer match decoder predicting anchor probabilities, trained with regression-by-classification then robust regression.

Problem

Dense feature matching — estimating a dense warp WABW^{\mathcal{A}\to\mathcal{B}} plus a matchability score p(xA)p(x^{\mathcal{A}}) for every pixel between two images — must survive extreme real-world changes in scale, illumination, viewpoint, and texture. Features trained from scratch on matching data (DKM’s ResNet50) are spatially precise but overfit to the training set; frozen DINOv2 features are dramatically more robust (the paper measures 27.1 px EPE / 85.6% robustness vs 60.2 / 57.5% for ResNet50 and 87.6 / 43.2% for VGG19 on a frozen-feature coarse-matching probe) but exist only at coarse stride 14. RoMa asks how to get both, and how to train each stage with a loss matched to its error regime.

Method & architecture

Two-stage dense pipeline (DKM skeleton). Decoupled encoders extract coarse and fine features; a global matcher Gθ=Dθ(Eθ(φcoarseA,φcoarseB))G_\theta = D_\theta(E_\theta(\varphi^{\mathcal A}_{\text{coarse}}, \varphi^{\mathcal B}_{\text{coarse}})) produces a coarse warp and certainty, then refiners Rθ,iR_{\theta,i} at strides {1,2,4,8}\{1,2,4,8\} recursively predict residual warp and certainty-logit offsets using stacked feature maps and a local correlation volume around the previous estimate, with gradients detached between stages.

Robust + localizable features. Fcoarse,θ=DINOv2F_{\text{coarse},\theta}=\text{DINOv2} (frozen throughout training — fixing the representation reduces overfitting and cuts compute), while Ffine,θ=VGG19F_{\text{fine},\theta}=\text{VGG19}: the ablation shows VGG19 makes poor coarse features but the best fine features, revealing “an inherent tension between fine localizability and coarse robustness.”

Transformer match decoder with anchor probabilities. Instead of regressing coordinates, the decoder (5 ViT blocks, 8 heads, hidden size 1024, no position encodings — propagating only by feature similarity to avoid resolution overfitting and oversmoothing) outputs a discretized conditional distribution over K=64×64K = 64\times 64 uniform anchors:

pcoarse,θ(xBxA)=k=1Kπk(xA)Bmk,p_{\text{coarse},\theta}(x^{\mathcal{B}}|x^{\mathcal{A}})=\sum_{k=1}^{K}\pi_k(x^{\mathcal{A}})\,\mathcal{B}_{m_k},

with πk\pi_k anchor probabilities and mkm_k anchor coordinates — so multimodal ambiguity (repetitive structure, motion boundaries) is represented instead of averaged. The warp is decoded by argmax over anchors followed by a local softargmax over the 4-neighborhood N4(k)N_4(k^*).

Loss matched to each stage. Modeling matchability at scale ss as a blurred joint distribution q(xA,xB;s)=N(0,s2I)p(xA,xB;0)q(x^{\mathcal{A}},x^{\mathcal{B}};s)=\mathcal{N}(0,s^2\mathbf{I}) \ast p(x^{\mathcal{A}},x^{\mathcal{B}};0) shows the coarse conditional is multimodal near motion boundaries while refinement (conditioned on the previous warp) is locally unimodal. Hence Lcoarse\mathcal{L}_{\text{coarse}} is regression-by-classification — NLL of the anchor closest to the ground truth, k(x)=argminkmkxk^{\dagger}(x)=\operatorname{argmin}_k \lVert m_k - x\rVert — and Lfine\mathcal{L}_{\text{fine}} is a robust generalized Charbonnier regression (α=0.5\alpha=0.5), whose log-density is (μθxiB2+s)1/4-(\lVert\mu_\theta - x_i^{\mathcal{B}}\rVert^2 + s)^{1/4}: locally L2-like gradients that decay toward zero for outliers. Total loss L=Lcoarse+Lfine\mathcal{L}=\mathcal{L}_{\text{coarse}}+\mathcal{L}_{\text{fine}} with no cross-stage weighting needed. Trained on MegaDepth (+ScanNet model for indoor eval) at 560×560.

Results

Why it matters for SLAM

RoMa demonstrated that frozen foundation-model features dramatically improve matching robustness — establishing the “foundation features for coarse anchors + specialized features for precision” paradigm. For SLAM this matters most in relocalization and loop closure under severe appearance change (day/night, seasons), where sparse hand-crafted or even learned keypoints fail. Dense RoMa-style matchers now back several modern reconstruction and localization pipelines.