Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
f9a9492f
"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "69716a5cec581f77d99760aad8f6d4e42405a00a"
Commit
f9a9492f
authored
Apr 18, 2022
by
MissPenguin
Browse files
update
parent
bf6703d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
31 deletions
+50
-31
doc/doc_ch/algorithm_det_db.md
doc/doc_ch/algorithm_det_db.md
+6
-12
doc/doc_ch/detection.md
doc/doc_ch/detection.md
+44
-19
doc/features.png
doc/features.png
+0
-0
No files found.
doc/doc_ch/algorithm_det_db.md
View file @
f9a9492f
...
@@ -23,28 +23,22 @@
...
@@ -23,28 +23,22 @@
在ICDAR2015文本检测公开数据集上,算法复现效果如下:
在ICDAR2015文本检测公开数据集上,算法复现效果如下:
|模型|骨干网络|precision|recall|Hmean|下载链接|
|模型|骨干网络|
配置文件|
precision|recall|Hmean|下载链接|
| --- | --- | --- | --- | --- | --- |
| --- | --- | --- | --- | --- | --- |
--- |
|DB|ResNet50_vd|86.41%|78.72%|82.38%|
[
训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_r50_vd_db_v2.0_train.tar
)
|
|DB|ResNet50_vd|
configs/det/det_r50_vd_db.yml|
86.41%|78.72%|82.38%|
[
训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_r50_vd_db_v2.0_train.tar
)
|
|DB|MobileNetV3|77.29%|73.08%|75.12%|
[
训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar
)
|
|DB|MobileNetV3|
configs/det/det_mv3_db.yml|
77.29%|73.08%|75.12%|
[
训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar
)
|
<a
name=
"2"
></a>
<a
name=
"2"
></a>
## 2. 环境配置
## 2. 环境配置
请先参考
[
《运行环境准备》
](
./environment.md
)
配置PaddleOCR运行环境,参考
[
《项目克隆》
](
./clone.md
)
克隆项目
请先参考
[
《运行环境准备》
](
./environment.md
)
配置PaddleOCR运行环境,参考
[
《项目克隆》
](
./clone.md
)
克隆项目
代码。
<a
name=
"3"
></a>
<a
name=
"3"
></a>
## 3. 模型训练、评估、预测
## 3. 模型训练、评估、预测
<a
name=
"3-1"
></a>
请参考
[
文本检测训练教程
](
./detection.md
)
。PaddleOCR对代码进行了模块化,训练不同的检测模型只需要
**更换配置文件**
即可。
### 3.1 训练
<a
name=
"3-2"
></a>
### 3.2 评估
<a
name=
"3-3"
></a>
### 3.3 预测
<a
name=
"4"
></a>
<a
name=
"4"
></a>
## 4. 推理部署
## 4. 推理部署
...
...
doc/doc_ch/detection.md
View file @
f9a9492f
...
@@ -10,7 +10,10 @@
...
@@ -10,7 +10,10 @@
*
[
2.1 启动训练
](
#21-----
)
*
[
2.1 启动训练
](
#21-----
)
*
[
2.2 断点训练
](
#22-----
)
*
[
2.2 断点训练
](
#22-----
)
*
[
2.3 更换Backbone 训练
](
#23---backbone---
)
*
[
2.3 更换Backbone 训练
](
#23---backbone---
)
*
[
2.4 知识蒸馏训练
](
#24---distill---
)
*
[
2.4 混合精度训练
](
#24---amp---
)
*
[
2.5 分布式训练
](
#25---fleet---
)
*
[
2.6 知识蒸馏训练
](
#26---distill---
)
*
[
2.7 其他训练环境(Windows/macOS/Linux DCU)
](
#27---other---
)
-
[
3. 模型评估与预测
](
#3--------
)
-
[
3. 模型评估与预测
](
#3--------
)
*
[
3.1 指标评估
](
#31-----
)
*
[
3.1 指标评估
](
#31-----
)
*
[
3.2 测试检测效果
](
#32-------
)
*
[
3.2 测试检测效果
](
#32-------
)
...
@@ -103,9 +106,6 @@ python3 tools/train.py -c configs/det/det_mv3_db.yml \
...
@@ -103,9 +106,6 @@ python3 tools/train.py -c configs/det/det_mv3_db.yml \
python3
-m
paddle.distributed.launch
--gpus
'0,1,2,3'
tools/train.py
-c
configs/det/det_mv3_db.yml
\
python3
-m
paddle.distributed.launch
--gpus
'0,1,2,3'
tools/train.py
-c
configs/det/det_mv3_db.yml
\
-o
Global.pretrained_model
=
./pretrain_models/MobileNetV3_large_x0_5_pretrained
-o
Global.pretrained_model
=
./pretrain_models/MobileNetV3_large_x0_5_pretrained
# 多机多卡训练,通过 --ips 参数设置使用的机器IP地址,通过 --gpus 参数设置使用的GPU ID
python3
-m
paddle.distributed.launch
--ips
=
"xx.xx.xx.xx,xx.xx.xx.xx"
--gpus
'0,1,2,3'
tools/train.py
-c
configs/det/det_mv3_db.yml
\
-o
Global.pretrained_model
=
./pretrain_models/MobileNetV3_large_x0_5_pretrained
```
```
上述指令中,通过-c 选择训练使用configs/det/det_db_mv3.yml配置文件。
上述指令中,通过-c 选择训练使用configs/det/det_db_mv3.yml配置文件。
...
@@ -116,15 +116,6 @@ python3 -m paddle.distributed.launch --ips="xx.xx.xx.xx,xx.xx.xx.xx" --gpus '0,1
...
@@ -116,15 +116,6 @@ python3 -m paddle.distributed.launch --ips="xx.xx.xx.xx,xx.xx.xx.xx" --gpus '0,1
python3 tools/train.py
-c
configs/det/det_mv3_db.yml
-o
Optimizer.base_lr
=
0.0001
python3 tools/train.py
-c
configs/det/det_mv3_db.yml
-o
Optimizer.base_lr
=
0.0001
```
```
**注意:**
采用多机多卡训练时,需要替换上面命令中的ips值为您机器的地址,机器之间需要能够相互ping通。另外,训练时需要在多个机器上分别启动命令。查看机器ip地址的命令为
`ifconfig`
。
如果您想进一步加快训练速度,可以使用
[
自动混合精度训练
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/01_paddle2.0_introduction/basic_concept/amp_cn.html
)
, 以单机单卡为例,命令如下:
```
shell
python3 tools/train.py
-c
configs/det/det_mv3_db.yml
\
-o
Global.pretrained_model
=
./pretrain_models/MobileNetV3_large_x0_5_pretrained
\
Global.use_amp
=
True Global.scale_loss
=
1024.0 Global.use_dynamic_loss_scaling
=
True
```
<a
name=
"22-----"
></a>
<a
name=
"22-----"
></a>
## 2.2 断点训练
## 2.2 断点训练
...
@@ -183,15 +174,49 @@ args1: args1
...
@@ -183,15 +174,49 @@ args1: args1
**注意**
:如果要更换网络的其他模块,可以参考
[
文档
](
./add_new_algorithm.md
)
。
**注意**
:如果要更换网络的其他模块,可以参考
[
文档
](
./add_new_algorithm.md
)
。
<a
name=
"24---amp---"
></a>
## 2.4 混合精度训练
如果您想进一步加快训练速度,可以使用
[
自动混合精度训练
](
https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/01_paddle2.0_introduction/basic_concept/amp_cn.html
)
, 以单机单卡为例,命令如下:
```
shell
python3 tools/train.py
-c
configs/det/det_mv3_db.yml
\
-o
Global.pretrained_model
=
./pretrain_models/MobileNetV3_large_x0_5_pretrained
\
Global.use_amp
=
True Global.scale_loss
=
1024.0 Global.use_dynamic_loss_scaling
=
True
```
<a
name
=
"26---fleet---"
>
</a>
## 2.5 分布式训练
多机多卡训练时,通过
`
--ips
`
参数设置使用的机器IP地址,通过
`
--gpus
`
参数设置使用的GPU ID:
```
bash
python3 -m paddle.distributed.launch --ips="xx.xx.xx.xx,xx.xx.xx.xx" --gpus '0,1,2,3' tools/train.py -c configs/det/det_mv3_db.yml
\
-o Global.pretrained_model=./pretrain_models/MobileNetV3_large_x0_5_pretrained
```
<a name="24---distill---"></a>
**注意:** 采用多机多卡训练时,需要替换上面命令中的ips值为您机器的地址,机器之间需要能够相互ping通。另外,训练时需要在多个机器上分别启动命令。查看机器ip地址的命令为`ifconfig`。
<a name="26---distill---"></a>
## 2.
4
知识蒸馏训练
## 2.
6
知识蒸馏训练
PaddleOCR支持了基于知识蒸馏的检测模型训练过程,更多内容可以参考[知识蒸馏说明文档](./knowledge_distillation.md)。
PaddleOCR支持了基于知识蒸馏的检测模型训练过程,更多内容可以参考[知识蒸馏说明文档](./knowledge_distillation.md)。
**注意:** 知识蒸馏训练目前只支持PP-OCR使用的`DB`和`CRNN`算法。
<a name="27---other---"></a>
## 2.7 其他训练环境
- Windows GPU/CPU
- macOS
- Linux DCU
<a name="3--------"></a>
<a name="3--------"></a>
# 3. 模型评估与预测
# 3. 模型评估与预测
...
@@ -206,22 +231,22 @@ PaddleOCR计算三个OCR检测相关的指标,分别是:Precision、Recall
...
@@ -206,22 +231,22 @@ PaddleOCR计算三个OCR检测相关的指标,分别是:Precision、Recall
python3 tools/eval.py -c configs/det/det_mv3_db.yml -o Global.checkpoints="{path/to/weights}/best_accuracy"
python3 tools/eval.py -c configs/det/det_mv3_db.yml -o Global.checkpoints="{path/to/weights}/best_accuracy"
```
```
* 注:`box_thresh`、`unclip_ratio`是DB后处理所需要的参数,在评估EAST模型时不需要设置
<a name="32-------"></a>
<a name="32-------"></a>
## 3.2 测试检测效果
## 3.2 测试检测效果
测试单张图像的检测效果
测试单张图像的检测效果
:
```
shell
```
shell
python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o Global.infer_img="./doc/imgs_en/img_10.jpg" Global.pretrained_model="./output/det_db/best_accuracy"
python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o Global.infer_img="./doc/imgs_en/img_10.jpg" Global.pretrained_model="./output/det_db/best_accuracy"
```
```
测试DB模型时,调整后处理阈值
测试DB模型时,调整后处理阈值
:
```
shell
```
shell
python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o Global.infer_img="./doc/imgs_en/img_10.jpg" Global.pretrained_model="./output/det_db/best_accuracy" PostProcess.box_thresh=0.6 PostProcess.unclip_ratio=2.0
python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o Global.infer_img="./doc/imgs_en/img_10.jpg" Global.pretrained_model="./output/det_db/best_accuracy" PostProcess.box_thresh=0.6 PostProcess.unclip_ratio=2.0
```
```
* 注:`box_thresh`、`unclip_ratio`是DB后处理参数,其他检测模型不支持。
测试文件夹下所有图像的检测效果
测试文件夹下所有图像的检测效果
:
```
shell
```
shell
python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o Global.infer_img="./doc/imgs_en/" Global.pretrained_model="./output/det_db/best_accuracy"
python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o Global.infer_img="./doc/imgs_en/" Global.pretrained_model="./output/det_db/best_accuracy"
```
```
...
...
doc/features.png
View replaced file @
bf6703d9
View file @
f9a9492f
1.15 MB
|
W:
|
H:
1.15 MB
|
W:
|
H:
2-up
Swipe
Onion skin
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment