CoolFace
Modelpublic

GleghornLab/lymph_node_segmentation

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes12downloads
Model Card

LNsegmentationsweep

A unet model for multilabel image segmentation trained with sliding window approach.

Model Description

  • Architecture: unet
  • Input Channels: 3
  • Output Classes: 4
  • Base Filters: 128
  • Window Size: 128
  • Downsample Factor: 1.0

Model-Specific Parameters

Training Configuration

ParameterValue
Batch Size8
Learning Rate7.77451918775676e-06
Weight Decay0.00164040349077736
Epochs100
Patience10
DatasetGleghornLab/Semi-AutomatedLNSegmentation1011_2025

Validation Performance Metrics (Pooled Pixel-Level)

MetricMeanClass 0Class 1Class 2Class 3
Dice0.86970.76350.86070.90850.9461
IoU0.77570.61740.75540.83230.8977
F10.86970.76350.86070.90850.9461
MCC0.86490.76360.85880.90320.9340
ROC AUC0.99710.99460.99830.99780.9978
PR AUC0.94120.85270.94940.97200.9908

Test Performance Metrics (Pooled Pixel-Level)

MetricMeanClass 0Class 1Class 2Class 3
Dice0.79600.75780.78300.73440.9087
IoU0.66660.61010.64330.58030.8328
F10.79600.75780.78300.73440.9087
MCC0.79590.76090.78910.74360.8900
ROC AUC0.99420.99490.99750.99030.9941
PR AUC0.91170.86280.91330.89850.9720

Usage

python
import numpy as np
from model import MODEL_REGISTRY, SegmentationConfig

# Load model
config = SegmentationConfig.from_pretrained("aholk/LN_segmentation_sweep")
model = MODEL_REGISTRY["unet"].from_pretrained("aholk/LN_segmentation_sweep")
model.eval()

# Run inference on a full image with sliding window
image = np.random.rand(2048, 2048, 3).astype(np.float32)  # Your image here
probs = model.predict_full_image(
    image,
    dim=128,
    batch_size=16,
    device="cuda"  # or "cpu"
)
# probs shape: (num_classes, H, W) with values in [0, 1]

# Threshold to get binary masks
masks = (probs > 0.5).astype(np.uint8)

Citation

If you use this model, please cite:

bibtex
@software{windowz_segmentation,
  title={Multilabel Image Segmentation with Sliding Window U-Net},
  author={Gleghorn Lab},
  year={2025},
  url={https://github.com/GleghornLab/ComputerVision2}
}