OCR (Optical Character Recognition) algorithm evaluation method, device and equipment

By identifying the scene type of the sample image and selecting matching character annotation rules, combining the results of the OCR recognition algorithm to calculate the evaluation index, the challenges of existing OCR technology in accuracy and adaptability are solved, and the effective evaluation of the OCR recognition algorithm is achieved.

CN119580270APending Publication Date: 2025-03-07SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311141028.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-05
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

Under the influence of factors such as font, arrangement, and light, the accuracy and adaptability of existing OCR technologies are challenged, and there is a lack of effective identification algorithm evaluation methods.

Method used

By identifying the scene type of the sample image, selecting matching character annotation rules, recording character annotation results, and obtaining character recognition results through the OCR recognition algorithm, and then calculating the evaluation index of the OCR recognition algorithm.

Benefits of technology

It realizes the accurate acquisition of the evaluation index of the OCR recognition algorithm, and can evaluate the OCR recognition algorithm based on these indicators, thereby improving the recognition accuracy and adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119580270A_ABST
    Figure CN119580270A_ABST
Patent Text Reader

Abstract

The invention provides an OCR (Optical Character Recognition) algorithm evaluation method, device and equipment. The method provided by the invention comprises the steps of identifying a scene type of each sample image in at least one sample image, and selecting a target character labeling rule matched with the scene type from preset character labeling rules according to the scene type; recording a character labeling result of each sample image; wherein the character labeling result is a character labeling result obtained by labeling each sample image by a labeling person according to the character labeling rule; obtaining a character recognition result of each sample image through an optical character recognition (OCR) algorithm; wherein the data format of the character recognition result is the same as the data format of the character labeling result; and obtaining an evaluation index of the OCR recognition algorithm according to the character labeling result of each sample image and the character recognition result of each sample image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an OCR recognition algorithm evaluation method, device and equipment. Background Art

[0002] Optical Character Recognition (OCR) technology can convert text recognition on images such as images, photos, and electronic faxes into editable strings.

[0003] In recent years, with the rapid development of computer vision and deep learning technology, OCR technology is booming with unprecedented speed and accuracy. Correspondingly, OCR technology is limited by many factors such as fonts, arrangement, light, etc., and its accuracy and adaptability are often challenged. Therefore, it is urgent to propose an OCR recognition algorithm evaluation method to evaluate the OCR recognition algorithm. Summary of the invention

[0004] In view of this, the present application provides an OCR recognition algorithm evaluation method, device and equipment to accurately obtain the evaluation indicators of the OCR recognition algorithm, and then evaluate the OCR recognition algorithm.

[0005] Specifically, the present application is implemented through the following technical solutions:

[0006] The first aspect of the present application provides an OCR recognition algorithm evaluation method, the method comprising:

[0007] Identifying a scene type of each sample image in at least one sample image, and selecting a target character labeling rule matching the scene type from pre-set character labeling rules according to the scene type;

[0008] Recording the character annotation results of each sample image; wherein the character annotation results are the character annotation results obtained after the annotator annotates each sample image according to the character annotation rules;

[0009] Obtaining a character recognition result of each sample image by an optical character recognition (OCR) recognition algorithm; wherein the data format of the character recognition result is the same as the data format of the character annotation result;

[0010] An evaluation index of the OCR recognition algorithm is obtained according to the character labeling result of each sample image and the character recognition result of each sample image.

[0011] The second aspect of the present application provides a recognition accuracy acquisition device, the device comprising a recognition module, a recording module, an acquisition module and a calculation module; wherein:

[0012] The recognition module is used to recognize the scene type of each sample image in at least one sample image, and select a target character labeling rule matching the scene type from preset character labeling rules according to the scene type;

[0013] The recording module is used to record the character annotation result of each sample image; wherein the character annotation result is the character annotation result obtained after the annotator annotates each sample image according to the character annotation rule;

[0014] The acquisition module is used to acquire the character recognition result of each sample image through an optical character recognition (OCR) recognition algorithm; wherein the data format of the character recognition result is the same as the data format of the character annotation result;

[0015] The calculation module is used to obtain an evaluation index of the OCR recognition algorithm according to the character labeling result of each sample image and the character recognition result of each sample image.

[0016] The third aspect of the present application provides a recognition accuracy acquisition device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any one of the methods provided in the first aspect of the present application are implemented.

[0017] The fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the methods provided in the first aspect of the present application.

[0018] The OCR recognition algorithm evaluation method, device and equipment provided in the present application, by identifying the scene type of each sample image in at least one sample image, and according to the scene type, selecting the target character annotation rule that matches the scene type from the pre-set character annotation rules, and then recording the character annotation results of each sample image, and obtaining the character recognition results of each sample image through the optical character recognition (OCR) recognition algorithm, and then obtaining the evaluation index of the OCR recognition algorithm according to the character annotation results of each sample image and the character recognition results of each sample image. In this way, the target character annotation rule is determined by the scene type of the sample image, and then the annotator is instructed to annotate the sample pattern according to the target character annotation rule, so that for each sample image, the evaluation index of the OCR recognition algorithm is obtained based on the manually annotated character annotation results and the character recognition results obtained by the optical character recognition (OCR) recognition algorithm. In this way, the evaluation index of the OCR recognition algorithm can be accurately obtained, and then the OCR recognition algorithm can be evaluated based on the evaluation index. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flowchart of Example 1 of the OCR recognition algorithm evaluation method provided in this application;

