Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
fc0a3769
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看板
提交
fc0a3769
编写于
3月 25, 2022
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix comment
上级
dbaab10e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
55 addition
and
21 deletion
+55
-21
tools/end2end/convert_ppocr_label.py
tools/end2end/convert_ppocr_label.py
+13
-0
tools/end2end/draw_html.py
tools/end2end/draw_html.py
+21
-11
tools/end2end/eval_end2end.py
tools/end2end/eval_end2end.py
+21
-10
未找到文件。
tools/end2end/convert_ppocr_label.py
浏览文件 @
fc0a3769
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
numpy
as
np
import
json
import
os
...
...
tools/end2end/draw_html.py
浏览文件 @
fc0a3769
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
...
...
@@ -12,7 +26,6 @@ def draw_debug_img(html_path):
)
image_list
=
[]
path
=
"./det_results/310_gt/"
#path = "infer_results/"
for
i
,
filename
in
enumerate
(
sorted
(
os
.
listdir
(
path
))):
if
filename
.
endswith
(
"txt"
):
continue
print
(
filename
)
...
...
@@ -23,16 +36,14 @@ def draw_debug_img(html_path):
base_3
=
"../PaddleOCR/det_results/ch_ppocr_mobile_infer/{}"
.
format
(
filename
)
if
True
:
html
.
write
(
"<tr>
\n
"
)
html
.
write
(
f
'<td>
{
filename
}
\n
GT'
)
html
.
write
(
'<td>GT
\n
<img src="%s" width=640></td>'
%
(
base
))
html
.
write
(
'<td>PPOCRV2
\n
<img src="%s" width=640></td>'
%
(
base_2
))
html
.
write
(
'<td>ppocr_mobile
\n
<img src="%s" width=640></td>'
%
(
base_3
))
html
.
write
(
"<tr>
\n
"
)
html
.
write
(
f
'<td>
{
filename
}
\n
GT'
)
html
.
write
(
'<td>GT
\n
<img src="%s" width=640></td>'
%
(
base
))
html
.
write
(
'<td>PPOCRV2
\n
<img src="%s" width=640></td>'
%
(
base_2
))
html
.
write
(
'<td>ppocr_mobile
\n
<img src="%s" width=640></td>'
%
(
base_3
))
html
.
write
(
"</tr>
\n
"
)
html
.
write
(
"</tr>
\n
"
)
html
.
write
(
'<style>
\n
'
)
html
.
write
(
'span {
\n
'
)
html
.
write
(
' color: red;
\n
'
)
...
...
@@ -41,7 +52,6 @@ def draw_debug_img(html_path):
html
.
write
(
'</table>
\n
'
)
html
.
write
(
'</html>
\n
</body>
\n
'
)
print
(
"ok"
)
#print("all cnt: {}, err cnt: {}, acc: {}".format(len(imgs), err_cnt, 1.0 * (len(imgs) - err_cnt) / len(imgs)))
return
...
...
tools/end2end/eval_end2end.py
浏览文件 @
fc0a3769
#!/usr/bin/env python
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
re
import
sys
# import Polygon
import
shapely
from
shapely.geometry
import
Polygon
import
numpy
as
np
...
...
@@ -10,9 +22,6 @@ from collections import defaultdict
import
operator
import
editdistance
# reload(sys)
# sys.setdefaultencoding('utf-8')
def
strQ2B
(
ustring
):
rstring
=
""
...
...
@@ -59,7 +68,7 @@ def ed(str1, str2):
return
editdistance
.
eval
(
str1
,
str2
)
def
e2e_eval
(
gt_dir
,
res_dir
):
def
e2e_eval
(
gt_dir
,
res_dir
,
ignore_blank
=
False
):
print
(
'start testing...'
)
iou_thresh
=
0.5
val_names
=
os
.
listdir
(
gt_dir
)
...
...
@@ -125,10 +134,12 @@ def e2e_eval(gt_dir, res_dir):
if
gt_match
[
index_gt
]
==
False
and
dt_match
[
index_dt
]
==
False
:
gt_match
[
index_gt
]
=
True
dt_match
[
index_dt
]
=
True
# gt_str = strQ2B(gts[index_gt][8]).replace(" ", "")
# dt_str = strQ2B(dts[index_dt][8]).replace(" ", "")
gt_str
=
strQ2B
(
gts
[
index_gt
][
8
])
dt_str
=
strQ2B
(
dts
[
index_dt
][
8
])
if
ignore_blank
:
gt_str
=
strQ2B
(
gts
[
index_gt
][
8
]).
replace
(
" "
,
""
)
dt_str
=
strQ2B
(
dts
[
index_dt
][
8
]).
replace
(
" "
,
""
)
else
:
gt_str
=
strQ2B
(
gts
[
index_gt
][
8
])
dt_str
=
strQ2B
(
dts
[
index_dt
][
8
])
if
ignore_masks
[
index_gt
]
==
'0'
:
ed_sum
+=
ed
(
gt_str
,
dt_str
)
num_gt_chars
+=
len
(
gt_str
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录