Skip to content

Add LoMa keypoint matching model#47401

Open
Gitanaskhan26 wants to merge 11 commits into
huggingface:mainfrom
Gitanaskhan26:new-model-47004/LoMa
Open

Add LoMa keypoint matching model#47401
Gitanaskhan26 wants to merge 11 commits into
huggingface:mainfrom
Gitanaskhan26:new-model-47004/LoMa

Conversation

@Gitanaskhan26

@Gitanaskhan26 Gitanaskhan26 commented Jul 18, 2026

Copy link
Copy Markdown

CI

What does this PR do?

Fixes #47004

Adds LoMa (davnords/LoMa), a local feature matcher that outperforms LightGlue and is
competitive with dense matchers on standard benchmarks (WxBS, IMC22, HPatches),
accepted at ECCV 2024.

Paper: https://arxiv.org/abs/2604.04931 (base), https://arxiv.org/abs/2604.11809 (rotation-invariant)
Code: https://github.com/davnords/LoMa

This is a work in progress; opening as a draft early per the contribution guide, to
track progress and get feedback before going further.

Scope for this PR

LoMa pairs with several external keypoint detectors in the original repo (DaD, DeDoDe-v2,
DISK, ALIKED), none of which are currently native transformers models, and trust_remote_code
for non-SuperPoint detectors was removed from LightGlue in #45122 for security reasons.
Proposing to scope this first PR to LoMa + SuperPoint, matching that existing precedent,
and follow up with native detector support (DaD in particular, since it's what the paper's
headline numbers use) as a separate PR once this lands. Flagging this early in case there's
a different preference; happy to adjust scope based on feedback here.

Architectural note: Currently planning to implement the DeDoDe-style descriptor network
as a reusable, standalone component (to enable a future native DeDoDe integration).
Open to feedback on this approach --> see comment in #47004.

Plan

  • LoMaConfig
  • Descriptor network (DeDoDe-style, new relative to LightGlue)
  • Matching transformer (adapted from LightGlue's self-/cross-attention blocks, dual-softmax matching head)
  • LoMaForKeypointMatching + Auto registration
  • Image processor (likely reusable from LightGlue)
  • Conversion script for the B/L/G checkpoints
  • Tests + integration test against the reference implementation
  • Docs

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline, Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link to it if that's the case. → Add LoMa keypoint detector & matcher #47004
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

(Note: Documentation and comprehensive tests are currently unchecked as this is a draft PR. They will be fully implemented and checked in subsequent commits before merging.)

Who can review?

@zucchini-nlp @guarin, @molbap

@Gitanaskhan26 Gitanaskhan26 changed the title Add LoMa model skeleton via add-new-model-like Add LoMa keypoint matching model Jul 18, 2026
@Gitanaskhan26
Gitanaskhan26 marked this pull request as draft July 18, 2026 22:05
@Gitanaskhan26
Gitanaskhan26 marked this pull request as ready for review July 19, 2026 07:36
@molbap

molbap commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Hello @Gitanaskhan26 , thanks for the PR!

To note, the weights are provided only in .pth through direct download via the author's repo, for a full release it would need to be converted to .safetensors as well and to be available on the hub.
For now it seems to be just the draft (the modular fully inherits LightGlue) so feel free to ping when you need. For the descriptor network, as long as the abstraction is clean here, we'll be able to reuse it on other models if needed.

If you are using a code agent: transformers_contribution_skill.md
I recommend using this skill (under development) to do a self-review on your end before pinging us, it's something I am trying out to shorten review cycles a bit!

@Gitanaskhan26

Copy link
Copy Markdown
Author

Hello @Gitanaskhan26 , thanks for the PR!

Hi @molbap, thanks for the feedback!

To note, the weights are provided only in .pth through direct download via the author's repo, for a full release it would need to be converted to .safetensors as well and to be available on the hub.

Noted. I will handle the .pth to .safetensors conversion and Hub upload and actually it was Phase 8 of my plan.

For now it seems to be just the draft (the modular fully inherits LightGlue) so feel free to ping when you need. For the descriptor network, as long as the abstraction is clean here, we'll be able to reuse it on other models if needed.

Understood. I will implement the descriptor network as a clean, reusable abstraction so it can be easily shared with other models in the future.

If you are using a code agent: transformers_contribution_skill.md I recommend using this skill (under development) to do a self-review on your end before pinging us, it's something I am trying out to shorten review cycles a bit!

Thanks for sharing, I will make sure to use it!

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, loma

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 30213627531:2
Result: failure | Jobs: 16 | Tests: 175,087 | Failures: 1 | Duration: 16h 54m

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.

Add LoMa keypoint detector & matcher

2 participants