[CVPR 2022] CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation

Related tags

Deep Learning cotta
Overview

CoTTA

Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation

Prerequisite

Please create and activate the following conda envrionment. To reproduce our results, please kindly create and use this environment.

# It may take several minutes for conda to solve the environment
conda update conda
conda env create -f environment.yml
conda activate cotta 

Experiment

CIFAR10-to-CIFAR10C-standard task

# Tested on RTX2080TI
cd cifar
bash run_cifar10.sh 

CIFAR10-to-CIFAR10C-gradual task

# Tested on RTX2080TI
bash run_cifar10_gradual.sh

CIFAR100-to-CIFAR100C task

# Tested on RTX3090
bash run_cifar100.sh

ImageNet-to-ImageNetC task

# Tested on RTX3090
cd imagenet
bash run.sh

Citation

Please cite our work if you find it useful.

@inproceedings{wang2022continual,
  title={Continual Test-Time Domain Adaptation},
  author={Wang, Qin and Fink, Olga and Van Gool, Luc and Dai, Dengxin},
  booktitle={Proceedings of Conference on Computer Vision and Pattern Recognition},
  year={2022}
}

Acknowledgement

Data links

For questions regarding the code, please contact [email protected] .

Comments
  • [resolved, user is now able to reproduce results for ImageNet] ImageNet experiments

    [resolved, user is now able to reproduce results for ImageNet] ImageNet experiments

    Hi, thanks for releasing the code. When I reproduce the table 6 Imagenet-C result in your paper (severity level 5), the source error is 82.4 and the BN adapt is 72.1, which is the same as your paper. However, Tent result is 69.2 and the CoTTA result is about 71.6, which is inconsistent with your paper, in which the tent is 66.5 and CoTTA is 63. Could you explain why the result is different? Thanks

    opened by HaoYang-219 10
  • Error in loading ckpt/cifar10/corruptions/Standard.pt

    Error in loading ckpt/cifar10/corruptions/Standard.pt

    The error is "_pickle.UnpicklingError: invalid load key, '<'." when checkpoint = torch.load(model_path, map_location=torch.device('cpu')), line 127 in utils.py is executed. The reported size of Standard.pt is 2.2K. Is this file complete?

    opened by mohazzam1 6
  • Question about the base_model in google drive

    Question about the base_model in google drive

    Hi, For some reason, I can't use request to download the base model from Google Drive, but I can download it by entering the Google Drive link from Chrome, and the link is "https://docs.google.com/uc?export=download&id=1t98aEuzeTL8P7Kpd5DIrCoCL21BNZUhC". The name of the file in the link is "natural.pt.tar", how do I change it to "Standard.pt"? Can I rename it directly? Hope to get your help.

    opened by YananGu 6
  • about the choice of p_th

    about the choice of p_th

    Awesome work, but a little question:

    Therefore, we use a threshold $p_{th}$ to filter the images, and do not apply augmentations on those with high confidence. More specifically, we design $p_{th} = conf^S-\delta$, where $conf^S$ is the 5% quantile for the softmax predictions’ confidence on the source images from the source model $f_\theta$

    In your code, 0.74 was the 5% quantile for cityscapes. So ,how is this value calculated?

    Kind regards.

    opened by Renp1ngs 5
  • Creating Segformer environment

    Creating Segformer environment

    Hi Qin, I encounter an error (Pip failed) while creating the environment for segmentation "Segformer" using conda, is it possible to re-write your environment locally again ? i.e. on your local workstation, not a cluster?

    opened by Yussef93 4
  • Questions about the moving average

    Questions about the moving average

    Hi! Thanks for sharing your code. This work is interesting! I have some questions about the updating of the teacher model. It would be great if you could answer them. The original Mean Teacher is trained with both labeled and unlabeled data. The consistency loss then calculates the difference between the outputs from the student and the teacher model. The author did not have high confidence about the feasibility of training Mean teacher without any labeled data. https://github.com/CuriousAI/mean-teacher/issues/24
    In your code, the student model update with the softmax_entropy and the teacher model accumulated the historical weights from the student model. I am wonder how could you avoid such performance degradation on the teacher model when there is no other guidance on the student model. I have tried to implement the Mean Teacher model without labeled data training on the student model. The training results shows that the performance of the teacher model dropped when updated with exponential moving average every steps. Had you ever encountered such problems?

    opened by Chloe1997 4
  • Questions around code and paper

    Questions around code and paper

    Hi,

    Thanks for patiently answering all the questions in previous issues. The paper is interesting, congratulations! I had a few questions and it would be great if you could help me understand this better :

    1. Which model is being used for evaluation? The model running on severity 5, has it already learnt/updated from all previous severities? When you move from one corruption to next while evaluating, has the model learnt from the last one or has it been tested individually on each corruption?
    2. In each batch, is there only one severity and one corruption?
    opened by ShambhaviCodes 4
  • https://drive.qin.ee/ cannot be accessed

    https://drive.qin.ee/ cannot be accessed

    Dear author, thank you for exposing the code. But when I want to reproduce the code of segmentation, I can't open the URL you provided. I hope you can answer my doubts. Thank you again!

    opened by xinyanghuang7 2
  • Confusion Regarding Batch Size

    Confusion Regarding Batch Size

    Hi, I have a query regarding the batch size. In the paper you have written, "We update the model for one step at each iteration (i.e. one gradient step per test point).". This seems to suggest that the BATCH_SIZE = 1.

    But in the config file, it is BATCH_SIZE = 200. [See here: link] So is the actual batch size 200 (and not 1) for the experiments in your paper?

    I have tried setting the batch size to 1, but the results deteriorate drastically.

    A clarification would be helpful. Thank you.

    opened by dhanajitb 2
  • Some question about the paper

    Some question about the paper

    Thanks for yout work, which inspired me a lot. And this work is highly corresponding to the continual learning or lifelong learning. Have you compared with other continual learning methods?

    opened by sunrainyg 2
  • Some questions about restoration design and the restoration factor

    Some questions about restoration design and the restoration factor

    Hi, author! Thanks again for your sharing codes. I've fixed the problems occurring in reproducing CIFAR-10C results by replacing the model back to the standard one. And I am here for some questions in your proposed restoration design. We know that "Stochastic Restoration" in CoTTA is designed to avoid catastrophic forgetting. The thing that bothers me is, in CL, avoiding catastrophic forgetting is needed when you want a model to solve all the tasks/domains that have been seen previously. But when all you need is just to keep high performance in current tasks/domains (i.e., online performance), what might be the reason for choosing restoration to avoid catastrophic forgetting (i.e., keep previous knowledge)? I know it achieves better results, and as the paper mentioned, it helps recovery after encountering hard examples. And I'll still appreciate it very much if there is any answer for my puzzles (it is also totally okay not to do so :) ). Or maybe is there any advice for the restoration factor setup (why CoTTA sets 0.01) ? :)

    opened by kadmkbl 2
