mo666666 / When-Adversarial-Training-Meets-Vision-Transformers

Official implementation of "When Adversarial Training Meets Vision Transformers: Recipes from Training to Architecture" published at NeurIPS 2022.
27 stars 4 forks source link

Adversarial-Training On CIFAR-100 #6

Closed Gatsby666 closed 10 months ago

Gatsby666 commented 10 months ago

hello~ I want to reproduce your code on the CIFAR-100 dataset, using vanilla adversarial defense methods on vit_base_patch16_224 with pre-training, to achieve similar effects in the paper. 3f4faa300bf5a94262ab3a3044107ed When I modified the data_loader, imported the pre-trained model and ran it successfully. However, the robustness only reached about 20%. I want to know if this is normal or is it an issue with some hyperparameter settings.

my settings: Namespace(model='vit_base_patch16_224', method='AT', dataset='cifa100', run_dummy=False, accum_steps=1, grad_clip=1.0, test=False, log_interval=10, batch_size=64, AA_batch=128, crop=32, resize=32, load=False, load_path='./checkpoint', scratch=False, n_w=10, attack_iters=10, patch=16, ARD=False, PRM=False, drop_rate=1.0, beta=6.0, eval_restarts=1, eval_iters=10, data_dir='./data', epochs=40, lr_min=0.0, lr_max=0.1, weight_decay=0.0001, momentum=0.9, epsilon=8, labelsmoothvalue=0, alpha=2, delta_init='random', out_dir='./logs/vit-B-16-v2-32_AT', seed=0, mixup=0.8, cutmix=1.0, cutmix_minmax=None, mixup_prob=0.3, mixup_switch_prob=0.5, mixup_mode='batch', output_dir='output')

mo666666 commented 10 months ago

Hello, Gatsby666! Thank you for your interest in our work!
Our experiments are actually performed on CIFAR-10 dataset instead of CIFAR-100. I think the worse robustness may attribute to the larger number of class for CIFAR-100 than those of CIFAR-10. It increases the difficulty of ViTs to defend adversarial attacks. Similar observations are observed on CNNs. You can refer to robustbench for more results. Hope my responses can address your concerns!

Gatsby666 commented 10 months ago

Thank for your responses! It makes me rethink my current work. By the way, your work has inspired me a lot. Thank you very much!

mo666666 commented 10 months ago

You are welcome! If you have any other questions, feel free to let me know. Best wishes and good luck!