SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.13591 · CVPR · 2022

Continual Test-Time Domain Adaptation

Dengxin Dai, Luc Van Gool, Switzerland, Olga Fink, Qin Wang

arXiv · PDF · Open in the Atlas

Code that ran

6 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 4 failures of our instrument; 5 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/2203.13591.json · badge: /api/ran/2203.13591.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
gist-ailab/domain-specific-block-selection-and-paired-view-pseudo-labeling-for-online-tta community
Papers with Code archive
4 ran · 3 no recorded run
qinenergy/cotta marked official in Papers with Code
Papers with Code archive
2 ran · 2 no recorded run
FunctionStatusWhere it lives
ColorJitterPro Ran
ran on a synthesized input · constructed an object; no result was computed
gist-ailab/domain-specific-block-selection-and-paired-view-pseudo-labeling-for-online-tta/classification/methods/cotta.py
code served (permissive licence) · get_code("a9926aa9bf223a28")
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, ColorJitterPro: 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 torchvision.transforms.functional as F
import torchvision.transforms as transforms
from torchvision.transforms import ColorJitter, Compose, Lambda
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create a small test image tensor (3 channels, 4x4 spatial dimensions)
# ColorJitterPro.forward expects a PIL Image or Tensor
# We'll use a tensor normalized to [0, 1] range
test_image = torch.rand(3, 4, 4)

ARGS = {
    'brightness': 0.2,
    'contrast': 0.2,
    'saturation': 0.2,
    'hue': 0.1,
    'gamma': 0.15
}
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 ColorJitterPro — 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 ColorJitterPro 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
ColorJitterPro Ran
ran on a synthesized input
qinenergy/cotta/imagenet/cotta.py
pointer only (licence: NOASSERTION) · get_code("b489338bf0c5151a")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, qinenergy/cotta (NOASSERTION). 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.

get_tta_transforms Ran
ran; our contract draft was wrong, not the code
gist-ailab/domain-specific-block-selection-and-paired-view-pseudo-labeling-for-online-tta/classification/methods/cotta.py
code served (permissive licence) · get_code("a8e9d937548d1d57")
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 Compose. 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 numpy as np
from PIL import Image
import torchvision.transforms as transforms
import torchvision.transforms.functional as F
from torchvision.transforms import ColorJitter, Compose, Lambda

torch.manual_seed(0)

class Clip(torch.nn.Module):
    def __init__(self, min_val=0.0, max_val=1.0):
        super().__init__()
        self.min_val = min_val
        self.max_val = max_val

    def forward(self, img):
        return torch.clip(img, self.min_val, self.max_val)

    def __repr__(self):
        return self.__class__.__name__ + '(min_val={0}, max_val={1})'.format(self.min_val, self.max_val)

class ColorJitterPro(ColorJitter):
    def __init__(self, brightness=0, contrast=0, saturation=0, hue=0, gamma=0):
        super().__init__(brightness, contrast, saturation, hue)
        self.gamma = self._check_input(gamma, 'gamma')

    def forward(self, img):
        fn_idx = torch.randperm(5)
        for fn_id in fn_idx:
            if fn_id == 0 and self.brightness is not None:
                brightness = self.brightness
                brightness_factor = torch.tensor(1.0).uniform_(brightness[0], brightness[1]).item()
                img = F.adjust_brightness(img, brightness_factor)
            if fn_id == 1 and self.contrast is not None:
                contrast = self.contrast
                contrast_factor = torch.tensor(1.0).uniform_(contrast[0], contrast[1]).item()
                img = F.adjust_contrast(img, contrast_factor)
            if fn_id == 2 and self.saturation is not None:
                saturation = self.saturation
                saturation_factor = torch.tensor(1.0).uniform_(saturation[0], saturation[1]).item()
                img = F.adjust_saturation(img, saturation_factor)
            if fn_id == 3 and self.hue is not None:
                hue = self.hue
                hue_factor = torch.tensor(1.0).uniform_(hue[0], hue[1]).item()
                img = F.adjust_hue(img, hue_factor)
            if fn_id == 4 and self.gamma is not None:
                gamma = self.gamma
                gamma_factor = torch.tensor(1.0).uniform_(gamma[0], gamma[1]).item()
                img = img.clamp(1e-08, 1.0)
                img = F.adjust_gamma(img, gamma_factor)
        return img

