From 97725a644511c46fbb1302430ebb45ee8b5a3f82 Mon Sep 17 00:00:00 2001 From: lubin10 Date: Thu, 28 Apr 2022 12:26:32 +0000 Subject: [PATCH 1/9] add rosetta_rare_doc; test=document_fix --- doc/doc_ch/algorithm_rec_rare.md | 114 +++++++++++++++++++++++++++ doc/doc_ch/algorithm_rec_rosetta.md | 116 ++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 doc/doc_ch/algorithm_rec_rare.md create mode 100644 doc/doc_ch/algorithm_rec_rosetta.md diff --git a/doc/doc_ch/algorithm_rec_rare.md b/doc/doc_ch/algorithm_rec_rare.md new file mode 100644 index 0000000000..03c21f925c --- /dev/null +++ b/doc/doc_ch/algorithm_rec_rare.md @@ -0,0 +1,114 @@ +# RARE + +- [1. 算法简介](#1) +- [2. 环境配置](#2) +- [3. 模型训练、评估、预测](#3) + - [3.1 训练](#3-1) + - [3.2 评估](#3-2) + - [3.3 预测](#3-3) +- [4. 推理部署](#4) + - [4.1 Python推理](#4-1) + - [4.2 C++推理](#4-2) + - [4.3 Serving服务化部署](#4-3) + - [4.4 更多推理部署](#4-4) +- [5. FAQ](#5) + + +## 1. 算法简介 + +论文信息: +> [Robust Scene Text Recognition with Automatic Rectification](https://arxiv.org/abs/1603.03915v2) +> Baoguang Shi, Xinggang Wang, Pengyuan Lyu, Cong Yao, Xiang Bai∗ +> CVPR, 2016 + +使用MJSynth和SynthText两个文字识别数据集训练,在IIIT, SVT, IC03, IC13, IC15, SVTP, CUTE数据集上进行评估,算法复现效果如下: + +|模型|骨干网络|配置文件|Avg Accuracy|下载链接| +| --- | --- | --- | --- | --- | +|RARE|Resnet34_vd|[configs/rec/rec_r34_vd_tps_bilstm_att.yml](../../configs/rec/rec_r34_vd_tps_bilstm_att.yml)|83.6%|[训练模型](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_tps_bilstm_att_v2.0_train.tar)| +|RARE|MobileNetV3|[configs/rec/rec_mv3_tps_bilstm_att.yml](../../configs/rec/rec_mv3_tps_bilstm_att.yml)|82.5%|[训练模型](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_tps_bilstm_att_v2.0_train.tar)| + + + +## 2. 环境配置 +请先参考[《运行环境准备》](./environment.md)配置PaddleOCR运行环境,参考[《项目克隆》](./clone.md)克隆项目代码。 + + +## 3. 模型训练、评估、预测 + +请参考[文本识别训练教程](./recognition.md)。PaddleOCR对代码进行了模块化,训练不同的识别模型只需要**更换配置文件**即可。以基于Resnet34_vd骨干网络为例: + + +### 3.1 训练 + +``` +#单卡训练(训练周期长,不建议) +python3 tools/train.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml +#多卡训练,通过--gpus参数指定卡号 +python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml +``` + + +### 3.2 评估 + +``` +# GPU 评估, Global.pretrained_model 为待评估模型 +python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model={path/to/weights}/best_accuracy +``` + + +### 3.3 预测 + +``` +# 预测使用的配置文件必须与训练一致 +python3 tools/infer_rec.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model={path/to/weights}/best_accuracy Global.infer_img=doc/imgs_words/en/word_1.png +``` + + +## 4. 推理部署 + + +### 4.1 Python推理 +首先将RARE文本识别训练过程中保存的模型,转换成inference model。以基于Resnet34_vd骨干网络,在MJSynth和SynthText两个文字识别数据集训练得到的模型为例( [模型下载地址](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_tps_bilstm_att_v2.0_train.tar) ),可以使用如下命令进行转换: + +```shell +python3 tools/export_model.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model=./rec_r34_vd_tps_bilstm_att_v2.0_train/best_accuracy Global.save_inference_dir=./inference/rec_rare +``` + +RARE文本识别模型推理,可以执行如下命令: + +```shell +python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rare/" +``` + + +### 4.2 C++推理 + +暂不支持 + + +### 4.3 Serving服务化部署 + +暂不支持 + + +### 4.4 更多推理部署 + +RARE模型还支持以下推理部署方式: + +- Paddle2ONNX推理:准备好推理模型后,参考[paddle2onnx](../../deploy/paddle2onnx/)教程操作。 + + +## 5. FAQ + + +## 引用 + +```bibtex +@inproceedings{2016Robust, + title={Robust Scene Text Recognition with Automatic Rectification}, + author={ Shi, B. and Wang, X. and Lyu, P. and Cong, Y. and Xiang, B. }, + booktitle={2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, + year={2016}, +} +``` diff --git a/doc/doc_ch/algorithm_rec_rosetta.md b/doc/doc_ch/algorithm_rec_rosetta.md new file mode 100644 index 0000000000..a1f52c112a --- /dev/null +++ b/doc/doc_ch/algorithm_rec_rosetta.md @@ -0,0 +1,116 @@ +# Rosetta + +- [1. 算法简介](#1) +- [2. 环境配置](#2) +- [3. 模型训练、评估、预测](#3) + - [3.1 训练](#3-1) + - [3.2 评估](#3-2) + - [3.3 预测](#3-3) +- [4. 推理部署](#4) + - [4.1 Python推理](#4-1) + - [4.2 C++推理](#4-2) + - [4.3 Serving服务化部署](#4-3) + - [4.4 更多推理部署](#4-4) +- [5. FAQ](#5) + + +## 1. 算法简介 + +论文信息: +> [Rosetta: Large Scale System for Text Detection and Recognition in Images](https://arxiv.org/abs/1910.05085) +> Borisyuk F , Gordo A , V Sivakumar +> KDD, 2018 + +使用MJSynth和SynthText两个文字识别数据集训练,在IIIT, SVT, IC03, IC13, IC15, SVTP, CUTE数据集上进行评估, 算法复现效果如下: + +|模型|骨干网络|配置文件|Avg Accuracy|下载链接| +| --- | --- | --- | --- | --- | +|Rosetta|Resnet34_vd|[configs/rec/rec_r34_vd_none_none_ctc.yml](../../configs/rec/rec_r34_vd_none_none_ctc.yml)|79.11%|[训练模型](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_none_ctc_v2.0_train.tar)| +|Rosetta|MobileNetV3|[configs/rec/rec_mv3_none_none_ctc.yml](../../configs/rec/rec_mv3_none_none_ctc.yml)|75.80%|[训练模型](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_none_none_ctc_v2.0_train.tar)| + + + +## 2. 环境配置 +请先参考[《运行环境准备》](./environment.md)配置PaddleOCR运行环境,参考[《项目克隆》](./clone.md)克隆项目代码。 + + + +## 3. 模型训练、评估、预测 + +请参考[文本识别训练教程](./recognition.md)。PaddleOCR对代码进行了模块化,训练不同的识别模型只需要**更换配置文件**即可。 以基于Resnet34_vd骨干网络为例: + + +### 3.1 训练 + +``` +#单卡训练(训练周期长,不建议) +python3 tools/train.py -c configs/rec/rec_r34_vd_none_none_ctc.yml +#多卡训练,通过--gpus参数指定卡号 +python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/rec/rec_r34_vd_none_none_ctc.yml +``` + + +### 3.2 评估 + +``` +# GPU 评估, Global.pretrained_model 为待评估模型 +python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model={path/to/weights}/best_accuracy +``` + + +### 3.3 预测 + +``` +# 预测使用的配置文件必须与训练一致 +python3 tools/infer_rec.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model={path/to/weights}/best_accuracy Global.infer_img=doc/imgs_words/en/word_1.png +``` + + + +## 4. 推理部署 + + +### 4.1 Python推理 +首先将Rosetta文本识别训练过程中保存的模型,转换成inference model。以基于Resnet34_vd骨干网络,在MJSynth和SynthText两个文字识别数据集训练得到的模型为例( [模型下载地址](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_none_ctc_v2.0_train.tar) ),可以使用如下命令进行转换: + +```shell +python3 tools/export_model.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model=./rec_r34_vd_none_none_ctc_v2.0_train/best_accuracy Global.save_inference_dir=./inference/rec_rosetta +``` + +Rosetta文本识别模型推理,可以执行如下命令: + +```shell +python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rosetta/" +``` + + +### 4.2 C++推理 + +暂不支持 + + +### 4.3 Serving服务化部署 + +暂不支持 + + +### 4.4 更多推理部署 + +Rosetta模型还支持以下推理部署方式: + +- Paddle2ONNX推理:准备好推理模型后,参考[paddle2onnx](../../deploy/paddle2onnx/)教程操作。 + + +## 5. FAQ + + +## 引用 + +```bibtex +@inproceedings{2018Rosetta, + title={Rosetta: Large Scale System for Text Detection and Recognition in Images}, + author={ Borisyuk, Fedor and Gordo, Albert and Sivakumar, Viswanath }, + booktitle={the 24th ACM SIGKDD International Conference}, + year={2018}, +} +``` From 2f74c2745a3565c80220e499ffa1eb6d962548e4 Mon Sep 17 00:00:00 2001 From: lubin10 Date: Thu, 28 Apr 2022 12:39:38 +0000 Subject: [PATCH 2/9] test=document_fix --- doc/doc_ch/algorithm_rec_rare.md | 5 ++--- doc/doc_ch/algorithm_rec_rosetta.md | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/doc_ch/algorithm_rec_rare.md b/doc/doc_ch/algorithm_rec_rare.md index 03c21f925c..e5b5e54c59 100644 --- a/doc/doc_ch/algorithm_rec_rare.md +++ b/doc/doc_ch/algorithm_rec_rare.md @@ -38,7 +38,7 @@ 请参考[文本识别训练教程](./recognition.md)。PaddleOCR对代码进行了模块化,训练不同的识别模型只需要**更换配置文件**即可。以基于Resnet34_vd骨干网络为例: - + ### 3.1 训练 ``` @@ -52,7 +52,7 @@ python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs ### 3.2 评估 ``` -# GPU 评估, Global.pretrained_model 为待评估模型 +# GPU评估, Global.pretrained_model为待评估模型 python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model={path/to/weights}/best_accuracy ``` @@ -60,7 +60,6 @@ python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec ### 3.3 预测 ``` -# 预测使用的配置文件必须与训练一致 python3 tools/infer_rec.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model={path/to/weights}/best_accuracy Global.infer_img=doc/imgs_words/en/word_1.png ``` diff --git a/doc/doc_ch/algorithm_rec_rosetta.md b/doc/doc_ch/algorithm_rec_rosetta.md index a1f52c112a..097a142b53 100644 --- a/doc/doc_ch/algorithm_rec_rosetta.md +++ b/doc/doc_ch/algorithm_rec_rosetta.md @@ -39,7 +39,7 @@ 请参考[文本识别训练教程](./recognition.md)。PaddleOCR对代码进行了模块化,训练不同的识别模型只需要**更换配置文件**即可。 以基于Resnet34_vd骨干网络为例: - + ### 3.1 训练 ``` @@ -53,7 +53,7 @@ python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs ### 3.2 评估 ``` -# GPU 评估, Global.pretrained_model 为待评估模型 +# GPU评估, Global.pretrained_model为待评估模型 python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model={path/to/weights}/best_accuracy ``` @@ -61,7 +61,6 @@ python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec ### 3.3 预测 ``` -# 预测使用的配置文件必须与训练一致 python3 tools/infer_rec.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model={path/to/weights}/best_accuracy Global.infer_img=doc/imgs_words/en/word_1.png ``` From d74640dd10ad264603ae2e342177cfd95afff537 Mon Sep 17 00:00:00 2001 From: lubin10 Date: Thu, 28 Apr 2022 12:49:40 +0000 Subject: [PATCH 3/9] add en doc;test=document_fix --- doc/doc_en/algorithm_rec_rare_en.md | 113 ++++++++++++++++++++++++ doc/doc_en/algorithm_rec_rosetta_en.md | 114 +++++++++++++++++++++++++ 2 files changed, 227 insertions(+) create mode 100644 doc/doc_en/algorithm_rec_rare_en.md create mode 100644 doc/doc_en/algorithm_rec_rosetta_en.md diff --git a/doc/doc_en/algorithm_rec_rare_en.md b/doc/doc_en/algorithm_rec_rare_en.md new file mode 100644 index 0000000000..b5059dfa25 --- /dev/null +++ b/doc/doc_en/algorithm_rec_rare_en.md @@ -0,0 +1,113 @@ +# RARE + +- [1. Introduction to Algorithms](#1) +- [2. Environment Configuration](#2) +- [3. Model training, evaluation, prediction](#3) + - [3.1 Training](#3-1) + - [3.2 Evaluation](#3-2) + - [3.3 Forecast](#3-3) +- [4. Inference Deployment](#4) + - [4.1 Python Reasoning](#4-1) + - [4.2 C++ Reasoning] (#4-2) + - [4.3 Serving service deployment](#4-3) + - [4.4 More inference deployments](#4-4) +- [5. FAQ](#5) + + +## 1. Introduction to the algorithm + +Paper information: +> [Robust Scene Text Recognition with Automatic Rectification](https://arxiv.org/abs/1603.03915v2) +> Baoguang Shi, Xinggang Wang, Pengyuan Lyu, Cong Yao, Xiang Bai∗ +> CVPR, 2016 + +Using MJSynth and SynthText two text recognition datasets for training, and evaluating on IIIT, SVT, IC03, IC13, IC15, SVTP, CUTE datasets, the algorithm reproduction effect is as follows: + +|Models|Backbone Networks|Configuration Files|Avg Accuracy|Download Links| +| --- | --- | --- | --- | --- | +|RARE|Resnet34_vd|[configs/rec/rec_r34_vd_tps_bilstm_att.yml](../../configs/rec/rec_r34_vd_tps_bilstm_att.yml)|83.6%|[training model](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_tps_bilstm_att_v2.0_train.tar)| +|RARE|MobileNetV3|[configs/rec/rec_mv3_tps_bilstm_att.yml](../../configs/rec/rec_mv3_tps_bilstm_att.yml)|82.5%|[trained model](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_tps_bilstm_att_v2.0_train.tar)| + + + +## 2. Environment configuration +Please refer to ["Operating Environment Preparation"](./environment.md) to configure the PaddleOCR operating environment, and refer to ["Project Clone"](./clone.md) to clone the project code. + + +## 3. Model training, evaluation, prediction + +Please refer to [Text Recognition Training Tutorial](./recognition.md). PaddleOCR modularizes the code, and training different recognition models only requires **changing the configuration file**. Take the backbone network based on Resnet34_vd as an example: + + +### 3.1 Training + +```` +#Single card training (long training period, not recommended) +python3 tools/train.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml +#Multi-card training, specify the card number through the --gpus parameter +python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml +```` + + +### 3.2 Evaluation + +```` +# GPU evaluation, Global.pretrained_model is the model to be evaluated +python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model={path/to/weights}/best_accuracy +```` + + +### 3.3 Prediction + +```` +python3 tools/infer_rec.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model={path/to/weights}/best_accuracy Global.infer_img=doc/imgs_words/en/word_1.png +```` + + +## 4. Inference Deployment + + +### 4.1 Python Reasoning +First, convert the model saved during the RARE text recognition training process into an inference model. Take the model trained on the MJSynth and SynthText text recognition datasets based on the Resnet34_vd backbone network as an example ([Model download address](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_tps_bilstm_att_v2.0_train.tar) ), which can be converted using the following command: + +```shell +python3 tools/export_model.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model=./rec_r34_vd_tps_bilstm_att_v2.0_train/best_accuracy Global.save_inference_dir=./inference/rec_rare +```` + +RARE text recognition model inference, you can execute the following commands: + +```shell +python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rare/" +```` + + +### 4.2 C++ Reasoning + +Not currently supported + + +### 4.3 Serving service deployment + +Not currently supported + + +### 4.4 More inference deployment + +The RARE model also supports the following inference deployment methods: + +- Paddle2ONNX Inference: After preparing the inference model, refer to the [paddle2onnx](../../deploy/paddle2onnx/) tutorial. + + +## 5. FAQ + + +## Quote + +````bibtex +@inproceedings{2016Robust, + title={Robust Scene Text Recognition with Automatic Rectification}, + author={ Shi, B. and Wang, X. and Lyu, P. and Cong, Y. and Xiang, B. }, + booktitle={2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, + year={2016}, +} +```` diff --git a/doc/doc_en/algorithm_rec_rosetta_en.md b/doc/doc_en/algorithm_rec_rosetta_en.md new file mode 100644 index 0000000000..1708185419 --- /dev/null +++ b/doc/doc_en/algorithm_rec_rosetta_en.md @@ -0,0 +1,114 @@ +#rosetta + +- [1. Introduction to Algorithms](#1) +- [2. Environment Configuration](#2) +- [3. Model training, evaluation, prediction](#3) + - [3.1 Training](#3-1) + - [3.2 Evaluation](#3-2) + - [3.3 Forecast](#3-3) +- [4. Inference Deployment](#4) + - [4.1 Python Reasoning](#4-1) + - [4.2 C++ Reasoning] (#4-2) + - [4.3 Serving service deployment](#4-3) + - [4.4 More inference deployments](#4-4) +- [5. FAQ](#5) + + +## 1. Introduction to the algorithm + +Paper information: +> [Rosetta: Large Scale System for Text Detection and Recognition in Images](https://arxiv.org/abs/1910.05085) +> Borisyuk F , Gordo A , V Sivakumar +> KDD, 2018 + +Using MJSynth and SynthText two text recognition datasets for training, and evaluating on IIIT, SVT, IC03, IC13, IC15, SVTP, CUTE datasets, the algorithm reproduction effect is as follows: + +|Models|Backbone Networks|Configuration Files|Avg Accuracy|Download Links| +| --- | --- | --- | --- | --- | +|Rosetta|Resnet34_vd|[configs/rec/rec_r34_vd_none_none_ctc.yml](../../configs/rec/rec_r34_vd_none_none_ctc.yml)|79.11%|[training model](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_none_ctc_v2.0_train.tar)| +|Rosetta|MobileNetV3|[configs/rec/rec_mv3_none_none_ctc.yml](../../configs/rec/rec_mv3_none_none_ctc.yml)|75.80%|[training model](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_none_none_ctc_v2.0_train.tar)| + + + +## 2. Environment configuration +Please refer to ["Operating Environment Preparation"](./environment.md) to configure the PaddleOCR operating environment, and refer to ["Project Clone"](./clone.md) to clone the project code. + + + +## 3. Model training, evaluation, prediction + +Please refer to [Text Recognition Training Tutorial](./recognition.md). PaddleOCR modularizes the code, and training different recognition models only requires **changing the configuration file**. Take the backbone network based on Resnet34_vd as an example: + + +### 3.1 Training + +```` +#Single card training (long training period, not recommended) +python3 tools/train.py -c configs/rec/rec_r34_vd_none_none_ctc.yml +#Multi-card training, specify the card number through the --gpus parameter +python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/rec/rec_r34_vd_none_none_ctc.yml +```` + + +### 3.2 Evaluation + +```` +# GPU evaluation, Global.pretrained_model is the model to be evaluated +python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model={path/to/weights}/best_accuracy +```` + + +### 3.3 Prediction + +```` +python3 tools/infer_rec.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model={path/to/weights}/best_accuracy Global.infer_img=doc/imgs_words/en/word_1.png +```` + + +## 4. Inference Deployment + + +### 4.1 Python Reasoning +First, convert the model saved during the Rosetta text recognition training process into an inference model. Take the model trained on the MJSynth and SynthText text recognition datasets based on the Resnet34_vd backbone network as an example ( [Model download address](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_none_ctc_v2.0_train.tar) ), which can be converted using the following command: + +```shell +python3 tools/export_model.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global.pretrained_model=./rec_r34_vd_none_none_ctc_v2.0_train/best_accuracy Global.save_inference_dir=./inference/rec_rosetta +```` + +Rosetta text recognition model inference, you can execute the following commands: + +```shell +python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rosetta/" +```` + + +### 4.2 C++ Reasoning + +Not currently supported + + +### 4.3 Serving service deployment + +Not currently supported + + +### 4.4 More inference deployment + +The Rosetta model also supports the following inference deployment methods: + +- Paddle2ONNX Inference: After preparing the inference model, refer to the [paddle2onnx](../../deploy/paddle2onnx/) tutorial. + + +## 5. FAQ + + +## Quote + +````bibtex +@inproceedings{2018Rosetta, + title={Rosetta: Large Scale System for Text Detection and Recognition in Images}, + author={ Borisyuk, Fedor and Gordo, Albert and Sivakumar, Viswanath }, + booktitle={the 24th ACM SIGKDD International Conference}, + year={2018}, +} +```` From 5ca14e4048678c16e6a546d4423b8c5f08ab51bb Mon Sep 17 00:00:00 2001 From: lubin10 Date: Thu, 28 Apr 2022 12:57:11 +0000 Subject: [PATCH 4/9] test=document_fix --- doc/doc_en/algorithm_rec_rare_en.md | 8 ++++---- doc/doc_en/algorithm_rec_rosetta_en.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/doc_en/algorithm_rec_rare_en.md b/doc/doc_en/algorithm_rec_rare_en.md index b5059dfa25..50fa17d371 100644 --- a/doc/doc_en/algorithm_rec_rare_en.md +++ b/doc/doc_en/algorithm_rec_rare_en.md @@ -5,10 +5,10 @@ - [3. Model training, evaluation, prediction](#3) - [3.1 Training](#3-1) - [3.2 Evaluation](#3-2) - - [3.3 Forecast](#3-3) + - [3.3 Prediction](#3-3) - [4. Inference Deployment](#4) - [4.1 Python Reasoning](#4-1) - - [4.2 C++ Reasoning] (#4-2) + - [4.2 C++ Reasoning](#4-2) - [4.3 Serving service deployment](#4-3) - [4.4 More inference deployments](#4-4) - [5. FAQ](#5) @@ -31,12 +31,12 @@ Using MJSynth and SynthText two text recognition datasets for training, and eval ## 2. Environment configuration -Please refer to ["Operating Environment Preparation"](./environment.md) to configure the PaddleOCR operating environment, and refer to ["Project Clone"](./clone.md) to clone the project code. +Please refer to ["Operating Environment Preparation"](./environment_en.md) to configure the PaddleOCR operating environment, and refer to ["Project Clone"](./clone_en.md) to clone the project code. ## 3. Model training, evaluation, prediction -Please refer to [Text Recognition Training Tutorial](./recognition.md). PaddleOCR modularizes the code, and training different recognition models only requires **changing the configuration file**. Take the backbone network based on Resnet34_vd as an example: +Please refer to [Text Recognition Training Tutorial](./recognition_en.md). PaddleOCR modularizes the code, and training different recognition models only requires **changing the configuration file**. Take the backbone network based on Resnet34_vd as an example: ### 3.1 Training diff --git a/doc/doc_en/algorithm_rec_rosetta_en.md b/doc/doc_en/algorithm_rec_rosetta_en.md index 1708185419..94b602e466 100644 --- a/doc/doc_en/algorithm_rec_rosetta_en.md +++ b/doc/doc_en/algorithm_rec_rosetta_en.md @@ -5,10 +5,10 @@ - [3. Model training, evaluation, prediction](#3) - [3.1 Training](#3-1) - [3.2 Evaluation](#3-2) - - [3.3 Forecast](#3-3) + - [3.3 Prediction](#3-3) - [4. Inference Deployment](#4) - [4.1 Python Reasoning](#4-1) - - [4.2 C++ Reasoning] (#4-2) + - [4.2 C++ Reasoning](#4-2) - [4.3 Serving service deployment](#4-3) - [4.4 More inference deployments](#4-4) - [5. FAQ](#5) @@ -31,13 +31,13 @@ Using MJSynth and SynthText two text recognition datasets for training, and eval ## 2. Environment configuration -Please refer to ["Operating Environment Preparation"](./environment.md) to configure the PaddleOCR operating environment, and refer to ["Project Clone"](./clone.md) to clone the project code. +Please refer to ["Operating Environment Preparation"](./environment_en.md) to configure the PaddleOCR operating environment, and refer to ["Project Clone"](./clone_en.md) to clone the project code. ## 3. Model training, evaluation, prediction -Please refer to [Text Recognition Training Tutorial](./recognition.md). PaddleOCR modularizes the code, and training different recognition models only requires **changing the configuration file**. Take the backbone network based on Resnet34_vd as an example: +Please refer to [Text Recognition Training Tutorial](./recognition_en.md). PaddleOCR modularizes the code, and training different recognition models only requires **changing the configuration file**. Take the backbone network based on Resnet34_vd as an example: ### 3.1 Training From c657cf8605f3bc33de86302725c1fd1b944825df Mon Sep 17 00:00:00 2001 From: lubin10 Date: Thu, 28 Apr 2022 13:01:45 +0000 Subject: [PATCH 5/9] test=document_fix --- doc/doc_en/algorithm_rec_rare_en.md | 6 +++--- doc/doc_en/algorithm_rec_rosetta_en.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/doc_en/algorithm_rec_rare_en.md b/doc/doc_en/algorithm_rec_rare_en.md index 50fa17d371..65a6c663ce 100644 --- a/doc/doc_en/algorithm_rec_rare_en.md +++ b/doc/doc_en/algorithm_rec_rare_en.md @@ -31,7 +31,7 @@ Using MJSynth and SynthText two text recognition datasets for training, and eval ## 2. Environment configuration -Please refer to ["Operating Environment Preparation"](./environment_en.md) to configure the PaddleOCR operating environment, and refer to ["Project Clone"](./clone_en.md) to clone the project code. +Please refer to [Operating Environment Preparation](./environment_en.md) to configure the PaddleOCR operating environment, and refer to [Project Clone](./clone_en.md) to clone the project code. ## 3. Model training, evaluation, prediction @@ -48,7 +48,7 @@ python3 tools/train.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml ```` - + ### 3.2 Evaluation ```` @@ -56,7 +56,7 @@ python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/ python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model={path/to/weights}/best_accuracy ```` - + ### 3.3 Prediction ```` diff --git a/doc/doc_en/algorithm_rec_rosetta_en.md b/doc/doc_en/algorithm_rec_rosetta_en.md index 94b602e466..f976f16a5d 100644 --- a/doc/doc_en/algorithm_rec_rosetta_en.md +++ b/doc/doc_en/algorithm_rec_rosetta_en.md @@ -1,4 +1,4 @@ -#rosetta +# Rosetta - [1. Introduction to Algorithms](#1) - [2. Environment Configuration](#2) @@ -31,7 +31,7 @@ Using MJSynth and SynthText two text recognition datasets for training, and eval ## 2. Environment configuration -Please refer to ["Operating Environment Preparation"](./environment_en.md) to configure the PaddleOCR operating environment, and refer to ["Project Clone"](./clone_en.md) to clone the project code. +Please refer to [Operating Environment Preparation](./environment_en.md) to configure the PaddleOCR operating environment, and refer to [Project Clone](./clone_en.md) to clone the project code. From df6120a093843d1f528c61cbfa129ae2c6e88a80 Mon Sep 17 00:00:00 2001 From: lubin10 Date: Fri, 29 Apr 2022 03:48:06 +0000 Subject: [PATCH 6/9] add image exmaple --- doc/doc_ch/algorithm_rec_rare.md | 10 +++++++++- doc/doc_ch/algorithm_rec_rosetta.md | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/doc_ch/algorithm_rec_rare.md b/doc/doc_ch/algorithm_rec_rare.md index e5b5e54c59..3d36da7cd4 100644 --- a/doc/doc_ch/algorithm_rec_rare.md +++ b/doc/doc_ch/algorithm_rec_rare.md @@ -77,8 +77,16 @@ python3 tools/export_model.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Gl RARE文本识别模型推理,可以执行如下命令: ```shell -python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rare/" +python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rare/" --rec_image_shape="3, 32, 100" --rec_char_dict_path="./ppocr/utils/ic15_dict.txt" ``` +推理结果如下所示: + +![](../../doc/imgs_words/en/word_1.png) + +``` +Predicts of doc/imgs_words/en/word_1.png:('joint ', 0.9999969601631165) +``` + ### 4.2 C++推理 diff --git a/doc/doc_ch/algorithm_rec_rosetta.md b/doc/doc_ch/algorithm_rec_rosetta.md index 097a142b53..c1784cac8c 100644 --- a/doc/doc_ch/algorithm_rec_rosetta.md +++ b/doc/doc_ch/algorithm_rec_rosetta.md @@ -79,7 +79,15 @@ python3 tools/export_model.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Glo Rosetta文本识别模型推理,可以执行如下命令: ```shell -python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rosetta/" +python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rosetta/" --rec_image_shape="3, 32, 100" --rec_char_dict_path="./ppocr/utils/ic15_dict.txt" +``` + +推理结果如下所示: + +![](../../doc/imgs_words/en/word_1.png) + +``` +Predicts of doc/imgs_words/en/word_1.png:('joint', 0.9999982714653015) ``` From 2051489235af75b5f7c29e8548f0b8df4ca4ee01 Mon Sep 17 00:00:00 2001 From: lubin10 Date: Fri, 29 Apr 2022 03:57:26 +0000 Subject: [PATCH 7/9] update doc; test=document_fix --- doc/doc_en/algorithm_rec_rare_en.md | 41 ++++++++++++++----------- doc/doc_en/algorithm_rec_rosetta_en.md | 42 +++++++++++++++----------- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/doc/doc_en/algorithm_rec_rare_en.md b/doc/doc_en/algorithm_rec_rare_en.md index 65a6c663ce..a44bba35fc 100644 --- a/doc/doc_en/algorithm_rec_rare_en.md +++ b/doc/doc_en/algorithm_rec_rare_en.md @@ -1,20 +1,20 @@ # RARE -- [1. Introduction to Algorithms](#1) -- [2. Environment Configuration](#2) -- [3. Model training, evaluation, prediction](#3) +- [1. Introduction](#1) +- [2. Environment](#2) +- [3. Model Training / Evaluation / Prediction](#3) - [3.1 Training](#3-1) - [3.2 Evaluation](#3-2) - [3.3 Prediction](#3-3) -- [4. Inference Deployment](#4) - - [4.1 Python Reasoning](#4-1) - - [4.2 C++ Reasoning](#4-2) - - [4.3 Serving service deployment](#4-3) - - [4.4 More inference deployments](#4-4) +- [4. Inference and Deployment](#4) + - [4.1 Python Inference](#4-1) + - [4.2 C++ Inference](#4-2) + - [4.3 Serving](#4-3) + - [4.4 More](#4-4) - [5. FAQ](#5) -## 1. Introduction to the algorithm +## 1. Introduction Paper information: > [Robust Scene Text Recognition with Automatic Rectification](https://arxiv.org/abs/1603.03915v2) @@ -30,11 +30,11 @@ Using MJSynth and SynthText two text recognition datasets for training, and eval -## 2. Environment configuration +## 2. Environment Please refer to [Operating Environment Preparation](./environment_en.md) to configure the PaddleOCR operating environment, and refer to [Project Clone](./clone_en.md) to clone the project code. -## 3. Model training, evaluation, prediction +## 3. Model Training / Evaluation / Prediction Please refer to [Text Recognition Training Tutorial](./recognition_en.md). PaddleOCR modularizes the code, and training different recognition models only requires **changing the configuration file**. Take the backbone network based on Resnet34_vd as an example: @@ -64,10 +64,10 @@ python3 tools/infer_rec.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Globa ```` -## 4. Inference Deployment +## 4. Inference -### 4.1 Python Reasoning +### 4.1 Python Inference First, convert the model saved during the RARE text recognition training process into an inference model. Take the model trained on the MJSynth and SynthText text recognition datasets based on the Resnet34_vd backbone network as an example ([Model download address](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_tps_bilstm_att_v2.0_train.tar) ), which can be converted using the following command: ```shell @@ -77,21 +77,28 @@ python3 tools/export_model.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Gl RARE text recognition model inference, you can execute the following commands: ```shell -python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rare/" +python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rare/" --rec_image_shape="3, 32, 100" --rec_char_dict_path= "./ppocr/utils/ic15_dict.txt" +```` +The inference results are as follows: + +![](../../doc/imgs_words/en/word_1.png) + +```` +Predicts of doc/imgs_words/en/word_1.png:('joint ', 0.9999969601631165) ```` -### 4.2 C++ Reasoning +### 4.2 C++ Inference Not currently supported -### 4.3 Serving service deployment +### 4.3 Serving Not currently supported -### 4.4 More inference deployment +### 4.4 More The RARE model also supports the following inference deployment methods: diff --git a/doc/doc_en/algorithm_rec_rosetta_en.md b/doc/doc_en/algorithm_rec_rosetta_en.md index f976f16a5d..8caea655fa 100644 --- a/doc/doc_en/algorithm_rec_rosetta_en.md +++ b/doc/doc_en/algorithm_rec_rosetta_en.md @@ -1,20 +1,20 @@ # Rosetta -- [1. Introduction to Algorithms](#1) -- [2. Environment Configuration](#2) -- [3. Model training, evaluation, prediction](#3) +- [1. Introduction](#1) +- [2. Environment](#2) +- [3. Model Training / Evaluation / Prediction](#3) - [3.1 Training](#3-1) - [3.2 Evaluation](#3-2) - [3.3 Prediction](#3-3) -- [4. Inference Deployment](#4) - - [4.1 Python Reasoning](#4-1) - - [4.2 C++ Reasoning](#4-2) - - [4.3 Serving service deployment](#4-3) - - [4.4 More inference deployments](#4-4) +- [4. Inference and Deployment](#4) + - [4.1 Python Inference](#4-1) + - [4.2 C++ Inference](#4-2) + - [4.3 Serving](#4-3) + - [4.4 More](#4-4) - [5. FAQ](#5) -## 1. Introduction to the algorithm +## 1. Introduction Paper information: > [Rosetta: Large Scale System for Text Detection and Recognition in Images](https://arxiv.org/abs/1910.05085) @@ -30,12 +30,12 @@ Using MJSynth and SynthText two text recognition datasets for training, and eval -## 2. Environment configuration +## 2. Environment Please refer to [Operating Environment Preparation](./environment_en.md) to configure the PaddleOCR operating environment, and refer to [Project Clone](./clone_en.md) to clone the project code. -## 3. Model training, evaluation, prediction +## 3. Model Training / Evaluation / Prediction Please refer to [Text Recognition Training Tutorial](./recognition_en.md). PaddleOCR modularizes the code, and training different recognition models only requires **changing the configuration file**. Take the backbone network based on Resnet34_vd as an example: @@ -65,10 +65,10 @@ python3 tools/infer_rec.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Global ```` -## 4. Inference Deployment +## 4. Inference and Deployment -### 4.1 Python Reasoning +### 4.1 Python Inference First, convert the model saved during the Rosetta text recognition training process into an inference model. Take the model trained on the MJSynth and SynthText text recognition datasets based on the Resnet34_vd backbone network as an example ( [Model download address](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_none_ctc_v2.0_train.tar) ), which can be converted using the following command: ```shell @@ -78,21 +78,29 @@ python3 tools/export_model.py -c configs/rec/rec_r34_vd_none_none_ctc.yml -o Glo Rosetta text recognition model inference, you can execute the following commands: ```shell -python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rosetta/" +python3 tools/infer/predict_rec.py --image_dir="doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_rosetta/" --rec_image_shape="3, 32, 100" --rec_char_dict_path= "./ppocr/utils/ic15_dict.txt" +```` + +The inference results are as follows: + +![](../../doc/imgs_words/en/word_1.png) + +```` +Predicts of doc/imgs_words/en/word_1.png:('joint', 0.9999982714653015) ```` -### 4.2 C++ Reasoning +### 4.2 C++ Inference Not currently supported -### 4.3 Serving service deployment +### 4.3 Serving Not currently supported -### 4.4 More inference deployment +### 4.4 More The Rosetta model also supports the following inference deployment methods: From 6e32bb063026d88787177fa967ea39154724dd14 Mon Sep 17 00:00:00 2001 From: lubin10 Date: Fri, 29 Apr 2022 04:04:32 +0000 Subject: [PATCH 8/9] test=document_fix --- doc/doc_ch/algorithm_rec_rare.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/doc_ch/algorithm_rec_rare.md b/doc/doc_ch/algorithm_rec_rare.md index 3d36da7cd4..dddd27ef98 100644 --- a/doc/doc_ch/algorithm_rec_rare.md +++ b/doc/doc_ch/algorithm_rec_rare.md @@ -48,7 +48,7 @@ python3 tools/train.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml ``` - + ### 3.2 评估 ``` @@ -56,7 +56,7 @@ python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs python3 -m paddle.distributed.launch --gpus '0' tools/eval.py -c configs/rec/rec_r34_vd_tps_bilstm_att.yml -o Global.pretrained_model={path/to/weights}/best_accuracy ``` - + ### 3.3 预测 ``` From 19d064c9f750a1ed655a078c8a6c8c631bc48a9b Mon Sep 17 00:00:00 2001 From: lubin10 Date: Fri, 29 Apr 2022 05:53:14 +0000 Subject: [PATCH 9/9] update test=document_fix --- doc/doc_en/algorithm_rec_rare_en.md | 1 - doc/doc_en/algorithm_rec_rosetta_en.md | 1 - 2 files changed, 2 deletions(-) diff --git a/doc/doc_en/algorithm_rec_rare_en.md b/doc/doc_en/algorithm_rec_rare_en.md index a44bba35fc..3aeb1e3adf 100644 --- a/doc/doc_en/algorithm_rec_rare_en.md +++ b/doc/doc_en/algorithm_rec_rare_en.md @@ -107,7 +107,6 @@ The RARE model also supports the following inference deployment methods: ## 5. FAQ - ## Quote ````bibtex diff --git a/doc/doc_en/algorithm_rec_rosetta_en.md b/doc/doc_en/algorithm_rec_rosetta_en.md index 8caea655fa..2a1d7b3127 100644 --- a/doc/doc_en/algorithm_rec_rosetta_en.md +++ b/doc/doc_en/algorithm_rec_rosetta_en.md @@ -109,7 +109,6 @@ The Rosetta model also supports the following inference deployment methods: ## 5. FAQ - ## Quote ````bibtex