现阶段布局分析可能会反优化,暂不开启
This commit is contained in:
@@ -12,3 +12,6 @@ SEND_ERROR_EMAIL = True
|
||||
|
||||
# 信息抽取批量处理大小
|
||||
IE_BATCH_SIZE = 4
|
||||
|
||||
# 是否开启布局分析
|
||||
LAYOUT_ANALYSIS = False
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user