SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2211.11514 · 2022

ProSFDA: Prompt Learning based Source-free Domain Adaptation for Medical Image Segmentation

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 2 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/2211.11514.json · badge: /api/ran/2211.11514.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
shishuaihu/prosfda canonical (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
calculate_one_layer Ran
ran on a synthesized input
shishuaihu/prosfda/prosfda/loss_functions/bn_loss.py
code served (permissive licence) · get_code("f5878ee40dd6353b")
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

torch.manual_seed(0)

# The function expects:
# - this: a tuple/list with at least 2 elements, each indexable with [0] and [1]
#   and supporting .abs() and .mean() (torch tensors)
# - stored: a tuple/list with at least 2 elements, same as above
# - alpha: a float (default 0.01)

# Create two small tensors for each position
tensor_this_0 = torch.randn(2, 4)
tensor_this_1 = torch.randn(2, 3)

tensor_stored_0 = torch.randn(2, 4)
tensor_stored_1 = torch.randn(2, 3)

# Pack into tuples
this = (tensor_this_0, tensor_this_1)
stored = (tensor_stored_0, tensor_stored_1)

alpha = 0.01

ARGS = {
    "this": this,
    "stored": stored,
    "alpha": alpha
}
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
conv3x3 Ran
ran; our contract draft was wrong, not the code
shishuaihu/prosfda/prosfda/models/resnet.py
pointer only (licence: MIT); the stored copy get_code serves, from lixiaotong97/DSU, is pointer only (licence: NONE) · get_code("fac5364e2f53c6db")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from lixiaotong97/DSU, and GitHub detected no licence in that repository when it was checked. 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.

layer_1_loss Ran
ran on a synthesized input
shishuaihu/prosfda/prosfda/loss_functions/bn_loss.py
code served (permissive licence) · get_code("73308afd566872ce")
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)

# Create a small model with batch norm layer at index 1
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.rn = nn.Sequential(
            nn.Conv2d(3, 4, kernel_size=1),
            nn.BatchNorm2d(4),
            nn.Conv2d(4, 4, kernel_size=1),
        )
    
    def forward(self, x):
        return self.rn(x)

model = SimpleModel()

# Create bn_f which should be a list/tuple where bn_f[0] has .features attribute
# The function accesses bn_f[0].features.mean() and bn_f[0].features.var()
# So we need an object with a .features tensor
class FeaturesContainer:
    def __init__(self):
        # Create features tensor: (batch=2, channels=4, height=3, width=3)
        self.features = torch.randn(2, 4, 3, 3)

bn_f = [FeaturesContainer()]

# Create pretrained_params with the expected structure
# The function accesses pretrained_params['model_state_dict']['rn.1.running_mean'] 
# and pretrained_params['model_state_dict']['rn.1.running_var']
pretrained_params = {
    'model_state_dict': {
        'rn.1.running_mean': torch.randn(4),
        'rn.1.running_var': torch.randn(4),
    }
}

ARGS = {
    'model': model,
    'pretrained_params': pretrained_params,
    'bn_f': bn_f,
    'alpha': 0.01,
}
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
layer_2_loss Ran
ran on a synthesized input
shishuaihu/prosfda/prosfda/loss_functions/bn_loss.py
code served (permissive licence) · get_code("dc5105153ec7b38e")
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)

# Create a minimal model - not actually used in the function body
model = nn.Sequential()

# Create pretrained_params dict with the expected state_dict structure
# The function accesses keys like 'model_state_dict' which contains BatchNorm running_mean and running_var
pretrained_params = {
    'model_state_dict': {
        'rn.4.0.bn1.running_mean': torch.randn(4),
        'rn.4.0.bn1.running_var': torch.randn(4),
        'rn.4.0.bn2.running_mean': torch.randn(4),
        'rn.4.0.bn2.running_var': torch.randn(4),
        'rn.4.1.bn1.running_mean': torch.randn(4),
        'rn.4.1.bn1.running_var': torch.randn(4),
        'rn.4.1.bn2.running_mean': torch.randn(4),
        'rn.4.1.bn2.running_var': torch.randn(4),
        'rn.4.2.bn1.running_mean': torch.randn(4),
        'rn.4.2.bn1.running_var': torch.randn(4),
        'rn.4.2.bn2.running_mean': torch.randn(4),
        'rn.4.2.bn2.running_var': torch.randn(4),
        'rn.5.0.bn1.running_mean': torch.randn(4),
        'rn.5.0.bn1.running_var': torch.randn(4),
        'rn.5.0.bn2.running_mean': torch.randn(4),
        'rn.5.0.bn2.running_var': torch.randn(4),
        'rn.5.0.downsample.1.running_mean': torch.randn(4),
        'rn.5.0.downsample.1.running_var': torch.randn(4),
    }
}

