优化测试功能

This commit is contained in:
2024-07-30 10:54:40 +08:00
parent 9e0e3d0e7d
commit ecf26c1bf6
3 changed files with 7 additions and 2 deletions

View File

@@ -12,4 +12,6 @@ if __name__ == '__main__':
for ocr_error in ocr_errors: for ocr_error in ocr_errors:
image = check_error(ocr_error) image = check_error(ocr_error)
if image is None:
continue
cv2.imwrite(f"./mask_optimization_result/{ocr_error.cfjaddress}.jpg", image) cv2.imwrite(f"./mask_optimization_result/{ocr_error.cfjaddress}.jpg", image)

View File

@@ -14,6 +14,8 @@ def check_error(error_ocr):
if not img_url: if not img_url:
# 没有自动涂抹的图片 # 没有自动涂抹的图片
img_url = ufile.get_private_url(error_ocr.cfjaddress, "drg103") img_url = ufile.get_private_url(error_ocr.cfjaddress, "drg103")
if not img_url:
return None
name = error_ocr.cXm name = error_ocr.cXm
id_card_num = error_ocr.cSfzh id_card_num = error_ocr.cSfzh

View File

@@ -64,7 +64,8 @@ def visual_model_test(model_type, test_img, task_path, schema):
temp_files_paths.append(temp_file.name) temp_files_paths.append(temp_file.name)
parsed_doc = util.get_ocr_layout( 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) temp_file.name)
# parsed_doc = doc_parser.parse({"doc": temp_file.name})["layout"] # parsed_doc = doc_parser.parse({"doc": temp_file.name})["layout"]
if img["x_offset"] or img["y_offset"]: if img["x_offset"] or img["y_offset"]:
@@ -150,7 +151,7 @@ def main(model_type, pic_name=None):
if __name__ == '__main__': if __name__ == '__main__':
main("ocr", "PH20240727000461_1_085531_1.PNG.jpg") main("ocr")
# main("settlement") # main("settlement")
# main("discharge") # main("discharge")
# main("cost") # main("cost")