Update: Imei with maximum 14 characters

This commit is contained in:
TannedCung 2024-07-22 10:34:43 +07:00
parent c015d2e70e
commit 6f86b76d01
2 changed files with 7 additions and 1 deletions

View File

@ -307,4 +307,6 @@ REASON_SOLUTION_MAP = {"Invalid image": "Remove this image from the evaluation r
"Handwritten": "Remove this image from the evaluation report",
"Wrong feedback": "Update revised resutl and re-calculate accuracy",
"Ocr cannot extract": "Improve OCR",
}
}
IMEI_MAX_LENGHT = 14

View File

@ -5,6 +5,7 @@ import time
import json
import glob
import shutil
from django.conf import settings
import pandas as pd
from tqdm import tqdm
from pathlib import Path
@ -64,6 +65,9 @@ def post_processing_str(class_name: str, s: str, is_gt: bool, sub: str) -> str:
s = convert_datetime_format(s)
if class_name == "retailername":
s = normalise_retailer_name(s, sub)
if class_name == "imei_number" and isinstance(s, str):
if len(s) > settings.IMEI_MAX_LENGHT:
s = s[:settings.IMEI_MAX_LENGHT]
return s