From 445d57e8c6283af4923118ad712cd7cfe364a8c4 Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Tue, 15 Oct 2024 14:21:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=B9=E5=90=91=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=9A=84=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- photo_review/auto_photo_review.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/photo_review/auto_photo_review.py b/photo_review/auto_photo_review.py index 8e938f9..a9ac3e1 100644 --- a/photo_review/auto_photo_review.py +++ b/photo_review/auto_photo_review.py @@ -140,6 +140,7 @@ def information_extraction(phrec, pk_phhd): dewarped_img_path = img_path angles = model_util.clas_orientation(dewarped_img_path) ocr_result = [] + ocr_text = '' rotated_img = None for angle in angles: tmp_ocr_result = [] @@ -150,10 +151,12 @@ def information_extraction(phrec, pk_phhd): continue a4_img = image_util.expand_to_a4_size(split_result['img']) tmp_ocr_result += model_util.ocr(a4_img) - if len(tmp_ocr_result) > len(ocr_result): + tmp_ocr_text = common_util.ocr_result_to_text(tmp_ocr_result) + + if len(tmp_ocr_text) > len(ocr_text): ocr_result = tmp_ocr_result + ocr_text = tmp_ocr_text rotated_img = tmp_rotated_img - ocr_text = common_util.ocr_result_to_text(ocr_result) rec_type = model_util.clas_text(ocr_text) if ocr_text else None if rec_type == '基本医保结算单': info_extract = model_util.ie_settlement(rotated_img, common_util.ocr_result_to_layout(ocr_result))