SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2212.04497 · 2022

UNETR++: Delving into Efficient and Accurate 3D Medical Image Segmentation

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 3 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2212.04497.json · badge: /api/ran/2212.04497.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
amshaker/unetr_plus_plus canonical (classifier label)
classifier basis: plan_row
6 ran · 2 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
check_input_folder_and_return_caseIDs Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from mrgiovanni/suprem
pointer only; the stored copy get_code serves, from mrgiovanni/suprem, is pointer only (licence: NOASSERTION) · get_code("6789364bbb259134")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

create_region_from_mask Ran
ran on a synthesized input
amshaker/unetr_plus_plus/unetr_pp/evaluation/region_based_evaluation.py
code served (permissive licence) · get_code("1df16eb62440aca6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family int, shape (3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a sample mask with different label values
mask = np.array([
    [0, 1, 2, 3],
    [1, 2, 0, 1],
    [3, 3, 1, 2]
], dtype=np.uint8)

# Define labels to join into a single region
join_labels = (1, 2)

ARGS = {
    "mask": mask,
    "join_labels": join_labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (3, 4) — shape (3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
dice Ran
ran on a synthesized input
amshaker/unetr_plus_plus/unetr_pp/inference_acdc.py
code served (permissive licence) · get_code("e65b0d891efe4fc8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# The dice function expects:
# - pred: array-like with .sum() method and logical operations support
# - label: array-like with .sum() method and logical operations support

# Create simple numpy arrays representing predictions and labels
# These should be binary (0s and 1s) as they're used with np.logical_and
pred = np.array([1, 0, 1, 1, 0, 1, 0, 0], dtype=bool)
label = np.array([1, 1, 0, 1, 0, 1, 1, 0], dtype=bool)

ARGS = {
    "pred": pred,
    "label": label
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
jaccard Ran
ran, honoured the contract we drafted
amshaker/unetr_plus_plus/unetr_pp/evaluation/metrics.py
code served (permissive licence) · get_code("12b5ba241c136bb3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create test and reference numpy arrays with matching shapes
test = np.array([
    [[1, 0, 1, 0],
     [0, 1, 0, 1]],
    [[1, 1, 0, 0],
     [0, 0, 1, 1]]
], dtype=np.int32)

reference = np.array([
    [[1, 0, 0, 0],
     [0, 1, 0, 0]],
    [[1, 0, 0, 0],
     [0, 0, 1, 0]]
], dtype=np.int32)

# Create a ConfusionMatrix instance
class ConfusionMatrix:
    def __init__(self, test=None, reference=None):
        self.tp = None
        self.fp = None
        self.tn = None
        self.fn = None
        self.size = None
        self.reference_empty = None
        self.reference_full = None
        self.test_empty = None
        self.test_full = None
        self.set_reference(reference)
        self.set_test(test)

    def set_test(self, test):
        self.test = test
        self.reset()

    def set_reference(self, reference):
        self.reference = reference
        self.reset()

    def reset(self):
        self.tp = None
        self.fp = None
        self.tn = None
        self.fn = None
        self.size = None
        self.test_empty = None
        self.test_full = None
        self.reference_empty = None
        self.reference_full = None

    def compute(self):
        if self.test is None or self.reference is None:
            raise ValueError("'test' and 'reference' must both be set to compute confusion matrix.")
        self.tp = int(((self.test != 0) * (self.reference != 0)).sum())
        self.fp = int(((self.test != 0) * (self.reference == 0)).sum())
        self.tn = int(((self.test == 0) * (self.reference == 0)).sum())
        self.fn = int(((self.test == 0) * (self.reference != 0)).sum())
        self.size = int(np.prod(self.reference.shape, dtype=np.int64))
        self.test_empty = not np.any(self.test)
        self.test_full = np.all(self.test)
        self.reference_empty = not np.any(self.reference)
        self.reference_full = np.all(self.reference)

    def get_matrix(self):
        for entry in (self.tp, self.fp, self.tn, self.fn):
            if entry is None:
                self.compute()
                break
        return (self.tp, self.fp, self.tn, self.fn)

    def get_size(self):
        if self.size is None:
            self.compute()
        return self.size

    def get_existence(self):
        for case in (self.test_empty, self.test_full, self.reference_empty, self.reference_full):
            if case is None:
                self.compute()
                break
        return (self.test_empty, self.test_full, self.reference_empty, self.reference_full)

confusion_matrix = ConfusionMatrix(test, reference)

ARGS = {
    'test': None,
    'reference': None,
    'confusion_matrix': confusion_matrix,
    'nan_for_nonexisting': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
precision Ran
ran; our contract draft was wrong, not the code
amshaker/unetr_plus_plus/unetr_pp/evaluation/metrics.py
code served (permissive licence) · get_code("035dc40fdafe0275")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create test and reference numpy arrays
# They need to be the same shape for the assertion to pass
test_array = np.array([[1, 0, 1, 0],
                       [1, 1, 0, 0]])

reference_array = np.array([[1, 0, 1, 1],
                            [1, 0, 0, 0]])

# Create a ConfusionMatrix instance
confusion_matrix_obj = None  # Will be None initially, letting the function create it

ARGS = {
    'test': test_array,
    'reference': reference_array,
    'confusion_matrix': confusion_matrix_obj,
    'nan_for_nonexisting': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
process_label Ran
ran on a synthesized input
amshaker/unetr_plus_plus/unetr_pp/inference_acdc.py
code served (permissive licence) · get_code("c11a7687e5a53d69")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function process_label takes a label tensor/array and compares it to values 1, 2, 3
# It returns three boolean tensors/arrays
# We need to provide a label argument that supports == comparison

label = torch.tensor([1, 2, 3, 1, 2, 3], dtype=torch.long)

ARGS = {
    "label": label
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
run_evaluation Ran
ran; our contract draft was wrong, not the code
amshaker/unetr_plus_plus/unetr_pp/evaluation/evaluator.py
code served (permissive licence) · get_code("e7033836f7ce1958")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class MockEvaluator:
    def __init__(self):
        self.labels = None
        self.test_data = None
        self.ref_data = None
    
    def set_test(self, test):
        self.test_data = test
    
    def set_reference(self, ref):
        self.ref_data = ref
    
    def construct_labels(self):
        self.labels = torch.tensor([0, 1, 0, 1])
    
    def evaluate(self, **metric_kwargs):
        return {
            'accuracy': 0.85,
            'precision': 0.88,
            'recall': 0.82
        }

test = "test_dataset_001"
ref = "reference_dataset_001"
evaluator = MockEvaluator()
metric_kwargs = {'threshold': 0.5, 'average': 'macro'}

ARGS = {
    'args': (test, ref, evaluator, metric_kwargs)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
dice Not yet run
unverified (harvested, no recorded run)
amshaker/unetr_plus_plus/unetr_pp/evaluation/metrics.py
code served (permissive licence) · get_code("a85d8587c247d950")
How it ran

no invocation recorded.

new_dice Not yet run
unverified (harvested, no recorded run)
amshaker/unetr_plus_plus/unetr_pp/inference_tumor.py
code served (permissive licence) · get_code("2d2f06b87fe3610c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 7 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 5 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
dice 4 other papers
1 dated earlier, 3 later
1809.10486 (2018-09)
nnU-Net: Self-adapting Framework for U-Net-Based Medical Image Segmentation
2410.09299 (2024-10)
Hierarchical uncertainty estimation for learning-based registration in neuroimaging
2506.23468 (2025-06)
NavM rph: A Self-Evolving World Model for Vision-and-Language Navigation in Continuous Environments
and 1 more not named here
jaccard 4 other papers
1 dated earlier, 3 later
1809.10486 (2018-09)
nnU-Net: Self-adapting Framework for U-Net-Based Medical Image Segmentation
2410.09299 (2024-10)
Hierarchical uncertainty estimation for learning-based registration in neuroimaging
2506.23468 (2025-06)
NavM rph: A Self-Evolving World Model for Vision-and-Language Navigation in Continuous Environments
and 1 more not named here
precision 4 other papers
1 dated earlier, 3 later
1809.10486 (2018-09)
nnU-Net: Self-adapting Framework for U-Net-Based Medical Image Segmentation
2410.09299 (2024-10)
Hierarchical uncertainty estimation for learning-based registration in neuroimaging
2506.23468 (2025-06)
NavM rph: A Self-Evolving World Model for Vision-and-Language Navigation in Continuous Environments
and 1 more not named here
check_input_folder_and_return_caseIDs 3 other papers
3 later
2309.05446 (2023-09)
A Localization-to-Segmentation Framework for Automatic Tumor Segmentation in Whole-Body PET/CT Images
2407.16697 (2024-07)
AbdomenAtlas: A Large-Scale, Detailed-Annotated, & Multi-Center Dataset for Efficient Transfer Learning and Open Algorithmic Benchmarking
2501.11253 (2025-01)
How Well Do Supervised 3D Models Transfer to Medical Imaging Tasks?
dice 2 other papers
1 dated earlier, 1 later
2111.13300 (2021-11)
A Robust Volumetric Transformer for Accurate 3D Tumor Segmentation
2306.13731 (2023-06)
How to Efficiently Adapt Large Segmentation Model(SAM) to Medical Images
run_evaluation 2 other papers
2 dated earlier
1809.10486 (2018-09)
nnU-Net: Self-adapting Framework for U-Net-Based Medical Image Segmentation
2109.03201 (2021-09)
nnFormer: Interleaved Transformer for Volumetric Segmentation
new_dice 1 other paper
1 dated earlier
2111.13300 (2021-11)
A Robust Volumetric Transformer for Accurate 3D Tumor Segmentation

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Owing to the success of transformer models, recent works study their applicability in 3D medical segmentation tasks. Within the transformer models, the self-attention mechanism is one of the main building blocks that strives to capture long-range dependencies. However, the self-attention operation has quadratic complexity which proves to be a computational bottleneck, especially in volumetric medical imaging, where the inputs are 3D with numerous slices. In this paper, we propose a 3D medical image segmentation approach, named UNETR++, that offers both high-quality segmentation masks as well as efficiency in terms of parameters, compute cost, and inference speed. The core of our design is the introduction of a novel efficient paired attention (EPA) block that efficiently learns spatial and channel-wise discriminative features using a pair of inter-dependent branches based on spatial and channel attention. Our spatial attention formulation is efficient having linear complexity with respect to the input sequence length. To enable communication between spatial and channel-focused branches, we share the weights of query and key mapping functions that provide a complimentary benefit (paired attention), while also reducing the overall network parameters. Our extensive evaluations on five benchmarks, Synapse, BTCV, ACDC, BRaTs, and Decathlon-Lung, reveal the effectiveness of our contributions in terms of both efficiency and accuracy. On Synapse, our UNETR++ sets a new state-of-the-art with a Dice Score of 87.2%, while being significantly efficient with a reduction of over 71% in terms of both parameters and FLOPs, compared to the best method in the literature. Code: https://github.com/Amshaker/unetr_plus_plus.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2212.04497")
get_code_for_paper("2212.04497")
have("2212.04497")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2212.04497.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2212.04497.svg)](https://syntology.ai/paper/2212.04497)

Connect an agent — have() is free.