From ea0ff9c340f29cc0fbc180ba781b03a2093ded46 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Fri, 25 Mar 2022 15:04:56 +0800 Subject: [PATCH] fix html --- tools/end2end/draw_html.py | 41 ++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/tools/end2end/draw_html.py b/tools/end2end/draw_html.py index 7b094c01..fcac8ad3 100644 --- a/tools/end2end/draw_html.py +++ b/tools/end2end/draw_html.py @@ -13,9 +13,29 @@ # limitations under the License. import os +import argparse -def draw_debug_img(html_path): +def str2bool(v): + return v.lower() in ("true", "t", "1") + + +def init_args(): + parser = argparse.ArgumentParser() + parser.add_argument("--image_dir", type=str, default="") + parser.add_argument("--save_html_path", type=str, default="./default.html") + parser.add_argument("--width", type=int, default=640) + return parser + + +def parse_args(): + parser = init_args() + return parser.parse_args() + + +def draw_debug_img(args): + + html_path = args.save_html_path err_cnt = 0 with open(html_path, 'w') as html: @@ -25,23 +45,14 @@ def draw_debug_img(html_path): "" ) image_list = [] - path = "./det_results/310_gt/" + path = args.image_dir for i, filename in enumerate(sorted(os.listdir(path))): if filename.endswith("txt"): continue - print(filename) # The image path base = "{}/{}".format(path, filename) - base_2 = "../PaddleOCR/det_results/ch_PPOCRV2_infer/{}".format( - filename) - base_3 = "../PaddleOCR/det_results/ch_ppocr_mobile_infer/{}".format( - filename) - html.write("\n") html.write(f' {filename}\n GT') - html.write('GT\n' % (base)) - html.write('PPOCRV2\n' % (base_2)) - html.write('ppocr_mobile\n' % - (base_3)) + html.write(f'GT\n') html.write("\n") html.write('\n') html.write('\n') html.write('\n\n') - print("ok") + print(f"The html file saved in {html_path}") return if __name__ == "__main__": - html_path = "sys_visual_iou_310.html" + args = parse_args() - draw_debug_img() + draw_debug_img(args) -- GitLab