← All research

Research · 01

Stanford Medicine

Research Intern · Curtis LabJan 2025 — Aug 2025

Trained an AI model to predict which proteins are present in tissue, using only the standard stained slide images pathologists already have.

64proteins predicted per cell
280Kcell nuclei mapped across the Madrid cohort
63%of comparisons significant for the 5 best-predicted proteins
65Kcell graphs used to train the GNN
Role
Research Intern
When
Jan 2025 — Aug 2025
Lab
Curtis Lab, Stanford Medicine
Worked with
Brennan Simon
Method
Graph neural network (GCN) over cell graphs
Input
H&E-stained whole-slide images
Target
CosMx spatial proteomics (64 proteins)
Models
HoverNet · UNI · DINO · GCN
Presented
August 19, 2025

01In short

Almost every tissue sample in a hospital gets stained pink and purple ("H&E") and photographed — it's cheap and routine. Measuring exactly which proteins are present, and where, takes a separate, much more expensive test called spatial proteomics.

My project asked: can a computer predict the expensive result from the cheap image? I treated each cell in the slide as a point in a network, connected it to its neighbours, and trained a graph neural network to predict the expression of 64 proteins in every cell.

I built this with Brennan Simon in the Curtis Lab and presented it in August 2025 as "Hematoxylin & Eosin (H&E) to Spatial Proteomics GNN." Everything below comes from that presentation.

02What I did

  • Developed a graph convolutional network (GCN) that predicts spatial protein expression from H&E-stained whole-slide images.
  • Combined three kinds of information about each cell: its predicted cell type, its position, and which cells it touches.
  • Predicted the expression of all 64 CosMx proteins in every cell.
  • For the 5 best-predicted proteins, achieved statistically significant agreement with the real measurements in 63% of evaluated comparisons, showing that molecular information can be inferred from ordinary histology.

03Two ways to look at tissue

H&E staining is the clinical gold standard. It stains cell nuclei purple (hematoxylin) and the cytoplasm and surrounding tissue pink (eosin). It's cheap, fast, follows a standardized protocol, and is performed on every clinical biopsy. The catch is that it carries only low-level information.

Spatial proteomics (here, the CosMx platform) measures dozens of proteins inside every single cell, at 40–64 targets at a time. It's extraordinarily detailed, but very expensive and slow. It covers a limited field of view and needs samples stored in particular ways.

Diagram of a cell: a dark purple nucleus labelled hematoxylin inside pink cytoplasm labelled eosin
How H&E stains a cell: hematoxylin turns the nucleus purple; eosin turns the cytoplasm and surrounding matrix pink.
Diagram of a cylindrical tissue core 1.5 mm across, sliced into 5 micrometre sections
Both methods start from the same kind of sample: a tissue core about 1.5 mm across, sliced into 5 µm sections.
A whole-slide H&E image: purple clusters of cells surrounded by pink tissue
H&E whole-slide image. Figure: B. Simon
A spatial proteomics image with cells coloured blue, orange, green and magenta by protein
CosMx spatial proteomics. Figure: B. Simon
H&E stain64-plex CosMx1000-plex CosMx
Cost per slide$1–6$3,880$5,996

04Why this project exists

Close the gap between the two: CosMx-level molecular insight at H&E prices. A deep learning model takes the cheap H&E image in and predicts the expensive spatial proteomics picture out.

An H&E whole-slide image, an arrow labelled Deep Learning Model, and the corresponding spatial proteomics image
The goal of the project: H&E in, spatial proteomics out.
Diagram: H&E at $1–6 per slide, a gap, and CosMx at $4K–6K per slide; the goal is CosMx-level insight at H&E prices
Why build this: the cost gap between H&E and CosMx.

Clinical

Predict cell types and cell activity efficiently from data hospitals already collect, to help doctors make better diagnostic and treatment decisions.

Research

Impute complex spatial information from cheap, plentiful existing data, transforming what current spatial "omics studies can do and opening the door to new discoveries.

05The data

We used the Madrid cohort: six whole-slide images of tissue microarrays (TMAs), each with H&E and overlaid CosMx spatial proteomic data from the same tissue.

  • 280,307nuclei detected in H&E
  • 220,200cells measured by CosMx
  • 16,616fields of view shared by both

Nuclei by cell type: fibroblast 104,964 · cancer 94,544 · immune 61,988 · normal epithelial 9,070 · necrotic 6,972 · unlabelled 2,769.

A tissue microarray slide: a grid of round, pink-and-purple stained tissue cores
Madrid TMA 3: each circle is a tissue core.
Scatter plot overlaying H&E nuclei and CosMx cells on a grid of fields of view
Nuclei and CosMx cells aligned on a shared grid.

06From slide to graph

The core idea is to represent tissue as a graph. Each cell is a node, and edges connect cells that sit next to each other. The same graph is built twice over the same patch of tissue: once from H&E (the input) and once from spatial proteomics (the answer the model learns to predict).

Diagram: an H&E slide is cut into 256×256 tiles; H&E tiles and the overlapping spatial proteomics both become graphs of cells; the model maps the input graph to an output graph of 64 protein expressions
Input graph: foundation-model tile features, plus each cell's type (predicted from H&E) and coordinates. Output graph: each cell's expression of 64 proteins.

Building those graphs took a pipeline of several models:

  • HoverNet finds every nucleus in the H&E slide and outputs its ID, centroid (x, y), and cell type. It's a CNN built for nucleus segmentation and classification that accurately separates nuclei in dense tissue, labels each one (epithelial, lymphocyte, stromal, and so on), and is widely benchmarked on the PanNuke and CoNSeP datasets.
  • DINO, a self-supervised model we trained ourselves, turns each nucleus into a 192-dimensional feature embedding.
  • An FOV generator cuts the slide into 256×256-pixel tiles (fields of view).
  • UNI, a self-supervised foundation model trained on millions of histology images, turns each tile into a 1,536-dimensional embedding that captures morphology, texture and tissue context, and generalizes across stains and tissue types.
  • CosMx supplies the target: 64-dimensional protein expression for every cell.
