modify svtr and nrtr docs

This commit is contained in:
Topdu 2022-04-29 04:09:48 +00:00
parent 1f007f6cc5
commit 1b1cf4b6a4
2 changed files with 74 additions and 9 deletions

View File

@ -8,6 +8,9 @@
- [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)
<a name="1"></a>
@ -20,11 +23,11 @@
<a name="model"></a>
`NRTR`在场景文本识别公开数据集上的精度和模型文件如下:
`NRTR`使用MJSynth和SynthText两个文字识别数据集训练在IIIT, SVT, IC03, IC13, IC15, SVTP, CUTE数据集上进行评估算法复现效果如下:
| | Avg accruacy | 下载链接 | 配置文件 |
|-----| --- | --- | --- |
| NRTR | 84.21% | [训练模型](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mtb_nrtr_train.tar) | [config](../../configs/rec/rec_mtb_nrtr.yml) |
| | Avg accruacy | 下载链接 | 配置文件 |
|--------|------------|--------------------------------------------------------------------------------| --- |
| NRTR | 84.21% | [训练模型](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mtb_nrtr_train.tar) | [config](../../configs/rec/rec_mtb_nrtr.yml) |
<a name="2"></a>
@ -38,13 +41,19 @@
<a name="3-1"></a>
### 3.1 模型训练
#### 数据集准备
数据集采用[DTRB](https://arxiv.org/abs/1904.01906) 文字识别训练和评估流程,使用`MJSynth``SynthText`两个识别数据集训练在IIIT, SVT, IC03, IC13, IC15, SVTP, CUTE数据集上进行评估。
请参考[文本识别训练教程](./recognition.md)。PaddleOCR对代码进行了模块化训练`NRTR`识别模型时需要**更换配置文件**为`NRTR`的[配置文件](../../configs/rec/rec_mtb_nrtr.yml)。
#### 启动训练
请参考[文本识别训练教程](./recognition.md)。PaddleOCR对代码进行了模块化训练`NRTR`识别模型时需要**更换配置文件**为`NRTR`的[配置文件](../../configs/rec/rec_mtb_nrtr.yml)。
具体地,在完成数据准备后,便可以启动训练,训练命令如下:
```shell
#单卡训练(训练周期长,不建议)
python3 tools/train.py -c configs/rec/rec_mtb_nrtr.yml
#多卡训练,通过--gpus参数指定卡号
python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/rec/rec_mtb_nrtr.yml
```
<a name="3-2"></a>
### 3.2 评估
@ -72,7 +81,7 @@ python3 tools/infer_rec.py -c configs/rec/rec_mtb_nrtr.yml -o Global.infer_img='
<a name="4-1"></a>
### 4.1 Python推理
首先将训练得到best模型转换成inference model。这里以训练完成的模型为例[模型下载地址](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mtb_nrtr_train.tar)),可以使用如下命令进行转换:
首先将训练得到best模型转换成inference model。这里以训练完成的模型为例[模型下载地址](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mtb_nrtr_train.tar) ),可以使用如下命令进行转换:
```shell
# 注意将pretrained_model的路径设置为本地路径。
@ -85,7 +94,36 @@ python3 tools/export_model.py -c configs/rec/rec_mtb_nrtr.yml -o Global.pretrain
python3 tools/infer/predict_rec.py --image_dir='./doc/imgs_words_en/word_10.png' --rec_model_dir='./inference/rec_mtb_nrtr/' --rec_algorithm='NRTR' --rec_image_shape='1,32,100' --rec_char_dict_path='./ppocr/utils/EN_symbol_dict.txt'
# 预测文件夹下所有图像时可修改image_dir为文件夹如 --image_dir='./doc/imgs_words_en/'。
```
<a name="4-2"></a>
### 4.2 C++推理部署
由于C++预处理后处理还未支持SVTR所以暂未支持
<a name="4-3"></a>
### 4.3 Serving服务化部署
暂不支持
<a name="4-4"></a>
### 4.4 更多推理部署
暂不支持
<a name="5"></a>
## 5. FAQ
1. `NRTR`论文中使用Beam搜索进行解码字符但是速度较慢这里默认未使用Beam搜索以贪婪搜索进行解码字符。
## 引用
```bibtex
@article{Sheng2019NRTR,
author = {Fenfen Sheng and Zhineng Chen andBo Xu},
title = {NRTR: A No-Recurrence Sequence-to-Sequence Model For Scene Text Recognition},
journal = {ICDAR},
year = {2019},
url = {http://arxiv.org/abs/1806.00926},
pages = {781-786}
}
```

View File

@ -8,6 +8,9 @@
- [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)
<a name="1"></a>
@ -62,6 +65,15 @@ SVTR在场景文本识别公开数据集上的精度(%)和模型文件如下:
请参考[文本识别训练教程](./recognition.md)。PaddleOCR对代码进行了模块化训练`SVTR`识别模型时需要**更换配置文件**为`SVTR`的[配置文件](../../configs/rec/rec_svtrnet.yml)。
具体地,在完成数据准备后,便可以启动训练,训练命令如下:
```shell
#单卡训练(训练周期长,不建议)
python3 tools/train.py -c configs/rec/rec_svtrnet.yml
#多卡训练,通过--gpus参数指定卡号
python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/rec/rec_svtrnet.yml
```
<a name="3-2"></a>
### 3.2 评估
@ -106,6 +118,21 @@ python3 tools/infer/predict_rec.py --image_dir='./doc/imgs_words_en/word_10.png'
[2022/04/26 10:11:01] ppocr INFO: Predicts of ./doc/imgs_words_en/word_10.png:('pain', 0.9999998807907104)
```
<a name="4-2"></a>
### 4.2 C++推理部署
由于C++预处理后处理还未支持SVTR所以暂未支持
<a name="4-3"></a>
### 4.3 Serving服务化部署
暂不支持
<a name="4-4"></a>
### 4.4 更多推理部署
暂不支持
<a name="5"></a>
## 5. FAQ