Fast, accurate OCR with correctness assessment.
Merge pull request #49 from OpenBMB/docs/readme-two-stage-pipeline
Tianyu Yu07b711ba40a5
diff --cc README.mdindex 2599acc,542aa5c..6ac3ca8--- a/README.md+++ b/README.md@@@ -151,8 -151,33 +151,34 @@@ See the [MiniCPM-OCR Jev model guide](.Choose how to integrate MiniCPM-OCR 1.0 and MiniCPM-OCR Jev:+ ### How Document Parsing Works++ Full-page parsing runs as a **two-stage pipeline** orchestrated by the [`minicpmvocr` SDK](https://pypi.org/project/minicpm-ocr/). The two stages use separate models, run in separate environments, and may run on different machines:++ ```mermaid+ flowchart LR+ DOC["PDF / image"] --> S1++ subgraph SDKENV ["minicpmvocr SDK (its own environment)"]+ S1["Stage 1 · Layout detection<br>PP-DocLayoutV3 layout model (PaddlePaddle / PaddleX)<br>regions, reading order, cropping"]+ ASM["Assemble output<br>Markdown / JSON in reading order"]+ end++ subgraph SRVENV ["Recognition service (separate environment)"]+ S2["Stage 2 · Region recognition<br>MiniCPM-OCR 1.0<br>vLLM / SGLang / llama.cpp / Ollama"]+ end++ S1 -- "each cropped region, over HTTP,<br>with a prompt for its region type" --> S2+ S2 -- "text, tables, formulas, charts, seals" --> ASM+ ```++ - **Stage 1 — Layout detection (run locally by the SDK).** The PP-DocLayoutV3 layout model detects document regions — text, tables, formulas, charts, seals — and analyzes reading order; the SDK then crops the regions. It runs inside the SDK environment and requires PaddlePaddle / PaddleX.+ - **Stage 2 — Region recognition (inference service).** The SDK sends each cropped region over HTTP to a MiniCPM-OCR 1.0 inference service — served by vLLM, SGLang, llama.cpp, or Ollama — with a prompt matching the region type (`Text Recognition:`, `Table Recognition:`, `Formula Recognition:`, …). The SDK assembles the recognized content into the final Markdown / JSON in reading order.++ A full local deployment therefore prepares **two environments side by side**: the SDK environment (pip package `minicpm-ocr`, plus PaddlePaddle / PaddleX for the layout model) and the inference-service environment of the chosen backend. The [Skill](#skill) walks through the complete setup — backend choice, environment installation, model downloads, and verification — and the [SDK tutorial](./docs/minicpm_ocr_tutorial_en.md) covers the same steps for manual deployment. For region prompts and per-stage details, see the [document parsing workflow](./docs/minicpm_ocr_1dot0_en.md#document-parsing-workflow).+<a id="使用-agent-skill-部署推荐"></a>+<a id="skill"></a>### Skilldiff --cc README_zh.mdindex a116403,ed31bc1..3c7d8f5--- a/README_zh.md+++ b/README_zh.md@@@ -149,8 -149,33 +149,34 @@@选择适合你的 MiniCPM-OCR 1.0 和 MiniCPM-OCR Jev 接入方式:+ ### 文档解析的两阶段流程++ 整页文档解析由 [`minicpmvocr` SDK](https://pypi.org/project/minicpm-ocr/) 统一编排,采用**两阶段流水线**:两个阶段使用不同的模型,分别运行在相互独立的环境中,也可以部署在不同的机器上:++ ```mermaid+ flowchart LR+ DOC["PDF / 图片"] --> S1++ subgraph SDKENV ["minicpmvocr SDK(独立环境)"]+ S1["阶段一 · 版面检测<br>PP-DocLayoutV3 版面模型(PaddlePaddle / PaddleX)<br>检测区域与阅读顺序并切块"]+ ASM["拼接输出<br>按阅读顺序生成 Markdown / JSON"]+ end++ subgraph SRVENV ["识别服务(另一套独立环境)"]+ S2["阶段二 · 区域识别<br>MiniCPM-OCR 1.0<br>vLLM / SGLang / llama.cpp / Ollama"]+ end++ S1 -- "各区域切块通过 HTTP 逐块发送,<br>提示词按区域类型选择" --> S2+ S2 -- "文本、表格、公式、图表、印章" --> ASM+ ```++ - **阶段一 · 版面检测(SDK 本地运行)**:PP-DocLayoutV3 版面模型检测文档区域(文本、表格、公式、图表、印章等)并分析阅读顺序,SDK 按区域切块。版面检测在 SDK 环境中本地完成,依赖 PaddlePaddle / PaddleX。+ - **阶段二 · 区域识别(推理服务)**:SDK 通过 HTTP 将每个切块发送给 MiniCPM-OCR 1.0 推理服务(由 vLLM、SGLang、llama.cpp 或 Ollama 部署),提示词按区域类型选择(`Text Recognition:`、`Table Recognition:`、`Formula Recognition:` 等),识别结果再按阅读顺序拼接为最终的 Markdown / JSON。++ 因此,完整的本地部署需要同时准备**两套环境**:SDK 环境(pip 包 `minicpm-ocr`,并额外安装 PaddlePaddle / PaddleX 以运行版面模型)和所选推理后端的服务环境。[Skill](#skill) 给出了从后端选择、环境安装、模型下载到验证的完整步骤;手动部署的相同步骤见 [SDK 使用教程](./docs/minicpm_ocr_tutorial.md)。各区域提示词与各阶段的详细说明见[文档解析流程](./docs/minicpm_ocr_1dot0_zh.md#文档解析流程)。+<a id="使用-agent-skill-部署推荐"></a>+<a id="skill"></a>### Skill