Seminiferous Tubule Segmentation β€” Coarse-to-Fine Model (v20b)

Model Description

A coarse-to-fine dual-branch architecture for 3-class semantic segmentation of mouse seminiferous tubules in H&E-stained histology images.

Classes: Background (0) | Seminiferous Epithelium (1) | Lumen (2)

Architecture

Branch Encoder Input Purpose
Coarse ResNet34 Full image 512Γ—512 Identifies the main tubule region
Fine EfficientNet-B4 Native patch 256Γ—256 + coarse mask Precise border delineation

The coarse branch provides a soft probability mask that guides the fine branch, ensuring predictions stay within the tubule region. A border detection auxiliary head improves boundary precision.

Total parameters: 47.3M

Training

  • Loss: Dice + Cross-Entropy (nnU-Net formulation)
  • Optimizer: AdamW with differential learning rates (GLNet principle)
  • Schedule: CosineAnnealingWarmRestarts
  • Augmentation: Kornia GPU (elastic deform, color jitter, Gaussian noise)
  • Coarse caching: Re-computed every 5 epochs for speed
  • Dataset: ~3900 patches from 431 images (85/15 train/val split)
  • Trained from scratch (ImageNet pretrained encoders only)

Usage

import torch
from model import CoarseToFineModel

model = CoarseToFineModel()
ckpt = torch.load('best_model_v20b.pt', map_location='cpu')
model.load_state_dict(ckpt['model_state_dict'])
model.eval()

# See inference.py for full sliding-window inference pipeline

Inference

The model uses a sliding window approach:

  1. Coarse branch processes the full image once β†’ tubule probability map
  2. 256Γ—256 patches slide across the image at stride=128
  3. Each patch receives the coarse probability as a 4th input channel
  4. Gaussian-weighted blending of overlapping predictions
  5. Post-processing: largest connected component for epithelium

Scale: 0.32 ΞΌm/pixel β†’ areas reported in ΞΌmΒ²

Results

Metric Value
Validation mIoU TBD (training in progress)
Epithelium IoU TBD
Lumen IoU TBD
Test images OK TBD/51

Hardware

Trained on NVIDIA GTX 1660 Ti (6GB VRAM), AMD Ryzen 5 5600X, 16GB RAM.

Files

β”œβ”€β”€ best_model_v20b.pt       # Model checkpoint
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ model.py             # Model architecture
β”‚   β”œβ”€β”€ dataset.py           # Data loading + patch extraction
β”‚   β”œβ”€β”€ losses.py            # Dice + CE loss functions
β”‚   β”œβ”€β”€ augmentation.py      # Kornia GPU augmentation
β”‚   └── utils.py             # Mask extraction utilities
β”œβ”€β”€ train.py                 # Training script
β”œβ”€β”€ inference.py             # Sliding window inference
└── evaluate.py              # Test set evaluation

Citation

@software{seminiferous_segmentation_2025,
  title={Coarse-to-Fine Segmentation of Seminiferous Tubules},
  author={Lucila Gotfryd},
  year={2025},
  url={https://huggingface.co/LuGot16/seminiferous-tubule-segmentation}
}

License

Apache-2.0

Generated by ML Intern

This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train LuGot16/seminiferous-tubule-segmentation