Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
44531217
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看板
提交
44531217
编写于
8月 01, 2021
作者:
W
WenmuZhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove style char
上级
fb4ad303
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
10 deletion
+17
-10
ppstructure/predict_system.py
ppstructure/predict_system.py
+17
-10
未找到文件。
ppstructure/predict_system.py
浏览文件 @
44531217
...
@@ -65,8 +65,17 @@ class OCRSystem(object):
...
@@ -65,8 +65,17 @@ class OCRSystem(object):
filter_boxes
,
filter_rec_res
=
self
.
text_system
(
roi_img
)
filter_boxes
,
filter_rec_res
=
self
.
text_system
(
roi_img
)
filter_boxes
=
[
x
+
[
x1
,
y1
]
for
x
in
filter_boxes
]
filter_boxes
=
[
x
+
[
x1
,
y1
]
for
x
in
filter_boxes
]
filter_boxes
=
[
x
.
reshape
(
-
1
).
tolist
()
for
x
in
filter_boxes
]
filter_boxes
=
[
x
.
reshape
(
-
1
).
tolist
()
for
x
in
filter_boxes
]
# remove style char
res
=
(
filter_boxes
,
filter_rec_res
)
style_token
=
[
'<strike>'
,
'<strike>'
,
'<sup>'
,
'</sub>'
,
'<b>'
,
'</b>'
,
'<sub>'
,
'</sup>'
,
'<overline>'
,
'</overline>'
,
'<underline>'
,
'</underline>'
,
'<i>'
,
'</i>'
]
filter_rec_res_tmp
=
[]
for
rec_res
in
filter_rec_res
:
rec_str
,
rec_conf
=
rec_res
for
token
in
style_token
:
if
token
in
rec_str
:
rec_str
=
rec_str
.
replace
(
token
,
''
)
filter_rec_res_tmp
.
append
((
rec_str
,
rec_conf
))
res
=
(
filter_boxes
,
filter_rec_res_tmp
)
res_list
.
append
({
'type'
:
region
.
type
,
'bbox'
:
[
x1
,
y1
,
x2
,
y2
],
'res'
:
res
})
res_list
.
append
({
'type'
:
region
.
type
,
'bbox'
:
[
x1
,
y1
,
x2
,
y2
],
'res'
:
res
})
return
res_list
return
res_list
...
@@ -75,14 +84,12 @@ def save_res(res, save_folder, img_name):
...
@@ -75,14 +84,12 @@ def save_res(res, save_folder, img_name):
excel_save_folder
=
os
.
path
.
join
(
save_folder
,
img_name
)
excel_save_folder
=
os
.
path
.
join
(
save_folder
,
img_name
)
os
.
makedirs
(
excel_save_folder
,
exist_ok
=
True
)
os
.
makedirs
(
excel_save_folder
,
exist_ok
=
True
)
# save res
# save res
for
region
in
res
:
with
open
(
os
.
path
.
join
(
excel_save_folder
,
'res.txt'
),
'w'
,
encoding
=
'utf8'
)
as
f
:
if
region
[
'type'
]
==
'Table'
:
for
region
in
res
:
excel_path
=
os
.
path
.
join
(
excel_save_folder
,
'{}.xlsx'
.
format
(
region
[
'bbox'
]))
if
region
[
'type'
]
==
'Table'
:
to_excel
(
region
[
'res'
],
excel_path
)
excel_path
=
os
.
path
.
join
(
excel_save_folder
,
'{}.xlsx'
.
format
(
region
[
'bbox'
]))
elif
region
[
'type'
]
==
'Figure'
:
to_excel
(
region
[
'res'
],
excel_path
)
pass
else
:
else
:
with
open
(
os
.
path
.
join
(
excel_save_folder
,
'res.txt'
),
'a'
,
encoding
=
'utf8'
)
as
f
:
for
box
,
rec_res
in
zip
(
region
[
'res'
][
0
],
region
[
'res'
][
1
]):
for
box
,
rec_res
in
zip
(
region
[
'res'
][
0
],
region
[
'res'
][
1
]):
f
.
write
(
'{}
\t
{}
\n
'
.
format
(
np
.
array
(
box
).
reshape
(
-
1
).
tolist
(),
rec_res
))
f
.
write
(
'{}
\t
{}
\n
'
.
format
(
np
.
array
(
box
).
reshape
(
-
1
).
tolist
(),
rec_res
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录