Owner
Qin Wang
[email protected], ETH Zürich
Qin Wang
code for our paper "Source Data-absent Unsupervised Domain Adaptation through Hypothesis Transfer and Labeling Transfer"

SHOT++ Code for our TPAMI submission "Source Data-absent Unsupervised Domain Adaptation through Hypothesis Transfer and Labeling Transfer" that is ext

null 74 Nov 27, 2022
Code for our NeurIPS 2021 paper 'Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation'

Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation (NeurIPS 2021) Code for our NeurIPS 2021 paper 'Exploiting the Intri

Shiqi Yang 51 Dec 5, 2022
Adversarial Adaptation with Distillation for BERT Unsupervised Domain Adaptation

Knowledge Distillation for BERT Unsupervised Domain Adaptation Official PyTorch implementation | Paper Abstract A pre-trained language model, BERT, ha

Minho Ryu 29 Nov 30, 2022
Code for CVPR2021 "Visualizing Adapted Knowledge in Domain Transfer". Visualization for domain adaptation. #explainable-ai

Visualizing Adapted Knowledge in Domain Transfer @inproceedings{hou2021visualizing, title={Visualizing Adapted Knowledge in Domain Transfer}, auth

Yunzhong Hou 77 Oct 29, 2022
Official repository for the paper "Self-Supervised Models are Continual Learners" (CVPR 2022)

Self-Supervised Models are Continual Learners This is the official repository for the paper: Self-Supervised Models are Continual Learners Enrico Fini

Enrico Fini 70 Nov 26, 2022
Code base for "On-the-Fly Test-time Adaptation for Medical Image Segmentation"

On-the-Fly Adaptation Official Pytorch Code base for On-the-Fly Test-time Adaptation for Medical Image Segmentation Paper Introduction One major probl

Jeya Maria Jose 17 Nov 10, 2022
[CVPR2021] Domain Consensus Clustering for Universal Domain Adaptation

[CVPR2021] Domain Consensus Clustering for Universal Domain Adaptation [Paper] Prerequisites To install requirements: pip install -r requirements.txt

Guangrui Li 81 Nov 20, 2022
CDTrans: Cross-domain Transformer for Unsupervised Domain Adaptation

CDTrans: Cross-domain Transformer for Unsupervised Domain Adaptation [arxiv] This is the official repository for CDTrans: Cross-domain Transformer for

null 232 Dec 1, 2022
CDTrans: Cross-domain Transformer for Unsupervised Domain Adaptation

[ICCV2021] TransReID: Transformer-based Object Re-Identification [pdf] The official repository for TransReID: Transformer-based Object Re-Identificati

DamoCV 559 Dec 7, 2022
A Pytorch Implementation of [Source data‐free domain adaptation of object detector through domain

A Pytorch Implementation of Source data‐free domain adaptation of object detector through domain‐specific perturbation Please follow Faster R-CNN and

null 1 Dec 25, 2021
Code release for "Transferable Semantic Augmentation for Domain Adaptation" (CVPR 2021)

Transferable Semantic Augmentation for Domain Adaptation Code release for "Transferable Semantic Augmentation for Domain Adaptation" (CVPR 2021) Paper

null 62 Oct 4, 2022
Code release for Universal Domain Adaptation(CVPR 2019)

Universal Domain Adaptation Code release for Universal Domain Adaptation(CVPR 2019) Requirements python 3.6+ PyTorch 1.0 pip install -r requirements.t

THUML @ Tsinghua University 230 Nov 25, 2022
ICLR21 Tent: Fully Test-Time Adaptation by Entropy Minimization

⛺️ Tent: Fully Test-Time Adaptation by Entropy Minimization This is the official project repository for Tent: Fully-Test Time Adaptation by Entropy Mi

Dequan Wang 194 Nov 30, 2022
This is our ARTS test set, an enriched test set to probe Aspect Robustness of ABSA.

This is the repository for our 2020 paper "Tasty Burgers, Soggy Fries: Probing Aspect Robustness in Aspect-Based Sentiment Analysis". Data We provide

null 35 Nov 16, 2022
[CVPR 2022] Official code for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved Neural Network Calibration"

MDCA Calibration This is the official PyTorch implementation for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved

MDCA Calibration 19 Nov 2, 2022
Code to reproduce the experiments in the paper "Transformer Based Multi-Source Domain Adaptation" (EMNLP 2020)

Transformer Based Multi-Source Domain Adaptation Dustin Wright and Isabelle Augenstein To appear in EMNLP 2020. Read the preprint: https://arxiv.org/a

CopeNLU 36 Dec 5, 2022
PyTorch code for the paper "Curriculum Graph Co-Teaching for Multi-target Domain Adaptation" (CVPR2021)

PyTorch code for the paper "Curriculum Graph Co-Teaching for Multi-target Domain Adaptation" (CVPR2021) This repo presents PyTorch implementation of M

Evgeny 78 Dec 4, 2022
code for ICCV 2021 paper 'Generalized Source-free Domain Adaptation'

G-SFDA Code (based on pytorch 1.3) for our ICCV 2021 paper 'Generalized Source-free Domain Adaptation'. [project] [paper]. Dataset preparing Download

Shiqi Yang 83 Nov 17, 2022
Official code of CVPR 2021's PLOP: Learning without Forgetting for Continual Semantic Segmentation

PLOP: Learning without Forgetting for Continual Semantic Segmentation This repository contains all of our code. It is a modified version of Cermelli e

Arthur Douillard 113 Nov 25, 2022