XFeat

Potje 2024 · Paper

One-line summary — An ultra-lightweight learned local feature (CVPR 2024) with compact 64-dim descriptors that runs up to 5× faster than existing deep features — in real time even on a laptop CPU — by keeping spatial resolution high and channel count low, making learned matching practical on embedded hardware.

Problem

State-of-the-art learned features (SuperPoint, DISK, ALIKE) are accurate but too heavy for the hardware robots actually ship with — drones, AR glasses, mobile robots. The bottleneck is architectural: accurate matching “requires sufficiently large image resolutions”, yet feeding high-resolution images through even a small VGG-like backbone inflates compute, since the FLOP count of a convolution layer is Fops=HiWiCiCi+1k2F_{ops}=H_i\cdot W_i\cdot C_i\cdot C_{i+1}\cdot k^2 — the spatial terms HiWiH_i W_i dominate in early layers. XFeat revisits fundamental CNN design choices for detecting, extracting, and matching local features under a hard compute budget.

Method & architecture

Featherweight backbone. From a grayscale image IRH×W×1\mathbf{I}\in\mathbb{R}^{H\times W\times 1}, six convolutional blocks (23 layers of “basic layers”: conv k{1,3}k\in\{1,3\} + ReLU + BatchNorm) halve resolution while tripling rather than doubling channels — {4,8,24,64,64,128}\{4,8,24,64,64,128\} from C=4C=4 up to C=128C=128 at H/32×W/32H/32\times W/32. Starting with only 4 channels keeps the expensive high-resolution early layers minimal; the triple-rate growth restores capacity in cheap low-resolution layers.

Three heads. A feature-pyramid fusion of the {1/8,1/16,1/32}\{1/8,1/16,1/32\} scales yields a dense 64-dim descriptor map FRH/8×W/8×64\mathbf{F}\in\mathbb{R}^{H/8\times W/8\times 64}, a reliability map R\mathbf{R} modeling the probability that Fi,j\mathbf{F}_{i,j} can be matched confidently, and a separate keypoint branch: the image is reshaped into 8×88\times 8 cells (64-dim vectors), and fast 1×11\times1 convolutions classify the keypoint position among the 64 cell positions plus a dustbin, KRH/8×W/8×65\mathbf{K}\in\mathbb{R}^{H/8\times W/8\times 65} (SuperPoint-style, but decoupled — joint training degrades semi-dense matching for compact CNNs).

Semi-dense match refinement. Instead of a fine-level feature map (LoFTR-style), an MLP predicts pixel offsets from a matched coarse descriptor pair alone: o=MLP(concat(fa,fb))\mathbf{o}=\text{MLP}(\text{concat}(\mathbf{f}_a,\mathbf{f}_b)), choosing the offset as

(x,y)=arg maxi,j{1,,8}o(i,j)(x,y)=\operatorname*{arg\,max}_{i,j\in\{1,\dots,8\}}\mathbf{o}(i,j)

where oR8×8\mathbf{o}\in\mathbb{R}^{8\times 8} holds offset logits — semi-dense matching with no high-resolution features at all.

Training. Supervised with pixel-level correspondences on MegaDepth + synthetically warped COCO (6:4 mix, 800×600), with a multi-task loss L=αLds+βLrel+γLfine+δLkp\mathcal{L}=\alpha\mathcal{L}_{ds}+\beta\mathcal{L}_{rel}+\gamma\mathcal{L}_{fine}+\delta\mathcal{L}_{kp}: a dual-softmax NLL over the similarity matrix S=F1F2T\mathbf{S}=\mathbf{F}_1\mathbf{F}_2^{\mathsf T} for descriptors, an L1 loss Lrel=σ(R1)Rˉ1Rˉ2+σ(R2)Rˉ1Rˉ2\mathcal{L}_{rel}=|\sigma(\mathbf{R}_1)-\bar{\mathbf{R}}_1\odot\bar{\mathbf{R}}_2|+|\sigma(\mathbf{R}_2)-\bar{\mathbf{R}}_1\odot\bar{\mathbf{R}}_2| tying reliability to dual-softmax confidence, NLL over offset logits, and keypoints distilled from ALIKE-tiny. Training converges in 36 h on one RTX 4090 using 6.5 GB VRAM. Inference: sparse mode (XFeat, 4,096 keypoints scored by Ki,jRi,j\mathbf{K}_{i,j}\cdot\mathbf{R}_{i,j} + mutual-nearest-neighbor) or semi-dense mode (XFeat*, top-10k reliable features + offset refinement).

Results

Why it matters for SLAM

Learned features had clearly surpassed hand-crafted ones (ORB, SIFT) in robustness, but their compute cost kept them out of real-time SLAM front-ends on embedded platforms. XFeat is the point where learned features became cheap enough to drop into a SLAM pipeline running on the kind of hardware robots actually ship with. Paired with a lightweight matcher such as LightGlue, it enables a full learned front-end (detection, description, matching) at frame rate on edge devices.