Skip to content

Commit 8c325a0

Browse files
Merge pull request #5 from LINs-lab/pretrain
Provide an improved pretraining script as requested by #4
2 parents 371ab7c + 246d998 commit 8c325a0

File tree

5 files changed

+478
-395
lines changed

5 files changed

+478
-395
lines changed

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ The TTAB package contains:
2525
In addition, the example scripts contain default models, optimizers, and evaluation code.
2626
New algorithms can be easily added and run on all of the TTAB datasets.
2727

28+
## News
29+
30+
- August 2023: We released an improved pretraining script based on what we used in our project, which can cover all of benchmark datasets mentioned in our paper except ImageNet.
31+
2832
## Installation
2933
To run a baseline test, please prepare the relevant pre-trained checkpoints for the base model and place them in `pretrain/ckpt/`.
3034
### Requirements
@@ -175,7 +179,15 @@ In addition to shared hyperparameters such as `lr`, `weight_decay`, `batch_size`
175179
In order to make a fair comparison across different TTA algorithms, we make reasonable modifications to these algorithms, which may induce inconsistency with their official implementation. -->
176180

177181
## Pretraining
178-
In this [link](https://drive.google.com/drive/folders/1ALNIYnnTJwqP80n9pEjSWtb_UdbcrsVi?usp=sharing), we provide a set of scripts that can be used to pre-train models on the in-distribution TTAB datasets. These pre-trained models were used to benchmark baselines in our paper. Note that we adopt self-supervised learning with a rotation prediction task to train the baseline model in our paper for a fair comparison. In practice, please feel free to choose whatever pre-training methods you prefer, but please pay attention to the setup of TTA methods.
182+
In `pretrain`, we provide an improved pretraining script based on what we used in our project, which can be used to pretrain the model on all of benchmark datasets used in our paper except ImageNet. Meanwhile, in this [link](https://drive.google.com/drive/folders/1ALNIYnnTJwqP80n9pEjSWtb_UdbcrsVi?usp=sharing), we release a set of checkpoints pretrained on the in-distribution TTAB datasets. These pre-trained models were used to benchmark baselines in our paper. Note that we adopt self-supervised learning with a rotation prediction task to train the baseline model in our paper for a fair comparison. In practice, please feel free to choose whatever pre-training methods you prefer, but please pay attention to the setup of TTA methods.
183+
```py
184+
python ssl_pretrain.py --data-name cifar10 --model-name resnet26
185+
python ssl_pretrain.py --data-name cifar100 --model-name resnet26
186+
python ssl_pretrain.py --data-name officehome_art --model-name resnet50 --entry-of-shared-layers layer3 --use-ls --lr 1e-2 --weight-decay 1e-4
187+
python ssl_pretrain.py --data-name pacs_art --model-name resnet50 --entry-of-shared-layers layer3 --use-ls --lr 1e-2 --weight-decay 1e-4
188+
python ssl_pretrain.py --data-name waterbirds --model-name resnet50 --entry-of-shared-layers layer3 --lr 1e-3 --weight-decay 1e-4
189+
python ssl_pretrain.py --data-name coloredmnist --model-name resnet18 --entry-of-shared-layers layer3 --lr 1e-3 --weight-decay 1e-4
190+
```
179191
<!-- ## Citing TTAB -->
180192

181193
## Bibliography

0 commit comments

Comments
 (0)