Paper commentary
ViViT: A Video Vision Transformer
Pure transformers can classify video by splitting clips into spatio-temporal tokens
- Problem Transformers scale poorly to the long token sequences that video produces, and video datasets are too small to train them from scratch. Attention over every spatio-temporal token costs too much.
- Method ViViT splits each clip into spatio-temporal tokens and factorises attention over space and time. It starts from pretrained image ViT weights and adds regularisation for smaller datasets.
- Results The Factorised encoder reached 43.7 action accuracy on Epic Kitchens with ViViT-B and tubelet size 16x2. ViViT-H/14x2 with JFT pretraining reached 84.9 Top-1 on Kinetics 400.
Why video is hard for transformers
Transformers model long-range dependencies through self-attention, which lets each position consider every other position, and this has displaced convolutions for sequence modelling in language. The cost is the difficulty. Multi-Headed Self-Attention scales quadratically with the number of tokens, and in video the token count grows with the number of frames.
A clip of many frames therefore becomes a very long sequence, and attention over all spatio-temporal positions quickly becomes expensive.
Data is the second obstacle. Image transformers such as ViT tend to need large training sets, and video benchmarks hold far fewer labelled examples than image collections. Training from scratch on video is therefore hard to bring to high accuracy. The approach starts from image models pretrained on large image datasets and adds regularisation for the smaller video sets.
Turning a clip into tokens
Uniform frame sampling is the simpler tokeniser. nt frames are drawn evenly from the clip, each frame is embedded with the same patch projection that ViT uses, and all resulting tokens are concatenated. With nh·nw patches per frame, the transformer receives nt·nh·nw tokens, and the mixing of information across time is left entirely to the transformer layers.
Tubelet embedding works on the video volume directly. Non-overlapping tubelets of size t×h×w are cut out and projected linearly, which extends the ViT embedding to three dimensions and corresponds to a 3D convolution. The token grid follows \(n_t=\lfloor T/t\rfloor\), \(n_h=\lfloor H/h\rfloor\) and \(n_w=\lfloor W/w\rfloor\), so a smaller tubelet gives more tokens and more computation.
The two tokenisers differ in where temporal information is combined. Tubelet embedding fuses neighbouring frames before the transformer sees them, whereas uniform frame sampling keeps frames separate until attention mixes them.
Four ways to factorise attention
The first variant, spatio-temporal attention, passes every token through an ordinary encoder, so each token can interact with all others from the first layer. This is the most direct design, but it carries the full quadratic cost in the number of spatio-temporal tokens.
The Factorised encoder runs two stages. A spatial encoder attends only among tokens that share a temporal index and produces one representation per frame. These frame representations are stacked and passed through a temporal encoder with Lt layers, so the design is a late fusion of temporal information. Because the spatial encoder works on small groups and the temporal encoder works on nt tokens, the complexity is written as O((nh·nw)^2 + nt^2), compared with O((nt·nh·nw)^2) for Model 1.
The model has more transformer layers in total, though.
Factorised self-attention keeps the single-encoder layout of Model 1 but splits each block's self-attention into a spatial step followed by a temporal step, each preceded by layer normalisation. This adds a second attention module per block, so the model has more parameters than Model 1. It drops the classification token, because reshaping tokens between spatial and temporal layouts would be ambiguous with one present.
Factorised dot-product attention keeps one attention module but splits its heads. For half of the heads, each query attends only to keys and values from its own spatial index, and for the other half only to those from its own temporal index. It keeps the parameter count of Model 1 and the computational complexity of Models 2 and 3, because only the attention neighbourhood of each query changes.
Starting video models from image weights
Video models have nt times as many tokens as the pretrained image model, so the positional embedding has to be extended along time. The pretrained embedding is repeated along the temporal axis. Tokens that share a spatial index start with the same embedding, and fine-tuning then separates them.
For the tubelet filter, a common approach is inflation: the 2D filter is copied across the t temporal positions and averaged, giving \( E = \frac{1}{t}[E_{image},\ldots,E_{image}] \). The central frame initialisation puts the pretrained filter at the centre temporal position, \(\lfloor t/2 \rfloor\), and sets the other positions to zero. At initialisation the filter then reads only the centre frame, so it behaves like uniform frame sampling, while training can learn to combine information from other frames.
With zeros there, the temporal step passes its input through unchanged at initialisation, acting as a residual connection.
Input encoding and model variants on Kinetics 400 and Epic Kitchens
Tubelet embedding with central frame initialisation reached 79.2 Top-1, against 78.5 for uniform frame sampling and 77.6 for filter inflation, which is 0.7 and 1.6 points higher respectively. This comparison uses 32-frame inputs with 8 frames and tubelets of length t = 4, a different tubelet setting from the 16x2 configuration used in the later tables.
Table 2 compares the four variants and the average pooling baseline with ViViT-B and tubelet size 16x2. Model 1 is highest on Kinetics 400 with 80.0 Top-1, while the Factorised encoder is highest on Epic Kitchens with 43.7 action accuracy, against 43.1 for Model 1. The authors attribute this to Model 1 overfitting on a smaller dataset such as Epic Kitchens.
Adding the temporal transformer to the average pooling baseline raised accuracy by 3 points on Kinetics 400 and by 4.9 points on Epic Kitchens, with almost no change in compute or runtime.
Regularising for Epic Kitchens and Something-Something v2
The models overfitted on Epic Kitchens and Something-Something v2 even with an ImageNet pretrained start, so regularisers were added to the Factorised encoder. Table 4 adds them one at a time on Epic Kitchens, from 38.4 action accuracy with random crop, flip and colour jitter, to 39.6 with Kinetics 400 initialisation, 40.2 with stochastic depth, 41.1 with random augment, 43.1 with label smoothing and 43.7 with mixup.
With all of them the Epic Kitchens gain is 5.3%, and the Something-Something v2 gain is similar at 5%.
Stochastic depth drops whole layers during training, and the drop probability grows linearly with depth. Label smoothing replaces the one-hot label with a mixture, \(\tilde{y}=(1-\lambda)y+\lambda u\), where u is a uniform distribution and λ lies in [0, 1]. Mixup trains on convex combinations of pairs of inputs and their labels, with the mixing weight drawn from a Beta distribution.
Random augment applies a sequence of transformations, and the same transformation is applied to every frame of a video so that it stays temporally consistent.
Table 7 lists the Epic Kitchens settings as stochastic drop rate 0.2, label smoothing 0.2, mixup alpha 0.1, and random augment with 2 layers and magnitude 15. For Something-Something v2 the listed settings are 0.3, 0.3 and 0.3 for those three regularisers, with 2 layers and magnitude 20 for random augment. Kinetics and Moments in Time were trained without these extra regularisers, with only the crop, flip and colour jitter augmentation, because the authors obtained state-of-the-art results without them.
Spatial resolution and number of frames
Table 5 raises the spatial crop of ViViT-L/16x2 with spatio-temporal attention on Kinetics 400 from 224 to 288 and to 320. Top-1 accuracy goes from 80.3 to 80.7 and 81.0, while GFLOPs rise from 1446 to 2919 and 3992, and runtime from 58.9 to 147.6 and 238.8. The comparisons with prior work use the 224 crop, and the authors note that further gains can be obtained at higher resolutions.
The default input is 32 frames with stride 2, and the Factorised encoder was also run with 64 and 128 frames at the same stride. A Kinetics video has 250 frames, so a 128-frame clip with stride 2 covers the whole video in a single view. The 32-frame model needed 995.3 GFLOPs per view and four views to saturate multi-view accuracy. The 128-frame model needed 3980.4 GFLOPs with one view, and it reached the highest accuracy.
The unfactorised Model 1 ran out of memory after 48 frames with tubelet length 2 and a Large backbone, which is why this experiment uses the Factorised encoder.
For Model 1, moving from ViViT-B to ViViT-L gave consistent accuracy gains, and compute grew with the backbone size.
Comparison with prior work on five benchmarks
The ViViT rows in the Kinetics table are for the Factorised encoder, with ViViT-L/16x2 reaching 80.6 Top-1 with one temporal and one spatial view, and 81.7 with three spatial crops per view. With ImageNet pretraining, the 81.7 row sits above X3D-XXL at 80.4, which uses 10 temporal and 3 spatial views, and above TimeSformer-L at 80.7, which uses 1 temporal and 3 spatial views.
On Kinetics 600 the same model reaches 82.9, against 82.2 for TimeSformer-L and 81.9 for X3D-XL.
With JFT pretraining the Factorised encoder reaches 83.5 on Kinetics 400 with 1x3 views, and the ViViT-H/14x2 model reaches 84.9 with 4 temporal and 3 spatial views and 47.77 TFLOPs over all views. On Kinetics 600 the ViViT-H/14x2 JFT model reaches 85.8, and the ViViT-L/16x2 FE JFT model reaches 84.3. The authors note these pretrained models are not directly comparable with prior work, and they compare them with ip-CSN-152 pretrained on Instagram data, which scores 82.5 with 10 temporal and 3 spatial views.
The authors attribute the lower accuracy on this dataset to diverse videos and label noise. The only method with higher verb accuracy used optical flow as an additional input.
The paper reports a 2.9% margin over the concurrent TimeSformer model, which also uses a pure-transformer design but not this factorisation or the regularisers. The authors also observe an inverse relation between how prior methods rank on Something-Something v2 and on Kinetics, which they read as the two datasets testing different characteristics.
Limits of the evidence
The unfactorised Model 1 overfits on the smaller Epic Kitchens, and the Factorised encoder performs best there in these experiments. Kinetics and Moments in Time were trained without the extra regularisers, so their results do not show how the regularisers behave on those datasets.
On Something-Something v2 the margin over prior methods is small, and the authors identify capturing fine-grained motion as an area for improvement. Moments in Time results are affected by diverse videos and label noise.
The approach still relies on image pretraining, and removing that dependence is left to future work. Crop sizes above 320 were not tested, and the authors only note that further gains may be possible at higher resolutions. Prior-work comparisons mix different pretraining data and view counts, so the rows in the state-of-the-art tables are not a single controlled experiment.
Paper info
- Authors
- Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Lučić, Cordelia Schmid
- Venue
- arXiv · Preprint
- First published
- 2021-3-29
- Added
- 2026-11-12
- Updated
- 2021-11-1
- Version
- v2
- arXiv
- 2103.15691
- Category
- cs.CV
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Lučić, Cordelia Schmid (2021). ViViT: A Video Vision Transformer. arXiv:2103.15691v2. https://arxiv.org/abs/2103.15691v2
BibTeX
@misc{arnab2021vivit,
title = {{ViViT: A Video Vision Transformer}},
author = {Anurag Arnab and Mostafa Dehghani and Georg Heigold and Chen Sun and Mario Lučić and Cordelia Schmid},
year = {2021},
eprint = {2103.15691},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2103.15691v2}
}