From ecf26c1bf6a73ce32c84a793f57dc96ca2c141dc Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Tue, 30 Jul 2024 10:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- photo_mask_batch_error_check.py | 2 ++ photo_mask_error_check.py | 2 ++ visual_model_test/visual_model_test.py | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/photo_mask_batch_error_check.py b/photo_mask_batch_error_check.py index b077bca..e7ad757 100644 --- a/photo_mask_batch_error_check.py +++ b/photo_mask_batch_error_check.py @@ -12,4 +12,6 @@ if __name__ == '__main__': for ocr_error in ocr_errors: image = check_error(ocr_error) + if image is None: + continue cv2.imwrite(f"./mask_optimization_result/{ocr_error.cfjaddress}.jpg", image) diff --git a/photo_mask_error_check.py b/photo_mask_error_check.py index 4459896..870202c 100644 --- a/photo_mask_error_check.py +++ b/photo_mask_error_check.py @@ -14,6 +14,8 @@ def check_error(error_ocr): if not img_url: # 没有自动涂抹的图片 img_url = ufile.get_private_url(error_ocr.cfjaddress, "drg103") + if not img_url: + return None name = error_ocr.cXm id_card_num = error_ocr.cSfzh diff --git a/visual_model_test/visual_model_test.py b/visual_model_test/visual_model_test.py index 8fbddf7..6fe71d3 100644 --- a/visual_model_test/visual_model_test.py +++ b/visual_model_test/visual_model_test.py @@ -64,7 +64,8 @@ def visual_model_test(model_type, test_img, task_path, schema): temp_files_paths.append(temp_file.name) parsed_doc = util.get_ocr_layout( - PaddleOCR(det_db_box_thresh=0.3, det_db_thresh=0.1, det_limit_side_len=1248, drop_score=0.3), + PaddleOCR(det_db_box_thresh=0.3, det_db_thresh=0.1, det_limit_side_len=1248, drop_score=0.3, + save_crop_res=False), temp_file.name) # parsed_doc = doc_parser.parse({"doc": temp_file.name})["layout"] if img["x_offset"] or img["y_offset"]: @@ -150,7 +151,7 @@ def main(model_type, pic_name=None): if __name__ == '__main__': - main("ocr", "PH20240727000461_1_085531_1.PNG.jpg") + main("ocr") # main("settlement") # main("discharge") # main("cost")