Learning Shadow Correspondence for Video Shadow Detection

Xinpeng Ding, Jingwen Yang, Xiaowei Hu, Xiaomeng Li

Introduction

Video shadow detection (VSD) is a critical task in computer vision, yet it faces a persistent challenge: temporal inconsistency. While single-image shadow detection has matured, applying these models to video often results in "flickering" masks. This occurs because shadow features—the mathematical representations of shadow regions—change inconsistently as lighting conditions shift and backgrounds move across frames. This paper addresses the "shadow feature inconsistency" problem by introducing Shadow-Consistent Correspondence (SC-Cor), a novel training framework designed to enforce fine-grained temporal stability.

The Challenge of Temporal Consistency

The primary hurdle in VSD is that a shadow correctly identified in one frame may be partially or entirely missed in the next due to subtle changes in background texture or illumination. Current approaches typically fall into two categories, both with significant drawbacks:

  1. Frame-level constraints: These treat the entire image as a single unit for consistency. However, they are often too coarse to capture the local, pixel-level variations that define shadow boundaries.
  2. Pixel-to-pixel correspondence: These methods require dense, pixel-perfect labels (similar to optical flow) to track shadows. Such annotations are prohibitively expensive and difficult to produce for complex video sequences.

The authors identify that the lack of robust, fine-grained pixel relations across frames is the root cause of flickering predictions.

Methodology: Shadow-Consistent Correspondence (SC-Cor)

To bridge the gap between coarse frame-level methods and expensive pixel-level labeling, the authors propose SC-Cor. This module is designed as a "plug-and-play" training objective that can be integrated into existing shadow detection architectures.

Pixel-to-Set Correspondence

The core innovation of SC-Cor is the pixel-to-set approach. Instead of forcing a model to match a specific pixel in Frame A to a specific pixel in Frame B, the model identifies an "anchor" shadow pixel in one frame and seeks the most similar representation within the entire set of shadow pixels in a neighboring frame. This flexibility allows the model to learn robust correspondences even when objects are deforming or moving rapidly.

Consistency and Regularization

The framework employs a Shadow Guidance Module to isolate shadow features using ground-truth masks during training. A consistency regularization loss is then applied to "pull" the anchor pixel closer to its best match in the neighboring shadow set while "pushing" it away from non-shadow (background) regions. This dual action enforces high intra-shadow similarity and clear inter-class separability.

Brightness Invariance

To ensure the model is not fooled by fluctuating light sources, the authors implement Brightness-Invariant Correspondence. By randomly shifting the brightness of frames during the training phase, the model is forced to learn features that remain stable regardless of illumination changes.

Inference Efficiency

A significant advantage of SC-Cor is its "plug-and-play" nature. Because it is a loss function used exclusively during training, the module is discarded during the inference phase. This allows the final detector to benefit from improved temporal awareness without any additional computational overhead or reduction in processing speed.

Experimental Evaluation

The authors evaluated their method using the ViSha dataset, a comprehensive benchmark for video shadow detection containing 120 videos and over 11,000 frames.

A New Metric: Temporal Stability (TS)

To better quantify the "flicker" effect, the authors introduced the Temporal Stability (TS) metric. This metric calculates the Intersection over Union (IoU) between a predicted mask and a version of the previous frame's mask that has been warped using optical flow. A higher TS score indicates a more stable and consistent prediction over time.

Key Results

Integrating SC-Cor into state-of-the-art (SOTA) detectors yielded significant performance gains:

  • Accuracy: When applied to the DSD model, SC-Cor improved the IoU by 6.51% and notably reduced the Balance Error Rate (BER).
  • Stability: The method outperformed the previous SOTA (TVSD) by 3.35% on the TS metric, resulting in visually smoother video masks.
  • Versatility: The module proved effective for both single-image detectors (enhancing their video performance) and existing video-based architectures.

Conclusion and Future Work

SC-Cor demonstrates that fine-grained pixel relations are essential for stable video shadow detection. By moving from rigid pixel-to-pixel matching to a flexible pixel-to-set correspondence, the authors provide a computationally "free" boost to temporal consistency.

While the method currently relies on ground-truth masks for training and optical flow for evaluation, its success suggests a promising path forward. The authors propose that this pixel-to-set logic could be adapted to other challenging video tasks, such as salient object detection or video object segmentation, where temporal jitter remains a hurdle.

Summary updated

BibTeX
@inproceedings{ding2022learning,
  author = {Xinpeng Ding and Jingwen Yang and Xiaowei Hu and Xiaomeng Li},
  title = {{Learning Shadow Correspondence for Video Shadow Detection}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-19790-1\_42},
}
Figure