LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference

Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin +2 more
4/2/2021
cs.CV

Official code: facebookresearch/LeViT (622 stars, Apache-2.0, last commit 2022-08-27). Most starred: huggingface/pytorch-image-models, a community implementation (36,940 stars, Apache-2.0, PyTorch, last commit 2026-04-29, 59× the official stars). 1 more implementation below.

Abstract

We design a family of image classification architectures that optimize the trade-off between accuracy and efficiency in a high-speed regime. Our work exploits recent findings in attention-based architectures, which are competitive on highly parallel processing hardware. We revisit principles from the extensive literature on convolutional neural networks to apply them to transformers, in particular activation maps with decreasing resolutions. We also introduce the attention bias, a new way to integrate positional information in vision transformers. As a result, we propose LeVIT: a hybrid neural network for fast inference image classification. We consider different measures of efficiency on different hardware platforms, so as to best reflect a wide range of application scenarios. Our extensive experiments empirically validate our technical choices and show they are suitable to most architectures. Overall, LeViT significantly outperforms existing convnets and vision transformers with respect to the speed/accuracy tradeoff. For example, at 80% ImageNet top-1 accuracy, LeViT is 5 times faster than EfficientNet on CPU. We release the code at https://github.com/facebookresearch/LeViT

View on arXivView PDF

Code Implementations(2)

Apache-2.0

LeViT a Vision Transformer in ConvNet's Clothing for Faster Inference

62275PythonMar 30, 20214 years agoApache-2.0
PyTorchApache-2.0

The largest collection of PyTorch image encoders / backbones. Including train, eval, inference, export scripts, and pretrained weights -- ResNet, ResNeXT, EfficientNet, NFNet, Vision Transformer (ViT), MobileNetV4, MobileNet-V3 & V2, RegNet, DPN, CSPNet, Swin Transformer, MaxViT, CoAtNet, ConvNeXt, and more

36,9405,171MDX, ShellFeb 2, 20195 months agoApache-2.0
augmixconvnextdistributed-trainingefficientnetimage-classification+15 more

Similar Papers

Cite this paper

@article{graham2021levit,
  title  = {LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference},
  author = {Ben Graham and Alaaeldin El-Nouby and Hugo Touvron and Pierre Stock and Armand Joulin and Hervé Jégou and Matthijs Douze},
  year   = {2021},
  eprint = {2104.01136},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2104.01136}
}

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/2104.01136.svg)](https://codeofpaper.com/paper/2104.01136)

Discussion