Charles Herrmann, Kyle Sargent, Lu Jiang, Ramin Zabih, Huiwen Chang, Ce Liu, Dilip Krishnan, Deqing Sun
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.
| Task | Dataset | Metric | Value | Model |
|---|---|---|---|---|
| Domain Adaptation | ImageNet-R | Top-1 Error Rate | 42.16 | Pyramid Adversarial Training Improves ViT (Im21k) |
| Domain Adaptation | ImageNet-R | Top-1 Error Rate | 46.08 | Pyramid Adversarial Training Improves ViT |
| Domain Adaptation | ImageNet-A | Top-1 accuracy % | 62.44 | Pyramid Adversarial Training Improves ViT (Im21k) |
| Domain Adaptation | ImageNet-A | Top-1 accuracy % | 36.41 | Pyramid Adversarial Training Improves ViT (384x384) |
| Domain Adaptation | ImageNet-C | mean Corruption Error (mCE) | 36.8 | Pyramid Adversarial Training Improves ViT (Im21k) |
| Domain Adaptation | ImageNet-C | mean Corruption Error (mCE) | 41.42 | Pyramid Adversarial Training Improves ViT |
| Domain Adaptation | ImageNet-Sketch | Top-1 accuracy | 46.03 | Pyramid Adversarial Training Improves ViT (Im21k) |
| Domain Adaptation | ImageNet-Sketch | Top-1 accuracy | 41.04 | Pyramid Adversarial Training Improves ViT |
| Image Classification | ObjectNet | Top-1 Accuracy | 49.39 | ViT-B/16 (512x512) + Pyramid |
| Image Classification | ObjectNet | Top-1 Accuracy | 47.53 | ViT-B/16 (512x512) + Pixel |
| Image Classification | ObjectNet | Top-1 Accuracy | 46.68 | ViT-B/16 (512x512) |
| Image Classification | ObjectNet | Top-1 Accuracy | 39.79 | RegViT on 384x384 + Adv Pyramid |
| Image Classification | ObjectNet | Top-1 Accuracy | 37.41 | RegViT on 384x384 + Adv Pixel |
| Image Classification | ObjectNet | Top-1 Accuracy | 35.59 | RegViT on 384x384 |
| Image Classification | ObjectNet | Top-1 Accuracy | 34.83 | RegViT on 384x384 + Random Pyramid |
| Image Classification | ObjectNet | Top-1 Accuracy | 34.12 | RegViT on 384x384 + Random Pixel |
| Image Classification | ObjectNet | Top-1 Accuracy | 32.92 | RegViT (RandAug) + Adv Pyramid |
| Image Classification | ObjectNet | Top-1 Accuracy | 30.98 | Discrete ViT + Pixel |
| Image Classification | ObjectNet | Top-1 Accuracy | 30.28 | Discrete ViT + Pyramid |
| Image Classification | ObjectNet | Top-1 Accuracy | 30.11 | RegViT (RandAug) + Adv Pixel |
| Image Classification | ObjectNet | Top-1 Accuracy | 29.95 | Discrete ViT |
| Image Classification | ObjectNet | Top-1 Accuracy | 29.41 | RegViT (RandAug) + Random Pyramid |
| Image Classification | ObjectNet | Top-1 Accuracy | 29.3 | RegViT (RandAug) |
| Image Classification | ObjectNet | Top-1 Accuracy | 28.72 | RegViT (RandAug) + Random Pixel |
| Image Classification | ObjectNet | Top-1 Accuracy | 28.6 | MLP-Mixer + Pyramid |
| Image Classification | ObjectNet | Top-1 Accuracy | 25.9 | MLP-Mixer |
| Image Classification | ObjectNet | Top-1 Accuracy | 25.65 | ViT + MixUp |
| Image Classification | ObjectNet | Top-1 Accuracy | 24.75 | MLP-Mixer + Pixel |
| Image Classification | ObjectNet | Top-1 Accuracy | 21.61 | ViT + CutMix |
| Image Classification | ObjectNet | Top-1 Accuracy | 17.36 | ViT |
| Domain Generalization | ImageNet-R | Top-1 Error Rate | 42.16 | Pyramid Adversarial Training Improves ViT (Im21k) |
| Domain Generalization | ImageNet-R | Top-1 Error Rate | 46.08 | Pyramid Adversarial Training Improves ViT |
| Domain Generalization | ImageNet-A | Top-1 accuracy % | 62.44 | Pyramid Adversarial Training Improves ViT (Im21k) |
| Domain Generalization | ImageNet-A | Top-1 accuracy % | 36.41 | Pyramid Adversarial Training Improves ViT (384x384) |
| Domain Generalization | ImageNet-C | mean Corruption Error (mCE) | 36.8 | Pyramid Adversarial Training Improves ViT (Im21k) |
| Domain Generalization | ImageNet-C | mean Corruption Error (mCE) | 41.42 | Pyramid Adversarial Training Improves ViT |
| Domain Generalization | ImageNet-Sketch | Top-1 accuracy | 46.03 | Pyramid Adversarial Training Improves ViT (Im21k) |
| Domain Generalization | ImageNet-Sketch | Top-1 accuracy | 41.04 | Pyramid Adversarial Training Improves ViT |