Skip to content

Commit abb2520

Browse files
Dawarssarlinpe
andauthored
Expose ALIKED feature extractor from LightGlue (#375)
Co-authored-by: Paul-Edouard Sarlin <15985472+sarlinpe@users.noreply.github.com>
1 parent 3c50d5b commit abb2520

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

hloc/extract_features.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@
114114
"resize_max": 1600,
115115
},
116116
},
117+
"aliked-n16": {
118+
"output": "feats-aliked-n16",
119+
"model": {
120+
"name": "aliked",
121+
"model_name": "aliked-n16",
122+
},
123+
"preprocessing": {
124+
"grayscale": False,
125+
"resize_max": 1024,
126+
},
127+
},
117128
# Global descriptors
118129
"dir": {
119130
"output": "global-feats-dir",

hloc/extractors/aliked.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from lightglue import ALIKED as ALIKED_
2+
3+
from ..utils.base_model import BaseModel
4+
5+
6+
class ALIKED(BaseModel):
7+
default_conf = {
8+
"model_name": "aliked-n16",
9+
"max_num_keypoints": -1,
10+
"detection_threshold": 0.2,
11+
"nms_radius": 2,
12+
}
13+
required_inputs = ["image"]
14+
15+
def _init(self, conf):
16+
conf.pop("name")
17+
self.model = ALIKED_(**conf)
18+
19+
def _forward(self, data):
20+
features = self.model(data)
21+
22+
return {
23+
"keypoints": [f for f in features["keypoints"]],
24+
"keypoint_scores": [f for f in features["keypoint_scores"]],
25+
"descriptors": [f.t() for f in features["descriptors"]],
26+
}

hloc/match_features.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
"features": "disk",
3636
},
3737
},
38+
"aliked+lightglue": {
39+
"output": "matches-aliked-lightglue",
40+
"model": {
41+
"name": "lightglue",
42+
"features": "aliked",
43+
},
44+
},
3845
"superglue": {
3946
"output": "matches-superglue",
4047
"model": {

0 commit comments

Comments
 (0)