Models · Dense matching

LoMa

LoMa (Nordström, Edstedt et al. 2026): sparse matching of two photos of one scene: DaD keypoints, DeDoDe-G descriptions (VGG19 plus DINOv2) and a light LightGlue-style transformer matcher; matches as keypoint index pairs (the form COLMAP takes). MIT code and weights; DINOv2 Apache-2.0.

experimental Fork of davnords/loma@ecc947d · backends: portable, kernels

Checkpoint

Paper 2026 Added in 0.2.0 Evaluated with 0.2.0

Portable, RTX 5060 Ti 16 GB 308 ms 768x1024, bf16
vs the faster original 3.4× original fp32: 1036 ms
Peak memory 1,767 MiB original: 4,176 MiB
Accuracy vs original fp32 +1.7 portable AUC@5°, MegaDepth-1500 (54.5 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("loma-b")  # kernels on a supported GPU, else portable PyTorch
result = model(image_a, image_b)
result.keypoints1  # also: keypoints2, pairs, scores
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 loma-b

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 fp16. 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 fp32fp32not measured ––––
Original (own default)upstream LoMa(LoMaB(mp=False)), float32, 2048 keypointsfp32 1036–4,176 MiB/4,390 MiB8.51.37
Portable fp32fp32not measured ––––
Portablebf16 3083.4×1,767 MiB/1,878 MiB2.51.27
Kernelsnot measured ––––
Portable + torch.compile 2853.6×2,870 MiB/3,216 MiB104 (build)–
TensorRTplanned for 0.2.1fails––––

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-15. 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-17Portablefp323037 8,147 MiB processskip768x1024
Kernelsfp32not 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 Apache-2.0 LICENSELICENSE-DADLICENSE-DEDODELICENSE-DINOv2
Weights
MIT AND Apache-2.0 (assumed from code)(not stated by the authors; assumed to follow the code) source
Training data
  • weights licence not stated by the original authors; assumed to be the code licence

Our reading of the licences, not legal advice.

Weights

loma_B.pt 758 MB· hosted on GitHub

fastforks downloads and checks these files on first use (fastforks download loma-b).

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

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

RundtypeAUC@5° ↑AUC@10° ↑AUC@20° ↑Δ AUC@5° vs fp32 originalpairsms / pair
Original fp32fp3254.571.683.7 reference 300 1033
Original fp16not measured
Portable fp32not measured
Portablebf1656.272.683.9 +1.7 300 403
Kernelsnot 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 authors’ code, same checkpoint and protocol. Measured on original fp32: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-16; portable: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 68b2f345, 2026-11-16.

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| <= 0.011 vs the original. GPU, portable bfloat16 and kernels float16 (the defaults): mean |diff| <= 0.05 and p99 <= 0.6 (absolute error of the output keypoints1).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.011 not recorded
cpu_min_recall≤ 0.99 not recorded
cpu_min_match≤ 0.99 not recorded
GPU default dtypes, mean |diff|≤ 0.05 0.00775
GPU default dtypes, p99 |diff|≤ 0.6 0.40228
gpu_min_recall≤ 0.96 not recorded
gpu_min_match≤ 0.93 not recorded

Recorded for loma-b on RTX 5060 Ti, torch 2.10.0+cu130, 2026-11-17, with these kernels: cudnn_hacccutlass_convigev

Details

LoMa (Nordström, Edstedt et al. 2026): local feature matching with a light transformer. DaD (a VGG11 detector trained by distillation, Edstedt et al. 2025) finds 2048 keypoints per image, a DeDoDe descriptor (VGG for B64/B128, VGG plus DINOv2 for B/L/G/R) describes them, and nine LightGlue-style transformer layers (rotary self-attention, cross-attention) refine the descriptions before a dual-softmax assignment. Returns both keypoint sets, the index pairs of the matches and their scores.

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 (2,424 MiB allocated)
Options
  • max_keypoints=2048>= 1· changes the output
  • long_side=1024>= 16· changes the output
  • size=784>= 56· changes the output
Outputs
keypoints1, keypoints2, pairs, scores
Checkpoint
dim=256, heads=4, layers=9
CUDA kernels
  • igevIGEV stereo: convolution epilogues, correlation lookups, GRU gates
  • cutlass_convCUTLASS convolutions with the recurrent update (GRU) fused in
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
Apple (MPS)
fp32

Limitations

  • Sparse output: no dense warp. `result.matches()` gives the matched points for `estimate_pose`; `pairs` are the index pairs pycolmap / COLMAP databases take.
  • One image pair per call internally (batches run pair by pair); the match counts differ per pair.
  • The match count depends on the image pair. The fixed 768 x 1024 LoMa-B64 TensorRT export returns variable-length matches. On ten photos paired with shifted copies, at least 96.7% of TensorRT correspondences agreed with portable within 2 pixels in both images.
  • Two resizes per image as upstream: the detector sees a long side of `long_side` (aspect kept), the descriptor a `size` x `size` square whatever the aspect ratio.
  • LoMa-R uses rotation augmentation. The other variants are trained for upright images.
Full reference, generated from the repository

LoMa (Nordström, Edstedt et al. 2026): sparse matching of two photos of one scene: DaD keypoints, DeDoDe-G descriptions (VGG19 plus DINOv2) and a light LightGlue-style transformer matcher; matches as keypoint index pairs (the form COLMAP takes). MIT code and weights; DINOv2 Apache-2.0.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
loma-bsynthetic (768x1024)original
portable
kernels
portable + torch.compile
TensorRT fp16
1036
308
–
285
planned for 0.2.1
4176 / 4390
1767 / 1878
–
2870 / 3216
–
loma-b64synthetic (768x1024)original
portable
kernels
portable + torch.compile
TensorRT bf16
–
129
–
101
109
–
854 / 962
–
1230 / 1356
1010 / 1034
loma-b128synthetic (768x1024)original
portable
kernels
portable + torch.compile
TensorRT fp16
–
150
–
122
fails: RuntimeError: Trying to create tensor with negative dimensio
–
878 / 984
–
1398 / 1760
–
loma-lsynthetic (768x1024)original
portable
kernels
portable + torch.compile
TensorRT fp16
–
319
–
295
fails: RuntimeError: Trying to create tensor with negative dimensio
–
1903 / 2012
–
3006 / 3194
–
Details
  • Original code: https://github.com/davnords/loma at ecc947d44ddc
  • Code licence: MIT AND Apache-2.0 (permissive); files: LICENSE, LICENSE-DAD, LICENSE-DEDODE, LICENSE-DINOv2
  • Weights licence: MIT AND Apache-2.0 (assumed from code)
  • Licence evidence: https://github.com/davnords/loma/blob/ecc947d44ddc9d50387e887bbedc743d65ffac00/README.md#license ; https://github.com/Parskatt/dad/blob/41b9e86a1a3ae52128485cc1094aa4952ef489ba/LICENSE ; https://github.com/Parskatt/DeDoDe/blob/6d156183f4dc84cd704ae779eebc8350995c5b06/README.md#license
  • Training data: MegaDepth (Internet photo collections with SfM / MVS depth) (Matcher: MegaDepth (paper); DaD: MegaDepth-based distillation (DaD paper); DeDoDe-G descriptor: MegaDepth; B, L, G and R include frozen DINOv2 (LVD-142M). B64 and B128 use VGG descriptors.)
  • Options: max_keypoints = 2048 (>= 1), long_side = 1024 (>= 16), size = 784 (>= 56)
  • Kernel libraries: igev, cutlass_conv, cudnn_hacc
  • Variants: loma-b, loma-b64, loma-b128, loma-l, loma-g, loma-r
  • Not in this release (planned for 0.2.1): loma-b ONNX / TensorRT export: the export fails in the network call (negative tensor dimension -1)
  • Outputs: keypoints1, keypoints2, pairs, scores
  • Input size: any H x W >= 32, padded to a multiple of 32
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): loma-b 3000x4000 (2.4 GiB peak allocated, 3.6 reserved); loma-b64 3000x4000 (1.1 GiB peak allocated, 1.4 reserved); loma-b128 3000x4000 (1.1 GiB peak allocated, 1.4 reserved); loma-l 3000x4000 (2.1 GiB peak allocated, 2.8 reserved); loma-g 3000x4000 (2.6 GiB peak allocated, 3.3 reserved); loma-r 3000x4000 (2.0 GiB peak allocated, 2.7 reserved)
  • loma-b 768x1024, first call: portable + torch.compile 104 s (cold Inductor cache).
  • loma-b64 768x1024, first call: portable + torch.compile 66 s (cold Inductor cache), TensorRT bf16 102 s (ONNX + engine).
  • loma-b128 768x1024, first call: portable + torch.compile 67 s (cold Inductor cache).
  • loma-l 768x1024, first call: portable + torch.compile 101 s (cold Inductor cache).
  • loma-b original 768x1024: upstream LoMa(LoMaB(mp=False)), float32, 2048 keypoints
  • loma-b load / first call: original 8.52 s / 1.373 s, portable 2.53 s / 1.269 s
  • loma-b64 load / first call: portable 0.28 s / 0.759 s
  • loma-b128 load / first call: portable 0.52 s / 0.636 s
  • loma-l load / first call: portable 1.49 s / 0.69 s
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
  • Speed and memory not measured for: loma-g, loma-r.

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 fp32portableportable fp32note
loma-bMegaDepth-1500, every 5th pair, relative pose AUC@5 / @10 / @20 degrees54.5 / 71.6 / 83.756.2 / 72.6 / 83.9
loma-b64MegaDepth-1500, every 5th pair, relative pose AUC@5 / @10 / @20 degrees56.0 / 72.0 / 83.1

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 68b2f345, 2026-11-16; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks c34edca4, 2026-11-17.

