algorithm_det_db.md 3.1 KB
Newer Older
MissPenguin's avatar
MissPenguin committed
1
2
3
4
# DB

- [1. 算法简介](#1)
- [2. 环境配置](#2)
MissPenguin's avatar
MissPenguin committed
5
6
7
8
9
10
11
12
13
14
- [3. 模型训练、评估、预测](#3)
    - [3.1 训练](#3-1)
    - [3.2 评估](#3-2)
    - [3.3 预测](#3-3)
- [4. 推理部署](#4)
    - [4.1 Python推理](#4-1)
    - [4.2 C++推理](#4-2)
    - [4.3 Serving服务化部署](#4-3)
    - [4.4 更多推理部署](#4-4)
- [5. FAQ](#5)
MissPenguin's avatar
MissPenguin committed
15
16
17
18
19
20
21
22
23
24
25

<a name="1"></a>
## 1. 算法简介

论文信息:
> [Real-time Scene Text Detection with Differentiable Binarization](https://arxiv.org/abs/1911.08947)
> Liao, Minghui and Wan, Zhaoyi and Yao, Cong and Chen, Kai and Bai, Xiang
> AAAI, 2020

在ICDAR2015文本检测公开数据集上,算法复现效果如下:

MissPenguin's avatar
update  
MissPenguin committed
26
27
28
29
|模型|骨干网络|配置文件|precision|recall|Hmean|下载链接|
| --- | --- | --- | --- | --- | --- | --- |
|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|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)|
MissPenguin's avatar
MissPenguin committed
30
31
32
33


<a name="2"></a>
## 2. 环境配置
MissPenguin's avatar
update  
MissPenguin committed
34
请先参考[《运行环境准备》](./environment.md)配置PaddleOCR运行环境,参考[《项目克隆》](./clone.md)克隆项目代码。
MissPenguin's avatar
MissPenguin committed
35
36
37


<a name="3"></a>
MissPenguin's avatar
MissPenguin committed
38
## 3. 模型训练、评估、预测
MissPenguin's avatar
MissPenguin committed
39

MissPenguin's avatar
update  
MissPenguin committed
40
请参考[文本检测训练教程](./detection.md)。PaddleOCR对代码进行了模块化,训练不同的检测模型只需要**更换配置文件**即可。
MissPenguin's avatar
MissPenguin committed
41
42
43


<a name="4"></a>
MissPenguin's avatar
MissPenguin committed
44
## 4. 推理部署
MissPenguin's avatar
MissPenguin committed
45

MissPenguin's avatar
MissPenguin committed
46
47
<a name="4-1"></a>
### 4.1 Python推理
MissPenguin's avatar
MissPenguin committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
首先将DB文本检测训练过程中保存的模型,转换成inference model。以基于Resnet50_vd骨干网络,在ICDAR2015英文数据集训练的模型为例( [模型下载地址](https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_r50_vd_db_v2.0_train.tar) ),可以使用如下命令进行转换:

```
python3 tools/export_model.py -c configs/det/det_r50_vd_db.yml -o Global.pretrained_model=./det_r50_vd_db_v2.0_train/best_accuracy  Global.save_inference_dir=./inference/det_db
```

DB文本检测模型推理,可以执行如下命令:

```
python3 tools/infer/predict_det.py --image_dir="./doc/imgs_en/img_10.jpg" --det_model_dir="./inference/det_db/"
```

可视化文本检测结果默认保存到`./inference_results`文件夹里面,结果文件的名称前缀为'det_res'。结果示例如下:

![](../imgs_results/det_res_img_10_db.jpg)

**注意**:由于ICDAR2015数据集只有1000张训练图像,且主要针对英文场景,所以上述模型对中文文本图像检测效果会比较差。

MissPenguin's avatar
MissPenguin committed
66
67
<a name="4-2"></a>
### 4.2 C++推理
MissPenguin's avatar
MissPenguin committed
68
69
敬请期待

MissPenguin's avatar
MissPenguin committed
70
71
<a name="4-3"></a>
### 4.3 Serving服务化部署
MissPenguin's avatar
MissPenguin committed
72
73
敬请期待

MissPenguin's avatar
MissPenguin committed
74
75
<a name="4-4"></a>
### 4.4 更多推理部署
MissPenguin's avatar
MissPenguin committed
76
77
敬请期待

MissPenguin's avatar
MissPenguin committed
78
79
<a name="5"></a>
## 5. FAQ
MissPenguin's avatar
MissPenguin committed
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94


## 引用

```bibtex
@inproceedings{liao2020real,
  title={Real-time scene text detection with differentiable binarization},
  author={Liao, Minghui and Wan, Zhaoyi and Yao, Cong and Chen, Kai and Bai, Xiang},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  volume={34},
  number={07},
  pages={11474--11481},
  year={2020}
}
```