SpineContextResUNet is a high-efficiency 3D deep learning framework designed to localize the human spine within Computed Tomography (CT) volumes. By leveraging a custom 1.7M parameter architecture, this project achieves state-of-the-art efficiency, allowing for complex medical image analysis on consumer-grade hardware.
Most 3D medical segmentation models (like the standard 3D U-Net) contain 30M+ parameters. SpineContextResUNet uses only 1.7 Million parameters, representing a ~17x reduction in size while maintaining high segmentation accuracy.
To compensate for its small size, the model utilizes a specialized bottleneck layer with dilated convolutions. This allows the network to "see" a larger anatomical area (wider receptive field) to understand the spine's global structure without increasing the number of weights.
The project is built specifically to utilize Metal Performance Shaders (MPS), enabling high-speed training and inference on Apple M-series chips (M1/M2/M3/M4).
├── checkpoints/
├── logs/
│ ├── test_set_evaluation.txt
│ └── training_log.txt
├── models/
│ └── best_model.pth
├── results/
│ └── test/
├── src/
│ ├── dataset.py
│ ├── evaluate.py
│ ├── model.py
│ ├── param_count.py
│ ├── preprocess.py
│ └── train.py
├── visualizations/
├── inference.py
├── README.md
├── requirements.txt
└── test_metrics_dice.csvThe model was rigorously tested across multiple datasets (VerSe and Global clinical scans), demonstrating high robustness to different imaging protocols.
| Metric | Result |
|---|---|
| Mean Dice Score (VerSe2020) | 0.8813 |
| Mean Dice Score (CTSpine1K) | 0.8817 |
| Parameter Count | 1,703,841 |
The evaluation files generated during testing, including subject-specific segmentation masks and sagittal visual overlays, are automatically stored in the results/test/ directory for easy verification and analysis.
This project was developed to address the "Black Box" and "Computational Inefficiency" problems in modern clinical AI. By providing a lightweight yet accurate localization map, SpineContextResUNet serves as a robust foundation for automated vertebral fracture detection and spinal deformity analysis.

