nnU-Net Knee MRI Segmentation
Automated knee MRI segmentation using nnU-Net cascade architecture for clinical and research applications.
This model provides accurate segmentation of 9 anatomical structures in knee MRI scans including cartilage, meniscus, and bone components with a mean Dice coefficient of 0.924.
π― Model Overview
- Architecture: nnU-Net cascade (3d_lowres β 3d_cascade_fullres)
- Input: Knee MRI volumes (.nii.gz, .nrrd)
- Output: 9-class segmentation masks
- Performance: 0.906 mean DSC across all structures
- Inference Time: ~80 seconds per volume
π Segmentation Classes
| Label | Structure | Typical DSC |
|---|---|---|
| 0 | Background | - |
| 1 | Patellar cartilage | >0.86 |
| 2 | Femoral cartilage | >0.86 |
| 3 | Medial tibial cartilage | >0.86 |
| 4 | Lateral tibial cartilage | >0.86 |
| 5 | Medial meniscus | >0.84 |
| 6 | Lateral meniscus | >0.84 |
| 7 | Femur bone | >0.95 |
| 8 | Tibia bone | >0.95 |
| 9 | Patella bone | >0.95 |
π Quick Start
Installation
# Install dependencies
pip install torch nnunetv2 SimpleITK numpy huggingface_hub
# Download models from HuggingFace
from huggingface_hub import snapshot_download
snapshot_download(repo_id="aagatti/nnunet_knee", local_dir="./nnunet_knee_models")
Python Usage
from scripts.inference import KneeSegmentationInference
# Initialize inference
inference = KneeSegmentationInference(model_path="./nnunet_knee_models/models")
# Run segmentation
result = inference.predict("knee_mri.nii.gz", "segmentation_output.nii.gz")
Command Line Usage
python scripts/inference.py --input knee_mri.nii.gz --output segmentation.nii.gz
π» Complete Setup Instructions
For complete setup with testing and validation:
- Clone the inference package: nnunet_knee inference code
- Download models: Use the code above or HuggingFace CLI
- Run tests: Validate with provided test data and DSC metrics
π¬ Technical Details
Architecture
- Stage 1: 3d_lowres model generates coarse segmentation
- Stage 2: 3d_cascade_fullres refines using lowres predictions
- Framework: nnU-Net v2 with PyTorch backend
- Preprocessing: Automatic intensity normalization and resampling
Performance Metrics
- Overall Mean DSC: 0.906
- Cartilage Structures: 0.86+ DSC (excellent)
- Meniscus Structures: 0.84+ DSC (excellent)
- Bone Structures: 0.95+ DSC (excellent)
- Inference Time: ~80 seconds per volume
Input Requirements
- Format: NIfTI (.nii.gz) or NRRD (.nrrd)
- Modality: T2-weighted knee MRI
- Orientation: Any (automatically handled)
- Resolution: Any (automatically resampled)
π Citation
If you use this model in your research, please cite:
@article{nnunet_knee_2024,
title={Automating Imaging Biomarker Analysis for Knee Osteoarthritis Using an Open-Source MRI-Based Deep Learning Pipeline},
author = {Goyal, Ananya and Belibi, Francesca and Sahani, Vyoma and Pedersen, Rune and Vainberg, Yael and Williams, Ashley and Chu, Constance and Haddock, Bryan and Gold, Garry and Chaudhari, Akshay and Kogan, Feliks and Gatti, Anthony},
year={2025},
doi = {10.1101/2025.02.21.25322094},
publisher = {Cold Spring Harbor Laboratory Press},
URL = {https://www.medrxiv.org/content/early/2025/02/23/2025.02.21.25322094},
eprint = {https://www.medrxiv.org/content/early/2025/02/23/2025.02.21.25322094.full.pdf},
journal = {medRxiv},
note={Available at: https://huggingface.co/aagatti/nnunet_knee}
}
π€ Contributing
This model is part of an open-source knee MRI analysis pipeline. Contributions and feedback are welcome!
π§ Contact
For questions about this model or collaboration opportunities, please reach out through the HuggingFace repository discussions.
Model Version: 1.0
Last Updated: 2025
License: MIT
Maintained by: @aagatti
- Downloads last month
- 19
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support
Evaluation results
- Mean Dice Score on Knee MRI Datasetself-reported0.906
- Bone Structures DSC on Knee MRI Datasetself-reported0.950
- Cartilage Structures DSC on Knee MRI Datasetself-reported0.860
- Meniscus Structures DSC on Knee MRI Datasetself-reported0.840