DocReal: Robust Document Dewarping of Real-Life Images via Attention-Enhanced Control Point Prediction

Fangchen Yu, Yina Xie, Lei Wu, Yafei Wen, Guozhi Wang, Shuai Ren, Xiaoxin Chen, Jianfeng Mao, Wenye Li

Abstract

Document images captured in real-world settings often suffer from complex physical deformations, perspective shifts, and environmental noise. DocReal addresses these challenges through a robust two-stage dewarping framework. By combining an Enet-based background removal stage with a novel Attention-Enhanced Control Point (AECP) prediction network, the system achieves precise geometric rectification. The AECP module leverages spatial and channel attention along with a dilation pyramid to focus on critical document features like text lines and edges. Furthermore, a physics-informed data synthesis method improves the model's ability to handle realistic paper behaviors. DocReal achieves state-of-the-art results on the DocUNet benchmark and a newly introduced real-life document dataset, significantly improving OCR accuracy.

Introduction

The convenience of smartphone document capture is frequently offset by image quality issues. Physical artifacts such as curls and folds, combined with messy backgrounds and shadows, hinder both human readability and automated processing like Optical Character Recognition (OCR). While traditional 3D reconstruction methods offer high precision, they typically require specialized hardware. Conversely, existing 2D deep learning approaches often struggle with fine-grained "local" deformations, leading to text distortion or "ghosting" artifacts. DocReal is proposed as a practical, high-performance 2D solution that bridges the gap between synthetic training and real-world application.

The DocReal Framework

The DocReal pipeline is structured into two primary stages to handle global and local distortions independently.

1. Background Removal and Coarse Rectification

The process begins with Enet, a fully convolutional encoder-decoder network. Enet is tasked with detecting document boundaries and stripping away background clutter. This stage produces a "coarse" result that addresses the overall perspective and global shape of the document, providing a cleaner input for the subsequent refinement stage.

2. Attention-Enhanced Control Point (AECP) Prediction

The core of the framework is the AECP module, which predicts a dense $31 \times 31$ grid of control points. Unlike standard convolutional networks, AECP incorporates:

  • Spatial and Channel Attention: These mechanisms force the model to prioritize structural features (text lines, paper edges) over irrelevant noise (shadows, textures).
  • Dilation Pyramid: A series of dilated convolutional layers provides a wide receptive field, allowing the network to understand how a deformation in one area (e.g., a corner fold) affects the global geometry of the page.
The DocReal pipeline featuring Enet for coarse rectification and the AECP module for fine-grained control point prediction.

Finally, the predicted control points are mapped to a flat reference grid, and the image is rectified using linear interpolation and remapping.

Data Synthesis and Benchmarking

To improve the "sim-to-real" transfer, the authors developed a sophisticated data synthesis method. By applying mathematical models to 3D meshes from the Doc3D dataset, they simulated realistic paper behaviors such as S-shaped curling and corner folding. This physics-informed approach ensures the model learns the natural constraints of paper deformation.

The framework was evaluated on two key datasets:

  • DocUNet: The standard benchmark for document dewarping.
  • DocReal Benchmark: A new, more challenging dataset consisting of 200 Chinese document images across 10 sub-scenarios and 5 deformation types, designed to better reflect real-world diversity.

Experimental Results

DocReal demonstrates superior performance across both geometric and text-based metrics. On the DocUNet benchmark, it achieved an MS-SSIM of 0.50 and reduced Local Distortion (LD) to 7.03, outperforming previous state-of-the-art models like DocTr and DocGeoNet.

Visual comparison of dewarping results across various state-of-the-art models.

Crucially, the model significantly enhances OCR performance. On the DocReal benchmark, it lowered the Character Error Rate (CER) to 0.4582, compared to 0.4688 for the previous control-point-based baseline (DDCP). Qualitative analysis confirms that DocReal produces straighter text lines and cleaner backgrounds, effectively eliminating the residual noise that often plagues other methods.

Conclusion

DocReal represents a significant advancement in document dewarping by treating geometry as an attention-guided problem. By separating global rectification from local refinement and utilizing physics-informed synthetic data, the framework achieves high robustness in real-life scenarios. Future work will focus on integrating lighting and shadow compensation directly into the dewarping layers to further enhance performance in suboptimal environmental conditions.

Summary updated

BibTeX
@inproceedings{yu2024docreal,
  author = {Fangchen Yu and Yina Xie and Lei Wu and Yafei Wen and Guozhi Wang and Shuai Ren and Xiaoxin Chen and Jianfeng Mao and Wenye Li},
  title = {{DocReal: Robust Document Dewarping of Real-Life Images via Attention-Enhanced Control Point Prediction}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  doi = {10.1109/wacv57701.2024.00072},
}
Figure