Comparative analysis framework for 3D medical image segmentation using MONAI and PyTorch. We evaluate 3D U-Net, UNETR, and SegResNet on three datasets: BraTS, MSD Liver, and TotalSegmentator.
- Open
notebooks/00_environment_setup.ipynbin Colab and Run all. It will:- Mount Drive
- Clone/pull this repo into
/content/drive/MyDrive/3d_medical_segmentation - Install compatible dependencies for Colab (Python 3.12)
- Run all selected experiments
- Ensure datasets are under
/content/drive/MyDrive/datasetswith folders:BraTS/(orbrats,BraTS2021)MSD/(orMSD_Liver,Task03_Liver)TotalSegmentator/(orTotalSeg)
- Datasets: BraTS, MSD Liver, TotalSegmentator loaders with robust path resolution
- Models: UNet (BasicUNet), UNETR, SegResNet with proper MONAI integration
- Training: Comprehensive pipeline with mixed precision, checkpointing, streaming logs
- Environment: Colab-ready setup with Drive persistence and auto-detection
- Evaluation: Dice metric computation with proper one-hot encoding
Experiment Matrix: 3 datasets × 3 architectures = 9 trained models
| Dataset | UNet | UNETR | SegResNet |
|---|---|---|---|
| BraTS (4→4 channels) | ✅ | ✅ | ✅ |
| MSD Liver (1→3 channels) | ✅ | ✅ | ✅ |
| TotalSegmentator (1→2 channels) | ✅ | ✅ | ✅ |
Training Performance:
- BraTS: ~17s/epoch (4-channel input, 4-class output)
- MSD Liver: ~1500s/epoch (single-channel CT, 3-class liver segmentation)
- TotalSegmentator: ~2000s/epoch (single-channel CT, 118-class→2-class simplified)
- All models: CUDA acceleration, mixed precision, proper convergence
Our trained models successfully segment brain tumors across multiple MRI modalities. Below are sample predictions showing the model's ability to identify tumor regions in different anatomical planes:
Watch the model predictions sweep through the entire 3D volume:
Key Achievements:
- Multi-class segmentation: Accurately distinguishes tumor core, enhancing tumor, and edema
- Volumetric consistency: Predictions maintain anatomical coherence across all three planes
- Clinical relevance: Results suitable for radiological assessment and treatment planning
- Model Evaluation: Comprehensive metrics (Dice, IoU, Hausdorff distance)
- Results Analysis: Performance comparison across architectures and datasets
- Visualization: Sample predictions, confusion matrices, learning curves
- Documentation: Technical report with findings and reproducibility guide
Measure per-volume latency and throughput across GPUs to compare deployment efficiency.
- Ensure you have a trained checkpoint and a sample input tensor matching your model's IO shape.
- Run the following minimal snippet to time forward passes with CUDA synchronization:
- Log results in a table (dataset, architecture, GPU, num GPUs, latency, throughput, Torch, CUDA).
Running python scripts/evaluate_models.py now performs both validation evaluation and inference benchmarking by default and writes a single unified summary at:
results/colab_runs/evaluation_full.json(also mirrored toresults/evaluation_full.json).
For the full protocol and reporting guidance, see "Inference Efficiency Benchmarking" in DOCUMENTATION.md.
MIT








