Abstract
Geometric distortion in document images, such as page warping and perspective shifts, significantly degrades the performance of downstream tasks like Optical Character Recognition (OCR). This paper presents DocGeoNet, a novel deep learning framework that rectifies these distortions by explicitly modeling two fundamental geometric constraints: global 3D shape and local textlines. By combining a Transformer-based structure encoder with a CNN-based textline extractor, DocGeoNet achieves state-of-the-art results on the DocUNet benchmark and a newly introduced real-world dataset, DIR300.
Introduction
Capturing documents with mobile devices often introduces "geometric distortion" due to physical folds, curved pages, or camera angles. While existing deep learning methods attempt to "unwarp" these images by predicting displacement fields, they frequently treat the process as a black box, ignoring the inherent geometric properties of documents. Specifically, document surfaces possess a mathematical 3D structure, and textlines—though curved in distorted photos—should be perfectly horizontal and straight in a rectified image. DocGeoNet addresses these challenges by integrating explicit geometric representations into the learning process.
Proposed Method: DocGeoNet
DocGeoNet employs a "divide and conquer" strategy to capture both global and local geometric cues. The architecture consists of four primary stages:
- Preprocessing: A lightweight semantic segmentation network removes the background, ensuring the model focuses solely on the document content.
- Structure Encoder (Global): A Transformer-based architecture captures long-range dependencies to estimate the 3D coordinate map of the warped paper. Transformers are particularly effective here as they can relate distant document corners to model the overall page structure.
- Textline Extractor (Local): A CNN-based sub-network identifies textlines. Given that textline membership depends on local pixel neighborhoods, the local receptive fields of a CNN are well-suited for this task.
- Rectification Decoder: The model fuses global 3D shape features and local textline features to predict a high-resolution "warping flow." This flow is then used to transform the distorted image into a flat, planar state.
Experimental Setup
The model was trained and evaluated using several key datasets:
- Doc3D: A large-scale synthetic dataset (100k images) augmented with an automated pipeline for textline annotations.
- DocUNet Benchmark: The standard evaluation set consisting of 130 images. The authors corrected orientation errors in the original benchmark to ensure fair comparison.
- DIR300: A new, more challenging test set introduced in this work. It contains 300 real-world document photos featuring complex backgrounds, varied lighting, and severe deformations.
Results and Discussion
DocGeoNet demonstrates superior performance across both quantitative and qualitative metrics.
Quantitative Performance
On the DocUNet benchmark, DocGeoNet achieved a Local Distortion (LD) score of 7.71, outperforming previous state-of-the-art methods like DocTr (7.76) and DewarpNet (8.39). In terms of OCR accuracy on the DIR300 dataset, the model achieved a Character Error Rate (CER) of 0.2271, a significant improvement over DocTr (0.2320) and DocProj (0.3984).
Key Insights
- Complementary Attributes: The 3D shape provides the global "skeleton" for unwarping, while textlines offer local constraints to ensure text readability and straightness.
- Hybrid Architecture: Utilizing Transformers for global shape and CNNs for local textlines leverages the strengths of each architecture for specific geometric tasks.
- Explicit Supervision: By using loss functions specifically for 3D shape and textline extraction, the model is forced to learn meaningful geometric representations rather than just implicit mappings.
Conclusion
DocGeoNet advances document image rectification by explicitly modeling geometric constraints. While the automated textline annotation pipeline has minor limitations with very small text, the framework remains robust. Future work will focus on refining annotations and addressing extreme illumination challenges such as heavy shadows and glare.
Summary updated