Skip to content
ModelListedExternal
Download

LN Segmentation Sweep

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

KindOtherVersionRevision 5df86f8Cgrade

Model source

Kind
Other
File size
2.06 GB
Version
vRevision 5df86f8
Updated
Sep 16, 2026
Downloads
13
Source
Hugging Face

Source description

LN_segmentation_sweep

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-Automated_LN_Segmentation_10_11_2025

Performance Metrics

MetricMeanClass 0Class 1Class 2Class 3
Dice0.77810.71970.76140.72710.9040
IoU0.65240.57080.61990.59290.8261
F10.77810.71970.76140.72710.9040
MCC0.78320.73080.77300.74400.8850
ROC AUC0.99450.99450.99750.99170.9943
PR AUC0.90760.83570.91080.90950.9743

Usage

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:

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

Sources

1 source
Hugging FacePrimaryVersion 5df86f86774edd7ad3e9a75efc0e645d9f0228ea
huggingface.co/aholk/LN_segmentation_sweep/tree/5df86f86774edd7ad3e9a75efc0e645d9f0228ea

Verified Sep 1

Model artifacts

1 artifact

model.safetensors

safetensors · 2.06 GB · SHA-256 16649a1d727d…81d1 · Hugging Face

Download file

Source excerpts

2 excerpts

--- license: mit tags: - image-segmentation - multilabel - unet - pytorch - medical-imaging library_name: transformers pipeline_tag: image-segmentation --- # LN_segmentation_sweep 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 | Parameter | Value | |-----------|-------| | Batch Size | 8 | | Learning Rate | 7.77451918775676e-06 | | Weight Decay | 0.00164040349077736 | | Epochs | 100 | | Patience | 10 | | Dataset | GleghornLab/Semi-Automated_LN_Segmentation_10_11_2025 | ## Performance Metrics | Metric | Mean | Class 0 | Class 1 | Class 2 | Class 3 | |--------|------|--------|--------|--------|--------| | Dice | 0.7781 | 0.7197 | 0.7614 | 0.7271 | 0.9040 | | IoU | 0.6524 | 0.5708 | 0.6199 | 0.5929 | 0.8261 | | F1 | 0.7781 | 0.7197 | 0.7614 | 0.7271 | 0.9040 | | MCC | 0.7832 | 0.7308 | 0.7730 | 0.7440 | 0.8850 | | ROC AUC | 0.9945 | 0.9945 | 0.9975 | 0.9917 | 0.9943 | | PR AUC | 0.9076 | 0.8357 | 0.9108 | 0.9095 | 0.9743 | ## 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} } ```

Source context: 13 downloads · 0 likes · Pipeline image-segmentation · Library transformers · Repo aholk/LN_segmentation_sweep