The output token of this encoder is then ﬁnally classiﬁed.
This architecture corresponds to a “late fusion” [34,
56, 72, 46] of temporal information, and the initial spatial encoder is identical to the one used for image classiﬁcation. It is thus analogous to CNN architectures such
as [24, 34, 72, 86] which ﬁrst extract per-frame features, and then aggregate them into a ﬁnal representation
before classifying them. Although this model has more
transformer layers than Model 1 (and thus more parameters), it requires fewer ﬂoating point operations (FLOPs),
as the two separate transformer blocks have a complexity
ofO((nhnw)2+n2
t)compared toO((ntnhnw)2)of
Model 1.
Transformer Block xLK         V       Q MLPLayer Norm
Layer NormMulti-HeadAttention
K         V       Q Layer NormMulti-HeadAttention
Temporal Self-Attention BlockSpatial Self-Attention BlockToken embeddingPositional embeddingFigure 5: Factorised self-attention (Model 3). Within each transformer block, the multi-headed self-attention operation is factorised into two operations (indicated by striped boxes) that ﬁrst
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