Skip to content
ModelListedExternal
Download

LN Segmentation

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

KindOtherVersionRevision 147e747

Model source

Kind
Other
File size
132 MB
Version
vRevision 147e747
Updated
Sep 27, 2026
Downloads
9
Tasks
Image segmentation
Source
Hugging Face

Source description

LN_segmentation

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

Model Description

  • Architecture: unet
  • Input Channels: 3
  • Output Classes: 4
  • Base Filters: 32
  • Window Size: 256

Model-Specific Parameters

Training Configuration

ParameterValue
Batch Size64
Learning Rate0.0003
Weight Decay0.01
Epochs100
Patience10
DatasetGleghornLab/Semi-Automated_LN_Segmentation_10_11_2025

Performance Metrics

MetricMeanClass 0Class 1Class 2Class 3
Dice0.51960.18000.29780.71890.8819
IoU0.40590.09890.17490.56120.7887
F10.51960.18000.29780.71890.8819
MCC0.50440.17300.28610.70320.8554
ROC AUC0.83380.64820.77720.92520.9847
PR AUC0.48460.07670.18070.75830.9227

Usage

import numpy as np
from model import MODEL_REGISTRY, SegmentationConfig

# Load model
config = SegmentationConfig.from_pretrained("aholk/LN_segmentation")
model = MODEL_REGISTRY["unet"].from_pretrained("aholk/LN_segmentation")
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=256,
    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)

Training Plots

Training Loss Dice Curves MCC Curves Best Validation

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 147e747c15995496db6dd6e8e0258ac0c1eee0f8
huggingface.co/aholk/LN_segmentation/tree/147e747c15995496db6dd6e8e0258ac0c1eee0f8

Verified Sep 27

Model artifacts

1 artifact

model.safetensors

safetensors · 132 MB · SHA-256 64c71e8d3366…3432 · Hugging Face

Download

Source excerpts

2 excerpts

--- license: mit tags: - image-segmentation - multilabel - unet - pytorch - medical-imaging library_name: transformers pipeline_tag: image-segmentation --- # LN_segmentation A unet model for multilabel image segmentation trained with sliding window approach. ## Model Description - **Architecture:** unet - **Input Channels:** 3 - **Output Classes:** 4 - **Base Filters:** 32 - **Window Size:** 256 ### Model-Specific Parameters ## Training Configuration | Parameter | Value | |-----------|-------| | Batch Size | 64 | | Learning Rate | 0.0003 | | Weight Decay | 0.01 | | 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.5196 | 0.1800 | 0.2978 | 0.7189 | 0.8819 | | IoU | 0.4059 | 0.0989 | 0.1749 | 0.5612 | 0.7887 | | F1 | 0.5196 | 0.1800 | 0.2978 | 0.7189 | 0.8819 | | MCC | 0.5044 | 0.1730 | 0.2861 | 0.7032 | 0.8554 | | ROC AUC | 0.8338 | 0.6482 | 0.7772 | 0.9252 | 0.9847 | | PR AUC | 0.4846 | 0.0767 | 0.1807 | 0.7583 | 0.9227 | ## Usage ```python import numpy as np from model import MODEL_REGISTRY, SegmentationConfig # Load model config = SegmentationConfig.from_pretrained("aholk/LN_segmentation") model = MODEL_REGISTRY["unet"].from_pretrained("aholk/LN_segmentation") 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=256, 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) ``` ## Training Plots ![Training Loss](training_loss.png) ![Dice Curves](dice_curves.png) ![MCC Curves](mcc_curves.png) ![Best Validation](best_validation_reconstruction.png) ## 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: 9 downloads · 0 likes · Pipeline image-segmentation · Library transformers · Repo aholk/LN_segmentation