完善table模型识别表格内容不准确的问题

master
tyc 6 months ago
parent 64cfbd851e
commit cbf03cd9fd
  1. 17
      yudao-server/src/main/java/cn/iocoder/yudao/server/service/SupervisionService.java

@ -103,6 +103,7 @@ public class SupervisionService {
List<EquipmentRegistryRespVO> equipmentRegistryRespVOS = new ArrayList<>();
for (OcrResponseVo.TableRecResult result : tableRecResults) {
List<String> texts = new ArrayList<>();
int isTableOcrPred = 0;
//表格返回参数table_res_list
if (CollectionUtil.isNotEmpty(result.getPrunedResult().getTable_res_list()) && result.getPrunedResult().getTable_res_list().size() == 1) {
texts = result.getPrunedResult().getTable_res_list().get(0).getTable_ocr_pred().getRec_texts();
@ -112,6 +113,7 @@ public class SupervisionService {
texts = rec_texts;
}
} else {
isTableOcrPred = 1;
texts = result.getPrunedResult().getOverall_ocr_res().getRec_texts();
}
EquipmentRegistryRespVO equipmentRegistryRespVO = null;
@ -135,6 +137,21 @@ public class SupervisionService {
}
equipmentRegistryRespVO.setType("certificateOfApproval");
equipmentRegistryRespVOS.add(equipmentRegistryRespVO);
} else {
if (isTableOcrPred == 0) {
//处理table_ocr_pred识别不准确,采用overall_ocr_res的识别结果来处理
List<String> textsNew = new ArrayList<>();
textsNew = result.getPrunedResult().getOverall_ocr_res().getRec_texts();
CertificateOfApproval = textsNew.stream().anyMatch(t -> t.contains("安装合格证") || t.contains("安装单位") || t.contains("安装单位名称") || t.contains("减压器编号") || t.contains("安装检验合格证") || t.contains("安装企业名称"));
if (CertificateOfApproval) {
equipmentRegistryRespVO = certificateOfApprovalService.getCertificateOfApproval(textsNew, postfix);
if (null == equipmentRegistryRespVO) {
continue;
}
equipmentRegistryRespVO.setType("certificateOfApproval");
equipmentRegistryRespVOS.add(equipmentRegistryRespVO);
}
}
}
//车用气瓶产品合格证
boolean productQualified = texts.stream().anyMatch(t -> t.contains("产品合格证") || t.contains("气密性试验压力") || t.contains("气密试验压力") || t.contains("气瓶重量")

Loading…
Cancel
Save