total-feet-seg
This repository contains nnU-Net v2 models that segment 56 bones of both feet and ankles in CT scans: the distal tibia and fibula, the tarsals, the metatarsals and the phalanges. Left and right bones get separate labels.
Models
| Model | Plans (-p) |
Epochs | Pseudo-Dice | Size |
|---|---|---|---|---|
| ResEnc L U-Net (recommended) | nnUNetResEncUNetLPlans |
681 | 0.958 | 821 MB |
| Plain U-Net (smaller, faster) | nnUNetPlans |
179 | 0.940 | 250 MB |
Pseudo-Dice by bone group:
| Bone group | ResEnc L U-Net | Plain U-Net |
|---|---|---|
| Tibia and fibula | 0.978 | 0.974 |
| Tarsals | 0.975 | 0.958 |
| Metatarsals | 0.966 | 0.959 |
| Phalanges | 0.944 | 0.919 |
The pseudo-Dice is nnU-Net's validation score during training. Both models were trained on all 30 cases (fold
all), so the score is measured on training data and does not estimate accuracy on new scans.
Both models were trained with these settings:
- Trainer:
nnUNetTrainerNoMirroring. Mirroring is turned off, so left and right are never swapped. - Configuration:
3d_fullres - Fold:
all - Checkpoint:
checkpoint_best.pth
Training data
The models were trained on 30 CT scans of the feet. The images come from VSDFullBodyBoneReconstruction. The labels were created from the bone meshes of VSDFullBodyBoneModels, with the fused foot bones split into individual bones.
The training data is published as BoneHub/vsd-feet-seg.
Labels
| Left | Right | |
|---|---|---|
| Tibia | 1 | 2 |
| Fibula | 3 | 4 |
| Talus | 5 | 6 |
| Calcaneus | 7 | 8 |
| Navicular | 9 | 10 |
| Cuboid | 11 | 12 |
| Medial / Intermediate / Lateral cuneiform | 13 / 15 / 17 | 14 / 16 / 18 |
| Metatarsals 1β5 | 19, 21, 23, 25, 27 | 20, 22, 24, 26, 28 |
| Phalanges of toe 1 (proximal, distal) | 29, 31 | 30, 32 |
| Phalanges of toes 2β5 (proximal, middle, distal) | 33β55, odd | 34β56, even |
The full list of label names is in models/*/dataset.json. In a name like Phalange_Foot_<toe>_<phalanx>_<side>:
- Toe: 1 is the big toe.
- Phalanx: counted from proximal to distal.
Prediction
1. Install
pip install nnunetv2 huggingface_hub
Install PyTorch for your CUDA version first.
2. Download the models and rename the folder
nnU-Net expects trained models in $nnUNet_results/DatasetXXX_Name/. The models/ folder in this repo therefore has to be renamed after download, for example to Dataset001_total-feet-seg.
export nnUNet_results="$PWD/nnUNet_results" # Windows: $env:nnUNet_results = "$PWD\nnUNet_results"
hf download BoneHub/total-feet-seg --include "models/*" --local-dir ./total-feet-seg
mkdir -p "$nnUNet_results"
mv ./total-feet-seg/models "$nnUNet_results/Dataset001_total-feet-seg"
If you already have another Dataset001_*, choose a free ID (e.g. Dataset901_total-feet-seg) and use that number with -d below.
3. Prepare the input
Put your CT scans (in Hounsfield units, .nii.gz) in one folder. Each file name must end in _0000:
data/infer/
βββ subject01_0000.nii.gz
βββ subject02_0000.nii.gz
The image orientation must be correct, because the model predicts left and right labels.
4. Predict
ResEnc L U-Net:
nnUNetv2_predict -i ./data/infer -o ./data/infer_out -d 1 -tr nnUNetTrainerNoMirroring -p nnUNetResEncUNetLPlans -c 3d_fullres -f all -chk checkpoint_best.pth
Plain U-Net:
nnUNetv2_predict -i ./data/infer -o ./data/infer_out -d 1 -tr nnUNetTrainerNoMirroring -p nnUNetPlans -c 3d_fullres -f all -chk checkpoint_best.pth
Each output in ./data/infer_out/ is a label map with the same geometry as its input.
Retraining
1. Download the dataset and rename the folder
The dataset folder feet_ct/ has to be renamed to an nnU-Net dataset name inside $nnUNet_raw, for example Dataset002_vsd-feet-seg.
Use a different ID than the downloaded model (Dataset001_total-feet-seg). If both use the same ID, training writes into the model's folder and overwrites the released weights.
export nnUNet_raw="$PWD/nnUNet_raw"
export nnUNet_preprocessed="$PWD/nnUNet_preprocessed"
export nnUNet_results="$PWD/nnUNet_results"
hf download BoneHub/vsd-feet-seg --repo-type dataset --include "feet_ct/*" --local-dir ./vsd-feet-seg
mkdir -p "$nnUNet_raw"
mv ./vsd-feet-seg/feet_ct "$nnUNet_raw/Dataset002_vsd-feet-seg"
2. Preprocess and train
ResEnc L U-Net:
nnUNetv2_plan_and_preprocess -d 2 -pl nnUNetPlannerResEncL -c 3d_fullres --verify_dataset_integrity
nnUNetv2_train 2 3d_fullres all -tr nnUNetTrainerNoMirroring -p nnUNetResEncUNetLPlans
Plain U-Net:
nnUNetv2_plan_and_preprocess -d 2 -c 3d_fullres --verify_dataset_integrity
nnUNetv2_train 2 3d_fullres all -tr nnUNetTrainerNoMirroring -p nnUNetPlans
- Always use
nnUNetTrainerNoMirroring. The default trainer mirrors images during training, which mixes up left and right. - To estimate accuracy on unseen data, train folds
0β4instead ofall. - Predicting with the retrained model. Use
-d 2and leave out-chk. A finished training run savescheckpoint_final.pth, which nnU-Net uses by default.
Fine-tuning on your own data
This section starts from the released ResEnc L weights.
Prepare your data. Create your own dataset in
$nnUNet_raw, e.g.Dataset004_my-feet, using the nnU-Net format (imagesTr/,labelsTr/,dataset.json). Use the same labels as above if possible.Reuse the released plans and preprocess. Copy the model's plans to
$nnUNet_preprocessed, transfer them to your dataset, and preprocess:M="$nnUNet_results/Dataset001_total-feet-seg/nnUNetTrainerNoMirroring__nnUNetResEncUNetLPlans__3d_fullres" mkdir -p "$nnUNet_preprocessed/Dataset001_total-feet-seg" cp "$M/plans.json" "$nnUNet_preprocessed/Dataset001_total-feet-seg/nnUNetResEncUNetLPlans.json" nnUNetv2_extract_fingerprint -d 4 nnUNetv2_move_plans_between_datasets -s 1 -t 4 -sp nnUNetResEncUNetLPlans -tp nnUNetResEncUNetLPlans nnUNetv2_preprocess -d 4 -plans_name nnUNetResEncUNetLPlans -c 3d_fullresTrain from the released weights.
nnUNetv2_train 4 3d_fullres all -tr nnUNetTrainerNoMirroring -p nnUNetResEncUNetLPlans \ -pretrained_weights "$M/fold_all/checkpoint_best.pth"
See nnU-Net's fine-tuning guide for details.
Limitations
- The models were trained on only 30 subjects and not tested on an independent dataset.
- Results may be worse on other scanners, fields of view, implants or pathologies.
- For research use only. The models are not for clinical use.
License
Citation
If you use these models, please cite nnU-Net and the used datasets:
@article{isensee2021nnunet,
title = {nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation},
author = {Isensee, Fabian and Jaeger, Paul F. and Kohl, Simon A. A. and Petersen, Jens and Maier-Hein, Klaus H.},
journal = {Nature Methods},
volume = {18},
number = {2},
pages = {203--211},
year = {2021}
}
@misc{seyedhamidrezaalaviVsdfeetseg,
title = {Vsd-Feet-Seg},
author = {Seyed Hamidreza Alavi and Malte Asseln},
year = {2026},
publisher = {Hugging Face},
doi = {10.57967/HF/10470},
url = {https://huggingface.co/datasets/BoneHub/vsd-feet-seg},
urldate = {2026-09-16}
}
@article{fischerDatabaseSegmentationsSurface2023,
title = {Database of Segmentations and Surface Models of Bones of the Entire Lower Body Created from Cadaver {{CT}} Scans},
author = {Fischer, M.C.M.},
year = 2023,
journal = {Scientific Data},
volume = {10},
number = {1},
pages = {763},
publisher = {Nature Publishing Group},
issn = {2052-4463},
doi = {10.1038/s41597-023-02669-z},
}
