README.md 7.9 KB
Newer Older
T
tink2123 已提交
1

D
dyning 已提交
2
## 简介
T
tink2123 已提交
3 4
PaddleOCR旨在打造一套丰富、领先、且实用的OCR工具库,助力使用者训练出更好的模型,并应用落地。

D
dyning 已提交
5
## 特性
D
dyning 已提交
6 7 8
- 超轻量级中文OCR,总模型仅8.6M
    - 单模型支持中英文数字组合识别、竖排文本识别、长文本识别
    - 检测模型DB(4.1M)+识别模型CRNN(4.5M)
D
dyning 已提交
9 10 11 12
- 多种文本检测训练算法,EAST、DB
- 多种文本识别训练算法,Rosetta、CRNN、STAR-Net、RARE

## **超轻量级中文OCR体验**
T
tink2123 已提交
13

L
LDOUBLEV 已提交
14
![](doc/imgs_results/11.jpg)
L
LDOUBLEV 已提交
15

D
dyning 已提交
16
上图是超轻量级中文OCR模型效果展示,更多效果图请见文末[效果展示](#效果展示)
D
dyning 已提交
17

D
dyning 已提交
18
#### 1.环境配置
L
LDOUBLEV 已提交
19

D
dyning 已提交
20
请先参考[快速安装](./doc/installation.md)配置PaddleOCR运行环境。
T
tink2123 已提交
21

D
dyning 已提交
22
#### 2.模型下载
L
LDOUBLEV 已提交
23

T
tink2123 已提交
24
```
D
dyning 已提交
25
# 下载inference模型文件包
D
dyning 已提交
26
wget https://paddleocr.bj.bcebos.com/inference.tar
D
dyning 已提交
27
# inference模型文件包解压
D
dyning 已提交
28
tar -xf inference.tar
T
tink2123 已提交
29 30
```

D
dyning 已提交
31 32
#### 3.单张图像或者图像集合预测

D
dyning 已提交
33
以下代码实现了文本检测、识别串联推理,在执行预测时,需要通过参数image_dir指定单张图像或者图像集合的路径、参数det_model_dir指定检测inference模型的路径和参数rec_model_dir指定识别inference模型的路径。可视化识别结果默认保存到 ./inference_results 文件夹里面。
D
dyning 已提交
34

T
tink2123 已提交
35
```
D
dyning 已提交
36
# 设置PYTHONPATH环境变量
T
tink2123 已提交
37 38
export PYTHONPATH=.

D
dyning 已提交
39
# 预测image_dir指定的单张图像
D
dyning 已提交
40
python3 tools/infer/predict_system.py --image_dir="./doc/imgs/11.jpg" --det_model_dir="./inference/det/"  --rec_model_dir="./inference/rec/"
D
dyning 已提交
41 42

# 预测image_dir指定的图像集合
D
dyning 已提交
43
python3 tools/infer/predict_system.py --image_dir="./doc/imgs/" --det_model_dir="./inference/det/"  --rec_model_dir="./inference/rec/"
D
dyning 已提交
44 45 46

# 如果想使用CPU进行预测,执行命令如下
python3 tools/infer/predict_system.py --image_dir="./doc/imgs/11.jpg" --det_model_dir="./inference/det/"  --rec_model_dir="./inference/rec/" --use_gpu=False
T
tink2123 已提交
47
```
D
dyning 已提交
48
更多的文本检测、识别串联推理使用方式请参考文档教程中[基于预测引擎推理](./doc/inference.md)
T
tink2123 已提交
49

L
LDOUBLEV 已提交
50

D
dyning 已提交
51 52
## 文档教程
- [快速安装](./doc/installation.md)
D
dyning 已提交
53 54 55
- [文本检测模型训练/评估/预测](./doc/detection.md)(持续更新中)
- [文本识别模型训练/评估/预测](./doc/recognition.md)(持续更新中)
- [基于预测引擎推理](./doc/inference.md)(持续更新中)
D
dyning 已提交
56

D
dyning 已提交
57
## 文本检测算法
T
tink2123 已提交
58 59

PaddleOCR开源的文本检测算法列表:
T
tink2123 已提交
60
- [x]  EAST([paper](https://arxiv.org/abs/1704.03155))
T
fix url  
tink2123 已提交
61 62
- [x]  DB([paper](https://arxiv.org/abs/1911.08947))
- [ ]  SAST([paper](https://arxiv.org/abs/1908.05498))(百度自研, comming soon)
T
tink2123 已提交
63

D
dyning 已提交
64
在ICDAR2015文本检测公开数据集上,算法效果如下:
T
tink2123 已提交
65

L
LDOUBLEV 已提交
66
|模型|骨干网络|Hmean|precision|recall|下载链接|
T
tink2123 已提交
67
|-|-|-|-|
L
LDOUBLEV 已提交
68 69 70 71 72 73
|EAST|ResNet50_vd|86.82%|88.18%|85.51|[下载链接](https://paddleocr.bj.bcebos.com/det_r50_vd_east.tar)|
|EAST|MobileNetV3|80.74%|81.67%|79.83%|[下载链接](https://paddleocr.bj.bcebos.com/det_mv3_east.tar)|
|DB|ResNet50_vd|82.19%|83.79%|80.65%|[下载链接](https://paddleocr.bj.bcebos.com/det_r50_vd_db.tar)|
|DB|MobileNetV3|74.53%|75.92%|73.18%|[下载链接](https://paddleocr.bj.bcebos.com/det_mv3_db.tar)|

* 注: 上述模型的训练和评估,设置后处理参数box_thresh=0.6,unclip_ratio=1.5,使用不同数据集、不同模型训练时,可调整这两个参数进行优化
T
tink2123 已提交
74

D
dyning 已提交
75
PaddleOCR文本检测算法的训练和使用请参考文档教程中[文本检测模型训练/评估/预测](./doc/detection.md)
T
tink2123 已提交
76

D
dyning 已提交
77
## 文本识别算法
T
tink2123 已提交
78 79

PaddleOCR开源的文本识别算法列表:
T
tink2123 已提交
80 81 82 83 84
- [x]  CRNN([paper](https://arxiv.org/abs/1507.05717))
- [x]  Rosetta([paper](https://arxiv.org/abs/1910.05085))
- [x]  STAR-Net([paper](http://www.bmva.org/bmvc/2016/papers/paper043/index.html))
- [x]  RARE([paper](https://arxiv.org/abs/1603.03915v1))
- [ ]  SRN([paper](https://arxiv.org/abs/2003.12294))(百度自研, comming soon)
T
tink2123 已提交
85

D
dyning 已提交
86
参考[DTRB](https://arxiv.org/abs/1904.01906)文字识别训练和评估流程,使用MJSynth和SynthText两个文字识别数据集训练,在IIIT, SVT, IC03, IC13, IC15, SVTP, CUTE数据集上进行评估,算法效果如下:
T
tink2123 已提交
87

D
dyning 已提交
88
|模型|骨干网络|Avg Accuracy|模型存储命名|下载链接|
D
dyning 已提交
89
|-|-|-|-|-|
D
dyning 已提交
90 91 92 93 94 95 96 97
|Rosetta|Resnet34_vd|80.24%|rec_r34_vd_none_none_ctc|[下载链接](https://paddleocr.bj.bcebos.com/rec_r34_vd_none_none_ctc.tar)|
|Rosetta|MobileNetV3|78.16%|rec_mv3_none_none_ctc|[下载链接](https://paddleocr.bj.bcebos.com/rec_mv3_none_none_ctc.tar)|
|CRNN|Resnet34_vd|82.20%|rec_r34_vd_none_bilstm_ctc|[下载链接](https://paddleocr.bj.bcebos.com/rec_r34_vd_none_bilstm_ctc.tar)|
|CRNN|MobileNetV3|79.37%|rec_mv3_none_bilstm_ctc|[下载链接](https://paddleocr.bj.bcebos.com/rec_mv3_none_bilstm_ctc.tar)|
|STAR-Net|Resnet34_vd|83.93%|rec_r34_vd_tps_bilstm_ctc|[下载链接](https://paddleocr.bj.bcebos.com/rec_r34_vd_tps_bilstm_ctc.tar)|
|STAR-Net|MobileNetV3|81.56%|rec_mv3_tps_bilstm_ctc|[下载链接](https://paddleocr.bj.bcebos.com/rec_mv3_tps_bilstm_ctc.tar)|
|RARE|Resnet34_vd|84.90%|rec_r34_vd_tps_bilstm_attn|[下载链接](https://paddleocr.bj.bcebos.com/rec_r34_vd_tps_bilstm_attn.tar)|
|RARE|MobileNetV3|83.32%|rec_mv3_tps_bilstm_attn|[下载链接](https://paddleocr.bj.bcebos.com/rec_mv3_tps_bilstm_attn.tar)|
T
tink2123 已提交
98

D
dyning 已提交
99
PaddleOCR文本识别算法的训练和使用请参考文档教程中[文本识别模型训练/评估/预测](./doc/recognition.md)
T
tink2123 已提交
100

D
dyning 已提交
101 102
## 端到端OCR算法
- [ ]  [End2End-PSL](https://arxiv.org/abs/1909.07808)(百度自研, comming soon)
T
tink2123 已提交
103

D
dyning 已提交
104
<a name="效果展示"></a>
L
LDOUBLEV 已提交
105
## 效果展示
L
LDOUBLEV 已提交
106 107 108 109 110 111 112 113
![](doc/imgs_results/1.jpg)
![](doc/imgs_results/7.jpg)
![](doc/imgs_results/12.jpg)
![](doc/imgs_results/4.jpg)
![](doc/imgs_results/6.jpg)
![](doc/imgs_results/9.jpg)
![](doc/imgs_results/16.png)
![](doc/imgs_results/22.jpg)
T
tink2123 已提交
114 115


D
dyning 已提交
116
## 参考文献
T
tink2123 已提交
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
```
1. EAST:
@inproceedings{zhou2017east,
  title={EAST: an efficient and accurate scene text detector},
  author={Zhou, Xinyu and Yao, Cong and Wen, He and Wang, Yuzhi and Zhou, Shuchang and He, Weiran and Liang, Jiajun},
  booktitle={Proceedings of the IEEE conference on Computer Vision and Pattern Recognition},
  pages={5551--5560},
  year={2017}
}

2. DB:
@article{liao2019real,
  title={Real-time Scene Text Detection with Differentiable Binarization},
  author={Liao, Minghui and Wan, Zhaoyi and Yao, Cong and Chen, Kai and Bai, Xiang},
  journal={arXiv preprint arXiv:1911.08947},
  year={2019}
}

3. DTRB:
@inproceedings{baek2019wrong,
  title={What is wrong with scene text recognition model comparisons? dataset and model analysis},
  author={Baek, Jeonghun and Kim, Geewook and Lee, Junyeop and Park, Sungrae and Han, Dongyoon and Yun, Sangdoo and Oh, Seong Joon and Lee, Hwalsuk},
  booktitle={Proceedings of the IEEE International Conference on Computer Vision},
  pages={4715--4723},
  year={2019}
}

4. SAST:
@inproceedings{wang2019single,
  title={A Single-Shot Arbitrarily-Shaped Text Detector based on Context Attended Multi-Task Learning},
  author={Wang, Pengfei and Zhang, Chengquan and Qi, Fei and Huang, Zuming and En, Mengyi and Han, Junyu and Liu, Jingtuo and Ding, Errui and Shi, Guangming},
  booktitle={Proceedings of the 27th ACM International Conference on Multimedia},
  pages={1277--1285},
  year={2019}
}

5. SRN:
@article{yu2020towards,
  title={Towards Accurate Scene Text Recognition with Semantic Reasoning Networks},
  author={Yu, Deli and Li, Xuan and Zhang, Chengquan and Han, Junyu and Liu, Jingtuo and Ding, Errui},
  journal={arXiv preprint arXiv:2003.12294},
  year={2020}
}

6. end2end-psl:
@inproceedings{sun2019chinese,
  title={Chinese Street View Text: Large-scale Chinese Text Reading with Partially Supervised Learning},
  author={Sun, Yipeng and Liu, Jiaming and Liu, Wei and Han, Junyu and Ding, Errui and Liu, Jingtuo},
  booktitle={Proceedings of the IEEE International Conference on Computer Vision},
  pages={9086--9095},
  year={2019}
}
```
D
dyning 已提交
170 171 172 173 174 175 176 177

## 许可证书
本项目的发布受<a href="https://github.com/PaddlePaddle/PaddleOCR/blob/master/LICENSE">Apache 2.0 license</a>许可认证。

## 版本更新

## 如何贡献代码
我们非常欢迎你为PaddleOCR贡献代码,也十分感谢你的反馈。