Shadow Detection with Conditional Generative Adversarial Networks

Vu Nguyen, Tomas F. Yago Vicente, Maozheng Zhao, Minh Hoai, Dimitris SamarasICCV 2017

Abstract

Shadow detection is a fundamental computer vision task complicated by the need for simultaneous local and global scene reasoning and the prevalence of class imbalance. We present scGAN (Sensitivity-conditioned Generative Adversarial Network), a novel approach that introduces a tunable sensitivity parameter ($w$) into the conditional GAN framework. This parameter allows a single trained model to adjust its detection threshold dynamically. Our method achieves a 17% error reduction over previous state-of-the-art methods on major benchmarks like the SBU dataset.

Introduction

Shadow detection requires distinguishing between dark-colored objects (albedo) and actual shadows caused by light obstruction. While local reasoning helps identify dark patches, global reasoning is necessary to ensure these patches are contextually consistent with the scene's lighting. Traditional methods, such as Conditional Random Fields (CRFs), often struggle with this global consistency. Furthermore, the "minority class" nature of shadows makes standard deep learning models prone to high false-negative rates unless specifically tuned, which usually requires expensive retraining.

Methodology: The scGAN Framework

The core innovation of scGAN is the sensitivity parameter ($w$). Unlike standard conditional GANs (cGANs) that map an image directly to a mask, scGAN treats $w$ as an additional input channel to the Generator.

The sensitivity parameter $w$ acts as a "control knob," allowing the Generator to produce masks with varying degrees of aggressiveness from a single model.

Key Components:

  1. Input Conditioning: The Generator (a U-Net architecture) receives the RGB image concatenated with a scalar value $w$.
  2. Weighted Loss: A weighted cross-entropy loss is employed, where $w$ determines the penalty for missing shadow pixels. During training, $w$ is sampled uniformly, teaching the network to understand the relationship between sensitivity and mask generation.
  3. Adversarial Consistency: The Discriminator forces the Generator to produce spatially coherent masks that "look right" for the given scene, effectively replacing complex post-processing steps.
  4. Multi-scale Prediction: To ensure robustness, the model aggregates predictions from the full image and hundreds of overlapping patches at various scales.

Experimental Results

The scGAN was evaluated on the SBU Shadow Dataset (4,000+ images) and the UCF Shadow Dataset.

Quantitative Performance

On the SBU dataset, scGAN achieved a 9.1% Balanced Error Rate (BER), representing a 17% improvement over the previous state-of-the-art, stackedCNN (11.0% BER). In cross-dataset evaluations, where the model was trained on SBU and tested on UCF, it achieved an 11.5% BER, even outperforming models specifically trained on UCF data.

Qualitative Analysis

The model demonstrates superior performance in challenging scenarios, such as detecting shadows on highly reflective surfaces (e.g., snow) and correctly identifying dark-colored materials that are not shadows.

Qualitative comparison showing scGAN's ability to produce cleaner, more accurate masks compared to previous methods like stackedCNN, particularly in avoiding false positives on dark objects.

Conclusion

By introducing a sensitivity "knob" into the GAN framework, scGAN provides a flexible and highly accurate solution for shadow detection. While the current multi-scale inference approach is computationally intensive, the underlying principle of sensitivity conditioning offers a promising path for other imbalanced classification tasks in domains like medical imaging or infrastructure monitoring.

Summary updated

BibTeX
@inproceedings{nguyen2017shadow,
  author = {Vu Nguyen and Tomas F. Yago Vicente and Maozheng Zhao and Minh Hoai and Dimitris Samaras},
  title = {{Shadow Detection with Conditional Generative Adversarial Networks}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2017},
  doi = {10.1109/iccv.2017.483},
}
Figure