NAFNet β HEMIT benchmark adaptation
Selected prediction weights trained by the Virtual Staining Benchmark on HEMIT. Input is RGB H&E; output is three independent numerical fluorescence intensity channels in DAPI, CD3, panCK order. This release contains the selected FP32 inference weights and a self-contained loader. No pretrained foundation network is needed for inference.
NAFNet width 32, encoder depths [1, 1, 1, 28], middle depth 1 and decoder depths [1, 1, 1, 1]. Cross-modality adaptation omits the image-level residual addition; marker gating and sigmoid output are disabled.
This is a disclosed benchmark adaptation of the published architecture, not an
author checkpoint or a reproduction of the paper's training setting or scores.
See the benchmark, training_summary.json, and release_evidence.json.
Use
Install the download client with python -m pip install huggingface_hub,
then download the release files:
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="thomasdekerf/nafnet-hemit",
local_dir="nafnet-hemit",
)
Enter the downloaded directory with cd nafnet-hemit, then run:
python -m pip install -r requirements.txt
python predict.py --input he_image.png --output prediction.npy --preview preview.png
For GPU inference append --device cuda. The default uses CPU. The input must be
stored uint8 RGB and at least 256Γ256 native pixels. The loader takes a fixed
center 256 crop, divides by 255, and never resizes or fits stain normalization.
Physical pixel size is not asserted. Predictions outside the released dataset
or native sampling require separate validation.
prediction.npy is an HWC float32 array in DAPI/CD3/panCK order, clamped to [0, 1]
exactly as in benchmark evaluation. prediction.raw.npy preserves the unclamped
model forward output. prediction.json records channel order and crop coordinates.
The optional preview is three grayscale intensity panels using a fixed [0, 1]
display range; the numerical stack is not an RGB tissue image.
Python loading after downloading the files:
from inference import load_model, load_rgb_center_crop, predict_tensor
model = load_model(device="cpu")
rgb, crop = load_rgb_center_crop("he_image.png")
raw_nchw = predict_tensor(model, rgb)
benchmark_nchw = raw_nchw.clamp(0, 1)
Training and evaluation
- Seed 42; train 3,717, validation 630 and test 945 author fields.
- Splits are disjoint by released author field identity. Patient/whole-slide mappings are unavailable, so independent patient-level disjointness is not certified.
- Native 256 random training crops; fixed center 256 held-out crops; no resizing.
- Training reached 96,000 optimizer updates, protecting the 80,000-update benchmark reference horizon and then observing 8 fresh full-validation checks without improvement.
- Selected checkpoint: update 28,000; minimum full-validation LPIPS. TEST did not select weights.
- Four-GPU native update/resume gate and native adequacy were verified.
Full test split (945 fields), from the original selected-checkpoint evaluation:
| Metric | Value |
|---|---|
| Numerical mIF PSNR | 29.548254 |
| Numerical mIF 11Γ11 box SSIM | 0.854607 |
| LPIPS on normalized intensity stack | 0.201648 |
| Numerical mIF MAE | 0.018421 |
Full validation, test and per-channel values are in evaluation.json. LPIPS is
an operational image-feature distance on the normalized three-channel stack,
not a validated biological or clinical stain score. Intensities use the released
uint8 / 255 codec, without physical fluorescence calibration.
Channel convention and provenance
Output channels are already in the benchmark's canonical DAPI/CD3/panCK order;
do not permute the model output. Ingestion converted the original raw TIFF
panCK/CD3/DAPI storage order using indices [2, 1, 0]. This numerical mapping is
documented in retained decoder/probe, named channel statistics and ingestion QC;
it is separate from the display colour or marker listing in a dataset README.
See release_evidence.json for source hashes and references.
Scope and license
For research image translation. This model has no established diagnostic or
clinical grading use. Dataset source, author attribution and terms appear in
THIRD_PARTY_NOTICES.md; code terms are retained in LICENSE and
UPSTREAM_NOTICE.md. No source tissue images are included in this repository.
HEMIT: Chang Bian, Beth Phillips, Tim Cootes and Martin Fergie (2024), Mendeley Data, version 1, DOI 10.17632/3gx53zm49d.1, CC BY 4.0. Original architecture: Simple Baselines for Image Restoration, https://arxiv.org/abs/2204.04676.
- Downloads last month
- -