quadratic complexity with respect to the number of tokens.
This complexity is pertinent for video, as the number of tokens increases linearly with the number of input frames, and
motivates the development of more efﬁcient architectures
next.
Model 2: Factorised encoder As shown in Fig. 4, this
model consists of two separate transformer encoders. The
ﬁrst, spatial encoder, only models interactions between tokens extracted from the same temporal index. A representation for each temporal index, hi2Rd, is obtained after Ls
layers: This is the encoded classiﬁcation token, zLs
clsif it was
prepended to the input (Eq. 1), or a global average pooling
from the tokens output by the spatial encoder, zLs, otherwise. The frame-level representations, hi, are concatenated
intoH2Rntd, and then forwarded through a temporal
encoder consisting of Lttransformer layers to model interactions between tokens from different temporal indices.
The output token of this encoder is then ﬁnally classiﬁed.
This architecture corresponds to a “late fusion” [34,
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