ASCHOPLEX: Fine-Tuned Choroid Plexus Segmentation in COMPASS-ND
Automated choroid plexus segmentation from 3D T1-weighted brain MRI using a five-model deep learning ensemble.
This repository provides the fine-tuned ASCHOPLEX model checkpoints, MONAI configurations, and an inference script for research applications.
The models were fine-tuned using manually annotated choroid plexus (ChP) segmentations from the multi-site COMPASS-ND cohort.
Original ASCHOPLEX: https://github.com/FAIR-Unipd/ASCHOPLEX
Quick Start
The model is designed to run locally on an NVIDIA GPU.
Once the repository is public and ungated, users can download and run ASCHOPLEX without creating a Hugging Face account, generating an access token, or logging in.
Requirements:
- Linux with an NVIDIA GPU
- CUDA-compatible PyTorch
- Python 3.9
- Approximately 770 MB of model checkpoints, plus software dependencies
- 3D T1-weighted MRI in NIfTI format
Important: GPU inference is required for the supported workflow. CPU-only inference is not supported or validated.
1. Download the Model
The recommended method uses the Hugging Face Hub downloader, which retrieves the complete model weights rather than Git LFS pointer files.
Install the downloader:
python -m pip install -U huggingface_hub
Download the complete repository:
hf download MINDlabmtl/Aschoplex_compassnd_chp_finetuned \
--local-dir Aschoplex_compassnd_chp_finetuned
Enter the repository:
cd Aschoplex_compassnd_chp_finetuned
No Hugging Face login or token is required for a public, ungated repository.
Alternatively, users can clone the repository using Git LFS:
git lfs install
git clone https://huggingface.co/MINDlabmtl/Aschoplex_compassnd_chp_finetuned
cd Aschoplex_compassnd_chp_finetuned
git lfs pull
Do not use a plain Git clone without ensuring the large checkpoint files have been downloaded.
2. Create the Environment
Create a dedicated Python environment:
conda create -n aschoplex python=3.9 -y
conda activate aschoplex
Install the tested CUDA 11.7 PyTorch build:
python -m pip install \
torch==1.13.1+cu117 \
torchvision==0.14.1+cu117 \
--extra-index-url https://download.pytorch.org/whl/cu117
Install the remaining dependencies:
python -m pip install -r requirements.txt
The inference implementation was developed and validated using PyTorch 1.13.1, MONAI 1.0.1, and NumPy 1.23.5.
UNETR requires the einops package. Ensure that it is included in the repository's requirements.txt.
Check the installation:
python -c "import torch, monai, numpy; from einops.layers.torch import Rearrange; print('Dependencies loaded successfully'); print('CUDA available:', torch.cuda.is_available())"
The CUDA check should return:
CUDA available: True
If CUDA is unavailable, verify the NVIDIA driver, PyTorch CUDA installation, and GPU allocation before running inference.
3. Run Inference
Run the complete five-model ensemble:
python run_inference.py \
--input /path/to/T1w.nii.gz \
--output ./predictions
For example:
python run_inference.py \
--input /data/subject001.nii.gz \
--output ./predictions
The output will be saved as:
predictions/
βββ subject001_ensemble_seg.nii.gz
The segmentation is a binary NIfTI mask in the original MRI image space.
The inference script also reports the number of segmented foreground voxels and the estimated ChP volume in cubic millimeters.
4. Verify the Model Checkpoints
If inference fails while loading a checkpoint, verify that all five model files have been downloaded:
ls -lh models/*/model_fold0/best_metric_model.pt
The checkpoints should be large binary files.
Files approximately 133β134 bytes in size are Git LFS pointers, not usable model checkpoints.
If this occurs, download the repository using the Hugging Face downloader described above or run git lfs pull.
Hardware Requirements and Runtime
ASCHOPLEX performs three-dimensional inference using three DynUNet and two UNETR models.
The five models are executed sequentially to reduce simultaneous GPU memory usage.
| Component | Requirement |
|---|---|
| GPU | NVIDIA CUDA-compatible GPU |
| Tested GPU | NVIDIA RTX A6000 |
| Tested GPU memory | 48 GB |
| Python | 3.9 |
| PyTorch | 1.13.1 |
| MONAI | 1.0.1 |
| Input | 3D T1-weighted NIfTI MRI |
| CPU-only inference | Not supported or validated |
Estimated Inference Time
For planning purposes, allow approximately 2β10 minutes per MRI scan on an NVIDIA RTX A6000.
This is a provisional estimate, not a measured benchmark. Actual runtime depends on MRI dimensions, preprocessing, GPU availability, disk performance, and system load.
The first inference may take longer because model initialization and checkpoint loading are included.
For reproducible runtime reporting, users should measure execution time on their own hardware:
/usr/bin/time -p python run_inference.py \
--input /path/to/T1w.nii.gz \
--output ./predictions
The reported real time includes model loading, preprocessing, inference, and output writing.
Model Architecture
The ensemble consists of five independently fine-tuned models:
| Model | Architecture |
|---|---|
DynUnet_128_DiceCE_1_0 |
DynUNet |
DynUnet_128_DiceCE_4_0 |
DynUNet |
DynUnet_128_Dice_2_0 |
DynUNet |
UNETR_128_DiceCE_0_0 |
UNETR |
UNETR_128_DiceCE_3_0 |
UNETR |
Ensemble Prediction
Each model processes the input MRI using its corresponding MONAI configuration.
The inference pipeline performs:
- MRI loading and preprocessing.
- Sliding-window inference using 128 Γ 128 Γ 128 voxel patches with 50% overlap.
- Spatial restoration of predictions to the original image space.
- Softmax probability estimation.
- Equal-weight averaging of the five probability maps.
- Voxel-wise argmax to generate the final binary segmentation.
The ensemble probability is calculated as:
P_ensemble(x) = [P_1(x) + P_2(x) + P_3(x) + P_4(x) + P_5(x)] / 5
Here, P_i(x) is the predicted class probability vector from model i at voxel x.
The final segmentation assigns each voxel to the class with the highest mean probability.
Choroid Plexus Volume Estimation
The script estimates ChP volume from the predicted foreground voxels.
ChP volume (mmΒ³) = Number of foreground voxels Γ Voxel volume (mmΒ³)
Voxel volume is derived from the spatial affine transformation of the original MRI.
Volume can be converted to milliliters using:
ChP volume (mL) = ChP volume (mmΒ³) / 1000
The reported volume is not normalized by intracranial volume.
Model Development and Validation
The ensemble was fine-tuned using manually annotated choroid plexus segmentations from the COMPASS-ND cohort.
The reference annotation dataset included 60 MRI scans:
- 20 cognitively unimpaired participants
- 20 participants with Alzheimer's disease
- 20 participants with Parkinson's disease
Annotations were prepared by 3 trained raters and reviewed through a consensus process involving an experienced neuroradiologist.
Held-Out Evaluation
Segmentation performance was evaluated on a held-out test set of 30 participants, with 10 participants from each diagnostic group.
Compared with the original ASCHOPLEX framework, the fine-tuned approach demonstrated improvements:
Release Verification
The restructured inference implementation was tested locally using the five fine-tuned model checkpoints.
The updated wrapper reproduced the previously validated wrapper output with identical image dimensions, identical affine transformations, and zero differing segmentation voxels.
This verifies consistency between the two wrapper versions, rather than independent external validation.
Repository Structure
Aschoplex_compassnd_chp_finetuned/
βββ README.md
βββ requirements.txt
βββ run_inference.py
βββ models/
βββ DynUnet_128_DiceCE_1_0/
βββ DynUnet_128_DiceCE_4_0/
βββ DynUnet_128_Dice_2_0/
βββ UNETR_128_DiceCE_0_0/
βββ UNETR_128_DiceCE_3_0/
Each model directory contains:
configs/
βββ hyper_parameters.yaml
βββ network.yaml
βββ transforms_infer.yaml
model_fold0/
βββ best_metric_model.pt
All five checkpoints are required for ensemble inference.
Intended Use and Limitations
ASCHOPLEX is intended for:
- Automated choroid plexus segmentation
- Quantitative ChP volumetry
- Neurodegenerative disease imaging research
- Large-scale structural MRI phenotyping
The model is intended for research use only and has not been validated for clinical diagnosis or treatment decisions.
Limitations
- CPU-only inference has not been validated and is not part of the supported workflow.
Data Privacy
No participant MRI scans, manual segmentation labels, or clinical metadata are distributed in this repository.
The provided inference script processes MRI scans locally. It does not upload input images to Hugging Face.
Users are responsible for complying with applicable institutional data-access and privacy requirements.
Citation
If you use this fine-tuned ASCHOPLEX ensemble, please cite:
Singh et al. Automatic segmentation of choroid plexus using deep learning across neurodegenerative diagnoses in the multi-site COMPASS-ND Study.
Full publication details and DOI will be added when available.
Please also acknowledge the original ASCHOPLEX framework:
https://github.com/FAIR-Unipd/ASCHOPLEX
Acknowledgments
This work builds upon the original ASCHOPLEX framework and the MONAI medical imaging deep learning ecosystem.
We acknowledge the COMPASS-ND participants, research teams, and contributing institutions.
License
Apache License 2.0, subject to verification of applicable upstream licensing, model-weight redistribution rights, and institutional release permissions.
This software is provided for research purposes without a guarantee of fitness for clinical use.