提交 1abb0e4a 编写于 作者: L LDOUBLEV

Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleOCR into fixocr

......@@ -171,19 +171,16 @@ PaddleOCR文本识别算法的训练和使用请参考文档教程中[文本识
![](doc/imgs_results/chinese_db_crnn_server/8.jpg)
## FAQ
1. **预测报错:got an unexpected keyword argument 'gradient_clip'**
安装的paddle版本不对,目前本项目仅支持paddle1.7,近期会适配到1.8。
2. **转换attention识别模型时报错:KeyError: 'predict'**
1. **转换attention识别模型时报错:KeyError: 'predict'**
问题已解,请更新到最新代码。
3. **关于推理速度**
2. **关于推理速度**
图片中的文字较多时,预测时间会增,可以使用--rec_batch_num设置更小预测batch num,默认值为30,可以改为10或其他数值。
4. **服务部署与移动端部署**
3. **服务部署与移动端部署**
预计6月中下旬会先后发布基于Serving的服务部署方案和基于Paddle Lite的移动端部署方案,欢迎持续关注。
5. **自研算法发布时间**
4. **自研算法发布时间**
自研算法SAST、SRN、End2End-PSL都将在6-7月陆续发布,敬请期待。
[more](./doc/doc_ch/FAQ.md)
......
......@@ -171,23 +171,19 @@ Please refer to the document for training guide and use of PaddleOCR text recogn
![](doc/imgs_results/chinese_db_crnn_server/8.jpg)
## FAQ
1. Prediction error:got an unexpected keyword argument 'gradient_clip'
The installed paddle version is not correct. At present, this project only supports paddle1.7, which will be adapted to 1.8 in the near future.
2. Error when using attention-based recognition model: KeyError: 'predict'
1. Error when using attention-based recognition model: KeyError: 'predict'
The inference of recognition model based on attention loss is still being debugged. For Chinese text recognition, it is recommended to choose the recognition model based on CTC loss first. In practice, it is also found that the recognition model based on attention loss is not as effective as the one based on CTC loss.
3. About inference speed
2. About inference speed
When there are a lot of texts in the picture, the prediction time will increase. You can use `--rec_batch_num` to set a smaller prediction batch size. The default value is 30, which can be changed to 10 or other values.
4. Service deployment and mobile deployment
3. Service deployment and mobile deployment
It is expected that the service deployment based on Serving and the mobile deployment based on Paddle Lite will be released successively in mid-to-late June. Stay tuned for more updates.
5. Release time of self-developed algorithm
4. Release time of self-developed algorithm
Baidu Self-developed algorithms such as SAST, SRN and end2end PSL will be released in June or July. Please be patient.
......
......@@ -41,3 +41,7 @@ Optimizer:
base_lr: 0.0005
beta1: 0.9
beta2: 0.999
decay:
function: cosine_decay
step_each_epoch: 20
total_epoch: 1000
......@@ -46,3 +46,7 @@ PaddleOCR已完成Windows和Mac系统适配,运行时注意两点:1、在[
报错信息:Input(X) dims[3] and Input(Grid) dims[2] should be equal, but received X dimension[3](320) != Grid dimension[2](100)
原因:TPS模块暂时无法支持变长的输入,请设置 --rec_image_shape='3,32,100' --rec_char_type='en' 固定输入shape
11. **自定义字典训练的模型,识别结果出现字典里没出现的字**
预测时没有设置采用的自定义字典路径。设置方法是在预测时,通过增加输入参数rec_char_dict_path来设置。
......@@ -46,3 +46,18 @@
| img_set_dir | 数据集路径 | ./train_data | \ |
| label_file_path | 数据标签路径 | ./train_data/rec_gt_train.txt| \ |
| infer_img | 预测图像文件夹路径 | ./infer_img | \|
## 配置文件 Optimizer 系列参数介绍
`rec_icdar15_train.yml` 为例
| 字段 | 用途 | 默认值 | 备注 |
| :---------------------: | :---------------------: | :--------------: | :--------------------: |
| function | 选择优化器 | pocr.optimizer,AdamDecay | 目前只支持Adam方式 |
| base_lr | 设置初始学习率 | 0.0005 | \ |
| beta1 | 设置一阶矩估计的指数衰减率 | 0.9 | \ |
| beta2 | 设置二阶矩估计的指数衰减率 | 0.999 | \ |
| decay | 是否使用decay | \ | \ |
| function(decay) | 设置decay方式 | cosine_decay | 目前只支持cosin_decay |
| step_each_epoch | 每个epoch包含多少次迭代 | 20 | 计算方式:total_image_num / (batch_size_per_card * card_size) |
| total_epoch | 总共迭代多少个epoch | 1000 | 与Global.epoch_num 一致 |
......@@ -46,3 +46,18 @@ Take `rec_chinese_reader.yml` as an example:
| img_set_dir | Image folder path | ./train_data | \ |
| label_file_path | Groundtruth file path | ./train_data/rec_gt_train.txt| \ |
| infer_img | Result folder path | ./infer_img | \|
## Introduction to Optimizer parameters of Configuration file
Take `rec_icdar15_train.yml` as an example:
| Parameter | Use | Default | None |
| :---------------------: | :---------------------: | :--------------: | :--------------------: |
| function | Select Optimizer function | pocr.optimizer,AdamDecay | Only support Adam |
| base_lr | Set the base lr | 0.0005 | \ |
| beta1 | Set the exponential decay rate for the 1st moment estimates | 0.9 | \ |
| beta2 | Set the exponential decay rate for the 2nd moment estimates | 0.999 | \ |
| decay | Whether to use decay | \ | \ |
| function(decay) | Set the decay function | cosine_decay | Only support cosine_decay |
| step_each_epoch | The number of steps in an epoch. | 20 | Calculation :total_image_num / (batch_size_per_card * card_size) |
| total_epoch | The number of epochs | 1000 | Consistent with Global.epoch_num |
......@@ -115,7 +115,6 @@ class DBHead(object):
initializer = fluid.initializer.Uniform(-stdv, stdv)
bias_attr = fluid.ParamAttr(
regularizer=regularizer,
gradient_clip=gradient_clip,
initializer=initializer,
name=name + "_b_attr")
return bias_attr
......
......@@ -15,6 +15,9 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import paddle.fluid as fluid
from ppocr.utils.utility import initial_logger
logger = initial_logger()
def AdamDecay(params, parameter_list=None):
......@@ -28,6 +31,18 @@ def AdamDecay(params, parameter_list=None):
base_lr = params['base_lr']
beta1 = params['beta1']
beta2 = params['beta2']
if 'decay' in params:
params = params['decay']
decay_mode = params['function']
step_each_epoch = params['step_each_epoch']
total_epoch = params['total_epoch']
if decay_mode == "cosine_decay":
base_lr = fluid.layers.cosine_decay(
learning_rate=base_lr,
step_each_epoch=step_each_epoch,
epochs=total_epoch)
else:
logger.info("Only support Cosine decay currently")
optimizer = fluid.optimizer.Adam(
learning_rate=base_lr,
beta1=beta1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册