Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added EigenPlaces for retrieval #337

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ We show in [`pipeline_SfM.ipynb`](https://nbviewer.jupyter.org/github/cvg/Hierar

- 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).
- 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).
- 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 [CosPlace](https://github.com/gmberton/CosPlace).
- 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).

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

Expand Down
6 changes: 3 additions & 3 deletions hloc/extract_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@
'model': {'name': 'openibl'},
'preprocessing': {'resize_max': 1024},
},
'cosplace': {
'output': 'global-feats-cosplace',
'model': {'name': 'cosplace'},
'eigenplaces': {
'output': 'global-feats-eigenplaces',
'model': {'name': 'eigenplaces'},
'preprocessing': {'resize_max': 1024},
}
}
Expand Down
22 changes: 16 additions & 6 deletions hloc/extractors/cosplace.py → hloc/extractors/eigenplaces.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
'''
Code for loading models trained with CosPlace as a global features extractor
for geolocalization through image retrieval.
Code for loading models trained with EigenPlaces (or CosPlace) as a global
features extractor for geolocalization through image retrieval.
Multiple models are available with different backbones. Below is a summary of
models available (backbone : list of available output descriptors
dimensionality). For example you can use a model based on a ResNet50 with
descriptors dimensionality 1024.

EigenPlaces trained models:
ResNet18: [ 256, 512]
ResNet50: [128, 256, 512, 2048]
ResNet101: [128, 256, 512, 2048]
VGG16: [ 512]

CosPlace trained models:
ResNet18: [32, 64, 128, 256, 512]
ResNet50: [32, 64, 128, 256, 512, 1024, 2048]
ResNet101: [32, 64, 128, 256, 512, 1024, 2048]
ResNet152: [32, 64, 128, 256, 512, 1024, 2048]
VGG16: [ 64, 128, 256, 512]

CosPlace paper: https://arxiv.org/abs/2204.02287
EigenPlaces paper (ICCV 2023): https://arxiv.org/abs/2308.10832
CosPlace paper (CVPR 2022): https://arxiv.org/abs/2204.02287
'''

import torch
Expand All @@ -20,15 +29,16 @@
from ..utils.base_model import BaseModel


class CosPlace(BaseModel):
class EigenPlaces(BaseModel):
default_conf = {
'backbone': 'ResNet50',
'variant': 'EigenPlaces',
'backbone': 'ResNet101',
'fc_output_dim' : 2048
}
required_inputs = ['image']
def _init(self, conf):
self.net = torch.hub.load(
'gmberton/CosPlace',
'gmberton/' + conf['variant'],
'get_trained_model',
backbone=conf['backbone'],
fc_output_dim=conf['fc_output_dim']
Expand Down