Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
2e05d54a
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2e05d54a
编写于
3月 09, 2023
作者:
Z
zhoujun
提交者:
GitHub
3月 09, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add d2s train for slanet and v3 (#9341)
* add d2s train for slanet and v3 * fix bug
上级
623424fc
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
47 addition
and
10 deletion
+47
-10
configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml
configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml
+1
-0
configs/kie/vi_layoutxlm/ser_vi_layoutxlm_xfund_zh.yml
configs/kie/vi_layoutxlm/ser_vi_layoutxlm_xfund_zh.yml
+1
-0
configs/rec/PP-OCRv3/ch_PP-OCRv3_rec_distillation.yml
configs/rec/PP-OCRv3/ch_PP-OCRv3_rec_distillation.yml
+1
-0
configs/table/SLANet.yml
configs/table/SLANet.yml
+1
-0
configs/table/table_master.yml
configs/table/table_master.yml
+1
-0
ppocr/modeling/architectures/__init__.py
ppocr/modeling/architectures/__init__.py
+33
-5
ppocr/utils/network.py
ppocr/utils/network.py
+2
-0
test_tipc/configs/ch_PP-OCRv3_det/train_infer_python.txt
test_tipc/configs/ch_PP-OCRv3_det/train_infer_python.txt
+1
-1
test_tipc/configs/ch_PP-OCRv3_rec/ch_PP-OCRv3_rec_distillation.yml
.../configs/ch_PP-OCRv3_rec/ch_PP-OCRv3_rec_distillation.yml
+1
-0
test_tipc/configs/ch_PP-OCRv3_rec/train_infer_python.txt
test_tipc/configs/ch_PP-OCRv3_rec/train_infer_python.txt
+1
-1
test_tipc/configs/slanet/SLANet.yml
test_tipc/configs/slanet/SLANet.yml
+1
-0
test_tipc/configs/slanet/train_infer_python.txt
test_tipc/configs/slanet/train_infer_python.txt
+1
-1
test_tipc/configs/table_master/table_master.yml
test_tipc/configs/table_master/table_master.yml
+1
-1
test_tipc/configs/vi_layoutxlm_ser/train_infer_python.txt
test_tipc/configs/vi_layoutxlm_ser/train_infer_python.txt
+1
-1
未找到文件。
configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml
浏览文件 @
2e05d54a
...
...
@@ -17,6 +17,7 @@ Global:
infer_img
:
doc/imgs_en/img_10.jpg
save_res_path
:
./checkpoints/det_db/predicts_db.txt
distributed
:
true
d2s_train_image_shape
:
[
3
,
-1
,
-1
]
Architecture
:
name
:
DistillationModel
...
...
configs/kie/vi_layoutxlm/ser_vi_layoutxlm_xfund_zh.yml
浏览文件 @
2e05d54a
...
...
@@ -12,6 +12,7 @@ Global:
use_visualdl
:
False
seed
:
2022
infer_img
:
ppstructure/docs/kie/input/zh_val_42.jpg
d2s_train_image_shape
:
[
3
,
224
,
224
]
# if you want to predict using the groundtruth ocr info,
# you can use the following config
# infer_img: train_data/XFUND/zh_val/val.json
...
...
configs/rec/PP-OCRv3/ch_PP-OCRv3_rec_distillation.yml
浏览文件 @
2e05d54a
...
...
@@ -19,6 +19,7 @@ Global:
use_space_char
:
true
distributed
:
true
save_res_path
:
./output/rec/predicts_ppocrv3_distillation.txt
d2s_train_image_shape
:
[
3
,
48
,
-1
]
Optimizer
:
...
...
configs/table/SLANet.yml
浏览文件 @
2e05d54a
...
...
@@ -21,6 +21,7 @@ Global:
infer_mode
:
False
use_sync_bn
:
True
save_res_path
:
'
output/infer'
d2s_train_image_shape
:
[
3
,
-1
,
-1
]
Optimizer
:
name
:
Adam
...
...
configs/table/table_master.yml
浏览文件 @
2e05d54a
...
...
@@ -17,6 +17,7 @@ Global:
infer_mode
:
false
max_text_length
:
&max_text_length
500
box_format
:
&box_format
'
xywh'
# 'xywh', 'xyxy', 'xyxyxyxy'
d2s_train_image_shape
:
[
3
,
480
,
480
]
Optimizer
:
...
...
ppocr/modeling/architectures/__init__.py
浏览文件 @
2e05d54a
...
...
@@ -38,9 +38,9 @@ def build_model(config):
def
apply_to_static
(
model
,
config
,
logger
):
if
config
[
"Global"
].
get
(
"to_static"
,
False
)
is
not
True
:
return
model
assert
"image_shape"
in
config
[
"Global"
],
"image_shape must be assigned for static training mode..."
supported_list
=
[
"DB"
,
"SVTR_LCNet"
,
"TableMaster"
]
assert
"
d2s_train_
image_shape"
in
config
[
"Global"
],
"
d2s_train_
image_shape must be assigned for static training mode..."
supported_list
=
[
"DB"
,
"SVTR_LCNet"
,
"TableMaster"
,
"LayoutXLM"
,
"SLANet"
]
if
config
[
"Architecture"
][
"algorithm"
]
in
[
"Distillation"
]:
algo
=
list
(
config
[
"Architecture"
][
"Models"
].
values
())[
0
][
"algorithm"
]
else
:
...
...
@@ -49,7 +49,7 @@ def apply_to_static(model, config, logger):
specs
=
[
InputSpec
(
[
None
]
+
config
[
"Global"
][
"image_shape"
],
dtype
=
'float32'
)
[
None
]
+
config
[
"Global"
][
"
d2s_train_
image_shape"
],
dtype
=
'float32'
)
]
if
algo
==
"SVTR_LCNet"
:
...
...
@@ -62,7 +62,7 @@ def apply_to_static(model, config, logger):
[
None
],
dtype
=
'int64'
),
InputSpec
(
[
None
],
dtype
=
'float64'
)
])
if
algo
==
"TableMaster"
:
el
if
algo
==
"TableMaster"
:
specs
.
append
(
[
InputSpec
(
...
...
@@ -76,6 +76,34 @@ def apply_to_static(model, config, logger):
InputSpec
(
[
None
,
6
],
dtype
=
'float32'
),
])
elif
algo
==
"LayoutXLM"
:
specs
=
[[
InputSpec
(
shape
=
[
None
,
512
],
dtype
=
"int64"
),
# input_ids
InputSpec
(
shape
=
[
None
,
512
,
4
],
dtype
=
"int64"
),
# bbox
InputSpec
(
shape
=
[
None
,
512
],
dtype
=
"int64"
),
# attention_mask
InputSpec
(
shape
=
[
None
,
512
],
dtype
=
"int64"
),
# token_type_ids
InputSpec
(
shape
=
[
None
,
3
,
224
,
224
],
dtype
=
"float32"
),
# image
InputSpec
(
shape
=
[
None
,
512
],
dtype
=
"int64"
),
# label
]]
elif
algo
==
"SLANet"
:
specs
.
append
([
InputSpec
(
[
None
,
config
[
"Global"
][
"max_text_length"
]
+
2
],
dtype
=
'int64'
),
InputSpec
(
[
None
,
config
[
"Global"
][
"max_text_length"
]
+
2
,
4
],
dtype
=
'float32'
),
InputSpec
(
[
None
,
config
[
"Global"
][
"max_text_length"
]
+
2
,
1
],
dtype
=
'float32'
),
InputSpec
(
[
None
,
6
],
dtype
=
'float64'
),
])
model
=
to_static
(
model
,
input_spec
=
specs
)
logger
.
info
(
"Successfully to apply @to_static with specs: {}"
.
format
(
specs
))
return
model
ppocr/utils/network.py
浏览文件 @
2e05d54a
...
...
@@ -20,6 +20,8 @@ from tqdm import tqdm
from
ppocr.utils.logging
import
get_logger
MODELS_DIR
=
os
.
path
.
expanduser
(
"~/.paddleocr/models/"
)
def
download_with_progressbar
(
url
,
save_path
):
logger
=
get_logger
()
...
...
test_tipc/configs/ch_PP-OCRv3_det/train_infer_python.txt
浏览文件 @
2e05d54a
...
...
@@ -17,7 +17,7 @@ norm_train:tools/train.py -c configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml -o
pact_train:null
fpgm_train:null
distill_train:null
null:null
to_static_train:Global.to_static=true
null:null
##
===========================eval_params===========================
...
...
test_tipc/configs/ch_PP-OCRv3_rec/ch_PP-OCRv3_rec_distillation.yml
浏览文件 @
2e05d54a
...
...
@@ -19,6 +19,7 @@ Global:
use_space_char
:
true
distributed
:
true
save_res_path
:
./output/rec/predicts_ppocrv3_distillation.txt
d2s_train_image_shape
:
[
3
,
48
,
-1
]
Optimizer
:
...
...
test_tipc/configs/ch_PP-OCRv3_rec/train_infer_python.txt
浏览文件 @
2e05d54a
...
...
@@ -17,7 +17,7 @@ norm_train:tools/train.py -c test_tipc/configs/ch_PP-OCRv3_rec/ch_PP-OCRv3_rec_d
pact_train:null
fpgm_train:null
distill_train:null
null:null
to_static_train:Global.to_static=true
null:null
##
===========================eval_params===========================
...
...
test_tipc/configs/slanet/SLANet.yml
浏览文件 @
2e05d54a
...
...
@@ -21,6 +21,7 @@ Global:
infer_mode
:
False
use_sync_bn
:
True
save_res_path
:
'
output/infer'
d2s_train_image_shape
:
[
3
,
-1
,
-1
]
Optimizer
:
name
:
Adam
...
...
test_tipc/configs/slanet/train_infer_python.txt
浏览文件 @
2e05d54a
...
...
@@ -17,7 +17,7 @@ norm_train:tools/train.py -c test_tipc/configs/slanet/SLANet.yml -o Global.print
pact_train:null
fpgm_train:null
distill_train:null
null:null
to_static_train:Global.to_static=true
null:null
##
===========================eval_params===========================
...
...
test_tipc/configs/table_master/table_master.yml
浏览文件 @
2e05d54a
...
...
@@ -16,7 +16,7 @@ Global:
character_dict_path
:
ppocr/utils/dict/table_master_structure_dict.txt
infer_mode
:
false
max_text_length
:
500
image_shape
:
[
3
,
480
,
480
]
d2s_train_
image_shape
:
[
3
,
480
,
480
]
Optimizer
:
...
...
test_tipc/configs/vi_layoutxlm_ser/train_infer_python.txt
浏览文件 @
2e05d54a
...
...
@@ -17,7 +17,7 @@ norm_train:tools/train.py -c ./configs/kie/vi_layoutxlm/ser_vi_layoutxlm_xfund_z
pact_train:null
fpgm_train:null
distill_train:null
null:null
to_static_train:Global.to_static=true
null:null
##
===========================eval_params===========================
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录