File size: 1,215 Bytes
e37b7d2
4db9215
 
 
e37b7d2
 
4db9215
e37b7d2
 
4db9215
 
e37b7d2
 
4db9215
 
 
 
 
9e7b0a0
 
 
 
4db9215
 
9e7b0a0
4db9215
 
 
 
 
9e7b0a0
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
title: UNIStainNet - Virtual IHC Staining
emoji: πŸ”¬
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: "6.10.0"
app_file: app.py
pinned: false
license: mit
hardware: cpu-basic
---

# UNIStainNet: Foundation-Model-Guided Virtual Staining

Virtual staining of H&E histopathology images to IHC (HER2, Ki67, ER, PR) using a single unified 42M-parameter SPADE-UNet conditioned on dense spatial tokens from a frozen UNI pathology foundation model.

## Features

- **Gallery** β€” Browse 16 pre-computed examples from BCI and MIST datasets (no GPU needed)
- **Virtual Staining** β€” Upload an H&E image and generate any IHC stain (GPU required)
- **Cross-Stain Comparison** β€” Generate all 4 stains from a single H&E input (GPU required)

## Architecture

| Component | Details |
|-----------|---------|
| Generator | SPADE-UNet with UNI spatial conditioning + FiLM stain embeddings |
| UNI Features | 4x4 sub-crop tiling β†’ UNI ViT-L/16 β†’ 32x32 spatial tokens (1024-dim) |
| Parameters | 42M (generator), UNI frozen (303M) |

## GPU Support

- **Gallery tab** works on CPU (default hardware)
- **Live inference** requires GPU β€” set Space hardware to ZeroGPU (HF Pro) or run locally with `python app.py`