Home

Awesome

Vision Transformer for Small-Size Datasets

Seung Hoon Lee and Seunghyun Lee and Byung Cheol Song | Paper

Inha University

Abstract

Recently, the Vision Transformer (ViT), which applied the transformer structure to the image classification task, has outperformed convolutional neural networks. However, the high performance of the ViT results from pre-training using a large-size dataset such as JFT-300M, and its dependence on a large dataset is interpreted as due to low locality inductive bias. This paper proposes Shifted Patch Tokenization (SPT) and Locality Self-Attention (LSA), which effectively solve the lack of locality inductive bias and enable it to learn from scratch even on small-size datasets. Moreover, SPT and LSA are generic and effective add-on modules that are easily applicable to various ViTs. Experimental results show that when both SPT and LSA were applied to the ViTs, the performance improved by an average of 2.96% in Tiny-ImageNet, which is a representative small-size dataset. Especially, Swin Transformer achieved an overwhelming performance improvement of 4.08% thanks to the proposed SPT and LSA.

Method

Shifted Patch Tokenization

<!-- <div align="center"> --> <img src="SPT.png" width="75%" title="" alt="teaser"> <!-- </div> -->

Locality Self-Attention

<!-- <div align="center"> -->

</img><img src="LSA.png" width="75%" title="" alt="teaser"></img>

<!-- </div> -->

Model Performance

Small-Size Dataset Classification

ModelFLOPsCIFAR10CIFAR100SVHNTiny-ImageNet
ViT189.893.5873.8197.8257.07
SL-ViT199.294.5376.9297.7961.07
T2T643.095.3077.0097.9060.57
SL-T2T671.495.5777.3697.9161.83
CaiT613.894.9176.8998.1364.37
SL-CaiT623.395.8180.3298.2867.18
PiT279.294.2474.9997.8360.25
SL-PiT322.995.8879.0097.9362.91
Swin242.394.4676.8797.7260.87
SL-Swin284.995.9379.9997.9264.95

Accuracy-Throughput Graph on Tiny-ImageNet

<!-- <div align="center"> -->

<img src="main.png" width="50%" title="" alt="teaser"></img>

<!-- </div> -->

How to train models

Pure ViT

python main.py --model vit 

SL-Swin

python main.py --model swin --is_LSA --is_SPT 

Citation

@article{lee2021vision,
  title={Vision Transformer for Small-Size Datasets},
  author={Lee, Seung Hoon and Lee, Seunghyun and Song, Byung Cheol},
  journal={arXiv preprint arXiv:2112.13492},
  year={2021}
}