Skip to content

Commit

Permalink
Expose ALIKED feature extractor from LightGlue (#375)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul-Edouard Sarlin <15985472+sarlinpe@users.noreply.github.com>
  • Loading branch information
Dawars and sarlinpe authored Nov 3, 2024
1 parent 3c50d5b commit abb2520
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hloc/extract_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@
"resize_max": 1600,
},
},
"aliked-n16": {
"output": "feats-aliked-n16",
"model": {
"name": "aliked",
"model_name": "aliked-n16",
},
"preprocessing": {
"grayscale": False,
"resize_max": 1024,
},
},
# Global descriptors
"dir": {
"output": "global-feats-dir",
Expand Down
26 changes: 26 additions & 0 deletions hloc/extractors/aliked.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from lightglue import ALIKED as ALIKED_

from ..utils.base_model import BaseModel


class ALIKED(BaseModel):
default_conf = {
"model_name": "aliked-n16",
"max_num_keypoints": -1,
"detection_threshold": 0.2,
"nms_radius": 2,
}
required_inputs = ["image"]

def _init(self, conf):
conf.pop("name")
self.model = ALIKED_(**conf)

def _forward(self, data):
features = self.model(data)

return {
"keypoints": [f for f in features["keypoints"]],
"keypoint_scores": [f for f in features["keypoint_scores"]],
"descriptors": [f.t() for f in features["descriptors"]],
}
7 changes: 7 additions & 0 deletions hloc/match_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
"features": "disk",
},
},
"aliked+lightglue": {
"output": "matches-aliked-lightglue",
"model": {
"name": "lightglue",
"features": "aliked",
},
},
"superglue": {
"output": "matches-superglue",
"model": {
Expand Down

0 comments on commit abb2520

Please sign in to comment.