Abstract
We present a lightweight and robust approach for paragraph recognition in document images using spatial Graph Convolutional Networks (GCNs) applied directly to OCR text boxes. By treating document layout analysis as a graph problem rather than a traditional computer vision task, our method achieves comparable or superior accuracy to heavy-duty R-CNN models while maintaining a model size 3–4 orders of magnitude smaller. The pipeline involves two primary steps: line splitting and line clustering, both supported by a $\beta$-skeleton graph structure. Our models demonstrate exceptional generalization from synthetic training data to real-world images and significant robustness to variable document styles and rotations.
Introduction
While Optical Character Recognition (OCR) has matured significantly in converting pixels to text, "logical layout analysis"—the grouping of text into coherent paragraphs—remains a challenge. Standard OCR engines often produce errors such as "run-on" lines that span multiple columns or fail to group related lines together. Existing solutions typically rely on either fragile, handcrafted rule-based systems or massive, computationally expensive image-based deep learning models like Mask R-CNN. The former breaks under unusual layouts, while the latter struggles with high-resolution processing and extreme aspect ratios. We propose a middle ground: a robust, GCN-based approach that is efficient enough for production environments.
Methodology
Our approach ignores original image pixels and text content, focusing entirely on the geometry of OCR bounding boxes. The process is divided into two main stages:
1. Graph Construction
We represent the document as a graph using a $\beta$-skeleton algorithm. Unlike simple K-Nearest Neighbor graphs, the $\beta$-skeleton provides a "goldilocks" level of connectivity—it is sparse enough for high efficiency while remaining sufficiently connected to capture the local neighborhood of every word and line.
2. Two-Step Processing
- Line Splitting: A GCN node classifier analyzes word-level boxes to identify "line starts" and "line ends." This effectively "cuts" OCR lines that have incorrectly merged text from adjacent columns.
- Line Clustering: A GCN edge classifier evaluates pairs of lines to determine if they belong to the same paragraph, utilizing features such as vertical/horizontal spacing and indentations.
The use of Graph Attention Networks (GAT) allows the model to dynamically weigh the importance of neighboring text boxes, which is critical for identifying subtle layout cues like paragraph indentations.
Key Insights and Advantages
Efficiency and Scale
Because the GCN processes coordinates (thousands of points) rather than millions of pixels, the model size is approximately 100KB. This is a staggering reduction compared to the 200MB typically required for a ResNet-101 based Faster R-CNN, making it ideal for mobile and edge deployment.
Rotation Robustness
Image-based models often fail when text is rotated or skewed because they rely on axis-aligned anchors. By operating on relative graph distances, our GCN handles rotated text gracefully, as seen in scene text or skewed document scans.
The $F1_{var}$ Metric
We argue that standard Intersection-over-Union (IoU) metrics are often too harsh for OCR tasks. We introduced a variable IoU threshold ($F1_{var}$) that accounts for the fact that single-line paragraphs are significantly harder to overlap perfectly than large multi-line blocks.
Results and Evaluation
Our models were evaluated on the PubLayNet benchmark and a novel Web Synthetic Page Layout dataset. On PubLayNet, the GCN approach achieved an $F1_{var}$ score of 0.959, outperforming a modified Faster R-CNN (0.945). More importantly, when tested on augmented data with heavy rotations, the image-based model's performance dropped to 0.547, while the GCN remained robust at 0.827.
Conclusion
By shifting paragraph recognition from the pixel domain to the graph domain, we achieve a highly efficient, rotation-robust, and accurate system. Future work will focus on extending this GCN framework to recognize complex entities like tables and lists, and incorporating reading order logic to link paragraphs across multi-column layouts.
Summary updated