mirror of
https://github.com/opendatalab/MinerU.git
synced 2026-03-27 02:58:54 +07:00
372 lines
31 KiB
Markdown
372 lines
31 KiB
Markdown
<div align="center" xmlns="http://www.w3.org/1999/html">
|
||
<!-- logo -->
|
||
<p align="center">
|
||
<img src="https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docs/images/MinerU-logo.png" width="300px" style="vertical-align:middle;">
|
||
</p>
|
||
|
||
<!-- icon -->
|
||
|
||
[](https://github.com/opendatalab/MinerU)
|
||
[](https://github.com/opendatalab/MinerU)
|
||
[](https://github.com/opendatalab/MinerU/issues)
|
||
[](https://github.com/opendatalab/MinerU/issues)
|
||
[](https://pypi.org/project/mineru/)
|
||
[](https://pypi.org/project/mineru/)
|
||
[](https://pepy.tech/project/mineru)
|
||
[](https://pepy.tech/project/mineru)
|
||
[](https://mineru.net/OpenSourceTools/Extractor?source=github)
|
||
[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
|
||
[](https://huggingface.co/spaces/opendatalab/MinerU)
|
||
[](https://colab.research.google.com/gist/myhloli/a3cb16570ab3cfeadf9d8f0ac91b4fca/mineru_demo.ipynb)
|
||
[](https://arxiv.org/abs/2409.18839)
|
||
[](https://arxiv.org/abs/2509.22186)
|
||
[](https://deepwiki.com/opendatalab/MinerU)
|
||
|
||
|
||
<a href="https://trendshift.io/repositories/11174" target="_blank"><img src="https://trendshift.io/api/badge/repositories/11174" alt="opendatalab%2FMinerU | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||
|
||
<!-- language -->
|
||
|
||
[English](README.md) | [简体中文](README_zh-CN.md)
|
||
|
||
<!-- hot link -->
|
||
|
||
<p align="center">
|
||
🚀<a href="https://mineru.net/?source=github">MinerU 官网入口→✅ 免装在线版 ✅ 全功能客户端 ✅ 开发者API在线调用,省去部署麻烦,多种产品形态一键get,速冲!</a>
|
||
</p>
|
||
|
||
<!-- join us -->
|
||
|
||
<p align="center">
|
||
👋 join us on <a href="https://discord.gg/Tdedn9GTXq" target="_blank">Discord</a> and <a href="https://mineru.net/community-portal/?aliasId=3c430f94" target="_blank">WeChat</a>
|
||
</p>
|
||
|
||
</div>
|
||
|
||
# 更新记录
|
||
|
||
- 2026/02/06 2.7.6 发布
|
||
- 新增国产算力平台昆仑芯、太初元碁的适配支持,目前已由官方和厂商适配并支持的国产算力平台包括:
|
||
- [昇腾 Ascend](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Ascend)
|
||
- [平头哥 T-Head](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/THead)
|
||
- [沐曦 METAX](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/METAX)
|
||
- [海光 Hygon](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Hygon/)
|
||
- [燧原 Enflame](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Enflame/)
|
||
- [摩尔线程 MooreThreads](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/MooreThreads/)
|
||
- [天数智芯 IluvatarCorex](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/IluvatarCorex/)
|
||
- [寒武纪 Cambricon](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Cambricon/)
|
||
- [昆仑芯 Kunlunxin](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Kunlunxin/)
|
||
- [太初元碁 Tecorigin](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Tecorigin/)
|
||
- [壁仞 Biren](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Biren/)
|
||
- MinerU 持续兼容国产硬件平台,支持主流芯片架构。以安全可靠的技术,助力科研、政企用户迈向文档数字化新高度!
|
||
|
||
- 2026/01/30 2.7.4 发布
|
||
- 新增国产算力平台天数智芯、寒武纪的适配支持。
|
||
|
||
- 2026/01/23 2.7.2 发布
|
||
- 新增国产算力平台海光、燧原、摩尔线程的适配支持
|
||
- 跨页表合并优化,提升合并成功率与合并效果
|
||
|
||
- 2026/01/06 2.7.1 发布
|
||
- fix bug: #4300
|
||
- 更新pdfminer.six的依赖版本以解决 [CVE-2025-64512](https://github.com/advisories/GHSA-wf5f-4jwr-ppcp)
|
||
- 支持输入图像的exif方向自动校正,提升OCR识别效果 #4283
|
||
|
||
- 2025/12/30 2.7.0 发布
|
||
- 简化安装流程,现在不再需要单独安装`vlm`加速引擎依赖包,安装时使用`uv pip install mineru[all]`即可安装所有可选后端的依赖包。
|
||
- 增加全新后端`hybrid`,该后端结合了`pipeline`和`vlm`后端的优势,在vlm的基础上,融入了pipeline的部分能力,在高精度的基础上增加了额外的扩展性:
|
||
- 从文本pdf中直接抽取文本,在文本pdf场景原生支持多语言识别,并极大减少解析幻觉;
|
||
- 通过指定ocr语言,在扫描pdf场景下支持109种语言的文本识别;
|
||
- 独立的行内公式识别开关,在不需要行内公式识别的场景下可单独关闭,提升解析结果视觉效果。
|
||
- 简化`vlm/hybrid`后端的引擎选择逻辑,用户只需指定后端为`*-auto-engine`,系统会根据当前环境自动选择合适的引擎进行推理加速,提升易用性.
|
||
- 默认解析后端从`pipeline`切换至`hybrid-auto-engine`,提升新用户开箱即用的结果一致性,避免出现解析结果认知差异。
|
||
- gradio应用增加i18n适配,支持中英文两种语言切换。
|
||
|
||
> 📝 查看完整的 [更新日志](https://opendatalab.github.io/MinerU/zh/reference/changelog/) 了解更多历史版本信息
|
||
|
||
# MinerU
|
||
|
||
## 项目简介
|
||
|
||
MinerU是一款将PDF转化为机器可读格式的工具(如markdown、json),可以很方便地抽取为任意格式。
|
||
MinerU诞生于[书生-浦语](https://github.com/InternLM/InternLM)的预训练过程中,我们将会集中精力解决科技文献中的符号转化问题,希望在大模型时代为科技发展做出贡献。
|
||
相比国内外知名商用产品MinerU还很年轻,如果遇到问题或者结果不及预期请到[issue](https://github.com/opendatalab/MinerU/issues)提交问题,同时**附上相关PDF**。
|
||
|
||
https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
|
||
|
||
## 主要功能
|
||
|
||
- 删除页眉、页脚、脚注、页码等元素,确保语义连贯
|
||
- 输出符合人类阅读顺序的文本,适用于单栏、多栏及复杂排版
|
||
- 保留原文档的结构,包括标题、段落、列表等
|
||
- 提取图像、图片描述、表格、表格标题及脚注
|
||
- 自动识别并转换文档中的公式为LaTeX格式
|
||
- 自动识别并转换文档中的表格为HTML格式
|
||
- 自动检测扫描版PDF和乱码PDF,并启用OCR功能
|
||
- OCR支持109种语言的检测与识别
|
||
- 支持多种输出格式,如多模态与NLP的Markdown、按阅读顺序排序的JSON、含有丰富信息的中间格式等
|
||
- 支持多种可视化结果,包括layout可视化、span可视化等,便于高效确认输出效果与质检
|
||
- 支持纯CPU环境运行,并支持 GPU(CUDA)/NPU(CANN)/MPS 加速
|
||
- 兼容Windows、Linux和Mac平台
|
||
|
||
# 快速开始
|
||
|
||
如果安装或使用中遇到任何问题,请先查询 <a href="#faq">FAQ</a> </br>
|
||
如果遇到解析效果不及预期,参考 <a href="#known-issues">Known Issues</a></br>
|
||
|
||
## 在线体验
|
||
|
||
### 官网在线应用
|
||
官网在线版功能与客户端一致,界面美观,功能丰富,需要登录使用
|
||
|
||
- [](https://mineru.net/OpenSourceTools/Extractor?source=github)
|
||
|
||
### 基于Gradio的在线demo
|
||
基于gradio开发的webui,界面简洁,仅包含核心解析功能,免登录
|
||
|
||
- [](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
|
||
- [](https://huggingface.co/spaces/opendatalab/MinerU)
|
||
|
||
## 本地部署
|
||
|
||
> [!WARNING]
|
||
> **安装前必看——软硬件环境支持说明**
|
||
>
|
||
> 为了确保项目的稳定性和可靠性,我们在开发过程中仅对特定的软硬件环境进行优化和测试。这样当用户在推荐的系统配置上部署和运行项目时,能够获得最佳的性能表现和最少的兼容性问题。
|
||
>
|
||
> 通过集中资源和精力于主线环境,我们团队能够更高效地解决潜在的BUG,及时开发新功能。
|
||
>
|
||
> 在非主线环境中,由于硬件、软件配置的多样性,以及第三方依赖项的兼容性问题,我们无法100%保证项目的完全可用性。因此,对于希望在非推荐环境中使用本项目的用户,我们建议先仔细阅读文档以及FAQ,大多数问题已经在FAQ中有对应的解决方案,除此之外我们鼓励社区反馈问题,以便我们能够逐步扩大支持范围。
|
||
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th rowspan="2">解析后端</th>
|
||
<th rowspan="2">pipeline</th>
|
||
<th colspan="2">*-auto-engine</th>
|
||
<th colspan="2">*-http-client</th>
|
||
</tr>
|
||
<tr>
|
||
<th>hybrid</th>
|
||
<th>vlm</th>
|
||
<th>hybrid</th>
|
||
<th>vlm</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<th>后端特性</th>
|
||
<td >兼容性好</td>
|
||
<td colspan="2">硬件配置要求较高</td>
|
||
<td colspan="2">适用于OpenAI兼容服务器<sup>2</sup></td>
|
||
</tr>
|
||
<tr>
|
||
<th>精度指标<sup>1</sup></th>
|
||
<td style="text-align:center;">82+</td>
|
||
<td colspan="4" style="text-align:center;">90+</td>
|
||
</tr>
|
||
<tr>
|
||
<th>操作系统</th>
|
||
<td colspan="5" style="text-align:center;">Linux<sup>3</sup> / Windows<sup>4</sup> / macOS<sup>5</sup></td>
|
||
</tr>
|
||
<tr>
|
||
<th>纯CPU平台支持</th>
|
||
<td style="text-align:center;">✅</td>
|
||
<td colspan="2" style="text-align:center;">❌</td>
|
||
<td colspan="2" style="text-align:center;">✅</td>
|
||
</tr>
|
||
<tr>
|
||
<th>GPU加速支持</th>
|
||
<td colspan="4" style="text-align:center;">Volta及以后架构GPU或Apple Silicon</td>
|
||
<td rowspan="2">不需要</td>
|
||
</tr>
|
||
<tr>
|
||
<th>显存最低要求</th>
|
||
<td style="text-align:center;">6GB</td>
|
||
<td style="text-align:center;">10GB</td>
|
||
<td style="text-align:center;">8GB</td>
|
||
<td style="text-align:center;">3GB</td>
|
||
</tr>
|
||
<tr>
|
||
<th>内存要求</th>
|
||
<td colspan="3" style="text-align:center;">最低16GB以上,推荐32GB以上</td>
|
||
<td colspan="2" style="text-align:center;">最低8GB</td>
|
||
</tr>
|
||
<tr>
|
||
<th>磁盘空间要求</th>
|
||
<td colspan="3" style="text-align:center;">20GB以上,推荐使用SSD</td>
|
||
<td colspan="2" style="text-align:center;">至少2GB</td>
|
||
</tr>
|
||
<tr>
|
||
<th>python版本</th>
|
||
<td colspan="5" style="text-align:center;">3.10-3.13</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
<sup>1</sup> 精度指标为OmniDocBench (v1.5)的End-to-End Evaluation Overall分数,基于`MinerU`最新版本测试
|
||
<sup>2</sup> 兼容OpenAI API的服务器,如通过`vLLM`/`SGLang`/`LMDeploy`等推理框架部署的本地模型服务器或远程模型服务
|
||
<sup>3</sup> Linux仅支持2019年及以后发行版
|
||
<sup>4</sup> 由于关键依赖`ray`未能在windows平台支持Python 3.13,故仅支持至3.10~3.12版本
|
||
<sup>5</sup> macOS 需使用14.0以上版本
|
||
|
||
> [!TIP]
|
||
> 除以上主流环境与平台外,我们也收录了一些社区用户反馈的其他平台支持情况,详情请参考[其他加速卡适配](https://opendatalab.github.io/MinerU/zh/usage/)。
|
||
> 如果您有意将自己的环境适配经验分享给社区,欢迎通过[show-and-tell](https://github.com/opendatalab/MinerU/discussions/categories/show-and-tell)提交或提交PR至[其他加速卡适配](https://github.com/opendatalab/MinerU/tree/master/docs/zh/usage/acceleration_cards)文档。
|
||
|
||
### 安装 MinerU
|
||
|
||
#### 使用pip或uv安装MinerU
|
||
```bash
|
||
pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple
|
||
pip install uv -i https://mirrors.aliyun.com/pypi/simple
|
||
uv pip install -U "mineru[all]" -i https://mirrors.aliyun.com/pypi/simple
|
||
```
|
||
|
||
#### 通过源码安装MinerU
|
||
```bash
|
||
git clone https://github.com/opendatalab/MinerU.git
|
||
cd MinerU
|
||
uv pip install -e .[all] -i https://mirrors.aliyun.com/pypi/simple
|
||
```
|
||
|
||
> [!TIP]
|
||
> `mineru[all]`包含所有核心功能,兼容Windows / Linux / macOS系统,适合绝大多数用户。
|
||
> 如果您需要指定vlm模型的推理框架,或是仅准备在边缘设备安装轻量版client端,可以参考文档[扩展模块安装指南](https://opendatalab.github.io/MinerU/zh/quick_start/extension_modules/)。
|
||
|
||
---
|
||
|
||
#### 使用docker部署Mineru
|
||
MinerU提供了便捷的docker部署方式,这有助于快速搭建环境并解决一些棘手的环境兼容问题。
|
||
您可以在文档中获取[Docker部署说明](https://opendatalab.github.io/MinerU/zh/quick_start/docker_deployment/)。
|
||
|
||
---
|
||
|
||
### 使用 MinerU
|
||
|
||
>[!TIP]
|
||
>默认使用托管在`huggingface`的模型进行解析,首次使用时会自动下载所需模型文件,后续使用将直接加载本地缓存的模型。如果您无法访问`huggingface`,可以通过以下命令切换至国内镜像源:
|
||
>```bash
|
||
>export MINERU_MODEL_SOURCE=modelscope
|
||
>```
|
||
|
||
如果您的设备满足上表中GPU加速的条件,可以使用简单的命令行进行文档解析:
|
||
```bash
|
||
mineru -p <input_path> -o <output_path>
|
||
```
|
||
如果您的设备不满足GPU加速条件,可以指定后端为`pipeline`,以在纯CPU环境下运行:
|
||
```bash
|
||
mineru -p <input_path> -o <output_path> -b pipeline
|
||
```
|
||
|
||
您可以通过命令行、API、WebUI等多种方式使用MinerU进行PDF解析,具体使用方法请参考[使用指南](https://opendatalab.github.io/MinerU/zh/usage/)。
|
||
|
||
# TODO
|
||
|
||
- [x] 基于模型的阅读顺序
|
||
- [x] 正文中目录、列表识别
|
||
- [x] 表格识别
|
||
- [x] 标题分级
|
||
- [x] 手写文本识别
|
||
- [x] 竖排文本识别
|
||
- [x] 拉丁字母重音符号识别
|
||
- [x] 正文中代码块识别
|
||
- [x] [化学式识别](docs/chemical_knowledge_introduction/introduction.pdf)(https://mineru.net)
|
||
- [ ] 图表内容识别
|
||
|
||
# Known Issues
|
||
|
||
- 阅读顺序基于模型对可阅读内容在空间中的分布进行排序,在极端复杂的排版下可能会部分区域乱序
|
||
- 对竖排文字的支持较为有限
|
||
- 目录和列表通过规则进行识别,少部分不常见的列表形式可能无法识别
|
||
- 代码块在layout模型里还没有支持
|
||
- 漫画书、艺术图册、小学教材、习题尚不能很好解析
|
||
- 表格识别在复杂表格上可能会出现行/列识别错误
|
||
- 在小语种PDF上,OCR识别可能会出现字符不准确的情况(如阿拉伯文易混淆字符等)
|
||
- 部分公式可能会无法在markdown中渲染
|
||
|
||
# FAQ
|
||
|
||
- 如果您在使用过程中遇到问题,可以先查看[常见问题](https://opendatalab.github.io/MinerU/zh/faq/)是否有解答。
|
||
- 如果未能解决您的问题,您也可以使用[DeepWiki](https://deepwiki.com/opendatalab/MinerU)与AI助手交流,这可以解决大部分常见问题。
|
||
- 如果您仍然无法解决问题,您可通过[Discord](https://discord.gg/Tdedn9GTXq)或[WeChat](https://mineru.net/community-portal/?aliasId=3c430f94)加入社区,与其他用户和开发者交流。
|
||
|
||
# All Thanks To Our Contributors
|
||
|
||
<a href="https://github.com/opendatalab/MinerU/graphs/contributors">
|
||
<img src="https://contrib.rocks/image?repo=opendatalab/MinerU" />
|
||
</a>
|
||
|
||
# License Information
|
||
|
||
[LICENSE.md](LICENSE.md)
|
||
|
||
本项目目前部分模型基于YOLO训练,但因其遵循AGPL协议,可能对某些使用场景构成限制。未来版本迭代中,我们计划探索并替换为许可条款更为宽松的模型,以提升用户友好度及灵活性。
|
||
|
||
# Acknowledgments
|
||
|
||
- [PDF-Extract-Kit](https://github.com/opendatalab/PDF-Extract-Kit)
|
||
- [DocLayout-YOLO](https://github.com/opendatalab/DocLayout-YOLO)
|
||
- [UniMERNet](https://github.com/opendatalab/UniMERNet)
|
||
- [RapidTable](https://github.com/RapidAI/RapidTable)
|
||
- [TableStructureRec](https://github.com/RapidAI/TableStructureRec)
|
||
- [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)
|
||
- [PaddleOCR2Pytorch](https://github.com/frotms/PaddleOCR2Pytorch)
|
||
- [layoutreader](https://github.com/ppaanngggg/layoutreader)
|
||
- [xy-cut](https://github.com/Sanster/xy-cut)
|
||
- [fast-langdetect](https://github.com/LlmKira/fast-langdetect)
|
||
- [pypdfium2](https://github.com/pypdfium2-team/pypdfium2)
|
||
- [pdftext](https://github.com/datalab-to/pdftext)
|
||
- [pdfminer.six](https://github.com/pdfminer/pdfminer.six)
|
||
- [pypdf](https://github.com/py-pdf/pypdf)
|
||
- [magika](https://github.com/google/magika)
|
||
- [vLLM](https://github.com/vllm-project/vllm)
|
||
- [LMDeploy](https://github.com/InternLM/lmdeploy)
|
||
|
||
# Citation
|
||
|
||
```bibtex
|
||
@article{niu2025mineru2,
|
||
title={Mineru2. 5: A decoupled vision-language model for efficient high-resolution document parsing},
|
||
author={Niu, Junbo and Liu, Zheng and Gu, Zhuangcheng and Wang, Bin and Ouyang, Linke and Zhao, Zhiyuan and Chu, Tao and He, Tianyao and Wu, Fan and Zhang, Qintong and others},
|
||
journal={arXiv preprint arXiv:2509.22186},
|
||
year={2025}
|
||
}
|
||
|
||
@article{wang2024mineru,
|
||
title={Mineru: An open-source solution for precise document content extraction},
|
||
author={Wang, Bin and Xu, Chao and Zhao, Xiaomeng and Ouyang, Linke and Wu, Fan and Zhao, Zhiyuan and Xu, Rui and Liu, Kaiwen and Qu, Yuan and Shang, Fukai and others},
|
||
journal={arXiv preprint arXiv:2409.18839},
|
||
year={2024}
|
||
}
|
||
|
||
@article{he2024opendatalab,
|
||
title={Opendatalab: Empowering general artificial intelligence with open datasets},
|
||
author={He, Conghui and Li, Wei and Jin, Zhenjiang and Xu, Chao and Wang, Bin and Lin, Dahua},
|
||
journal={arXiv preprint arXiv:2407.13773},
|
||
year={2024}
|
||
}
|
||
```
|
||
|
||
# Star History
|
||
|
||
<a>
|
||
<picture>
|
||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date&theme=dark" />
|
||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date" />
|
||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date" />
|
||
</picture>
|
||
</a>
|
||
|
||
|
||
# Links
|
||
- [Easy Data Preparation with latest LLMs-based Operators and Pipelines](https://github.com/OpenDCAI/DataFlow)
|
||
- [Vis3 (OSS browser based on s3)](https://github.com/opendatalab/Vis3)
|
||
- [LabelU (A Lightweight Multi-modal Data Annotation Tool)](https://github.com/opendatalab/labelU)
|
||
- [LabelLLM (An Open-source LLM Dialogue Annotation Platform)](https://github.com/opendatalab/LabelLLM)
|
||
- [PDF-Extract-Kit (A Comprehensive Toolkit for High-Quality PDF Content Extraction)](https://github.com/opendatalab/PDF-Extract-Kit)
|
||
- [OmniDocBench (A Comprehensive Benchmark for Document Parsing and Evaluation)](https://github.com/opendatalab/OmniDocBench)
|
||
- [Magic-HTML (Mixed web page extraction tool)](https://github.com/opendatalab/magic-html)
|
||
- [Magic-Doc (Fast speed ppt/pptx/doc/docx/pdf extraction tool)](https://github.com/InternLM/magic-doc)
|
||
- [Dingo: A Comprehensive AI Data Quality Evaluation Tool](https://github.com/MigoXLab/dingo)
|