16x8 16x4 16x2
Input tubelet size0.20.4TFLOPs
Spatio-temporal Factorised encoder Factorised self-attention Factorised dot-product
(a) Accuracy (b) Compute
Figure 8: The effect of varying the number of temporal tokens on
(a) accuracy and (b) computation on Kinetics 400, for different
variants of our model with a ViViT-B backbone.
on Epic Kitchens, suggesting that this dataset requires more
detailed modelling of temporal relations.
As described in Sec. 3.3, all factorised variants of our
model use signiﬁcantly fewer FLOPs than the unfactorised
Model 1, as the attention is computed separately over
spatial- and temporal-dimensions. Model 4 adds no additional parameters to the unfactorised Model 1, and uses the
least compute. The temporal transformer encoder in Model
2 operates on only nttokens, which is why there is a barely
a change in compute and runtime over the average pooling baseline, even though it improves the accuracy substantially (3% on Kinetics and 4.9% on Epic Kitchens). Finally, Model 3 requires more compute and parameters than
the other factorised models, as its additional self-attention
We present pure-transformer based models for video classification, drawing
upon the recent success of such models in image classification. Our model
extracts spatio-temporal tokens from the input video, which are then encoded by
a series of transformer layers. In order to handle the long sequences of tokens
encountered in video, we propose several, efficient variants of our model which
factorise the spatial- and temporal-dimensions of the input. Although
transformer-based models are known to only be effective when large training
datasets are available, we show how we can effectively regularise the model
during training and leverage pretrained image models to be able to train on
comparatively small datasets. We conduct thorough ablation studies, and achieve
state-of-the-art results on multiple video classification benchmarks including
Kinetics 400 and 600, Epic Kitchens, Something-Something v2 and Moments in
Time, outperforming prior methods based on deep 3D convolutional networks. To
facilitate further research, we release code at
https://github.com/google-research/scenic/tree/main/scenic/projects/vivit
Anurag Arnab Mostafa Dehghani Georg Heigold Chen Sun Mario Lučić Cordelia Schmid