layoutparser
A unified toolkit for Deep Learning Based Document Image Analysis
What it is and what it does
LayoutParser is a unified toolkit for document image analysis built on deep learning. It provides pre-trained models for detecting layout regions (text blocks, tables, figures) in document images and PDFs, along with specialized data structures and APIs for filtering, cropping, and analyzing those regions. The package integrates with OCR tools and supports loading layout data from JSON, CSV, and PDF files.
Typical workflows involve loading an image, running a layout detection model to identify regions, filtering or cropping regions of interest, optionally running OCR on each region, and visualizing results. It's designed for tasks like table extraction, hierarchical document parsing, and structured data extraction from scanned or digital documents. The package depends on computer vision (opencv-python, pillow, scipy) and data handling (numpy, pandas, pyyaml) libraries, plus PDF-specific tools (pdfplumber, pdf2image).
Use it for:
- Extract tables from PDFs or scanned documents by detecting table regions and running OCR on each cell.
- Analyze complex multi-column documents by filtering layout regions by spatial position (e.g., left column only).
- Build document processing pipelines that detect and segment different content types (text, images, tables) for downstream processing.
- Convert unstructured document images into structured data by detecting layout regions and extracting text via OCR.
- Visualize document structure by drawing detected layout regions on images with element IDs and transparency.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
LayoutParser provides deep learning-based document layout detection and analysis, with APIs for detecting layout regions, filtering elements, performing OCR, and loading/visualizing document structures from images and PDFs.
Yes, if you need document layout detection and are comfortable with a dormant package. LayoutParser has low install friction, permissive licensing, no known vulnerabilities, and strong community adoption. However, the last release was 2022-04-06—verify that its dependencies (especially opencv-python and deep learning model URLs) remain compatible with your environment before committing to production use.
Install
layoutparser on PyPI
pip
pip install layoutparseruv
uv add layoutparserpoetry
poetry add layoutparserInstalling layoutparser
Before you install
Low friction installation with a pure Python wheel and nine runtime dependencies (numpy, opencv-python, scipy, pandas, pillow, pyyaml, iopath, pdfplumber, pdf2image). Package is dormant—last release was 2022-04-06, over 1591 days ago, though the repository remains active with recent commits.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions. No notable licensing constraints for most use cases.
Quickstart
pip install layoutparser
import layoutparser as lp
model = lp.AutoLayoutModel('lp://EfficientDete/PubLayNet')
layout = model.detect(image)
Requires a pre-trained model URL or local model path; deep learning model downloads may be large and require network access on first use.
Verify before relying
- Whether pre-trained models are automatically downloaded or must be manually configured.
- Current compatibility with modern versions of opencv-python, scipy, and pandas given the 2022-04-06 release date.
- Whether Detectron2 backend setup (mentioned in docs) is required for all layout detection tasks or only specific models.
- Actual monthly download volume and PyPI ranking to confirm production-readiness despite dormant status.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 9 — numpy, opencv-python, scipy, pandas, pillow, pyyaml, iopath, pdfplumber, pdf2image |
| Maintenance | dormant — 1,591 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,190,511/month — #4,241 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: layoutparser-0.3.4-py3-none-any.whl
Keywords: layout analysis, deep learning
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
unstructured-inferenceRuns inference on layout-parsing and…
permissive · top 5,000 on PyPI
surya-ocrSurya is an OCR and document intelligence model…
permissive · top 5,000 on PyPI
python-doctrpython-doctr extracts and localizes text from…
permissive · top 15,000 on PyPI
marker-pdfMarker converts PDFs, images, and other…
permissive · top 15,000 on PyPI
docling-ibm-modelsProvides AI models for table structure…
permissive · top 5,000 on PyPI
cnstdDetects text and mathematical formulas in…
permissive · top 15,000 on PyPI
pymupdf-layoutPyMuPDF Layout analyzes PDF structure and…
agpl · top 1,000 on PyPI
pdfminerExtracts text and layout information from PDF…
permissive · top 15,000 on PyPI
doclingDocling parses diverse document formats—PDF,…
permissive · top 5,000 on PyPI
img2tableIdentifies and extracts tables from images and…
permissive · top 15,000 on PyPI