paddleocr 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. paddleocr-0.0.0/LICENSE +201 -0
  2. paddleocr-0.0.0/MANIFEST.in +22 -0
  3. paddleocr-0.0.0/PKG-INFO +314 -0
  4. paddleocr-0.0.0/README.md +290 -0
  5. paddleocr-0.0.0/paddleocr/__init__.py +65 -0
  6. paddleocr-0.0.0/paddleocr/__main__.py +39 -0
  7. paddleocr-0.0.0/paddleocr/_abstract.py +25 -0
  8. paddleocr-0.0.0/paddleocr/_cli.py +118 -0
  9. paddleocr-0.0.0/paddleocr/_common_args.py +142 -0
  10. paddleocr-0.0.0/paddleocr/_constants.py +21 -0
  11. paddleocr-0.0.0/paddleocr/_env.py +19 -0
  12. paddleocr-0.0.0/paddleocr/_mkldnn_blocklists.py +31 -0
  13. paddleocr-0.0.0/paddleocr/_models/__init__.py +41 -0
  14. paddleocr-0.0.0/paddleocr/_models/_image_classification.py +52 -0
  15. paddleocr-0.0.0/paddleocr/_models/_object_detection.py +87 -0
  16. paddleocr-0.0.0/paddleocr/_models/_text_detection.py +75 -0
  17. paddleocr-0.0.0/paddleocr/_models/base.py +108 -0
  18. paddleocr-0.0.0/paddleocr/_models/doc_img_orientation_classification.py +40 -0
  19. paddleocr-0.0.0/paddleocr/_models/doc_vlm.py +63 -0
  20. paddleocr-0.0.0/paddleocr/_models/formula_recognition.py +54 -0
  21. paddleocr-0.0.0/paddleocr/_models/layout_detection.py +38 -0
  22. paddleocr-0.0.0/paddleocr/_models/seal_text_detection.py +47 -0
  23. paddleocr-0.0.0/paddleocr/_models/table_cells_detection.py +38 -0
  24. paddleocr-0.0.0/paddleocr/_models/table_classification.py +38 -0
  25. paddleocr-0.0.0/paddleocr/_models/table_structure_recognition.py +54 -0
  26. paddleocr-0.0.0/paddleocr/_models/text_detection.py +47 -0
  27. paddleocr-0.0.0/paddleocr/_models/text_image_unwarping.py +54 -0
  28. paddleocr-0.0.0/paddleocr/_models/text_line_orientation_classification.py +40 -0
  29. paddleocr-0.0.0/paddleocr/_models/text_recognition.py +64 -0
  30. paddleocr-0.0.0/paddleocr/_pipelines/__init__.py +33 -0
  31. paddleocr-0.0.0/paddleocr/_pipelines/base.py +133 -0
  32. paddleocr-0.0.0/paddleocr/_pipelines/doc_preprocessor.py +147 -0
  33. paddleocr-0.0.0/paddleocr/_pipelines/doc_understanding.py +107 -0
  34. paddleocr-0.0.0/paddleocr/_pipelines/formula_recognition.py +283 -0
  35. paddleocr-0.0.0/paddleocr/_pipelines/ocr.py +578 -0
  36. paddleocr-0.0.0/paddleocr/_pipelines/pp_chatocrv4_doc.py +681 -0
  37. paddleocr-0.0.0/paddleocr/_pipelines/pp_structurev3.py +736 -0
  38. paddleocr-0.0.0/paddleocr/_pipelines/seal_recognition.py +375 -0
  39. paddleocr-0.0.0/paddleocr/_pipelines/table_recognition_v2.py +434 -0
  40. paddleocr-0.0.0/paddleocr/_pipelines/utils.py +30 -0
  41. paddleocr-0.0.0/paddleocr/_utils/__init__.py +13 -0
  42. paddleocr-0.0.0/paddleocr/_utils/cli.py +63 -0
  43. paddleocr-0.0.0/paddleocr/_utils/deprecation.py +42 -0
  44. paddleocr-0.0.0/paddleocr/_utils/logging.py +39 -0
  45. paddleocr-0.0.0/paddleocr/_version.py +20 -0
  46. paddleocr-0.0.0/paddleocr.egg-info/PKG-INFO +314 -0
  47. paddleocr-0.0.0/paddleocr.egg-info/SOURCES.txt +52 -0
  48. paddleocr-0.0.0/paddleocr.egg-info/dependency_links.txt +1 -0
  49. paddleocr-0.0.0/paddleocr.egg-info/entry_points.txt +2 -0
  50. paddleocr-0.0.0/paddleocr.egg-info/requires.txt +3 -0
  51. paddleocr-0.0.0/paddleocr.egg-info/top_level.txt +1 -0
  52. paddleocr-0.0.0/pyproject.toml +68 -0
  53. paddleocr-0.0.0/setup.cfg +4 -0
  54. paddleocr-0.0.0/setup.py +18 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,22 @@
