SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.02885 · 2021

Category Contrast for Unsupervised Domain Adaptation in Visual Tasks

arXiv · PDF · Open in the Atlas

Code that ran

8 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, 1 violated it and 4 have no contract verdict; 2 failures of our instrument; 1 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/2106.02885.json · badge: /api/ran/2106.02885.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
jxhuang0508/CaCo canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
colorize_mask Ran
ran, honoured the contract we drafted
jxhuang0508/CaCo/caco_vanilla_finetune/evaluate_cityscapes.py
pointer only (licence: MIT); the stored copy get_code serves, from lym29/DASeg, is pointer only (licence: NONE) · get_code("21ac171a17099011")
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 lym29/DASeg, 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.

fast_hist Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jxhuang0508/CaCo/caco_vanilla_finetune/compute_iou.py
code served (permissive licence) · get_code("d86fb168246b16a4")
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 ndarray, ndim 2, dtype family int, shape (4, 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

# Analyze the function:
# - a: array-like, used with >= 0, < n comparisons, and .astype(int)
# - b: array-like, same shape as a, used in indexing
# - n: int, used as upper bound and for bincount minlength

# Create small numpy arrays for a and b
a = np.array([0, 1, 2, 3, 1, 2], dtype=np.int32)
b = np.array([0, 1, 2, 0, 1, 2], dtype=np.int32)
n = 4

ARGS = {
    "a": a,
    "b": b,
    "n": n
}
Setup block drafted by
a language model, Claude Haiku 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 2, dtype family int, shape (4, 4) — shape (4, 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
fliplr Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jxhuang0508/CaCo/caco_proda_finetune/utils.py
code served (permissive licence) · get_code("7b5ad493dd203454")
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 Tensor, ndim 4, dtype family float; no output shape is stated. 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 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

torch.manual_seed(0)

# The function expects an image tensor with at least 4 dimensions
# It accesses dimension 3 (the width dimension) and uses index_select
# Create a small 4D tensor: (batch, channels, height, width)
img = torch.randn(2, 3, 4, 5)

ARGS = {
    "img": img
}
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 Tensor, ndim 4, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
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_logger Ran
ran on a synthesized input
jxhuang0508/CaCo/caco_proda_finetune/calc_prototype.py
code served (permissive licence) · get_code("ac7a106d5297c790")
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 Logger. 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 os
import tempfile
import logging

# Create a temporary directory for the log file
logdir = tempfile.mkdtemp()

# Define ARGS dictionary with the parameter
ARGS = {
    'logdir': logdir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger 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
label2rgb Ran
ran on a synthesized input
jxhuang0508/CaCo/caco_proda_finetune/generate_pseudo_label.py
code served (permissive licence) · get_code("aa26e15f4a19aa99")
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 4, dtype family float, shape (2, 3, 4, 3) 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 numpy as np

torch.manual_seed(0)

# func parameter: a callable that takes a 2D numpy array and returns a 3D array (H, W, C)
def label_to_rgb_func(label_2d):
    """Convert a 2D label map to RGB image."""
    h, w = label_2d.shape
    # Return an RGB image (H, W, 3)
    rgb = np.random.randint(0, 256, (h, w, 3), dtype=np.uint8)
    return rgb.astype(np.float32)

# label parameter: tensor of shape (batch_size, 1, height, width)
label = torch.randint(0, 10, (2, 1, 4, 3), dtype=torch.long)

ARGS = {
    "func": label_to_rgb_func,
    "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 Tensor, ndim 4, dtype family float, shape (2, 3, 4, 3) — shape (2, 3, 4, 3) 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
label_mapping Ran
ran on a synthesized input
jxhuang0508/CaCo/caco_vanilla_finetune/compute_iou.py
code served (permissive licence) · get_code("bcfd47261d90f53e")
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 1, dtype family int, shape (7,) 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 input array with integer labels
input_array = np.array([0, 1, 2, 0, 1, 2, 0], dtype=np.int64)

# Create a mapping list where each element is [old_label, new_label]
# This maps: 0->10, 1->20, 2->30
mapping = [[0, 10], [1, 20], [2, 30]]

ARGS = {
    "input": input_array,
    "mapping": mapping
}
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 1, dtype family int, shape (7,) — shape (7,) 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
per_class_iu Ran
ran, violated the contract we drafted
jxhuang0508/CaCo/caco_vanilla_finetune/compute_iou.py
pointer only (licence: MIT); the stored copy get_code serves, from YanchaoYang/FDA, is pointer only (licence: NONE) · get_code("b1c59751f8968e99")
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 YanchaoYang/FDA, 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.

relative_path_to_absolute_path Ran
ran on a synthesized input
jxhuang0508/CaCo/caco_proda_finetune/parser_train.py
code served (permissive licence) · get_code("b7a6065c4f4d02be")
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 SimpleNamespace. 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 os
from types import SimpleNamespace

ARGS = {
    'opt': SimpleNamespace(
        rcrop='256,512',
        root='/tmp/test_root',
        resume_path='models/checkpoint.pth',
        src_rootpath='data/source',
        tgt_rootpath='data/target',
        path_LP='pretrained/lp_model.pth',
        path_soft='pretrained/soft_model.pth',
        name='experiment_001'
    )
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SimpleNamespace — a SimpleNamespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleNamespace 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
parser_ Not yet run
unverified (harvested, no recorded run)
jxhuang0508/CaCo/caco_proda_finetune/parser_train.py
code served (permissive licence) · get_code("a36dc031ef248c84")
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, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 1 the same month, 4 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
colorize_mask 15 other papers
13 dated earlier, 1 the same month, 1 later
1702.01105 (2017-02)
Joint 2D-3D-Semantic Data for Indoor Scene Understanding
1704.08509 (2017-04)
No More Discrimination: Cross City Adaptation of Road Scene Segmenters
1802.10349 (2018-02)
Learning to Adapt Structured Output Space for Semantic Segmentation
and 12 more not named here
fast_hist 12 other papers
10 dated earlier, 2 later
1511.00561 (2015-11)
SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation
1702.01105 (2017-02)
Joint 2D-3D-Semantic Data for Indoor Scene Understanding
1806.07373 (2018-06)
Few-Shot Segmentation Propagation with Guided Networks
and 9 more not named here
per_class_iu 6 other papers
4 dated earlier, 2 later
1702.01105 (2017-02)
Joint 2D-3D-Semantic Data for Indoor Scene Understanding
1809.09478 (2018-09)
Taking A Closer Look at Domain Shift: Category-level Adversaries for Semantics Consistent Domain Adaptation
2003.14032 (2020-03)
PolarNet: An Improved Grid Representation for Online LiDAR Point Clouds Semantic Segmentation
and 3 more not named here
fliplr 2 other papers
2 dated earlier
1912.11164 (2019-12)
Unsupervised Scene Adaptation with Memory Regularization in vivo
2003.03773 (2020-03)
Rectifying Pseudo Label Learning via Uncertainty Estimation for Domain Adaptive Semantic Segmentation
label_mapping 2 other papers
1 dated earlier, 1 later
1809.09478 (2018-09)
Taking A Closer Look at Domain Shift: Category-level Adversaries for Semantics Consistent Domain Adaptation
2202.06484 (2022-02)
D2ADA: Dynamic Density-aware Active Domain Adaptation for Semantic 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

Instance contrast for unsupervised representation learning has achieved great success in recent years. In this work, we explore the idea of instance contrastive learning in unsupervised domain adaptation (UDA) and propose a novel Category Contrast technique (CaCo) that introduces semantic priors on top of instance discrimination for visual UDA tasks. By considering instance contrastive learning as a dictionary look-up operation, we construct a semantics-aware dictionary with samples from both source and target domains where each target sample is assigned a (pseudo) category label based on the category priors of source samples. This allows category contrastive learning (between target queries and the category-level dictionary) for category-discriminative yet domain-invariant feature representations: samples of the same category (from either source or target domain) are pulled closer while those of different categories are pushed apart simultaneously. Extensive UDA experiments in multiple visual tasks (e.g., segmentation, classification and detection) show that CaCo achieves superior performance as compared with state-of-the-art methods. The experiments also demonstrate that CaCo is complementary to existing UDA methods and generalizable to other learning setups such as unsupervised model adaptation, open-/partial-set adaptation etc.

For agents

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

get_harvested_code_for_paper("2106.02885")
get_code_for_paper("2106.02885")
have("2106.02885")

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

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

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

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

Connect an agent — have() is free.