class GaussianNoise(torch.nn.Module):
    def __init__(self, mean=0.0, std=1.0):
        super().__init__()
        self.std = std
        self.mean = mean

    def forward(self, img):
        noise = torch.randn(img.size()) * self.std + self.mean
        noise = noise.to(img.device)
        return img + noise

    def __repr__(self):
        return self.__class__.__name__ + '(mean={0}, std={1})'.format(self.mean, self.std)

def get_tta_transforms(dataset, gaussian_std: float=0.005, soft=False, padding_mode='edge', cotta_augs=True):
    img_shape = (32, 32, 3) if 'cifar' in dataset else (224, 224, 3)
    n_pixels = img_shape[0]
    tta_transforms = [
        Clip(0.0, 1.0),
        ColorJitterPro(brightness=0.2, contrast=0.2, saturation=0.2, hue=0.1, gamma=0.2),
        GaussianNoise(mean=0.0, std=gaussian_std)
    ]
    return tta_transforms

ARGS = {
    'dataset': 'cifar10',
    'gaussian_std': 0.005,
    'soft': False,
    'padding_mode': 'edge',
    'cotta_augs': True
}
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 Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
softmax_entropy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
qinenergy/cotta/imagenet/cotta.py
pointer only (licence: NOASSERTION) · get_code("867d3ea552eca91a")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, qinenergy/cotta (NOASSERTION). 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.

softmax_entropy_cifar Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gist-ailab/domain-specific-block-selection-and-paired-view-pseudo-labeling-for-online-tta/classification/methods/cotta.py
code served (permissive licence) · get_code("0468f0b50e09906c")
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 1, 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

torch.manual_seed(0)

# The function softmax_entropy_cifar takes two tensors x and x_ema
# It calls:
# - x_ema.softmax(1) - softmax along dimension 1
# - x.log_softmax(1) - log_softmax along dimension 1
# - element-wise multiplication
# - .sum(1) - sum along dimension 1
# Both tensors need to support these operations, so they should be 2D tensors
# with shape (batch_size, num_classes)

# Create small tensors: batch size 2, num_classes 4
x = torch.randn(2, 4, requires_grad=True)
x_ema = torch.randn(2, 4)

ARGS = {
    'x': x,
    'x_ema': x_ema,
}
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 1, dtype family float — no output shape is stated: observe_signature.py could not observe it (import:OSError)
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_entropy_imagenet Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gist-ailab/domain-specific-block-selection-and-paired-view-pseudo-labeling-for-online-tta/classification/methods/cotta.py
code served (permissive licence) · get_code("1fc83fb4edd6a960")
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 1, 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

torch.manual_seed(0)

# The function expects two tensors with shape (batch_size, num_classes)
# It calls .softmax(1), .log_softmax(1), and .sum(1) on them
# So we need 2D tensors with batch dimension 0 and class dimension 1

batch_size = 2
num_classes = 4

x = torch.randn(batch_size, num_classes)
x_ema = torch.randn(batch_size, num_classes)

ARGS = {
    "x": x,
    "x_ema": x_ema,
}
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 1, dtype family float — no output shape is stated: observe_signature.py could not observe it (import:OSError)
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
CoTTA Not yet run
unverified (harvested, no recorded run)
gist-ailab/domain-specific-block-selection-and-paired-view-pseudo-labeling-for-online-tta/classification/methods/cotta.py
code served (permissive licence) · get_code("075386119a24268c")
How it ran

no invocation recorded.

CoTTA Not yet run
unverified (harvested, no recorded run)
qinenergy/cotta/imagenet/cotta.py
pointer only (licence: NOASSERTION) · get_code("37f58a96f8a7fef2")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, qinenergy/cotta (NOASSERTION). 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. No invocation recorded.

