TapLab: A Fast Framework for Semantic Video Segmentation Tapping Into Compressed-Domain Knowledge

Junyi Feng, Songyuan Li, Xi Li, Fei Wu, Qi Tian, Ming-Hsuan Yang, Haibin Ling

TL;DR

TapLab is a novel framework that achieves a 3x to 10x speedup in semantic video segmentation by leveraging motion vectors and residuals already present in compressed video streams (like MPEG-4). By replacing expensive optical flow calculations with these "free" codec features, it achieves 70.6% mIoU on the Cityscapes dataset at nearly 100 FPS on high-resolution 1024×2048 video.

What Problem Does This Paper Address?

Semantic segmentation—the task of assigning a category label to every single pixel—is computationally grueling, especially for high-resolution (1080p or 4K) video. While modern CNNs are accurate, running them on every single frame in a video sequence is redundant and too slow for real-time applications like autonomous driving.

Previous attempts to solve this usually took one of two paths:

  1. Lightweight Models: Designing smaller, faster networks that often sacrifice significant accuracy.
  2. Temporal Propagation: Using optical flow to "warp" the segmentation from a keyframe to subsequent frames. However, calculating optical flow is itself a massive computational bottleneck.

The authors of TapLab ask: Why calculate motion information from scratch when the video file already contains it?

Methods

TapLab introduces three "plug-and-play" modules that tap into the compressed domain (the internal data used by video codecs to save space):

  • Fast Feature Warping (FFW): Instead of computing optical flow, TapLab extracts Motion Vectors (MV) directly from the video stream. It uses these vectors to shift (warp) the feature maps from the previous frame to the current one. This operation is essentially "free" in terms of computation.
  • Residual-Guided Correction (RGC): Motion vectors are coarse (usually 16x16 blocks) and can be noisy. To fix this, TapLab looks at the Residuals (the difference between the predicted frame and the actual frame). It identifies the "worst" regions—where the warping failed—and runs the CNN on just those small patches to refine the results.
  • Residual-Guided Frame Selection (RGFS): Not every frame can be warped successfully (e.g., during a fast camera cut). RGFS calculates a frame-level score based on residuals to decide if a frame is too "hard" to warp. If it is, the system triggers a full CNN inference (treating it as a new keyframe).

Datasets

The authors evaluated TapLab on two primary benchmarks for urban scene understanding:

  • Cityscapes: High-resolution (1024×2048) video of street scenes. This is the primary benchmark for the paper.
  • CamVid: A lower-resolution (720×960) dataset used to demonstrate the framework's consistency across different video qualities.

Key Insights and Ideas

  • The "Good Enough" Nature of MVs: While motion vectors are blocky and less precise than pixel-level optical flow, the authors realized that CNN feature maps are already downsampled (usually by 1/8 or 1/16). This means the coarse resolution of motion vectors actually matches the resolution of the features they are warping.
  • Residuals as Uncertainty Maps: The paper elegantly uses residuals—originally designed for video reconstruction—as a proxy for segmentation uncertainty. High residuals correlate strongly with areas where motion-based warping will fail (like new objects entering the frame).
  • Contextual Bonus: Surprisingly, the authors found that warping can sometimes be more accurate than per-frame inference. Because warping carries over features from previous frames, it can maintain context for objects that are partially moving out of the camera's field of view.

Key Results

TapLab demonstrates a massive leap in the accuracy-vs-speed trade-off:

  • Speed: On Cityscapes (1024×2048), TapLab reached 99.8 FPS with a 70.6% mIoU. A high-speed variant reached over 160 FPS.
  • Efficiency: It runs 3x to 10x faster than the baseline per-frame models it was built upon.
  • Comparison: Compared to other non-per-frame methods like DFF (which uses optical flow), TapLab is significantly faster (99.8 FPS vs. 5.6 FPS) while maintaining comparable or better accuracy.

Limitations and Future Work

  • Codec Dependency: The current implementation relies on the availability of motion vectors and residuals, which are standard in MPEG-4, H.264, and H.265, but might require specific hardware/software decoders to extract efficiently in real-time.
  • Precision Loss: There is still a slight accuracy degradation compared to running a heavy CNN on every single frame.
  • Future Directions: The authors suggest exploring more sophisticated ways to utilize compressed-domain features, perhaps by training the CNN to be "aware" of the motion vectors during the initial feature extraction phase.

Summary updated

BibTeX
@article{feng2022taplab,
  author = {Junyi Feng and Songyuan Li and Xi Li and Fei Wu and Qi Tian and Ming-Hsuan Yang and Haibin Ling},
  title = {{TapLab: A Fast Framework for Semantic Video Segmentation Tapping Into Compressed-Domain Knowledge}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2022},
  url = {https://openreview.net/forum?id=7ztBUDXd5pO},
}
Figure