Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
a4bc9da8
P
PaddleOCR
项目概览
weixin_41840029
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a4bc9da8
编写于
9月 21, 2022
作者:
文幕地方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug
上级
06194524
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
18 addition
and
8 deletion
+18
-8
configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml
configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml
+2
-2
configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh_udml.yml
configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh_udml.yml
+6
-4
ppocr/losses/distillation_loss.py
ppocr/losses/distillation_loss.py
+5
-0
ppocr/postprocess/vqa_token_re_layoutlm_postprocess.py
ppocr/postprocess/vqa_token_re_layoutlm_postprocess.py
+1
-1
ppstructure/kie/predict_kie_token_ser_re.py
ppstructure/kie/predict_kie_token_ser_re.py
+4
-1
未找到文件。
configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml
浏览文件 @
a4bc9da8
...
@@ -83,7 +83,7 @@ Train:
...
@@ -83,7 +83,7 @@ Train:
order
:
'
hwc'
order
:
'
hwc'
-
ToCHWImage
:
-
ToCHWImage
:
-
KeepKeys
:
-
KeepKeys
:
keep_keys
:
[
'
input_ids'
,
'
bbox'
,
'
attention_mask'
,
'
token_type_ids'
,
'
image'
,
'
entities'
,
'
relations'
]
# dataloader will return list in this order
keep_keys
:
[
'
input_ids'
,
'
bbox'
,
'
attention_mask'
,
'
token_type_ids'
,
'
entities'
,
'
relations'
]
# dataloader will return list in this order
loader
:
loader
:
shuffle
:
True
shuffle
:
True
drop_last
:
False
drop_last
:
False
...
@@ -122,7 +122,7 @@ Eval:
...
@@ -122,7 +122,7 @@ Eval:
order
:
'
hwc'
order
:
'
hwc'
-
ToCHWImage
:
-
ToCHWImage
:
-
KeepKeys
:
-
KeepKeys
:
keep_keys
:
[
'
input_ids'
,
'
bbox'
,
'
attention_mask'
,
'
token_type_ids'
,
'
image'
,
'
entities'
,
'
relations'
]
# dataloader will return list in this order
keep_keys
:
[
'
input_ids'
,
'
bbox'
,
'
attention_mask'
,
'
token_type_ids'
,
'
entities'
,
'
relations'
]
# dataloader will return list in this order
loader
:
loader
:
shuffle
:
False
shuffle
:
False
drop_last
:
False
drop_last
:
False
...
...
configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh_udml.yml
浏览文件 @
a4bc9da8
...
@@ -57,14 +57,16 @@ Loss:
...
@@ -57,14 +57,16 @@ Loss:
mode
:
"
l2"
mode
:
"
l2"
model_name_pairs
:
model_name_pairs
:
-
[
"
Student"
,
"
Teacher"
]
-
[
"
Student"
,
"
Teacher"
]
key
:
hidden_states_5
key
:
hidden_states
index
:
5
name
:
"
loss_5"
name
:
"
loss_5"
-
DistillationVQADistanceLoss
:
-
DistillationVQADistanceLoss
:
weight
:
0.5
weight
:
0.5
mode
:
"
l2"
mode
:
"
l2"
model_name_pairs
:
model_name_pairs
:
-
[
"
Student"
,
"
Teacher"
]
-
[
"
Student"
,
"
Teacher"
]
key
:
hidden_states_8
key
:
hidden_states
index
:
8
name
:
"
loss_8"
name
:
"
loss_8"
...
@@ -126,7 +128,7 @@ Train:
...
@@ -126,7 +128,7 @@ Train:
order
:
'
hwc'
order
:
'
hwc'
-
ToCHWImage
:
-
ToCHWImage
:
-
KeepKeys
:
-
KeepKeys
:
keep_keys
:
[
'
input_ids'
,
'
bbox'
,
'
attention_mask'
,
'
token_type_ids'
,
'
image'
,
'
entities'
,
'
relations'
]
# dataloader will return list in this order
keep_keys
:
[
'
input_ids'
,
'
bbox'
,
'
attention_mask'
,
'
token_type_ids'
,
'
entities'
,
'
relations'
]
# dataloader will return list in this order
loader
:
loader
:
shuffle
:
True
shuffle
:
True
drop_last
:
False
drop_last
:
False
...
@@ -166,7 +168,7 @@ Eval:
...
@@ -166,7 +168,7 @@ Eval:
order
:
'
hwc'
order
:
'
hwc'
-
ToCHWImage
:
-
ToCHWImage
:
-
KeepKeys
:
-
KeepKeys
:
keep_keys
:
[
'
input_ids'
,
'
bbox'
,
'
attention_mask'
,
'
token_type_ids'
,
'
image'
,
'
entities'
,
'
relations'
]
# dataloader will return list in this order
keep_keys
:
[
'
input_ids'
,
'
bbox'
,
'
attention_mask'
,
'
token_type_ids'
,
'
entities'
,
'
relations'
]
# dataloader will return list in this order
loader
:
loader
:
shuffle
:
False
shuffle
:
False
drop_last
:
False
drop_last
:
False
...
...
ppocr/losses/distillation_loss.py
浏览文件 @
a4bc9da8
...
@@ -417,11 +417,13 @@ class DistillationVQADistanceLoss(DistanceLoss):
...
@@ -417,11 +417,13 @@ class DistillationVQADistanceLoss(DistanceLoss):
mode
=
"l2"
,
mode
=
"l2"
,
model_name_pairs
=
[],
model_name_pairs
=
[],
key
=
None
,
key
=
None
,
index
=
None
,
name
=
"loss_distance"
,
name
=
"loss_distance"
,
**
kargs
):
**
kargs
):
super
().
__init__
(
mode
=
mode
,
**
kargs
)
super
().
__init__
(
mode
=
mode
,
**
kargs
)
assert
isinstance
(
model_name_pairs
,
list
)
assert
isinstance
(
model_name_pairs
,
list
)
self
.
key
=
key
self
.
key
=
key
self
.
index
=
index
self
.
model_name_pairs
=
model_name_pairs
self
.
model_name_pairs
=
model_name_pairs
self
.
name
=
name
+
"_l2"
self
.
name
=
name
+
"_l2"
...
@@ -434,6 +436,9 @@ class DistillationVQADistanceLoss(DistanceLoss):
...
@@ -434,6 +436,9 @@ class DistillationVQADistanceLoss(DistanceLoss):
if
self
.
key
is
not
None
:
if
self
.
key
is
not
None
:
out1
=
out1
[
self
.
key
]
out1
=
out1
[
self
.
key
]
out2
=
out2
[
self
.
key
]
out2
=
out2
[
self
.
key
]
if
self
.
index
is
not
None
:
out1
=
out1
[:,
self
.
index
,
:,
:]
out2
=
out2
[:,
self
.
index
,
:,
:]
if
attention_mask
is
not
None
:
if
attention_mask
is
not
None
:
max_len
=
attention_mask
.
shape
[
-
1
]
max_len
=
attention_mask
.
shape
[
-
1
]
out1
=
out1
[:,
:
max_len
]
out1
=
out1
[:,
:
max_len
]
...
...
ppocr/postprocess/vqa_token_re_layoutlm_postprocess.py
浏览文件 @
a4bc9da8
...
@@ -32,7 +32,7 @@ class VQAReTokenLayoutLMPostProcess(object):
...
@@ -32,7 +32,7 @@ class VQAReTokenLayoutLMPostProcess(object):
return
self
.
_infer
(
pred_relations
,
*
args
,
**
kwargs
)
return
self
.
_infer
(
pred_relations
,
*
args
,
**
kwargs
)
def
_metric
(
self
,
pred_relations
,
label
):
def
_metric
(
self
,
pred_relations
,
label
):
return
pred_relations
,
label
[
6
],
label
[
5
]
return
pred_relations
,
label
[
-
1
],
label
[
-
2
]
def
_infer
(
self
,
pred_relations
,
*
args
,
**
kwargs
):
def
_infer
(
self
,
pred_relations
,
*
args
,
**
kwargs
):
ser_results
=
kwargs
[
'ser_results'
]
ser_results
=
kwargs
[
'ser_results'
]
...
...
ppstructure/kie/predict_kie_token_ser_re.py
浏览文件 @
a4bc9da8
...
@@ -64,7 +64,10 @@ class SerRePredictor(object):
...
@@ -64,7 +64,10 @@ class SerRePredictor(object):
for
output_tensor
in
self
.
output_tensors
:
for
output_tensor
in
self
.
output_tensors
:
output
=
output_tensor
.
copy_to_cpu
()
output
=
output_tensor
.
copy_to_cpu
()
outputs
.
append
(
output
)
outputs
.
append
(
output
)
preds
=
dict
(
loss
=
outputs
[
0
],
pred_relations
=
outputs
[
1
])
preds
=
dict
(
loss
=
outputs
[
1
],
pred_relations
=
outputs
[
2
],
hidden_states
=
outputs
[
0
],
)
post_result
=
self
.
postprocess_op
(
post_result
=
self
.
postprocess_op
(
preds
,
preds
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录