[0020] Figure 2 A flowchart of Example 2 of the OCR recognition algorithm evaluation method provided in this application;

[0021] Figure 3 A schematic diagram of a sample image of a first type of scene type shown in an embodiment of the present application;

[0022] Figure 4 A flowchart of Example 3 of the OCR recognition algorithm evaluation method provided in this application;

[0023] Figure 5 A flowchart of a fourth embodiment of the image recognition method provided by the present application;

[0024] Figure 6 A schematic diagram of a sample image shown in an embodiment of the present application;

[0025] Figure 7 A hardware structure diagram of an image recognition device in which the image recognition device provided by the present application is located;

[0026] Figure 8 This is a structural diagram of the first embodiment of the image recognition device provided in this application. DETAILED DESCRIPTION

[0027] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0028] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0030] The present application provides an OCR recognition algorithm evaluation method, device and equipment to accurately obtain the evaluation index of the OCR recognition algorithm, and then evaluate the OCR recognition algorithm.

[0031] The OCR recognition algorithm evaluation method, device and equipment provided in the present application, by identifying the scene type of each sample image in at least one sample image, and according to the scene type, selecting the target character annotation rule that matches the scene type from the pre-set character annotation rules, and then recording the character annotation results of each sample image, and obtaining the character recognition results of each sample image through the optical character recognition (OCR) recognition algorithm, and then obtaining the evaluation index of the OCR recognition algorithm according to the character annotation results of each sample image and the character recognition results of each sample image. In this way, the target character annotation rule is determined by the scene type of the sample image, and then the annotator is instructed to annotate the sample pattern according to the target character annotation rule, so that for each sample image, the evaluation index of the OCR recognition algorithm is obtained based on the manually annotated character annotation results and the character recognition results obtained by the optical character recognition (OCR) recognition algorithm. In this way, the evaluation index of the OCR recognition algorithm can be accurately obtained, and then the OCR recognition algorithm can be evaluated based on the evaluation index.

[0032] Specific embodiments are given below to introduce the technical solution of the present application in detail.

[0033] Figure 1 This is a flowchart of the first embodiment of the OCR recognition algorithm evaluation method provided by this application. Please refer to Figure 1 , the method provided in this embodiment may include:

[0034] S101 : Identify the scene type of each sample image in at least one sample image, and select a target character labeling rule matching the scene type from preset character labeling rules according to the scene type.

[0035] Specifically, the scene type of the sample image refers to the actual scene where the sample image is located. For example, the scene type may include a video screenshot scene, a poster scene, a promotional image scene, a banner scene, a press release scene, and a text message picture scene. It should be noted that sample images under different scene types have different text features. For example, in the sample image under the press release scene, the text is relatively neat and dense. For another example, in the sample image under the poster scene or the promotional image scene, the text is relatively messy and sparse, and the text direction may be reversed.

[0036] It should be noted that the sample image can be processed for clarity to improve the clarity of the image and make it clearer for subsequent related processing. For example, the sample image can be processed for clarity based on a clarity processing method such as sharpening filtering and image enhancement.

[0037] Furthermore, the specific content of the preset character marking rule is preset according to actual needs. In this embodiment, the specific content of the character marking rule is not limited.

[0038] For example, in a possible implementation, the preset character marking rules include a block marking rule, a line marking rule, and an overall marking rule.

[0039] Specifically, the block labeling rule is used to instruct the labeling personnel to divide the sample image into multiple blocks according to the preset segmentation rule, and respectively label the target blocks in the multiple blocks with characters; wherein the target block is a block containing characters in the multiple blocks;

[0040] The line-by-line marking method is used to instruct the marking personnel to mark the characters of the sample image line by line based on the character line where the characters in the sample image are located;

[0041] The overall labeling rule is used to instruct the labeling personnel to label the sample image as a whole and perform character labeling on the sample image.

[0042] Specifically, the specific content of the preset segmentation rule is set according to actual needs. In this embodiment, the specific content of the preset segmentation rule is not limited. For example, the preset segmentation rule may be to segment the sample image into four areas according to the principle of equal division. For another example, the preset segmentation rule may be to segment according to the density of characters.

[0043] It should be noted that, in specific implementation, based on the correspondence between the pre-set scene type and the character annotation rule, a target character rule matching the scene type can be selected from the pre-set character annotation rules. The correspondence between the pre-set scene type and the character annotation rule is set according to actual needs and is not limited in this embodiment.

