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
7b53596c
Commit
7b53596c
authored
Dec 14, 2020
by
WenmuZhou
Browse files
Merge branch 'dygraph' of
https://github.com/PaddlePaddle/PaddleOCR
into dygraph_rc
parents
0458f0cc
0e32093f
Changes
157
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
155 additions
and
748 deletions
+155
-748
README_ch.md
README_ch.md
+18
-10
README_en.md
README_en.md
+99
-144
configs/cls/cls_mv3.yml
configs/cls/cls_mv3.yml
+0
-1
configs/det/bak/det_r50_vd_db.yml
configs/det/bak/det_r50_vd_db.yml
+0
-130
configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml
configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml
+1
-1
configs/det/ch_ppocr_v2.0/ch_det_res18_db_v2.0.yml
configs/det/ch_ppocr_v2.0/ch_det_res18_db_v2.0.yml
+1
-1
configs/det/det_mv3_db.yml
configs/det/det_mv3_db.yml
+1
-1
configs/det/det_r50_vd_db.yml
configs/det/det_r50_vd_db.yml
+1
-1
configs/rec/bak/rec_mv3_none_bilstm_ctc_simple.yml
configs/rec/bak/rec_mv3_none_bilstm_ctc_simple.yml
+0
-106
configs/rec/bak/rec_r34_vd_none_bilstm_ctc.yml
configs/rec/bak/rec_r34_vd_none_bilstm_ctc.yml
+0
-104
configs/rec/ch_ppocr_v2.0/rec_chinese_common_train_v2.0.yml
configs/rec/ch_ppocr_v2.0/rec_chinese_common_train_v2.0.yml
+0
-0
configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.yml
configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.yml
+0
-0
configs/rec/rec_icdar15_train.yml
configs/rec/rec_icdar15_train.yml
+34
-40
deploy/android_demo/.gitignore
deploy/android_demo/.gitignore
+0
-9
deploy/android_demo/README.md
deploy/android_demo/README.md
+0
-19
deploy/android_demo/app/.gitignore
deploy/android_demo/app/.gitignore
+0
-1
deploy/android_demo/app/build.gradle
deploy/android_demo/app/build.gradle
+0
-94
deploy/android_demo/app/proguard-rules.pro
deploy/android_demo/app/proguard-rules.pro
+0
-21
deploy/android_demo/app/src/androidTest/java/com/baidu/paddle/lite/demo/ocr/ExampleInstrumentedTest.java
...m/baidu/paddle/lite/demo/ocr/ExampleInstrumentedTest.java
+0
-26
deploy/android_demo/app/src/main/AndroidManifest.xml
deploy/android_demo/app/src/main/AndroidManifest.xml
+0
-39
No files found.
README_ch.md
View file @
7b53596c
...
...
@@ -4,16 +4,18 @@
PaddleOCR旨在打造一套丰富、领先、且实用的OCR工具库,助力使用者训练出更好的模型,并应用落地。
**近期更新**
-
2020.12.07
[
FAQ
](
./doc/doc_ch/FAQ.md
)
新增5个高频问题,总数124个,并且计划以后每周一都会更新,欢迎大家持续关注。
-
2020.11.25 更新半自动标注工具
[
PPOCRLabel
](
./PPOCRLabel/README.md
)
,辅助开发者高效完成标注任务,输出格式与PP-OCR训练任务完美衔接。
-
2020.9.22 更新PP-OCR技术文章,https://arxiv.org/abs/2009.09941
-
2020.9.19 更新超轻量压缩ppocr_mobile_slim系列模型,整体模型3.5M(详见
[
PP-OCR Pipline
](
#PP-OCR
)
),适合在移动端部署使用。
[
模型下载
](
#模型下载
)
-
2020.9.19 更新超轻量压缩ppocr_mobile_slim系列模型,整体模型3.5M(详见
[
PP-OCR Pip
e
line
](
#PP-OCR
)
),适合在移动端部署使用。
[
模型下载
](
#模型下载
)
-
2020.9.17 更新超轻量ppocr_mobile系列和通用ppocr_server系列中英文ocr模型,媲美商业效果。
[
模型下载
](
#模型下载
)
-
2020.9.17 更新
[
英文识别模型
](
./doc/doc_ch/models_list.md#英文识别模型
)
和
[
多语言识别模型
](
doc/doc_ch/models_list.md#多语言识别模型
)
,已支持
`德语、法语、日语、韩语`
,更多语种识别模型将持续更新。
-
2020.8.26 更新OCR相关的84个常见问题及解答,具体参考
[
FAQ
](
./doc/doc_ch/FAQ.md
)
-
2020.8.24 支持通过whl包安装使用PaddleOCR,具体参考
[
Paddleocr Package使用说明
](
./doc/doc_ch/whl.md
)
-
2020.8.21 更新8月18日B站直播课回放和PPT,课节2,易学易用的OCR工具大礼包,
[
获取地址
](
https://aistudio.baidu.com/aistudio/education/group/info/1519
)
-
[
More
](
./doc/doc_ch/update.md
)
## 特性
-
PPOCR系列高质量预训练模型,准确的识别效果
...
...
@@ -48,15 +50,14 @@ PaddleOCR旨在打造一套丰富、领先、且实用的OCR工具库,助力
-
代码体验:从
[
快速安装
](
./doc/doc_ch/installation.md
)
开始
<a
name=
"模型下载"
></a>
## PP-OCR
1.1
系列模型列表(
9月17日
更新)
## PP-OCR
2.0
系列模型列表(更新
中
)
| 模型简介 | 模型名称 |推荐场景 | 检测模型 | 方向分类器 | 识别模型 |
| ------------ | --------------- | ----------------|---- | ---------- | -------- |
| 中英文超轻量OCR模型(8.1M) | ch_ppocr_mobile_v1.1_xx |移动端&服务器端|
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile/det/ch_ppocr_mobile_v1.1_det_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile/det/ch_ppocr_mobile_v1.1_det_train.tar
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/cls/ch_ppocr_mobile_v1.1_cls_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/20-09-22/cls/ch_ppocr_mobile_v1.1_cls_train.tar
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile/rec/ch_ppocr_mobile_v1.1_rec_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile/rec/ch_ppocr_mobile_v1.1_rec_pre.tar
)
|
| 中英文通用OCR模型(155.1M) |ch_ppocr_server_v1.1_xx|服务器端 |
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/server/det/ch_ppocr_server_v1.1_det_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/20-09-22/server/det/ch_ppocr_server_v1.1_det_train.tar
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/cls/ch_ppocr_mobile_v1.1_cls_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/20-09-22/cls/ch_ppocr_mobile_v1.1_cls_train.tar
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/server/rec/ch_ppocr_server_v1.1_rec_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/20-09-22/server/rec/ch_ppocr_server_v1.1_rec_pre.tar
)
|
| 中英文超轻量压缩OCR模型(3.5M) | ch_ppocr_mobile_slim_v1.1_xx| 移动端 |
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile-slim/det/ch_ppocr_mobile_v1.1_det_prune_infer.tar
)
/
[
slim模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile/lite/ch_ppocr_mobile_v1.1_det_prune_opt.nb
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/cls/ch_ppocr_mobile_v1.1_cls_quant_infer.tar
)
/
[
slim模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile/lite/ch_ppocr_mobile_v1.1_cls_quant_opt.nb
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile-slim/rec/ch_ppocr_mobile_v1.1_rec_quant_infer.tar
)
/
[
slim模型
](
https://paddleocr.bj.bcebos.com/20-09-22/mobile/lite/ch_ppocr_mobile_v1.1_rec_quant_opt.nb
)
|
| 中英文超轻量OCR模型(8.1M) | ch_ppocr_mobile_v2.0_xx |移动端&服务器端|
[
推理模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_train.tar
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_pre.tar
)
|
| 中英文通用OCR模型(143M) |ch_ppocr_server_v2.0_xx|服务器端 |
[
推理模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_train.tar
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_train.tar
)
|
[
推理模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_infer.tar
)
/
[
预训练模型
](
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_pre.tar
)
|
更多模型下载(包括多语言),可以参考
[
PP-OCR v
1.1
系列模型下载
](
./doc/doc_ch/models_list.md
)
更多模型下载(包括多语言),可以参考
[
PP-OCR v
2.0
系列模型下载
](
./doc/doc_ch/models_list.md
)
## 文档教程
-
[
快速安装
](
./doc/doc_ch/installation.md
)
...
...
@@ -76,9 +77,9 @@ PaddleOCR旨在打造一套丰富、领先、且实用的OCR工具库,助力
-
[
基于Python脚本预测引擎推理
](
./doc/doc_ch/inference.md
)
-
[
基于C++预测引擎推理
](
./deploy/cpp_infer/readme.md
)
-
[
服务化部署
](
./deploy/hubserving/readme.md
)
-
[
端侧部署
](
.
/deploy/lite/readme.md
)
-
[
模型量化
](
.
/deploy/slim/quantization/README.md
)
-
[
模型裁剪
](
.
/deploy/slim/prune/README.md
)
-
[
端侧部署
](
https://github.com/PaddlePaddle/PaddleOCR/blob/develop
/deploy/lite/readme.md
)
-
[
模型量化
](
https://github.com/PaddlePaddle/PaddleOCR/blob/develop
/deploy/slim/quantization/README.md
)
-
[
模型裁剪
](
https://github.com/PaddlePaddle/PaddleOCR/blob/develop
/deploy/slim/prune/README.md
)
-
[
Benchmark
](
./doc/doc_ch/benchmark.md
)
-
数据集
-
[
通用中英文OCR数据集
](
./doc/doc_ch/datasets.md
)
...
...
@@ -96,6 +97,9 @@ PaddleOCR旨在打造一套丰富、领先、且实用的OCR工具库,助力
-
[
许可证书
](
#许可证书
)
-
[
贡献代码
](
#贡献代码
)
**
*
注意:动态图端侧部署仍在开发中,目前仅支持动态图训练、python端预测,C++预测,
如果您有需要移动端部署案例或者量化裁剪,请切换到静态图分支;
**
*
<a
name=
"PP-OCR"
></a>
## PP-OCR Pipline
<div
align=
"center"
>
...
...
@@ -141,6 +145,7 @@ PP-OCR是一个实用的超轻量OCR系统。主要由DB文本检测、检测框
## 贡献代码
我们非常欢迎你为PaddleOCR贡献代码,也十分感谢你的反馈。
-
非常感谢
[
Khanh Tran
](
https://github.com/xxxpsyduck
)
和
[
Karl Horky
](
https://github.com/karlhorky
)
贡献修改英文文档
-
非常感谢
[
zhangxin
](
https://github.com/ZhangXinNan
)(
[Blog](https://blog.csdn.net/sdlypyzq
)
) 贡献新的可视化方式、添加.gitgnore、处理手动设置PYTHONPATH环境变量的问题
-
非常感谢
[
lyl120117
](
https://github.com/lyl120117
)
贡献打印网络结构的代码
...
...
@@ -148,3 +153,6 @@ PP-OCR是一个实用的超轻量OCR系统。主要由DB文本检测、检测框
-
非常感谢
[
authorfu
](
https://github.com/authorfu
)
贡献Android和
[
xiadeye
](
https://github.com/xiadeye
)
贡献IOS的demo代码
-
非常感谢
[
BeyondYourself
](
https://github.com/BeyondYourself
)
给PaddleOCR提了很多非常棒的建议,并简化了PaddleOCR的部分代码风格。
-
非常感谢
[
tangmq
](
https://gitee.com/tangmq
)
给PaddleOCR增加Docker化部署服务,支持快速发布可调用的Restful API服务。
-
非常感谢
[
lijinhan
](
https://github.com/lijinhan
)
给PaddleOCR增加java SpringBoot 调用OCR Hubserving接口完成对OCR服务化部署的使用。
-
非常感谢
[
Mejans
](
https://github.com/Mejans
)
给PaddleOCR增加新语言奥克西坦语Occitan的字典和语料。
-
非常感谢
[
Evezerest
](
https://github.com/Evezerest
)
,
[
ninetailskim
](
https://github.com/ninetailskim
)
,
[
edencfc
](
https://github.com/edencfc
)
,
[
BeyondYourself
](
https://github.com/BeyondYourself
)
,
[
1084667371
](
https://github.com/1084667371
)
贡献了PPOCRLabel的完整代码。
README_en.md
View file @
7b53596c
This diff is collapsed.
Click to expand it.
configs/cls/cls_mv3.yml
View file @
7b53596c
...
...
@@ -8,7 +8,6 @@ Global:
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
[
0
,
1000
]
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights
:
True
cal_metric_during_train
:
True
pretrained_model
:
checkpoints
:
...
...
configs/det/bak/det_r50_vd_db.yml
deleted
100644 → 0
View file @
0458f0cc
Global
:
use_gpu
:
true
epoch_num
:
1200
log_smooth_window
:
20
print_batch_step
:
2
save_model_dir
:
./output/det_r50_vd/
save_epoch_step
:
1200
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
8
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights
:
True
cal_metric_during_train
:
False
pretrained_model
:
./pretrain_models/ResNet50_vd_ssld_pretrained/
checkpoints
:
save_inference_dir
:
use_visualdl
:
True
infer_img
:
doc/imgs_en/img_10.jpg
save_res_path
:
./output/det_db/predicts_db.txt
Optimizer
:
name
:
Adam
beta1
:
0.9
beta2
:
0.999
learning_rate
:
lr
:
0.001
regularizer
:
name
:
'
L2'
factor
:
0
Architecture
:
type
:
det
algorithm
:
DB
Transform
:
Backbone
:
name
:
ResNet
layers
:
50
Neck
:
name
:
FPN
out_channels
:
256
Head
:
name
:
DBHead
k
:
50
Loss
:
name
:
DBLoss
balance_loss
:
true
main_loss_type
:
DiceLoss
alpha
:
5
beta
:
10
ohem_ratio
:
3
PostProcess
:
name
:
DBPostProcess
thresh
:
0.3
box_thresh
:
0.6
max_candidates
:
1000
unclip_ratio
:
1.5
Metric
:
name
:
DetMetric
main_indicator
:
hmean
TRAIN
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./detection/
file_list
:
-
./detection/train_icdar2015_label.txt
# dataset1
ratio_list
:
[
1.0
]
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
DetLabelEncode
:
# Class handling label
-
IaaAugment
:
augmenter_args
:
-
{
'
type'
:
Fliplr
,
'
args'
:
{
'
p'
:
0.5
}
}
-
{
'
type'
:
Affine
,
'
args'
:
{
'
rotate'
:
[
-10
,
10
]
}
}
-
{
'
type'
:
Resize
,
'
args'
:
{
'
size'
:
[
0.5
,
3
]
}
}
-
EastRandomCropData
:
size
:
[
640
,
640
]
max_tries
:
50
keep_ratio
:
true
-
MakeBorderMap
:
shrink_ratio
:
0.4
thresh_min
:
0.3
thresh_max
:
0.7
-
MakeShrinkMap
:
shrink_ratio
:
0.4
min_text_size
:
8
-
NormalizeImage
:
scale
:
1./255.
mean
:
[
0.485
,
0.456
,
0.406
]
std
:
[
0.229
,
0.224
,
0.225
]
order
:
'
hwc'
-
ToCHWImage
:
-
keepKeys
:
keep_keys
:
[
'
image'
,
'
threshold_map'
,
'
threshold_mask'
,
'
shrink_map'
,
'
shrink_mask'
]
# dataloader will return list in this order
loader
:
shuffle
:
True
drop_last
:
False
batch_size
:
16
num_workers
:
8
EVAL
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./detection/
file_list
:
-
./detection/test_icdar2015_label.txt
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
DetLabelEncode
:
# Class handling label
-
DetResizeForTest
:
image_shape
:
[
736
,
1280
]
-
NormalizeImage
:
scale
:
1./255.
mean
:
[
0.485
,
0.456
,
0.406
]
std
:
[
0.229
,
0.224
,
0.225
]
order
:
'
hwc'
-
ToCHWImage
:
-
keepKeys
:
keep_keys
:
[
'
image'
,
'
shape'
,
'
polys'
,
'
ignore_tags'
]
loader
:
shuffle
:
False
drop_last
:
False
batch_size
:
1
# must be 1
num_workers
:
8
\ No newline at end of file
configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml
View file @
7b53596c
...
...
@@ -11,7 +11,7 @@ Global:
load_static_weights
:
True
cal_metric_during_train
:
False
pretrained_model
:
./pretrain_models/MobileNetV3_large_x0_5_pretrained
checkpoints
:
#./output/det_db_0.001_DiceLoss_256_pp_config_2.0b_4gpu/best_accuracy
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
doc/imgs_en/img_10.jpg
...
...
configs/det/ch_ppocr_v2.0/ch_det_res18_db_v2.0.yml
View file @
7b53596c
...
...
@@ -11,7 +11,7 @@ Global:
load_static_weights
:
True
cal_metric_during_train
:
False
pretrained_model
:
./pretrain_models/ResNet18_vd_pretrained
checkpoints
:
#./output/det_db_0.001_DiceLoss_256_pp_config_2.0b_4gpu/best_accuracy
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
doc/imgs_en/img_10.jpg
...
...
configs/det/det_mv3_db.yml
View file @
7b53596c
...
...
@@ -11,7 +11,7 @@ Global:
load_static_weights
:
True
cal_metric_during_train
:
False
pretrained_model
:
./pretrain_models/MobileNetV3_large_x0_5_pretrained
checkpoints
:
#./output/det_db_0.001_DiceLoss_256_pp_config_2.0b_4gpu/best_accuracy
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
doc/imgs_en/img_10.jpg
...
...
configs/det/det_r50_vd_db.yml
View file @
7b53596c
...
...
@@ -3,7 +3,7 @@ Global:
epoch_num
:
1200
log_smooth_window
:
20
print_batch_step
:
10
save_model_dir
:
./output/det_
rc/det_
r50_vd/
save_model_dir
:
./output/det_r50_vd/
save_epoch_step
:
1200
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
[
5000
,
4000
]
...
...
configs/rec/bak/rec_mv3_none_bilstm_ctc_simple.yml
deleted
100644 → 0
View file @
0458f0cc
Global
:
use_gpu
:
false
epoch_num
:
500
log_smooth_window
:
20
print_batch_step
:
10
save_model_dir
:
./output/rec/mv3_none_bilstm_ctc/
save_epoch_step
:
500
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
127
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights
:
True
cal_metric_during_train
:
True
pretrained_model
:
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
doc/imgs_words/ch/word_1.jpg
# for data or label process
max_text_length
:
80
character_dict_path
:
ppocr/utils/ppocr_keys_v1.txt
character_type
:
'
ch'
use_space_char
:
False
infer_mode
:
False
use_tps
:
False
Optimizer
:
name
:
Adam
beta1
:
0.9
beta2
:
0.999
learning_rate
:
lr
:
0.001
regularizer
:
name
:
'
L2'
factor
:
0.00001
Architecture
:
type
:
rec
algorithm
:
CRNN
Transform
:
Backbone
:
name
:
MobileNetV3
scale
:
0.5
model_name
:
small
small_stride
:
[
1
,
2
,
2
,
2
]
Neck
:
name
:
SequenceEncoder
encoder_type
:
fc
hidden_size
:
96
Head
:
name
:
CTC
fc_decay
:
0.00001
Loss
:
name
:
CTCLoss
PostProcess
:
name
:
CTCLabelDecode
Metric
:
name
:
RecMetric
main_indicator
:
acc
TRAIN
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./rec
file_list
:
-
./rec/train.txt
# dataset1
ratio_list
:
[
0.4
,
0.6
]
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
CTCLabelEncode
:
# Class handling label
-
RecAug
:
-
RecResizeImg
:
image_shape
:
[
3
,
32
,
320
]
-
keepKeys
:
keep_keys
:
[
'
image'
,
'
label'
,
'
length'
]
# dataloader will return list in this order
loader
:
batch_size
:
256
shuffle
:
True
drop_last
:
True
num_workers
:
8
EVAL
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./rec
file_list
:
-
./rec/val.txt
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
CTCLabelEncode
:
# Class handling label
-
RecResizeImg
:
image_shape
:
[
3
,
32
,
320
]
-
keepKeys
:
keep_keys
:
[
'
image'
,
'
label'
,
'
length'
]
# dataloader will return list in this order
loader
:
shuffle
:
False
drop_last
:
False
batch_size
:
256
num_workers
:
8
configs/rec/bak/rec_r34_vd_none_bilstm_ctc.yml
deleted
100644 → 0
View file @
0458f0cc
Global
:
use_gpu
:
false
epoch_num
:
500
log_smooth_window
:
20
print_batch_step
:
10
save_model_dir
:
./output/rec/res34_none_bilstm_ctc/
save_epoch_step
:
500
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
127
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights
:
True
cal_metric_during_train
:
True
pretrained_model
:
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
doc/imgs_words/ch/word_1.jpg
# for data or label process
max_text_length
:
80
character_dict_path
:
ppocr/utils/ppocr_keys_v1.txt
character_type
:
'
ch'
use_space_char
:
False
infer_mode
:
False
use_tps
:
False
Optimizer
:
name
:
Adam
beta1
:
0.9
beta2
:
0.999
learning_rate
:
lr
:
0.001
regularizer
:
name
:
'
L2'
factor
:
0.00001
Architecture
:
type
:
rec
algorithm
:
CRNN
Transform
:
Backbone
:
name
:
ResNet
layers
:
34
Neck
:
name
:
SequenceEncoder
encoder_type
:
fc
hidden_size
:
96
Head
:
name
:
CTC
fc_decay
:
0.00001
Loss
:
name
:
CTCLoss
PostProcess
:
name
:
CTCLabelDecode
Metric
:
name
:
RecMetric
main_indicator
:
acc
TRAIN
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./rec
file_list
:
-
./rec/train.txt
# dataset1
ratio_list
:
[
0.4
,
0.6
]
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
CTCLabelEncode
:
# Class handling label
-
RecAug
:
-
RecResizeImg
:
image_shape
:
[
3
,
32
,
320
]
-
keepKeys
:
keep_keys
:
[
'
image'
,
'
label'
,
'
length'
]
# dataloader will return list in this order
loader
:
batch_size
:
256
shuffle
:
True
drop_last
:
True
num_workers
:
8
EVAL
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./rec
file_list
:
-
./rec/val.txt
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
CTCLabelEncode
:
# Class handling label
-
RecResizeImg
:
image_shape
:
[
3
,
32
,
320
]
-
keepKeys
:
keep_keys
:
[
'
image'
,
'
label'
,
'
length'
]
# dataloader will return list in this order
loader
:
shuffle
:
False
drop_last
:
False
batch_size
:
256
num_workers
:
8
configs/rec/ch_ppocr_v2.0/rec_chinese_common_train_v2.0.y
a
ml
→
configs/rec/ch_ppocr_v2.0/rec_chinese_common_train_v2.0.yml
View file @
7b53596c
File moved
configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.y
a
ml
→
configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.yml
View file @
7b53596c
File moved
configs/rec/
bak/rec_r34_vd_none_none_ctc
.yml
→
configs/rec/
rec_icdar15_train
.yml
View file @
7b53596c
Global
:
use_gpu
:
fals
e
epoch_num
:
500
use_gpu
:
tru
e
epoch_num
:
72
log_smooth_window
:
20
print_batch_step
:
10
save_model_dir
:
./output/rec/
res34_none_none_ctc
/
save_epoch_step
:
500
# evaluation is run every
5
000 iterations
after the 4000th iteration
eval_batch_step
:
127
save_model_dir
:
./output/rec/
ic15
/
save_epoch_step
:
3
# evaluation is run every
2
000 iterations
eval_batch_step
:
[
0
,
2000
]
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights
:
True
cal_metric_during_train
:
True
pretrained_model
:
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
doc/imgs_words
/ch
/word_1
.jp
g
infer_img
:
doc/imgs_words
_en
/word_1
0.pn
g
# for data or label process
max_text_length
:
80
character_dict_path
:
ppocr/utils/ppocr_keys_v1.txt
character_type
:
'
ch'
use_space_char
:
False
character_dict_path
:
ppocr/utils/ic15_dict.txt
character_type
:
ch
max_text_length
:
25
infer_mode
:
False
use_tps
:
False
use_space_char
:
False
Optimizer
:
name
:
Adam
beta1
:
0.9
beta2
:
0.999
l
earning_rate
:
l
r
:
0.00
1
l
r
:
l
earning_rate
:
0.00
05
regularizer
:
name
:
'
L2'
factor
:
0
.00001
factor
:
0
Architecture
:
type
:
rec
model_
type
:
rec
algorithm
:
CRNN
Transform
:
Backbone
:
...
...
@@ -43,10 +40,11 @@ Architecture:
layers
:
34
Neck
:
name
:
SequenceEncoder
encoder_type
:
reshape
encoder_type
:
rnn
hidden_size
:
256
Head
:
name
:
CTC
fc_decay
:
0
.00001
name
:
CTC
Head
fc_decay
:
0
Loss
:
name
:
CTCLoss
...
...
@@ -58,46 +56,42 @@ Metric:
name
:
RecMetric
main_indicator
:
acc
T
RAIN
:
T
rain
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./rec
file_list
:
-
./rec/train.txt
# dataset1
ratio_list
:
[
0.4
,
0.6
]
data_dir
:
./train_data/
label_file_list
:
[
"
./train_data/train_list.txt"
]
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
CTCLabelEncode
:
# Class handling label
-
RecAug
:
-
RecResizeImg
:
image_shape
:
[
3
,
32
,
320
]
-
k
eepKeys
:
keep_keys
:
[
'
image'
,
'
label'
,
'
length'
]
# dataloader will return list in this order
image_shape
:
[
3
,
32
,
100
]
-
K
eepKeys
:
keep_keys
:
[
'
image'
,
'
label'
,
'
length'
]
# dataloader will return list in this order
loader
:
batch_size
:
256
shuffle
:
True
batch_size_per_card
:
256
drop_last
:
True
num_workers
:
8
E
VAL
:
E
val
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./rec
file_list
:
-
./rec/val.txt
data_dir
:
./train_data/
label_file_list
:
[
"
./train_data/train_list.txt"
]
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
CTCLabelEncode
:
# Class handling label
-
RecResizeImg
:
image_shape
:
[
3
,
32
,
320
]
-
k
eepKeys
:
keep_keys
:
[
'
image'
,
'
label'
,
'
length'
]
# dataloader will return list in this order
image_shape
:
[
3
,
32
,
100
]
-
K
eepKeys
:
keep_keys
:
[
'
image'
,
'
label'
,
'
length'
]
# dataloader will return list in this order
loader
:
shuffle
:
False
drop_last
:
False
batch_size
:
256
num_workers
:
8
batch_size
_per_card
:
256
num_workers
:
4
deploy/android_demo/.gitignore
deleted
100644 → 0
View file @
0458f0cc
*.iml
.gradle
/local.properties
/.idea/*
.DS_Store
/build
/captures
.externalNativeBuild
deploy/android_demo/README.md
deleted
100644 → 0
View file @
0458f0cc
# 如何快速测试
### 1. 安装最新版本的Android Studio
可以从https://developer.android.com/studio 下载。本Demo使用是4.0版本Android Studio编写。
### 2. 按照NDK 20 以上版本
Demo测试的时候使用的是NDK 20b版本,20版本以上均可以支持编译成功。
如果您是初学者,可以用以下方式安装和测试NDK编译环境。
点击 File -> New ->New Project, 新建 "Native C++" project
### 3. 导入项目
点击 File->New->Import Project..., 然后跟着Android Studio的引导导入
# 获得更多支持
前往
[
端计算模型生成平台EasyEdge
](
https://ai.baidu.com/easyedge/app/open_source_demo?referrerUrl=paddlelite
)
,获得更多开发支持:
-
Demo APP:可使用手机扫码安装,方便手机端快速体验文字识别
-
SDK:模型被封装为适配不同芯片硬件和操作系统SDK,包括完善的接口,方便进行二次开发
deploy/android_demo/app/.gitignore
deleted
100644 → 0
View file @
0458f0cc
/build
deploy/android_demo/app/build.gradle
deleted
100644 → 0
View file @
0458f0cc
import
java.security.MessageDigest
apply
plugin:
'com.android.application'
android
{
compileSdkVersion
29
defaultConfig
{
applicationId
"com.baidu.paddle.lite.demo.ocr"
minSdkVersion
23
targetSdkVersion
29
versionCode
1
versionName
"1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild
{
cmake
{
cppFlags
"-std=c++11 -frtti -fexceptions -Wno-format"
arguments
'-DANDROID_PLATFORM=android-23'
,
'-DANDROID_STL=c++_shared'
,
"-DANDROID_ARM_NEON=TRUE"
}
}
ndk
{
// abiFilters "arm64-v8a", "armeabi-v7a"
abiFilters
"arm64-v8a"
,
"armeabi-v7a"
ldLibs
"jnigraphics"
}
}
buildTypes
{
release
{
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
externalNativeBuild
{
cmake
{
path
"src/main/cpp/CMakeLists.txt"
version
"3.10.2"
}
}
}
dependencies
{
implementation
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
implementation
'androidx.appcompat:appcompat:1.1.0'
implementation
'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
}
def
archives
=
[
[
'src'
:
'https://paddlelite-demo.bj.bcebos.com/libs/android/paddle_lite_libs_v2_6_1.tar.gz'
,
'dest'
:
'PaddleLite'
],
[
'src'
:
'https://paddlelite-demo.bj.bcebos.com/libs/android/opencv-4.2.0-android-sdk.tar.gz'
,
'dest'
:
'OpenCV'
],
[
'src'
:
'https://paddleocr.bj.bcebos.com/deploy/lite/ocr_v1_for_cpu.tar.gz'
,
'dest'
:
'src/main/assets/models/ocr_v1_for_cpu'
]
]
task
downloadAndExtractArchives
(
type:
DefaultTask
)
{
doFirst
{
println
"Downloading and extracting archives including libs and models"
}
doLast
{
// Prepare cache folder for archives
String
cachePath
=
"cache"
if
(!
file
(
"${cachePath}"
).
exists
())
{
mkdir
"${cachePath}"
}
archives
.
eachWithIndex
{
archive
,
index
->
MessageDigest
messageDigest
=
MessageDigest
.
getInstance
(
'MD5'
)
messageDigest
.
update
(
archive
.
src
.
bytes
)
String
cacheName
=
new
BigInteger
(
1
,
messageDigest
.
digest
()).
toString
(
32
)
// Download the target archive if not exists
boolean
copyFiles
=
!
file
(
"${archive.dest}"
).
exists
()
if
(!
file
(
"${cachePath}/${cacheName}.tar.gz"
).
exists
())
{
ant
.
get
(
src:
archive
.
src
,
dest:
file
(
"${cachePath}/${cacheName}.tar.gz"
))
copyFiles
=
true
;
// force to copy files from the latest archive files
}
// Extract the target archive if its dest path does not exists
if
(
copyFiles
)
{
copy
{
from
tarTree
(
"${cachePath}/${cacheName}.tar.gz"
)
into
"${archive.dest}"
}
}
}
}
}
preBuild
.
dependsOn
downloadAndExtractArchives
\ No newline at end of file
deploy/android_demo/app/proguard-rules.pro
deleted
100644 → 0
View file @
0458f0cc
# Add project specific ProGuard rules here.
#
You
can
control
the
set
of
applied
configuration
files
using
the
#
proguardFiles
setting
in
build
.
gradle
.
#
#
For
more
details
,
see
#
http
://
developer
.
android
.
com
/
guide
/
developing
/
tools
/
proguard
.
html
#
If
your
project
uses
WebView
with
JS
,
uncomment
the
following
#
and
specify
the
fully
qualified
class
name
to
the
JavaScript
interface
#
class
:
#-
keepclassmembers
class
fqcn
.
of
.
javascript
.
interface
.
for
.
webview
{
#
public
*
;
#
}
#
Uncomment
this
to
preserve
the
line
number
information
for
#
debugging
stack
traces
.
#-
keepattributes
SourceFile
,
LineNumberTable
#
If
you
keep
the
line
number
information
,
uncomment
this
to
#
hide
the
original
source
file
name
.
#-
renamesourcefileattribute
SourceFile
deploy/android_demo/app/src/androidTest/java/com/baidu/paddle/lite/demo/ocr/ExampleInstrumentedTest.java
deleted
100644 → 0
View file @
0458f0cc
package
com.baidu.paddle.lite.demo.ocr
;
import
android.content.Context
;
import
android.support.test.InstrumentationRegistry
;
import
android.support.test.runner.AndroidJUnit4
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
static
org
.
junit
.
Assert
.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith
(
AndroidJUnit4
.
class
)
public
class
ExampleInstrumentedTest
{
@Test
public
void
useAppContext
()
{
// Context of the app under test.
Context
appContext
=
InstrumentationRegistry
.
getTargetContext
();
assertEquals
(
"com.baidu.paddle.lite.demo"
,
appContext
.
getPackageName
());
}
}
deploy/android_demo/app/src/main/AndroidManifest.xml
deleted
100644 → 0
View file @
0458f0cc
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.baidu.paddle.lite.demo.ocr"
>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<application
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
<!-- to test MiniActivity, change this to com.baidu.paddle.lite.demo.ocr.MiniActivity -->
<activity
android:name=
"com.baidu.paddle.lite.demo.ocr.MainActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
"com.baidu.paddle.lite.demo.ocr.SettingsActivity"
android:label=
"Settings"
>
</activity>
<provider
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"com.baidu.paddle.lite.demo.ocr.fileprovider"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/file_paths"
></meta-data>
</provider>
</application>
</manifest>
\ No newline at end of file
Prev
1
2
3
4
5
…
8
Next
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