SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.01845 · CVPR · 2021

Unsupervised Multi-source Domain Adaptation Without Access to Source Data

Samet Oymak, Dripta Raychaudhuri, Sujoy Paul, Amit Roy-Chowdhury, Sk Miraj

arXiv · PDF · Open in the Atlas

Code that ran

4 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 1 failure of our instrument; 4 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/2104.01845.json · badge: /api/ran/2104.01845.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
driptaRC/DECISION community
Papers with Code archive
4 ran · 4 no recorded run
FunctionStatusWhere it lives
data_load Ran
ran; our contract draft was wrong, not the code
driptaRC/DECISION/adapt_multi.py
code served (permissive licence) · get_code("7ba25b84bcf91c5a")
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 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 numpy as np
from torchvision import transforms
from torch.utils.data import DataLoader, Dataset
from PIL import Image
import tempfile
import os

torch.manual_seed(0)

# Helper functions that are used in the code
def rgb_loader(path):
    with open(path, 'rb') as f:
        with Image.open(f) as img:
            return img.convert('RGB')

def l_loader(path):
    with open(path, 'rb') as f:
        with Image.open(f) as img:
            return img.convert('L')

def make_dataset(image_list, labels):
    if labels is not None:
        len_ = len(image_list)
        images = [(image_list[i].strip(), labels[i, :]) for i in range(len_)]
    elif len(image_list[0].split()) > 2:
        images = [(val.split()[0], np.array([int(la) for la in val.split()[1:]])) for val in image_list]
    else:
        images = [(val.split()[0], int(val.split()[1])) for val in image_list]
    return images

class ImageList_idx(Dataset):
    def __init__(self, image_list, labels=None, transform=None, target_transform=None, mode='RGB'):
        imgs = make_dataset(image_list, labels)
        if len(imgs) == 0:
            raise RuntimeError('Found 0 images')
        self.imgs = imgs
        self.transform = transform
        self.target_transform = target_transform
        if mode == 'RGB':
            self.loader = rgb_loader
        elif mode == 'L':
            self.loader = l_loader

    def __getitem__(self, index):
        path, target = self.imgs[index]
        img = self.loader(path)
        if self.transform is not None:
            img = self.transform(img)
        if self.target_transform is not None:
            target = self.target_transform(target)
        return (img, target, index)

    def __len__(self):
        return len(self.imgs)

def image_test(resize_size=256, crop_size=224, alexnet=False):
    normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
    return transforms.Compose([
        transforms.Resize((resize_size, resize_size)),
        transforms.CenterCrop(crop_size),
        transforms.ToTensor(),
        normalize
    ])

def image_train(resize_size=256, crop_size=224, alexnet=False):
    normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
    return transforms.Compose([
        transforms.Resize((resize_size, resize_size)),
        transforms.RandomCrop(crop_size),
        transforms.RandomHorizontalFlip(),
        transforms.ToTensor(),
        normalize
    ])

# Create temporary image files for testing
def create_temp_image(path):
    img = Image.new('RGB', (300, 300), color='red')
    img.save(path)

# Create temporary directory and image files
temp_dir = tempfile.mkdtemp()
img_path_1 = os.path.join(temp_dir, 'img1.jpg')
img_path_2 = os.path.join(temp_dir, 'img2.jpg')
img_path_3 = os.path.join(temp_dir, 'img3.jpg')
create_temp_image(img_path_1)
create_temp_image(img_path_2)
create_temp_image(img_path_3)

# Create dataset list files
tar_list_path = os.path.join(temp_dir, 'tar_list.txt')
test_list_path = os.path.join(temp_dir, 'test_list.txt')

with open(tar_list_path, 'w') as f:
    f.write(f"{img_path_1} 0\n")
    f.write(f"{img_path_2} 1\n")

with open(test_list_path, 'w') as f:
    f.write(f"{img_path_3} 0\n")

# Create args object
class Args:
    def __init__(self):
        self.batch_size = 2
        self.t_dset_path = tar_list_path
        self.test_dset_path = test_list_path
        self.worker = 0

