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
- Paper RoMa v2: Harder Better Faster Denser Feature Matching ECCV 2026 · first released 19 Nov 2025
Checkpoint romav2
Paper 2025 Added in 0.2.0 Evaluated with 0.2.0
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)
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32upstream RoMaV2.match; local correlation: upstream's plain-torch path (no fused-local-corr) | fp32 | 1412 | 0.52× | 10.9 GiB/11.3 GiB | 6.9 | 2.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 MiB | 5.5 | 2.09 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | bf16 | 546 | 1.4× | 1,989 MiB/2,596 MiB | 0.8 | 0.91 |
| Kernels | bf16 | 354 | 2.1× | 1,909 MiB/2,300 MiB | 1.0 | 0.62 |
| Portable + torch.compile | 576 | 1.3× | 3,150 MiB/3,386 MiB | 254 (build) | – | |
| TensorRT fp16 | fp16 | 353 | 2.1× | 5,702 MiBenginenot comparable | 185 (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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-13 | Original | fp32 | out of memory | – | 768x1024 | |
| Portable | fp32 | 5901 | 7,697 MiB process | matches | 768x1024 | |
| Kernels | bf16 | not 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 GitHubfastforks 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
| Run | dtype | AUC@5° ↑ | AUC@10° ↑ | AUC@20° ↑ | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | not measured | |||||
| Original fp16 | bf16 | 63.2 | 77.1 | 86.7 | 1500 | 1196 |
| Portable fp32 | not measured | |||||
| Portable | bf16 | 63.0 | 76.9 | 86.5 | 1500 | 910 |
| Kernels | bf16 | 62.9 | 76.9 | 86.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
| Run | dtype | AUC@5° ↑ | AUC@10° ↑ | AUC@20° ↑ | Δ AUC@5° vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 64.6 | 78.0 | 87.1 | reference | 300 | 2452 |
| Original fp16 | bf16 | 64.7 | 78.2 | 87.3 | +0.1 | 300 | 1196 |
| Portable fp32 | fp32 | 64.3 | 78.0 | 87.0 | −0.3 | 300 | 2012 |
| Portable | bf16 | 64.7 | 78.3 | 87.3 | +0.1 | 300 | 910 |
| Kernels | bf16 | 64.4 | 77.9 | 86.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.
| Solver | Runs on | Threshold (px) | Pose AUC@5 / @10 / @20 | Pairs per second |
|---|---|---|---|---|
| fastforks estimate_pose, kernels | GPU, batches of 500 pairs | 1.0 | 69.9 / 81.5 / 89.3 | 18,446 |
| fastforks estimate_pose, portable | GPU, batches of 500 pairs | 1.0 | 69.6 / 81.2 / 89.1 | 418 |
| PoseLib 2.0.5 | CPU, 16 processes | 1.0 | 70.0 / 81.6 / 89.5 | 325 |
| OpenCV USAC (MAGSAC++) | CPU, 16 processes | 0.5 | 65.7 / 78.6 / 87.3 | 271 |
| OpenCV RANSAC | CPU, 16 processes | 0.5 | 62.9 / 76.9 / 86.4 | 323 |
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).
| Check | Tolerance | Measured |
|---|---|---|
| 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 outputfine_size=1280>= 0· changes the outputkeep_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.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
romav2 | synthetic (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):
romav23000x4000 (2.9 GiB peak allocated, 4.7 reserved) romav2768x1024, first call: portable + torch.compile 254 s (cold Inductor cache), TensorRT fp16 185 s (ONNX + engine).romav2original (fp32) 768x1024: upstream RoMaV2.match; local correlation: upstream's plain-torch path (no fused-local-corr)romav2original 768x1024: the authors' mixed-precision option (bfloat16); upstream RoMaV2.match; local correlation: upstream's plain-torch path (no fused-local-corr)romav2load / 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.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
romav2 | MegaDepth-1500, relative pose AUC@5 / @10 / @20 degrees | 63.2 / 77.1 / 86.7 | 63.0 / 76.9 / 86.5 | 62.9 / 76.9 / 86.4 | |||
romav2 | MegaDepth-1500, every 5th pair, relative pose AUC@5 / @10 / @20 degrees | 64.6 / 78.0 / 87.1 | 64.7 / 78.2 / 87.3 | 64.7 / 78.3 / 87.3 | 64.3 / 78.0 / 87.0 | 64.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).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
romav2 | 0.00573 / 0.02077 | RTX 5060 Ti, torch 2.14.1+cu130 | romav2@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).
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.
Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).