Image-to-Image
Diffusers
Safetensors
English
virtual-staining
histopathology
multiplex-immunofluorescence
diffusion
research
Instructions to use Hyun-Jic/DiffVS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Hyun-Jic/DiffVS with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Hyun-Jic/DiffVS", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
File size: 5,805 Bytes
c80a05a | 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | ---
license: cc-by-nc-4.0
base_model: stabilityai/stable-diffusion-2
library_name: diffusers
pipeline_tag: image-to-image
tags:
- virtual-staining
- histopathology
- multiplex-immunofluorescence
- diffusion
- research
language:
- en
---
# DiffVS: Virtual Multiplex Staining for Histological Images using a Marker-wise Conditioned Diffusion Model
**AAAI 2026** — Hyun-Jic Oh, Junsik Kim, Zhiyi Shi, Yichen Wu, Yu-An Chen,
Peter K. Sorger, Hanspeter Pfister, Won-Ki Jeong.
Code: [hvcl/DiffVS](https://github.com/hvcl/DiffVS)
DiffVS predicts 16-marker multiplex immunofluorescence (mIF) from H&E histology
tiles with a marker-conditioned diffusion model. This repository contains the
ORION-CRC paper checkpoints for both training stages.
## Checkpoints
```text
orion/stage1/ Marigold-style paired latent diffusion (30,000 iterations)
unet/config.json
unet/diffusion_pytorch_model.safetensors
markers.json
conditioning.json
orion/stage2/ Diffusion-FT, one-step inference, initialized from stage1
unet/config.json
unet/diffusion_pytorch_model.safetensors
markers.json
conditioning.json
MANIFEST.json file sizes and SHA256
LICENSE
```
HEMIT checkpoints are not included in this release.
### Conditioning
The UNets use `class_embed_type="projection"` with a 16-dimensional one-hot
marker vector (`class_labels`). Marker order (`markers.json`):
```text
0 Hoechst, 1 CD31, 2 CD45, 3 CD68, 4 CD4, 5 FOXP3, 6 CD8a, 7 CD45RO,
8 CD20, 9 PD-L1, 10 CD3e, 11 CD163, 12 E-cadherin, 13 Ki67, 14 Pan-CK, 15 SMA
```
Cross-attention receives the Stable Diffusion 2 text encoding of the empty string.
The H&E latent (VAE posterior mean × 0.18215) is concatenated before the target
latent. Stage 1 samples with 50 DDIM steps from Gaussian noise; Stage 2 predicts
in one step at timestep 999 from a zero target latent (v-prediction).
## Usage
Install the [DiffVS code](https://github.com/hvcl/DiffVS) and its requirements,
then run from the code repository:
```bash
# Stage 2 (one step)
PYTHONPATH=src python -m diffvs.infer_diffusion_ft \
--dataset orion --dataset-root /path/to/ORIONCRC_dataset_tile_20x \
--checkpoint-dir hf://Hyun-Jic/DiffVS/orion/stage2 \
--pretrained-model Manojb/stable-diffusion-2-base \
--output-dir ./outputs/orion_stage2 --max-rows 8
# Stage 1 (50-step DDIM)
PYTHONPATH=src python -m diffvs.infer_marigold \
--dataset orion --dataset-root /path/to/ORIONCRC_dataset_tile_20x \
--checkpoint-dir hf://Hyun-Jic/DiffVS/orion/stage1 \
--pretrained-model Manojb/stable-diffusion-2-base \
--output-dir ./outputs/orion_stage1 --max-rows 2 --num-inference-steps 50
```
`--markers CD3e Pan-CK` selects a subset of markers; `--max-rows -1` processes
the whole split. A local stage folder can be passed to `--checkpoint-dir`.
The base VAE, tokenizer, text encoder and scheduler are loaded from a Stable
Diffusion 2 repository and are not redistributed here. The original
`stabilityai/stable-diffusion-2` repository may be unavailable; the checkpoints
were verified with `Manojb/stable-diffusion-2-base` (revision
`64bf7b4f10eee35494b38d55c06c0c78cf8b44d0`) and the v-prediction settings in
`conditioning.json`. Stage-2 outputs matched the original predictions on ORION
test tiles (mean absolute difference 1.3e-5, Pearson ≥ 0.9996 for every marker).
## Input and output
- **Input:** RGB H&E at 20×. The 512-pixel ORION tile is center-cropped to
256 pixels without resizing and normalized as `(RGB − 127.5) / 127.5`.
- **Output:** `16 × 256 × 256` float32 TIFF in [0, 1], ordered as in
`markers.json` (PD-1 is not predicted). Each marker image is the RGB average of
the decoded latent, clipped to [−1, 1] and mapped to [0, 1]. Values are
processed mIF intensities, not raw fluorescence measurements.
## Training data
ORION-CRC as processed for MIPHEI-ViT (20×, 16 markers), with slide-level splits:
295,096 training tiles (37 slides), 12,402 validation tiles (2 slides) and
10,952 test tiles (2 slides).
## Evaluation
On the ORION test split, Stage 2 reaches macro cell-level AUPRC **0.372**,
ROC AUC **0.806**, balanced accuracy **0.736** and F1 **0.371**
(MIPHEI-style logistic-regression probe on cell features, 256-pixel center crop,
no minimum cell area).
## Limitations
- Trained on a single cohort (ORION-CRC, colorectal cancer). Performance on other
institutions, stains, scanners, organs or magnifications is not guaranteed.
- For research use only. Not validated for clinical diagnosis or treatment
decisions.
## License
The DiffVS checkpoints and code are released under
[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) (noncommercial use,
with attribution). The Stable Diffusion 2 base model remains subject to the
[CreativeML Open RAIL++-M](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
license, including its use restrictions; the DiffVS license does not replace those
terms. Dataset access and redistribution are governed by the
[ORION data provider](https://github.com/labsyspharm/orion-crc/blob/main/datarelease-README.md).
No dataset images or base model components are included.
## Citation
```bibtex
@inproceedings{oh2026virtual,
title={Virtual multiplex staining for histological images using a marker-wise conditioned diffusion model},
author={Oh, Hyun-Jic and Kim, Junsik and Shi, Zhiyi and Wu, Yichen and Chen, Yu-An and Sorger, Peter K and Pfister, Hanspeter and Jeong, Won-Ki},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={40},
number={10},
pages={8168--8176},
year={2026}
}
```
Please also cite [Marigold](https://github.com/prs-eth/Marigold) and
[diffusion-e2e-ft](https://github.com/VisualComputingInstitute/diffusion-e2e-ft),
which this work builds on, and the ORION-CRC dataset.
|