TSM: Temporal Shift Module for Efficient Video Understanding

Ji Lin, Chuang Gan, Song Han

Abstract

The explosive growth in video streaming gives rise to challenges on performing video understanding at high accuracy and low computation cost. Conventional 2D CNNs are computationally cheap but cannot capture temporal relationships; 3D CNN based methods can achieve good performance but are computationally intensive, making it expensive to deploy. In this paper, we propose a generic and effective Temporal Shift Module (TSM) that enjoys both high efficiency and high performance. Specifically, it can achieve the performance of 3D CNN but maintain 2D CNN’s complexity. TSM shifts part of the channels along the temporal dimension; thus facilitate information exchanged among neighboring frames. It can be inserted into 2D CNNs to achieve temporal modeling at zero computation and zero parameters. We also extended TSM to online setting, which enables real-time low-latency online video recognition and video object detection. TSM is accurate and efficient: it ranks the first place on the Something-Something leaderboard upon publication; on Jetson Nano and Galaxy Note8, it achieves a low latency of 13ms and 35ms for online video recognition.

Introduction

Video understanding tasks, such as action recognition, require modeling temporal dynamics across frames. Historically, researchers have faced a stark trade-off between efficiency and accuracy. Standard 2D CNNs are computationally efficient but treat video frames as independent images, failing to capture temporal relationships. Conversely, 3D CNNs can learn joint spatio-temporal features but are computationally expensive and difficult to deploy on edge hardware due to high parameter counts and FLOPs.

The Temporal Shift Module (TSM) addresses this gap by providing the temporal modeling power of a 3D CNN while maintaining the lightweight footprint of a 2D CNN. TSM is a "computationally free" plug-and-play module that enables standard 2D CNNs to achieve state-of-the-art performance in video understanding.

The Temporal Shift Module (TSM)

The core innovation of TSM is the shift operation. A 1D convolution can be decomposed into a shift operation and a multiply-accumulate operation. TSM performs the shift manually along the temporal dimension. For a given frame, TSM takes a portion of its channels and replaces them with channels from neighboring frames. When a standard 2D convolution is subsequently applied to this mingled feature map, it effectively performs temporal modeling because the data at a single spatial location now contains information from multiple time steps.

The TSM mechanism: (left) original tensor, (middle) uni-directional shift for online settings, and (right) bi-directional shift for offline settings.

TSM supports two modes of operation:

  • Offline TSM: Shifts channels bi-directionally (past and future), suitable for post-processing video data.
  • Online TSM: Shifts channels uni-directionally (past to current) and uses a small buffer to cache features, enabling zero-latency real-time inference.

Hardware-Aware Design and Optimization

While the shift operation has zero FLOPs, it can incur data movement overhead. The authors optimized TSM through two key strategies:

  1. Partial Shift: Shifting all channels results in high memory movement overhead and can degrade spatial feature learning. The authors found that shifting only 1/4 of the channels provides the optimal balance between temporal modeling and efficiency, reducing latency overhead from ~13% to ~3%.
  2. Residual Shift: To prevent the loss of information in the current frame, TSM is placed inside the residual branch of a network (e.g., ResNet). This ensures that original features are preserved via the identity shortcut.
Impact of shift proportion on latency overhead (left) and accuracy (right). The 1/4 shift proportion is identified as the optimal "sweet spot."

Experimental Results

The authors evaluated TSM on several benchmarks, including Something-Something (V1 & V2), Kinetics-400, and Jester. Key findings include:

  • State-of-the-Art Performance: TSM achieved the #1 spot on the Something-Something leaderboard at the time of publication, outperforming heavy 3D CNNs.
  • High Efficiency: On a Tesla P100 GPU, TSM achieved 6x higher throughput and 3x lower latency than the I3D (3D CNN) model. On Kinetics, adding TSM to a 2D baseline improved accuracy by 3.5% with zero additional FLOPs.
  • Edge Deployment: TSM is highly effective on low-power hardware, achieving 13ms latency on an NVIDIA Jetson Nano and 35ms on a Samsung Galaxy Note8 for real-time recognition.

Conclusion

TSM demonstrates that high-performance temporal reasoning does not require expensive 3D convolutions. By shifting the "cost" from computation to minimal memory movement, TSM enables high-accuracy video understanding on a wide range of devices. Future work may explore adaptive shifting strategies or extending TSM to more complex tasks like video segmentation and action localization.

Summary updated

BibTeX
@inproceedings{lin2019tsm,
  author = {Ji Lin and Chuang Gan and Song Han},
  title = {{TSM: Temporal Shift Module for Efficient Video Understanding}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2019},
  url = {https://openreview.net/forum?id=FzKtY7D2MJ},
}
Figure