[0044] S102, recording the character annotation result of each sample image; wherein the character annotation result is the character annotation result obtained after the annotator annotates each sample image according to the character annotation rule.

[0045] Specifically, in a possible implementation, the character annotation result represents all characters contained in the sample image and the position information of each character, and the position of the character can be determined based on the position information of the character in the character annotation result. Among them, all characters contained in the sample image can include Chinese and English, simplified Chinese, traditional Chinese, special symbols and punctuation marks, etc. It should be noted that the character annotation result can be stored in a variety of ways. For example, the character annotation result can be stored in the form of a table or a document.

[0046] Furthermore, the character annotation result is the character annotation result obtained after the annotator annotates each sample image according to the character annotation rule. For example, in one embodiment, in combination with the above example, after the sample image is processed for clarity, the annotator annotates it according to the target character annotation rule to obtain the character annotation result.

[0047] S103, obtaining a character recognition result of each sample image by using an optical character recognition (OCR) recognition algorithm; wherein the data format of the character recognition result is the same as the data format of the character labeling result.

[0048] Specifically, the character recognition result is similar to the character annotation result, and is used to characterize all characters contained in the sample image and the position information of each character. Furthermore, the character recognition result is the character recognition result obtained after the optical character recognition (OCR) recognition algorithm performs character recognition on the sample image. It should be noted that the character recognition result can be stored in a variety of ways. For example, the character recognition result can be stored in the form of a table or document.

[0049] Furthermore, the data format of the character recognition result is the same as the data format of the character labeling result to facilitate subsequent comparison.

[0050] S104: Obtain an evaluation index of the OCR recognition algorithm according to the character labeling result of each sample image and the character recognition result of each sample image.

[0051] Specifically, after obtaining the character annotation results and character recognition results of the sample image, the evaluation index of the OCR recognition algorithm can be obtained based on the recognition accuracy calculation method. For example, in one possible implementation, the overlap between the character annotation results of the sample image and the character recognition results of the sample image can be used as the evaluation index of the OCR recognition algorithm.

[0052] The OCR recognition algorithm evaluation method provided in this embodiment identifies the scene type of each sample image in at least one sample image, and selects a target character annotation rule that matches the scene type from the pre-set character annotation rules according to the scene type, and then records the character annotation results of each sample image, and obtains the character recognition results of each sample image through the optical character recognition (OCR) recognition algorithm, and then obtains the recognition accuracy of the OCR recognition algorithm according to the character annotation results of each sample image and the character recognition results of each sample image. In this way, the target character annotation rule is determined by the scene type of the sample image, and then the annotator is instructed to annotate the sample pattern according to the target character annotation rule, so that for each sample image, the evaluation index of the OCR recognition algorithm is obtained based on the manually annotated character annotation results and the character recognition results obtained by the optical character recognition (OCR) recognition algorithm. In this way, the evaluation index of the OCR recognition algorithm can be accurately obtained, and then the OCR recognition algorithm can be evaluated based on the evaluation index.

[0053] Figure 2 This is a flowchart of Example 2 of the OCR recognition algorithm evaluation method provided by this application. Please refer to Figure 2 On the basis of the above embodiment, the pre-set character annotation rules include block annotation rules, line annotation rules and overall annotation rules; the step of selecting a target character annotation rule matching the scene type from the pre-set character annotation rules may include:

[0054] S201: When the scene type is a first scene type, determine that the target character marking rule is a block marking method.

[0055] Specifically, the first scene type is a non-text scene type with fewer characters in the sample image. For example, the first scene type may include a video screenshot scene, a poster scene, a signboard image scene, an advertisement image scene, and a banner image scene. Figure 3 This is a schematic diagram of a sample image of a first type of scene type shown in an embodiment of the present application. Figure 3 The sample image is a video screenshot, most of the image area is a background picture, and a small part of the area is a character area. At this time, it is determined that the sample image belongs to the first type of scene type. Further, the target character labeling rule is determined to be a block labeling rule.

[0056] As described above, the block labeling rule is used to instruct the labeler to divide the image into multiple blocks according to the preset segmentation rule, and to label the target blocks in the multiple blocks with characters respectively. The target block is the block containing characters in the multiple blocks.

[0057] Furthermore, after determining the target character labeling rule, the labeler will label the sample image according to the target character labeling rule. For example, in this example, the labeler will logically divide the sample image into multiple blocks according to a certain ratio, and then after dividing the sample image into multiple blocks, each block can be labeled in order from left to right and from top to bottom to obtain the block labeling result of each target block (wherein the block labeling result includes the block identifier and the characters contained in the block corresponding to the block identifier); finally, the set of the block labeling results of all target blocks is used as the character labeling result of the sample image, and the character labeling result of the sample image is recorded.

[0058] In other words, when labeling, for each block, read and record from left to right and from top to bottom according to the character line. When labeling, check whether there is crooked or inverted text in the sample image. If so, rotate the image to the appropriate angle and label it according to the upright sample.

