This repository contains the code used for Bag of Tricks for Fully Test-Time Adaptation 🔗 by Saypraseuth Mounsaveng, Florent Chiaroni, Malik Boudiaf, Marco Pedersoli and Ismail Ben Ayed (WACV 2024).
The code is mainly inspired from SAR 🔗 and adapted with additional methods and tricks.
Links to the source code of the methods mentioned in the article: The code used in this paper was mostly inspired by the
Method | Code Link |
---|---|
Tent | https://github.com/DequanWang/tent |
SAR | https://github.com/mr-eggplant/SAR |
Delta | https://github.com/bwbwzhao/DELTA |
DUA | https://github.com/jmiemirza/DUA |
Hebbian | n/a |
Links to the weights of the pretrained models mentioned in the paper:
Architecture | Code Link |
---|---|
ResNet50-BN | https://download.pytorch.org/models/resnet50--9c8e357.pth |
ResNet50-GN | timm |
ResNet-101 | https://github.com/Albert0147/NRC\_SFDA |
VitBase-LN | timm |
WRN28-10 | RobustBench |
WRN40-2 | RobustBench |
SVHN model | Pytorch-Playground |
Installation:
Packages to install:
Data preparation:
This repository contains code for evaluation on different datasets. Here are the links to download them:
ImageNet-C 🔗. ImageNet-Sketch 🔗. ImageNet-Rendition 🔗. VisDA-C 2017 🔗. CIFAR10 🔗. CIFAR100 🔗. MNIST 🔗. MNIST-M 🔗. USPS 🔗.
Usage:
python3 main.py --data_corruption /path/to/imagenet-c --exp_type [normal/bs1/mix_shifts/label_shifts] --method [no_adapt/tent/delta/sar] --model [resnet50_bn_torch/resnet50_gn_timm/vitbase_timm] --test_batch_size 16 --output /output/dir
'--exp_type' is choosen from:
-
'normal' means the same test setting to prior mild data stream in Tent and EATA
-
'bs1' means single sample adaptation, only one sample comes each time-step
-
'mix_shifts' conducts exps over the mixture of 15 corruption types in ImageNet-C
-
'label_shifts' means exps under online imbalanced label distribution shifts. Moreover, imbalance_ratio indicates the imbalance extent
Please check our PAPER 🔗 for experimental results.
For any questions or comments, please contact Saypraseuth Mounsaveng by [saypraseuth.mounsaveng.1 at etsmtl.net] . 📬
If you think our work is helpful for the community, please consider citing it:
@InProceedings{Mounsaveng_2024_WACV,
author = {Mounsaveng, Saypraseuth and Chiaroni, Florent and Boudiaf, Malik and Pedersoli, Marco and Ben Ayed, Ismail},
title = {Bag of Tricks for Fully Test-Time Adaptation},
booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
month = {January},
year = {2024}
}