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))