2025

From Pixels to Place

Mapping architectural similarity across time and culture.

Code repository

  • CLIP
  • UMAP
  • HDBSCAN
  • Representation learning
  • Architectural history

Where it came from

I was taking architecture history classes as a hobby during my Computer Engineering degree. I learned a lot of eras and styles theoretically and I could identify buildings, place them in their period. But like most people, I was using context: colours, ornamentation, geography, the name of the architect. I was judging correctly, but not geometrically.

That made me wonder: if I stripped all of that away and judged buildings on pure visual and geometric similarity, would I get the same groupings? Or would some buildings from completely different eras and geographies share a deeper structural DNA — correctly classified as different styles, but visually closer to each other than to their own kind?

I also wondered about proximity between related styles. How close are Byzantine and Romanesque? How much does American Craftsman overlap with Foursquare? These are styles that historians already know are related — but how does that relationship look in an embedding space?

What I expected

I expected to find strange connections. A building from antiquity sharing a visual fingerprint with something from 1980. Cross-era, cross-geography outliers that would reveal some hidden geometry underlying all of architecture.

That happened — but rarely, and not in the generalizable way I had imagined. It was specific buildings that drifted outside their cluster, not entire styles bleeding into each other. I did not find a clean unexpected kinship between two distant styles.

What I did find was how tightly related styles cluster when they share geography or period. And once I had that, I wanted to push further: do sub-traditions exist inside a single style? Does Gothic fragment into regional schools? Does Egyptian split by type of monument? That became its own investigation.

The data

I used the ECCV2014 Architectural Styles dataset, available on Kaggle. It covers 25 styles with around 60 images per style, 1,472 in total after quality filtering.

Contact sheet of sample images drawn from each of the 25 architectural styles in the dataset.
Stratified sample, five images per style. The spot-check exists to catch mislabelled and unreadable files before embedding — worth doing, since it also reveals how consistent the photographic conventions are within each category.

How I measured it

Each image was encoded with CLIP ViT-L/14 into a 768-dimensional vector — a compact description of what the building looks like, learned from hundreds of millions of image-text pairs. I projected all 1,472 vectors to 2D with UMAP to get a navigable latent space, then ran HDBSCAN to find clusters. To look inside each style, I repeated the clustering on each style’s own embedding subspace after a PCA compression step, which surfaces sub-traditions that the global clustering would otherwise smooth over.

UMAP scatter plot of 1,472 building images coloured by architectural style, showing separated regions for ancient, medieval sacred, domestic vernacular, and modern styles.
UMAP projection of CLIP embeddings, coloured by labelled style. Egyptian and Achaemenid sit isolated on the right; Russian Orthodox forms a tight island at the top; the American domestic styles collapse into a single mass at the bottom centre.
Heatmap of cosine similarity between the CLIP centroids of all 25 architectural styles.
Cosine similarity between per-style CLIP centroids. The bright block in the American and British domestic styles is the collapse described above; Egyptian's nearest neighbour is Achaemenid at 0.83, its furthest are Chicago School and American Foursquare at 0.50.

What I found

The global UMAP makes some things immediately clear. American residential styles — Craftsman, Foursquare, Queen Anne, Tudor Revival — collapse into a single dense region. The model sees them as one visual family, which matches how closely they developed together in the same place and period. Egyptian and Achaemenid sit alone, far from everything else. Gothic and Romanesque are neighbours; so are Baroque and Byzantine. The model has, without being told any history, approximately reconstructed the map that architectural historians already use.

The cosine similarity matrix puts numbers on this. The three closest pairs are American Craftsman and American Foursquare (0.98), International and Postmodern (0.95), and American Foursquare and Queen Anne (0.95). The most isolated styles are Egyptian, Achaemenid, and Novelty — the last of which is almost definitionally unclassifiable.

The within-style subclustering is where it gets more interesting. 23 of the 25 styles fragment when you cluster inside their own embedding space. Only Chicago School and Queen Anne appear visually uniform. Gothic splits into two groups that visually correspond to lighter-stone French and Belgian cathedral facades versus darker English perpendicular and collegiate Gothic. Egyptian produces three distinct sub-clusters: pyramid and open landscape sites, temple facade reliefs, and statuary. Baroque fragments by region — Venetian church facades, Central European ornate towers, and Ibero-American Churrigueresque.

These are not labelled anywhere in the dataset. The model found them on its own.

Dendrogram of the 25 architectural styles, splitting first into sacred versus secular, then into domestic and modern branches.
Ward linkage over centroid cosine distances. The first split separates ancient and medieval sacred architecture from everything else; the second separates domestic and revival styles from the modern movement.
Small multiple scatter plots showing within-style sub-clustering for each of the 25 architectural styles.
Within-style sub-clustering. Most styles split; the interesting question is what the splits correspond to.
Two rows of Egyptian architecture thumbnails, showing the images assigned to each within-style sub-cluster.
Egyptian sub-clusters, shown as the actual images. Inspecting the members is the only honest way to decide whether a split is meaningful or an artefact of photographic framing.

Tech stack

Python · CLIP ViT-L/14 (open_clip_torch, LAION-2B) · UMAP · HDBSCAN · scikit-learn · NumPy · pandas · Matplotlib · Google Colab

Code repository

← All projects