[0059] In conjunction with the above example, please continue to refer to Figure 3 , the sample image is divided into 9 blocks based on the preset segmentation rules, among which block 1, block 2, block 3 and block 8 contain characters. These 4 blocks containing characters are the target blocks. The block identifier of each target block and the characters contained in the block corresponding to the block identifier are recorded in order from left to right and from top to bottom, and recorded as the block labeling result. At this time, the block labeling result of the sample image is shown in Table 1:

[0060] Table 1

[0061]

[0062] Please refer to Table 1. After the block labeling result of the sample image is obtained, the set consisting of the block labeling results of all target blocks is used as the character labeling result of the sample image.

[0063] S202: When the scene type is the second scene type, determine that the target character marking rule is a line breaking marking rule.

[0064] Specifically, the second scene type is a text scene with more characters in the sample image. For example, the second scene type may include a news release image scene, a chat message image scene, and an article image scene.

[0065] Further, when it is determined that the scene type of the sample image is the second scene type, the target labeling rule is determined to be a line-by-line labeling rule.

[0066] Specifically, referring to the above introduction, the line-by-line marking method is used to instruct the marking personnel to mark the characters of the sample image line by line based on the character lines where the characters in the sample image are located.

[0067] Specifically, in the actual annotation process, the annotator may annotate the sample image line by line in the order from left to right and from top to bottom, taking the character line where the characters in the sample image are located as a unit.

[0068] Furthermore, when the annotator annotates the sample image, the row identifier of each character row in the image and the characters contained in the pixel row corresponding to the row identifier can be recorded as the row annotation result, and then all the row annotation results can be used as the character annotation result of the sample image.

[0069] S203: When the scene type is a third scene type, determine that the target character marking rule is an overall marking rule.

[0070] Specifically, the third scene type is a non-text scene in which characters are relatively concentrated and account for a relatively small proportion in the sample image. Further, when the scene type of the sample image is determined to be the third scene type, the target annotation rule is determined to be the overall annotation rule. At this time, taking the sample image as a whole, the characters contained in the sample image can be read and recorded in order from left to right and from top to bottom, and recorded as the character annotation result of the sample image.

[0071] It should be noted that, referring to the previous introduction, the first category scene type and the third category scene type are non-text scene types, the second category scene type is a text scene type, and the character concentration level of the first category scene type is lower than that of the second category scene type and the third category scene type.

[0072] The OCR recognition algorithm evaluation method provided in this embodiment selects different character annotation rules based on different scene types to annotate sample images to obtain character annotation results. In this way, more fine-grained character annotation results can be obtained, and further, when obtaining evaluation indicators based on more fine-grained character annotation results and character recognition results, the accuracy can be improved.

[0073] Figure 4 This is a flowchart of Example 3 of the OCR recognition algorithm evaluation method provided by this application. Please refer to Figure 4On the basis of the above embodiment, the step of obtaining the character recognition accuracy of the OCR recognition algorithm according to the character labeling result of each sample image and the character recognition result of each sample image may include:

[0074] S401 . For each sample image, determine the total number of accurate characters corresponding to each sample image according to the character labeling result and the character recognition result.

[0075] In the specific implementation, when the character annotation result is a character annotation result obtained based on the block annotation rule, the character annotation result and the character recognition result are compared in blocks to obtain the number of accurate characters corresponding to each block contained in each sample image, and based on the number of accurate characters corresponding to each block, the cumulative number of accurate characters corresponding to each sample image is determined.

[0076] For example, in one embodiment, when the target character labeling rule of the sample image is the block labeling rule, there are three target blocks, namely block A, block B and block C. The character labeling result of block A is compared with the character recognition result of block A. The characters in the character recognition result that are the same as the character labeling result are taken as the accurate characters corresponding to the block. The number of these characters is the number of accurate characters corresponding to block A. The sum of the numbers of accurate characters corresponding to all target blocks is taken as the cumulative number of accurate characters corresponding to the sample image.

[0077] In a specific implementation, comparing the character labeling result and the character recognition result in blocks to obtain the number of accurate characters corresponding to each block contained in each sample image may include:

[0078] For each of the multiple blocks, comparing the character marking result with the character recognition result in units of character rows in the block, to obtain the number of accurate characters corresponding to each character row in the block;

[0079] According to the number of accurate characters corresponding to each character row of the block, the number of accurate characters corresponding to the block is obtained.

[0080] In other words, during the specific comparison, for each block, first compare the first character row of the block, count the number of times each character appears in the character recognition result from left to right, and compare each character with the first character row of the block in the character annotation result. If a character in a row of a block in the character recognition result exists in the corresponding row of the corresponding block in the character annotation result, and the total number of characters in the row of the block is N, and further, the total number of characters in the row of the block in the character annotation result is M, if N is less than or equal to M, then the number of accurate characters corresponding to the character row is added by N, and if N is greater than M, then the number of accurate characters corresponding to the character row is added by M. Then, compare the second row of the block, and so on. After the comparison of the block is completed, the number of accurate characters corresponding to the block is obtained according to the number of accurate characters corresponding to each character row in the block. Further, compare other blocks, and finally, based on the number of accurate characters corresponding to each block, obtain the cumulative number of accurate characters corresponding to each sample image. In this way, during the comparison, the character marking results and the character recognition results of the same block are compared, and the character marking results and the character recognition results of different blocks are not compared.

