TotalSegmentator (fastforks)

TotalSegmentator (Wasserthal et al., Radiology: AI 2023): 117 anatomical structures (organs, bones, muscles, vessels) in CT, from nnU-Net v2 3D U-Nets. total merges five 1.5 mm part networks, total-3mm is the single fast 3 mm network. Gives one integer label volume on the input grid plus the label names.

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/wasserth/TotalSegmentator at 184fa4765456.

Task: volume. Tier: experimental. Outputs: labels. Backends: portable, kernels.

Input: a CT volume [D, H, W] in Hounsfield units and its voxel spacing in mm (volume.read_nifti reads both from a NIfTI file). Output: a class index per voxel [D, H, W] on the input grid (0 = background). Encoder models (nnFoundation) take a CT or MRI volume and give its encoder feature maps.

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
totalsegmentator-total@1 Dataset291_TotalSegmentator_part1_organs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json
Dataset291_TotalSegmentator_part1_organs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json
Dataset291_TotalSegmentator_part1_organs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth
Dataset292_TotalSegmentator_part2_vertebrae_1532subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json
Dataset292_TotalSegmentator_part2_vertebrae_1532subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json
Dataset292_TotalSegmentator_part2_vertebrae_1532subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth
Dataset293_TotalSegmentator_part3_cardiac_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json
Dataset293_TotalSegmentator_part3_cardiac_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json
Dataset293_TotalSegmentator_part3_cardiac_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth
Dataset294_TotalSegmentator_part4_muscles_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json
Dataset294_TotalSegmentator_part4_muscles_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json
Dataset294_TotalSegmentator_part4_muscles_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth
Dataset295_TotalSegmentator_part5_ribs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json
Dataset295_TotalSegmentator_part5_ribs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json
Dataset295_TotalSegmentator_part5_ribs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth
d77d815eb2bd
09089590277f
98c429f89fd9
72fcde2fa591
5c967bfe82c8
7022f71829ef
a048b27bfe30
ac8ee8e6d004
189010ac67fe
63c9175c2f3f
3c0002bc0667
655eb40de03a
241fa585e763
71228770dbcb
a674364c60b3
Apache-2.0 yes
totalsegmentator-total-3mm@1 Dataset297_TotalSegmentator_total_3mm_1559subj/nnUNetTrainer_4000epochs_NoMirroring__nnUNetPlans__3d_fullres/plans.json
Dataset297_TotalSegmentator_total_3mm_1559subj/nnUNetTrainer_4000epochs_NoMirroring__nnUNetPlans__3d_fullres/dataset.json
Dataset297_TotalSegmentator_total_3mm_1559subj/nnUNetTrainer_4000epochs_NoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth
d1cb3c15f53d
e804e08ad891
1e38e40356ad
Apache-2.0 yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.

Training data: TotalSegmentator dataset v2 (1228 CT scans, 117 structures) (1559 CT scans of the TotalSegmentator dataset v2 (CC BY 4.0). Only the weights licence counts for the commercial flag.).

Licence evidence: https://github.com/wasserth/TotalSegmentator/blob/184fa4765456492b2ab81a981cc387465906b003/LICENSE ; https://github.com/wasserth/TotalSegmentator/blob/184fa4765456492b2ab81a981cc387465906b003/README.md

Input size

any D x H x W volume and its voxel spacing (resampled to the model spacing, sliding window) Tested up to (portable, fp16, RTX 5060 Ti 16 GB): totalsegmentator-total 512x512x512 voxels (5.5 GiB peak allocated, 5.8 reserved); totalsegmentator-total-3mm 512x512x512 voxels (4.3 GiB peak allocated, 5.1 reserved)

Speed and memory

Volume, synthetic

model input time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
totalsegmentator-total 200x200 47779 45630 1927 1740 26.2x 1.1x 2640 / 2874 2605 / 2944 2349 / 2704
totalsegmentator-total-3mm 200x200 7304 7270 67.1 63.5 114.4x 1.1x 2010 / 2684 1092 / 1508 1037 / 1410

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
totalsegmentator-total 0.07 0.77 0.77 54.51 2.10 1.88
totalsegmentator-total-3mm 0.06 1.18 1.19 12.48 0.26 0.21

torch.compile and TensorRT

model input time: portable compile TensorRT fp16 kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
totalsegmentator-total 200x200 1927 ms fails: no exportable module (multi-network sliding-window pipeline) fails: no exportable module (multi-network sliding-window pipeline; 1740 ms – – 2605 / 2944 – 2349 / 2704 –
totalsegmentator-total-3mm 200x200 67.1 ms fails: no exportable module (multi-network sliding-window pipeline) fails: no exportable module (multi-network sliding-window pipeline; 63.5 ms – – 1092 / 1508 – 1037 / 1410 –

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

A small subset of real CT cases of the TotalSegmentator dataset (not the full test split), each run at its card's spacing (1.5 or 3 mm) in the same pipeline; mean over the cases of the Dice (0 to 1) averaged over the classes present, against the ground-truth segmentations (vertebrae_L6 of the subset has no counterpart and is skipped). Original = TotalSegmentator 2.18.0, default fp16 autocast. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp16 portable kernels note
totalsegmentator-total TotalSegmentator test subset (7 CT cases), 1.5 mm, mean Dice 0.9365 0.9365 0.9365
totalsegmentator-total-3mm TotalSegmentator test subset (8 CT cases), 3 mm, mean Dice 0.8285 0.8285 0.8285

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 2d71f180, 2026-11-14.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.0 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.003 and p99 <= 0.5 (absolute error of the output labels).

Usage

from fastforks import volume

model = volume.load("totalsegmentator-total")  # mode="auto": the preferred backend from recorded measurements
result = model(ct, spacing=spacing)  # ct: [D, H, W] float32 HU volume; spacing: (z, y, x) in mm
result.labels  # [D, H, W] uint8 label per voxel; result.class_names[k] names label k
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: totalsegmentator-total, totalsegmentator-total-3mm.

Kernels backend

volume.load("totalsegmentator-total", mode="kernels") runs our CUDA kernels (vol_norm). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including fastforks/totalsegmentator