Models · Dense matching

RoMa v2

RoMa v2 (2025): dense matching between two photos of one scene from any viewpoints: where each pixel of the first image is in the second, and how sure the model is that it is visible there. Built on Meta's DINOv3. MIT code; the DINOv3 parts of the code and weights are under the DINOv3 licence.

experimental Fork of Parskatt/romav2@95c9968 · backends: portable, kernels

Checkpoint romav2

Paper 2025 Added in 0.2.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 354 ms 768x1024, bf16
vs the faster original 2.1× original fp16: 741 ms
Peak memory 1,909 MiB original: 9,881 MiB
Accuracy vs original fp32 −0.2 kernels AUC@5°, MegaDepth-1500 (64.6 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import matching

model = matching.load("romav2")  # kernels on a supported GPU, else portable PyTorch
result = model(image_a, image_b)
result.warp  # also: certainty
result.backend  # what ran: mode, device, dtype, kernels

points1, points2 = result.matches(5000)  # matched pixels, sampled where the model is certain
pose = matching.estimate_pose(points1, points2, K1, K2)  # relative pose on the GPU (RANSAC); K = intrinsics [3, 3]
pose.R, pose.t, pose.inliers  # rotation, unit translation, inlier mask
fastforks bench romav2

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs bf16. Portable runs bf16 on CUDA.

Input: synthetic, 768x1024 (the task’s standard size)

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32upstream RoMaV2.match; local correlation: upstream's plain-torch path (no fused-local-corr)fp32 14120.52×10.9 GiB/11.3 GiB6.92.07
Original fp16the authors' mixed-precision option (bfloat16); upstream RoMaV2.match; local correlation: upstream's plain-torch path (no fused-local-corr)fp16 741–9,881 MiB/10,124 MiB5.52.09
Portable fp32fp32not measured ––––
Portablebf16 5461.4×1,989 MiB/2,596 MiB0.80.91
Kernelsbf16 3542.1×1,909 MiB/2,300 MiB1.00.62
Portable + torch.compile 5761.3×3,150 MiB/3,386 MiB254 (build)–
TensorRT fp16fp16 3532.1×5,702 MiBenginenot comparable185 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-11 to 2026-11-14. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-13Originalfp32out of memory–768x1024
Portablefp325901 7,697 MiB processmatches768x1024
Kernelsbf16not implemented–768x1024

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
MIT AND LicenseRef-DINOv3-License LICENSELICENSE.md
Weights
MIT AND LicenseRef-DINOv3-License source
Training data
Upstream README: a mix of wide-baseline matching datasets following UFM and MapAnything (MegaDepth and others; see the paper); none has a dataset entry here yet. The frozen DINOv3 descriptor was pretrained on LVD-1689M (not released).
  • The checkpoint includes the DINOv3 ViT-L/16 weights, and net/dinov3.py and net/vit/ come from DINOv3: the DINOv3 License (Meta: attribution and conditions apply) covers those parts; read it before commercial use.

Our reading of the licences, not legal advice.

Weights

romav2.0.1.pt 1.1 GB· hosted on GitHub

fastforks downloads and checks these files on first use (fastforks download romav2).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

MegaDepth-1500

relative pose AUC@5 / @10 / @20 degrees

RundtypeAUC@5° ↑AUC@10° ↑AUC@20° ↑pairsms / pair
Original fp32not measured
Original fp16bf1663.277.186.7 1500 1196
Portable fp32not measured
Portablebf1663.076.986.5 1500 910
Kernelsbf1662.976.986.4 1500 695

The original code was not run on this dataset, so the table cannot show the distance to it.

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 authors’ code, same checkpoint and protocol. Measured on original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 011e320c, 2026-11-12.

MegaDepth-1500

every 5th pair, relative pose AUC@5 / @10 / @20 degrees

RundtypeAUC@5° ↑AUC@10° ↑AUC@20° ↑Δ AUC@5° vs fp32 originalpairsms / pair
Original fp32fp3264.678.087.1 reference 300 2452
Original fp16bf1664.778.287.3 +0.1 300 1196
Portable fp32fp3264.378.087.0 −0.3 300 2012
Portablebf1664.778.387.3 +0.1 300 910
Kernelsbf1664.477.986.9 −0.2 300 695

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. The same 300 pairs for all modes, so float32 and bfloat16 compare pair for pair. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12; original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11; portable fp32, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 011e320c, 2026-11-12; portable: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 011e320c, 2026-11-11.

Relative pose on the GPU

A dense matcher is usually followed by RANSAC on its matches to get the camera motion. fastforks does that step on the GPU too: result.matches(n) samples matched points where the model is certain, and matching.estimate_pose runs essential-matrix RANSAC on them, many image pairs per call, with no copy to the CPU. Like the models it has a portable (plain PyTorch) and a kernels (CUDA) backend.

SolverRuns onThreshold (px)Pose AUC@5 / @10 / @20Pairs per second
fastforks estimate_pose, kernelsGPU, batches of 500 pairs1.069.9 / 81.5 / 89.318,446
fastforks estimate_pose, portableGPU, batches of 500 pairs1.069.6 / 81.2 / 89.1418
PoseLib 2.0.5CPU, 16 processes1.070.0 / 81.6 / 89.5325
OpenCV USAC (MAGSAC++)CPU, 16 processes0.565.7 / 78.6 / 87.3271
OpenCV RANSACCPU, 16 processes0.562.9 / 76.9 / 86.4323

MegaDepth-1500, RoMa v2 matches (5000 per pair), 5 samplings, the same matches for every solver, on one machine: RTX 5060 Ti and a Ryzen 7 5800X (16 threads). Each solver runs at the inlier threshold where it is most accurate. Pairs per second is wall-clock throughput over all 7500 poses: the CPU solvers run one pair per call in 16 single-threaded processes, the GPU solver takes 500 pairs per call. One pair alone takes about 1.7 ms with the kernels, 29 ms with PoseLib and 24 ms with OpenCV RANSAC on one core. The accuracy table above stays on OpenCV RANSAC, as in the papers, so it is comparable with published numbers; this table is the only place the GPU solver is used.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 1.6e-05 vs the original. GPU, bfloat16 (the default), portable and kernels: mean |diff| <= 0.0086 and p99 <= 0.032 (absolute error of the output warp).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.000016 not recorded
gpu_min_score≤ 0.5 not recorded
GPU default dtypes, mean |diff|≤ 0.0086 0.00573
GPU default dtypes, p99 |diff|≤ 0.032 0.02077

Recorded for romav2 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14, with these kernels: romav2

Details

RoMa v2 (Edstedt, Nordström, Wadenbäck, Felsberg et al. 2025): dense feature matching between two images of any viewpoint. A frozen DINOv3 ViT-L/16 describes both images at a coarse square size, a multi-view ViT with alternating attention and a DPT head turn the global cosine matches into a coarse warp and an overlap logit, and convolutional refiners on VGG19-BN features (local correlation at strides 4, 2, 1) sharpen it, at the coarse 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.

Input / output
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.
What the numbers mean, and which models need the camera focal length

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](../sfm.md).