Parity

CPU, float32: max |diff| <= 0.011 vs the original. GPU, portable bfloat16 and kernels float16 (the defaults): mean |diff| <= 0.05 and p99 <= 0.6 (absolute error of the output keypoints1).

variantkernels error vs original, mean / p99GPU, torchkernels used
loma-b0.00775 / 0.40228RTX 5060 Ti, torch 2.10.0+cu130cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120
loma-b640.00718 / 0.39541RTX 5060 Ti, torch 2.10.0+cu130cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120
loma-b1280.00775 / 0.40228RTX 5060 Ti, torch 2.10.0+cu130cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120
loma-l0.00775 / 0.40228RTX 5060 Ti, torch 2.10.0+cu130cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120
loma-g0.00775 / 0.40228RTX 5060 Ti, torch 2.10.0+cu130cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120
loma-r0.00775 / 0.40228RTX 5060 Ti, torch 2.10.0+cu130cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120

Limitations

  • Sparse output: no dense warp. result.matches() gives the matched points for estimate_pose; pairs are the index pairs pycolmap / COLMAP databases take.
  • One image pair per call internally (batches run pair by pair); the match counts differ per pair.
  • The match count depends on the image pair. The fixed 768 x 1024 LoMa-B64 TensorRT export returns variable-length matches. On ten photos paired with shifted copies, at least 96.7% of TensorRT correspondences agreed with portable within 2 pixels in both images.
  • Two resizes per image as upstream: the detector sees a long side of long_side (aspect kept), the descriptor a size x size square whatever the aspect ratio.
  • LoMa-R uses rotation augmentation. The other variants are trained for upright images.

Example output

No example rendered for this checkpoint yet.