From e1797278d1688c53166b8285da4d56abf9c56b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Komorowicz?= Date: Thu, 21 Nov 2024 18:45:07 +0100 Subject: [PATCH] Added ALIKED+LightGlue --- README.md | 2 +- hloc/extract_features.py | 29 +++++++++++++++++++++++++++++ hloc/extractors/aliked.py | 27 +++++++++++++++++++++++++++ hloc/match_features.py | 17 +++++++++++++++++ ui/config.yaml | 11 +++++++++++ 5 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 hloc/extractors/aliked.py diff --git a/README.md b/README.md index 6eddcd5..9de0a56 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The tool currently supports various popular image matching algorithms, namely: - [x] [DeDoDe](https://github.com/Parskatt/DeDoDe), 3DV 2024 - [ ] [Mickey](https://github.com/nianticlabs/mickey), CVPR 2024 - [x] [GIM](https://github.com/xuelunshen/gim), ICLR 2024 -- [x] [DUSt3R](https://github.com/naver/dust3r), arXiv 2023 +- [x] [ALIKED](https://github.com/Shiaoming/ALIKED), ICCV 2023 - [x] [LightGlue](https://github.com/cvg/LightGlue), ICCV 2023 - [x] [DarkFeat](https://github.com/THU-LYJ-Lab/DarkFeat), AAAI 2023 - [x] [SFD2](https://github.com/feixue94/sfd2), CVPR 2023 diff --git a/hloc/extract_features.py b/hloc/extract_features.py index 62eeb45..a36ba1d 100644 --- a/hloc/extract_features.py +++ b/hloc/extract_features.py @@ -214,6 +214,35 @@ "resize_max": 1600, }, }, + + "aliked-n16-rot": { + "output": "feats-aliked-n16-rot", + "model": { + "name": "aliked", + "model_name": "aliked-n16rot", + "max_num_keypoints": -1, + "detection_threshold": 0.2, + "nms_radius": 2, + }, + "preprocessing": { + "grayscale": False, + "resize_max": 1024, + }, + }, + "aliked-n16": { + "output": "feats-aliked-n16", + "model": { + "name": "aliked", + "model_name": "aliked-n16", + "max_num_keypoints": -1, + "detection_threshold": 0.2, + "nms_radius": 2, + }, + "preprocessing": { + "grayscale": False, + "resize_max": 1024, + }, + }, "alike": { "output": "feats-alike-n5000-r1600", "model": { diff --git a/hloc/extractors/aliked.py b/hloc/extractors/aliked.py new file mode 100644 index 0000000..91e4431 --- /dev/null +++ b/hloc/extractors/aliked.py @@ -0,0 +1,27 @@ +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): + image = data["image"] + features = self.model(data) + + return { + "keypoints": [f for f in features["keypoints"]], + "scores": [f for f in features["keypoint_scores"]], + "descriptors": [f.t() for f in features["descriptors"]], + } \ No newline at end of file diff --git a/hloc/match_features.py b/hloc/match_features.py index 88a44e2..cb75253 100644 --- a/hloc/match_features.py +++ b/hloc/match_features.py @@ -80,6 +80,23 @@ "force_resize": False, }, }, + "aliked-lightglue": { + "output": "matches-aliked-lightglue", + "model": { + "name": "lightglue", + "match_threshold": 0.2, + "width_confidence": 0.99, # for point pruning + "depth_confidence": 0.95, # for early stopping, + "features": "aliked", + "model_name": "aliked_lightglue.pth", + }, + "preprocessing": { + "grayscale": True, + "resize_max": 1024, + "dfactor": 8, + "force_resize": False, + }, + }, "sift-lightglue": { "output": "matches-sift-lightglue", "model": { diff --git a/ui/config.yaml b/ui/config.yaml index eb6b609..ffe68f8 100644 --- a/ui/config.yaml +++ b/ui/config.yaml @@ -267,6 +267,17 @@ matcher_zoo: paper: https://arxiv.org/pdf/2306.13643 project: null display: true + aliked+lightglue: + matcher: aliked-lightglue + feature: aliked-n16 + dense: false + info: + name: ALIKED + source: "ICCV 2023" + github: https://github.com/Shiaoming/ALIKED + paper: https://arxiv.org/pdf/2304.03608.pdf + project: null + display: true superpoint+mnn: matcher: NN-mutual feature: superpoint_max