RoMa

ParskattMIT更新放缓

RoMa 是 CVPR 2024 提出的鲁棒稠密特征匹配器,能为几乎任意图像对估计像素级稠密形变和可靠的匹配置信度,用于 3D 重建等任务。

[CVPR 2024] RoMa: Robust Dense Feature Matching; RoMa is the robust dense feature matcher capable of estimating pixel-dense warps and reliable certainties for almost any image pair.

v0.1.1发布于 2025-10-06 14:33 UTC1,332star142fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
uv pip install romatch
硬件要求按 README 说明

README 未说明具体显存或 GPU 型号要求;示例代码通过 device 参数指定运行设备。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

CVPR 2024 的鲁棒稠密特征匹配器,为任意图像对估计像素级 warp 和可靠置信度

RoMa 是 CVPR 2024 提出的鲁棒稠密特征匹配器,能为几乎任意图像对估计像素级稠密形变和可靠的匹配置信度,用于 3D 重建等任务。

核心能力

  • 估计像素稠密 warp 而非稀疏关键点匹配
  • 同时输出匹配置信度用于筛选可靠对应
  • 支持任意关键点的匹配(match_keypoints)
  • 提供轻量版 Tiny RoMa,基于 XFeat 构建
  • 可调初始分辨率与上采样分辨率及采样阈值

容易踩的坑

需先安装 uv 或改用 pip 安装;Tiny RoMa 需从 romatch 单独导入 tiny_roma_v1_outdoor;复现训练需先按 DKM 仓库说明下载并预处理数据集;fused-local-corr 加速内核需额外加 --extra 或 [fused-local-corr] 安装

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本v0.1.1
  1. v0.1.1最新正式版2025-10-06 · 2025-10-06 14:33 UTC

    What's Changed

    Full Changelog: https://github.com/Parskatt/RoMa/compare/v0.1.0...v0.1.1

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Setup/Install

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

    uv pip install -e .
    

    or

    uv sync
    

    You can also install romatch directly as a package from PyPI by

    uv pip install romatch
    

    or

    uv add romatch
    

    Fused local correlation kernel

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

    uv sync --extra fused-local-corr
    

    or

    uv pip install romatch[fused-local-corr]
    

    or

    uv add romatch[fused-local-corr]
    

    Demo / How to Use

    We provide two demos in the demos folder. Here's the gist of it:

    from romatch import roma_outdoor
    roma_model = roma_outdoor(device=device)
    # Match
    warp, certainty = roma_model.match(imA_path, imB_path, device=device)
    # Sample matches for estimation
    matches, certainty = roma_model.sample(warp, certainty)
    # Convert to pixel coordinates (RoMa produces matches in [-1,1]x[-1,1])
    kptsA, kptsB = roma_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
    )
    

    New: You can also match arbitrary keypoints with RoMa. See match_keypoints in RegressionMatcher.

    Settings

    Resolution

    By default RoMa uses an initial resolution of (560,560) which is then upsampled to (864,864). You can change this at construction (see roma_outdoor kwargs). You can also change this later, by changing the roma_model.w_resized, roma_model.h_resized, and roma_model.upsample_res.

    Sampling

    roma_model.sample_thresh controls the thresholding used when sampling matches for estimation. In certain cases a lower or higher threshold may improve results.

    Reproducing Results

    The experiments in the paper are provided in the experiments folder.

    Training

    1. First follow the instructions provided here: https://github.com/Parskatt/DKM for downloading and preprocessing datasets.
    2. Run the relevant experiment, e.g.,
    torchrun --nproc_per_node=4 --nnodes=1 --rdzv_backend=c10d experiments/roma_outdoor.py
    

    Testing

    python experiments/roma_outdoor.py --only_test --benchmark mega-1500
    

    License

    All our code except DINOv2 is MIT license. DINOv2 has an Apache 2 license DINOv2.

    Acknowledgement

    Our codebase builds on the code in DKM.

    Tiny RoMa

    If you find that RoMa is too heavy, you might want to try Tiny RoMa which is built on top of XFeat.

    from romatch import tiny_roma_v1_outdoor
    tiny_roma_model = tiny_roma_v1_outdoor(device=device)
    

    Mega1500:

    AUC@5AUC@10AUC@20
    XFeat46.458.969.2
    XFeat*51.967.278.9
    Tiny RoMa v156.469.579.5
    RoMa---

    Mega-8-Scenes (See DKM):

    AUC@5AUC@10AUC@20
    XFeat---
    XFeat*50.164.475.2
    Tiny RoMa v157.770.579.6
    RoMa---

    IMC22 :'):

    mAA@10
    XFeat42.1
    XFeat*-
    Tiny RoMa v142.2
    RoMa-

    Reproducibility

    There are a few diffs in the current codebase compared to the original repo used to run experiments.

    1. The scale_factor used in the match method now is relative to the original training resolution of 560. Previosly it was based on the set coarse resolution (which might or might not be 560).
    2. Newer PyTorch, original code used something like 2.1.
    3. Stochastic eval: both RANSAC and the chosen correspondences can affect results in Mega1500.
    4. Matrix inverse in GP has been replaced with cholesky decomp.

    That being said, if diff of results are $>0.5$ there probably is something wrong, please let me know.

    BibTeX

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

    @inproceedings{edstedt2024roma,
    title={{RoMa: Robust Dense Feature Matching}},
    author={Edstedt, Johan and Sun, Qiyu and Bökman, Georg and Wadenbäck, Mårten and Felsberg, Michael},
    booktitle={IEEE Conference on Computer Vision and Pattern Recognition},
    year={2024}
    }