DocDeshadower: Frequency-Aware Transformer for Document Shadow Removal

Ziyang Zhou, Yingtie Lei, Xuhang Chen, Shenghong Luo, Wenjun Zhang, Chi-Man Pun, Zhen Wang · DOI

Introduction

Shadows in document images, often caused by hands or mobile devices during capture, present a significant challenge for downstream tasks such as Optical Character Recognition (OCR) and document segmentation. Traditional heuristic-based methods often fail to generalize across diverse lighting conditions, while standard deep learning models frequently struggle to preserve fine text details or handle varying shadow intensities. The fundamental difficulty lies in the multi-scale nature of shadows: they affect global illumination (low-frequency) while simultaneously distorting sharp text edges (high-frequency).

Methodology

The proposed DocDeshadower architecture addresses these challenges through a "divide and conquer" strategy centered on frequency decomposition.

The DocDeshadower architecture utilizes a Laplacian Pyramid to separate image frequencies, processing them through specialized AAN and GMFT modules.

Frequency Decomposition

The model first decomposes the input image into multiple frequency bands using a Laplacian Pyramid. This allows the network to isolate broad illumination changes from fine-grained textures, enabling specialized processing for each component.

Attention-Aggregation Network (AAN)

The AAN module is specifically designed for low-frequency components. It employs a Channel-wise Normalized Residual (CNR) block to identify shadow regions and a Multi-stage Attentive Aggregation (MAA) block to correct color distortions at the pixel level, ensuring global consistency.

Gated Multi-scale Fusion Transformer (GMFT)

To handle high-frequency components, the authors utilize a Vision Transformer (ViT) architecture. Given that shadows can span large areas, the GMFT captures long-range dependencies. It incorporates a "Gated Identity Attention" (GIA) block to refine edges and textures without significant computational overhead.

Optimization

The model is optimized using a combination of Mean Squared Error (MSE) and Structural Similarity Index (SSIM) loss functions, balancing pixel-level accuracy with structural integrity.

Datasets and Evaluation

DocDeshadower was evaluated on two benchmark datasets:

  • Jung Dataset: Consisting of 60 training and 27 testing images.
  • Kligler Dataset: A larger set featuring 272 training and 28 testing images.

To enhance model robustness, the authors applied extensive data augmentation techniques, including random cropping, flipping, and adjustments to color and brightness.

Results

DocDeshadower achieves state-of-the-art (SOTA) performance across all primary metrics. On the Jung dataset, the model reached a PSNR of 23.52 dB, representing a 3.83 dB improvement over previous benchmarks. It also demonstrated superior performance in SSIM (0.88) and RMSE (17.56).

Qualitatively, the model effectively removes shadows without leaving the "ghost" edges or unnatural color tints common in other models like SG-ShadowNet or BEDSR-Net. The resulting images are highly suitable for OCR and professional document archiving.

Conclusion and Future Work

By leveraging frequency-aware processing and Transformer-based global context, DocDeshadower sets a new standard for document shadow removal. While the results are impressive, future work will focus on improving generalization to lighting conditions outside the standard datasets and optimizing the architecture for real-time performance on mobile devices.

Summary updated

BibTeX
@inproceedings{zhou2024docdeshadower,
  author = {Ziyang Zhou and Yingtie Lei and Xuhang Chen and Shenghong Luo and Wenjun Zhang and Chi-Man Pun and Zhen Wang},
  title = {{DocDeshadower: Frequency-Aware Transformer for Document Shadow Removal}},
  booktitle = {SMC},
  year = {2024},
  doi = {10.1109/smc54092.2024.10831480},
}
Figure