# Create bn_f - a list/dict-like object where each element has a .features attribute
class FeatureHolder:
    def __init__(self, num_channels=4):
        # features shape: (batch, channels, height, width) -> will be reduced by mean(dim=(0, -2, -1))
        self.features = torch.randn(2, num_channels, 3, 3)

# bn_f needs to be indexable with indices 1-9
bn_f = {
    1: FeatureHolder(4),
    2: FeatureHolder(4),
    3: FeatureHolder(4),
    4: FeatureHolder(4),
    5: FeatureHolder(4),
    6: FeatureHolder(4),
    7: FeatureHolder(4),
    8: FeatureHolder(4),
    9: FeatureHolder(4),
}

ARGS = {
    'model': model,
    'pretrained_params': pretrained_params,
    'bn_f': bn_f,
    'alpha': 0.01,
}
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
resnet18 Ran
ran; our contract draft was wrong, not the code
shishuaihu/prosfda/prosfda/models/resnet.py
code served (permissive licence) · get_code("d38ea8161a11f731")
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 ResNet. 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)

ARGS = {
    'pretrained': False,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
resnet34 Ran
ran on a synthesized input
shishuaihu/prosfda/prosfda/models/resnet.py
code served (permissive licence) · get_code("3bf24868b1862168")
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 ResNet. 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
import math

torch.manual_seed(0)

ARGS = {
    "pretrained": False,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 2 the same month, 2 later) and 4 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
conv3x3 686 other papers
425 dated earlier, 9 the same month, 241 later, 11 same year, order not determinable · 31 only as an assembly brick
1406.2661 (2014-06)
Generative Adversarial Networks
1409.0575 (2014-09)
ImageNet Large Scale Visual Recognition Challenge
1412.6572 (2014-12)
Explaining and Harnessing Adversarial Examples
and 683 more not named here
resnet18 89 other papers
55 dated earlier, 2 the same month, 30 later, 2 same year, order not determinable
1705.09759 (2017-05)
CASENet: Deep Category-Aware Semantic Edge Detection
1801.07698 (2018-01)
ArcFace: Additive Angular Margin Loss for Deep Face Recognition
1803.00839 (2018-03)
Pose-Robust Face Recognition via Deep Residual Equivariant Mapping
and 86 more not named here

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-23.

Repositories linked to this paper

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

Abstract

The domain discrepancy existed between medical images acquired in different situations renders a major hurdle in deploying pre-trained medical image segmentation models for clinical use. Since it is less possible to distribute training data with the pre-trained model due to the huge data size and privacy concern, source-free unsupervised domain adaptation (SFDA) has recently been increasingly studied based on either pseudo labels or prior knowledge. However, the image features and probability maps used by pseudo label-based SFDA and the consistent prior assumption and the prior prediction network used by prior-guided SFDA may become less reliable when the domain discrepancy is large. In this paper, we propose a \textbf{Pro}mpt learning based \textbf{SFDA} (\textbf{ProSFDA}) method for medical image segmentation, which aims to improve the quality of domain adaption by minimizing explicitly the domain discrepancy. Specifically, in the prompt learning stage, we estimate source-domain images via adding a domain-aware prompt to target-domain images, then optimize the prompt via minimizing the statistic alignment loss, and thereby prompt the source model to generate reliable predictions on (altered) target-domain images. In the feature alignment stage, we also align the features of target-domain images and their styles-augmented counterparts to optimize the source model, and hence push the model to extract compact features. We evaluate our ProSFDA on two multi-domain medical image segmentation benchmarks. Our results indicate that the proposed ProSFDA outperforms substantially other SFDA methods and is even comparable to UDA methods. Code will be available at \url{https://github.com/ShishuaiHu/ProSFDA}.

For agents

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

get_harvested_code_for_paper("2211.11514")
get_code_for_paper("2211.11514")
have("2211.11514")

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

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

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

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

Connect an agent — have() is free.