conda create -n mos python=3.8
pip install -r requirements.txt
Torchvision provides CIFAR10
, CIFAR100
datasets. The root paths of data are respectively set to ./dataset/cifar10
and ./dataset/cifar100
.
Dataset | Training (#Epochs) | ViT-Tiny/2 | ViT-Small/2 | ViT-Base/2 |
---|---|---|---|---|
CIFAR10 | Pretrain (800) | link | link | link |
KNN Accuracy | 93.2% | 95.1% | 95.1% | |
Linear (100) | link | link | link | |
Linear Accuracy | 94.8% | 96.3% | 96.4% | |
Finetune (100) | link | link | link | |
Finetune Accuracy | 97.6% | 98.3% | 98.3% | |
CIFAR100 | Pretrain (800) | link | link | link |
KNN Accuracy | 67.8% | 73.5% | 74.4% | |
Linear (100) | link | link | link | |
Linear Accuracy | 73.5% | 78.5% | 79.6% | |
Finetune (100) | link | link | link | |
Finetune Accuracy | 83.7% | 86.1% | 86.2% |
Set hyperparameter, dataset and GPUs in config/pretrain/vit_small_pretrain.py and run the following command
python main_pretrain.py --arch vit-small
Set hyperparameter, dataset and GPUs in config/knn/knn.py and run the following command
python main_knn.py --arch vit-small --pretrained-weights /path/to/pretrained-weights.pth
Set hyperparameter, dataset and GPUs in config/linear/vit_small_linear.py and run the following command:
python main_linear.py --arch vit-small --pretrained-weights /path/to/pretrained-weights.pth
Set hyperparameter, dataset and GPUs in config/finetuning/vit_small_finetuning.py and run the following command
python python main_finetune.py --arch vit-small --pretrained-weights /path/to/pretrained-weights.pth