Shadow Removal Refinement via Material-Consistent Shadow Edges

Shilin Hu, Hieu Le, ShahRukh Athar, Sagnik Das, Dimitris Samaras

Introduction

Shadow removal remains a fundamental challenge in computer vision due to its ill-posed nature. To accurately restore the underlying surface, a model must disentangle the intrinsic material properties from the extrinsic lighting conditions. While deep learning models trained on paired datasets (images with and without shadows) have shown promise, they often struggle with "in-the-wild" scenes characterized by complex textures and varied lighting. These models frequently produce artifacts such as "ghost" shadows or unnatural color shifts because they fail to distinguish between shadow boundaries and actual material transitions.

Methodology: Test-Time Adaptation with Material-Consistent Edges

The proposed method addresses these limitations through a test-time adaptation (TTA) framework that refines shadow removal for specific images. The pipeline consists of three primary stages:

1. Shadow-Invariant Segmentation

The researchers leverage the Segment Anything Model (SAM), fine-tuning it to become "shadow-blind." Unlike the vanilla SAM, which often segments a single material into multiple parts due to shadow interference, the fine-tuned version maintains consistency across shadow boundaries, treating the shadowed and non-shadowed regions of a single material as one object.

Comparison of vanilla SAM and the proposed fine-tuned shadow-invariant SAM.

2. Extraction of Material-Consistent (MC) Edges

By intersecting the shadow-invariant segments with a standard shadow mask, the system identifies "Material-Consistent (MC) shadow edges." These edges represent locations where a shadow boundary traverses a uniform material, providing a reliable reference for color and texture restoration.

3. Refinement via Multi-Loss Supervision

During the TTA phase, the pre-trained shadow removal model is fine-tuned on the target image using three specific losses: RGB Distance Loss to minimize color differences, RGB Distribution Loss (using Earth Mover’s Distance) to align statistical color spreads, and Texture (LPIPS) Loss to preserve fine-grained structural patterns.

Evaluation and Results

To evaluate performance on complex scenes, the authors introduced the SBU-S and CUHK-S benchmarks, curated from real-world shadow detection datasets. They also proposed the Color Distribution Difference (CDD) metric, which quantifies the disparity in color histograms across MC edges, enabling evaluation without shadow-free ground truth.

Qualitative comparison of shadow removal models before and after refinement, showing significant reductions in CDD scores.

The refinement method achieved a performance improvement of over 30% on the CDD metric when applied to state-of-the-art models like ShadowFormer and SP+M-Net. Notably, the approach effectively mitigates common artifacts such as border "halos" and blue tints, and it significantly improves robustness during cross-dataset testing.

Conclusion

This research demonstrates that foundation models like SAM can be repurposed to provide self-supervision for low-level vision tasks. While the current iterative refinement process (taking approximately 24 seconds per image) is not yet suitable for real-time applications, it offers a powerful solution for high-quality photo editing. Future work may focus on optimizing processing speed and addressing the complexities of soft shadow penumbras.

Summary updated

BibTeX
@inproceedings{hu2025shadow,
  author = {Shilin Hu and Hieu Le and ShahRukh Athar and Sagnik Das and Dimitris Samaras},
  title = {{Shadow Removal Refinement via Material-Consistent Shadow Edges}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2025},
  doi = {10.1109/wacv61041.2025.00261},
}
Figure