提交 58114b6c 编写于 作者: qq_25193841's avatar qq_25193841

Complete quickstart_en

上级 22838d50
...@@ -9,6 +9,7 @@ PaddleOCR supports both dynamic graph and static graph programming paradigm ...@@ -9,6 +9,7 @@ PaddleOCR supports both dynamic graph and static graph programming paradigm
- Static graph: develop branch - Static graph: develop branch
**Recent updates** **Recent updates**
- 2021.1.21 update more than 25+ multilingual recognition models [models list](./doc/doc_en/models_list_en.md), including:English, Chinese, German, French, Japanese,Spanish,Portuguese Russia Arabic and so on. Models for more languages will continue to be updated [Develop Plan](https://github.com/PaddlePaddle/PaddleOCR/issues/1048). - 2021.1.21 update more than 25+ multilingual recognition models [models list](./doc/doc_en/models_list_en.md), including:English, Chinese, German, French, Japanese,Spanish,Portuguese Russia Arabic and so on. Models for more languages will continue to be updated [Develop Plan](https://github.com/PaddlePaddle/PaddleOCR/issues/1048).
- 2020.12.15 update Data synthesis tool, i.e., [Style-Text](./StyleText/README.md),easy to synthesize a large number of images which are similar to the target scene image. - 2020.12.15 update Data synthesis tool, i.e., [Style-Text](./StyleText/README.md),easy to synthesize a large number of images which are similar to the target scene image.
- 2020.11.25 Update a new data annotation tool, i.e., [PPOCRLabel](./PPOCRLabel/README.md), which is helpful to improve the labeling efficiency. Moreover, the labeling results can be used in training of the PP-OCR system directly. - 2020.11.25 Update a new data annotation tool, i.e., [PPOCRLabel](./PPOCRLabel/README.md), which is helpful to improve the labeling efficiency. Moreover, the labeling results can be used in training of the PP-OCR system directly.
......
# 零基础Python环境搭建 # 零基础Python环境搭建
[toc]
## Windows ## Windows
### 第1步:安装Anaconda ### 第1步:安装Anaconda
......
# PaddleOCR快速开始 # PaddleOCR快速开始
[PaddleOCR快速开始](#paddleocr)
[TOC]
* [1. 轻量安装](#1)
+ [1.0 运行环境准备](#10)
+ [1.1 安装PaddlePaddle2.0](#11)
+ [1.2 安装PaddleOCR whl包](#12)
* [2. 便捷使用](#2)
+ [2.1 命令行使用](#21)
- [2.1.1 中英文模型](#211)
- [2.1.2 多语言模型](#212)
- [2.1.3 版面分析](#213)
+ [2.2 Python脚本使用](#22)
- [2.2.1 中英文与多语言使用](#221)
- [2.2.2 版面分析使用](#222)
<a name="1"></a>
## 1. 轻量安装 ## 1. 轻量安装
<a name="10"></a>
### 1.0 运行环境准备 ### 1.0 运行环境准备
如果您未搭建过Python环境,可以通过[零基础Python环境搭建文档](./environment.)进行环境搭建 如果您未搭建过Python环境,可以通过[零基础Python环境搭建文档](./environment.)进行环境搭建
<a name="11"></a>
### 1.1 安装PaddlePaddle2.0 ### 1.1 安装PaddlePaddle2.0
- 如果您的机器安装的是CUDA9或CUDA10,请运行以下命令安装 - 如果您的机器安装的是CUDA9或CUDA10,请运行以下命令安装
...@@ -24,7 +37,7 @@ python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple ...@@ -24,7 +37,7 @@ python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
``` ```
更多的版本需求,请参照[飞桨官网安装文档](https://www.paddlepaddle.org.cn/install/quick)中的说明进行操作。 更多的版本需求,请参照[飞桨官网安装文档](https://www.paddlepaddle.org.cn/install/quick)中的说明进行操作。
<a name="12"></a>
### 1.2 安装PaddleOCR whl包 ### 1.2 安装PaddleOCR whl包
```bash ```bash
...@@ -42,9 +55,9 @@ pip install "paddleocr>=2.0.1" # 推荐使用2.0.1+版本 ...@@ -42,9 +55,9 @@ pip install "paddleocr>=2.0.1" # 推荐使用2.0.1+版本
``` ```
<a name="2"></a>
## 2. 便捷使用 ## 2. 便捷使用
<a name="21"></a>
### 2.1 命令行使用 ### 2.1 命令行使用
PaddleOCR提供了一系列测试图片,点击xx下载,然后在终端中切换到相应目录 PaddleOCR提供了一系列测试图片,点击xx下载,然后在终端中切换到相应目录
...@@ -54,7 +67,7 @@ cd /path/to/ppocr_img ...@@ -54,7 +67,7 @@ cd /path/to/ppocr_img
``` ```
如果不使用提供的测试图片,可以将下方`--image_dir`参数替换为相应的测试图片路径 如果不使用提供的测试图片,可以将下方`--image_dir`参数替换为相应的测试图片路径
<a name="211"></a>
#### 2.1.1 中英文模型 #### 2.1.1 中英文模型
* 检测+方向分类器+识别全流程:设置方向分类器参数`--use_angle_cls true`后可对竖排文本进行识别。 * 检测+方向分类器+识别全流程:设置方向分类器参数`--use_angle_cls true`后可对竖排文本进行识别。
...@@ -103,7 +116,7 @@ cd /path/to/ppocr_img ...@@ -103,7 +116,7 @@ cd /path/to/ppocr_img
更多whl包使用包括, whl包参数说明 更多whl包使用包括, whl包参数说明
<a name="212"></a>
#### 2.1.2 多语言模型 #### 2.1.2 多语言模型
Paddleocr目前支持80个语种,可以通过修改`--lang`参数进行切换,对于英文模型,指定`--lang=en` Paddleocr目前支持80个语种,可以通过修改`--lang`参数进行切换,对于英文模型,指定`--lang=en`
...@@ -139,7 +152,7 @@ paddleocr --image_dir ./imgs_en/254.jpg --lang=en ...@@ -139,7 +152,7 @@ paddleocr --image_dir ./imgs_en/254.jpg --lang=en
| 繁体中文 | chinese_cht | | 意大利文 | it | | 俄罗斯文 | ru | | 繁体中文 | chinese_cht | | 意大利文 | it | | 俄罗斯文 | ru |
全部语种及其对应的缩写列表可查看[多语言模型教程](./multi_languages.md) 全部语种及其对应的缩写列表可查看[多语言模型教程](./multi_languages.md)
<a name="213"></a>
#### 2.1.3 版面分析 #### 2.1.3 版面分析
使用PaddleOCR的版面分析功能,需要指定`--type=structure` 使用PaddleOCR的版面分析功能,需要指定`--type=structure`
...@@ -192,8 +205,9 @@ paddleocr --image_dir=./table/1.png --type=structure ...@@ -192,8 +205,9 @@ paddleocr --image_dir=./table/1.png --type=structure
<a name="22"></a>
### 2.2 Python脚本使用 ### 2.2 Python脚本使用
<a name="221"></a>
#### 2.2.1 中英文与多语言使用 #### 2.2.1 中英文与多语言使用
通过脚本使用PaddleOCR whl包。whl包会自动下载ppocr轻量级模型作为默认模型, 通过脚本使用PaddleOCR whl包。whl包会自动下载ppocr轻量级模型作为默认模型,
...@@ -237,7 +251,7 @@ im_show.save('result.jpg') ...@@ -237,7 +251,7 @@ im_show.save('result.jpg')
<div align="center"> <div align="center">
<img src="../imgs_results/whl/11_det_rec.jpg" width="800"> <img src="../imgs_results/whl/11_det_rec.jpg" width="800">
</div> </div>
<a name="222"></a>
#### 2.2.2 版面分析使用 #### 2.2.2 版面分析使用
```python ```python
...@@ -265,4 +279,3 @@ im_show = draw_structure_result(image, result,font_path=font_path) ...@@ -265,4 +279,3 @@ im_show = draw_structure_result(image, result,font_path=font_path)
im_show = Image.fromarray(im_show) im_show = Image.fromarray(im_show)
im_show.save('result.jpg') im_show.save('result.jpg')
``` ```
...@@ -198,13 +198,13 @@ If necessary, you can read related documents: ...@@ -198,13 +198,13 @@ If necessary, you can read related documents:
| Language | Abbreviation | | Language | Abbreviation | | Language | Abbreviation | | Language | Abbreviation |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
|chinese and english|ch| |Arabic|ar| |Chinese & English|ch| |Arabic|ar|
|english|en| |Hindi|hi| |English|en| |Hindi|hi|
|french|fr| |Uyghur|ug| |French|fr| |Uyghur|ug|
|german|german| |Persian|fa| |German|german| |Persian|fa|
|japan|japan| |Urdu|ur| |Japan|japan| |Urdu|ur|
|korean|korean| | Serbian(latin) |rs_latin| |Korean|korean| | Serbian(latin) |rs_latin|
|chinese traditional |ch_tra| |Occitan |oc| |Chinese Traditional |chinese_cht| |Occitan |oc|
| Italian |it| |Marathi|mr| | Italian |it| |Marathi|mr|
|Spanish |es| |Nepali|ne| |Spanish |es| |Nepali|ne|
| Portuguese|pt| |Serbian(cyrillic)|rs_cyrillic| | Portuguese|pt| |Serbian(cyrillic)|rs_cyrillic|
......
# PaddleOCR Quick Start # PaddleOCR Quick Start
[TOC] [PaddleOCR Quick Start](#paddleocr-quick-start)
## 1. 轻量安装 * [1. Light Installation](#1-light-installation)
+ [1.1 Install PaddlePaddle2.0](#11-install-paddlepaddle20)
+ [1.2 Install PaddleOCR Whl Package](#12-install-paddleocr-whl-package)
* [2. Easy-to-Use](#2-easy-to-use)
+ [2.1 Use by command line](#21-use-by-command-line)
- [2.1.1 English and Chinese Model](#211-english-and-chinese-model)
- [2.1.2 Multi-language Model](#212-multi-language-model)
- [2.1.3 LayoutParser](#213-layoutparser)
+ [2.2 Use by Code](#22-use-by-code)
- [2.2.1 Chinese & English Model and Multilingual Model](#221-chinese---english-model-and-multilingual-model)
- [2.2.2 LayoutParser](#222-layoutparser)
### 1.0 Environment Preparation <a name="1-light-installation"></a>
环境配置 ## 1. Light Installation
python环境、pip安装 <a name="11-install-paddlepaddle20"></a>
```bash
pip3 install --upgrade pip
```
### 1.1 Install PaddlePaddle2.0 ### 1.1 Install PaddlePaddle2.0
...@@ -27,48 +33,92 @@ python3 -m pip install paddlepaddle==2.0.0 -i https://mirror.baidu.com/pypi/simp ...@@ -27,48 +33,92 @@ python3 -m pip install paddlepaddle==2.0.0 -i https://mirror.baidu.com/pypi/simp
For more software version requirements, please refer to the instructions in [Installation Document](https://www.paddlepaddle.org.cn/install/quick) for operation. For more software version requirements, please refer to the instructions in [Installation Document](https://www.paddlepaddle.org.cn/install/quick) for operation.
<a name="12-install-paddleocr-whl-package"></a>
### 1.2 Install PaddleOCR Whl Package ### 1.2 Install PaddleOCR Whl Package
```bash ```bash
pip install "paddleocr>=2.0.1" # Recommend to use version 2.0.1+ pip install "paddleocr>=2.0.1" # Recommend to use version 2.0.1+
``` ```
是否会出现sharply问题? - **For windows users:** If you getting this error `OSError: [WinError 126] The specified module could not be found` when you install shapely on windows. Please try to download Shapely whl file [here](http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely).
Reference: [Solve shapely installation on windows](https://stackoverflow.com/questions/44398265/install-shapely-oserror-winerror-126-the-specified-module-could-not-be-found)
- **For layout analysis users**, run the following command to install **Layout-Parser**
如果需要使用版面分析功能,还需**安装 Layout-Parser** ```bash
pip3 install -U https://paddleocr.bj.bcebos.com/whl/layoutparser-0.0.0-py3-none-any.whl
```
<a name="2-easy-to-use"></a>
## 2. Easy-to-Use
<a name="21-use-by-command-line"></a>
### 2.1 Use by command line
PaddleOCR provides a series of test images, click xx to download, and then switch to the corresponding directory in the terminal
```bash ```bash
pip3 install -U https://paddleocr.bj.bcebos.com/whl/layoutparser-0.0.0-py3-none-any.whl cd /path/to/ppocr_img
``` ```
## 2. 便捷使用 If you do not use the provided test image, you can replace the following `--image_dir` parameter with the corresponding test image path
### 2.1 Use by command line <a name="211-english-and-chinese-model"></a>
#### 2.1.1 English and Chinese Model #### 2.1.1 English and Chinese Model
* detection classification and recognition * Detection, direction classification and recognition: set the direction classifier parameter`--use_angle_cls true` to recognize vertical text.
```bash ```bash
paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --use_angle_cls true --lang en paddleocr --image_dir ./imgs_en/img_12.jpg --use_angle_cls true --lang en
``` ```
Output will be a list, each item contains bounding box, text and recognition confidence Output will be a list, each item contains bounding box, text and recognition confidence
```bash ```bash
[[[442.0, 173.0], [1169.0, 173.0], [1169.0, 225.0], [442.0, 225.0]], ['ACKNOWLEDGEMENTS', 0.99283075]] [[[442.0, 173.0], [1169.0, 173.0], [1169.0, 225.0], [442.0, 225.0]], ['ACKNOWLEDGEMENTS', 0.99283075]]
[[[393.0, 340.0], [1207.0, 342.0], [1207.0, 389.0], [393.0, 387.0]], ['We would like to thank all the designers and', 0.9357758]] [[[393.0, 340.0], [1207.0, 342.0], [1207.0, 389.0], [393.0, 387.0]], ['We would like to thank all the designers and', 0.9357758]]
[[[399.0, 398.0], [1204.0, 398.0], [1204.0, 433.0], [399.0, 433.0]], ['contributors whohave been involved in the', 0.9592447]] [[[399.0, 398.0], [1204.0, 398.0], [1204.0, 433.0], [399.0, 433.0]], ['contributors whohave been involved in the', 0.9592447]]
...... ......
``` ```
* Only detection: set `--rec` to `false`
```bash
paddleocr --image_dir ./imgs_en/img_12.jpg --rec false
```
* 更多whl包使用包括, whl包参数说明: Output will be a list, each item only contains bounding box
```bash
[[756.0, 812.0], [805.0, 812.0], [805.0, 830.0], [756.0, 830.0]]
[[820.0, 803.0], [1085.0, 801.0], [1085.0, 836.0], [820.0, 838.0]]
[[393.0, 801.0], [715.0, 805.0], [715.0, 839.0], [393.0, 836.0]]
......
```
* Only recognition: set `--det` to `false`
```bash
paddleocr --image_dir ./imgs_words_en/word_10.png --det false --lang en
```
Output will be a list, each item contains text and recognition confidence
```bash
['PAIN', 0.990372]
```
More whl package usage can be found in [whl package](./whl_en.md)
<a name="212-multi-language-model"></a>
#### 2.1.2 Multi-language Model #### 2.1.2 Multi-language Model
Paddleocr currently supports 80 languages, which can be switched by modifying the --lang parameter.The specific supported [language](language_abbreviations) can be viewed in the table. Paddleocr currently supports 80 languages, which can be switched by modifying the `--lang` parameter.
``` bash ``` bash
paddleocr --image_dir ./doc/imgs_en/254.jpg --lang=en paddleocr --image_dir ./doc/imgs_en/254.jpg --lang=en
...@@ -78,8 +128,6 @@ paddleocr --image_dir ./doc/imgs_en/254.jpg --lang=en ...@@ -78,8 +128,6 @@ paddleocr --image_dir ./doc/imgs_en/254.jpg --lang=en
<img src="../imgs_en/254.jpg" width="300" height="600"> <img src="../imgs_en/254.jpg" width="300" height="600">
<img src="../imgs_results/multi_lang/img_02.jpg" width="600" height="600"> <img src="../imgs_results/multi_lang/img_02.jpg" width="600" height="600">
</div> </div>
The result is a list, each item contains a text box, text and recognition confidence The result is a list, each item contains a text box, text and recognition confidence
```text ```text
...@@ -93,92 +141,129 @@ The result is a list, each item contains a text box, text and recognition confid ...@@ -93,92 +141,129 @@ The result is a list, each item contains a text box, text and recognition confid
...... ......
``` ```
#### 2.1.3 版面分析 Commonly used multilingual abbreviations include
```bash | Language | Abbreviation | | Language | Abbreviation | | Language | Abbreviation |
paddleocr --image_dir=../doc/table/1.png --type=structure | ------------------- | ------------ | ---- | -------- | ------------ | ---- | -------- | ------------ |
``` | Chinese & English | ch | | French | fr | | Japanese | japan |
| English | en | | German | german | | Korean | korean |
| Chinese Traditional | chinese_cht | | Italian | it | | Russian | ru |
1. **返回结果说明** A list of all languages and their corresponding abbreviations can be found in [Multi-Language Model Tutorial](./multi_languages_en.md)
<a name="213-layoutparser"></a>
PP-Structure的返回结果为一个dict组成的list,示例如下 #### 2.1.3 LayoutParser
```shell To use the layout analysis function of PaddleOCR, you need to specify `--type=structure`
[
{ 'type': 'Text', ```bash
'bbox': [34, 432, 345, 462], paddleocr --image_dir=../doc/table/1.png --type=structure
'res': ([[36.0, 437.0, 341.0, 437.0, 341.0, 446.0, 36.0, 447.0], [41.0, 454.0, 125.0, 453.0, 125.0, 459.0, 41.0, 460.0]],
[('Tigure-6. The performance of CNN and IPT models using difforen', 0.90060663), ('Tent ', 0.465441)])
}
]
``` ```
dict 里各个字段说明如下 - **Results Format**
| 字段 | 说明 | The returned results of PP-Structure is a list composed of a dict, an example is as follows
| ---- | ------------------------------------------------------------ |
| type | 图片区域的类型 |
| bbox | 图片区域的在原图的坐标,分别[左上角x,左上角y,右下角x,右下角y] |
| res | 图片区域的OCR或表格识别结果。<br> 表格: 表格的HTML字符串; <br> OCR: 一个包含各个单行文字的检测坐标和识别结果的元组 |
2. **参数说明** ```shell
[
{ 'type': 'Text',
'bbox': [34, 432, 345, 462],
'res': ([[36.0, 437.0, 341.0, 437.0, 341.0, 446.0, 36.0, 447.0], [41.0, 454.0, 125.0, 453.0, 125.0, 459.0, 41.0, 460.0]],
[('Tigure-6. The performance of CNN and IPT models using difforen', 0.90060663), ('Tent ', 0.465441)])
}
]
```
| 字段 | 说明 | 默认值 | The description of each field in dict is as follows
| --------------- | ---------------------------------------- | -------------------------------------------- |
| output | excel和识别结果保存的地址 | ./output/table |
| table_max_len | 表格结构模型预测时,图像的长边resize尺度 | 488 |
| table_model_dir | 表格结构模型 inference 模型地址 | None |
| table_char_type | 表格结构模型所用字典地址 | ../ppocr/utils/dict/table_structure_dict.txt |
大部分参数和paddleocr whl包保持一致,见 [whl包文档](../doc/doc_ch/whl.md) | Parameter | Description |
| --------- | ------------------------------------------------------------ |
| type | Type of image area |
| bbox | The coordinates of the image area in the original image, respectively [left upper x, left upper y, right bottom x, right bottom y] |
| res | OCR or table recognition result of image area。<br> Table: HTML string of the table; <br> OCR: A tuple containing the detection coordinates and recognition results of each single line of text |
运行完成后,每张图片会在`output`字段指定的目录下有一个同名目录,图片里的每个表格会存储为一个excel,图片区域会被裁剪之后保存下来,excel文件和图片名名为表格在图片里的坐标。 - **Parameter Description:**
### 2.2 Python脚本使用 | Parameter | Description | Default value |
| --------------- | ------------------------------------------------------------ | -------------------------------------------- |
| output | The path where excel and recognition results are saved | ./output/table |
| table_max_len | The long side of the image is resized in table structure model | 488 |
| table_model_dir | inference model path of table structure model | None |
| table_char_type | dict path of table structure model | ../ppocr/utils/dict/table_structure_dict.txt |
#### 2.2.1 中英文与多语言使用 <a name="22-use-by-code"></a>
paddleocr whl包会自动下载ppocr轻量级模型作为默认模型,可以根据第3节**自定义模型**进行自定义更换。 ### 2.2 Use by Code
<a name="221-chinese---english-model-and-multilingual-model"></a>
* 检测+方向分类器+识别全流程 #### 2.2.1 Chinese & English Model and Multilingual Model
```python * detection, angle classification and recognition:
from paddleocr import PaddleOCR, draw_ocr
# Paddleocr目前支持中英文、英文、法语、德语、韩语、日语,可以通过修改lang参数进行切换 ```python
# 参数依次为`ch`, `en`, `french`, `german`, `korean`, `japan`。 from paddleocr import PaddleOCR,draw_ocr
ocr = PaddleOCR(use_angle_cls=True, lang="ch") # need to run only once to download and load model into memory # Paddleocr supports Chinese, English, French, German, Korean and Japanese.
img_path = 'Path/to/Your/Img/11.jpg' # You can set the parameter `lang` as `ch`, `en`, `fr`, `german`, `korean`, `japan`
# to switch the language model in order.
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
img_path = './imgs_en/img_12.jpg'
result = ocr.ocr(img_path, cls=True) result = ocr.ocr(img_path, cls=True)
for line in result: for line in result:
print(line) print(line)
# 显示结果
from PIL import Image
# draw result
from PIL import Image
image = Image.open(img_path).convert('RGB') image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result] boxes = [line[0] for line in result]
txts = [line[1][0] for line in result] txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result] scores = [line[1][1] for line in result]
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf') im_show = draw_ocr(image, boxes, txts, scores, font_path='./fonts/simfang.ttf')
im_show = Image.fromarray(im_show) im_show = Image.fromarray(im_show)
im_show.save('result.jpg') im_show.save('result.jpg')
``` ```
结果是一个list,每个item包含了文本框,文字和识别置信度 Output will be a list, each item contains bounding box, text and recognition confidence
```bash ```bash
[[[24.0, 36.0], [304.0, 34.0], [304.0, 72.0], [24.0, 74.0]], ['纯臻营养护发素', 0.964739]] [[[442.0, 173.0], [1169.0, 173.0], [1169.0, 225.0], [442.0, 225.0]], ['ACKNOWLEDGEMENTS', 0.99283075]]
[[[24.0, 80.0], [172.0, 80.0], [172.0, 104.0], [24.0, 104.0]], ['产品信息/参数', 0.98069626]] [[[393.0, 340.0], [1207.0, 342.0], [1207.0, 389.0], [393.0, 387.0]], ['We would like to thank all the designers and', 0.9357758]]
[[[24.0, 109.0], [333.0, 109.0], [333.0, 136.0], [24.0, 136.0]], ['(45元/每公斤,100公斤起订)', 0.9676722]] [[[399.0, 398.0], [1204.0, 398.0], [1204.0, 433.0], [399.0, 433.0]], ['contributors whohave been involved in the', 0.9592447]]
...... ......
``` ```
结果可视化 Visualization of results
<div align="center"> <div align="center">
<img src="../imgs_results/whl/11_det_rec.jpg" width="800"> <img src="../imgs_results/whl/12_det_rec.jpg" width="800">
</div> </div>
<a name="222-layoutparser"></a>
#### 2.2.2 LayoutParser
```python
import os
import cv2
from paddleocr import PPStructure,draw_structure_result,save_structure_res
table_engine = PPStructure(show_log=True)
save_folder = './output/table'
img_path = './table/1.png'
img = cv2.imread(img_path)
result = table_engine(img)
save_structure_res(result, save_folder,os.path.basename(img_path).split('.')[0])
for line in result:
line.pop('img')
print(line)
from PIL import Image
font_path = './fonts/simfang.ttf'
image = Image.open(img_path).convert('RGB')
im_show = draw_structure_result(image, result,font_path=font_path)
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```
#### 2.2.2 版面分析使用
# paddleocr package # Paddleocr Package
## 1 Get started quickly ## 1 Get started quickly
### 1.1 install package ### 1.1 install package
......
...@@ -124,8 +124,6 @@ Most of the parameters are consistent with the paddleocr whl package, see [doc o ...@@ -124,8 +124,6 @@ Most of the parameters are consistent with the paddleocr whl package, see [doc o
After running, each image will have a directory with the same name under the directory specified in the output field. Each table in the picture will be stored as an excel and figure area will be cropped and saved, the excel and image file name will be the coordinates of the table in the image. After running, each image will have a directory with the same name under the directory specified in the output field. Each table in the picture will be stored as an excel and figure area will be cropped and saved, the excel and image file name will be the coordinates of the table in the image.
## 4. PP-Structure Pipeline ## 4. PP-Structure Pipeline
the process is as follows
![pipeline](../doc/table/pipeline_en.jpg) ![pipeline](../doc/table/pipeline_en.jpg)
In PP-Structure, the image will be analyzed by layoutparser first. In the layout analysis, the area in the image will be classified, including **text, title, image, list and table** 5 categories. For the first 4 types of areas, directly use the PP-OCR to complete the text detection and recognition. The table area will be converted to an excel file of the same table style via Table OCR. In PP-Structure, the image will be analyzed by layoutparser first. In the layout analysis, the area in the image will be classified, including **text, title, image, list and table** 5 categories. For the first 4 types of areas, directly use the PP-OCR to complete the text detection and recognition. The table area will be converted to an excel file of the same table style via Table OCR.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册