当前位置:网站首页>Detailed explanation of PPOCR detector configuration file parameters
Detailed explanation of PPOCR detector configuration file parameters
2022-08-05 10:49:00 【HUAWEI CLOUD】
@[toc]
配置文件参数介绍
以 rec_chinese_lite_train_v2.0.yml 为例
Global
| 字段 | 用途 | 默认值 | 备注 |
|---|---|---|---|
| use_gpu | 设置代码是否在gpu运行 | true | \ |
| epoch_num | 最大训练epoch数 | 500 | \ |
| log_smooth_window | log队列长度,每次打印输出队列里的中间值 | 20 | \ |
| print_batch_step | 设置打印log间隔 | 10 | \ |
| save_model_dir | 设置模型保存路径 | output/{算法名称} | \ |
| save_epoch_step | 设置模型保存间隔 | 3 | \ |
| eval_batch_step | 设置模型评估间隔 | 2000 或 [1000, 2000] | 2000 表示每2000次迭代评估一次,[1000, 2000]表示从1000次迭代开始,每2000次评估一次 |
| cal_metric_during_train | 设置是否在训练过程中评估指标,此时评估的是模型在当前batch下的指标 | true | \ |
| load_static_weights | 设置预训练模型是否是静态图模式保存(目前仅检测算法需要) | true | \ |
| pretrained_model | 设置加载预训练模型路径 | ./pretrain_models/CRNN/best_accuracy | \ |
| checkpoints | 加载模型参数路径 | None | 用于中断后加载参数继续训练 |
| use_visualdl | 设置是否启用visualdl进行可视化log展示 | False | 教程地址 |
| infer_img | 设置预测图像路径或文件夹路径 | ./infer_img | \ |
| character_dict_path | 设置字典路径 | ./ppocr/utils/ppocr_keys_v1.txt | 如果为空,则默认使用小写字母+数字作为字典 |
| max_text_length | 设置文本最大长度 | 25 | \ |
| use_space_char | 设置是否识别空格 | True | \ |
| label_list | 设置方向分类器支持的角度 | [‘0’,‘180’] | 仅在方向分类器中生效 |
| save_res_path | 设置检测模型的结果保存地址 | ./output/det_db/predicts_db.txt | 仅在检测模型中生效 |
Optimizer
| 字段 | 用途 | 默认值 | 备注 |
|---|---|---|---|
| name | 优化器类名 | Adam | 目前支持Momentum,Adam,RMSProp, 见[ppocr/optimizer/optimizer.py](file:/D:/cv/PaddleOCR-release-2.5/ppocr/optimizer/optimizer.py) |
| beta1 | 设置一阶矩估计的指数衰减率 | 0.9 | \ |
| beta2 | 设置二阶矩估计的指数衰减率 | 0.999 | \ |
| clip_norm | 所允许的二范数最大值 | \ | |
| lr | 设置学习率decay方式 | - | \ |
| name | 学习率decay类名 | Cosine | 目前支持Linear,Cosine,Step,Piecewise, 见[ppocr/optimizer/learning_rate.py](file:/D:/cv/PaddleOCR-release-2.5/ppocr/optimizer/learning_rate.py) |
| learning_rate | 基础学习率 | 0.001 | \ |
| regularizer | 设置网络正则化方式 | - | \ |
| name | 正则化类名 | L2 | 目前支持L1,L2, 见[ppocr/optimizer/regularizer.py](file:/D:/cv/PaddleOCR-release-2.5/ppocr/optimizer/regularizer.py) |
| factor | 正则化系数 | 0.00001 | \ |
Architecture
在PaddleOCR中,网络被划分为Transform,Backbone,Neck和Head四个阶段
| 字段 | 用途 | 默认值 | 备注 |
|---|---|---|---|
| model_type | 网络类型 | rec | 目前支持rec,det,cls |
| algorithm | 模型名称 | CRNN | 支持列表见[algorithm_overview](file:/D:/cv/PaddleOCR-release-2.5/doc/doc_ch/algorithm_overview.md) |
| Transform | 设置变换方式 | - | 目前仅rec类型的算法支持, 具体见[ppocr/modeling/transforms](file:/D:/cv/PaddleOCR-release-2.5/ppocr/modeling/transforms) |
| name | 变换方式类名 | TPS | 目前支持TPS |
| num_fiducial | TPS控制点数 | 20 | 上下边各十个 |
| loc_lr | 定位网络学习率 | 0.1 | \ |
| model_name | 定位网络大小 | small | 目前支持small,large |
| Backbone | 设置网络backbone类名 | - | 具体见[ppocr/modeling/backbones](file:/D:/cv/PaddleOCR-release-2.5/ppocr/modeling/backbones) |
| name | backbone类名 | ResNet | 目前支持MobileNetV3,ResNet |
| layers | resnet层数 | 34 | 支持18,34,50,101,152,200 |
| model_name | MobileNetV3 网络大小 | small | 支持small,large |
| Neck | 设置网络neck | - | 具体见[ppocr/modeling/necks](file:/D:/cv/PaddleOCR-release-2.5/ppocr/modeling/necks) |
| name | neck类名 | SequenceEncoder | 目前支持SequenceEncoder,DBFPN |
| encoder_type | SequenceEncoder编码器类型 | rnn | 支持reshape,fc,rnn |
| hidden_size | rnn内部单元数 | 48 | \ |
| out_channels | DBFPN输出通道数 | 256 | \ |
| Head | 设置网络Head | - | 具体见[ppocr/modeling/heads](file:/D:/cv/PaddleOCR-release-2.5/ppocr/modeling/heads) |
| name | head类名 | CTCHead | 目前支持CTCHead,DBHead,ClsHead |
| fc_decay | CTCHead正则化系数 | 0.0004 | \ |
| k | DBHead二值化系数 | 50 | \ |
| class_dim | ClsHead输出分类数 | 2 | \ |
Loss
| 字段 | 用途 | 默认值 | 备注 |
|---|---|---|---|
| name | 网络loss类名 | CTCLoss | 目前支持CTCLoss,DBLoss,ClsLoss |
| balance_loss | DBLossloss中是否对正负样本数量进行均衡(使用OHEM) | True | \ |
| ohem_ratio | DBLossloss中的OHEM的负正样本比例 | 3 | \ |
| main_loss_type | DBLossloss中shrink_map所采用的loss | DiceLoss | 支持DiceLoss,BCELoss |
| alpha | DBLossloss中shrink_map_loss的系数 | 5 | \ |
| beta | DBLossloss中threshold_map_loss的系数 | 10 | \ |
PostProcess
| 字段 | 用途 | 默认值 | 备注 |
|---|---|---|---|
| name | 后处理类名 | CTCLabelDecode | 目前支持CTCLoss,AttnLabelDecode,DBPostProcess,ClsPostProcess |
| thresh | DBPostProcess中分割图进行二值化的阈值 | 0.3 | \ |
| box_thresh | DBPostProcess中对输出框进行过滤的阈值,低于此阈值的框不会输出 | 0.7 | \ |
| max_candidates | DBPostProcess中输出的最大文本框数量 | 1000 | |
| unclip_ratio | DBPostProcess中对文本框进行放大的比例 | 2.0 | \ |
Metric
| 字段 | 用途 | 默认值 | 备注 |
|---|---|---|---|
| name | 指标评估方法名称 | CTCLabelDecode | 目前支持DetMetric,RecMetric,ClsMetric |
| main_indicator | 主要指标,用于选取最优模型 | acc | 对于检测方法为hmean,识别和分类方法为acc |
Dataset
| 字段 | 用途 | 默认值 | 备注 |
|---|---|---|---|
| dataset | 每次迭代返回一个样本 | - | - |
| name | dataset类名 | SimpleDataSet | 目前支持SimpleDataSet和LMDBDataSet |
| data_dir | 数据集图片存放路径 | ./train_data | \ |
| label_file_list | 数据标签路径 | ["./train_data/train_list.txt"] | dataset为LMDBDataSet时不需要此参数 |
| ratio_list | 数据集的比例 | [1.0] | 若label_file_list中有两个train_list,且ratio_list为[0.4,0.6],则从train_list1中采样40%,从train_list2中采样60%组合整个dataset |
| transforms | 对图片和标签进行变换的方法列表 | [DecodeImage,CTCLabelEncode,RecResizeImg,KeepKeys] | 见[ppocr/data/imaug](file:/D:/cv/PaddleOCR-release-2.5/ppocr/data/imaug) |
| loader | dataloader相关 | - | |
| shuffle | 每个epoch是否将数据集顺序打乱 | True | \ |
| batch_size_per_card | 训练时单卡batch size | 256 | \ |
| drop_last | 是否丢弃因数据集样本数不能被 batch_size 整除而产生的最后一个不完整的mini-batch | True | \ |
| num_workers | 用于加载数据的子进程个数,若为0即为不开启子进程,在主进程中进行数据加载 | 8 | \ |
边栏推荐
- 一文道清什么是SPL
- 012_SSS_ Improving Diffusion Model Efficiency Through Patching
- Chapter 4: activiti RuntimeService settings get and get process variables, and the difference from taskService, set process variables when starting and completing tasks [easy to understand]
- SMB + SMB2: Accessing shares return an error after prolonged idle period
- The JVM collection that Alibaba's top architects have summarized for many years, where can't I check it!
- 使用Windbg过程中两个使用细节分享
- JS introduction to reverse the recycling business network of learning, simple encryption mobile phone number
- API 网关简述
- 这份阿里强推的并发编程知识点笔记,将是你拿大厂offer的突破口
- Our Web3 Entrepreneurship Project, Yellow
猜你喜欢

