layout-parser
Routes LayoutParser workflows for document layout objects, document I/O, visualization, OCR, and layout-detection model wrappers.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- layout-parser
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Routes LayoutParser workflows for document layout objects, document I/O, visualization, OCR, and layout-detection model wrappers.
- disable-model-invocation
- true
02 资源文件 7
- 参考文档references/api-reference.md2.4 KB
- 参考文档references/repo-provenance.md1.4 KB
- 参考文档references/repo-routing-metadata.json331 B
- 参考文档references/troubleshooting.md5.2 KB
- 参考文档references/workflows.md2.1 KB
- 脚本scripts/inspect_backends.py3.3 KB
- 脚本scripts/smoke_layoutparser_core.py2.6 KB
03 SKILL.md 正文
LayoutParser
LayoutParser is a document-image analysis toolkit for layout objects, page/token loading, OCR parsing, visualization, and layout-detection model wrappers.
Use this root skill as a router. Read the owning sub-skill for detailed API notes, workflow steps, and troubleshooting.
Install and first checks
Base install:
pip install layoutparser
OCR support:
pip install "layoutparser[ocr]"
Layout-model support:
pip install "layoutparser[layoutmodels]"
pip install "layoutparser[effdet]"
pip install "layoutparser[paddledetection]"
Detectron2 still uses its own backend install path:
pip install layoutparser torchvision
pip install "detectron2@git+https://github.com/facebookresearch/detectron2.git@v0.5#egg=detectron2"
For local inspection from a checkout, prefer an isolated environment and an editable install in that private environment rather than mutating the source repository.
Minimal import checks:
python -c "import layoutparser as lp; print(lp.__version__)"
python -c "from layoutparser import Layout, Rectangle; print(Layout([Rectangle(0, 0, 10, 10)]))"
If backend availability is uncertain, run the bundled inspector:
python scripts/inspect_backends.py
For a local smoke check that stays inside synthetic data, use:
python scripts/smoke_layoutparser_core.py
Route map
layout-objects
Read this for:
Interval,Rectangle,Quadrilateral,TextBlock, andLayout- coordinate transforms, padding, shifting, scaling, cropping
union,intersect,relative_to,condition_on,is_inLayoutsorting, filtering, serialization, and line/category grouping
layout-io
Read this for:
load_json,load_dict,load_csv,load_dataframe,load_pdf- JSON/CSV/DataFrame round-trips and PDF token extraction
- page metadata,
block_type, and layout export/import issues - COCO-style annotation conversion patterns
visualization
Read this for:
draw_boxanddraw_text- color maps, alpha handling, font settings, vertical text, and layout overlays
- turning detected or loaded layouts into readable page visuals
layout-models
Read this for:
AutoLayoutModelDetectron2LayoutModel,EfficientDetLayoutModel, andPaddleDetectionLayoutModellp://config parsing, model catalogs, label maps, and backend selection- model download, cache, and device-selection behavior
ocr
Read this for:
TesseractAgent,TesseractFeatureTypeGCVAgent,GCVFeatureType- OCR response parsing, saved-response loading, and text aggregation
- credential and binary requirements for live OCR
Root references
- Read
references/api-reference.mdfor the top-level public API map. - Read
references/workflows.mdfor cross-sub-skill document workflows. - Read
references/repo-provenance.mdbefore checking staleness or refreshing. - Read
references/repo-routing-metadata.jsononly when verifying managed repo-skills-router placement.
When to jump to troubleshooting
Read references/troubleshooting.md when you see any of these:
- missing optional backend imports
pkg_resources/ setuptools issues aroundgoogle-cloud-vision==1tesseractor credential problemspdf2image/popplerproblemsInvalidShapeError,NotSupportedShapeError, or layout validation errors- model download, cache, or
lp://parsing failures
Notes for future agents
- This skill is public runtime guidance; do not rely on the original checkout remaining available.
- Runtime links should stay inside this generated skill tree.
- Use the sub-skill that matches the user’s primary workflow first, then cross- reference the others when a task spans multiple layers.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).