FusionUNet β€” Whole Slide Image (WSI) Tissue Segmentation

FusionUNet is a dual-encoder semantic segmentation model designed for automated tissue foreground segmentation in brightfield histopathology Whole Slide Images (WSIs). The architecture combines DenseNet-121 and MobileNetV2 feature extractors via gated feature fusion modules and concurrent spatial-and-channel Squeeze-and-Excitation (scSE) attention blocks.

Sample Result

image


Model Details

  • Repository: soroush-oskouei/tissue_segmentation
  • Architecture: Dual-encoder U-Net (FusionUNet) with DenseNet-121 + MobileNetV2 backbones, gated multi-scale fusion, and scSE attention in both fusion and decoder stages.
  • Input: RGB histopathology image tiles normalized using checkpoint channel statistics (mean and std), resolution (500 Γ— 500 px).
  • Output: Single-channel logit map converted via sigmoid activation into tissue foreground probabilities ([0, 1]).
  • Checkpoint Contents (best_fusion_unet.pt):
    • model_state: Trained PyTorch state_dict
    • model_kwargs: Architecture hyperparameters (num_classes, fused_ch, dec_ch)
    • img_size: Training tile resolution
    • mean / std: Channel normalization parameters
    • threshold: Optimal validation probability threshold
    • epoch & validation score (val_dice / val_f1)

Quickstart & Usage

1. Clone the Inference Repository & Install Dependencies

git clone [https://github.com/SoroushOskouei/tissue-segmentation.git](https://github.com/SoroushOskouei/tissue-segmentation.git)
cd tissue-segmentation
pip install torch torchvision numpy opencv-python matplotlib tqdm openslide-python openslide-bin huggingface_hub

2. Download Model Weights from Hugging Face

Using the Python API:

from huggingface_hub import hf_hub_download

ckpt_path = hf_hub_download(
    repo_id="soroush-oskouei/tissue_segmentation",
    filename="best_fusion_unet.pt",
    local_dir="weights",
)
print("Downloaded checkpoint to:", ckpt_path)

Or via the Hugging Face CLI:

hf download soroush-oskouei/tissue_segmentation best_fusion_unet.pt --local-dir weights

3. Run Whole Slide Image Inference

python infer.py \
  --wsi path/to/slide.svs \
  --checkpoint weights/best_fusion_unet.pt \
  --out-dir results/

To test the pipeline on a public Aperio sample slide (CMU-1.svs):

python infer.py \
  --download-sample \
  --checkpoint weights/best_fusion_unet.pt \
  --out-dir results/

Generated Outputs

For each input slide, the inference script exports:

  • *_mask.png β€” Post-processed binary tissue mask at target MPP.
  • *_prob.png β€” Blended tissue probability map (0–255).
  • *_overlay.jpg β€” Slide thumbnail with semi-transparent mask overlay and tissue contours.
  • *_tissue.geojson β€” Polygon annotations with hole support in level-0 coordinates (compatible with QuPath).
  • *_summary.png β€” 4-panel visual summary (Thumbnail, Probability, Mask, Overlay).
  • *_info.json β€” Slide metadata, inference settings, runtime, and total tissue area ($\text{mm}^2$).

Training Data & Acknowledgments

The training and validation datasets used to develop these weights were derived from The Cancer Genome Atlas (TCGA) Research Network (https://www.cancer.gov/tcga). We gratefully acknowledge the TCGA consortium, tissue donors, and contributing clinical institutions for making these histopathology whole slide images publicly available.


Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support