Leveraging Contrast Information for Efficient Document Shadow Removal

Yifan Liu, Jiancheng Huang, Na Liu, Mingfu Yan, Yi Huang, Shifeng Chen · DOI

TL;DR

This paper introduces a novel end-to-end document shadow removal method that leverages the inherent contrast information within document images to precisely locate and remove shadows without relying on external shadow masks. By employing a coarse-to-fine framework guided by this contrast representation, the method achieves state-of-the-art performance in preserving document content and details.

What Problem Does This Paper Address?

The digitization of documents is crucial for various applications like OCR and layout analysis. However, shadows cast on documents during image capture significantly degrade the quality and accuracy of these downstream tasks. While general shadow removal methods exist, they often fall short for documents due to their unique characteristics, such as dense text and intricate layouts. Existing document-specific methods either require additional information like shadow masks, which are costly to obtain, or fail to fully utilize the rich information already present within the shadowed document itself. This leads to incomplete shadow removal, loss of original content, or a lack of generalization across different shadow scenarios.

Methods

The core innovation of this paper lies in its use of contrast representation to guide shadow removal. Instead of relying on explicit shadow masks, the authors propose a method that extracts shadow information directly from the image's contrast.

  1. Contrast Representation Module (CR): This module first generates a "contrast heatmap" using traditional image processing techniques to enhance the difference between shadowed and non-shadowed regions. This heatmap is then fed into an adaptive adjustment network, which refines it to create a "shadow-scale representation." This representation effectively captures shadow positions, densities, and intensities.
  2. Coarse-to-Fine Framework: The overall pipeline consists of two main stages:
  3. Base Shadow Removal Module: This module, built upon a U-Net architecture, performs an initial, coarse removal of the majority of shadows.
  4. Refine Removal Network Module: This module utilizes a diffusion model for more precise shadow elimination and detail restoration. Crucially, the contrast representation generated by the CR module is integrated into this diffusion network via cross-attention layers. This contrast information acts as a condition, guiding the diffusion model to perform more accurate shadow removal and detail preservation.

The authors emphasize that their method is end-to-end trainable, simplifying the training process compared to traditional multi-stage approaches.

Datasets

The primary dataset used for training and evaluation is the SD7K dataset, which is described as the largest publicly available dataset specifically designed for document shadow removal. It provides paired high-resolution document images with corresponding shadow masks. The authors note that they use only the paired images for training and inference, not the shadow masks, to align with their mask-free approach. They also collected their own real-world document shadow images for generalization testing.

Key Insights and Ideas

  • Leveraging Inherent Information: The paper highlights that document images themselves contain sufficient information for effective shadow removal, negating the need for external shadow masks.
  • Contrast as a Shadow Cue: The core insight is that contrast variations are a strong indicator of shadow presence and characteristics in documents. This allows for a more direct and efficient approach to shadow localization.
  • Adaptive Contrast Adjustment: Recognizing that contrast enhancement can vary significantly across different lighting conditions, the introduction of an adaptive network to adjust the contrast map is crucial for robust performance.
  • Guidance for Diffusion Models: Using the contrast representation as a condition for diffusion models proves effective in guiding the generative process towards accurate shadow removal and detail preservation.

Key Results

  • State-of-the-Art Performance: The proposed method achieves the highest PSNR and SSIM values and the lowest RMSE on the SD7K test set compared to other state-of-the-art methods, indicating superior shadow removal effectiveness and detail preservation.
  • Qualitative Improvements: Visual comparisons (Fig. 5) show that the method effectively removes shadows while preserving text, patterns, and original tones, outperforming other methods that often leave residual shadows or alter document content.
  • Generalization: The method demonstrates good generalization ability on out-of-dataset images, producing visually superior results compared to other methods.
  • Ablation Studies: Experiments confirm the effectiveness of both the contrast condition and the adaptive adjustment of the contrast map, with the full model (w/ condition and w/ adjustment) achieving the best results.

Limitations and Future Work

  • Hardware Dependency: The authors acknowledge that their training and inference are heavily reliant on GPUs, with significant memory requirements, limiting real-time inference capabilities.
  • Tonal Consistency: In some challenging cases, maintaining perfect tonal consistency between shadow-removed regions and the rest of the image remains a limitation.
  • Future Directions: While not explicitly detailed, the limitations suggest potential future work in optimizing for efficiency on less powerful hardware and further improving tonal consistency.

Summary updated

BibTeX
@misc{liu2025leveraging,
  author = {Yifan Liu and Jiancheng Huang and Na Liu and Mingfu Yan and Yi Huang and Shifeng Chen},
  title = {{Leveraging Contrast Information for Efficient Document Shadow Removal}},
  year = {2025},
  eprint = {2504.00385},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.00385},
}
Figure