TimeSformer (Time-Space Transformer) is a video recognition model that treats a video as "a sequence of patches from each frame," feeds it into a Transformer, and computes temporal and spatial self-attention separately in each block. It uses no convolutions at all. Bertasius, Wang, and Torresani of Facebook AI presented it at ICML 2021, in a paper titled "Is Space-Time Attention All You Need for Video Understanding?"
For images, ViT had split an image into patches, arranged them like words, and matched CNN accuracy using only a Transformer encoder. TimeSformer extends ViT to video. The paper lists three advantages of using self-attention for video:
- Weaker inductive bias: The convolutional properties of "looking only nearby" and "being the same under shifts" help when data is scarce, but with plenty of data they may overly restrict the functions the model can represent.
- Direct capture of long-range relations: Convolutions cannot see beyond their receptive field, so long-range relations can only be gathered gradually by stacking layers. Self-attention can directly compare every pair of time steps and positions.
- Fast training and inference: Image Transformers had been reported to train larger models than CNNs within the same compute budget.
However, video has many patches (1,568 even for 8 frames), and self-attention that compares every pair becomes computationally heavy. The paper therefore compared five ways of applying space-time self-attention and showed that "divided attention," which applies temporal attention and spatial attention separately in sequence, is best in both compute and accuracy.
The paper's main results are:
- On Kinetics-400, the default TimeSformer reached 78.0% top-1 with 0.59 TFLOPs of inference compute per video. TimeSformer-L, which sees longer inputs, reached 80.7%, the best at the time.
- Training on Kinetics-400 took only 416 GPU hours, reaching higher accuracy (75.8%) in less time than SlowFast (75.6% with 3,840 GPU hours; both pretrained on ImageNet-1K).
- It can see 96 frames (about 12 seconds of Kinetics video) in a single clip, and outperformed SlowFast by 8–11 points on classification of long videos several minutes in length.

