RoMa (fastforks)

RoMa (Edstedt, Sun, Bökman, Wadenbäck, Felsberg, CVPR 2024): dense feature matching between two images of any viewpoint. A frozen DINOv2 ViT-L/14 and a VGG19-BN describe both images; a Gaussian process over the coarse DINOv2 features and a transformer classifier give a coarse warp, and convolutional refiners (local correlation at strides 16, 8, 4) sharpen it at strides 16 to 1, at a coarse square size and again at a fine size. Returns, for every pixel of the first image, its position in the second (pixels) and the probability that it is visible there.

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/Parskatt/RoMa at 77f8d6880352.

Task: matching. Tier: experimental. Outputs: warp, certainty. Backends: portable, kernels.

Input: two RGB images of one scene. Output: for every pixel of the first image its position in the second (x, y in pixels) and a certainty that the pixel is visible in both. Sparse matchers (LightGlue) return the keypoints of both images and the index pairs of the matched ones instead. To reconstruct camera poses from an image folder with these matchers, see structure from motion.

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
romav1@1 roma_outdoor.pth
dinov2_vitl14_pretrain.pth
c7a45c80d41a
d5383ea8f487
MIT AND Apache-2.0 yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Licence files: LICENSE.

Training data: MegaDepth (Internet photo collections with SfM / MVS depth) (roma_outdoor: MegaDepth (upstream README / paper). The frozen DINOv2 was pretrained on LVD-142M (not released).).

  • Licence note: The DINOv2 ViT-L/14 weights are the second weight file (Meta's release, Apache-2.0).

Licence evidence: https://github.com/Parskatt/RoMa/blob/77f8d68803526dcddfd9b7a46bc76125bdc25f15/README.md#license

Input size

any H x W >= 32, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): romav1 3000x4000 (1.9 GiB peak allocated, 2.2 reserved)

Speed and memory

Matching, synthetic, 768x1024

model time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
romav1 – 386 376 356 1.1x 1.1x 3887 / 4094 1720 / 1820 1720 / 1860

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
romav1 6.28 1.09 1.96 2.57 0.83 0.86

torch.compile and TensorRT

model input time: portable compile TensorRT fp16 kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
romav1 768x1024 376 ms deferred (build >5 min) planned for 0.2.1 356 ms – – 1720 / 1820 – 1720 / 1860 –

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

Dense matchers: 5000 matches per pair sampled from the warp by certainty (upstream's balanced KDE sampling); sparse matchers: all their matches of one call (LightGlue, XFeat: LightGlue's MegaDepth-1500 setting; LoFTR, DeDoDe: their card defaults). OpenCV essential-matrix RANSAC (0.5 px threshold, normalised by the mean focal length); AUC of the larger of the rotation and translation-direction errors. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable kernels note
romav1 MegaDepth-1500, relative pose AUC@5 / @10 / @20 degrees 62.6 / 76.6 / 86.3 62.6 / 76.6 / 86.4 62.4 / 76.4 / 86.2
romav1 MegaDepth-1500, every 10th pair, relative pose AUC@5 / @10 / @20 degrees 67.6 / 80.1 / 88.2 66.4 / 79.5 / 88.1 68.2 / 80.8 / 88.8 67.5 / 80.0 / 88.2

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks f218aa9d, 2026-11-13.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 4.3e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.00079 and p99 <= 0.0042 (absolute error of the output warp).

Limitations

  • One direction (the first image's half of upstream's symmetric call); upstream's sampling / keypoint helpers are not included; tools/eval_matching.py has the MegaDepth-1500 sampling.
  • Both images are resized to squares (upstream's behaviour), whatever their aspect ratio; upstream resizes PIL images, this runner float tensors (bicubic, antialiased).

Usage

from fastforks import matching

model = matching.load("romav1")  # mode="auto": the preferred backend from recorded measurements
result = model("view1.jpg", "view2.jpg")
result.warp  # [2, H1, W1] float32: x, y in view2 pixels
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: romav1.

Kernels backend

matching.load("romav1", mode="kernels") runs our CUDA kernels (fastbb). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including fastforks/romav1