Models · 3D volume segmentation
nnInteractive
nnInteractive (DKFZ): a promptable 3D segmenter: click a point, draw a box or a scribble on any structure in a CT, MRI, PET or microscopy volume and it returns that structure's 3D mask; further prompts (positive or negative) refine it. Non-commercial weights (CC-BY-NC-SA-4.0).
experimental Fork of MIC-DKFZ/nnInteractive@6bf57ad · backends: portable, kernels
- Paper nnInteractive: Redefining 3D Promptable Segmentation arXiv 2025 · first released 11 Mar 2025
Checkpoint nninteractive
Paper 2025 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("nninteractive") # kernels on a supported GPU, else portable PyTorch
result = model(volume, spacing)
result.mask
result.backend # what ran: mode, device, dtype, kernels The weights are non-commercial: fastforks downloads them only with FASTFORKS_NONCOMMERCIAL=1 set.
fastforks bench nninteractive 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.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 705 | 0.65× | 7,156 MiB/8,408 MiB | 1.9 | 1.05 |
| Original fp16 | fp16 | 460 | – | 4,076 MiB/4,636 MiB | 3.2 | 1.04 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 215 | 2.1× | 3,075 MiB/3,492 MiB | 1.1 | 0.48 |
| Kernels | fp16 | 201 | 2.3× | 2,643 MiB/3,072 MiB | 0.7 | 0.40 |
| Portable + torch.compile | 162 | 2.8× | 3,643 MiB/3,832 MiB | 18 (build) | – | |
| TensorRT | not measured here | – | – | – | – |
Measured on RTX 5060 Ti 16 GB, torch 2.10.0+cu130, 2.14.1+cu130, 2026-11-14 to 2026-11-15. 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 | Portable | fp32 | 3525 | 11.2 GiB 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
Non-commercial only
- Code
- Apache-2.0 LICENSE
- Weights
- CC-BY-NC-SA-4.0 source
- Training data
- 120+ volumetric 3D datasets (CT, MRI, PET, 3D microscopy; readme) with simulated prompts.
- weights: CC-BY-NC-SA-4.0
Our reading of the licences, not legal advice.
Weights
nnInteractive_v1.0/plans.json 6.3 KB· hosted on Hugging FacennInteractive_v1.0/fold_0/checkpoint_final.pth 411 MB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download nninteractive). Non-commercial weights need FASTFORKS_NONCOMMERCIAL=1.
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 (8 CT cases x 12 prompts)
mean Dice vs the ground-truth mask
| Run | dtype | dice ↑ | agree ↑ | portable_agree ↑ | prompted runs | ms / prompted run |
|---|---|---|---|---|---|---|
| Original fp32 | not measured | |||||
| Original fp16 | fp16 | 0.9688 | – | – | 96 | – |
| Portable fp32 | not measured | |||||
| Portable | fp16 | 0.9688 | 0.9999 | – | 96 | – |
| Kernels | fp16 | 0.9688 | 0.9999 | – | 96 | – |
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. nnInteractive: per case 12 simulated prompts (point, box, scribble, point + box on 3 organs), one interaction each; Dice of the predicted mask against the ground-truth organ mask, mean over the runs. Agreement is Dice against the original FP16 or portable FP16 mask as labelled. Original = the authors’ code, same checkpoint and protocol. Measured on original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-15; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 715d7cb5, 2026-11-15.
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 mask).
| 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.00006 |
| GPU default dtypes, p99 |diff| | ≤ 0.5 | 0 |
Recorded for nninteractive on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14, with these kernels: vol_norm
Details
nnInteractive (Isensee et al. 2025): DKFZ's promptable 3D segmentation for CT, MRI, PET and 3D microscopy. Point, box (2D or 3D) and scribble prompts, positive or negative, refine one object mask in a session; a ResEnc-L U-Net on 192³ patches with AutoZoom (zooms out up to 4x while the mask grows past the patch, then refines the changed region at full resolution). Lasso prompts and initial masks are not ported.
- 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,874 MiB allocated)
- Outputs
mask- CUDA kernels
vol_norminstance norm and LeakyReLU on 3D volumes
- Apple (MPS)
- fp32
Full reference, generated from the repository
nnInteractive (DKFZ): a promptable 3D segmenter: click a point, draw a box or a scribble on any structure in a CT, MRI, PET or microscopy volume and it returns that structure's 3D mask; further prompts (positive or negative) refine it. Non-commercial weights (CC-BY-NC-SA-4.0).
Commercial use: no (weights: CC-BY-NC-SA-4.0).
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
nninteractive | synthetic (200x200) | original (fp32) original portable kernels portable + torch.compile | 705 460 215 201 162 | 7156 / 8408 4076 / 4636 3075 / 3492 2643 / 3072 3643 / 3832 |
nninteractive | 192x192 | original portable kernels TensorRT fp16 | – – – 262 (U-Net on one prepared 8-channel, 192³ patch only; memory estimated) | – – – 2738 / 2740 |
Details
- Original code: https://github.com/MIC-DKFZ/nnInteractive at
6bf57adf42ca - Code licence: Apache-2.0 (permissive); files:
LICENSE - Weights licence: CC-BY-NC-SA-4.0
- Licence evidence: https://huggingface.co/MIC-DKFZ/nnInteractive/blob/3f308d751c00644e4fde6f09c600264b393b21b5/nnInteractive_v1.0/LICENSE ; https://github.com/MIC-DKFZ/nnInteractive/blob/master/LICENSE
- Training data: 120+ volumetric 3D datasets (CT, MRI, PET, 3D microscopy; readme) with simulated prompts.
- Kernel libraries:
vol_norm - Variants:
nninteractive - Outputs: mask
- 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):
nninteractive512x512x512 voxels (5.7 GiB peak allocated, 6.1 reserved) nninteractive200x200, first call: portable + torch.compile 18 s (cold Inductor cache).nninteractive192x192, first call: TensorRT fp16 58 s (ONNX + engine).nninteractiveload / first call: original 3.23 s / 1.038 s, portable 1.09 s / 0.482 s, kernels 0.65 s / 0.403 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. nnInteractive: per case 12 simulated prompts (point, box, scribble, point + box on 3 organs), one interaction each; Dice of the predicted mask against the ground-truth organ mask, mean over the runs. Agreement is Dice against the original FP16 or portable FP16 mask as labelled. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp16 | portable | kernels | TensorRT | note |
|---|---|---|---|---|---|---|
nninteractive | TotalSegmentator test subset (8 CT cases x 12 prompts), mean Dice vs the ground-truth mask / agreement with the original / agreement with portable FP16 | 0.9688 | 0.9688 / 0.9999 | 0.9688 / 0.9999 | 0.9688 / 0.9997 |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 715d7cb5, 2026-11-15; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 715d7cb5, 2026-11-15; tensorrt: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks dc38c37c, 2026-11-17.
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 mask).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
nninteractive | 6e-05 / 0.0 | RTX 5060 Ti, torch 2.14.1+cu130 | vol_norm@44036d4da567:sm_120 |
Example output
No example rendered for this checkpoint yet.