[0081] For example, in combination with the example shown in Table 1, the character annotation result of the sample image is shown in Table 1. Furthermore, the character recognition result of the sample image is shown in Table 2:

[0082] Table 2

[0083]

[0084] At this time, during the comparison, first compare block 1 to determine that the number of accurate characters corresponding to block 1 is 1. Further, compare block 2. When comparing block 2, compare in units of character rows, that is, first compare the first character row. For example, in this example, through comparison, it is determined that the number of accurate characters corresponding to the first character row in block 2 is 2. Then, compare the second character row in block 2 to determine that the number of accurate characters corresponding to the second character row in block 2 is 4. In this way, the number of accurate characters corresponding to block 2 is determined to be 6. The method for determining the number of accurate characters corresponding to the other blocks is similar and will not be repeated here.

[0085] Furthermore, when the character annotation result is a character annotation result obtained based on the line annotation rule, the character annotation result and the character recognition result are compared in units of character lines to obtain the number of accurate characters corresponding to the character lines contained in each sample image, and based on the number of accurate characters corresponding to each character line, the cumulative number of accurate characters corresponding to each sample image is determined.

[0086] For example, in one embodiment, when the target character annotation rule of the sample image is the line annotation rule, there are 10 character rows, namely the first row, the second row...the tenth row. During comparison, the character annotation result of the first row is compared with the character recognition result of the first row, and the characters in the character recognition result that are the same as the character annotation result are taken as the accurate characters corresponding to the character row. The number of such characters is the number of accurate characters corresponding to the first character row, and the sum of the numbers of accurate characters corresponding to all character rows is taken as the cumulative number of accurate characters corresponding to the sample image.

[0087] In other words, during the specific comparison, for each character row in the character recognition result, the row annotation results of the corresponding character row in the character annotation result are compared one by one. For example, for a certain character in the first row of the character recognition result, if the character exists in the corresponding character row in the character annotation result, and the total number of the characters in the character recognition result and the row annotation result is N; further, the total number of the characters contained in the row annotation results of the corresponding character row in the character annotation result is M. If N is less than or equal to M, the cumulative total number of accurate characters is added to N; if N is greater than M, the cumulative total number of accurate characters is added to M, and so on. In this way, during the comparison, the character recognition results and character annotation results of the same character row are compared, and the character recognition results and character annotation results of different character rows are not compared.

[0088] Furthermore, when the character annotation result is a character annotation result obtained based on the overall annotation rule, the character annotation result and the character recognition result are compared with each sample image as a unit to determine the cumulative number of accurate characters corresponding to each sample image.

[0089] In other words, at this time, for each character in the character recognition result, it is compared with the character annotation result one by one. If for a character in the character recognition result, the character exists in the character annotation result, and the total number of the character in the character recognition result is N, and the total number of the character in the character annotation result is M, if N is less than or equal to M, then the cumulative total number of accurate characters is added to N; if N is greater than M, then the cumulative total number of accurate characters is added to M, and so on. In this way, when comparing, the character recognition result is compared with the character annotation result as a whole, regardless of position and order.

[0090] S402: Calculate an evaluation index of the OCR recognition algorithm according to the accumulated total, a first total number of characters included in the character labeling result, and a second total number of characters included in the character recognition result.

[0091] Specifically, the specific implementation process of this step may include:

[0092] (1) Calculating a first total number of accurate characters corresponding to the at least one sample according to the accumulated total number of accurate characters corresponding to each sample.

[0093] Specifically, the first total number may be calculated according to the following formula:

[0094]

[0095] Wherein, N0 is the first total number of accurate characters corresponding to the at least one sample image; N i is the accumulated number of accurate characters corresponding to the i-th sample image; and n is the number of sample images contained in the at least one sample image.

[0096] (2) Calculating a second total number of characters marked by the character marking result corresponding to the at least one sample according to the first total number of characters included in the character marking result of each sample.

[0097] Specifically, the second total number can be calculated according to the following formula:

[0098]

[0099] Wherein, x0 is the second total number of characters marked by the character marking result of the at least one sample image; x i is the second total number of characters included in the character labeling result of the i-th sample image; and n is the number of sample images included in the at least one sample image.

[0100] (3) Calculating a third total number of characters recognized by the character recognition result corresponding to the at least one sample based on the second total number of characters included in the character recognition result of each sample.

[0101] Specifically, the third total number can be calculated according to the following formula:

[0102]

[0103] Wherein, y0 is the third total number of characters recognized by the character recognition result corresponding to the at least one sample image; y i is the second total number of characters included in the character recognition result of the i-th sample image; and n is the number of sample images included in the at least one sample image.

