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

Jifeng Wang, Xiang Li, Le Hui, Jian Yang

Abstract

Shadow detection and removal are critical yet challenging tasks in computer vision. Traditionally treated as independent problems, this paper proposes a unified framework called ST-CGAN (Stacked Conditional Generative Adversarial Network). By stacking two CGANs, the model learns to predict a shadow mask and subsequently use it as a spatial prior to reconstruct a shadow-free image. This joint learning approach allows both tasks to mutually inform and improve each other, leading to state-of-the-art results on the newly introduced ISTD dataset.

Introduction

Shadows often complicate downstream vision tasks like object tracking and recognition. While shadow detection identifies the presence and location of shadows, shadow removal aims to restore the underlying texture and color. Previous research typically employed two-stage pipelines where detection and removal were handled by separate, unlinked models.

The authors argue that these tasks are fundamentally synergistic: a precise shadow mask provides the necessary spatial guidance for removal, while the reconstruction process helps the model better distinguish shadows from dark objects. ST-CGAN addresses this by integrating both tasks into a single, end-to-end trainable architecture.

Methodology: The ST-CGAN Architecture

The core innovation of this work is the stacked configuration of two Conditional Generative Adversarial Networks. Unlike standard multi-task architectures that branch out from a shared feature extractor, ST-CGAN processes tasks sequentially.

Overview of the ST-CGAN architecture showing the sequential flow from input image to shadow detection and finally shadow removal.
  1. Shadow Detection ($G_1$): The first generator takes the original image and produces a binary shadow mask.
  2. Shadow Removal ($G_2$): The second generator receives the original image concatenated with the mask from $G_1$. This mask acts as a spatial prior, focusing the network's attention on regions that require illumination and color correction.
  3. Dual Discriminators ($D_1, D_2$): To ensure high-quality outputs, each generator is paired with a discriminator. $D_1$ evaluates the realism of the shadow mask, while $D_2$ ensures the final shadow-free image maintains global color consistency and realistic textures.

Both generators utilize a U-Net structure with skip connections to preserve fine-grained spatial details during the reconstruction process.

The ISTD Dataset

A significant contribution of this research is the creation of the Image Shadow Triplets (ISTD) dataset. Joint learning requires data that includes the original shadow image, the corresponding shadow mask, and a ground-truth shadow-free image.

  • Scale: 1,870 image triplets.
  • Diversity: 135 different scenarios covering various ground materials and lighting conditions. This dataset fills a critical gap, as previous benchmarks like SBU or SRD only provided masks or shadow-free images, but not both.

Key Insights: Stacked vs. Multi-branch

The authors demonstrate that the stacked approach is superior to traditional multi-branch designs for this specific problem. By passing the output of the detection task directly into the removal task, the model establishes a "forward-backward" information flow. The removal stage's requirement for global consistency effectively regularizes the detection stage, preventing it from misclassifying dark, non-shadowed regions as shadows.

Experimental Results

ST-CGAN was evaluated against several state-of-the-art methods, including StackedCNN and scGAN.

Quantitative Performance

On the ISTD dataset, ST-CGAN achieved:

  • Shadow Detection: A Balance Error Rate (BER) of 3.85, a significant improvement over StackedCNN's 8.6.
  • Shadow Removal: A Root Mean Square Error (RMSE) of 7.47 for the entire image, outperforming specialized models like Gong et al. (8.53).

Qualitative Comparison

Visually, ST-CGAN produces more natural results with fewer artifacts. While other methods often leave "ghosting" effects or alter the color of non-shadowed regions, ST-CGAN maintains high fidelity to the original scene's textures and colors.

Qualitative comparison of shadow detection and removal results. ST-CGAN (Ours) shows superior performance in mask accuracy and texture restoration compared to other state-of-the-art methods.

Conclusion

ST-CGAN demonstrates the power of joint learning through a stacked GAN architecture. By treating shadow detection and removal as mutually beneficial tasks, the model achieves superior performance on both. Future work may involve extending this paradigm to other vision tasks where one output serves as a logical prior for another, as well as addressing the challenges of collecting perfectly aligned triplet data in more complex environments.

Summary updated

BibTeX
@inproceedings{wang2018stacked,
  author = {Jifeng Wang and Xiang Li and Le Hui 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