Skip to content

Commit d9d04b5

Browse files
add: liftfeat (#130)
* add: liftfeat * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 5c6385d commit d9d04b5

File tree

6 files changed

+75
-0
lines changed

6 files changed

+75
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,6 @@
7676
[submodule "imcui/third_party/dad"]
7777
path = imcui/third_party/dad
7878
url = https://github.com/Parskatt/dad
79+
[submodule "imcui/third_party/LiftFeat"]
80+
path = imcui/third_party/LiftFeat
81+
url = https://github.com/agipro/LiftFeat.git

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The tool currently supports various popular image matching algorithms, namely:
3434
| Algorithm | Supported | Conference/Journal | Year | GitHub Link |
3535
|------------------|-----------|--------------------|------|-------------|
3636
| DaD || ARXIV | 2025 | [Link](https://github.com/Parskatt/dad) |
37+
| LiftFeat || ICRA | 2025 | [Link](https://github.com/lyp-deeplearning/LiftFeat) |
3738
| MINIMA || ARXIV | 2024 | [Link](https://github.com/LSXI7/MINIMA) |
3839
| XoFTR || CVPR | 2024 | [Link](https://github.com/OnderT/XoFTR) |
3940
| EfficientLoFTR || CVPR | 2024 | [Link](https://github.com/zju3dv/EfficientLoFTR) |

config/config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,17 @@ matcher_zoo:
242242
paper: https://arxiv.org/abs/2404.19174
243243
project: null
244244
display: false
245+
liftfeat(sparse):
246+
matcher: NN-mutual
247+
feature: liftfeat
248+
dense: false
249+
info:
250+
name: LiftFeat #dispaly name
251+
source: "ICRA 2025"
252+
github: https://github.com/lyp-deeplearning/LiftFeat
253+
paper: https://arxiv.org/abs/2505.0342
254+
project: null
255+
display: true
245256
dedode:
246257
matcher: Dual-Softmax
247258
feature: dedode

imcui/hloc/extract_features.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,17 @@
214214
"resize_max": 1600,
215215
},
216216
},
217+
"liftfeat": {
218+
"output": "feats-liftfeat-n5000-r1600",
219+
"model": {
220+
"name": "liftfeat",
221+
"max_keypoints": 5000,
222+
},
223+
"preprocessing": {
224+
"grayscale": False,
225+
"resize_max": 1600,
226+
},
227+
},
217228
"aliked-n16-rot": {
218229
"output": "feats-aliked-n16-rot",
219230
"model": {

imcui/hloc/extractors/liftfeat.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import sys
2+
from pathlib import Path
3+
from ..utils.base_model import BaseModel
4+
from .. import logger
5+
6+
fire_path = Path(__file__).parent / "../../third_party/LiftFeat"
7+
sys.path.append(str(fire_path))
8+
9+
from models.liftfeat_wrapper import LiftFeat, MODEL_PATH
10+
11+
12+
class Liftfeat(BaseModel):
13+
default_conf = {
14+
"keypoint_threshold": 0.05,
15+
"max_keypoints": 5000,
16+
}
17+
18+
required_inputs = ["image"]
19+
20+
def _init(self, conf):
21+
logger.info("Loading LiftFeat model...")
22+
self.net = LiftFeat(
23+
weight=MODEL_PATH,
24+
detect_threshold=self.conf["keypoint_threshold"],
25+
top_k=self.conf["max_keypoints"],
26+
)
27+
logger.info("Loading LiftFeat model done!")
28+
29+
def _forward(self, data):
30+
image = data["image"].cpu().numpy().squeeze() * 255
31+
image = image.transpose(1, 2, 0)
32+
pred = self.net.extract(image)
33+
34+
keypoints = pred["keypoints"]
35+
descriptors = pred["descriptors"]
36+
scores = pred["scores"]
37+
if self.conf["max_keypoints"] < len(keypoints):
38+
idxs = scores.argsort()[-self.conf["max_keypoints"] or None :]
39+
keypoints = keypoints[idxs, :2]
40+
descriptors = descriptors[idxs]
41+
scores = scores[idxs]
42+
43+
pred = {
44+
"keypoints": keypoints[None],
45+
"descriptors": descriptors[None].permute(0, 2, 1),
46+
"scores": scores[None],
47+
}
48+
return pred

imcui/third_party/LiftFeat

Submodule LiftFeat added at bb64a68

0 commit comments

Comments
 (0)