TinyViT: Fast Pretraining Distillation for Small Vision Transformers

Kan Wu, Jinnian Zhang, Houwen Peng, Mengchen Liu, Bin Xiao +2 more
7/21/2022
cs.CV

Official code: microsoft/Cream (1,836 stars, MIT, last commit 2024-07-25). 1 more implementation below.

Abstract

Vision transformer (ViT) recently has drawn great attention in computer vision due to its remarkable model capability. However, most prevailing ViT models suffer from huge number of parameters, restricting their applicability on devices with limited resources. To alleviate this issue, we propose TinyViT, a new family of tiny and efficient small vision transformers pretrained on large-scale datasets with our proposed fast distillation framework. The central idea is to transfer knowledge from large pretrained models to small ones, while enabling small models to get the dividends of massive pretraining data. More specifically, we apply distillation during pretraining for knowledge transfer. The logits of large teacher models are sparsified and stored in disk in advance to save the memory cost and computation overheads. The tiny student transformers are automatically scaled down from a large pretrained model with computation and parameter constraints. Comprehensive experiments demonstrate the efficacy of TinyViT. It achieves a top-1 accuracy of 84.8% on ImageNet-1k with only 21M parameters, being comparable to Swin-B pretrained on ImageNet-21k while using 4.2 times fewer parameters. Moreover, increasing image resolutions, TinyViT can reach 86.5% accuracy, being slightly better than Swin-L while using only 11% parameters. Last but not the least, we demonstrate a good transfer ability of TinyViT on various downstream tasks. Code and models are available at https://github.com/microsoft/Cream/tree/main/TinyViT.

View on arXivView PDF

Code Implementations(2)

microsoft/CreamOfficial100%
MIT

This is a collection of our NAS and Vision Transformer work.

1,836243C++, CudaOct 12, 20202 years agoMIT
automlefficiencyknowledge-distillationnasrpe+2 more
wkcn/TinyViTCommunity71%

[ECCV 2022] TinyViT: Fast Pretraining Distillation for Small Vision Transformers (https://github.com/microsoft/Cream/tree/main/TinyViT)

13611PythonJun 28, 20233 years agoNOASSERTION

Similar Papers

Cite this paper

@article{wu2022tinyvit,
  title  = {TinyViT: Fast Pretraining Distillation for Small Vision Transformers},
  author = {Kan Wu and Jinnian Zhang and Houwen Peng and Mengchen Liu and Bin Xiao and Jianlong Fu and Lu Yuan},
  year   = {2022},
  eprint = {2207.10666},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2207.10666v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2207.10666.svg)](https://codeofpaper.com/paper/2207.10666)

Discussion