[0104] (4) Calculating an evaluation index of the OCR recognition algorithm according to the first total number, the second total number, and the third total number.

[0105] It should be noted that the evaluation index of the OCR recognition algorithm on each sample image may include the precision rate, recall rate and F1 score of the OCR recognition algorithm on each sample image.

[0106] In specific implementation, the evaluation index of the OCR recognition algorithm can be calculated according to the following formula:

[0107]

[0108]

[0109]

[0110] Among them, S is the F1 score of the OCR recognition algorithm, Z1 is the precision rate of the OCR recognition algorithm, and Z2 is the recall rate of the OCR recognition algorithm.

[0111] The method provided in this embodiment determines the cumulative total number of accurate characters corresponding to each sample image according to the character annotation result and the character recognition result, and then calculates the evaluation index of the OCR recognition algorithm according to the cumulative total number, the first total number of characters included in the character annotation result, and the second total number of characters included in the character recognition result. In this way, the evaluation index can be obtained quickly and accurately.

[0112] Figure 5 This is a flowchart of the fourth embodiment of the image recognition method provided by this application. Please refer to Figure 5 , the method provided in this embodiment may include:

[0113] S501: Perform clarity processing on at least one sample image.

[0114] In specific implementation, the sample image can be processed for clarity to improve the clarity of the sample image and improve the accuracy of labeling and recognition.

[0115] S502: Identify the scene type of each sample image in the at least one sample image, and select a target character labeling rule matching the scene type from preset character labeling rules according to the scene type.

[0116] For example, in one embodiment, Figure 6 This is a schematic diagram of a sample image shown in an embodiment of the present application. Figure 6 , the sample image is a non-text scene with few characters, and it is determined that it belongs to the first type of scene type, and then the block annotation rule is applied to annotate the sample image. Finally, the set of block annotation results of each target block is used as the character annotation result of the sample image, and the character annotation result is recorded. It should be noted that, referring to Figure 6When the sample image contains characters with skewed or tilted angles, the sample image can be rotated to a suitable angle when marking the characters, and then the characters can be recognized and marked with upright samples.

[0117] S503: Record the character annotation result of each sample image.

[0118] For example, in conjunction with the above example, please continue to refer to Figure 6 The character annotation result of the sample image is shown in Table 2. Table 2 is a character annotation result of a sample image provided by an embodiment of the present application:

[0119] Table 2

[0120] Block ID The characters contained in this block Block 3 green Block 6 I Block 8 spring Block 11 Of

[0121] Please refer to Table 2. After the block labeling result of the sample image is obtained, the block labeling results of all target blocks are used as the character labeling result of the sample image.

[0122] S504: Obtain character recognition results of each sample image through an optical character recognition (OCR) algorithm.

[0123] S505 . For each sample image, determine the total number of accurate characters corresponding to each sample image according to the character labeling result and the character recognition result.

[0124] S506: Calculate an evaluation index of the OCR recognition algorithm according to the accumulated total, a first total number of characters included in the character labeling result, and a second total number of characters included in the character recognition result.

[0125] Specifically, the specific implementation method of step S504 to step S506 can refer to the relevant introduction in the above embodiment, and this is not limited in this embodiment.

[0126] The OCR recognition algorithm evaluation method provided in this embodiment first performs clarity processing on at least one sample image, then identifies the scene type of each sample image in the at least one sample image, and selects a target character annotation rule that matches the scene type from a pre-set character annotation rule according to the scene type, and records the character annotation result of each sample image, and simultaneously obtains the character recognition result of each sample image through an optical character recognition (OCR) recognition algorithm, and further, for each sample image, according to the character annotation result and the character recognition result, determines the cumulative total number of accurate characters corresponding to each sample image, and then calculates the evaluation index of the OCR recognition algorithm according to the cumulative total number, the first total number of characters included in the character annotation result, and the second total number of characters included in the character recognition result. In this way, the evaluation index can be obtained quickly and accurately, and then the OCR recognition algorithm can be evaluated based on the obtained evaluation index.

[0127] Corresponding to the aforementioned embodiment of an OCR recognition algorithm evaluation method, the present application also provides an embodiment of a recognition accuracy acquisition device.

[0128] The embodiment of the recognition accuracy acquisition device of the present application can be applied to the recognition accuracy acquisition device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the recognition accuracy acquisition device in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory and running them. From the hardware level, if Figure 7 As shown, it is a hardware structure diagram of the recognition accuracy acquisition device provided by the present application, in which the recognition accuracy acquisition device is located. Figure 7 In addition to the processor, memory, network interface, and non-volatile memory shown, the recognition accuracy acquisition device where the device in the embodiment is located usually acquires the actual function of the recognition accuracy device and may also include other hardware, which will not be described in detail.

[0129] Figure 8 For a structural diagram of the first embodiment of the image recognition device provided by this application, please refer to Figure 8 The device provided in this embodiment includes an identification module 810, a recording module 820, an acquisition module 830 and a calculation module 840; wherein,

