Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
4078b0fe
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看板
提交
4078b0fe
编写于
10月 18, 2022
作者:
文幕地方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix pact bug in slanet
上级
27306852
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
14 deletion
+15
-14
ppstructure/kie/requirements.txt
ppstructure/kie/requirements.txt
+1
-1
ppstructure/table/predict_table.py
ppstructure/table/predict_table.py
+9
-9
test_tipc/configs/layoutxlm_ser/train_pact_infer_python.txt
test_tipc/configs/layoutxlm_ser/train_pact_infer_python.txt
+2
-2
test_tipc/configs/slanet/train_pact_infer_python.txt
test_tipc/configs/slanet/train_pact_infer_python.txt
+1
-1
test_tipc/prepare.sh
test_tipc/prepare.sh
+2
-1
未找到文件。
ppstructure/kie/requirements.txt
浏览文件 @
4078b0fe
...
@@ -4,4 +4,4 @@ seqeval
...
@@ -4,4 +4,4 @@ seqeval
pypandoc
pypandoc
attrdict
attrdict
python_docx
python_docx
https://paddleocr.bj.bcebos.com/ppstructure/whl/paddlenlp-2.3.0.dev0-py3-none-any.whl
paddlenlp>=2.4.1
ppstructure/table/predict_table.py
浏览文件 @
4078b0fe
...
@@ -58,6 +58,7 @@ def expand(pix, det_box, shape):
...
@@ -58,6 +58,7 @@ def expand(pix, det_box, shape):
class
TableSystem
(
object
):
class
TableSystem
(
object
):
def
__init__
(
self
,
args
,
text_detector
=
None
,
text_recognizer
=
None
):
def
__init__
(
self
,
args
,
text_detector
=
None
,
text_recognizer
=
None
):
self
.
args
=
args
if
not
args
.
show_log
:
if
not
args
.
show_log
:
logger
.
setLevel
(
logging
.
INFO
)
logger
.
setLevel
(
logging
.
INFO
)
...
@@ -99,13 +100,18 @@ class TableSystem(object):
...
@@ -99,13 +100,18 @@ class TableSystem(object):
result
=
dict
()
result
=
dict
()
time_dict
=
{
'det'
:
0
,
'rec'
:
0
,
'table'
:
0
,
'all'
:
0
,
'match'
:
0
}
time_dict
=
{
'det'
:
0
,
'rec'
:
0
,
'table'
:
0
,
'all'
:
0
,
'match'
:
0
}
start
=
time
.
time
()
start
=
time
.
time
()
if
self
.
args
.
benchmark
:
self
.
autolog
.
times
.
start
()
structure_res
,
elapse
=
self
.
_structure
(
copy
.
deepcopy
(
img
))
structure_res
,
elapse
=
self
.
_structure
(
copy
.
deepcopy
(
img
))
if
self
.
benchmark
:
self
.
autolog
.
times
.
stamp
()
result
[
'cell_bbox'
]
=
structure_res
[
1
].
tolist
()
result
[
'cell_bbox'
]
=
structure_res
[
1
].
tolist
()
time_dict
[
'table'
]
=
elapse
time_dict
[
'table'
]
=
elapse
dt_boxes
,
rec_res
,
det_elapse
,
rec_elapse
=
self
.
_ocr
(
dt_boxes
,
rec_res
,
det_elapse
,
rec_elapse
=
self
.
_ocr
(
copy
.
deepcopy
(
img
))
copy
.
deepcopy
(
img
))
if
self
.
benchmark
:
self
.
autolog
.
times
.
stamp
()
time_dict
[
'det'
]
=
det_elapse
time_dict
[
'det'
]
=
det_elapse
time_dict
[
'rec'
]
=
rec_elapse
time_dict
[
'rec'
]
=
rec_elapse
...
@@ -118,24 +124,18 @@ class TableSystem(object):
...
@@ -118,24 +124,18 @@ class TableSystem(object):
toc
=
time
.
time
()
toc
=
time
.
time
()
time_dict
[
'match'
]
=
toc
-
tic
time_dict
[
'match'
]
=
toc
-
tic
result
[
'html'
]
=
pred_html
result
[
'html'
]
=
pred_html
if
self
.
benchmark
:
self
.
autolog
.
times
.
end
(
stamp
=
True
)
end
=
time
.
time
()
end
=
time
.
time
()
time_dict
[
'all'
]
=
end
-
start
time_dict
[
'all'
]
=
end
-
start
if
self
.
benchmark
:
if
self
.
benchmark
:
self
.
autolog
.
times
.
stamp
(
)
self
.
autolog
.
times
.
end
(
stamp
=
True
)
return
result
,
time_dict
return
result
,
time_dict
def
_structure
(
self
,
img
):
def
_structure
(
self
,
img
):
if
self
.
benchmark
:
self
.
autolog
.
times
.
start
()
structure_res
,
elapse
=
self
.
table_structurer
(
copy
.
deepcopy
(
img
))
structure_res
,
elapse
=
self
.
table_structurer
(
copy
.
deepcopy
(
img
))
return
structure_res
,
elapse
return
structure_res
,
elapse
def
_ocr
(
self
,
img
):
def
_ocr
(
self
,
img
):
h
,
w
=
img
.
shape
[:
2
]
h
,
w
=
img
.
shape
[:
2
]
if
self
.
benchmark
:
self
.
autolog
.
times
.
stamp
()
dt_boxes
,
det_elapse
=
self
.
text_detector
(
copy
.
deepcopy
(
img
))
dt_boxes
,
det_elapse
=
self
.
text_detector
(
copy
.
deepcopy
(
img
))
dt_boxes
=
sorted_boxes
(
dt_boxes
)
dt_boxes
=
sorted_boxes
(
dt_boxes
)
...
@@ -233,7 +233,7 @@ def main(args):
...
@@ -233,7 +233,7 @@ def main(args):
f_html
.
close
()
f_html
.
close
()
if
args
.
benchmark
:
if
args
.
benchmark
:
t
ext
_sys
.
autolog
.
report
()
t
able
_sys
.
autolog
.
report
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
test_tipc/configs/layoutxlm_ser/train_pact_infer_python.txt
浏览文件 @
4078b0fe
...
@@ -7,14 +7,14 @@ Global.auto_cast:fp32
...
@@ -7,14 +7,14 @@ Global.auto_cast:fp32
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=17
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=17
Global.save_model_dir:./output/
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=4|whole_train_whole_infer=8
Train.loader.batch_size_per_card:lite_train_lite_infer=4|whole_train_whole_infer=8
Architecture.Backbone.
checkpoints
:pretrain_models/ser_LayoutXLM_xfun_zh
Architecture.Backbone.
pretrained
:pretrain_models/ser_LayoutXLM_xfun_zh
train_model_name:latest
train_model_name:latest
train_infer_img_dir:ppstructure/docs/kie/input/zh_val_42.jpg
train_infer_img_dir:ppstructure/docs/kie/input/zh_val_42.jpg
null:null
null:null
##
##
trainer:pact_train
trainer:pact_train
norm_train:null
norm_train:null
pact_train:deploy/slim/quantization/quant.py -c test_tipc/configs/layoutxlm_ser/ser_layoutxlm_xfund_zh.yml -o
pact_train:deploy/slim/quantization/quant.py -c test_tipc/configs/layoutxlm_ser/ser_layoutxlm_xfund_zh.yml -o
Global.eval_batch_step=[2000,10]
fpgm_train:null
fpgm_train:null
distill_train:null
distill_train:null
null:null
null:null
...
...
test_tipc/configs/slanet/train_pact_infer_python.txt
浏览文件 @
4078b0fe
...
@@ -34,7 +34,7 @@ distill_export:null
...
@@ -34,7 +34,7 @@ distill_export:null
export1:null
export1:null
export2:null
export2:null
##
##
infer_model:./inference/en_pp
ocr_mobile_v2.0_table_structure
_infer
infer_model:./inference/en_pp
structure_mobile_v2.0_SLANet
_infer
infer_export:null
infer_export:null
infer_quant:True
infer_quant:True
inference:ppstructure/table/predict_table.py --det_model_dir=./inference/en_ppocr_mobile_v2.0_table_det_infer --rec_model_dir=./inference/en_ppocr_mobile_v2.0_table_rec_infer --rec_char_dict_path=./ppocr/utils/dict/table_dict.txt --table_char_dict_path=./ppocr/utils/dict/table_structure_dict.txt --image_dir=./ppstructure/docs/table/table.jpg --det_limit_side_len=736 --det_limit_type=min --output ./output/table
inference:ppstructure/table/predict_table.py --det_model_dir=./inference/en_ppocr_mobile_v2.0_table_det_infer --rec_model_dir=./inference/en_ppocr_mobile_v2.0_table_rec_infer --rec_char_dict_path=./ppocr/utils/dict/table_dict.txt --table_char_dict_path=./ppocr/utils/dict/table_structure_dict.txt --image_dir=./ppstructure/docs/table/table.jpg --det_limit_side_len=736 --det_limit_type=min --output ./output/table
...
...
test_tipc/prepare.sh
浏览文件 @
4078b0fe
...
@@ -146,6 +146,7 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
...
@@ -146,6 +146,7 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
python_name
=
${
array
[0]
}
python_name
=
${
array
[0]
}
${
python_name
}
-m
pip
install
-r
requirements.txt
${
python_name
}
-m
pip
install
-r
requirements.txt
${
python_name
}
-m
pip
install
https://paddleocr.bj.bcebos.com/libs/auto_log-1.2.0-py3-none-any.whl
${
python_name
}
-m
pip
install
https://paddleocr.bj.bcebos.com/libs/auto_log-1.2.0-py3-none-any.whl
${
python_name
}
-m
pip
install
paddleslim
==
2.3.4
# pretrain lite train data
# pretrain lite train data
wget
-nc
-P
./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar
--no-check-certificate
...
@@ -260,7 +261,7 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
...
@@ -260,7 +261,7 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/rec_r32_gaspin_bilstm_att_train.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/rec_r32_gaspin_bilstm_att_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf rec_r32_gaspin_bilstm_att_train.tar
&&
cd
../
cd
./pretrain_models/
&&
tar
xf rec_r32_gaspin_bilstm_att_train.tar
&&
cd
../
fi
fi
if
[
${
model_name
}
==
"layoutxlm_ser"
]
;
then
if
[
[
${
model_name
}
=
~
"layoutxlm_ser"
]
]
;
then
${
python_name
}
-m
pip
install
-r
ppstructure/kie/requirements.txt
${
python_name
}
-m
pip
install
-r
ppstructure/kie/requirements.txt
${
python_name
}
-m
pip
install
opencv-python
-U
${
python_name
}
-m
pip
install
opencv-python
-U
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/ppstructure/dataset/XFUND.tar
--no-check-certificate
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/ppstructure/dataset/XFUND.tar
--no-check-certificate
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录