
levit_conv_128s
Image classification320 ops7.8M params
21 models, image classification. Fewest parameters first.
LeViT is a hybrid neural network for fast inference image classification, designed for the trade-off between accuracy and efficiency in a high-speed regime. The name nods to LeNet: the uniform stack of a Transformer is replaced by a pyramid with pooling. Why it matters: at 80% ImageNet top-1 accuracy, LeViT is 5 times faster than EfficientNet on CPU. It builds upon the ViT architecture and the DeiT training method, folding in components proven useful for convolutional architectures.
The patch embedding is a small convnet: 4 layers of 3x3 convolutions with stride 2 take the channel count from 3 to 32, 64, 128 and 256 while shrinking the resolution. There is no classification token; it is removed in favour of a convnet-style pooling of the last activation map. Positional information comes from a learnt attention bias added directly to the attention maps, instead of a positional embedding at the input. The attention block that downsamples between stages halves the height and width of the activation map, and because of the change in scale it is used without a residual connection. All of LeViT's non-linear activations are Hardswish. Compared with a DeiT block, LeViT spends less time on the MLP component because the expansion factor is halved from four to two.
Training follows DeiT's distillation-driven recipe, with two classification heads: one supervised by the ground-truth classes, the second by a RegNetY-16GF teacher. LeViT-384 is on par with DeiT-Small in accuracy but uses half the number of FLOPs. At the faster end, LeViT-128S is on par with DeiT-Tiny and uses 4 times fewer FLOPs. LeViT-192 and LeViT-256 have about the same accuracies as EfficientNet B2 and B3 but are 5 and 7 times faster on CPU. In the ablations, flattening the pyramid into a straight stack at the same FLOP count forces the network width down, leaving a model with few parameters and a very low final accuracy. The timm implementation traced here, adapted from the official facebookresearch/LeViT code, combines both conv and linear forms of the model.
AI-written summary; not reviewed by a person. Corrections welcome.
Paper: LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference

Image classification320 ops7.8M params

Image classification440 ops7.8M params

Image classification519 ops8.8M params

Image classification401 ops9.2M params

Image classification551 ops9.2M params

Image classification401 ops10.9M params

Image classification551 ops10.9M params

Image classification401 ops18.9M params

Image classification551 ops18.9M params

Image classification558 ops26.2M params

Image classification768 ops26.2M params

Image classification398 ops39.1M params

Image classification548 ops39.1M params

Image classification401 ops39.1M params

Image classification551 ops39.1M params

Image classification393 ops74M params

Image classification543 ops74M params

Image classification558 ops92.5M params

Image classification768 ops92.5M params

Image classification396 ops95.2M params

Image classification546 ops95.2M params