MCPcopy Create free account
hub / github.com/MichaelHL-ai/OCR_EVALUATION / validate_data

Function validate_data

Algorithm_DetEva.py:39–58  ·  view source on GitHub ↗

Method validate_data: validates that all files in the results folder are correct (have the correct name contents). Validates also that there are no missing files in the folder. If some error detected, the method raises the error

(gtFilePath, submFilePath, evaluationParams)

Source from the content-addressed store, hash-verified

37
38
39def validate_data(gtFilePath, submFilePath, evaluationParams):
40 """
41 Method validate_data: validates that all files in the results folder are correct (have the correct name contents).
42 Validates also that there are no missing files in the folder.
43 If some error detected, the method raises the error
44 """
45 gt = rrc_evaluation_funcs.load_zip_file(gtFilePath, evaluationParams['GT_SAMPLE_NAME_2_ID'])
46
47 subm = rrc_evaluation_funcs.load_zip_file(submFilePath, evaluationParams['DET_SAMPLE_NAME_2_ID'], True)
48
49 # Validate format of GroundTruth
50 for k in gt:
51 rrc_evaluation_funcs.validate_lines_in_file(k, gt[k], evaluationParams['CRLF'], True, True)
52
53 # Validate format of results
54 for k in subm:
55 if (k in gt) == False:
56 raise Exception("The sample %s not present in GT" % k)
57
58 rrc_evaluation_funcs.validate_lines_in_file(k, subm[k], evaluationParams['CRLF'], True, True)
59
60
61def evaluate_method(gtFilePath, submFilePath, evaluationParams):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected