You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

nycLocator-v1

nycLocator-v1 is a visual place-recognition encoder adapted to street-level imagery of New York City. Built on MegaLoc, it produces 8,448-dimensional, L2-normalized descriptors for image retrieval and location matching.

Model specifications

Property Value
Architecture MegaLoc with a DINOv2 ViT-B/14 backbone
Parameters 228,639,553
Input RGB images, resized to 322 × 322 pixels
Output 8,448-dimensional normalized descriptor
Weight format Safetensors, float32
Similarity Cosine similarity

Training

The model was initialized from the published MegaLoc weights and adapted from a collection of geotagged New York City street-view images covering 11,864 labeled locations, each with four directional views.

Adaptation uses geographic soft contrastive learning. Nearby locations provide positive examples; hard negatives are mined from the training descriptors with a minimum geographic separation of 0.5 km. The final full-data continuation ran for four epochs using 224-pixel training crops, the last eight transformer blocks unfrozen, a learning rate of 2e-6, and a geographic temperature of 0.15 km.

The adaptation did not add external reference-image collections, street-map databases, business gazetteers, or public location indexes. The base model's original pretraining is documented separately by its authors. Training images and location labels are not included in this repository.

Evaluation

The initial development phase used a location-level training/validation split with 9,492 training locations and 2,372 validation locations. Hyperparameters and checkpoints were selected using this split. The released checkpoint was then continued on all 11,864 labeled locations, so no held-out evaluation score is assigned to this full-data checkpoint.

Packaging verification includes strict parameter loading, finite-value checks, normalized descriptor output, exact tensor equality after Safetensors conversion, and an identical CPU forward pass before and after conversion. Details are recorded in provenance.json.

Usage

Download the repository while authenticated and install the dependencies:

pip install -r requirements.txt

Run from the downloaded model directory:

import torch
from PIL import Image
from load_model import load_model, preprocess

model = load_model(device="cpu")  # Use "cuda" for GPU inference.
image = preprocess(Image.open("street_view.jpg")).unsqueeze(0)

with torch.inference_mode():
    descriptor = model(image)  # Shape: [1, 8448]

Use the same preprocessing and weights for query and reference images. Compare normalized descriptors with cosine similarity. Geographic predictions require a separate reference collection with known coordinates and a retrieval decoder; the encoder itself does not directly output latitude or longitude.

Files

  • model.safetensors: adapted encoder weights.
  • megaloc_model.py: pinned upstream architecture implementation.
  • load_model.py: local loading and preprocessing utilities.
  • config.json: architecture and model configuration.
  • training_run.json: training-run metadata.
  • provenance.json: checkpoint integrity and packaging verification.
  • upstream_revision.json: upstream source revision.

Attribution and licensing

MegaLoc was developed by Gabriele Berton and Carlo Masone. Its upstream code is provided under the MIT license included in LICENSE.MegaLoc. This repository does not redistribute the training imagery or grant rights to its source data.

Reference: MegaLoc: One Retrieval to Place Them All, CVPR 2025 Workshop. Paper · Upstream implementation

Downloads last month
2
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ts3915789/nycLocator-v1

Base model

gberton/MegaLoc
Finetuned
(1)
this model

Paper for ts3915789/nycLocator-v1