Skip to content

Commit

Permalink
Added EigenPlaces for retrieval (cvg#337)
Browse files Browse the repository at this point in the history
Co-authored-by: gmberton <[email protected]>
  • Loading branch information
gmberton and gmberton authored Jan 11, 2024
1 parent a9ee933 commit 988dd3a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
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

0 comments on commit 988dd3a

Please sign in to comment.