TPATH Glomeruli Detection - YOLOv8 Model
Automated detection and classification of glomeruli in renal pathology whole slide images.
RESEARCH USE ONLY - This model is intended for research purposes only and has not been validated for clinical diagnostic use.
Model Description
- Model Type: YOLOv8 Object Detection
- Input Size: 1024ร1024 pixels
- Classes: 2 (normal glomeruli, sclerotic glomeruli)
- Framework: Ultralytics YOLOv8
Quick Start
Installation
pip install ultralytics huggingface_hub
Download Model
# Using Hugging Face CLI
hf download shuheimisawa/tpath-glomeruli-v1 best.pt --local-dir ./models/
# Or using Python
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(repo_id="shuheimisawa/tpath-glomeruli-v1", filename="best.pt")
Basic Usage
from ultralytics import YOLO
# Load model
model = YOLO("models/best.pt")
# Run inference on an image
results = model("path/to/kidney_tissue.png", conf=0.20)
# Process results
for result in results:
boxes = result.boxes
for box in boxes:
class_id = int(box.cls[0])
confidence = float(box.conf[0])
class_name = "normal" if class_id == 0 else "sclerotic"
print(f"Detected {class_name} glomerulus with confidence {confidence:.2f}")
Whole Slide Image Processing
For processing whole slide images (.svs, .ndpi, .tiff), use the full pipeline:
git clone https://github.com/shuheimisawa/glomeruli-detector.git
cd glomeruli-detector
pip install -r requirements.txt
from tpath_glomeruli import AggressiveOverlapMerge
# Initialize detector with Test-Time Augmentation
detector = AggressiveOverlapMerge(
model_path="models/best.pt",
confidence_threshold=0.20,
overlap_threshold=0.20,
use_tta=True # Improves detection accuracy
)
# Process whole slide image
results = detector.process_wsi(
wsi_path="path/to/slide.svs",
output_dir="results"
)
print(f"Total glomeruli: {results['total_detections']}")
print(f"Normal: {results['normal_count']}")
print(f"Sclerotic: {results['sclerotic_count']}")
Output Format
Detection results include:
- Bounding box coordinates (x_min, y_min, x_max, y_max)
- Center coordinates (center_x, center_y)
- Class name (normal/sclerotic)
- Confidence score (0-1)
Recommended Settings
| Parameter | Value | Description |
|---|---|---|
| Confidence Threshold | 0.20 | Minimum detection confidence |
| Overlap Threshold | 0.20 | IoU threshold for merging duplicates |
| Use TTA | True | Test-Time Augmentation for better recall |
Supported Formats
- Aperio SVS (.svs)
- TIFF (.tif, .tiff)
- Hamamatsu NDPI (.ndpi)
- Leica SCN (.scn)
- Standard images (.png, .jpg)
Links
- GitHub Repository: shuheimisawa/glomeruli-detector
- Full Documentation: See repository README
Limitations
- Trained on specific staining protocols; performance may vary on different tissue preparations
- Processing time: ~30-60 seconds per slide depending on size
- Requires GPU for optimal performance (CPU inference is slower)
License
MIT License
Disclaimer
This model is provided for research purposes only. It has not been validated for clinical use and should not be used for medical diagnosis or treatment decisions. Always consult qualified medical professionals for clinical applications.
Contact
- Issues: GitHub Issues
- Email: [email protected]
- Downloads last month
- 25