Temporal Memory Attention for Video Semantic Segmentation

Hao Wang, Weining Wang, Jing Liu

Introduction

Semantic segmentation—the task of assigning a category label to every pixel—becomes significantly more complex in the context of video. While frame-by-frame processing is possible, it fails to leverage temporal relationships, often leading to flickering or inconsistent results. Historically, researchers relied on optical flow to track motion and maintain consistency. However, optical flow requires heavy computation and is prone to error propagation during occlusions or fast motion.

The Temporal Memory Attention Network (TMANet) addresses these issues by replacing explicit motion estimation with a self-attention mechanism that retrieves relevant features from a memory bank of past frames.

Methodology

TMANet consists of four primary stages designed to capture long-range temporal relations efficiently.

Architecture of the Temporal Memory Attention Network (TMANet)
  1. Shared Backbone: A standard feature extractor (e.g., ResNet-50) processes the current "query" frame and a sequence of $T$ past "memory" frames.
  2. Encoding Layers: These layers use 1x1 convolutions for channel reduction and 3x3 convolutions to preserve spatial context, producing "Keys" (for matching) and "Values" (containing feature data).
  3. Temporal Memory Attention (TMA) Module: This core component compares the "Key" of the current frame against the "Keys" of all frames in the memory bank. This creates an attention map identifying relevant past information, which is then used to retrieve corresponding "Values."
  4. Feature Aggregation: The retrieved memory features are concatenated with the current frame's features and passed to a segmentation head for final prediction.

Experimental Setup

The model was evaluated on two major benchmarks for urban scene understanding:

  • Cityscapes: 5,000 high-quality images of urban driving scenes with 19 classes.
  • CamVid: A dataset consisting of 4 video sequences with 11 semantic categories.

Key Results and Insights

TMANet achieves state-of-the-art (SOTA) results while maintaining high efficiency compared to existing methods.

Performance comparison on Cityscapes and CamVid benchmarks
  • Accuracy: On Cityscapes, TMANet achieved 80.3% mIoU, outperforming the previous leader, TDNet (79.9%). On CamVid, it reached 76.5% mIoU, again surpassing TDNet (76.0%).
  • Efficiency: TMANet requires only 754 GFLOPs, significantly lower than TDNet (1082 GFLOPs) and traditional flow-based methods like DFF or Netwarp, which exceed 919 GFLOPs.

Ablation Insights

  • Memory Depth: Increasing memory from 2 to 4 frames provides a significant boost, though 6 frames show diminishing returns, suggesting 4 frames is the "sweet spot."
  • Sampling Strategy: Continuous frame sampling (immediate past) outperformed random sampling because the visual representation remains more highly correlated.
  • Spatial Context: The inclusion of 3x3 convolutions in the encoding layer is vital; using only 1x1 convolutions degrades performance by losing local spatial structures.

Conclusion

TMANet demonstrates that explicit optical flow is not strictly necessary for high-performance video segmentation. By utilizing a temporal memory attention mechanism, the framework achieves superior accuracy and efficiency, offering a robust alternative for real-time urban scene understanding.

Summary updated

Abstract

Video semantic segmentation requires to utilize the complex temporal relations between frames of the video sequence. Previous works usually exploit accurate optical flow to leverage the temporal relations, which suffer much from heavy computational cost. In this paper, we propose a Temporal Memory Attention Network (TMANet) to adaptively integrate the long-range temporal relations over the video sequence based on the self-attention mechanism without exhaustive optical flow prediction. Specially, we construct a memory using several past frames to store the temporal information of the current frame. We then propose a temporal memory attention module to capture the relation between the current frame and the memory to enhance the representation of the current frame. Our method achieves new state-of-the-art performances on two challenging video semantic segmentation datasets, particularly 80.3% mIoU on Cityscapes and 76.5% mIoU on CamVid with ResNet-50.
BibTeX
@inproceedings{wang2021temporal,
  author = {Hao Wang and Weining Wang and Jing Liu},
  title = {{Temporal Memory Attention for Video Semantic Segmentation}},
  booktitle = {ICIP},
  year = {2021},
  url = {https://openreview.net/forum?id=Wbc1H1x3TU},
}
Figure