CANet: A Context-Aware Network for Shadow Removal

Zipei Chen, Chengjiang Long, Ling Zhang, Chunxia Xiao

Abstract

Shadow removal is a critical task in computer vision, as shadows can significantly degrade image quality and interfere with downstream tasks like object detection. This paper presents CANet (Context-Aware Network), a novel two-stage framework that treats shadow removal as an information transfer problem. By identifying unshadowed regions with similar textures and colors, CANet "borrows" contextual information to restore shadowed areas. Experimental results on ISTD and SRD datasets demonstrate that CANet achieves state-of-the-art performance, producing visually superior results with fewer artifacts.

Introduction

Shadows are complex phenomena resulting from the interaction of light sources, scene geometry, and surface properties. While modern deep learning methods have improved shadow removal, many rely solely on increasing the network's receptive field to capture global information. These approaches often overlook a vital cue: the image context. Most shadowed regions have a corresponding unshadowed area within the same image that shares similar texture and color characteristics.

The challenge lies in accurately matching these regions and transferring information without introducing color mismatches or boundary artifacts. CANet addresses this by utilizing a dedicated patch-matching module and a multi-scale feature transfer mechanism, followed by a refinement stage to ensure global consistency.

Methodology

The CANet architecture is divided into two primary stages: Contextual Matching and Transfer (Stage-I) and Refinement (Stage-II).

Stage-I: Contextual Matching and Transfer

Stage-I is the core of the network, designed to find and utilize relevant contextual information. It consists of two main components:

  1. Contextual Patch Matching (CPM): To focus on texture rather than illumination, the network processes "light-unaware" images where global lightness is averaged. A dual-head network analyzes 32x32 patches; one head classifies the patch pair type (e.g., shadow-to-non-shadow), while the other calculates a correlation score based on texture similarity.
  2. Contextual Feature Transfer (CFT): Using the scores from the CPM, the CFT mechanism transfers features from high-correlation non-shadow patches to shadowed regions. This transfer occurs across multiple network scales to preserve both fine details and broad color strokes.

A key design choice in Stage-I is the separate processing of the LAB color space. The L (Lightness) channel, which is most affected by shadows, is handled separately from the A and B (Color) channels to prevent over-processing and color distortion.

Stage-II: Refinement

The initial output from Stage-I may contain minor artifacts or boundary inconsistencies. Stage-II employs a DenseUNet—an encoder-decoder structure with dense connections—to refine the Stage-I result. By taking both the Stage-I output and the original input image, the refinement stage produces a final, high-quality, shadow-free image.

The two-stage architecture of CANet, illustrating the flow from Stage-I (Contextual Matching) to Stage-II (Refinement).

Experiments and Results

CANet was evaluated on two major benchmarks: the ISTD dataset (1,330 training, 540 testing triples) and the SRD dataset (2,680 training, 408 testing pairs). To train the CPM module, the authors also created an auxiliary dataset of over 600,000 patch pairs.

Quantitative Performance

On the ISTD dataset, CANet achieved a Root Mean Square Error (RMSE) of 6.15 for the entire image, outperforming the previous state-of-the-art (6.62). In shadow regions specifically, the RMSE was reduced to 8.86, a significant improvement over the 9.15 achieved by prior methods.

Qualitative Comparison

Visually, CANet excels at producing clean boundaries and natural-looking textures. Unlike previous methods that often leave "ghosting" artifacts or cause color shifts in the recovered areas, CANet’s context-aware approach ensures that the restored regions integrate seamlessly with the surrounding environment.

Qualitative comparison of CANet against other state-of-the-art methods. CANet (column i) shows superior texture restoration and boundary handling.

Conclusion

CANet introduces a powerful paradigm for shadow removal by leveraging internal image context. By treating the problem as a search-and-replace task facilitated by deep feature transfer, it overcomes many limitations of purely generative or brightening-based approaches. While it faces challenges when unique textures are entirely shadowed or when applied to video without temporal constraints, CANet represents a significant step forward in high-fidelity shadow removal.

Summary updated

BibTeX
@misc{chen2021canet,
  author = {Zipei Chen and Chengjiang Long and Ling Zhang and Chunxia Xiao},
  title = {{CANet: A Context-Aware Network for Shadow Removal}},
  year = {2021},
  eprint = {2108.09894},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.09894},
}
Figure