Abstract
Document unwarping is a critical preprocessing step for accurate Optical Character Recognition (OCR), yet traditional global methods often struggle with complex folds and introduce unwanted artifacts. This paper presents the first end-to-end trainable system for piece-wise document unwarping. By decomposing distorted images into local patches and employing a novel differentiable stitching network, the proposed architecture achieves a 4% improvement in image similarity and significantly enhances text recognition accuracy on real-world benchmarks.
The Challenge of Global Unwarping
When capturing documents via mobile devices, geometric distortions such as page curls, folds, and perspective shifts are common. These "warps" severely degrade the performance of OCR engines. Existing state-of-the-art methods typically approach this as a global problem, predicting a single transformation for the entire image. However, global models often over-correct; to fix a severe fold in one corner, they may introduce "spurious warping" in perfectly flat areas.
Furthermore, previous attempts at piece-wise (patch-based) unwarping relied on non-differentiable optimization techniques, such as graph-cuts, to join corrected patches. This prevented these systems from being trained as a single, cohesive unit from start to finish.
A Differentiable Piece-wise Pipeline
The authors propose a three-stage pipeline that is fully differentiable, enabling end-to-end training and optimization:
- Shape Network (SNet): This module predicts a 3D coordinate map of the input image. Representing the physical geometry in 3D space provides a more stable target for learning than raw pixel movements.
- Piece-wise Unwarping Network (PUNet): PUNet breaks the 3D map into $n \times n$ patches. It predicts a "local backward map" (BM) for each patch, focusing on fine-grained local deformations that global models frequently overlook.
- Global Stitching Network (GSNet): This stage utilizes a Canonical Placement Module (CPM) to align patches and a Grid Stitching Feature Pyramid Network (G-FPN) to blend them. A global branch provides context regarding scale and alignment, ensuring patches fit together without visible seams or artifacts.
Datasets and Evaluation
The model was trained and validated using Doc3D, a massive synthetic dataset of 100,000 document images with realistic textures and ground-truth unwarping maps. For real-world performance, the researchers used the DocUNet Benchmark, evaluating both image similarity (MS-SSIM) and local distortion (LD). Additionally, a subset of 51 images from DocUNet was used specifically for OCR evaluation to measure the impact on Character Error Rate (CER) and Word Error Rate (WER).
Key Results
The proposed method outperformed previous leaders, such as DewarpNet, across all primary metrics:
- Image Quality: Achieved a Multi-Scale Structural Similarity (MS-SSIM) of 0.4879, representing a 4% improvement over previous state-of-the-art results.
- OCR Accuracy: On the DocUNet benchmark, the system reduced the Character Error Rate (CER) to 0.3001 and the Word Error Rate (WER) to 0.4302.
- Qualitative Gains: Visual results demonstrate significantly straighter text lines and a marked reduction in wavy artifacts in regions that were originally flat.
Conclusion and Future Work
By adopting a "divide and conquer" strategy, this research demonstrates that complex, multi-fold warps can be effectively managed as a collection of simpler local deformations. The introduction of the differentiable GSNet allows the model to learn how to minimize stitching artifacts during training, providing a hybrid approach that balances local precision with global consistency.
While the system handles scale mismatches effectively, extreme perspective distortions remain a challenge. Future research may explore adaptive patching strategies—where the network dynamically determines patch boundaries based on fold locations—or recurrent structures to handle higher-resolution documents with an arbitrary number of patches.
Summary updated