1
+ prune .github
2
+ prune applications
3
+ prune benchmark
4
+ prune configs
5
+ prune deploy
6
+ prune doc
7
+ prune docs
8
+ prune overrides
9
+ prune ppocr/ext_op
10
+ prune ppocr/losses
11
+ prune ppocr/metrics
12
+ prune ppocr/modeling
13
+ prune ppocr/optimizer
14
+ prune ppstructure/docs
15
+ prune test_tipc
16
+ prune tests
17
+ exclude .clang_format.hook
18
+ exclude .gitignore
19
+ exclude .pre-commit-config.yaml
20
+ exclude .style.yapf
21
+ exclude mkdocs.yml
22
+ exclude train.sh
@@ -0,0 +1,314 @@
1
+ Metadata-Version: 2.1
2
+ Name: paddleocr
3
+ Version: 0.0.0
4
+ Summary: Awesome OCR toolkit based on PaddlePaddle
5
+ Author-email: PaddlePaddle <Paddle-better@baidu.com>
6
+ Maintainer-email: PaddlePaddle <Paddle-better@baidu.com>
7
+ License: Apache License 2.0
8
+ Project-URL: homepage, https://github.com/PaddlePaddle/PaddleOCR
9
+ Project-URL: documentation, https://github.com/PaddlePaddle/PaddleOCR/blob/main/README.md
10
+ Project-URL: repository, https://github.com/PaddlePaddle/PaddleOCR.git
11
+ Project-URL: issues, https://github.com/PaddlePaddle/PaddleOCR/issues
12
+ Keywords: ocr,textdetection,textrecognition,paddleocr,crnn,east,star-net,rosetta,ocrlite,db,chineseocr,chinesetextdetection,chinesetextrecognition
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Natural Language :: Chinese (Simplified)
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Utilities
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: paddlex[ie,multimodal,ocr]==3.0.0
22
+ Requires-Dist: PyYAML>=6
23
+ Requires-Dist: typing-extensions>=4.12
24
+
25
+ <div align="center">
26
+ <p>
27
+ <img width="100%" src="./docs/images/Banner_cn.png" alt="PaddleOCR Banner"></a>
28
+ </p>
29
+
30
+ <!-- language -->
31
+ 中文 | [English](./README_en.md) | [日本語](./README_ja.md)
32
+
33
+ <!-- icon -->
34
+
35
+ [![stars](https://img.shields.io/github/stars/PaddlePaddle/PaddleOCR?color=ccf)](https://github.com/PaddlePaddle/PaddleOCR)
36
+ [![Downloads](https://img.shields.io/pypi/dm/paddleocr)](https://pypi.org/project/PaddleOCR/)
37
+ ![python](https://img.shields.io/badge/python-3.8+-aff.svg)
38
+ ![os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-pink.svg)
39
+
40
+ [![Website](https://img.shields.io/badge/Website-PaddleOCR-blue?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmmRkdj0AAAAASUVORK5CYII=)](https://www.paddleocr.ai/)
41
+ [![AI Studio](https://img.shields.io/badge/PP_OCRv5-AI_Studio-green)](https://aistudio.baidu.com/community/app/91660/webUI)
42
+ [![AI Studio](https://img.shields.io/badge/PP_StructureV3-AI_Studio-green)](https://aistudio.baidu.com/community/app/518494/webUI)
43
+ [![AI Studio](https://img.shields.io/badge/PP_ChatOCRv4-AI_Studio-green)](https://aistudio.baidu.com/community/app/518493/webUI)
44
+
45
+ </div>
46
+
47
+ ## 🚀 简介
48
+ PaddleOCR自发布以来凭借学术前沿算法和产业落地实践,受到了产学研各方的喜爱,并被广泛应用于众多知名开源项目,例如:Umi-OCR、OmniParser、MinerU、RAGFlow等,已成为广大开发者心中的开源OCR领域的首选工具。2025年5月20日,飞桨团队发布**PaddleOCR 3.0**,全面适配**飞桨框架3.0正式版**,进一步**提升文字识别精度**,支持**多文字类型识别**和**手写体识别**,满足大模型应用对**复杂文档高精度解析**的旺盛需求,结合**文心大模型4.5 Turbo**显著提升关键信息抽取精度,并新增**对昆仑芯、昇腾等国产硬件**的支持。
49
+
50
+ PaddleOCR 3.0**新增**三大特色能力::
51
+ - 全场景文字识别模型[PP-OCRv5](docs/version3.x/algorithm/PP-OCRv5/PP-OCRv5.md):单模型支持五种文字类型和复杂手写体识别;整体识别精度相比上一代**提升13个百分点**。
52
+ - 通用文档解析方案[PP-StructureV3](docs/version3.x/algorithm/PP-StructureV3/PP-StructureV3.md):支持多场景、多版式 PDF 高精度解析,在公开评测集中**领先众多开源和闭源方案**。
53
+ - 智能文档理解方案[PP-ChatOCRv4](docs/version3.x/algorithm/PP-ChatOCRv4/PP-ChatOCRv4.md):原生支持文心大模型4.5 Turbo,精度相比上一代**提升15个百分点**。
54
+
55
+ PaddleOCR 3.0除了提供优秀的模型库外,还提供好学易用的工具,覆盖模型训练、推理和服务化部署,方便开发者快速落地AI应用。
56
+ <div align="center">
57
+ <p>
58
+ <img width="100%" src="./docs/images/Arch_cn.png" alt="PaddleOCR Architecture"></a>
59
+ </p>
60
+ </div>
61
+
62
+
63
+ ## 📣 最新动态
64
+ 🔥🔥2025.05.20: **PaddleOCR 3.0** 正式发布,包含:
65
+ - **PP-OCRv5**: 全场景高精度文字识别
66
+
67
+ 1. 🌐 单模型支持**五种**文字类型(**简体中文**、**繁体中文**、**中文拼音**、**英文**和**日文**)。
68
+ 2. ✍️ 支持复杂**手写体**识别:复杂连笔、非规范字迹识别性能显著提升。
69
+ 3. 🎯 整体识别精度提升 - 多种应用场景达到 SOTA 精度, 相比上一版本PP-OCRv4,识别精度**提升13个百分点**!
70
+
71
+ - **PP-StructureV3**: 通用文档解析方案
72
+
73
+ 1. 🧮 支持多场景 PDF 高精度解析,在 OmniDocBench 基准测试中**领先众多开源和闭源方案**。
74
+ 2. 🧠 多项专精能力: **印章识别**、**图表转表格**、**嵌套公式/图片的表格识别**、**竖排文本解析**及**复杂表格结构分析**等。
75
+
76
+
77
+ - **PP-ChatOCRv4**: 智能文档理解方案
78
+ 1. 🔥 文档图像(PDF/PNG/JPG)关键信息提取精度相比上一代**提升15个百分点**!
79
+ 2. 💻 原生支持**文心大模型4.5 Turbo**,还兼容 PaddleNLP、Ollama、vLLM 等工具部署的大模型。
80
+ 3. 🤝 集成 [PP-DocBee2](https://github.com/PaddlePaddle/PaddleMIX/tree/develop/paddlemix/examples/ppdocbee2),支持印刷文字、手写体文字、印章信息、表格、图表等常见的复杂文档信息抽取和理解的能力。
81
+
82
+
83
+ ## ⚡ 快速开始
84
+ ### 1. 在线体验
85
+ [![AI Studio](https://img.shields.io/badge/PP_OCRv5-AI_Studio-green)](https://aistudio.baidu.com/community/app/91660/webUI)
86
+ [![AI Studio](https://img.shields.io/badge/PP_StructureV3-AI_Studio-green)](https://aistudio.baidu.com/community/app/518494/webUI)
87
+ [![AI Studio](https://img.shields.io/badge/PP_ChatOCRv4-AI_Studio-green)](https://aistudio.baidu.com/community/app/518493/webUI)
88
+
89
+ ### 2. 本地安装
90
+
91
+ 请参考[安装指南](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html)完成**PaddlePaddle 3.0**的安装,然后安装paddleocr。
92
+
93
+ ```bash
94
+ # 安装 paddleocr
95
+ pip install paddleocr
96
+ ```
97
+
98
+ ### 3. 命令行方式推理
99
+ ```bash
100
+ # 运行 PP-OCRv5 推理
101
+ paddleocr ocr -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png
102
+
103
+ # 运行 PP-StructureV3 推理
104
+ paddleocr PP-StructureV3 -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/pp_structure_v3_demo.png
105
+
106
+ # 运行 PP-ChatOCRv4 推理前,需要先获得千帆KPI Key
107
+ paddleocr pp_chatocrv4_doc -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_certificate-1.png -k 驾驶室准乘人数 --qianfan_api_key your_api_key
108
+
109
+ # 查看 "paddleocr ocr" 详细参数
110
+ paddleocr ocr --help
111
+ ```
112
+ ### 4. API方式推理
113
+
114
+ **4.1 PP-OCRv5 示例**
115
+ ```python
116
+ from paddleocr import PaddleOCR
117
+ # 初始化 PaddleOCR 实例
118
+ ocr = PaddleOCR()
119
+ # 对示例图像执行 OCR 推理
120
+ result = ocr.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png")
121
+ # 可视化结果并保存 json 结果
122
+ for res in result:
123
+ res.print()
124
+ res.save_to_img("output")
125
+ res.save_to_json("output")
126
+ ```
127
+
128
+ <details>
129
+ <summary><strong>4.2 PP-StructureV3 示例</strong></summary>
130
+
131
+ ```python
132
+ from pathlib import Path
133
+ from paddleocr import PPStructureV3
134
+
135
+ pipeline = PPStructureV3()
136
+
137
+ # For Image
138
+ output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/pp_structure_v3_demo.png")
139
+
140
+ # 可视化结果并保存 json 结果
141
+ for res in output:
142
+ res.print()
143
+ res.save_to_json(save_path="output")
144
+ res.save_to_markdown(save_path="output")
145
+
146
+ # For PDF File
147
+ input_file = "./your_pdf_file.pdf"
148
+ output_path = Path("./output")
149
+
150
+ output = pipeline.predict(input_file)
151
+
152
+ markdown_list = []
153
+ markdown_images = []
154
+
155
+ for res in output:
156
+ md_info = res.markdown
157
+ markdown_list.append(md_info)
158
+ markdown_images.append(md_info.get("markdown_images", {}))
159
+
160
+ markdown_texts = pipeline.concatenate_markdown_pages(markdown_list)
161
+
162
+ mkd_file_path = output_path / f"{Path(input_file).stem}.md"
163
+ mkd_file_path.parent.mkdir(parents=True, exist_ok=True)
164
+
165
+ with open(mkd_file_path, "w", encoding="utf-8") as f:
166
+ f.write(markdown_texts)
167
+
168
+ for item in markdown_images:
169
+ if item:
170
+ for path, image in item.items():
171
+ file_path = output_path / path
172
+ file_path.parent.mkdir(parents=True, exist_ok=True)
173
+ image.save(file_path)
174
+ ```
175
+
176
+ </details>
177
+
178
+
179
+ <details>
180
+ <summary><strong>4.3 PP-ChatOCRv4 示例</strong></summary>
181
+
182
+ ```python
183
+ from paddleocr import PPChatOCRv4Doc
184
+
185
+ chat_bot_config = {
186
+ "module_name": "chat_bot",
187
+ "model_name": "ernie-3.5-8k",
188
+ "base_url": "https://qianfan.baidubce.com/v2",
189
+ "api_type": "openai",
190
+ "api_key": "api_key", # your api_key
191
+ }
192
+
193
+ retriever_config = {
194
+ "module_name": "retriever",
195
+ "model_name": "embedding-v1",
196
+ "base_url": "https://qianfan.baidubce.com/v2",
197
+ "api_type": "qianfan",
198
+ "api_key": "api_key", # your api_key
199
+ }
200
+
201
+ mllm_chat_bot_config = {
202
+ "module_name": "chat_bot",
203
+ "model_name": "PP-DocBee",
204
+ "base_url": "http://127.0.0.1:8080/", # your local mllm service url
205
+ "api_type": "openai",
206
+ "api_key": "api_key", # your api_key
207
+ }
208
+
209
+ pipeline = PPChatOCRv4Doc()
210
+
211
+ visual_predict_res = pipeline.visual_predict(
212
+ input="https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_certificate-1.png",
213
+ use_doc_orientation_classify=False,
214
+ use_doc_unwarping=False,
215
+ use_common_ocr=True,
216
+ use_seal_recognition=True,
217
+ use_table_recognition=True,
218
+ )
219
+
220
+ visual_info_list = []
221
+ for res in visual_predict_res:
222
+ visual_info_list.append(res["visual_info"])
223
+ layout_parsing_result = res["layout_parsing_result"]
224
+
225
+ vector_info = pipeline.build_vector(
226
+ visual_info_list, flag_save_bytes_vector=True, retriever_config=retriever_config
227
+ )
228
+ mllm_predict_res = pipeline.mllm_pred(
229
+ input="vehicle_certificate-1.png",
230
+ key_list=["驾驶室准乘人数"],
231
+ mllm_chat_bot_config=mllm_chat_bot_config,
232
+ )
233
+ mllm_predict_info = mllm_predict_res["mllm_res"]
234
+ chat_result = pipeline.chat(
235
+ key_list=["驾驶室准乘人数"],
236
+ visual_info=visual_info_list,
237
+ vector_info=vector_info,
238
+ mllm_predict_info=mllm_predict_info,
239
+ chat_bot_config=chat_bot_config,
240
+ retriever_config=retriever_config,
241
+ )
242
+ print(chat_result)
243
+ ```
244
+
245
+ </details>
246
+
247
+
248
+ ### 5. **国产化硬件使用**
249
+ - [昆仑芯安装指南](https://paddlepaddle.github.io/PaddleOCR/latest/version3.x/other_devices_support/paddlepaddle_install_XPU.html)
250
+ - [昇腾安装指南](https://paddlepaddle.github.io/PaddleOCR/latest/version3.x/other_devices_support/paddlepaddle_install_NPU.html)
251
+
252
+ ## ⛰️ 进阶指南
253
+ - [PP-OCRv5 使用教程](https://paddlepaddle.github.io/PaddleOCR/latest/version3.x/pipeline_usage/OCR.html)
254
+ - [PP-StructureV3 使用教程](https://paddlepaddle.github.io/PaddleOCR/latest/version3.x/pipeline_usage/PP-StructureV3.html)
255
+ - [PP-ChatOCRv4 使用教程](https://paddlepaddle.github.io/PaddleOCR/latest/version3.x/pipeline_usage/PP-ChatOCRv4.html)
256
+
257
+ ## 🔄 效果展示
258
+
259
+ <div align="center">
260
+ <p>
261
+ <img width="100%" src="./docs/images/demo.gif" alt="PP-OCRv5 Demo"></a>
262
+ </p>
263
+ </div>
264
+
265
+ <div align="center">
266
+ <p>
267
+ <img width="100%" src="./docs/images/blue_v3.gif" alt="PP-StructureV3 Demo"></a>
268
+ </p>
269
+ </div>
270
+
271
+ ## 👩‍👩‍👧‍👦 开发者社区
272
+
273
+ | 扫码关注飞桨公众号 | 扫码加入技术交流群 |
274
+ | :---: | :---: |
275
+ | <img src="https://raw.githubusercontent.com/cuicheng01/PaddleX_doc_images/refs/heads/main/images/paddleocr/README/qrcode_for_paddlepaddle_official_account.jpg" width="150"> | <img src="https://raw.githubusercontent.com/cuicheng01/PaddleX_doc_images/refs/heads/main/images/paddleocr/README/qr_code_for_the_questionnaire.jpg" width="150"> |
276
+
277
+ ## 🏆 使用 PaddleOCR 的优秀项目
278
+ PaddleOCR 的发展离不开社区贡献!💗衷心感谢所有开发者、合作伙伴与贡献者!
279
+ | 项目名称 | 简介 |
280
+ | ------------ | ----------- |
281
+ | [RAGFlow](https://github.com/infiniflow/ragflow) <a href="https://github.com/infiniflow/ragflow"><img src="https://img.shields.io/github/stars/infiniflow/ragflow"></a>|基于RAG的AI工作流引擎|
282
+ | [MinerU](https://github.com/opendatalab/MinerU) <a href="https://github.com/opendatalab/MinerU"><img src="https://img.shields.io/github/stars/opendatalab/MinerU"></a>|多类型文档转换Markdown工具|
283
+ | [Umi-OCR](https://github.com/hiroi-sora/Umi-OCR) <a href="https://github.com/hiroi-sora/Umi-OCR"><img src="https://img.shields.io/github/stars/hiroi-sora/Umi-OCR"></a>|开源批量离线OCR软件|
284
+ | [OmniParser](https://github.com/microsoft/OmniParser)<a href="https://github.com/microsoft/OmniParser"><img src="https://img.shields.io/github/stars/microsoft/OmniParser"></a> |基于纯视觉的GUI智能体屏幕解析工具|
285
+ | [QAnything](https://github.com/netease-youdao/QAnything)<a href="https://github.com/netease-youdao/QAnything"><img src="https://img.shields.io/github/stars/netease-youdao/QAnything"></a> |基于任意内容的问答系统|
286
+ | [PDF-Extract-Kit](https://github.com/opendatalab/PDF-Extract-Kit) <a href="https://github.com/opendatalab/PDF-Extract-Kit"><img src="https://img.shields.io/github/stars/opendatalab/PDF-Extract-Kit"></a>|高效复杂PDF文档提取工具包|
287
+ | [Dango-Translator](https://github.com/PantsuDango/Dango-Translator)<a href="https://github.com/PantsuDango/Dango-Translator"><img src="https://img.shields.io/github/stars/PantsuDango/Dango-Translator"></a> |屏幕实时翻译工具|
288
+ | [更多项目](./awesome_projects.md) | |
289
+
290
+ ## 👩‍👩‍👧‍👦 贡献者
291
+
292
+ <a href="https://github.com/PaddlePaddle/PaddleOCR/graphs/contributors">
293
+ <img src="https://contrib.rocks/image?repo=PaddlePaddle/PaddleOCR&max=400&columns=20" width="800"/>
294
+ </a>
295
+
296
+
297
+ ## 🌟 Star
298
+
299
+ [![Star History Chart](https://api.star-history.com/svg?repos=PaddlePaddle/PaddleOCR&type=Date)](https://star-history.com/#PaddlePaddle/PaddleOCR&Date)
300
+
301
+
302
+ ## 📄 许可协议
303
+ 本项目的发布受[Apache 2.0 license](LICENSE)许可认证。
304
+
305
+ ## 🎓 学术引用
306
+
307
+ ```
308
+ @misc{paddleocr2020,
309
+ title={PaddleOCR, Awesome multilingual OCR toolkits based on PaddlePaddle.},
310
+ author={PaddlePaddle Authors},
311
+ howpublished = {\url{https://github.com/PaddlePaddle/PaddleOCR}},
312
+ year={2020}
313
+ }
314
+ ```