How to use from the
Use from the
Diffusers library
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]

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

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

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):

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 and its requirements, then run from the code repository:

# 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 (noncommercial use, with attribution). The Stable Diffusion 2 base model remains subject to the CreativeML Open RAIL++-M license, including its use restrictions; the DiffVS license does not replace those terms. Dataset access and redistribution are governed by the ORION data provider. No dataset images or base model components are included.

Citation

@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 and diffusion-e2e-ft, which this work builds on, and the ORION-CRC dataset.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Hyun-Jic/DiffVS

Finetuned
(189)
this model