From a804a97c92a26dc1455e6cdfebf201f426511712 Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Wed, 2 Dec 2020 15:55:15 +0800 Subject: [PATCH] add drop_score to args --- tools/infer/utility.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/infer/utility.py b/tools/infer/utility.py index 1d8cf22a..ee1f954d 100755 --- a/tools/infer/utility.py +++ b/tools/infer/utility.py @@ -71,6 +71,7 @@ def parse_args(): parser.add_argument("--use_space_char", type=str2bool, default=True) parser.add_argument( "--vis_font_path", type=str, default="./doc/simfang.ttf") + parser.add_argument("--drop_score", type=float, default=0.5) # params for text classifier parser.add_argument("--use_angle_cls", type=str2bool, default=False) @@ -229,10 +230,10 @@ def draw_ocr_box_txt(image, box[2][1], box[3][0], box[3][1] ], outline=color) - box_height = math.sqrt((box[0][0] - box[3][0])**2 + (box[0][1] - box[3][ - 1])**2) - box_width = math.sqrt((box[0][0] - box[1][0])**2 + (box[0][1] - box[1][ - 1])**2) + box_height = math.sqrt((box[0][0] - box[3][0]) ** 2 + (box[0][1] - box[3][ + 1]) ** 2) + box_width = math.sqrt((box[0][0] - box[1][0]) ** 2 + (box[0][1] - box[1][ + 1]) ** 2) if box_height > 2 * box_width: font_size = max(int(box_width * 0.9), 10) font = ImageFont.truetype(font_path, font_size, encoding="utf-8") -- GitLab