unet
A unet model for multilabel image segmentation trained with sliding window approach.
Model Description
- Architecture: unet
- Input Channels: 3
- Output Classes: 4
- Base Filters: 64
- Window Size: 128
Model-Specific Parameters
Training Configuration
| Parameter | Value |
|---|---|
| Batch Size | 104 |
| Learning Rate | 0.00022024066149191473 |
| Weight Decay | 0.0014536273060551214 |
| 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.6978 | 0.7433 | 0.3599 | 0.7710 | 0.9169 |
| IoU | 0.5900 | 0.5943 | 0.2820 | 0.6335 | 0.8501 |
| F1 | 0.6978 | 0.7433 | 0.3599 | 0.7710 | 0.9169 |
| MCC | 0.6939 | 0.7503 | 0.3571 | 0.7684 | 0.8997 |
| ROC AUC | 0.9258 | 0.9963 | 0.7273 | 0.9858 | 0.9937 |
| PR AUC | 0.7667 | 0.8455 | 0.4107 | 0.8457 | 0.9649 |
Usage
import numpy as np
from model import MODEL_REGISTRY, SegmentationConfig
# Load model
config = SegmentationConfig.from_pretrained("lhallee/unet")
model = MODEL_REGISTRY["unet"].from_pretrained("lhallee/unet")
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)
Training Plots
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}
}
- Downloads last month
- 40



