SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1806.05034 · 2018

A Probabilistic U-Net for Segmentation of Ambiguous Images

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; 2 honoured the contract we drafted, 1 violated it and 2 have no contract verdict; 2 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/1806.05034.json · badge: /api/ran/1806.05034.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
MIC-DKFZ/probabilistic_unet community (classifier label)
classifier basis: plan_row
4 ran · 2 no recorded run
cviviers/prob_3d_segmentation reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
jenspetersen/probabilistic-unet reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
stefanknegt/Probabilistic-Unet-Pytorch community (classifier label)
classifier basis not recorded on the link
1 ran · 0 no recorded run
FunctionStatusWhere it lives
get_array_of_modes Ran
ran; our contract draft was wrong, not the code
MIC-DKFZ/probabilistic_unet/evaluation/eval_cityscapes.py
code served (permissive licence) · get_code("65cc4cdcce48e4cb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned ndarray, ndim 5, dtype family int, shape (32, 2, 3, 4, 5) 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
import torch

torch.manual_seed(0)

# Create a config object with the required attributes
class Config:
    def __init__(self):
        # Define label_switches: dict with class names and their sampling probabilities
        self.label_switches = {
            'class_a': 0.3,
            'class_b': 0.5,
            'class_c': 0.7,
            'class_d': 0.2,
            'class_e': 0.6
        }
        self.exp_modes = 5
        self.num_modes = 2 ** self.exp_modes  # 32 modes
        
        # Create name2trainId mapping
        # Maps original class names to IDs and their switched versions to different IDs
        self.name2trainId = {
            'class_a': 1,
            'class_a_2': 11,
            'class_b': 2,
            'class_b_2': 12,
            'class_c': 3,
            'class_c_2': 13,
            'class_d': 4,
            'class_d_2': 14,
            'class_e': 5,
            'class_e_2': 15
        }

cf = Config()

# Create a small 4D segmentation array (batch, height, width, depth or similar)
# Using shape (2, 3, 4, 5) to have distinct dimensions
seg = np.array([
    [
        [[1, 2, 3, 4, 5],
         [2, 3, 1, 2, 4],
         [3, 1, 5, 3, 2],
         [4, 5, 2, 1, 3]],
        [[5, 4, 3, 2, 1],
         [1, 2, 3, 4, 5],
         [2, 3, 4, 5, 1],
         [3, 4, 5, 1, 2]],
        [[1, 1, 2, 2, 3],
         [3, 4, 4, 5, 5],
         [1, 2, 3, 4, 5],
         [5, 4, 3, 2, 1]]
    ],
    [
        [[5, 5, 4, 4, 3],
         [3, 2, 2, 1, 1],
         [4, 3, 2, 1, 5],
         [1, 2, 3, 4, 5]],
        [[2, 3, 4, 5, 1],
         [1, 5, 4, 3, 2],
         [3, 2, 1, 5, 4],
         [4, 3, 2, 1, 5]],
        [[1, 2, 3, 4, 5],
         [5, 4, 3, 2, 1],
         [2, 3, 4, 5, 1],
         [1, 5, 2, 4, 3]]
    ]
], dtype=np.uint8)

ARGS = {
    'cf': cf,
    'seg': seg
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 5, dtype family int, shape (32, 2, 3, 4, 5) — shape (32, 2, 3, 4, 5) 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
get_array_of_samples Ran
ran, honoured the contract we drafted
MIC-DKFZ/probabilistic_unet/evaluation/eval_cityscapes.py
code served (permissive licence) · get_code("d600a3dd3ae5b79f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned ndarray, ndim 6, dtype family int, shape (3, 1, 1, 8, 12, 10) 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
import os
import tempfile

# Create a temporary directory for the test
temp_dir = tempfile.mkdtemp()

# Create a simple config object
class Config:
    def __init__(self):
        self.num_samples = 3
        self.patch_size = (8, 12, 10)  # 3D patch size (distinct dimensions)
        self.out_dir = temp_dir

cf = Config()

# Create some sample files
img_key = "test_image"

# Create dummy segmentation samples and save them
for i in range(cf.num_samples):
    sample_path = os.path.join(cf.out_dir, '{}_sample{}_labelIds.npy'.format(img_key, i))
    # Create a sample with shape (1, 1, 8, 12, 10) to match what the function expects
    sample_data = np.random.randint(0, 5, size=(1, 1) + cf.patch_size, dtype=np.uint8)
    np.save(sample_path, sample_data)

ARGS = {
    'cf': cf,
    'img_key': img_key
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 6, dtype family int, shape (3, 1, 1, 8, 12, 10) — shape (3, 1, 1, 8, 12, 10) 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
get_model Ran
ran; our contract draft was wrong, not the code
cviviers/prob_3d_segmentation/pytorch3dunet/unet3d/model.py
code served (permissive licence) · get_code("7c3bc634ea8906ac")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned UNet3D. 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)

# The function imports from 'pytorch3dunet.unet3d.model' and looks for a class
# We need to create a mock module structure since we can't actually import it

import sys
from types import ModuleType

# Create mock module structure
pytorch3dunet = ModuleType('pytorch3dunet')
unet3d = ModuleType('pytorch3dunet.unet3d')
model_module = ModuleType('pytorch3dunet.unet3d.model')

sys.modules['pytorch3dunet'] = pytorch3dunet
sys.modules['pytorch3dunet.unet3d'] = unet3d
sys.modules['pytorch3dunet.unet3d.model'] = model_module

# Create a simple mock model class that can be instantiated
class UNet3D(nn.Module):
    def __init__(self, name=None, in_channels=1, out_channels=2, f_maps=16, **kwargs):
        super(UNet3D, self).__init__()
        self.name = name
        self.in_channels = in_channels
        self.out_channels = out_channels
        self.f_maps = f_maps
        # Simple conv layer to make it a valid nn.Module
        self.conv = nn.Conv3d(in_channels, out_channels, kernel_size=3, padding=1)
    
    def forward(self, x):
        return self.conv(x)

# Add the class to the mock module
setattr(model_module, 'UNet3D', UNet3D)

# Create model_config that will be passed to get_model
model_config = {
    'name': 'UNet3D',
    'in_channels': 1,
    'out_channels': 2,
    'f_maps': 16,
    'num_groups': 8,
    'final_sigmoid': True
}

ARGS = {
    'model_config': model_config
}
Setup block drafted by
a language model, Claude Sonnet 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 UNet3D — a UNet3D output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a UNet3D 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
is_conv Ran
ran, violated the contract we drafted
jenspetersen/probabilistic-unet/probunet/model.py
code served (permissive licence) · get_code("0a5cbe60b0814cee")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned bool, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function checks if `op` is a convolution type or instance
# We can test with different cases:
# 1. A Conv2d class (type)
# 2. A Conv2d instance
# 3. Some other type/instance

# Let's use a Conv2d instance as the test case
conv_instance = nn.Conv2d(in_channels=3, out_channels=8, kernel_size=3)

ARGS = {
    'op': conv_instance
}
Setup block drafted by
a language model, Claude Sonnet 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 bool, 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
l2_regularisation Ran
ran, honoured the contract we drafted
stefanknegt/Probabilistic-Unet-Pytorch/utils.py
code served (permissive licence) · get_code("c23b05634625d281")
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 Tensor, 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 torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

m = SimpleModel()

ARGS = {
    "m": m
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, 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
numpy_one_hot Ran
ran on a synthesized input
MIC-DKFZ/probabilistic_unet/utils/training_utils.py
code served (permissive licence) · get_code("73daa4c05abbf736")
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 3, dtype family float, shape (2, 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 small integer-labeled array
label_arr = np.array([[0, 1, 2], [1, 3, 0]])

# Number of classes
num_classes = 4

ARGS = {
    "label_arr": label_arr,
    "num_classes": num_classes
}
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 3, dtype family float, shape (2, 3, 4) — shape (2, 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
softmax_2_onehot Ran
ran on a synthesized input
MIC-DKFZ/probabilistic_unet/utils/training_utils.py
code served (permissive licence) · get_code("394d537f276d03c2")
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 float, shape (2, 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 small softmax output array
# Shape: (batch_size=2, num_classes=4)
# Values should represent softmax probabilities (sum to 1 across axis 1)
arr = np.array([
    [0.7, 0.2, 0.05, 0.05],
    [0.1, 0.1, 0.1, 0.7]
], dtype=np.float32)

ARGS = {
    "arr": arr
}
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 float, shape (2, 4) — shape (2, 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
ce_loss Not yet run
unverified (harvested, no recorded run)
MIC-DKFZ/probabilistic_unet/utils/training_utils.py
code served (permissive licence) · get_code("1154f612e91c9287")
How it ran

no invocation recorded.

get_mode_counts Not yet run
unverified (harvested, no recorded run)
MIC-DKFZ/probabilistic_unet/evaluation/eval_cityscapes.py
code served (permissive licence) · get_code("0621b823c2321b0f")
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, 4 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 4 later) and 5 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
l2_regularisation 6 other papers
6 later
1907.01949 (2019-07)
Supervised Uncertainty Quantification for Segmentation with Multiple Annotations
2203.04895 (2022-03)
Joint Learning of Salient Object Detection, Depth Estimation and Contour Extraction
2207.02466 (2022-07)
GLENet: Boosting 3D Object Detectors with Generative Label Uncertainty Estimation
and 3 more not named here
get_array_of_modes 1 other paper
1 later
1905.13077 (2019-05)
A Hierarchical Probabilistic U-Net for Modeling Multi-Scale Ambiguities
get_array_of_samples 1 other paper
1 later
1905.13077 (2019-05)
A Hierarchical Probabilistic U-Net for Modeling Multi-Scale Ambiguities
get_mode_counts 1 other paper
1 later
1905.13077 (2019-05)
A Hierarchical Probabilistic U-Net for Modeling Multi-Scale Ambiguities

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

Many real-world vision problems suffer from inherent ambiguities. In clinical applications for example, it might not be clear from a CT scan alone which particular region is cancer tissue. Therefore a group of graders typically produces a set of diverse but plausible segmentations. We consider the task of learning a distribution over segmentations given an input. To this end we propose a generative segmentation model based on a combination of a U-Net with a conditional variational autoencoder that is capable of efficiently producing an unlimited number of plausible hypotheses. We show on a lung abnormalities segmentation task and on a Cityscapes segmentation task that our model reproduces the possible segmentation variants as well as the frequencies with which they occur, doing so significantly better than published approaches. These models could have a high impact in real-world applications, such as being used as clinical decision-making algorithms accounting for multiple plausible semantic segmentation hypotheses to provide possible diagnoses and recommend further actions to resolve the present ambiguities.

For agents

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

get_harvested_code_for_paper("1806.05034")
get_code_for_paper("1806.05034")
have("1806.05034")

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

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

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

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

Connect an agent — have() is free.