diff --git a/tools/end2end/draw_html.py b/tools/end2end/draw_html.py index 7b094c01a04fdc8a8a73ce55aff479eca5ee2f0f..fcac8ad3bfb6f0d1fcc48ea026b0febe60a001c0 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("