Awesome
Entropy is not Enough for Test-Time Adaptation: From the Perspective of Disentangled Factors
This is the official implementation of Entropy is not Enough for Test-Time Adaptation: From the Perspective of Disentangled Factors š
by Jonghyun Lee, Dahuin Jung, Saehyung Lee, Junsung Park, Juhyeon Shin, Uiwon Hwang and Sungroh Yoon (ICLR 2024 Spotlight, Top-5% of the submissions).
This implementation is based on SAR implementation š.
Environments
You should modify [username] and [env_name] in environment.yaml, then
$ conda env create --file environment.yaml
Baselines
TENT š (ICLR 2021)
EATA š (ICML 2022)
SAR š (ICLR 2023)
Dataset
You can download ImageNet-C from a link ImageNet-C š.
After downloading the dataset, move to the root directory ([data_root]) of datasets.
If you run on ColoredMNIST š or Waterbirds š, run
$ python pretrain_[dataset_name].py --root_dir [data_root] --dset [dataset_name]
Then datasets are automatically downloaded in your [data_root] directory.
(ColoredMNIST from torchvision š and ./dataset/ColoredMNIST_dataset.py, Waterbirds from wilds š package)
Your [data_root] will be as follows:
data_root
āāā ImageNet-C
ā āāā brightness
ā āāā contrast
ā āāā ...
āāā ColoredMNIST
ā āāā ColoredMNIST_model.pickle
ā āāā MNIST
ā āāā train1.pt
ā āāā train2.pt
ā āāā test.pt
āāā Waterbirds
ā āāā metadata.csv
ā āāā waterbirds_dataset.h5py
ā āāā waterbirds_pretrained_model.pickle
ā āāā 001. Black_footed_Albatross
ā āāā 002. Laysan_Albatross
āāā āāā ...
If you don't want to pre-train, you can just copy and paste the [dataset_name]_model.pickle from './pretrained/' directory.
Experiment
You can run most of the experiments in our paper by
$ chmod +x exp_deyo.sh
$ ./exp_deyo.sh
If you want to run on the ImageNet-R or VISDA-2021, you should use main_da.py
You should modify ROOT variable as [data_root] in exp_deyo.sh.
Citation
If our DeYO method or biased test-time adaptation settings are helpful in your research, please consider citing our paper:
@inproceedings{
lee2024entropy,
title={Entropy is not Enough for Test-Time Adaptation: From the Perspective of Disentangled Factors},
author={Jonghyun Lee and Dahuin Jung and Saehyung Lee and Junsung Park and Juhyeon Shin and Uiwon Hwang and Sungroh Yoon},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=9w3iw8wDuE}
}
Acknowledgment
The code is inspired by the Tent š, EATA š, and SAR š.