HyperAIHyperAI

Command Palette

Search for a command to run...

3 months ago

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

Ben Graham Alaaeldin El-Nouby Hugo Touvron Pierre Stock Armand Joulin Hervé Jégou Matthijs Douze

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

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

Benchmarks

BenchmarkMethodologyMetrics
image-classification-on-cifar-10LeViT-128S
Percentage correct: 97.5
image-classification-on-cifar-10LeViT-128
Percentage correct: 97.6
image-classification-on-cifar-10LeViT-384
Percentage correct: 98
image-classification-on-cifar-10LeViT-192
Percentage correct: 98.2
image-classification-on-cifar-10LeViT-256
Percentage correct: 98.1
image-classification-on-flowers-102LeViT-128S
Accuracy: 96.8
image-classification-on-flowers-102LeViT-192
Accuracy: 97.8
image-classification-on-flowers-102LeViT-256
Accuracy: 97.7
image-classification-on-flowers-102LeViT-384
Accuracy: 98.3
image-classification-on-imagenetLeViT-384
GFLOPs: 2.334
Number of params: 39.4M
Top 1 Accuracy: 82.5%
image-classification-on-imagenetLeViT-256
GFLOPs: 1.066
Number of params: 17.8M
Top 1 Accuracy: 81.6%
image-classification-on-imagenetLeViT-128S
GFLOPs: 0.288
Number of params: 4.7M
Top 1 Accuracy: 75.7%
image-classification-on-imagenetLeViT-128
GFLOPs: 0.376
Number of params: 8.8M
Top 1 Accuracy: 79.6%
image-classification-on-imagenetLeViT-192
GFLOPs: 0.624
Number of params: 10.4M
Top 1 Accuracy: 80%
image-classification-on-imagenet-realLeViT-384
Accuracy: 87.5%
image-classification-on-imagenet-realLeViT-256
Accuracy: 86.9%
image-classification-on-imagenet-realLeViT-128
Accuracy: 85.6%
image-classification-on-imagenet-realLeViT-128S
Accuracy: 82.6%
image-classification-on-imagenet-realLeViT-192
Accuracy: 85.8%
image-classification-on-imagenet-v2LeViT-256
Top 1 Accuracy: 69.9
image-classification-on-imagenet-v2LeViT-192
Top 1 Accuracy: 68.7
image-classification-on-imagenet-v2LeViT-384
Top 1 Accuracy: 71.4
image-classification-on-imagenet-v2LeViT-128S
Top 1 Accuracy: 63.9
image-classification-on-imagenet-v2LeViT-128
Top 1 Accuracy: 67.5
image-classification-on-inaturalist-2018LeViT-384
Top-1 Accuracy: 66.9%
image-classification-on-inaturalist-2018LeViT-128S
Top-1 Accuracy: 55.2%
image-classification-on-inaturalist-2018LeViT-256
Top-1 Accuracy: 66.2%
image-classification-on-inaturalist-2018LeViT-192
Top-1 Accuracy: 60.4%
image-classification-on-inaturalist-2018LeViT-128
Top-1 Accuracy: 54%
image-classification-on-inaturalist-2019LeViT-192
Top-1 Accuracy: 70.8
image-classification-on-inaturalist-2019LeViT-256
Top-1 Accuracy: 72.3
image-classification-on-inaturalist-2019LeViT-128
Top-1 Accuracy: 68.4
image-classification-on-inaturalist-2019LeViT-384
Top-1 Accuracy: 74.3
image-classification-on-inaturalist-2019LeViT-128S
Top-1 Accuracy: 66.5
image-classification-on-stanford-carsLeViT-128S
Accuracy: 88.4
image-classification-on-stanford-carsLeViT-256
Accuracy: 88.2
image-classification-on-stanford-carsLeViT-384
Accuracy: 89.3
image-classification-on-stanford-carsLeViT-128
Accuracy: 88.6
image-classification-on-stanford-carsLeViT-192
Accuracy: 89.8

Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing
Get Started

Hyper Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp