Optical character recognition test method, device, readable storage medium and terminal equipment
By generating and marking OCR test data and automatically comparing the recognition results, the problem of inefficiency of traditional OCR test methods is solved, and efficient and accurate recognition accuracy testing is achieved.
Patent Information
- Application Number
- CN202011019006.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-24
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-09-24
AI Technical Summary
Traditional OCR testing methods are workload-intensive, time-consuming, error-prone, and have low testing efficiency.
Generate OCR test data by generating preset data templates and parameter configuration information, and mark corresponding tags. The test data is input into the OCR engine for recognition, and the recognition results are automatically compared to determine the recognition accuracy, including determination of the position and form of the data template, and ID Generation, label determination, recognition result comparison and accuracy calculation.
The automated OCR testing process has been implemented, reducing testing workload, shortening time-consuming, avoiding human errors, and significantly improving testing efficiency.
Smart Images

Figure CN112287936B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and in particular, relates to an optical character recognition test method, device, computer-readable storage medium and terminal device. Background Art
[0002] Optical Character Recognition (OCR) refers to the process of analyzing and identifying image files of text data to obtain text and layout information, that is, recognizing the text in the image and returning it in the form of text. At present, many industries such as banking, insurance, finance, taxation, customs, public security, border inspection, logistics, telecommunications, industrial and commercial management, libraries, household registration management, and auditing have applied OCR technology. OCR technology reduces labor costs and improves work efficiency.
[0003] The recognition accuracy of the OCR engine is an important indicator to measure the performance of the OCR engine. The traditional test method of the recognition accuracy of the OCR engine is mainly done manually, which is labor-intensive, time-consuming, error-prone and inefficient. Summary of the invention
[0004] In view of this, the embodiments of the present application provide an OCR testing method, apparatus, computer-readable storage medium and terminal device to solve the problems of existing OCR testing methods such as large workload, long time consumption, prone to errors and low testing efficiency.
[0005] A first aspect of an embodiment of the present application provides an OCR testing method, which may include:
[0006] Generate OCR test data according to the preset data template and parameter configuration information, and mark the label corresponding to the OCR test data;
[0007] Input the OCR test data into a preset OCR engine for recognition, and obtain the recognition result output by the OCR engine;
[0008] The recognition result is compared with the label, and the recognition accuracy of the OCR engine is determined according to the comparison result.
[0009] Furthermore, generating OCR test data according to the preset data template and parameter configuration information may include:
[0010] Determine the position to be filled in the data template and the filling form according to the parameter configuration information;
[0011] Generate an ID according to the parameter configuration information;
[0012] Fill the ID into the to-be-filled position in the data template according to the filling form to generate the OCR test data.
[0013] Further, generating an ID according to the parameter configuration information may include:
[0014] Read the ID length and the continuous indication parameter in the parameter configuration information;
[0015] If the continuous indication parameter is a preset first value, generating continuous IDs that meet the ID length;
[0016] If the continuous indication parameter is a preset second value, the number of IDs in the parameter configuration information is read; and according to the number of IDs, an ID that meets the ID length is randomly generated.
[0017] Furthermore, the label corresponding to the OCR test data may include:
[0018] The ID is marked as a label corresponding to the OCR test data.
[0019] Furthermore, comparing the recognition result with the label may include:
[0020] determining the length of the label;
[0021] Extracting continuous digital strings from the recognition results, and determining the length of each extracted digital string;
[0022] Selecting equal-length digital strings according to the length of each digital string, wherein the equal-length digital strings are consistent with the length of the label;
[0023] Compare each selected digital string of equal length with the label to determine whether there is a digital string of equal length as the label;
[0024] If there is a digital string of the same length as the label, it is determined that the OCR engine has recognized it correctly;
[0025] If there is no digital string with the same length as the label, it is determined that the OCR engine has made a recognition error.
[0026] Furthermore, determining the recognition accuracy of the OCR engine according to the comparison result may include:
[0027] Counting a first number and a second number according to the comparison result, wherein the first number is the number of times the OCR engine recognizes correctly, and the second number is the number of times the OCR engine recognizes incorrectly;
[0028] The recognition accuracy of the OCR engine is calculated according to the first number of times and the second number of times.
[0029] A second aspect of an embodiment of the present application provides an OCR testing device, which may include:
[0030] A test data generation module, used to generate OCR test data according to a preset data template and parameter configuration information, and mark a label corresponding to the OCR test data;
[0031] A recognition module, used for inputting the OCR test data into a preset OCR engine for recognition, and obtaining a recognition result output by the OCR engine;
[0032] The recognition result comparison module is used to compare the recognition result with the label and determine the recognition accuracy of the OCR engine according to the comparison result.
[0033] Furthermore, the test data generation module may include:
[0034] A position and form determination unit, used to determine the position to be filled in and the filling form in the data template according to the parameter configuration information;
[0035] An ID generating unit, used to generate an ID according to the parameter configuration information;
[0036] The test data generating unit is used to fill in the ID into the to-be-filled position in the data template according to the filling form to generate the OCR test data.
[0037] Furthermore, the ID generation unit may include:
[0038] A parameter reading subunit, used to read the ID length and the continuous indication parameter in the parameter configuration information;
[0039] The first generating subunit is used to generate continuous IDs that meet the ID length if the continuous indication parameter is a preset first value.
[0040] The second generating subunit is used for reading the number of IDs in the parameter configuration information if the continuous indication parameter is a preset second value; and randomly generating an ID that meets the ID length according to the number of IDs.
[0041] Furthermore, the test data generation module may also include:
[0042] A label determination unit is used to mark the ID as a label corresponding to the OCR test data.
[0043] Furthermore, the recognition result comparison module may include:
[0044] A length determination unit, used to determine the length of the label;
[0045] A digital string extraction unit, used to extract continuous digital strings from the recognition result and determine the length of each extracted digital string;
[0046] An equal-length digital string selection unit, used to select equal-length digital strings according to the lengths of the respective digital strings, wherein the equal-length digital strings are consistent with the length of the labels;
[0047] A comparison unit, used to compare each selected equal-length digital string with the label, to determine whether there is an equal-length digital string as the label;
[0048] A first determination unit, configured to determine that the OCR engine has correctly identified the label if there is a digital string of the same length as the label;
[0049] The second determining unit is used to determine that the OCR engine has made a recognition error if there is no digital string with the same length as the label.
[0050] Furthermore, the recognition result comparison module may also include:
[0051] A result counting unit, used for counting a first number and a second number according to the comparison result, wherein the first number is the number of times the OCR engine recognizes correctly, and the second number is the number of times the OCR engine recognizes incorrectly;
[0052] A recognition accuracy calculation unit is used to calculate the recognition accuracy of the OCR engine according to the first number of times and the second number of times.
[0053] A third aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above OCR testing methods are implemented.
[0054] A fourth aspect of an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above-mentioned OCR testing methods when executing the computer program.
[0055] A fifth aspect of an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the steps of any one of the above-mentioned OCR testing methods.
[0056] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the embodiments of the present application generate OCR test data according to a preset data template and parameter configuration information, and mark the label corresponding to the OCR test data; input the OCR test data into a preset OCR engine for recognition, and obtain the recognition result output by the OCR engine; compare the recognition result with the label, and determine the recognition accuracy of the OCR engine according to the comparison result. Through the embodiments of the present application, test data can be automatically generated, the OCR engine can be automatically called to recognize test data, the results can be automatically compared, and the recognition accuracy of the OCR engine can be determined. Compared with the traditional test method that relies on manual work, the test workload is reduced, the test time is shortened, human-induced errors are avoided, and the test efficiency is greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0058] Figure 1 A schematic diagram of a scenario for identifying an ID card number;
[0059] Figure 2 A schematic diagram of a scenario for identifying a courier number;
[0060] Figure 3 A schematic diagram of a scenario for identifying the examination number on a hospital report;
[0061] Figure 4 This is a flow chart of an embodiment of an OCR testing method in an embodiment of the present application;
[0062] Figure 5 is a schematic diagram of a data template;
[0063] Figure 6 A schematic diagram for determining the position to be filled in the data template;
[0064] Figure 7 A schematic diagram of OCR test data stored in the form of an image file;
[0065] Figure 8 A schematic diagram of the specific contents of an image file;
[0066] Fig. 9 Schematic diagram of OCR test data generated in batches;
[0067] Fig.10A schematic diagram of the recognition result output by the OCR engine;
[0068] Fig.11 This is a structural diagram of an embodiment of an OCR testing device in an embodiment of the present application;
[0069] Fig.12 This is a schematic block diagram of a terminal device in an embodiment of the present application. DETAILED DESCRIPTION
[0070] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described below are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0071] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0072] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0073] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0074] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0075] In addition, in the description of the present application, the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0076] The embodiments of the present application can be applied to scenarios where various digital identifications (IDs) are recognized through an OCR engine, including but not limited to recognition of ID numbers (such as Figure 1 As shown), identify the express number (such as Figure 2 as shown), and identify the hospital report number (such as Figure 3 Specific scenarios such as those shown in the figure.
[0077] In these application scenarios, if the OCR engine can correctly identify the ID, it can be judged as correct. For example, if the 18 consecutive digits of the ID number "123456198206257890" are correctly identified, but the name, gender, ethnicity and other characters are not correctly identified, it will also be judged as correct. For another example, for a report form of a people's hospital, as long as the examination number "02742" can be successfully identified, it can be judged as correct.
[0078] See also Figure 4 , an embodiment of an optical character recognition test method in the embodiment of the present application may include:
[0079] Step S401: Generate OCR test data according to a preset data template and parameter configuration information, and mark a label corresponding to the OCR test data.
[0080] The data template can be set by the user according to the actual application scenario. Taking the scenario of identifying the examination number of the hospital report as an example, only the part of the hospital report that needs to be recognized by the OCR engine can be intercepted, and the information such as the examination number in the report can be overwritten to form a data template such as Figure 5 The data template shown.
[0081] The specific process of generating OCR test data may include:
[0082] Step S4011: determine the location to be filled in and the filling form in the data template according to the parameter configuration information.
[0083] The parameter configuration information may include specific filling forms such as fonts and font sizes, wherein the fonts may include common fonts such as Microsoft YaHei, Songti, Times New Rome, etc., and the font sizes may include 12, 14, 16, 18, 20, 24, etc.
[0084] The parameter configuration information may also include coordinate information such as the starting coordinates of the ID on the preset X-axis and the starting coordinates on the preset Y-axis. The position to be filled in the data template can be determined based on the coordinate information. Figure 6 As shown, the rectangular box in the figure is the determined position to be filled in.
[0085] Step S4012: Generate a digital identifier according to the parameter configuration information.
[0086] Specifically, the ID length and the continuous indication parameter in the parameter configuration information can be read respectively first. The ID length can be set according to actual conditions, for example, the ID length of an identity card is 18, and the ID length of a hospital report is 5.
[0087] The continuous indication parameter is used to indicate whether to generate IDs continuously. If the continuous indication parameter is a preset first value, continuous IDs that meet the ID length are generated. For example, when the ID length is 5, a maximum of 100,000 IDs can be continuously generated, from "00000", "00001", "00002" to "99998", "99999", totaling 100,000 IDs.
[0088] If the continuous indication parameter is a preset second value, the number of IDs in the parameter configuration information is read, and according to the number of IDs, an ID that meets the ID length is randomly generated. The number of IDs is a positive integer and can be set according to actual conditions. For example, when the number of IDs is 500, 500 IDs can be randomly generated.
[0089] The first value and the second value can be set according to actual conditions. For example, the first value can be set to 1 and the second value can be set to 0. Of course, other settings can also be made according to actual conditions, and the embodiments of the present application do not specifically limit this.
[0090] Step S4013: fill in the ID into the position to be filled in the data template according to the filling form to generate the OCR test data.
[0091] The OCR test data may be stored in the form of an image file, and the format of the image file may include common formats such as JPG, PNG, TIFF, BMP, etc. Preferably, the ID may be marked as a label corresponding to the OCR test data and used as the name of the corresponding image file. Figure 7 The figure shows a schematic diagram of OCR test data stored in the form of an image file. The specific content of the image file is as follows: Figure 8 As shown in the figure, the ID is 262715, so this image file is also named 262715 to facilitate subsequent comparison. Generally, OCR test data can be generated in batches. Fig. 9 The figure shows a schematic diagram of a batch of OCR test data.
[0092] Step S402: input the OCR test data into a preset OCR engine for recognition, and obtain the recognition result output by the OCR engine.
[0093] The OCR engine can be any OCR engine in the prior art, and its main function is to input an image and output a recognition result in the form of text. Figure 8 When the image is shown, the recognition result in text form is output as Fig.10 shown.
[0094] Step S403: compare the recognition result with the label, and determine the recognition accuracy of the OCR engine according to the comparison result.
[0095] The specific process of comparing the recognition results may include:
[0096] Step S4031, determine the length of the label.
[0097] Step S4032: extract continuous digital strings from the recognition results, and determine the length of each extracted digital string.
[0098] Step S4033: select digital strings of equal length according to the lengths of the respective digital strings.
[0099] The equal-length digital string is consistent with the length of the label.
[0100] Step S4034: compare the selected digital strings of equal length with the labels respectively.
[0101] Determine whether there is a digital string of equal length to the label. If there is a digital string of equal length to the label, determine that the OCR engine has recognized it correctly; if there is no digital string of equal length to the label, determine that the OCR engine has recognized it incorrectly.
[0102] For the OCR test data generated in batches, the image files can be read one by one. Each time an image is read, the OCR engine is called to recognize the image. After obtaining the recognition result, it can be compared with the name of the image (that is, the label) to obtain the comparison result. After traversing all the OCR test data, the first number and the second number can be counted according to the comparison results. The first number is the number of times the OCR engine recognizes correctly, and the second number is the number of times the OCR engine recognizes incorrectly. After completing the statistics, the recognition accuracy of the OCR engine can be calculated according to the following formula: Recognition accuracy = first number ÷ (first number + second number) × 100%.
[0103] In summary, the embodiment of the present application generates OCR test data according to a preset data template and parameter configuration information, and marks a label corresponding to the OCR test data; inputs the OCR test data into a preset OCR engine for recognition, and obtains the recognition result output by the OCR engine; compares the recognition result with the label, and determines the recognition accuracy of the OCR engine based on the comparison result. Through the embodiment of the present application, test data can be automatically generated, the OCR engine can be automatically called to recognize test data, the results can be automatically compared, and the recognition accuracy of the OCR engine can be determined. Compared with the traditional testing method that relies on manual work, the testing workload is reduced, the testing time is shortened, human-induced errors are avoided, and the testing efficiency is greatly improved.
[0104] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0105] Corresponding to an OCR testing method described in the above embodiment, Fig.11 A structural diagram of an embodiment of an OCR testing device provided in an embodiment of the present application is shown.
[0106] In this embodiment, an OCR testing device may include:
[0107] The test data generating module 1101 is used to generate OCR test data according to a preset data template and parameter configuration information, and mark a label corresponding to the OCR test data;
[0108] The recognition module 1102 is used to input the OCR test data into a preset OCR engine for recognition, and obtain the recognition result output by the OCR engine;
[0109] The recognition result comparison module 1103 is used to compare the recognition result with the label and determine the recognition accuracy of the OCR engine according to the comparison result.
[0110] Furthermore, the test data generation module may include:
[0111] A position and form determination unit, used to determine the position to be filled in and the filling form in the data template according to the parameter configuration information;
[0112] An ID generating unit, used to generate an ID according to the parameter configuration information;
[0113] The test data generating unit is used to fill in the ID into the to-be-filled position in the data template according to the filling form to generate the OCR test data.
[0114] Furthermore, the ID generation unit may include:
[0115] A parameter reading subunit, used to read the ID length and the continuous indication parameter in the parameter configuration information;
[0116] The first generating subunit is used to generate continuous IDs that meet the ID length if the continuous indication parameter is a preset first value.
[0117] The second generating subunit is used for reading the number of IDs in the parameter configuration information if the continuous indication parameter is a preset second value; and randomly generating an ID that meets the ID length according to the number of IDs.
[0118] Furthermore, the test data generation module may also include:
[0119] A label determination unit is used to mark the ID as a label corresponding to the OCR test data.
[0120] Furthermore, the recognition result comparison module may include:
[0121] A length determination unit, used to determine the length of the label;
[0122] A digital string extraction unit, used to extract continuous digital strings from the recognition result and determine the length of each extracted digital string;
[0123] An equal-length digital string selection unit, used to select equal-length digital strings according to the lengths of the respective digital strings, wherein the equal-length digital strings are consistent with the length of the labels;
[0124] A comparison unit, used to compare each selected equal-length digital string with the label, to determine whether there is an equal-length digital string as the label;
[0125] A first determination unit, configured to determine that the OCR engine has correctly identified the label if there is a digital string of the same length as the label;
[0126] The second determining unit is used to determine that the OCR engine has made a recognition error if there is no digital string with the same length as the label.
[0127] Furthermore, the recognition result comparison module may also include:
[0128] A result counting unit, used for counting a first number and a second number according to the comparison result, wherein the first number is the number of times the OCR engine recognizes correctly, and the second number is the number of times the OCR engine recognizes incorrectly;
[0129] A recognition accuracy calculation unit is used to calculate the recognition accuracy of the OCR engine according to the first number of times and the second number of times.
[0130] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0131] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0132] Fig.12 A schematic block diagram of a terminal device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0133] like Fig.12 As shown, the terminal device 12 of this embodiment includes: a processor 120, a memory 121, and a computer program 122 stored in the memory 121 and executable on the processor 120. When the processor 120 executes the computer program 122, the steps in the above-mentioned various OCR test method embodiments are implemented, for example Figure 4 Alternatively, when the processor 120 executes the computer program 122, the functions of each module / unit in the above-mentioned device embodiments are realized, for example Fig.11 The functions of modules 1101 to 1103 are shown.
[0134] Exemplarily, the computer program 122 may be divided into one or more modules / units, which are stored in the memory 121 and executed by the processor 120 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 122 in the terminal device 12.
[0135] The terminal device 12 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. Those skilled in the art will appreciate that Fig.12 It is only an example of the terminal device 12 and does not constitute a limitation on the terminal device 12. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device 12 may also include input and output devices, network access devices, buses, etc.
[0136] The processor 120 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0137] The memory 121 may be an internal storage unit of the terminal device 12, such as a hard disk or memory of the terminal device 12. The memory 121 may also be an external storage device of the terminal device 12, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 12. Further, the memory 121 may also include both an internal storage unit of the terminal device 12 and an external storage device. The memory 121 is used to store the computer program and other programs and data required by the terminal device 12. The memory 121 may also be used to temporarily store data that has been output or is to be output.
[0138] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0139] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0140] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0141] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0142] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0143] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0144] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.
[0145] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An optical character recognition test method, characterized in that: include: Determine the location to be filled in and the filling form in the preset data template according to the preset parameter configuration information; Generate a digital identifier according to the parameter configuration information; Fill the digital identifier into the to-be-filled position in the data template according to the filling form, generate optical character recognition test data, and mark a label corresponding to the optical character recognition test data; Inputting the optical character recognition test data into a preset optical character recognition engine for recognition, and obtaining a recognition result output by the optical character recognition engine; The recognition result is compared with the label, and the recognition accuracy of the optical character recognition engine is determined according to the comparison result.
2. The optical character recognition test method according to claim 1, characterized in that: The generating a digital identifier according to the parameter configuration information includes: Reading the digital identification length and the continuous indication parameter in the parameter configuration information; If the continuous indication parameter is a preset first value, a continuous digital identifier that meets the length of the digital identifier is generated.
3. The optical character recognition test method according to claim 2, characterized in that: Also includes: If the continuous indication parameter is a preset second value, reading the number of digital identifiers in the parameter configuration information; According to the number of digital identifiers, a digital identifier that meets the length of the digital identifier is randomly generated.
4. The optical character recognition test method according to claim 1, characterized in that: The label corresponding to the optical character recognition test data includes: The digital identification is marked as a label corresponding to the optical character recognition test data.
5. The optical character recognition test method according to claim 1, characterized in that: The comparing the recognition result with the label includes: determining the length of the label; Extracting continuous digital strings from the recognition results, and determining the length of each extracted digital string; Selecting equal-length digital strings according to the length of each digital string, wherein the equal-length digital strings are consistent with the length of the label; Compare each selected digital string of equal length with the label to determine whether there is a digital string of equal length as the label; If there is a digital string of the same length as the label, it is determined that the optical character recognition engine has recognized it correctly; If there is no digital string with the same length as the label, it is determined that the optical character recognition engine has made a recognition error.
6. The optical character recognition test method according to any one of claims 1 to 5, characterized in that: Determining the recognition accuracy of the optical character recognition engine according to the comparison result includes: Counting a first number and a second number according to the comparison result, wherein the first number is the number of correct identifications by the optical character recognition engine, and the second number is the number of incorrect identifications by the optical character recognition engine; The recognition accuracy of the optical character recognition engine is calculated according to the first number of times and the second number of times.
7. An optical character recognition test device, characterized in that: include: A test data generation module is used to determine the position to be filled in and the filling form in the preset data template according to the preset parameter configuration information; Generate a digital identifier according to the parameter configuration information; Fill the digital identifier into the to-be-filled position in the data template according to the filling form, generate optical character recognition test data, and mark a label corresponding to the optical character recognition test data; A recognition module, used for inputting the optical character recognition test data into a preset optical character recognition engine for recognition, and obtaining a recognition result output by the optical character recognition engine; The recognition result comparison module is used to compare the recognition result with the label and determine the recognition accuracy of the optical character recognition engine according to the comparison result.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the optical character recognition test method according to any one of claims 1 to 6 are implemented.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the optical character recognition test method according to any one of claims 1 to 6 are implemented.
