Spatial building embeddings

This model turns a street-level photograph of a building into a 256-dimensional embedding. It is the embedding model of the paper A global typology of buildings seen from the street (A. W. Olson and S. Saxe), which calls the embedding R.

The revision that the paper used is 7ebdef3b61de34c733268e87b600d63d223d4f15. RELEASE_NOTES.md lists what later revisions change.

The model

The model is a DINOv3 ViT-7B/16 backbone (facebook/dinov3-vit7b16-pretrain-lvd1689m, Meta) followed by a projection head. The backbone is frozen: its weights are Meta's, unchanged.

The projection head maps the backbone's 4,096 features to the embedding. It is a multilayer perceptron with three hidden layers of width 384 (4,096 → 384 → 384 → 384 → 256; GELU activations, dropout 0.1, no normalisation layers) plus a learned linear shortcut from input to output. The output has unit length.

The repository holds the weights of both parts: 6,719,051,392 parameters, of which 3,016,320 are the projection head, in 32-bit floating point (six safetensors files, about 27 GB).

Training

The projection head was trained to recognise the same building in different photographs, with a triplet margin loss. Positives are other photographs of the same building. Negatives are drawn from bands of visual similarity that an upper-confidence-bound bandit selects. Hyperparameters were set with Optuna on validation recall at 100, with early stopping.

The training data were the 3D Street View dataset (Zamir et al. 2016): 1,006,160 buildings and 5,772,534 images from eight cities (New York, Chicago, Washington, Las Vegas, San Francisco, Florence, Amsterdam and Paris). The photographs of the paper were not used in training.

The training code is in the folder model_training/ of the paper's code repository.

How to use it

Loading the model reads the configuration and the image processor of the backbone from Meta's repository, which is gated. Accept the DINOv3 licence on the page of facebook/dinov3-vit7b16-pretrain-lvd1689m and log in to Hugging Face first.

import torch
from PIL import Image
from transformers import AutoImageProcessor, AutoModel

REVISION = "7ebdef3b61de34c733268e87b600d63d223d4f15"
model = AutoModel.from_pretrained(
    "alexwaolson/spatial-building-embeddings",
    revision=REVISION,
    trust_remote_code=True,
    low_cpu_mem_usage=False,
).eval()
processor = AutoImageProcessor.from_pretrained(model.config.backbone_model_name)

image = Image.open("building.jpg").convert("RGB")
inputs = processor(images=[image], return_tensors="pt")
with torch.no_grad():
    embedding = model(**inputs)[0]  # shape (1, 256), unit length

trust_remote_code=True is needed because the projection head is a class defined in this repository (modeling_spatial_embeddings.py). The paper's embeddings were computed with transformers 4.57.1 and torch 2.15.0, on 640 × 640 pixel frames.

What it is for, and its limits

The model was made to compare buildings by their appearance from the street: to find similar buildings and to group them. The paper clusters the embeddings of 946,635 buildings in 221 countries and territories into eleven archetypes.

  • The head was trained on photographs from eight cities in the United States and Europe. The paper applies it worldwide and reports how the resulting typology was checked.
  • The embedding describes the whole photograph, not only the building. In the paper, a linear probe recovers the continent of a photograph from its embedding with balanced accuracy 0.933. An analysis that must not depend on location or scene should control for them.
  • It has not been evaluated for any other use.

Licence

The weights include the DINOv3 backbone. The model is therefore distributed under the DINOv3 License of Meta; LICENSE.md is a copy of that agreement, and its terms apply to any use or redistribution of this model. Among them: redistribution only under the same agreement and with a copy of it, and an acknowledgement of DINOv3 in publications of research that uses it.

The two Python files of this repository, configuration_spatial_embeddings.py and modeling_spatial_embeddings.py, are under the MIT licence (LICENSE-MIT.txt).

This model is built with DINOv3.

How to cite

Olson, A. W. & Saxe, S. A global typology of buildings seen from the street (in preparation, 2026).

Siméoni, O. et al. DINOv3. Preprint at https://arxiv.org/abs/2508.10104 (2025).

Zamir, A. R. et al. Generic 3D representation via pose estimation and matching. In Proc. European Conference on Computer Vision (ECCV 2016) 535–553 (2016).

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

Model tree for alexwaolson/spatial-building-embeddings

Finetuned
(44)
this model

Paper for alexwaolson/spatial-building-embeddings