Instructions to use aholk/LN_HEV_only_segmentation_sweep with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aholk/LN_HEV_only_segmentation_sweep with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="aholk/LN_HEV_only_segmentation_sweep")# Load model directly from transformers import R2UNetForSegmentation model = R2UNetForSegmentation.from_pretrained("aholk/LN_HEV_only_segmentation_sweep", dtype="auto") - Notebooks
- Google Colab
- Kaggle
LN_HEV_only_segmentation_sweep
A r2unet model for binary image segmentation trained with sliding window approach.
Model Description
- Architecture: r2unet
- Input Channels: 3
- Output Classes: 1
- Base Filters: 32
- Window Size: 128
- Downsample Factor: 1.0
Model-Specific Parameters
- Recurrence (t): 3
Training Configuration
| Parameter | Value |
|---|---|
| Batch Size | 16 |
| Learning Rate | 4.274719008769108e-06 |
| Weight Decay | 8.030299406726313e-05 |
| Epochs | 100 |
| Patience | 10 |
| Dataset | GleghornLab/Semi-Automated_LN_Segmentation_10_11_2025 |
Performance Metrics
| Metric | Mean | Class 0 |
|---|---|---|
| Dice | 0.2140 | 0.2140 |
| IoU | 0.1207 | 0.1207 |
| F1 | 0.2140 | 0.2140 |
| MCC | 0.2953 | 0.2953 |
| ROC AUC | 0.9242 | 0.9242 |
| PR AUC | 0.1705 | 0.1705 |
Usage
import numpy as np
from model import MODEL_REGISTRY, SegmentationConfig
# Load model
config = SegmentationConfig.from_pretrained("aholk/LN_HEV_only_segmentation_sweep")
model = MODEL_REGISTRY["r2unet"].from_pretrained("aholk/LN_HEV_only_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}
}
- Downloads last month
- 40