ARGS = {
    'args': Args()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — 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
feat_bottleneck Ran
ran on a synthesized input · constructed an object; no result was computed
driptaRC/DECISION/adapt_multi.py
code served (permissive licence) · get_code("dc1fec3684ad2c3d")
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 an instance of its own class, feat_bottleneck: the run constructed the object and did not call it, so no result was computed. 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 = {
    'feature_dim': 128,
    'bottleneck_dim': 256,
    'type': 'bn'
}
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 feat_bottleneck — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a feat_bottleneck 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
feat_classifier Ran
ran on a synthesized input · constructed an object; no result was computed
driptaRC/DECISION/adapt_multi.py
code served (permissive licence) · get_code("be3e451f783e5bab")
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 an instance of its own class, feat_classifier: the run constructed the object and did not call it, so no result was computed. 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 torch.nn.utils.weight_norm as weightNorm

torch.manual_seed(0)

def init_weights(m):
    classname = m.__class__.__name__
    if classname.find('Conv2d') != -1 or classname.find('ConvTranspose2d') != -1:
        nn.init.kaiming_uniform_(m.weight)
        nn.init.zeros_(m.bias)
    elif classname.find('BatchNorm') != -1:
        nn.init.normal_(m.weight, 1.0, 0.02)
        nn.init.zeros_(m.bias)
    elif classname.find('Linear') != -1:
        nn.init.xavier_normal_(m.weight)
        nn.init.zeros_(m.bias)

class feat_classifier(nn.Module):

    def __init__(self, class_num, bottleneck_dim=256, type='linear'):
        super(feat_classifier, self).__init__()
        self.type = type
        if type == 'wn':
            self.fc = weightNorm(nn.Linear(bottleneck_dim, class_num), name='weight')
            self.fc.apply(init_weights)
        else:
            self.fc = nn.Linear(bottleneck_dim, class_num)
            self.fc.apply(init_weights)

    def forward(self, x):
        x = self.fc(x)
        return x

ARGS = {
    'class_num': 10,
    'bottleneck_dim': 256,
    'type': 'linear'
}
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 feat_classifier — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a feat_classifier 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
scalar Ran
ran on a synthesized input · constructed an object; no result was computed
driptaRC/DECISION/adapt_multi.py
code served (permissive licence) · get_code("2ef8d37c92cb2fed")
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 an instance of its own class, scalar: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 scalar class __init__ takes init_weights as a parameter
# It multiplies a tensor by init_weights, so init_weights should be a scalar value
init_weights_value = 0.5

ARGS = {
    'init_weights': init_weights_value
}
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 scalar — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a scalar 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
VGGBase Not yet run
unverified (harvested, no recorded run)
driptaRC/DECISION/adapt_multi.py
code served (permissive licence) · get_code("26f47e76a106ed2d")
How it ran

no invocation recorded.

cal_acc_multi Not yet run
unverified (harvested, no recorded run)
driptaRC/DECISION/adapt_multi.py
code served (permissive licence) · get_code("9a78b60ad452f989")
How it ran

no invocation recorded.

obtain_label Not yet run
unverified (harvested, no recorded run)
driptaRC/DECISION/adapt_multi.py
code served (permissive licence) · get_code("5b7bf620e4e50f11")
How it ran

no invocation recorded.

train_target Not yet run
unverified (harvested, no recorded run)
driptaRC/DECISION/adapt_multi.py
code served (permissive licence) · get_code("b1bbbdb6f251057d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 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
feat_classifier
brick of this paper's assembly: model
4 other papers
4 later · 3 only as an assembly brick
2205.04183 (2022-05)
Attracting and Dispersing: A Simple Approach for Source-free Domain Adaptation
2206.06640 (2022-06)
Confidence Score for Source-Free Unsupervised Domain Adaptation
2211.06612 (2022-11)
Divide and Contrast: Source-free Domain Adaptation via Adaptive Contrastive Learning
and 1 more not named here
VGGBase
brick of this paper's assembly: helper
2 other papers
2 later · 2 only as an assembly brick
2206.06640 (2022-06)
Confidence Score for Source-Free Unsupervised Domain Adaptation
2211.06612 (2022-11)
Divide and Contrast: Source-free Domain Adaptation via Adaptive Contrastive Learning
feat_bottleneck
brick of this paper's assembly: model
1 other paper
1 later · 1 only as an assembly brick
2206.06640 (2022-06)
Confidence Score for Source-Free Unsupervised Domain Adaptation

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

Unsupervised Domain Adaptation (UDA) aims to learn a predictor model for an unlabeled domain by transferring knowledge from a separate labeled source domain. However, most of these conventional UDA approaches make the strong assumption of having access to the source data during training, which may not be very practical due to privacy, security and storage concerns. A recent line of work addressed this problem and proposed an algorithm that transfers knowledge to the unlabeled target domain from a single source model without requiring access to the source data. However, for adaptation purposes, if there are multiple trained source models available to choose from, this method has to go through adapting each and every model individually, to check for the best source. Thus, we ask the question: can we find the optimal combination of source models, with no source data and without target labels, whose performance is no worse than the single best source? To answer this, we propose a novel and efficient algorithm which automatically combines the source models with suitable weights in such a way that it performs at least as good as the best source model. We provide intuitive theoretical insights to justify our claim. Furthermore, extensive experiments are conducted on several benchmark datasets to show the effectiveness of our algorithm, where in most cases, our method not only reaches best source accuracy but also outperforms it.

For agents

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

get_harvested_code_for_paper("2104.01845")
get_code_for_paper("2104.01845")
have("2104.01845")

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

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

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

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

Connect an agent — have() is free.