提交 fc0a3769 编写于 作者: L LDOUBLEV

fix comment

上级 dbaab10e
# 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
......
# 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
......
#!/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.
先完成此消息的编辑!
想要评论请 注册