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