Models · 3D volume segmentation
TotalSegmentator
TotalSegmentator (University Hospital Basel): nnU-Net v2 networks that label 117 anatomical structures (organs, bones, muscles, vessels) in CT volumes, at 1.5 mm (five networks) or 3 mm (one, faster). Commercially usable (Apache-2.0 code and weights).
experimental Fork of wasserth/TotalSegmentator@184fa47 · backends: portable, kernels
- Paper TotalSegmentator: Robust Segmentation of 104 Anatomic Structures in CT Images Radiology: Artificial Intelligence 2023 · first released 5 Jul 2023
- Paper nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation Nature Methods 2021 · first released 7 Dec 2020
Paper 2023 Added in 0.2.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import volume
model = volume.load("totalsegmentator-total") # kernels on a supported GPU, else portable PyTorch
result = model(volume, spacing)
result.labels
result.backend # what ran: mode, device, dtype, kernels fastforks bench totalsegmentator-total Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
Input: synthetic, 200x200 (the task’s standard size)
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32totalsegmentator(nifti, ml=True, fast=False, device='gpu') on the in-memory NIfTI (CPU numpy in, labels out; weights load per call as upstream) | fp32 | 47779 | 0.96× | 8,150 MiB/8,604 MiB | 0.1 | 55.49 |
| Original fp16totalsegmentator(nifti, ml=True, fast=False, device='gpu') on the in-memory NIfTI (CPU numpy in, labels out; weights load per call as upstream) | fp16 | 45630 | – | 2,640 MiB/2,874 MiB | 0.1 | 54.51 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 1927 | 24× | 2,605 MiB/2,944 MiB | 0.8 | 2.10 |
| Kernels | fp16 | 1740 | 26× | 2,349 MiB/2,704 MiB | 0.8 | 1.88 |
| Portable + torch.compileno exportable module (multi-network sliding-window pipeline) | fails | – | – | – | – | |
| TensorRTno exportable module (multi-network sliding-window pipeline; | fails | – | – | – | – |
Measured on RTX 5060 Ti 16 GB, torch 2.10.0+cu130, 2.14.1+cu130, 2026-11-14. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-15 | Original | fp32 | cannot run here | – | 200x200 | |
| Portable | fp16 | 23070 | 6,058 MiB process | matches | 200x200 | |
| Portable | fp32 | 27804 | 10,180 MiB process | matches | 200x200 | |
| Kernels | fp16 | not implemented | – | 200x200 | ||
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
Our reading of the licences, not legal advice.
Weights
Dataset291_TotalSegmentator_part1_organs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json 11.2 KB· inside a 234 MB archive· hosted on GitHubDataset291_TotalSegmentator_part1_organs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json 1.0 KB· inside a 234 MB archive· hosted on GitHubDataset291_TotalSegmentator_part1_organs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth 252 MB· inside a 234 MB archive· hosted on GitHubDataset292_TotalSegmentator_part2_vertebrae_1532subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json 11.2 KB· inside a 234 MB archive· hosted on GitHubDataset292_TotalSegmentator_part2_vertebrae_1532subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json 1.1 KB· inside a 234 MB archive· hosted on GitHubDataset292_TotalSegmentator_part2_vertebrae_1532subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth 252 MB· inside a 234 MB archive· hosted on GitHubDataset293_TotalSegmentator_part3_cardiac_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json 11.2 KB· inside a 234 MB archive· hosted on GitHubDataset293_TotalSegmentator_part3_cardiac_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json 974 B· inside a 234 MB archive· hosted on GitHubDataset293_TotalSegmentator_part3_cardiac_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth 251 MB· inside a 234 MB archive· hosted on GitHubDataset294_TotalSegmentator_part4_muscles_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json 11.2 KB· inside a 234 MB archive· hosted on GitHubDataset294_TotalSegmentator_part4_muscles_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json 1.0 KB· inside a 234 MB archive· hosted on GitHubDataset294_TotalSegmentator_part4_muscles_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth 252 MB· inside a 234 MB archive· hosted on GitHubDataset295_TotalSegmentator_part5_ribs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/plans.json 11.2 KB· inside a 234 MB archive· hosted on GitHubDataset295_TotalSegmentator_part5_ribs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/dataset.json 1.0 KB· inside a 234 MB archive· hosted on GitHubDataset295_TotalSegmentator_part5_ribs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres/fold_0/checkpoint_final.pth 252 MB· inside a 234 MB archive· hosted on GitHubfastforks downloads and checks these files on first use (fastforks download totalsegmentator-total).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
TotalSegmentator test subset (7 CT cases)
1.5 mm, mean Dice
| Run | dtype | dice ↑ | cases | ms / case |
|---|---|---|---|---|
| Original fp32 | not measured | |||
| Original fp16 | fp16 | 0.9365 | 7 | – |
| Portable fp32 | not measured | |||
| Portable | fp16 | 0.9365 | 7 | – |
| Kernels | fp16 | 0.9365 | 7 | – |
The original code was not run on this dataset, so the table cannot show the distance to it.
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 authors’ code, same checkpoint and protocol. Measured on original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 2d71f180, 2026-11-14.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0 | not recorded |
| cpu_label_mismatch | ≤ 0.001 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.003 | 0.00007 |
| GPU default dtypes, p99 |diff| | ≤ 0.5 | 0 |
Recorded for totalsegmentator-total on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14, with these kernels: vol_norm
Details
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.
- Input / output
- Input: a CT volume
[D, H, W]in Hounsfield units and its voxel spacing in mm (volume.read_niftireads both from a NIfTI file). Output: a class index per voxel[D, H, W]on the input grid (0 = background).What the numbers mean, and which models need the camera focal length
Encoder models (nnFoundation) take a CT or MRI volume and give its encoder feature maps. For a trained nnU-Net v2 folder or checkpoint, see the [nnU-Net v2 loader](../api/volume.md#nnu-net-v2).
- Input size
- any H x W >= 32, padded to a multiple of 32; tested up to 512x512 (5,635 MiB allocated)
- Outputs
labels- Checkpoint
parts=["Dataset291_TotalSegmentator_part1_organs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres","Dataset292_TotalSegmentator_part2_vertebrae_1532subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres","Dataset293_TotalSegmentator_part3_cardiac_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres","Dataset294_TotalSegmentator_part4_muscles_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres","Dataset295_TotalSegmentator_part5_ribs_1559subj/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres"],spacing=1.5- CUDA kernels
vol_norminstance norm and LeakyReLU on 3D volumes
- Apple (MPS)
- fp32, fp16
Full reference, generated from the repository
TotalSegmentator (University Hospital Basel): nnU-Net v2 networks that label 117 anatomical structures (organs, bones, muscles, vessels) in CT volumes, at 1.5 mm (five networks) or 3 mm (one, faster). Commercially usable (Apache-2.0 code and weights).
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
totalsegmentator-total | synthetic (200x200) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 47779 45630 1927 1740 fails: no exportable module (multi-network sliding-window pipeline) fails: no exportable module (multi-network sliding-window pipeline; | 8150 / 8604 2640 / 2874 2605 / 2944 2349 / 2704 – – |
totalsegmentator-total-3mm | synthetic (200x200) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 7304 7270 67.1 63.5 fails: no exportable module (multi-network sliding-window pipeline) fails: no exportable module (multi-network sliding-window pipeline; | 5358 / 5698 2010 / 2684 1092 / 1508 1037 / 1410 – – |
Details
- Original code: https://github.com/wasserth/TotalSegmentator at
184fa4765456 - Code licence: Apache-2.0 (permissive); files:
LICENSE - Weights licence: Apache-2.0
- Licence evidence: https://github.com/wasserth/TotalSegmentator/blob/184fa4765456492b2ab81a981cc387465906b003/LICENSE ; https://github.com/wasserth/TotalSegmentator/blob/184fa4765456492b2ab81a981cc387465906b003/README.md
- 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.)
- Kernel libraries:
vol_norm - Variants:
totalsegmentator-total,totalsegmentator-total-3mm - Outputs: labels
- 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-total512x512x512 voxels (5.5 GiB peak allocated, 5.8 reserved);totalsegmentator-total-3mm512x512x512 voxels (4.3 GiB peak allocated, 5.1 reserved) totalsegmentator-totaloriginal (fp32) 200x200, original 200x200: totalsegmentator(nifti, ml=True, fast=False, device='gpu') on the in-memory NIfTI (CPU numpy in, labels out; weights load per call as upstream)totalsegmentator-total-3mmoriginal (fp32) 200x200, original 200x200: totalsegmentator(nifti, ml=True, fast=True, device='gpu') on the in-memory NIfTI (CPU numpy in, labels out; weights load per call as upstream)totalsegmentator-totalload / first call: original 0.07 s / 54.51 s, portable 0.77 s / 2.103 s, kernels 0.77 s / 1.879 stotalsegmentator-total-3mmload / first call: original 0.06 s / 12.48 s, portable 1.18 s / 0.259 s, kernels 1.19 s / 0.209 s- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
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
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).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
totalsegmentator-total | 7e-05 / 0.0 | RTX 5060 Ti, torch 2.14.1+cu130 | vol_norm@44036d4da567:sm_120 |
totalsegmentator-total-3mm | 0.0006 / 0.0 | RTX 5060 Ti, torch 2.14.1+cu130 | vol_norm@44036d4da567:sm_120 |
Example output
No example rendered for this checkpoint yet.