Buckets:
915 MB
6 files
Updated 4 months ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| .gitattributes | 1.52 kB xet | 818ba6de | |
| LICENSE | 1.09 kB xet | cd1b9900 | |
| README.md | 1.94 kB xet | d70ed284 | |
| config.json | 288 Bytes xet | cb25312b | |
| megaloc_model.py | 15.1 kB xet | e7df776e | |
| model.safetensors | 915 MB xet | 1fb01a9c |
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 (CVPR 2025 Workshop)
GitHub: gmberton/MegaLoc
Usage
import torch
import torchvision.transforms as tfm
from PIL import Image
model = torch.hub.load("gmberton/MegaLoc", "get_trained_model")
# Same preprocessing we use for evaluation: ImageNet normalization, resize to 322x322
# (any resolution works, paper results are computed at 322x322)
transform = tfm.Compose([
tfm.ToTensor(),
tfm.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
tfm.Resize(size=[322, 322], antialias=True),
])
images = torch.stack([transform(Image.open(path).convert("RGB")) for path in ["im1.jpg", "im2.jpg"]])
with torch.inference_mode():
descriptors = model(images) # shape [2, 8448], L2-normalized
similarities = descriptors @ descriptors.T # cosine similarities
For benchmarking on VPR datasets, see VPR-methods-evaluation.
Qualitative Examples
Top-1 retrieved images from the SF-XL test set (2.8M database images):
Citation
@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}
}
- Total size
- 915 MB
- Files
- 6
- Last updated
- Aug 11
- Pre-warmed CDN
- US EU US EU