From 13bad9f4d621405f049e55bd905ff6ce07bf9b10 Mon Sep 17 00:00:00 2001
From: Leif <4603009@qq.com>
Date: Tue, 7 Sep 2021 21:10:37 +0800
Subject: [PATCH] Update training.md
---
doc/doc_ch/training.md | 35 +++++++++++++++++-----------
doc/doc_en/training_en.md | 49 ++++++++++++++++++++++-----------------
2 files changed, 49 insertions(+), 35 deletions(-)
diff --git a/doc/doc_ch/training.md b/doc/doc_ch/training.md
index fb7f94a9..c0dddd33 100644
--- a/doc/doc_ch/training.md
+++ b/doc/doc_ch/training.md
@@ -1,26 +1,33 @@
-# 模型训练
+# PP-OCR模型训练
本文将介绍模型训练时需掌握的基本概念,和训练时的调优方法。
同时会简单介绍PaddleOCR模型训练数据的组成部分,以及如何在垂类场景中准备数据finetune模型。
-- [1. 基本概念](#基本概念)
- * [1.1 学习率](#学习率)
- * [1.2 正则化](#正则化)
- * [1.3 评估指标](#评估指标)
-- [2. 数据与垂类场景](#数据与垂类场景)
- * [2.1 训练数据](#训练数据)
- * [2.2 垂类场景](#垂类场景)
- * [2.3 自己构建数据集](#自己构建数据集)
-* [3. 常见问题](#常见问题)
+- [1.配置文件](#配置文件)
+- [2. 基本概念](#基本概念)
+ * [2.1 学习率](#学习率)
+ * [2.2 正则化](#正则化)
+ * [2.3 评估指标](#评估指标)
+- [3. 数据与垂类场景](#数据与垂类场景)
+ * [3.1 训练数据](#训练数据)
+ * [3.2 垂类场景](#垂类场景)
+ * [3.3 自己构建数据集](#自己构建数据集)
+* [4. 常见问题](#常见问题)
+
+
+
+## 1. 配置文件说明
+
+PaddleOCR模型使用配置文件管理网络训练、评估的参数。在配置文件中,可以设置组建模型、优化器、损失函数、模型前后处理的参数,PaddleOCR从配置文件中读取到这些参数,进而组建出完整的训练流程,完成模型训练,在需要对模型进行优化的时,可以通过修改配置文件中的参数完成配置,使用简单且方便修改。
+
+完整的配置文件说明可以参考[配置文件](./config.md)
-## 1. 基本概念
-OCR(Optical Character Recognition,光学字符识别)是指对图像进行分析识别处理,获取文字和版面信息的过程,是典型的计算机视觉任务,
-通常由文本检测和文本识别两个子任务构成。
+## 2. 基本概念
-模型调优时需要关注以下参数:
+模型训练过程中需要手动调整一些超参数,帮助模型以最小的代价获得最优指标。不同的数据量可能需要不同的超参,当您希望在自己的数据上finetune或对模型效果调优时,有以下几个参数调整策略可供参考:
### 1.1 学习率
diff --git a/doc/doc_en/training_en.md b/doc/doc_en/training_en.md
index eaae2d1e..bd82bd27 100644
--- a/doc/doc_en/training_en.md
+++ b/doc/doc_en/training_en.md
@@ -1,30 +1,37 @@
# MODEL TRAINING
-- [1. Basic concepts](#1-basic-concepts)
- * [1.1 Learning rate](#11-learning-rate)
- * [1.2 Regularization](#12-regularization)
- * [1.3 Evaluation indicators](#13-evaluation-indicators-)
-- [2. Data and vertical scenes](#2-data-and-vertical-scenes)
- * [2.1 Training data](#21-training-data)
- * [2.2 Vertical scene](#22-vertical-scene)
- * [2.3 Build your own data set](#23-build-your-own-data-set)
-* [3. FAQ](#3-faq)
+- [1.Yml Configuration ](#1-Yml-Configuration)
+- [2. Basic concepts](#1-basic-concepts)
+ * [2.1 Learning rate](#11-learning-rate)
+ * [2.2 Regularization](#12-regularization)
+ * [2.3 Evaluation indicators](#13-evaluation-indicators-)
+- [3. Data and vertical scenes](#2-data-and-vertical-scenes)
+ * [3.1 Training data](#21-training-data)
+ * [3.2 Vertical scene](#22-vertical-scene)
+ * [3.3 Build your own data set](#23-build-your-own-data-set)
+* [4. FAQ](#3-faq)
This article will introduce the basic concepts that need to be mastered during model training and the tuning methods during training.
At the same time, it will briefly introduce the components of the PaddleOCR model training data and how to prepare the data finetune model in the vertical scene.
+
+
+## 1. Yml configuration
+
+The PaddleOCR model uses configuration files to manage network training and evaluation parameters. In the configuration file, you can set the model, optimizer, loss function, and pre- and post-processing parameters of the model. PaddleOCR reads these parameters from the configuration file, and then builds a complete training process to complete the model training. When optimized, the configuration can be completed by modifying the parameters in the configuration file, which is simple to use and convenient to modify.
+
+For the complete configuration file description, please refer to [Configuration File](./config_en.md)
+
-# 1. Basic concepts
-OCR (Optical Character Recognition) refers to the process of analyzing and recognizing images to obtain text and layout information. It is a typical computer vision task.
-It usually consists of two subtasks: text detection and text recognition.
+## 2. Basic concepts
-The following parameters need to be paid attention to when tuning the model:
+In the process of model training, some hyperparameters need to be manually adjusted to help the model obtain the optimal index at the least loss. Different data volumes may require different hyper-parameters. When you want to finetune your own data or tune the model effect, there are several parameter adjustment strategies for reference:
-## 1.1 Learning rate
+### 2.1 Learning rate
The learning rate is one of the important hyperparameters for training neural networks. It represents the step length of the gradient moving to the optimal solution of the loss function in each iteration.
A variety of learning rate update strategies are provided in PaddleOCR, which can be modified through configuration files, for example:
@@ -45,7 +52,7 @@ and the learning rate is the same in each stage.
warmup_epoch means that in the first 5 epochs, the learning rate will gradually increase from 0 to base_lr. For all strategies, please refer to the code [learning_rate.py](../../ppocr/optimizer/learning_rate.py).
-## 1.2 Regularization
+### 2.2 Regularization
Regularization can effectively avoid algorithm overfitting. PaddleOCR provides L1 and L2 regularization methods.
L1 and L2 regularization are the most commonly used regularization methods.
@@ -61,7 +68,7 @@ Optimizer:
factor: 2.0e-05
```
-## 1.3 Evaluation indicators
+### 2.3 Evaluation indicators
(1) Detection stage: First, evaluate according to the IOU of the detection frame and the labeled frame. If the IOU is greater than a certain threshold, it is judged that the detection is accurate. Here, the detection frame and the label frame are different from the general general target detection frame, and they are represented by polygons. Detection accuracy: the percentage of the correct detection frame number in all detection frames is mainly used to judge the detection index. Detection recall rate: the percentage of correct detection frames in all marked frames, which is mainly an indicator of missed detection.
@@ -71,11 +78,11 @@ Optimizer:
-# 2. Data and vertical scenes
+## 3. Data and vertical scenes
-## 2.1 Training data
+### 3.1 Training data
The current open source models, data sets and magnitudes are as follows:
@@ -92,14 +99,14 @@ Among them, the public data sets are all open source, users can search and downl
-## 2.2 Vertical scene
+### 3.2 Vertical scene
PaddleOCR mainly focuses on general OCR. If you have vertical requirements, you can use PaddleOCR + vertical data to train yourself;
If there is a lack of labeled data, or if you do not want to invest in research and development costs, it is recommended to directly call the open API, which covers some of the more common vertical categories.
-## 2.3 Build your own data set
+### 3.3 Build your own data set
There are several experiences for reference when constructing the data set:
@@ -117,7 +124,7 @@ There are several experiences for reference when constructing the data set:
-# 3. FAQ
+## 4. FAQ
**Q**: How to choose a suitable network input shape when training CRNN recognition?
--
GitLab