📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.
Update README
SWHL65f3820b012e
diff --git a/.github/workflows/gen_whl_to_pypi_rapidocr_vino.yml b/.github/workflows/gen_whl_to_pypi_rapidocr_vino.ymlindex 47a6e96..9a669c3 100644--- a/.github/workflows/gen_whl_to_pypi_rapidocr_vino.yml+++ b/.github/workflows/gen_whl_to_pypi_rapidocr_vino.yml@@ -6,7 +6,7 @@ on:paths:- 'python/rapidocr_openvino/**'- 'docs/doc_whl_rapidocr_vino.md'- - 'python/setup_openvino.py'+ # - 'python/setup_openvino.py'env:RESOURCES_URL: https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/required_for_whl_v1.1.0.zipdiff --git a/README.md b/README.mdindex cab8758..2b5e65c 100755--- a/README.md+++ b/README.md@@ -28,9 +28,9 @@- [商业支持](#商业支持)- [简介](#简介)- [近期更新(more)](#近期更新more)+ - [🤖2022-12-14 update:](#2022-12-14-update)- [🧻2022-11-20 update:](#2022-11-20-update)- [🎃2022-11-01 update:](#2022-11-01-update)- - [🚩2022-10-01 update:](#2022-10-01-update)- [垂直相关项目(more)](#垂直相关项目more)- [衍生项目](#衍生项目)- [生态框架](#生态框架)@@ -68,17 +68,16 @@- 基于百度的开源PaddleOCR 模型及训练,任何人可以使用本推理库,也可以根据自己的需求使用百度PaddlePaddle框架进行模型优化。## 近期更新([more](./docs/change_log.md))+#### 🤖2022-12-14 update:+- \[python\] 将配置参数和模型移到模块里面,同时将模型打到whl包内,可以直接pip安装使用,更加方便快捷。+- 详情参见:[README](./python/README.md#推荐pip安装快速使用)+#### 🧻2022-11-20 update:- \[python\] 添加版面分析部分,支持中文、英文和表格三种版面的检测分析。详情参见:[Rapid Structure](./python/rapid_structure/README.md)部分。#### 🎃2022-11-01 update:- 添加Hugging Face Demo, 增加可以调节超参数的功能,详情可访问[Hugging Face Demo](https://huggingface.co/spaces/SWHL/RapidOCRDemo)-#### 🚩2022-10-01 update:-- 修复python部分下一些较小bugs-- merge来自[AutumnSun1996](https://github.com/AutumnSun1996)的[OCRWeb实现的多语言部署](https://github.com/RapidAI/RapidOCR/pull/46)demo,详情参见:[ocrweb_mutli-README](./ocrweb_multi/README.md)-- 添加onnxruntime-gpu推理速度较慢于CPU的问题说明,详情参见:[onnxruntime-gpu版相关说明](./python/README.md#onnxruntime-gpu版相关说明)-## 垂直相关项目([more](./docs/related_projects.md))- [RapidVideOCR](https://github.com/SWHL/RapidVideOCR):基于RapidOCR,提取视频中的硬字幕diff --git a/docs/README_en.md b/docs/README_en.mdindex 62595ea..04bc897 100644--- a/docs/README_en.md+++ b/docs/README_en.md@@ -26,9 +26,9 @@- [RapidOCR (Open source OCR for the security of the digital world)](#rapidocr-open-source-ocr-for-the-security-of-the-digital-world)- [Introduction](#introduction)- [Recently updates(more)](#recently-updatesmore)+ - [🤖2022-12-14 update:](#2022-12-14-update)- [🧻2022-11-20 update:](#2022-11-20-update)- [🎃2022-11-01 update:](#2022-11-01-update)- - [🚩2022-10-01 update:](#2022-10-01-update)- [Related projects (more)](#related-projects-more)- [Derivatives](#derivatives)- [Overall Framework](#overall-framework)@@ -65,17 +65,16 @@- Based on Baidu's open source PaddleOCR model and training, anyone can use this inference library, or use Baidu's PaddlePaddle framework for model optimization according to their own needs.## Recently updates([more](./change_log_en.md))+#### 🤖2022-12-14 update:+- \[python\] Move the configuration parameters and model into the module, and at the same time put the model into the whl package, which can be directly installed and used by pip, which is more convenient and quicker.+- For details, see: [README](../python/README.md#推荐pip安装快速使用)+#### 🧻2022-11-20 update:- \[python\] Add the layout analysis part, which supports the detection and analysis of three layouts: Chinese, English and tables. See: [Rapid Structure](../python/rapid_structure/README.md) section for details.#### 🎃2022-11-01 update:- Add Hugging Face Demo, add module that can adjust hyperameters, for details, please visit [Hugging Face Demo](https://huggingface.co/spaces/SWHL/RapidOCRDemo).-#### 🚩2022-10-01 update:-- Fix some minor bugs under python section.-- Merge the [OCRWeb Implementation of Multilingual Deployment](https://github.com/RapidAI/RapidOCR/pull/46) demo from [AutumnSun1996](https://github.com/AutumnSun1996), see for details: [ocrweb_mutli-README](./ocrweb_multi/README.md)-- Add a description of the problem that onnxruntime-gpu inference speed is slower than CPU. For details, please refer to: [onnxruntime-gpu version related instructions](../python/README.md#onnxruntime-gpu版相关说明)-## Related projects ([more](../docs/related_projects.md))- [RapidVideOCR](https://github.com/SWHL/RapidVideOCR): Extract hard subtitles in videos based on RapidOCRdiff --git a/docs/change_log.md b/docs/change_log.mdindex d06ac05..05f08ad 100644--- a/docs/change_log.md+++ b/docs/change_log.md@@ -1,3 +1,7 @@+#### 🤖2022-12-14 update:+- \[python\] 将配置参数和模型移到模块里面,同时将模型打到whl包内,可以直接pip安装使用,更加方便快捷。+- 详情参见:[README](../python/README.md#推荐pip安装快速使用)+#### 🧻2022-11-20 update:- \[python\] 添加版面分析部分,支持中文、英文和表格三种版面的检测分析。详情参见:[Rapid Structure](./python/rapid_structure/README.md)部分。diff --git a/docs/change_log_en.md b/docs/change_log_en.mdindex e273c80..662cfc3 100644--- a/docs/change_log_en.md+++ b/docs/change_log_en.md@@ -1,3 +1,7 @@+#### 🤖2022-12-14 update:+- \[python\] Move the configuration parameters and model into the module, and at the same time put the model into the whl package, which can be directly installed and used by pip, which is more convenient and quicker.+- For details, see: [README](../python/README.md#推荐pip安装快速使用)+#### 🧻2022-11-20 update:- \[python\] Add the layout analysis part, which supports the detection and analysis of three layouts: Chinese, English and tables. See: [Rapid Structure](../python/rapid_structure/README.md) section for details.diff --git a/python/README.md b/python/README.mdindex cb3986d..6666b48 100755--- a/python/README.md+++ b/python/README.md@@ -9,7 +9,7 @@- [RapidOCR Python](#rapidocr-python)- [简介和说明](#简介和说明)- - [pip安装快速使用](#pip安装快速使用)+ - [(推荐)pip安装快速使用](#推荐pip安装快速使用)- [源码使用步骤](#源码使用步骤)- [`config.yaml`中常用参数介绍](#configyaml中常用参数介绍)- [onnxruntime-gpu版相关说明](#onnxruntime-gpu版相关说明)@@ -20,8 +20,8 @@### 简介和说明- **各个版本的ONNX模型下载地址:**[百度网盘](https://pan.baidu.com/s/1PTcgXG2zEgQU6A_A3kGJ3Q?pwd=jhai) | [Google Drive](https://drive.google.com/drive/folders/1x_a9KpCo_1blxH1xFOfgKVkw1HYRVywY?usp=sharing)-- 所有常用的参数配置都在[`config.yaml`](./config.yaml)下,一目了然,更加便捷-- **目前[`config.yaml`](./config.yaml)中配置为权衡速度和准确度的最优组合。**+- 所有常用的参数配置都在[`config.yaml`](./rapidocr_onnxruntime/config.yaml)下,一目了然,更加便捷+- **目前[`config.yaml`](./rapidocr_onnxruntime/config.yaml)中配置为权衡速度和准确度的最优组合。**- 每个独立的模块下均有独立的`config.yaml`配置文件,可以单独使用- `det`部分:- `det`中`mobile`和`server`版,推理代码一致,直接更改配置文件中模型路径即可@@ -55,72 +55,32 @@|openvino|✓||-### pip安装快速使用+### (推荐)pip安装快速使用1. 安装`rapidocr`包- - `rapidocr_onnxruntime`: <a href="https://pypi.org/project/rapidocr-onnxruntime/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-onnxruntime?style=plastic"></a>- - `rapidocr_openvino`: <a href="https://pypi.org/project/rapidocr-openvino/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-openvino?style=plastic"></a>- - script:- ```shell- pip install rapidocr-onnxruntime-- # or- # pip install rapidocr-openvino- ```--2. 下载相关的模型和配置文件- ```shell- $ wget https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/required_for_whl_v1.1.0.zip-- # Download by gitee- # wget https://gitee.com/RapidAI/RapidOCR/releases/download/v1.1.0/required_for_whl_v1.1.0.zip+ - <a href="https://pypi.org/project/rapidocr-onnxruntime/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-onnxruntime?style=plastic"></a> `rapidocr_onnxruntime` → `pip install rapidocr-onnxruntime`+ - <a href="https://pypi.org/project/rapidocr-openvino/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr-openvino?style=plastic"></a> `rapidocr_openvino` → `pip install rapidocr-openvino`- $ unzip required_for_whl_v1.1.0.zip- $ cd required_for_whl_v1.1.0- ```- - 模型md5值,自行比对- |模型名称|md5值|- |---:|:---|- |ch_ppocr_mobile_v2.0_cls_infer.onnx| c99c6bfc2df6544427ad3c7c85feab36|- |ch_PP-OCRv3_det_infer.onnx | f3b6ff552124995842242f6dac1afde3|- |ch_PP-OCRv3_rec_infer.onnx | ed1abe13869a3a7a036c0b3819c6f642|-- - 最终目录结构如下:- ```text- required_for_whl_v1.1.0/- ├── config.yaml- ├── README.md- ├── test_demo.py- ├── resources- │ └── models- │ ├── ch_ppocr_mobile_v2.0_cls_infer.onnx- │ ├── ch_PP-OCRv3_det_infer.onnx- │ └── ch_PP-OCRv3_rec_infer.onnx- └── test_images- ├── ch_en_num.jpg- └── single_line_text.jpg- ```--3. 推理使用-```python-import cv2-from rapidocr_onnxruntime import RapidOCR-# from rapidocr_openvino import RapidOCR+2. 推理使用+ ```python+ import cv2+ from rapidocr_onnxruntime import RapidOCR+ # from rapidocr_openvino import RapidOCR-text_sys = RapidOCR('config.yaml')+ text_sys = RapidOCR('config.yaml')-img = cv2.imread('test_images/ch_en_num.jpg')+ img = cv2.imread('test_images/ch_en_num.jpg')-result = text_sys(img)-print(result)+ result = text_sys(img)+ print(result)-# result: [[文本框坐标], 文本内容, 置信度]-# 示例:[[左上, 右上, 右下, 左下], '小明', '0.99']-```+ # result: [[文本框坐标], 文本内容, 置信度]+ # 示例:[[左上, 右上, 右下, 左下], '小明', '0.99']+ ```### 源码使用步骤1. 下载整个项目到本地```shell- cd RapidOCR/python+ $ cd RapidOCR/python```2. 下载链接下的`resources`目录(包含模型和显示的字体文件)@@ -133,29 +93,34 @@ print(result)```text.├── README.md- ├── config.yaml- ├── test_demo.py+ ├── demo.py├── rapidocr_onnxruntime│ ├── __init__.py│ ├── ch_ppocr_v2_cls│ ├── ch_ppocr_v3_det│ ├── ch_ppocr_v3_rec- │ └── rapid_ocr_api.py+ │ ├── config.yaml+ │ ├── rapid_ocr_api.py+ │ └── models+ │ ├── ch_PP-OCRv3_det_infer.onnx+ │ ├── ch_ppocr_mobile_v2.0_cls_infer.onnx+ │ └── ch_PP-OCRv3_rec_infer.onnx├── rapidocr_openvino│ ├── __init__.py│ ├── README.md│ ├── ch_ppocr_v2_cls│ ├── ch_ppocr_v3_det│ ├── ch_ppocr_v3_rec- │ └── rapid_ocr_api.py- ├── requirements.txt- ├── resources- │ ├── fonts- │ │ └── FZYTK.TTF- │ └── models+ │ ├── config.yaml+ │ ├── rapid_ocr_api.py+ │ └── models│ ├── ch_PP-OCRv3_det_infer.onnx│ ├── ch_ppocr_mobile_v2.0_cls_infer.onnx│ └── ch_PP-OCRv3_rec_infer.onnx+ ├── requirements.txt+ ├── resources+ │ └── fonts+ │ └── FZYTK.TTF└── test_images├── ch_en_num.jpg└── single_line_text.jpg@@ -170,7 +135,7 @@ print(result)```- 基于openvino推理所需环境安装:```bash- # Windows端+ # Windows/Macpip install openvino==2022.2.0pip install -r requirements.txt -i https://pypi.douban.com/simple/@@ -193,7 +158,7 @@ print(result)# 基于openvino引擎推理# from rapidocr_openvino import RapidOCR- text_sys = RapidOCR('config.yaml')+ text_sys = RapidOCR()image_path = r'test_images/det_images/ch_en_num.jpg'img = cv2.imread(image_path)@@ -204,12 +169,12 @@ print(result)# result: [[文本框坐标], 文本内容, 置信度]# 示例:[[左上, 右上, 右下, 左下], '小明', '0.99']```- - 直接运行`test_demo.py`,可直接可视化查看结果。+ - 直接运行`demo.py`,可直接可视化查看结果。```bash- python test_demo.py+ python demo.py```-### [`config.yaml`](./config.yaml)中常用参数介绍+### [`config.yaml`](./rapidocr_onnxruntime/config.yaml)中常用参数介绍- `Global`部分| 参数名称 | 取值范围 | 默认值 | 作用 ||------------: | :----------: | :-----: | :----------------------------------------------|@@ -298,7 +263,7 @@ print(result)# 如果输出中含有CUDAExecutionProvider,则证明可以正常调用GPU# ['CUDAExecutionProvider', 'CPUExecutionProvider']```-2. 更改[`config.yaml`](./config.yaml)中对应部分的参数即可,详细参数介绍参见[官方文档](https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html)。+2. 更改[`config.yaml`](./rapidocr_onnxruntime/config.yaml)中对应部分的参数即可,详细参数介绍参见[官方文档](https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html)。```yamluse_cuda: trueCUDAExecutionProvider:diff --git a/python/setup_openvino.py b/python/setup_openvino.pyindex 58a5d35..b307965 100644--- a/python/setup_openvino.py+++ b/python/setup_openvino.py@@ -39,7 +39,6 @@ def get_readme():MODULE_NAME = 'rapidocr_openvino'latest_version = get_latest_version(MODULE_NAME)VERSION_NUM = version_add_one(latest_version)-VERSION_NUM = '1.1.14'setuptools.setup(name=MODULE_NAME,