Input size
any H x W >= 32, padded to a multiple of 32; tested up to 3000x4000 (3,003 MiB allocated)
Options
  • coarse_size=800>= 16· changes the output
  • fine_size=1280>= 0· changes the output
  • keep_descriptors=0>= 0
Outputs
warp, certainty
CUDA kernels
  • romav2RoMa v2: local correlation without the sampled window tensor
Apple (MPS)
fp32

Limitations

  • The precision matrices of the warp (upstream `precision_AB`) and upstream's sampling / keypoint helpers are not returned; tools/eval_matching.py has the MegaDepth-1500 sampling.
  • Both images are resized to squares (upstream's behaviour), whatever their aspect ratio.
Full reference, generated from the repository

RoMa v2 (2025): dense matching between two photos of one scene from any viewpoints: where each pixel of the first image is in the second, and how sure the model is that it is visible there. Built on Meta's DINOv3. MIT code; the DINOv3 parts of the code and weights are under the DINOv3 licence.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
romav2synthetic (768x1024)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
1412
741
546
354
576
353
11159 / 11606
9881 / 10124
1989 / 2596
1909 / 2300
3150 / 3386
6694 / 6740
Details
  • Original code: https://github.com/Parskatt/romav2 at 95c9968145c8
  • Code licence: MIT AND LicenseRef-DINOv3-License (permissive); files: LICENSE, LICENSE.md
  • Weights licence: MIT AND LicenseRef-DINOv3-License
  • Licence evidence: https://github.com/Parskatt/romav2/blob/95c9968145c8906b7b59383258e9f73b02853d89/README.md#license
  • Training data: Upstream README: a mix of wide-baseline matching datasets following UFM and MapAnything (MegaDepth and others; see the paper); none has a dataset entry here yet. The frozen DINOv3 descriptor was pretrained on LVD-1689M (not released).
  • Licence note: The checkpoint includes the DINOv3 ViT-L/16 weights, and net/dinov3.py and net/vit/ come from DINOv3: the DINOv3 License (Meta: attribution and conditions apply) covers those parts; read it before commercial use.
  • Options: coarse_size = 800 (>= 16), fine_size = 1280 (>= 0), keep_descriptors = 0 (>= 0; speed only)
  • Kernel libraries: romav2
  • Variants: romav2
  • Outputs: warp, certainty
  • Input size: any H x W >= 32, padded to a multiple of 32
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): romav2 3000x4000 (2.9 GiB peak allocated, 4.7 reserved)
  • romav2 768x1024, first call: portable + torch.compile 254 s (cold Inductor cache), TensorRT fp16 185 s (ONNX + engine).
  • romav2 original (fp32) 768x1024: upstream RoMaV2.match; local correlation: upstream's plain-torch path (no fused-local-corr)
  • romav2 original 768x1024: the authors' mixed-precision option (bfloat16); upstream RoMaV2.match; local correlation: upstream's plain-torch path (no fused-local-corr)
  • romav2 load / first call: original 5.45 s / 2.091 s, portable 0.85 s / 0.913 s, kernels 0.96 s / 0.62 s
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Measured

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. The same 300 pairs for all modes, so float32 and bfloat16 compare pair for pair. Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
romav2MegaDepth-1500, relative pose AUC@5 / @10 / @20 degrees63.2 / 77.1 / 86.763.0 / 76.9 / 86.562.9 / 76.9 / 86.4
romav2MegaDepth-1500, every 5th pair, relative pose AUC@5 / @10 / @20 degrees64.6 / 78.0 / 87.164.7 / 78.2 / 87.364.7 / 78.3 / 87.364.3 / 78.0 / 87.064.4 / 77.9 / 86.9

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 011e320c, 2026-11-11 to 2026-11-12; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 011e320c, 2026-11-12; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 011e320c, 2026-11-12.

Parity

CPU, float32: max |diff| <= 1.6e-05 vs the original. GPU, bfloat16 (the default), portable and kernels: mean |diff| <= 0.0086 and p99 <= 0.032 (absolute error of the output warp).

variantkernels error vs original, mean / p99GPU, torchkernels used
romav20.00573 / 0.02077RTX 5060 Ti, torch 2.14.1+cu130romav2@bb29839cee98:sm_120

Limitations

  • The precision matrices of the warp (upstream precision_AB) and upstream's sampling / keypoint helpers are not returned; tools/eval_matching.py has the MegaDepth-1500 sampling.
  • Both images are resized to squares (upstream's behaviour), whatever their aspect ratio.

Example output

One fixed input through this checkpoint, the same for every model of the task (portable · bfloat16 · NVIDIA GeForce RTX 5060 Ti).

View A
View B
Output

88% of view A's pixels are found in view B with a certainty above 0.5; the lines are 100 matches sampled by certainty.

Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), view a
View A · 100%

Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).