Skip to content

Commit d0e8494

Browse files
authored
Added MegaLoc and removed EigenPlaces (#458)
1 parent abb2520 commit d0e8494

File tree

4 files changed

+31
-61
lines changed

4 files changed

+31
-61
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ We show in [`pipeline_SfM.ipynb`](https://nbviewer.jupyter.org/github/cvg/Hierar
9595

9696
- Supported local feature extractors: [SuperPoint](https://arxiv.org/abs/1712.07629), [DISK](https://arxiv.org/abs/2006.13566), [D2-Net](https://arxiv.org/abs/1905.03561), [SIFT](https://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf), and [R2D2](https://arxiv.org/abs/1906.06195).
9797
- Supported feature matchers: [SuperGlue](https://arxiv.org/abs/1911.11763), its faster follow-up [LightGlue](https://github.com/cvg/LightGlue), and nearest neighbor search with ratio test, distance test, and/or mutual check. hloc also supports dense matching with [LoFTR](https://github.com/zju3dv/LoFTR).
98-
- Supported image retrieval: [NetVLAD](https://arxiv.org/abs/1511.07247), [AP-GeM/DIR](https://github.com/naver/deep-image-retrieval), [OpenIBL](https://github.com/yxgeee/OpenIBL), [CosPlace](https://github.com/gmberton/CosPlace) and [EigenPlaces](https://github.com/gmberton/EigenPlaces).
98+
- Supported image retrieval: [NetVLAD](https://arxiv.org/abs/1511.07247), [AP-GeM/DIR](https://github.com/naver/deep-image-retrieval), [OpenIBL](https://github.com/yxgeee/OpenIBL), and [MegaLoc](https://github.com/gmberton/MegaLoc).
9999

100100
Using NetVLAD for retrieval, we obtain the following best results:
101101

hloc/extract_features.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@
141141
"model": {"name": "openibl"},
142142
"preprocessing": {"resize_max": 1024},
143143
},
144-
"eigenplaces": {
145-
"output": "global-feats-eigenplaces",
146-
"model": {"name": "eigenplaces"},
144+
"megaloc": {
145+
"output": "global-feats-megaloc",
146+
"model": {"name": "megaloc"},
147147
"preprocessing": {"resize_max": 1024},
148148
},
149149
}

hloc/extractors/eigenplaces.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

hloc/extractors/megaloc.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
Code to use MegaLoc as a global features extractor.
3+
4+
MegaLoc paper: https://arxiv.org/abs/2502.17237
5+
"""
6+
7+
import torch
8+
import torchvision.transforms as tvf
9+
10+
from ..utils.base_model import BaseModel
11+
12+
13+
class MegaPlaces(BaseModel):
14+
required_inputs = ["image"]
15+
16+
def _init(self, conf):
17+
self.net = torch.hub.load("gmberton/MegaLoc", "get_trained_model").eval()
18+
mean = [0.485, 0.456, 0.406]
19+
std = [0.229, 0.224, 0.225]
20+
self.norm_rgb = tvf.Normalize(mean=mean, std=std)
21+
22+
def _forward(self, data):
23+
image = self.norm_rgb(data["image"])
24+
desc = self.net(image)
25+
return {
26+
"global_descriptor": desc,
27+
}

0 commit comments

Comments
 (0)