149b0899 by 周伟奇

slice part 2

1 parent 59da79a4
...@@ -341,11 +341,11 @@ def ca_compare_license(license_en, ocr_res_dict, field_list): ...@@ -341,11 +341,11 @@ def ca_compare_license(license_en, ocr_res_dict, field_list):
341 else: 341 else:
342 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str 342 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str
343 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value 343 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
344 result_field_list.append((name, value, result, ocr_str, img_path, error_type)) 344 result_field_list.append((name, value, result, ocr_str, position_img_path, img_path, error_type))
345 345
346 if not is_find: 346 if not is_find:
347 for name, value in field_list: 347 for name, value in field_list:
348 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value)) 348 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, empty_str, ErrorType.NF.value))
349 349
350 return result_field_list 350 return result_field_list
351 351
...@@ -364,7 +364,7 @@ def ca_compare_process(compare_info, ocr_res_dict): ...@@ -364,7 +364,7 @@ def ca_compare_process(compare_info, ocr_res_dict):
364 for license_dict in license_list: 364 for license_dict in license_list:
365 for license_en, field_list in license_dict.items(): 365 for license_en, field_list in license_dict.items():
366 result_field_list = ca_compare_license(license_en, ocr_res_dict, field_list) 366 result_field_list = ca_compare_license(license_en, ocr_res_dict, field_list)
367 for name, value, result, ocr_str, img_path, error_type in result_field_list: 367 for name, value, result, ocr_str, position_img_path, img_path, error_type in result_field_list:
368 total_fields += 1 368 total_fields += 1
369 if result == consts.RESULT_N: 369 if result == consts.RESULT_N:
370 failed_count += 1 370 failed_count += 1
...@@ -377,7 +377,7 @@ def ca_compare_process(compare_info, ocr_res_dict): ...@@ -377,7 +377,7 @@ def ca_compare_process(compare_info, ocr_res_dict):
377 consts.HEAD_LIST[4]: value, 377 consts.HEAD_LIST[4]: value,
378 consts.HEAD_LIST[5]: ocr_str, 378 consts.HEAD_LIST[5]: ocr_str,
379 consts.HEAD_LIST[6]: result, 379 consts.HEAD_LIST[6]: result,
380 consts.HEAD_LIST[7]: empty_str, 380 consts.HEAD_LIST[7]: position_img_path,
381 consts.HEAD_LIST[8]: img_path, 381 consts.HEAD_LIST[8]: img_path,
382 consts.HEAD_LIST[9]: error_type, 382 consts.HEAD_LIST[9]: error_type,
383 } 383 }
...@@ -385,7 +385,7 @@ def ca_compare_process(compare_info, ocr_res_dict): ...@@ -385,7 +385,7 @@ def ca_compare_process(compare_info, ocr_res_dict):
385 else: 385 else:
386 for license_en, field_list in info_value.items(): 386 for license_en, field_list in info_value.items():
387 result_field_list = ca_compare_license(license_en, ocr_res_dict, field_list) 387 result_field_list = ca_compare_license(license_en, ocr_res_dict, field_list)
388 for name, value, result, ocr_str, img_path, error_type in result_field_list: 388 for name, value, result, ocr_str, position_img_path, img_path, error_type in result_field_list:
389 total_fields += 1 389 total_fields += 1
390 if result == consts.RESULT_N: 390 if result == consts.RESULT_N:
391 failed_count += 1 391 failed_count += 1
...@@ -398,7 +398,7 @@ def ca_compare_process(compare_info, ocr_res_dict): ...@@ -398,7 +398,7 @@ def ca_compare_process(compare_info, ocr_res_dict):
398 consts.HEAD_LIST[4]: value, 398 consts.HEAD_LIST[4]: value,
399 consts.HEAD_LIST[5]: ocr_str, 399 consts.HEAD_LIST[5]: ocr_str,
400 consts.HEAD_LIST[6]: result, 400 consts.HEAD_LIST[6]: result,
401 consts.HEAD_LIST[7]: empty_str, 401 consts.HEAD_LIST[7]: position_img_path,
402 consts.HEAD_LIST[8]: img_path, 402 consts.HEAD_LIST[8]: img_path,
403 consts.HEAD_LIST[9]: error_type, 403 consts.HEAD_LIST[9]: error_type,
404 } 404 }
...@@ -1116,13 +1116,13 @@ def se_compare_license(license_en, ocr_res_dict, field_list): ...@@ -1116,13 +1116,13 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
1116 1116
1117 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str 1117 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str
1118 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value 1118 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
1119 result_field_list.append((name, value, result, ocr_str, img_path, error_type)) 1119 result_field_list.append((name, value, result, ocr_str, position_img_path, img_path, error_type))
1120 else: 1120 else:
1121 no_ocr_result = True 1121 no_ocr_result = True
1122 1122
1123 if not is_find: 1123 if not is_find:
1124 for name, value in field_list: 1124 for name, value in field_list:
1125 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value)) 1125 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, empty_str, ErrorType.NF.value))
1126 1126
1127 return result_field_list, no_ocr_result 1127 return result_field_list, no_ocr_result
1128 1128
...@@ -1184,11 +1184,12 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): ...@@ -1184,11 +1184,12 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list):
1184 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2]) 1184 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
1185 img_path = ocr_res.get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str 1185 img_path = ocr_res.get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str
1186 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value 1186 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
1187 result_field_list.append((name, value, result, ocr_str, img_path, error_type)) 1187 position_img_path = empty_str
1188 result_field_list.append((name, value, result, ocr_str, position_img_path, img_path, error_type))
1188 1189
1189 if not is_find: 1190 if not is_find:
1190 for name, value in field_list: 1191 for name, value in field_list:
1191 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value)) 1192 result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, empty_str, ErrorType.NF.value))
1192 1193
1193 return result_field_list 1194 return result_field_list
1194 1195
...@@ -1211,7 +1212,7 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1211,7 +1212,7 @@ def se_compare_process(compare_info, ocr_res_dict):
1211 for license_en, field_list in license_dict.items(): 1212 for license_en, field_list in license_dict.items():
1212 failure_field = [] 1213 failure_field = []
1213 result_field_list, no_ocr_result = se_compare_license(license_en, ocr_res_dict, field_list) 1214 result_field_list, no_ocr_result = se_compare_license(license_en, ocr_res_dict, field_list)
1214 for name, value, result, ocr_str, img_path, error_type in result_field_list: 1215 for name, value, result, ocr_str, position_img_path, img_path, error_type in result_field_list:
1215 if license_en not in consts.SKIP_CARD or not no_ocr_result: 1216 if license_en not in consts.SKIP_CARD or not no_ocr_result:
1216 total_fields += 1 1217 total_fields += 1
1217 if result == consts.RESULT_N: 1218 if result == consts.RESULT_N:
...@@ -1227,7 +1228,7 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1227,7 +1228,7 @@ def se_compare_process(compare_info, ocr_res_dict):
1227 consts.HEAD_LIST[4]: value, 1228 consts.HEAD_LIST[4]: value,
1228 consts.HEAD_LIST[5]: ocr_str, 1229 consts.HEAD_LIST[5]: ocr_str,
1229 consts.HEAD_LIST[6]: result, 1230 consts.HEAD_LIST[6]: result,
1230 consts.HEAD_LIST[7]: empty_str, 1231 consts.HEAD_LIST[7]: position_img_path,
1231 consts.HEAD_LIST[8]: img_path, 1232 consts.HEAD_LIST[8]: img_path,
1232 consts.HEAD_LIST[9]: error_type, 1233 consts.HEAD_LIST[9]: error_type,
1233 } 1234 }
...@@ -1241,7 +1242,7 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1241,7 +1242,7 @@ def se_compare_process(compare_info, ocr_res_dict):
1241 result_field_list = se_mvc34_compare(license_en, ocr_res_dict, field_list) 1242 result_field_list = se_mvc34_compare(license_en, ocr_res_dict, field_list)
1242 else: 1243 else:
1243 result_field_list, _ = se_compare_license(license_en, ocr_res_dict, field_list) 1244 result_field_list, _ = se_compare_license(license_en, ocr_res_dict, field_list)
1244 for name, value, result, ocr_str, img_path, error_type in result_field_list: 1245 for name, value, result, ocr_str, position_img_path, img_path, error_type in result_field_list:
1245 total_fields += 1 1246 total_fields += 1
1246 if result == consts.RESULT_N: 1247 if result == consts.RESULT_N:
1247 failed_count += 1 1248 failed_count += 1
...@@ -1256,7 +1257,7 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1256,7 +1257,7 @@ def se_compare_process(compare_info, ocr_res_dict):
1256 consts.HEAD_LIST[4]: value, 1257 consts.HEAD_LIST[4]: value,
1257 consts.HEAD_LIST[5]: ocr_str, 1258 consts.HEAD_LIST[5]: ocr_str,
1258 consts.HEAD_LIST[6]: result, 1259 consts.HEAD_LIST[6]: result,
1259 consts.HEAD_LIST[7]: empty_str, 1260 consts.HEAD_LIST[7]: position_img_path,
1260 consts.HEAD_LIST[8]: img_path, 1261 consts.HEAD_LIST[8]: img_path,
1261 consts.HEAD_LIST[9]: error_type, 1262 consts.HEAD_LIST[9]: error_type,
1262 } 1263 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!