Skip to main content

RoMa v2 🤖: Harder Better Faster Denser Feature Matching

Johan Edstedt · David Nordström · Yushan Zhang · Georg Bökman · Jonathan Astermark · Viktor Larsson · Anders Heyden · Fredrik Kahl · Mårten Wadenbäck · Michael Felsberg

Paper | Project Page


example

How to Use

from romav2 import RoMaV2

# load pretrained model
model = RoMaV2()
# Match densely for any image-like pair of inputs
preds = model.match(img_A_path, img_B_path)

# you can also run the forward method directly as 
# preds = model(img_A, img_B)

# Sample 5000 matches for estimation
matches, overlaps, precision_AB, precision_BA = model.sample(preds, 5000)

# Convert to pixel coordinates (RoMaV2 produces matches in [-1,1]x[-1,1])
kptsA, kptsB = model.to_pixel_coordinates(matches, H_A, W_A, H_B, W_B)

# Find a fundamental matrix (or anything else of interest)
F, mask = cv2.findFundamentalMat(
    kptsA.cpu().numpy(), kptsB.cpu().numpy(), ransacReprojThreshold=0.2, method=cv2.USAC_MAGSAC, confidence=0.999999, maxIters=10000
)

We additionally provide two demos in the demos folder, which might help in understanding.

Setup/Install

In your python environment (tested on Linux python 3.12), run:

uv pip install -e .

or

uv sync

Benchmarks

If you do not already have MegaDepth and ScanNet, you can the following to download them:

source scripts/eval_prep.sh

Mega-1500

uv run tests/test_mega1500.py

ScanNet-1500

uv run tests/test_scannet1500.py

Expected Results

Experiments on ScanNet-1500 and MegaDepth-1500 are provided in the tests folder. Running these gave me ScanNet-1500: [34.0, 56.5, 73.9], and Mega-1500: [62.8, 76,8, 86.5], which are similar to the results of the paper.

Fused local correlation kernel

Include the --extra fused-local-corr flag as:

uv sync --extra fused-local-corr

or

uv pip install romav2[fused-local-corr]

or

uv add romav2[fused-local-corr]

Settings

By twiddling with some different settings you may reach better results on your task of interest. Some important ones, which we enable setting to some reasonable defaults through model.apply_setting, are:

model.H_lr, model.W_lr: height and width for the image pair.

model.H_hr, model.W_hr: height and width for a high resolution version of the image pair (used for upsampling as in RoMa)

model.bidirectional: Useful for getting more diverse matches, and for estimating the covariance matrix in both directions.

model.threshold: Value between [0,1]. Used to set overlap prediction above it to 1. Useful for Mega1500.

model.balanced_sampling: Diverse sampling, same as RoMa. Typically helps to get better RANSAC estimates.

License

All our code except DINOv3 is MIT license. DINOv3 has a custom license, see DINOv3.

Acknowledgement

Our codebase builds mainly on the code in RoMa. We were additionally inspired by UFM and MapAnything, particularly for the datasets used to train the models.

BibTeX

If you find our models useful, please consider citing our paper!

@article{edstedt2025romav2,
  title={{RoMa v2: Harder Better Faster Denser Feature Matching}},
  author={Johan Edstedt, David Nordström, Yushan Zhang, Georg Bökman, Jonathan Astermark, Viktor Larsson, Anders Heyden, Fredrik Kahl, Mårten Wadenbäck, Michael Felsberg},
  journal={arXiv preprint arXiv:2511.15706},
  year={2025}
}

Metadata

Release files for romav2 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for romav2 2.0.1
File Size Uploaded Provenance Actions
romav2-2.0.1.tar.gz 37.1 kB Without provenance Details for romav2-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for romav2 2.0.1
File Interpreter ABI Platform Actions
romav2-2.0.1-py3-none-any.whl Python 3 none any Details for romav2-2.0.1-py3-none-any.whl

Total release size: 87.7 kB

Release files / romav2-2.0.1.tar.gz

Download URL romav2-2.0.1.tar.gz
Size 37.1 kB
Tags Source
SHA-256 checksum
How to use checksums
30f53039db047c6b46244824ea79c06b65945d7633d6a4905de02a539f2ac80e
BLAKE2b-256 checksum
How to use checksums
e5b3f3688a9b3355ed29c23dd921d46af09a31169539d55e470ac052e1196a26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / romav2-2.0.1-py3-none-any.whl

Download URL romav2-2.0.1-py3-none-any.whl
Size 50.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4acdc8fed7ba212cefc7f31e9fa4ee46bd7a38901445a92b7f7f59259c2f6783
BLAKE2b-256 checksum
How to use checksums
e9256a5c0e37d34a80ba6ee7ad9fa9d1d2c5b5e11d3800e1faf2a4cbad57e916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for romav2 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page