Distortion-Aware Network Pruning and Feature Reuse for Real-time Video Segmentation

Hyunsu Rhee, Dongchan Min, Sunil Hwang, Bruno Andreis, Sung Ju Hwang

Abstract

Real-time video segmentation is a crucial task for many real-world applications such as autonomous driving and robot control. Since state-of-the-art semantic segmentation models are often too heavy for real-time applications despite their impressive performance, researchers have proposed lightweight architectures with speed-accuracy trade-offs, achieving real-time speed at the expense of reduced accuracy. In this paper, we propose a novel framework to speed up any architecture with skip-connections for real-time vision tasks by exploiting the temporal locality in videos. Specifically, at the arrival of each frame, we transform the features from the previous frame to reuse them at specific spatial bins. We then perform partial computation of the backbone network on the regions of the current frame that captures temporal differences between the current and previous frame. This is done by dynamically dropping out residual blocks using a gating mechanism which decides which blocks to drop based on inter-frame distortion. We validate our Spatial-Temporal Mask Generator (STMG) on video semantic segmentation benchmarks with multiple backbone networks, and show that our method largely speeds up inference with minimal loss of accuracy.

Introduction

Real-time video semantic segmentation—the task of labeling every pixel in a video stream in real-time—is the "eyes" of autonomous vehicles and robots. While we have incredibly accurate models today, they are often too computationally "heavy" for the hardware found in a car or a drone. State-of-the-art (SOTA) segmentation models usually rely on deep residual backbones that are slow. To speed things up, many researchers try to use "optical flow" to warp features from one frame to the next. However, calculating accurate optical flow is often slower than just running a lightweight segmentation model from scratch.

Furthermore, video is highly redundant. In typical driving scenarios, large portions of the frame (e.g., the dashboard or sky) remain static across frames. Computing features for these regions repeatedly is inefficient. The challenge lies in skipping unnecessary work without losing the fine details needed for safety-critical tasks.

Methods: Spatial-Temporal Mask Generator (STMG)

We introduce the Spatial-Temporal Mask Generator (STMG), a model-agnostic framework designed for any architecture with skip-connections (like ResNets). It consists of three main components:

  1. Input-dependent Block Pruning: Residual networks are naturally resilient to layer removal due to their skip connections. STMG uses a Bayesian mechanism (a Dependent Beta-Bernoulli Process) to decide, on the fly, which residual blocks to skip for a specific frame based on its difference from the previous one.
  2. Spatial Masking & Feature Reuse: Instead of recomputing the entire frame, the model generates a 2D "spatial mask" based on the cosine similarity between features of the current and previous frames. It reuses old features for static regions and only performs partial computation on the "distorted" (moving) regions.
  3. Distortion-Aware Scheduling: The system uses a threshold-based policy: if a frame has significant "distortion" (change), it is processed as a "Key Frame" by the full network. Minor changes result in "Non-Key Frame" processing using the lightweight, pruned treatment.
Overview of the STMG framework, including block pruning, spatial masking, and knowledge distillation.

To train the mask generator without manual labels for every frame, we employ Knowledge Distillation, using a powerful "teacher" network to guide the STMG toward ideal segmentation outputs.

Experimental Results

The framework was validated on two industry-standard benchmarks: Cityscapes (urban street scenes) and CamVid (road-scene parsing). We tested the approach on SOTA real-time backbones like DDRNet-39 and DDRNet-23-Slim.

Key results include:

  • DDRNet-39 on Cityscapes: Inference speed increased from 22.1 FPS to 32.6 FPS (a 47.5% gain) with only a 1.47% drop in mIoU (from 80.3% to 79.1%).
  • DDRNet-23-Slim: Achieved a blistering 116 FPS, making it highly suitable for high-speed applications.
  • Efficiency: The method significantly reduced FLOPs by skipping redundant computations in static background areas.
Speed-accuracy trade-off comparison on Cityscapes. STMG variants achieve significant FPS gains with minimal mIoU loss.

Conclusion and Future Work

Our method demonstrates that pixel-perfect motion vectors are not required for effective feature reuse; simple feature similarity is sufficient to guide network pruning. While effective, the system currently requires keeping both the main network and the STMG in GPU memory, which may be a hurdle for memory-constrained devices. Additionally, feature reuse can lead to "drift" over long sequences, a challenge mitigated here by frequent keyframes. Future work will explore longer temporal sequences to further refine the pruning mechanism's intelligence.

Summary updated

BibTeX
@misc{rhee2022distortion,
  author = {Hyunsu Rhee and Dongchan Min and Sunil Hwang and Bruno Andreis and Sung Ju Hwang},
  title = {{Distortion-Aware Network Pruning and Feature Reuse for Real-time Video Segmentation}},
  year = {2022},
  eprint = {2206.09604},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.09604},
}
Figure