From 88666ccf889af7de61c8f23c29cb721ca111bec1 Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Mon, 24 Jun 2024 14:26:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4ocr=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- visual_model_test/visual_model_test.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/visual_model_test/visual_model_test.py b/visual_model_test/visual_model_test.py index f9bdb6f..7054e39 100644 --- a/visual_model_test/visual_model_test.py +++ b/visual_model_test/visual_model_test.py @@ -46,20 +46,18 @@ def visual_model_test(model_type, test_img, task_path, schema): imgs = split_image(test_img) layout = [] temp_files_paths = [] - doc_parser = DocParser(layout_analysis=False) for img in imgs: with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as temp_file: cv2.imwrite(temp_file.name, img["img"]) temp_files_paths.append(temp_file.name) - parsed_doc = doc_parser.parse({"doc": temp_file.name}, expand_to_a4_size=True) + ocr_layout = get_ocr_layout(temp_file.name) if img["x_offset"] or img["y_offset"]: - for p in parsed_doc["layout"]: - box = p[0] + for box in ocr_layout: box[0] += img["x_offset"] box[1] += img["y_offset"] box[2] += img["x_offset"] box[3] += img["y_offset"] - layout += parsed_doc["layout"] + layout += ocr_layout write_visual_result(test_img, layout=layout) else: