Skip to content

Add LoMa#495

Open
davnords wants to merge 2 commits intocvg:masterfrom
davnords:master
Open

Add LoMa#495
davnords wants to merge 2 commits intocvg:masterfrom
davnords:master

Conversation

@davnords
Copy link
Copy Markdown

Attempt to add the LoMa matcher from LoMa: Local Feature Matching Revisited.

Verification

When I benchmarked LoMa-B on InLoc, using the following simple script:

from pathlib import Path
from hloc import extract_features, match_features, localize_inloc

if __name__ == "__main__":
    print(f"Running matcher")
    dataset = Path("data/inloc")  # change this if your dataset is somewhere else

    pairs = Path("pairs/inloc")
    loc_pairs = pairs / "pairs-query-netvlad40.txt"  # top 40 retrieved by NetVLAD

    outputs = Path("outputs/inloc")  # where everything will be saved
    results = outputs / f"InLoc_loma_netvlad40.txt"  # the result file
    feature_conf = extract_features.confs["loma_inloc"]
    matcher_conf = match_features.confs["loma"]

    feature_path = extract_features.main(feature_conf, dataset, outputs)
    match_path = match_features.main(matcher_conf, loc_pairs, feature_conf["output"], outputs, overwrite=False)# True)
    localize_inloc.main(
        dataset, loc_pairs, feature_path, match_path, results, skip_matches=20
    )

I achieved the following results:

DUC1: 55.1 / 80.3 / 91.4 
DUC2: 72.5 / 87.8 / 88.5

This is similar to the results reported in the paper and an almost 20-point improvement on DUC2 (0.25m, 10°) compared to what is reported in the LightGlue paper.

Thank you very much for your work.

/ David

@davnords
Copy link
Copy Markdown
Author

@sarlinpe Perhaps this matcher be interest you :)

LoMa.

/ David

@omaralvarez
Copy link
Copy Markdown

This matcher would be a great addition, hoping it gets merged!

@Parskatt
Copy link
Copy Markdown
Contributor

@sarlinpe anything else required for merge?

@omaralvarez
Copy link
Copy Markdown

I have been testing the implementation and I found an issue with the Dockerfile of hloc. For up to date colmap, hloc, and LoMa, the Python version needs to be bumped to 3.10, if not the docker build errors out. Additionally, probably due to being based in the colmap image it is missing git.

In python 3.10, dataclasses is already included in the Python standard library, leading to a dependency conflict when installing lomatch @ git+https://github.com/davnords/LoMa.

Just removing the dataclasses in the .toml in LoMa would fix this issue. I could create another pull request with the updated Dockerfile.

@Parskatt
Copy link
Copy Markdown
Contributor

Now fixed.

@omaralvarez
Copy link
Copy Markdown

omaralvarez commented Apr 30, 2026

I confirm now docker works well with the change and my Dockerfile pull request #497 . I have also tested LoMa with a difficult reconstruction and it works really well.

@omaralvarez
Copy link
Copy Markdown

omaralvarez commented Apr 30, 2026

Shouldn't we make available through config all LoMa weights (loma_R, loma_L, etc.)? It would be great to be able to use the LoMa-R version. I think right now LoMa-R is missing, please correct me if I am wrong.

@davnords
Copy link
Copy Markdown
Author

davnords commented May 1, 2026

Thank you @omaralvarez for testing. I am glad LoMa performed well on difficult reconstructions. I have now added LoMa-R to the configs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants