Efficient Video Segmentation Models with Per-frame Inference

Yifan Liu, Chunhua Shen, Changqian Yu, Jingdong WangarXiv 2022

Introduction

Semantic segmentation in video sequences is a foundational task for real-time systems such as autonomous vehicles and mobile AR. While standard image-based segmentation models can be applied to each frame independently, they frequently produce temporally inconsistent results, characterized by distracting flickering and jitter. Existing solutions typically rely on multi-frame inference or keyframe propagation, which introduce significant computational overhead or irregular latency. This paper presents a novel training framework that improves temporal consistency while maintaining the efficiency and simplicity of per-frame inference.

The Problem: Accuracy vs. Consistency

Video segmentation models face a trilemma between accuracy, temporal consistency, and inference speed.

  1. Post-processing/Multi-frame models improve smoothness by considering temporal context at test time but are often too slow for real-time use.
  2. Keyframe-based models reduce average computation by propagating features from sparse keyframes, but suffer from "spiky" latency that complicates hardware scheduling.
  3. Per-frame models are fast and predictable but lack the temporal constraints needed to prevent frame-to-frame prediction shifts.

The authors propose that temporal consistency should be treated as a training constraint rather than an inference requirement.

Methodology: Training for Consistency

The core of the approach is a semi-supervised learning scheme that uses video data to supervise a lightweight "student" model. The framework consists of three primary pillars:

1. Motion-Guided Temporal Loss

To enforce smoothness, the model is trained on pairs of adjacent frames. A pre-trained optical flow network (FlowNet) calculates the motion between frame $t$ and $t+1$. The prediction from frame $t$ is warped according to this flow; a temporal loss then penalizes discrepancies between the warped prediction and the model's actual output at $t+1$. This teaches the model to respect the underlying physical motion of objects.

2. Temporal Knowledge Distillation

A high-capacity "teacher" network provides additional guidance. The distillation process includes:

  • Pair-wise-Frames Dependency (PF): Captures local spatial-temporal relationships.
  • Multi-frame Dependency (MF): Utilizes a ConvLSTM to model long-range temporal correlations, which are then distilled into the student's per-frame weights.
The proposed training framework featuring knowledge distillation (PF, MF) and motion-guided temporal loss.

3. Self-training with Pseudo-labels

To leverage large-scale unlabeled video, the teacher network generates high-quality pseudo-labels. These labels allow the student to learn from a much broader distribution of temporal dynamics than available in manually annotated datasets.

Experimental Results

The framework was evaluated on standard benchmarks including Cityscapes and YouTube-VIS. The results demonstrate that "Video" versions of lightweight backbones like MobileNetV2 and HRNet significantly outperform their baseline counterparts in both accuracy (mIoU) and temporal consistency (TC).

Quantitative comparison of various models across temporal consistency, accuracy, and inference speed.

As shown in the performance plots, the proposed models (red stars) occupy the top-right regions, indicating a superior balance of speed and stability. For instance, the trained MobileNetV2 achieved 75.5% mIoU on Cityscapes at over 20 FPS, matching the performance of much heavier architectures while maintaining high temporal smoothness.

Conclusion

By shifting the burden of temporal modeling from inference to training, this work enables lightweight models to produce high-quality, flicker-free video segmentation. This "per-frame inference" paradigm offers the predictable latency required for safety-critical and real-time applications without sacrificing the visual stability typically associated with much slower video-specific models.

Summary updated

BibTeX
@misc{liu2022efficient,
  author = {Yifan Liu and Chunhua Shen and Changqian Yu and Jingdong Wang},
  title = {{Efficient Video Segmentation Models with Per-frame Inference}},
  year = {2022},
  eprint = {2202.12427},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2202.12427},
}
Figure