Stacked Conditional Generative Adversarial Networks for Jointly Learning Shadow Detection and Shadow Removal

Jifeng Wang, Xiang Li, Jian Yang

Abstract

Shadows present a significant challenge in computer vision, often interfering with object tracking and recognition. While traditionally treated as separate tasks, shadow detection and shadow removal are intrinsically linked. This paper introduces ST-CGAN (Stacked Conditional Generative Adversarial Network), a unified framework that jointly learns both tasks. By stacking two GANs, the model allows detection and removal to mutually inform one another, leading to state-of-the-art performance. We also introduce the ISTD dataset, a large-scale collection of shadow image triplets, to facilitate multi-task learning.

Introduction

Shadows provide essential information about scene geometry and lighting but often degrade the performance of high-level vision algorithms. Historically, researchers have addressed shadow detection and shadow removal in isolation. Detection-only methods frequently fail to distinguish shadows from dark-colored objects due to a lack of global context. Conversely, removal-only methods often introduce color artifacts in non-shadowed regions because they lack precise localization.

Existing two-stage pipelines are typically not end-to-end, preventing the removal stage from providing feedback to the detection stage. To overcome these limitations, we propose a stacked architecture that treats detection and removal as a joint optimization problem, where each task enhances the other.

Methodology: The ST-CGAN Architecture

The core of our approach is the Stacked Conditional Generative Adversarial Network (ST-CGAN). Unlike parallel multi-branch architectures, ST-CGAN utilizes a sequential dependency that mirrors the natural relationship between detection and removal.

The ST-CGAN architecture consists of two stacked generators ($G_1, G_2$) and two discriminators ($D_1, D_2$) for joint shadow detection and removal.

The framework consists of two main components:

  1. Shadow Detection Network ($G_1$): This generator takes the input shadow image and predicts a binary shadow mask.
  2. Shadow Removal Network ($G_2$): This generator takes the original image concatenated with the predicted mask from $G_1$. By receiving an explicit "map" of shadowed regions, $G_2$ can focus its reconstruction efforts more effectively.

Two discriminators, $D_1$ and $D_2$, are employed to ensure the realism of the predicted mask and the final shadow-free image, respectively. This design facilitates a "mutual promotion" effect: an accurate mask simplifies removal, while a successful removal validates the detection.

Datasets and the ISTD Benchmark

Training a joint model requires "triplet" data: the original shadow image, a corresponding shadow mask, and a ground-truth shadow-free image. As existing datasets were often incomplete, we introduced the ISTD (Image Shadow Triplets) dataset. ISTD contains 1,870 image triplets captured across 135 diverse scenarios, providing a rigorous benchmark for simultaneous detection and removal. We also validated our model's detection capabilities on the SBU and UCF datasets.

Experimental Results

ST-CGAN sets new benchmarks in both shadow detection and removal.

Shadow Detection

On the SBU dataset, ST-CGAN achieved a Balance Error Rate (BER) of 11.34%, outperforming previous models like scGAN (13.26%). On our ISTD dataset, the model achieved a remarkably low BER of 3.85%.

Shadow Removal

In terms of reconstruction quality, ST-CGAN achieved a Root Mean Square Error (RMSE) of 7.47 in the LAB color space on the ISTD dataset, a significant improvement over the previous state-of-the-art (8.53).

Qualitative comparison of shadow detection and removal results against state-of-the-art methods.

Qualitatively, ST-CGAN excels at preserving original colors and avoiding "ghosting" artifacts common in local-pixel methods. The use of conditional GANs ensures global consistency, allowing the model to distinguish between dark surfaces and actual shadows.

Conclusion and Future Work

By framing shadow detection and removal as a joint, stacked task, ST-CGAN demonstrates that these two problems are better solved together. The sequential information flow allows for more effective feature sharing and global scene understanding.

While highly effective, the approach faces challenges common to the field, such as the difficulty of capturing perfectly aligned ground-truth triplets due to ambient light variations. Future work will explore the application of this stacked multi-task paradigm to other paired vision problems, such as joint depth estimation and semantic segmentation, and investigate more computationally efficient architectures.

Summary updated

BibTeX
@inproceedings{wang2018stacked,
  author = {Jifeng Wang and Xiang Li and Jian Yang},
  title = {{Stacked Conditional Generative Adversarial Networks for Jointly Learning Shadow Detection and Shadow Removal}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  doi = {10.1109/cvpr.2018.00192},
}
Figure