Pyramid Adversarial Training Improves ViT Performance

Aggressive data augmentation is a key component of the strong generalization capabilities of Vision Transformer (ViT). One such data augmentation technique is adversarial training (AT); however, many prior works have shown that this often results in poor clean accuracy. In this work, we present pyramid adversarial training (PyramidAT), a simple and effective technique to improve ViT's overall performance. We pair it with a "matched" Dropout and stochastic depth regularization, which adopts the same Dropout and stochastic depth configuration for the clean and adversarial samples. Similar to the improvements on CNNs by AdvProp (not directly applicable to ViT), our pyramid adversarial training breaks the trade-off between in-distribution accuracy and out-of-distribution robustness for ViT and related architectures. It leads to 1.82% absolute improvement on ImageNet clean accuracy for the ViT-B model when trained only on ImageNet-1K data, while simultaneously boosting performance on 7 ImageNet robustness metrics, by absolute numbers ranging from 1.76% to 15.68%. We set a new state-of-the-art for ImageNet-C (41.42 mCE), ImageNet-R (53.92%), and ImageNet-Sketch (41.04%) without extra data, using only the ViT-B/16 backbone and our pyramid adversarial training. Our code is publicly available at pyramidat.github.io.

PDF Abstract CVPR 2022 PDF CVPR 2022 Abstract

Results from the Paper


Ranked #9 on Domain Generalization on ImageNet-C (using extra training data)

     Get a GitHub badge
Task Dataset Model Metric Name Metric Value Global Rank Uses Extra
Training Data
Result Benchmark
Domain Generalization ImageNet-A Pyramid Adversarial Training Improves ViT (384x384) Top-1 accuracy % 36.41 # 24
Domain Generalization ImageNet-A Pyramid Adversarial Training Improves ViT (Im21k) Top-1 accuracy % 62.44 # 13
Domain Generalization ImageNet-C Pyramid Adversarial Training Improves ViT (Im21k) mean Corruption Error (mCE) 36.80 # 9
Number of params 87M # 35
Domain Generalization ImageNet-C Pyramid Adversarial Training Improves ViT mean Corruption Error (mCE) 41.42 # 15
Domain Generalization ImageNet-R Pyramid Adversarial Training Improves ViT Top-1 Error Rate 46.08 # 22
Domain Generalization ImageNet-R Pyramid Adversarial Training Improves ViT (Im21k) Top-1 Error Rate 42.16 # 17
Domain Generalization ImageNet-Sketch Pyramid Adversarial Training Improves ViT (Im21k) Top-1 accuracy 46.03 # 14
Domain Generalization ImageNet-Sketch Pyramid Adversarial Training Improves ViT Top-1 accuracy 41.04 # 18
Image Classification ObjectNet RegViT (RandAug) + Random Pyramid Top-1 Accuracy 29.41 # 68
Image Classification ObjectNet RegViT (RandAug) + Random Pixel Top-1 Accuracy 28.72 # 72
Image Classification ObjectNet RegViT (RandAug) Top-1 Accuracy 29.3 # 69
Image Classification ObjectNet ViT + MixUp Top-1 Accuracy 25.65 # 80
Image Classification ObjectNet ViT + CutMix Top-1 Accuracy 21.61 # 87
Image Classification ObjectNet ViT Top-1 Accuracy 17.36 # 96
Image Classification ObjectNet MLP-Mixer + Pyramid Top-1 Accuracy 28.6 # 73
Image Classification ObjectNet MLP-Mixer + Pixel Top-1 Accuracy 24.75 # 82
Image Classification ObjectNet MLP-Mixer Top-1 Accuracy 25.9 # 78
Image Classification ObjectNet Discrete ViT + Pyramid Top-1 Accuracy 30.28 # 64
Image Classification ObjectNet Discrete ViT + Pixel Top-1 Accuracy 30.98 # 63
Image Classification ObjectNet Discrete ViT Top-1 Accuracy 29.95 # 66
Image Classification ObjectNet ViT-B/16 (512x512) + Pyramid Top-1 Accuracy 49.39 # 27
Image Classification ObjectNet ViT-B/16 (512x512) + Pixel Top-1 Accuracy 47.53 # 31
Image Classification ObjectNet ViT-B/16 (512x512) Top-1 Accuracy 46.68 # 34
Image Classification ObjectNet RegViT on 384x384 + Adv Pixel Top-1 Accuracy 37.41 # 47
Image Classification ObjectNet RegViT on 384x384 + Adv Pyramid Top-1 Accuracy 39.79 # 43
Image Classification ObjectNet RegViT on 384x384 + Random Pixel Top-1 Accuracy 34.12 # 57
Image Classification ObjectNet RegViT on 384x384 + Random Pyramid Top-1 Accuracy 34.83 # 55
Image Classification ObjectNet RegViT on 384x384 Top-1 Accuracy 35.59 # 53
Image Classification ObjectNet RegViT (RandAug) + Adv Pyramid Top-1 Accuracy 32.92 # 58
Image Classification ObjectNet RegViT (RandAug) + Adv Pixel Top-1 Accuracy 30.11 # 65

Methods