ResNetDomainNet126 Not yet run
unverified (harvested, no recorded run)
gist-ailab/domain-specific-block-selection-and-paired-view-pseudo-labeling-for-online-tta/classification/methods/cotta.py
code served (permissive licence) · get_code("83761eb5f1fb5613")
How it ran

no invocation recorded.

TTAMethod Not yet run
unverified (harvested, no recorded run)
gist-ailab/domain-specific-block-selection-and-paired-view-pseudo-labeling-for-online-tta/classification/methods/cotta.py
code served (permissive licence) · get_code("77fa9f7bf81480f2")
How it ran

no invocation recorded.

get_tta_transforms Not yet run
unverified (harvested, no recorded run)
qinenergy/cotta/imagenet/cotta.py
pointer only (licence: NOASSERTION) · get_code("3e1ce9963cc81750")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, qinenergy/cotta (NOASSERTION). 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. No invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 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
ColorJitterPro
brick of this paper's assembly: data_transform, helper
6 other papers
6 later · 1 only as an assembly brick
2303.13899 (2023-03)
Robust Test-Time Adaptation in Dynamic Scenarios
2311.18193 (2023-11)
Persistent Test-time Adaptation in Recurring Testing Scenarios
2503.20354 (2025-03)
SURGEON: Memory-Adaptive Fully Test-Time Adaptation via Dynamic Activation Sparsity
and 3 more not named here
softmax_entropy
brick of this paper's assembly: loss
2 other papers
2 later
2306.04344 (2023-06)
ViDA: Homeostatic Visual Domain Adapter for Continual Test Time Adaptation
2404.06065 (2024-04)
Unified Entropy Optimization for Open-Set Test-Time Adaptation
softmax_entropy_cifar
brick of this paper's assembly: loss
2 other papers
2 later
2310.20199 (2023-10)
In Search of Lost Online Test-time Adaptation: A Survey
2407.12128 (2024-07)
Distribution Alignment for Fully Test-Time Adaptation with Dynamic Online Data Streams
softmax_entropy_imagenet
brick of this paper's assembly: loss
2 other papers
2 later
2310.20199 (2023-10)
In Search of Lost Online Test-time Adaptation: A Survey
2407.12128 (2024-07)
Distribution Alignment for Fully Test-Time Adaptation with Dynamic Online Data Streams
get_tta_transforms
brick of this paper's assembly: data_transform
1 other paper
1 later
2503.20354 (2025-03)
SURGEON: Memory-Adaptive Fully Test-Time Adaptation via Dynamic Activation Sparsity

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

Test-time domain adaptation aims to adapt a source pretrained model to a target domain without using any source data. Existing works mainly consider the case where the target domain is static. However, real-world machine perception systems are running in non-stationary and continually changing environments where the target domain distribution can change over time. Existing methods, which are mostly based on self-training and entropy regularization, can suffer from these non-stationary environments. Due to the distribution shift over time in the target domain, pseudo-labels become unreliable. The noisy pseudolabels can further lead to error accumulation and catastrophic forgetting. To tackle these issues, we propose a continual test-time adaptation approach (CoTTA) which comprises two parts. Firstly, we propose to reduce the error accumulation by using weight-averaged and augmentationaveraged predictions which are often more accurate. On the other hand, to avoid catastrophic forgetting, we propose to stochastically restore a small part of the neurons to the source pre-trained weights during each iteration to help preserve source knowledge in the long-term. The proposed method enables the long-term adaptation for all parameters in the network. CoTTA is easy to implement and can be readily incorporated in off-the-shelf pre-trained models. We demonstrate the effectiveness of our approach on four classification tasks and a segmentation task for continual testtime adaptation, on which we outperform existing methods. Our code is available at https://qin.ee/cotta.

For agents

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

get_harvested_code_for_paper("2203.13591")
get_code_for_paper("2203.13591")
have("2203.13591")

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

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

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

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

Connect an agent — have() is free.