File size: 1,498 Bytes
8c466ed
7cb9f79
37b751d
 
8c466ed
37b751d
 
c6d8ab9
8c466ed
 
c6d8ab9
 
37b751d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6d8ab9
 
 
37b751d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
pipeline_tag: visual-document-retrieval
library_name: pytorch
license: mit
tags:
- visual-place-recognition
- image-retrieval
- arxiv:2502.17237
---

# MegaLoc

MegaLoc is an image retrieval model for visual place recognition (VPR) that achieves state-of-the-art on most VPR datasets, including indoor and outdoor environments.

**Paper:** [MegaLoc: One Retrieval to Place Them All](https://arxiv.org/abs/2502.17237) (CVPR 2025 Workshop)

**GitHub:** [gmberton/MegaLoc](https://github.com/gmberton/MegaLoc)

## Usage

```python
import torch
model = torch.hub.load("gmberton/MegaLoc", "get_trained_model")
model.eval()

# Extract descriptor from an image
image = torch.randn(1, 3, 322, 322)  # [B, 3, H, W] - any size works
with torch.no_grad():
    descriptor = model(image)  # [B, 8448] L2-normalized descriptor
```

For benchmarking on VPR datasets, see [VPR-methods-evaluation](https://github.com/gmberton/VPR-methods-evaluation).

## Qualitative Examples

Top-1 retrieved images from the SF-XL test set (2.8M database images):

![teaser](https://github.com/user-attachments/assets/a90b8d4c-ab53-4151-aacc-93493d583713)

## Citation

```bibtex
@InProceedings{Berton_2025_CVPR,
    author    = {Berton, Gabriele and Masone, Carlo},
    title     = {MegaLoc: One Retrieval to Place Them All},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
    month     = {June},
    year      = {2025},
    pages     = {2861-2867}
}
```