From 2e03863fc82d0736ef64fa9c97d7d88678b6b05f Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Tue, 18 Jun 2024 17:16:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E9=98=B6=E6=AE=B5=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=88=86=E6=9E=90=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=8F=8D=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E6=9A=82=E4=B8=8D=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/photo_review.py | 3 +++ photo_review/__init__.py | 10 ++++++---- visual_model_test/visual_model_test.py | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config/photo_review.py b/config/photo_review.py index fbdd783..4dcbb17 100644 --- a/config/photo_review.py +++ b/config/photo_review.py @@ -12,3 +12,6 @@ SEND_ERROR_EMAIL = True # 信息抽取批量处理大小 IE_BATCH_SIZE = 4 + +# 是否开启布局分析 +LAYOUT_ANALYSIS = False diff --git a/photo_review/__init__.py b/photo_review/__init__.py index 1f3b3e0..01fea81 100644 --- a/photo_review/__init__.py +++ b/photo_review/__init__.py @@ -2,22 +2,24 @@ from paddlenlp import Taskflow from config.keys import PATIENT_NAME, ADMISSION_DATE, DISCHARGE_DATE, MEDICAL_EXPENSES, PERSONAL_CASH_PAYMENT, \ PERSONAL_ACCOUNT_PAYMENT, PERSONAL_FUNDED_AMOUNT, MEDICAL_INSURANCE_TYPE, HOSPITAL, DEPARTMENT, DOCTOR -from config.photo_review import IE_BATCH_SIZE +from config.photo_review import IE_BATCH_SIZE, LAYOUT_ANALYSIS # 基本医保结算单 settlement_list_schema = \ PATIENT_NAME + ADMISSION_DATE + DISCHARGE_DATE + MEDICAL_EXPENSES + PERSONAL_CASH_PAYMENT \ + PERSONAL_ACCOUNT_PAYMENT + PERSONAL_FUNDED_AMOUNT + MEDICAL_INSURANCE_TYPE settlement_ie = Taskflow("information_extraction", schema=settlement_list_schema, model="uie-x-base", - task_path="config/model/settlement_list_model", layout_analysis=True, batch_size=IE_BATCH_SIZE) + task_path="config/model/settlement_list_model", layout_analysis=LAYOUT_ANALYSIS, + batch_size=IE_BATCH_SIZE) # 出院记录 discharge_record_schema = \ HOSPITAL + DEPARTMENT + PATIENT_NAME + ADMISSION_DATE + DISCHARGE_DATE + DOCTOR discharge_ie = Taskflow("information_extraction", schema=discharge_record_schema, model="uie-x-base", - task_path="config/model/discharge_record_model", layout_analysis=True, batch_size=IE_BATCH_SIZE) + task_path="config/model/discharge_record_model", layout_analysis=LAYOUT_ANALYSIS, + batch_size=IE_BATCH_SIZE) # 费用清单 cost_list_schema = PATIENT_NAME + ADMISSION_DATE + DISCHARGE_DATE + MEDICAL_EXPENSES cost_ie = Taskflow("information_extraction", schema=cost_list_schema, model="uie-x-base", - task_path="config/model/cost_list_model", layout_analysis=True, batch_size=IE_BATCH_SIZE) + task_path="config/model/cost_list_model", layout_analysis=LAYOUT_ANALYSIS, batch_size=IE_BATCH_SIZE) diff --git a/visual_model_test/visual_model_test.py b/visual_model_test/visual_model_test.py index 276d856..39b0729 100644 --- a/visual_model_test/visual_model_test.py +++ b/visual_model_test/visual_model_test.py @@ -44,7 +44,7 @@ def visual_model_test(model_type, test_img, task_path, schema): write_visual_result(test_img, layout=parsed_doc["layout"]) else: my_ie = Taskflow("information_extraction", schema=schema, model="uie-x-base", task_path=task_path, - layout_analysis=True) + layout_analysis=False) my_results = my_ie({"doc": test_img}) write_visual_result(test_img, result=my_results[0]) @@ -74,7 +74,7 @@ def main(model_type, pic_name=None): schema = ["患者姓名", "入院日期", "出院日期", "费用总额", "个人现金支付", "个人账户支付", "自费金额", "医保类型"] elif model_type == "discharge": task_path = "../config/model/discharge_record_model" - test_img_path = ucloud.get_private_url(pic_name) if pic_name else "img/PH20240428000832_1_093844_2.jpg" + test_img_path = ucloud.get_private_url(pic_name) if pic_name else "img/PH20240401000003_3_001938_2.jpg" schema = ["医院", "科室", "患者姓名", "入院日期", "出院日期", "主治医生"] elif model_type == "cost": task_path = "../config/model/cost_list_model"