All Tokens Matter: Token Labeling for Training Better Vision Transformers

In this paper, we present token labeling -- a new training objective for training high-performance vision transformers (ViTs). Different from the standard training objective of ViTs that computes the classification loss on an additional trainable class token, our proposed one takes advantage of all the image patch tokens to compute the training loss in a dense manner. Specifically, token labeling reformulates the image classification problem into multiple token-level recognition problems and assigns each patch token with an individual location-specific supervision generated by a machine annotator. Experiments show that token labeling can clearly and consistently improve the performance of various ViT models across a wide spectrum. For a vision transformer with 26M learnable parameters serving as an example, with token labeling, the model can achieve 84.4% Top-1 accuracy on ImageNet. The result can be further increased to 86.4% by slightly scaling the model size up to 150M, delivering the minimal-sized model among previous models (250M+) reaching 86%. We also show that token labeling can clearly improve the generalization capability of the pre-trained models on downstream tasks with dense prediction, such as semantic segmentation. Our code and all the training details will be made publicly available at https://github.com/zihangJiang/TokenLabeling.

PDF Abstract NeurIPS 2021 PDF NeurIPS 2021 Abstract

Datasets


Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Semantic Segmentation ADE20K LV-ViT-L (UperNet, MS) Validation mIoU 51.8 # 84
Params (M) 209 # 19
Image Classification ImageNet LV-ViT-L Top 1 Accuracy 86.4% # 143
Number of params 151M # 881
GFLOPs 214.8 # 470
Image Classification ImageNet LV-ViT-M Top 1 Accuracy 84.1% # 325
Number of params 56M # 748
GFLOPs 16 # 346
Image Classification ImageNet LV-ViT-S Top 1 Accuracy 83.3% # 403
Number of params 26M # 607
GFLOPs 6.6 # 244
Efficient ViTs ImageNet-1K (With LV-ViT-S) Base (LV-ViT-S) Top 1 Accuracy 83.3 # 3
GFLOPs 6.6 # 1

Methods