提交 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 numpy as np
import json import json
import os 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 import os
...@@ -12,7 +26,6 @@ def draw_debug_img(html_path): ...@@ -12,7 +26,6 @@ def draw_debug_img(html_path):
) )
image_list = [] image_list = []
path = "./det_results/310_gt/" path = "./det_results/310_gt/"
#path = "infer_results/"
for i, filename in enumerate(sorted(os.listdir(path))): for i, filename in enumerate(sorted(os.listdir(path))):
if filename.endswith("txt"): continue if filename.endswith("txt"): continue
print(filename) print(filename)
...@@ -23,12 +36,10 @@ def draw_debug_img(html_path): ...@@ -23,12 +36,10 @@ def draw_debug_img(html_path):
base_3 = "../PaddleOCR/det_results/ch_ppocr_mobile_infer/{}".format( base_3 = "../PaddleOCR/det_results/ch_ppocr_mobile_infer/{}".format(
filename) filename)
if True:
html.write("<tr>\n") html.write("<tr>\n")
html.write(f'<td> {filename}\n GT') html.write(f'<td> {filename}\n GT')
html.write('<td>GT\n<img src="%s" width=640></td>' % (base)) html.write('<td>GT\n<img src="%s" width=640></td>' % (base))
html.write('<td>PPOCRV2\n<img src="%s" width=640></td>' % html.write('<td>PPOCRV2\n<img src="%s" width=640></td>' % (base_2))
(base_2))
html.write('<td>ppocr_mobile\n<img src="%s" width=640></td>' % html.write('<td>ppocr_mobile\n<img src="%s" width=640></td>' %
(base_3)) (base_3))
...@@ -41,7 +52,6 @@ def draw_debug_img(html_path): ...@@ -41,7 +52,6 @@ def draw_debug_img(html_path):
html.write('</table>\n') html.write('</table>\n')
html.write('</html>\n</body>\n') html.write('</html>\n</body>\n')
print("ok") print("ok")
#print("all cnt: {}, err cnt: {}, acc: {}".format(len(imgs), err_cnt, 1.0 * (len(imgs) - err_cnt) / len(imgs)))
return 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 os
import re import re
import sys import sys
# import Polygon
import shapely import shapely
from shapely.geometry import Polygon from shapely.geometry import Polygon
import numpy as np import numpy as np
...@@ -10,9 +22,6 @@ from collections import defaultdict ...@@ -10,9 +22,6 @@ from collections import defaultdict
import operator import operator
import editdistance import editdistance
# reload(sys)
# sys.setdefaultencoding('utf-8')
def strQ2B(ustring): def strQ2B(ustring):
rstring = "" rstring = ""
...@@ -59,7 +68,7 @@ def ed(str1, str2): ...@@ -59,7 +68,7 @@ def ed(str1, str2):
return editdistance.eval(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...') print('start testing...')
iou_thresh = 0.5 iou_thresh = 0.5
val_names = os.listdir(gt_dir) val_names = os.listdir(gt_dir)
...@@ -125,8 +134,10 @@ def e2e_eval(gt_dir, res_dir): ...@@ -125,8 +134,10 @@ def e2e_eval(gt_dir, res_dir):
if gt_match[index_gt] == False and dt_match[index_dt] == False: if gt_match[index_gt] == False and dt_match[index_dt] == False:
gt_match[index_gt] = True gt_match[index_gt] = True
dt_match[index_dt] = True dt_match[index_dt] = True
# gt_str = strQ2B(gts[index_gt][8]).replace(" ", "") if ignore_blank:
# dt_str = strQ2B(dts[index_dt][8]).replace(" ", "") gt_str = strQ2B(gts[index_gt][8]).replace(" ", "")
dt_str = strQ2B(dts[index_dt][8]).replace(" ", "")
else:
gt_str = strQ2B(gts[index_gt][8]) gt_str = strQ2B(gts[index_gt][8])
dt_str = strQ2B(dts[index_dt][8]) dt_str = strQ2B(dts[index_dt][8])
if ignore_masks[index_gt] == '0': if ignore_masks[index_gt] == '0':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册