当前位置:网站首页>PPOCR 检测器配置文件参数详解
PPOCR 检测器配置文件参数详解
2022-08-05 10:47:00 【华为云】
@[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 | \ |
边栏推荐
- FPGA:基础入门按键控制LED灯
- 用KUSTO查询语句(KQL)在Azure Data Explorer Database上查询LOG实战
- RT-Thread记录(一、RT-Thread 版本、RT-Thread Studio开发环境 及 配合CubeMX开发快速上手)
- 2022 Huashu Cup Mathematical Modeling Question A Optimization Design Ideas for Ring Oscillators Code Sharing
- How to choose coins and determine the corresponding strategy research
- Chapter 5: Activiti process shunting judgment, judging to go to different task nodes
- gradle尚硅谷笔记
- 【MySQL基础】-【数据处理之增删改】
- E-sports, convenience, efficiency, security, key words for OriginOS functions
- 力扣(LeetCode)216. 组合总和 III(2022.08.04)
猜你喜欢

STM32+ULN2003 drives 28BYJ4 stepper motor (forward and reverse according to the number of turns)

我们的Web3创业项目,黄了

How to choose coins and determine the corresponding strategy research

SQL外连接之交集、并集、差集查询

This notebook of concurrent programming knowledge points strongly recommended by Ali will be a breakthrough for you to get an offer from a big factory

Meteorological data processing example - matlab string cutting matching and R language date matching (data splicing)

sqlserver编写通用脚本实现获取一年前日期的方法

60行从零开始自己动手写FutureTask是什么体验?

字节一面:TCP 和 UDP 可以使用同一个端口吗?

What are the standards for electrical engineering
随机推荐
Chapter 4: In the activiti process, variable transmission and acquisition process variables, setting and acquiring multiple process variables, setting and acquiring local process variables "recommende
这份阿里强推的并发编程知识点笔记,将是你拿大厂offer的突破口
R语言使用yardstick包的pr_curve函数评估多分类(Multiclass)模型的性能、查看模型在多分类每个分类上的ROC曲线(precision(精准率),R代表的是recall(召回率)
Dynamics 365Online PDF导出及打印
Leetcode刷题——623. 在二叉树中增加一行
第八章:activiti多用户任务分配
秘乐短视频挖矿系统开发详情
力扣(LeetCode)216. 组合总和 III(2022.08.04)
牛刀小试基本语法,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang基本语法和变量的使用EP02
MySQL transactions
Oracle 19.3 restart 环境
E-sports, convenience, efficiency, security, key words for OriginOS functions
Opencv图像缩放和平移
LeetCode 216. Combined Sum III (2022.08.04)
【MindSpore Easy-Diantong Robot-01】You may have seen many knowledge quiz robots, but this one is a bit different
API 网关简述
[Translation] Chaos Net + SkyWalking: Better observability for chaos engineering
js hijacks the array push method
我们的Web3创业项目,黄了
SQL Outer Join Intersection, Union, Difference Query