RT-Thread记录(一、RT-Thread 版本、RT-Thread Studio开发环境 及 配合CubeMX开发快速上手)

2022 Huashu Cup Mathematical Modeling Question A Optimization Design Ideas for Ring Oscillators Code Sharing

Voice-based social software development - making the most of its value

PCB布局必知必会:教你正确地布设运算放大器的电路板

产品太多了,如何实现一次登录多产品互通?

The founder of the DFINITY Foundation talks about the ups and downs of the bear market, and where should DeFi projects go?

【MindSpore Easy-Diantong Robot-01】You may have seen many knowledge quiz robots, but this one is a bit different

【 temperature warning program DE development 】 event driven model instance

Huawei's lightweight neural network architecture GhostNet has been upgraded again, and G-GhostNet (IJCV22) has shown its talents on the GPU

登录功能和退出功能(瑞吉外卖)
随机推荐
秘乐短视频挖矿系统开发详情
大佬们 我是新手,我根据文档用flinksql 写个简单的用户访问量的count 但是执行一次就结束
[Strong Net Cup 2022] WP-UM
第四章:redis 数组结构的set和一些通用命令「建议收藏」
导火索:OAuth 2.0四种授权登录方式必读
MySQL transactions
uniapp connect ibeacon
2022华数杯数学建模思路分析交流
R语言使用yardstick包的pr_curve函数评估多分类(Multiclass)模型的性能、查看模型在多分类每个分类上的ROC曲线(precision(精准率),R代表的是recall(召回率)
【翻译】混沌网+SkyWalking:为混沌工程提供更好的可观察性
GCC编译的时候头文件搜索规则
2022技能大赛训练题:交换机snmp配置
【MindSpore Easy-Diantong Robot-01】You may have seen many knowledge quiz robots, but this one is a bit different
Oracle 19.3 restart 环境
2022 Hangzhou Electric Power Multi-School Session 6 1008.Shinobu Loves Segment Tree Regular Questions
OpenHarmony如何查询设备类型
flutter 服务器返回数据判断是否为空
gradle尚硅谷笔记
How does the official account operate and maintain?Public account operation and maintenance professional team
FPGA:基础入门LED灯闪烁