Document Layout Analysis repos for development with PdfPig.
From wikipedia: Document layout analysis is the process of identifying and categorizing the regions of interest in the scanned image of a text document. A reading system requires the segmentation of text zones from non-textual ones and the arrangement in their correct reading order. Detection and labeling of the different zones (or blocks) as text body, illustrations, math symbols, and tables embedded in a document is called geometric layout analysis. But text zones play different logical roles inside the document (titles, captions, footnotes, etc.) and this kind of semantic labeling is the scope of the logical layout analysis.
Related projects
- PdfPig - Read text content from PDFs in C# (port of PdfBox)
- camelot-sharp (port of camelot) - Extract tables from PDF files
- tabula-sharp (port of tabula-java) - Extract tables from PDF files
- PublayNetSharp - Extract and convert PubLayNet data to PageXml format
- PublayNet-maskrcnn-mlnet - Using a MaskRCNN model trained on the PublayNet dataset with ML.Net in C# / .Net for Document layout analysis and page segmmentation task.
- PdfPig MLNet Block Classifier - Proof of concept of training a simple Region Classifier using PdfPig and ML.NET (LightGBM).
- PdfPig SVM Region Classifier - Proof of concept of a simple SVM Region Classifier using PdfPig and Accord.Net.
- simple-docstrum - A step-by-step implementation of the Docstrum algorithm for pdf documents
Cited by
- LayoutParser: A Unified Toolkit for Deep Learning Based Document Image Analysis | Zejiang Shen, Ruochen Zhang, Melissa Dell, Benjamin Charles Germain Lee, Jacob Carlson, and Weining Li | website | github
Resources
- Text extraction
- Word segmentation
- Page segmentation
- Zone classification/extraction & Reading order
- NLP & ML
- Related topics
- Datasets
- Output file format
Text extraction
- High precision text extraction from PDF documents | Øyvind Raddum Berg
- User-Guided Information Extraction from Print-Oriented Documents | Tamir Hassan
- Combining Linguistic and Spatial Information for Document Analysis | Aiello, Monz and Todoran
- New Methods for Metadata Extraction from Scientific Literature | Dominika Tkaczyk
- A System for Converting PDF Documents into Structured XML Format | Hervé Déjean, Jean-Luc Meunier
- Layout and Content Extraction for PDF Documents | Hui Chao, Jian Fan
- DocParser: Hierarchical Structure Parsing of Document Renderings | J. Rausch, O. Martinez, F. Bissig, C. Zhang, and S. Feuerriegel
Word segmentation
- An Efficient Word Segmentation Technique for Historical and Degraded Machine-Printed Documents | M. Makridis, N. Nikolaou, B. Gatos
- Word Extraction Using Area Voronoi Diagram | Zhe Wang, Yue Lu, Chew Lim Tan
- A word extraction algorithm for machine-printed documents using a 3D neighborhood graph model | Young-Jung Yu, Hwan-Gue Cho
- Recognition of Multi-Oriented, Multi-Sized, and Curved Text | Yao-Yi Chiang, Craig A. Knoblock
Page segmentation
- Performance Comparison of Six Algorithms for Page Segmentation | Faisal Shafait, Daniel Keysers, and Thomas M. Breuel
- A Fast Algorithm for Bottom-Up Document Layout Analysis | Anikó Simon, Jean-Christophe Pret, and A. Peter Johnson
- Empirical Performance Evaluation Methodology and its Application to Page Segmentation Algorithms: A Review | Pinky Gather, Avininder Singh
- Layout Analysis based on Text Line Segment Hypotheses | Thomas M. Breuel
- Hybrid Page Layout Analysis via Tab-Stop Detection | presentation | Ray Smith
- Extending the Page Segmentation Algorithms of the Ocropus Documentation Layout Analysis System | Amy Alison Winder
- Object-Level Document Analysis of PDF Files | Tamir Hassan
- Document Image Segmentation as a Spectral Partitioning Problem | Dasigi, Jain and Jawahar
- Benchmarking Page Segmentation Algorithms | S. Randriamasy, L. Vincent
Recursive XY Cut
The X-Y cut segmentation algorithm, also referred to as recursive X-Y cuts (RXYC) algorithm, is a tree-based top-down algorithm.
The root of the tree represents the entire document page. All the leaf nodes together represent the final segmentation. The RXYC algorithm recursively splits the document into two or more smaller rectangular blocks which represent the nodes of the tree. At each step of the recursion, the horizontal and vertical projection profiles of each node are computed. Then, the valleys along the horizontal and vertical directions, VX and VY, are compared to corresponding predefined thresholds TX and TY. If the valley is larger than the threshold, the node is split at the mid-point of the wider of VX and VY into two children nodes. The process continues until no leaf node can be split further. Then, noise regions are removed using noise removal thresholds TnX and TnY. source
- Recursive X-Y Cut using Bounding Boxes of Connected Components | Jaekyu Ha, Robert M. Haralick and Ihsin T. Phillips
Docstrum
The Docstrum algorithm by Gorman is a bottom-up approach based on nearest-neighborhood clustering of connected components extracted from the document image. After noise removal, the connected components are separated into two groups, one with dominant characters and another one with characters in titles and section heading, using a character size ratio factor fd. Then, K nearest neighbors are found for each connected component. Then, text-lines are found by computing the transitive closure on within-line nearest neighbor pairings using a threshold ft. Finally, text-lines are merged to form text blocks using a parallel distance threshold fpa and a perpendicular distance threshold fpe. source
- The Document Spectrum for Page Layout Analysis | Lawrence O'Gorman
- Document Structure and Layout Analysis | Anoop M. Namboodiri and Anil K. Jain
- Document Layout Analysis | Garrett Hoch
Voronoi
The Voronoi-diagram based segmentation algorithm by Kise et al. is also a bottom-up algorithm. In the first step, it extracts sample points from the boundaries of the connected components using a sampling rate sr. Then, noise removal is done using a maximum noise zone size threshold nm, in addition to width, height, and aspect ratio thresholds. After that the Voronoi diagram is generated using sample points obtained from the borders of the connected components. Superfluous Voronoi edges are deleted using a criterion involving the area ratio threshold ta, and the inter-line spacing margin control factor fr. Since we evaluate all algorithms on document pages with Manhattan layouts, a modified version of the algorithm is used to generate rectangular zones.source
- Voronoi++: A Dynamic Page Segmentation approach based on Voronoi and Docstrum features | Mudit Agrawal and David Doermann
Constrained text-line detection
The layout analysis approach by Breuel finds text-lines as a two step process:
- Find tall whitespace rectangles and evaluate them as candidates for gutters, column separators, etc. The algorithm for finding maximal empty whitespace is described in Breuel. The whitespace rectangles are returned in order of decreasing quality and are allowed a maximum overlap of Om.
- The whitespace rectangles representing the columns are used as obstacles in a robust least square, globally optimal text-line detection algorithm. Then, the bounding box of all the characters making the text-line is computed.
The method was merely intended by its author as a demonstration of the application of two geometric algorithms, and not as a complete layout analysis system; nevertheless, we included it in the comparison because it has already proven useful in some applications. It is also nearly parameter free and resolution independent.
source
- Two Geometric Algorithms for Layout Analysis | Thomas M. Breuel
- High precision text extraction from PDF documents | Øyvind Raddum Berg
- High Performance Document Layout Analysis | Thomas M. Breuel
PDF/A standard
PDF/A-1a compliant document make the following information available:
- Language specification
- Hierarchical document structure
- Tagged text spans and descriptive text for images and symbols
- Character mappings to Unicode
Zone classification/extraction & Reading order
- Page Segmentation and Zone Classification: The State of the Art | O. Okun, D. Doermann, M. Pietikainen
- Looking Beyond Text: Extracting Figures, Tables and Captions from Computer Science Papers | C. Clark, S. Divvala
- PDFFigures 2.0: Mining Figures from Research Papers | C. Clark, S. Divvala
- Document image zone classification: A simple high-performance approach | D. Keysers, F. Shafait, T. M. Breuel
- Document-Zone Classification using Partial Least Squares and Hybrid Classifiers | W. Abd-Almageed, M. Agrawal, W. Seo, D. Doermann
- The Zonemap Metric for Page Segmentation and Area Classification in Scanned Documents | O. Galibert, J. Kahn and I. Oparin
- Layout analysis and content classification in digitized books | A. Corbelli, L. Baraldi, F. Balducci, C. Grana, R. Cucchiara
Reading order
-
Unsupervised document structure analysis of digital scientific articles | S. Klampfl, M. Granitzer, K. Jack, R. Kern
-
Document understanding for a broad class of documents | M. Aiello, C. Monz, L. Todoran, M. Worring
-
A Data Mining Approach to Reading Order Detection | M. Ceci, M. Berardi, G. A. Porcelli
Table
- A survey of table recognition | R. Zanibbi, D. Blostein, J.R. Cordy
- Design of an end-to-end method to extract information from tables | A. Costa e Silva, A. Jorge, L. Torgo
- A Table Detection Method for PDF Documents Based on Convolutional Neural Networks | L. Hao, L. Gao, X. Yi, Z. Tang
- Extracting Tables from Documents using Conditional Generative Adversarial Networks and Genetic Algorithms | N. Le Vine, M. Zeigenfuse, M. Rowany
- Detecting Table Region in PDF Documents Using Distant Supervision | Miao Fan and Doo Soon Kim
- Automatic Tabular Data Extraction and Understanding | R. Rastan
- Algorithmic Extraction of Data in Tables in PDF Documents | A. Nurminen
- A Multi-Layered Approach to Information Extraction from Tables in Biomedical Documents | N. Milosevic
- Integrating and querying similar tables from PDF documentsusing deep learning | Rahul Anand, Hye-young Paik and Chen Wang
- Locating Tables in Scanned Documents for Reconstructing and Republishing | MAC Akmal Jahan, Roshan G Ragel
- Recognition of Tables and Forms | Bertrand Coüasnon, Aurélie Lemaitre
- TableBank: Table Benchmark for Image-based Table Detection and Recognition | M. Li, L. Cui, S. Huang, F. Wei, M. Zhou and Z. Li
- Looking Beyond Text: Extracting Figures, Tables and Captions from Computer Science Papers | Christopher Clark and Santosh Divvala |
website
- A Table Detection Method for Multipage PDF Documents via Visual Seperators and Tabular Structures | J. Fang, L. Gao, K. Bai, R. Qiu, X. Tao, Z. Tang
- A Rectangle Mining Method for Understandingthe Semantics of Financial Tables | X. Chen, L. Chiticariu, M. Danilevsky, A. Evfimievski and P. Sen
- Table Header Detection and Classification | J. Fang, P. Mitra, Z. Tang, C. L. Giles
- Configurable Table Structure Recognition in Untagged PDF Documents | A. Shigarov, A. Mikhailov, A. Altaev |
ppt
- Complicated Table Structure Recognition | Z. Chi, H. Huang, H. Xu, H. Yu, W. Yin, X. Mao | github
Systems
- pdf2table: A Method to Extract Table Information from PDF Files | Burcu Yildiz, Katharina Kaiser, and Silvia Miksch
- PDF-TREX: An Approach for Recognizing and Extracting Tables from PDF Documents | Ermelinda Oro, Massimo Ruffolo
- TAO: System for Table Detection and Extraction from PDF Documents | Martha O. Perez-Arriaga, Trilce Estrada, and Soraya Abad-Mota
Sparse line
- Identifying Table Boundaries in Digital Documents via Sparse Line Detection | Ying Liu, Prasenjit Mitra, C. Lee Giles
- A Fast Preprocessing Method for Table Boundary Detection: Narrowing Down the Sparse Lines using Solely Coordinate Information | Ying Liu, Prasenjit Mitra, C. Lee Giles
- Improving the Table Boundary Detection in PDFs by Fixing the Sequence Error of the Sparse Lines | Ying Liu, Kun Bai, Prasenjit Mitra, C. Lee Giles
- Automatic Table Ground Truth Generation and A Background-analysis-based Table Structure Extraction Method | Yalin Wangt, Ihsin T. Phillips and Robert Haralickt
Chart and diagram
- FigureSeer: Parsing Result-Figures in Research Papers | N. Siegel, Z. Horvitz, R. Levin, S. Divvala, and A. Farhadi
- Extraction, layout analysis and classification of diagrams in PDF documents | Robert P. Futrelle, Mingyan Shao, Chris Cieslik and Andrea Elaina Grimes
- Graphics Recognition in PDF documents | Mingyan Shao and Robert P. Futrelle
- A Study on the Document Zone Content Classification Problem | Yalin Wang, Ihsin T. Phillips, and Robert M. Haralick
- Text/Figure Separation in Document Images Using Docstrum Descriptor and Two-Level Clustering | Valery Anisimovskiy, Ilya Kurilin, Andrey Shcherbinin, Petr Pohl
- CHART-Synthetic
- Looking Beyond Text: Extracting Figures, Tables and Captions from Computer Science Papers | Christopher Clark and Santosh Divvala |
website
- Metrics for Evaluating Data Extraction from Charts | Adobe Research | github
Mathematical expression
- A Font Setting Based Bayesian Model to Extract Mathematical Expression in PDF Files | Xing Wang, Jyh-Charn Liu
- Mathematical Formula Identification in PDF Documents | Xiaoyan Lin, Liangcai Gao, Zhi Tang, Xiaofan Lin
- Faithful Mathematical Formula Recognition from PDF Documents | Josef B. Baker, Alan P. Sexton and Volker Sorge
- Extracting Precise Data from PDF Documents for Mathematical Formula Recognition | Josef B. Baker, Alan P. Sexton and Volker Sorge
- Mathematical formula identification and performance evaluation in PDF documents | Xiaoyan Lin, Liangcai Gao, Zhi Tang, Josef Baker, Volker Sorge
Margins recognition
- Finding blocks of text in an image using Python, OpenCV and numpy
- Notes on the margins: how to extract them using image segmentation, Google Vision API, and R
- A mixed approach to auto-detection of page body | Liangcai Gao, Zhi Tang, Ruiheng Qiu
- Header and Footer Extraction by Page-Association | Xiaofan Lin
- A System for Converting PDF Documents into Structured XML Format | Hervé Déjean, Jean-Luc Meunier
NLP & ML
- Chargrid: Towards Understanding 2D Documents | A. R. Katti, C. Reisswig, C. Guder, S. Brarda, S. Bickel, J. Höhne, J. B. Faddoul | medium
- Chargrid-OCR: End-to-end trainable Optical Character Recognition through Semantic Segmentation and Object Detection | C. Reisswig, A. R. Katti, M. Spinaci, J. Höhne | slides
- BERTgrid: Contextualized Embedding for 2D Document Representation and Understanding | Timo I. Denk, Christian Reisswig | slides
- LayoutLM: Pre-Training of Text and Layout for Document Image Understanding | Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, Ming Zhou | github
- Detect2Rank: Combining Object Detectors UsingLearning to Rank | S. Karaoglu, Y. Liu., T. Gevers
- DocParser: Hierarchical Structure Parsing of Document Renderings | J. Rausch, O. Martinez, F. Bissig, C. Zhang, and S. Feuerriegel | github | medium
- LayoutParser: A Unified Toolkit for Deep Learning Based Document Image Analysis | Zejiang Shen, Ruochen Zhang, Melissa Dell, Benjamin Charles Germain Lee, Jacob Carlson, and Weining Li | website | github
Pre-trained models
- MaskRCNN on PubLayNet datasets. |
- DocParser
- Object Detection — Document Layout Analysis Using Monk AI
- CDeC-Net
- Graphical Object Detection in document images
- CascadeTabNet
- Parsing PDFs using YOLOV3 (using Camelot)
- PubTables-1M: Towards comprehensive table extraction from unstructured documents
- Interactive demo: Document Layout Analysis with DiT | github
Workshops
Related topics
- Improving typography and minimising computation for documents with scalable layouts | Pinkney, Alexander J.
- Breaking Paragraphs into Lines | D. E. Knuth, M. F. Plass
Bounding boxes
- Fast Visual Object Tracking with Rotated Bounding Boxes | Bao Xin Chen, John K. Tsotsos
- Building Non-Overlapping Polygons for Image Document Layout Analysis Results | C.-A. Boiangiu, Mihai Zaharescu, I. Bucur
- Ensure Non-Overlapping in Document Layout Analysis | C.-A. Boiangiu, B. Raducanu, S. Petrescu, I. Bucur
- Beta-Shape Using Delaunay-Based Triangle Erosion | C.-A. Boiangiu
Images
- Analysing layout information: searching PDF documents for pictures | B. Mathiak et al.
Shape detection
- Polygon Detection from a Set of Lines | Alfredo Ferreira, Manuel J. Fonseca, Joaquim A. Jorge
- A Simple Approach to Recognise Geometric Shapes Interactively | Joaquim A. Jorge and Manuel J. Fonseca
- The Detection of Rectangular Shape Objects Using Matching Schema | Soo-Young Ye, Joon-Young Choi and Ki-Gon Nam
- Edge Detection Based Shape Identification | Vivek Kumar, Sumit Pandey, Amrindra Pal, Sandeep Sharma
- Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or its Caricature | David H. Douglas and Thomas K. Peucker
- Shape description using cubic polynomial Bezier curves | L. Cinque, S. Levialdi, A. Malizia
- New Algorithm for Medial Axis Transform of Plane Domain and details from stackoverflow | Choi, Choi, Moon and Wee
Character Recognition
- RNN-Based Handwriting Recognition in Gboard | Sandro Feuz and Pedro Gonnet |
arxiv
- Handwritten Arabic Digits Recognition Using Bézier Curves | Aissa Kerkour El Miad and Azzeddine Mazroui
Layout Similarity
Dehyphenation
- Dehyphenation - Some empirical methods | Ola S. Bauge
- Improved Dehyphenation of Line Breaks for PDF Text Extraction | Mari Sverresdatter Hernæs
- Dehyphenation of Words and Guessing Ligatures | Sumitra Magdalin Corraya
- How Document Pre-processing affects Keyphrase Extraction Performance | F. Boudin, H. Mougard, D. Cram
Data structure
- Kd-Trees for Document Layout Analysis | Christoph Dalitz
Datasets
- DocBank: A Benchmark Dataset for Document Layout Analysis | M. Li, Y. Xu, L. Cui, S. Huang, F. Wei, Z. Li, M. Zhou |
github
- PubLayNet: largest dataset ever for document layout analysis | Zhong, Tang and Yepes |
github
|ibm article
- DocParser: Hierarchical Structure Parsing of Document Renderings | J. Rausch, O. Martinez, F. Bissig, C. Zhang, and S. Feuerriegel
- TableBank: Table Benchmark for Image-based Table Detection and Recognition | M. Li, L. Cui, S. Huang, F. Wei, M. Zhou and Z. Li
- Document Image Datasets | Jonathan DeGange
Output file format
- hOCR: hocr spec |
- ALTO XML: alto schema |
- TEI: tei-ocr | schema
- PAGE: PAGE-XML |
Validate and transform between OCR file formats (hOCR, ALTO, PAGE, FineReader)
Pdf page to image converter
A Pdf page to image converter is available to help in the research proces. It relies on the mupdf library, available in the sumatra pdf reader.
Pdf layout analysis viewer
A Pdf layout analysis viewer is available, also relies on the mupdf library.