[0130] The recognition module 810 is used to recognize the scene type of each sample image in at least one sample image, and select a target character labeling rule matching the scene type from pre-set character labeling rules according to the scene type;

[0131] The recording module 820 is used to record the character annotation result of each sample image; wherein the character annotation result is the character annotation result obtained after the annotator annotates each sample image according to the character annotation rule;

[0132] The acquisition module 830 is used to acquire the character recognition result of each sample image by using an optical character recognition (OCR) recognition algorithm; wherein the data format of the character recognition result is the same as the data format of the character annotation result;

[0133] The calculation module 840 is used to obtain the evaluation index of the OCR recognition algorithm according to the character labeling result of each sample image and the character recognition result of each sample image.

[0134] The device of this embodiment can be used to perform Figure 1 The steps, specific implementation principles and implementation processes of the method embodiment shown are similar and will not be repeated here.

[0135] Optionally, the pre-set character marking rules include block marking rules, line marking rules and overall marking rules; wherein,

[0136] The block labeling rule is used to instruct the labeling personnel to divide the sample image into multiple blocks according to the preset segmentation rule, and respectively label the target blocks among the multiple blocks with characters; wherein the target block is a block containing characters among the multiple blocks;

[0137] The line-by-line marking method is used to instruct the marking personnel to mark the characters of the sample image line by line based on the character line where the characters in the sample image are located;

[0138] The overall labeling rule is used to instruct the labeling personnel to label the sample image as a whole and perform character labeling on the sample image.

[0139] Optionally, the recognition module 810 is specifically configured to determine that the target character marking rule is a block marking method when the scene type is the first type of scene type;

[0140] The recognition module 810 is further specifically configured to determine that the target character marking rule is a line-break marking rule when the scene type is the second scene type;

[0141] The recognition module 810 is also specifically used to determine that the target character marking rule is an overall marking rule when the scene type is a third type of scene type; wherein the first type of scene type and the third type of scene type are non-text scene types, the second type of scene type is a text scene type, and the character concentration level of the first type of scene type is lower than that of the second type of scene type and the third type of scene type.

[0142] Optionally, the recording module 820 is specifically configured to, when the target character labeling rule is a block labeling rule, use a set of block labeling results of each target block as a character labeling result of the sample image, and record the character labeling result; wherein the block labeling result includes a block identifier and characters contained in the block corresponding to the block identifier;

[0143] The recording module 820 is further specifically configured to, when the target character labeling rule is a line labeling rule, use a set of line labeling results of each of the character lines as a character labeling result of the sample image, and record the character labeling result; wherein the line labeling result includes a line identifier and characters included in the character line corresponding to the line identifier;

[0144] The recording module 820 is further specifically configured to, when the character annotation rule is an overall annotation method, use the characters included in the sample image as the character annotation result of the sample image, and record the character annotation result.

[0145] Optionally, the calculation module 840 is specifically configured to determine, for each sample image, the cumulative total number of accurate characters corresponding to each sample image according to the character labeling result and the character recognition result;

[0146] The calculation module 840 is further specifically configured to calculate an evaluation index of the OCR recognition algorithm according to the accumulated total, a first total number of characters included in the character labeling result, and a second total number of characters included in the character recognition result.

[0147] Optionally, the calculation module 840 is further specifically configured to compare the character annotation result with the character recognition result in units of blocks when the character annotation result is a character annotation result obtained based on a block annotation rule, to obtain the number of accurate characters corresponding to each block contained in each sample image, and determine the cumulative number of accurate characters corresponding to each sample image according to the number of accurate characters corresponding to each block;

[0148] The calculation module 840 is further specifically configured to compare the character annotation result with the character recognition result in units of character lines when the character annotation result is a character annotation result obtained based on a line-by-line annotation rule, to obtain the number of accurate characters corresponding to the character lines contained in each sample image, and to determine the cumulative number of accurate characters corresponding to each sample image according to the number of accurate characters corresponding to each character line;

[0149] The calculation module 840 is also specifically used to compare the character annotation result and the character recognition result based on each sample image when the character annotation result is a character annotation result obtained based on the overall annotation rule, so as to determine the cumulative number of accurate characters corresponding to each sample image.

[0150] Please continue to refer to Figure 7 The present application also provides a recognition accuracy acquisition device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any one of the methods provided in the first aspect of the present application are implemented.

[0151] The present application also provides a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the steps of any one of the methods provided in the present application are implemented.

[0152] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0153] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0154] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A method for evaluating an OCR recognition algorithm, characterized in that: The method comprises: Identifying a scene type of each sample image in at least one sample image, and selecting a target character labeling rule matching the scene type from pre-set character labeling rules according to the scene type; Recording the character annotation results of each sample image; wherein the character annotation results are the character annotation results obtained after the annotator annotates each sample image according to the character annotation rules; Obtaining a character recognition result of each sample image by an optical character recognition (OCR) recognition algorithm; wherein the data format of the character recognition result is the same as the data format of the character annotation result; An evaluation index of the OCR recognition algorithm is obtained according to the character labeling result of each sample image and the character recognition result of each sample image.