Pipeline diagram: HoverNet produces cell IDs, centroids and types; DINO produces 192-D nucleus embeddings; the FOV generator creates tiles that UNI turns into 1536-D embeddings; CosMx provides 64-D protein expression; all feed into the graph
The full graph data setup.

07Generating fields of view

The FOV grid is calculated as 256×256-pixel squares from the top-left of each whole-slide image to the bottom-right. It serves three purposes: it's the unit for extracting UNI features, it's how per-FOV graphs are constructed, and it keeps spatial relationships manageable across a huge slide. It also puts a smaller load on the GPU when training the GNN.

Two plots: H&E nuclei on an FOV grid (280,307 points, 19,784 FOVs) and CosMx cells on an FOV grid (220,200 points, 18,674 FOVs)
Nuclei (19,784 FOVs) and CosMx cells (18,674 FOVs) on the same grid.

08Teaching a model what nuclei look like

To describe each nucleus, we trained DINO, a self-supervised vision transformer from Facebook AI Research, on 1.7 million nuclei from the Madrid cohort. It produces a 192-dimensional embedding of each nucleus's features.

  • A student and a teacher network, both vision transformers; the teacher is an exponential moving average (EMA) of the student.
  • Multi-crop training: 2 global views (224 px) plus K local views (92 px) of each image.
  • Loss: cross-entropy between the student's and teacher's outputs.
  • Kept stable with the EMA update, centering, and temperature scaling.
  • The result: view-invariant, transferable embeddings.
A row of five H&E nucleus patches used for training
Nucleus patches from Madrid TMA 3, matched by cell ID.

Without ever being told what cell types are, the trained model separates them. Plotting the embeddings (PCA), cancer, immune and fibroblast cells fall into distinct regions.

PCA scatter plot of DINO embeddings coloured by cell type: red cancer cells on the left, blue immune cells on the right, green fibroblasts spread throughout
PCA of DINO embeddings by cell type (Madrid TMA 3).
PCA plot with cancer cells highlighted in red
Cancer
PCA plot with immune cells highlighted in blue
Immune
PCA plot with fibroblasts highlighted in green
Fibroblast
PCA plot with normal epithelial cells highlighted in cyan
Normal epithelial
PCA plot with necrotic cells highlighted in yellow
Necrotic
PCA plot with unlabelled cells highlighted in magenta
No label

09Inside the graph

Inputs

  • H&E nucleus features: morphology, cell type, x/y position.
  • Spatial proteomics: 64 proteins per cell.
  • UNI embeddings: a 1,536-dim representation of each FOV.

Sliding windows

  • Groups 2×2 FOVs into one window, with a stride of 1.
  • Each window must meet requirements: at least 20 cells, exactly 4 FOVs, and spatial proteomics mapping present.

Nodes

  • Cell nodes: nuclei with H&E features, mapped to their proteins where available.
  • Hypernodes: one per FOV carrying its UNI embedding, connected to all of that FOV's cells.

Edges

  • Intra-FOV: connect neighbouring cells within 60 µm.
  • Inter-FOV: connect cells across FOV boundaries.
  • Hypernode edges: connect each UNI hypernode to its cells.
Network plot of one window: four square hypernodes, each connected by green edges to the surrounding cells, with red edges crossing between fields of view
One 2×2 window: square hypernodes link to their cells; red edges cross FOV boundaries.

10The model

x (1,733) + cell-type embedding (32)→ Linear → H
GCNConv + BatchNorm + ReLU + Dropoutrepeated L times
concat(H, cell-type embedding)→ MLP → 64 proteins

h′i = σ ( W · Σj ∈ 𝒩(i) hj / √(di dj) )

Each GCN layer updates a cell by averaging its neighbours' features, weighted by how connected each cell is (d = node degree).

  • Cell-type embedding: nn.Embedding(num_cell_types, 32)
  • Input projection: Linear(input_dim + 32 → hidden_dim) + ReLU + Dropout
  • GCN backbone: num_layers × [GCNConv(H, H) → BatchNorm1d(H) → ReLU → Dropout]
  • Prediction head: concat(final H, cell_type_emb) → MLP → 64 outputs
  • Loss: MSE · Optimizer: AdamW · LR scheduler: ReduceLROnPlateau

11Training

  • 65,000graphs for training
  • 10,000held out for validation
  • 6 hrsper epoch
  • 2epochs in total

12Results, for now

After two epochs, the results split in two.

Five proteins came through. For the 5 best-predicted proteins, the model's predictions agreed with the measured CosMx expression with statistical significance in 63% of evaluated comparisons. That's the core evidence that molecular information can be read from ordinary H&E histology.

Most of the other proteins are still poorly predicted. Across the full panel of 64, the correlation between predicted and measured expression mostly sits between about 0.05 and 0.2, and 15 proteins came out negative.

That's a starting point rather than a failure. The pipeline works end to end, the DINO embeddings clearly capture biology, five proteins already show real signal, and the results show exactly where to push next.

13Next steps

  • Retraining with a higher batch size.
  • Extended training: more epochs, plus hyperparameter sweeps over learning rate, dropout and loss functions.
  • Feature extraction: replace or augment DINO with a chopped HoverNet, to get more H&E nuclei for training.
  • Graph construction: try different edge definitions: k-nearest neighbours, radius, and distance-weighted edges.
Next — ResearchBioCurious
→