A Comprehensive Toolkit for High-Quality PDF Content Extraction
A Comprehensive Toolkit for High-Quality PDF Content Extraction
PDF-Extract-Kit is a powerful open-source toolkit designed to efficiently extract high-quality content from complex and diverse PDF documents. Here are its main features and advantages:
Experience PDF-Extract-Kit now and unlock the limitless potential of PDF documents!
Note: PDF-Extract-Kit is designed for high-quality document processing and functions as a model toolbox.
If you are interested in extracting high-quality document content (e.g., converting PDFs to Markdown), please use MinerU, which combines the high-quality predictions from PDF-Extract-Kit with specialized engineering optimizations for more convenient and efficient content extraction.
If you're a developer looking to create engaging applications such as document translation, document Q&A, or document assistants, you'll find it very convenient to build your own projects using PDF-Extract-Kit. In particular, we will periodically update the PDF-Extract-Kit/project directory with interesting applications, so stay tuned!
We welcome researchers and engineers from the community to contribute outstanding models and innovative applications by submitting PRs to become contributors to the PDF-Extract-Kit project.
| Task Type | Description | Models |
|---|---|---|
| Layout Detection | Locate different elements in a document: including images, tables, text, titles, formulas | DocLayout-YOLO_ft, YOLO-v10_ft, LayoutLMv3_ft |
| Formula Detection | Locate formulas in documents: including inline and block formulas | YOLOv8_ft |
| Formula Recognition | Recognize formula images into LaTeX source code | UniMERNet |
| OCR | Extract text content from images (including location and recognition) | PaddleOCR |
| Table Recognition | Recognize table images into corresponding source code (LaTeX/HTML/Markdown) | PaddleOCR+TableMaster, StructEqTable |
| Reading Order | Sort and concatenate discrete text paragraphs | Coming Soon! |
2024.10.22 We are excited to announce that table recognition model StructTable-InternVL2-1B, which supports output LaTeX, HTML and MarkdDown formats has been officially integrated into PDF-Extract-Kit 1.0. Please refer to the table recognition algorithm documentation for usage instructions!2024.10.17 We are excited to announce that the more accurate and faster layout detection model, DocLayout-YOLO, has been officially integrated into PDF-Extract-Kit 1.0. Please refer to the layout detection algorithm documentation for usage instructions!2024.10.10 The official release of PDF-Extract-Kit 1.0, rebuilt with modularity for more convenient and flexible model usage! Please switch to the release/0.1.1 branch for the old version.2024.08.01 Added the StructEqTable module for table content extraction. Welcome to use it!2024.07.01 We released PDF-Extract-Kit, a comprehensive toolkit for high-quality PDF content extraction, including Layout Detection, Formula Detection, Formula Recognition, and OCR.Many current open-source SOTA models are trained and evaluated on academic datasets, achieving high-quality results only on single document types. To enable models to achieve stable and robust high-quality results on diverse documents, we constructed diverse fine-tuning datasets and fine-tuned some SOTA models to obtain practical parsing models. Below are some visual results of the models.
We trained robust Layout Detection models using diverse PDF document annotations. Our fine-tuned models achieve accurate extraction results on diverse PDF documents such as papers, textbooks, research reports, and financial reports, and demonstrate high robustness to challenges like blurring and watermarks. The visualization example below shows the inference results of the fine-tuned LayoutLMv3 model.
Similarly, we collected and annotated documents containing formulas in both English and Chinese, and fine-tuned advanced formula detection models. The visualization result below shows the inference results of the fine-tuned YOLO formula detection model:
UniMERNet is an algorithm designed for diverse formula recognition in real-world scenarios. By constructing large-scale training data and carefully designed results, it achieves excellent recognition performance for complex long formulas, handwritten formulas, and noisy screenshot formulas.
StructEqTable is a high efficiency toolkit that can converts table images into LaTeX/HTML/MarkDown. The latest version, powered by the InternVL2-1B foundation model, improves Chinese recognition accuracy and expands multi-format output options.
Coming Soon!
conda create -n pdf-extract-kit-1.0 python=3.10
conda activate pdf-extract-kit-1.0
pip install -r requirements.txtNote: If your device does not support GPU, please install the CPU version dependencies using
requirements-cpu.txtinstead ofrequirements.txt.
Note: Current Doclayout-YOLO only supports installation from pypi,if error raises during DocLayout-YOLO installation,please install through
pip3 install doclayout-yolo==0.0.2 --extra-index-url=https://pypi.org/simple.
Please refer to the Model Weights Download Tutorial to download the required model weights. Note: You can choose to download all the weights or select specific ones. For detailed instructions, please refer to the tutorial.
python scripts/layout_detection.py --config=configs/layout_detection.yamlLayout detection models support DocLayout-YOLO (default model), YOLO-v10, and LayoutLMv3. For YOLO-v10 and LayoutLMv3, please refer to Layout Detection Algorithm. You can view the layout detection results in the outputs/layout_detection folder.
python scripts/formula_detection.py --config=configs/formula_detection.yamlYou can view the formula detection results in the outputs/formula_detection folder.
python scripts/ocr.py --config=configs/ocr.yamlYou can view the OCR results in the outputs/ocr folder.
python scripts/formula_recognition.py --config=configs/formula_recognition.yamlYou can view the formula recognition results in the outputs/formula_recognition folder.
python scripts/table_parsing.py --config configs/table_parsing.yamlYou can view the table recognition results in the outputs/table_parsing folder.
Note: For more details on using the model, please refer to thePDF-Extract-Kit-1.0 Tutorial.
This project focuses on using models for
high-qualitycontent extraction fromdiversedocuments and does not involve reconstructing extracted content into new documents, such as PDF to Markdown. For such needs, please refer to our other GitHub project: MinerU.
PDF-Extract-Kit aims to provide high-quality PDF content extraction capabilities. We encourage the community to propose specific and valuable needs and welcome everyone to participate in continuously improving the PDF-Extract-Kit tool to advance research and industry development.
This project is open-sourced under the AGPL-3.0 license.
Since this project uses YOLO code and PyMuPDF for file processing, these components require compliance with the AGPL-3.0 license. Therefore, to ensure adherence to the licensing requirements of these dependencies, this repository as a whole adopts the AGPL-3.0 license.
If you find our models / code / papers useful in your research, please consider giving ⭐ and citations , thx :)
…授权
`slanet-plus.onnx` has ONNX-prohibited nested-scope name collisions and fails to import in MIGraphX
[BUG] `table_parsing.py` 处理目录包含多张表格图片时 CUDA Out of Memory | CUDA OOM when parsing a directory with many table images
文档内容提取样例运行错误
Dna data
_pickle.UnpicklingError: invalid load key, 'v'. 错误
file not found
GPU进行OCR识别没有识别出内容,但是代码也没有报错信息, 而CPU能识别
PaddleOCR是2.7.x的版本
你好只用layout_detection的时候怎么获取相应的位置信息的json,目前只有一个 png图片输出。