2. The method according to claim 1, characterized in that The pre-set character marking rules include block marking rules, line marking rules and overall marking rules; wherein, The block labeling rule is used to instruct the labeling personnel to divide the sample image into multiple blocks according to the preset segmentation rule, and respectively label the target blocks among the multiple blocks with characters; wherein the target block is a block containing characters among the multiple blocks; The line-by-line marking method is used to instruct the marking personnel to mark the characters of the sample image line by line based on the character line where the characters in the sample image are located; The overall labeling rule is used to instruct the labeling personnel to label the sample image as a whole and perform character labeling on the sample image.

3. The method according to claim 2, characterized in that The selecting a target character marking rule matching the scene type from the preset character marking rules includes: When the scene type is the first type of scene type, determining that the target character marking rule is a block marking method; When the scene type is the second scene type, determining that the target character marking rule is a line-break marking rule; When the scene type is a third type of scene type, the target character annotation rule is determined to be an overall annotation rule; wherein the first type of scene type and the third type of scene type are non-text scene types, the second type of scene type is a text scene type, and the character concentration level of the first type of scene type is lower than that of the second type of scene type and the third type of scene type.

4. The method according to claim 2, characterized in that: The recording of the character annotation result of each sample image includes: When the target character labeling rule is a block labeling rule, a set of block labeling results of each target block is used as a character labeling result of the sample image, and the character labeling result is recorded; wherein the block labeling result includes a block identifier and characters contained in the block corresponding to the block identifier; When the target character labeling rule is a line labeling rule, a set of line labeling results of each character line is used as a character labeling result of the sample image, and the character labeling result is recorded; wherein the line labeling result includes a line identifier and characters contained in the character line corresponding to the line identifier; When the character annotation rule is a holistic annotation method, the characters included in the sample image are used as the character annotation result of the sample image, and the character annotation result is recorded.

5. The method according to claim 1, characterized in that The obtaining of the evaluation index of the OCR recognition algorithm according to the character labeling result of each sample image and the character recognition result of each sample image includes: For each of the sample images, according to the character labeling result and the character recognition result, determine the cumulative total number of accurate characters corresponding to each of the sample images; An evaluation index of the OCR recognition algorithm is calculated according to the accumulated total, a first total number of characters included in the character marking result, and a second total number of characters included in the character recognition result.

6. The method according to claim 5, characterized in that Determining the cumulative total number of accurate characters corresponding to each sample image according to the character labeling result and the character recognition result includes: When the character annotation result is a character annotation result obtained based on a block annotation rule, the character annotation result is compared with the character recognition result in units of blocks to obtain the number of accurate characters corresponding to each block contained in each sample image, and according to the number of accurate characters corresponding to each block, the cumulative number of accurate characters corresponding to each sample image is determined; When the character annotation result is a character annotation result obtained based on a line-by-line annotation rule, the character annotation result and the character recognition result are compared in character line units to obtain the number of accurate characters corresponding to the character lines contained in each sample image, and the cumulative number of accurate characters corresponding to each sample image is determined according to the number of accurate characters corresponding to each character line; When the character annotation result is a character annotation result obtained based on the overall annotation rule, the character annotation result and the character recognition result are compared with each sample image as a unit to determine the cumulative number of accurate characters corresponding to each sample image.

7. The method according to claim 5, characterized in that The calculating the evaluation index of the OCR recognition algorithm according to the accumulated total, the first total number of characters included in the character annotation result, and the second total number of characters included in the character recognition result includes: Calculating a first total number of accurate characters corresponding to the at least one sample according to the accumulated total number of accurate characters corresponding to each sample; Calculating a second total number of characters marked by the character marking result corresponding to the at least one sample according to the first total number of characters included in the character marking result of each sample; Calculating a third total number of characters recognized by the character recognition result corresponding to the at least one sample according to the second total number of characters included in the character recognition result of each sample; An evaluation index of the OCR recognition algorithm is calculated according to the first total number, the second total number and the third total number.

8. A recognition accuracy acquisition device, characterized in that: The device includes an identification module, a recording module, an acquisition module and a calculation module; wherein, The recognition module is used to recognize the scene type of each sample image in at least one sample image, and select a target character labeling rule matching the scene type from preset character labeling rules according to the scene type; The recording module is used to record the character annotation result of each sample image; wherein the character annotation result is the character annotation result obtained after the annotator annotates each sample image according to the character annotation rule; The acquisition module is used to acquire the character recognition result of each sample image through an optical character recognition (OCR) recognition algorithm; wherein the data format of the character recognition result is the same as the data format of the character annotation result; The calculation module is used to obtain an evaluation index of the OCR recognition algorithm according to the character labeling result of each sample image and the character recognition result of each sample image.

9. A recognition accuracy acquisition device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.