OCR recognition result optimization candidate character recommendation method based on stroke comparison

The OCR recognition result optimization method based on stroke comparison solves the problem of OCR system misjudging similar characters under non-ideal conditions. It provides candidate character recommendations through stroke structure analysis, thereby improving recognition accuracy and proofreading efficiency.

CN120612705AActive Publication Date: 2025-09-09CENT SOUTH UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511107167.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-09-09
Estimated Expiration
2045-08-08

AI Technical Summary

Technical Problem

Existing OCR systems are prone to misjudging similar characters under non-ideal conditions and lack a structural review mechanism for recognition results, resulting in frequent recognition errors.

Method used

By establishing a character stroke order library and a stroke difference scoring matrix, the stroke structure difference between the OCR recognition results and the candidate characters is calculated, and the candidate character recommendations with interpretable structures are output.

Benefits of technology

It provides structurally explainable candidate character recommendations to help with proofreading and error correction, and improves the recognition accuracy of the OCR system under non-ideal conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120612705A_ABST
    Figure CN120612705A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of character image recognition processing, and particularly discloses an OCR recognition result optimization candidate character recommendation method based on stroke comparison, which can perform difference analysis on an OCR recognition result on a stroke structure level by establishing a stroke difference scoring mechanism, judge whether the OCR recognition result is matched with a standard character structure or not, and recommend a candidate character to the OCR recognition result. Therefore, suspected mistaken recognition characters are recognized, structural abnormity is marked, a clear basis is provided for follow-up proofreading or replacement, a plurality of candidate characters closest to the recognition result in structure are output according to stroke structure similarity during difference analysis, and a difference degree score is provided as a reference. The candidate character set and the structural similarity score thereof can be used as an input basis for manual proofreading, OCR system post-processing or an automatic error correction module, and a structural reference basis is provided for subsequent review, review and automatic error correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of character image recognition and processing, and specifically discloses an OCR recognition result optimization candidate character recommendation method based on stroke comparison. Background Art

[0002] Current OCR systems have been widely applied in scenarios such as bill recognition, document digitization, and document processing. The mainstream methods mostly implement the end-to-end text recognition process based on deep learning models such as convolutional neural networks (CNNs), recurrent neural networks (RNNs), or Transformers. In the case of recognizing standard fonts or images with high quality, the system can achieve high accuracy.

[0003] Although the current OCR system can achieve high recognition accuracy under the conditions of standard fonts and clear images, in real application environments, such as when there are structurally similar characters (such as "白" and "百", "口" and "日") or many characters with similar strokes, the recognition results often appear incorrect.

[0004] Especially under non-ideal conditions such as blurred character images, deformed fonts, and handwritten inputs, existing OCR systems are prone to misjudging similar characters, and the recognition system itself usually lacks a structural review mechanism for recognition results and cannot effectively judge or correct potential errors.

[0005] The present invention provides an OCR recognition result optimization candidate character recommendation method based on stroke comparison to solve the above problems. Summary of the Invention

[0006] The purpose of the present invention is to perform stroke structure-level comparison and analysis with a character stroke order library for single-character outputs of OCR recognition, calculate the difference degree between the recognition result and other characters, and output several candidate characters with the closest stroke orders, providing a structurally interpretable judgment basis and candidate replacement suggestions for the OCR system.

[0007] To achieve the above purpose, the basic solution of the present invention provides an OCR recognition result optimization candidate character recommendation method based on stroke comparison, including the following steps: Step A1: Establish a character stroke order library, which stores the stroke sequence information of all standard characters arranged in an increasing sequence, and each stroke sequence information correspondingly includes a stroke code referring to the stroke. Step A2: Establish a stroke difference degree scoring matrix for evaluating the structural difference degree between any two strokes. Step A3: Receive the single-character result of OCR recognition as the input character, and match and obtain the stroke sequence with the number of stroke orders of the input character from the character stroke order library. Step A4: Filter and obtain candidate characters from the character stroke order library according to the stroke order number range to form a candidate character set; Step A5: Compare the input character with the candidate characters in sequence, calculate the stroke difference based on the stroke difference scoring matrix to obtain a comparison score, and store the comparison score corresponding to the candidate character in the candidate character set; Step A6: Sort the candidate characters in the candidate character set in ascending order according to the comparison scores, retain and output the first N_candidate items, and output a set of each retained candidate character and its comparison score.

[0008] Further, in step A1, the stroke sequence information stored in the character stroke library StrokeLib is represented as: {character c:[s1,s2,...,s k ]},s k Indicates the k-th stroke order of a character, where k = 1, 2, .... The stroke codes in the stroke sequence information of each standard character c are interpreted as follows: 1=horizontal, 2=vertical, 3=left stroke, 4=right stroke, 5=falling stroke, 0=empty stroke; Among them, empty strokes are used for insertion / deletion structure scoring.

[0009] Furthermore, in step A2, the expression of the stroke difference score matrix StrokeDiffMatrix is ​​as follows: ; Where StrokeDiffMatrix[i][j] represents the structural difference between the i-th stroke and the j-th stroke, and its value range is [0,1]. A larger value indicates a more obvious difference, and a smaller value indicates a closer structure. The value range of i and j is {0,1,2,3,4,5}, corresponding to the stroke code in the stroke sequence information of each character.

[0010] Further, in step A4, the candidate character set includes character set 1 of all standard characters in the character stroke order library whose number of strokes is the same as the number of strokes of the input character, and character set 3 of all standard characters in the character stroke order library whose number of strokes is one more than the number of strokes of the input character. When the number of strokes of the input character is greater than 1, the candidate character set also includes character set 2 of all standard characters in the character stroke order library whose number of strokes is one less than the number of strokes of the input character.

[0011] Further, in step A5, the process of comparing the input character with the candidate characters in sequence includes comparing the input character with the candidate characters in character set one and character set three in the candidate character set in sequence. When the number of strokes of the input character is greater than 1, it also includes comparing the input character with the candidate characters in character set two in the candidate character set.

[0012] Furthermore, the comparison process of the input character with the candidate characters of the character set 1 in the candidate character set is as follows: For each candidate character c w ∈ character set 1, get its stroke sequence S_c=[t1,t2,...,t z ]; Initialize the difference count diff_count=0 and the comparison score score=0.0; Bit-by-bit comparison S_ocr=[s1,s2,...,s k ] and S_c=[t1,t2,...,t z ], where S_ocr is the stroke sequence with the number of strokes of the input character matched from the character stroke order library, k=1,2,..., z=1,2,...; If s k With t z If they are not the same, then diff_count+=1 and score w +=StrokeDiffMatrix[s k ][t z ], StrokeDiffMatrix[s k ][t z ] indicates the sth k Strokes and t z The difference in the structure of the strokes, if diff_count≤1, then (c w ,score w ) is added to the candidate character set CandidateSet, and CandidateSet.append((c w ,score w )).

[0013] Furthermore, the comparison process of the input character with the candidate characters of the character set 2 in the candidate character set is as follows: For each position y∈[0,n-1] in the stroke sequence S_ocr of the input character, delete the y-th stroke s y Construct the deletion variant S_del y , record the deleted strokes s y , and (S_del y ,s y ) is added to the deletion set, where n represents the length of the pen sequence column, n=len(S_ocr); For all candidate characters c w-1 ∈ character set 2, if its stroke sequence is equal to any deletion variant S_del y , then remember the scorew-1 =StrokeDiffMatrix[s y ][0], and (c w-1 ,score w-1 ) is added to the candidate character set CandidateSet, and CandidateSet.append((c w-1 ,score w-1 )).

[0014] Furthermore, the comparison process of the input character with the candidate characters of the character set 3 in the candidate character set is as follows: For each position r∈[0,n] in the stroke sequence S_ocr of the input character and the corresponding stroke code x, x∈{1,2,3,4,5}, insert x into the corresponding position in S_ocr to get S_ins r , and (S_ins r ,x) is added to the insertion set; For all candidate characters c w+1 ∈ character set three, if its stroke sequence is the same as any S_ins r If they are exactly the same, remember to score w+1 =StrokeDiffMatrix[0][x], and (c w+1 ,score w+1 ) is added to the candidate character set CandidateSet, and CandidateSet.append((c w+1 ,score w+1 )).

[0015] The principle and effect of this solution are: 1. Compared with the existing technology, the present invention can perform difference analysis on the OCR recognition results at the stroke structure level to determine whether they match the standard character structure, thereby identifying suspected misrecognized characters and marking structural anomalies, providing a clear basis for subsequent proofreading or replacement, and establishing a stroke difference scoring mechanism.

[0016] 2. Compared with existing technologies, this invention outputs multiple candidate characters that are structurally closest to the recognition result based on stroke structure similarity, and provides a difference score as a reference. The candidate character set and its structural similarity score can be used as input for manual proofreading, OCR system post-processing, or automatic error correction modules, providing a structural reference for subsequent review, inspection, and automatic error correction. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 A flowchart of a method for optimizing candidate character recommendation based on OCR recognition results based on stroke comparison proposed in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0019] In order to further illustrate the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the specific implementation methods, structures, features and effects of the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments.

[0020] The candidate character recommendation method is optimized based on the OCR recognition results of stroke comparison, and the implementation is as follows: Figure 1 As shown, the following steps are included: Step A1: Establish a character stroke order library. The character stroke order library stores stroke sequence information of all standard characters arranged in ascending order. Each stroke sequence information includes a stroke code representing a stroke.

[0021] In this embodiment, the character stroke order library StrokeLib stores the stroke sequence information of all standard characters, and the type of the character stroke order library is Dict[str, List[int]].

[0022] The stroke sequence information stored in the character stroke library StrokeLib is represented as: {character c:[s1,s2,...,s k ]},s k Indicates the kth stroke order of a character, where k = 1, 2, ..., where each standard character c includes a plurality of stroke sequence information arranged in ascending order, and each stroke sequence information contains a stroke code for representing a stroke. The stroke codes in the stroke sequence information of each standard character are interpreted as follows: 1 = horizontal stroke, 2 = vertical stroke, 3 = left-falling stroke, 4 = right-falling stroke, 5 = right-falling stroke, 0 = empty stroke. The empty stroke is used for insertion / deletion structure scoring.

[0023] Step A2: Establish a stroke difference score matrix for evaluating the degree of structural difference between any two strokes.

[0024] In this embodiment, the expression of the stroke difference score matrix StrokeDiffMatrix is ​​as follows: ; In the formula, StrokeDiffMatrix[i][j] represents the structural difference degree between the i-th stroke and the j-th stroke, and the value range is [0, 1]. The larger the value, the more obvious the difference, and the smaller the value, the closer the structure. The value ranges of i and j are both {0, 1, 2, 3, 4, 5}, corresponding to the stroke codes in the stroke sequence information of each character.

[0025] The following is an example of calculating the stroke difference degree score: In the process of calculating the stroke difference degree, when the 3rd stroke of a recognized input character is "horizontal", that is, the stroke code is 1, and at this time, the 3rd stroke of the recognized candidate character is "left-falling stroke", that is, the stroke code is 3, the comparison score of the structural difference degree obtained under the same stroke sequence is 0.4, that is, StrokeDiffMatrix[1][3]=0.4.

[0026] In the process of calculating the stroke difference degree, when it is recognized that a candidate character has one more inserted stroke "folding stroke" than a certain input character, that is, the stroke code is 5, then the comparison score of the difference degree of the inserted structure is 0.9, that is, StrokeDiffMatrix[0][5]=0.9 (the difference degree between the empty stroke and the folding stroke).

[0027] Step A3: Receive the single-character result recognized by OCR as the input character C_ocr, match and obtain the stroke sequence with the number of strokes of the input character C_ocr from the character stroke sequence library StrokeLib, denoted as S_ocr=[s1, s2,..., s k , and the number of strokes, that is, the length of the stroke sequence, is denoted as n = len(S_ocr).

[0028] Step A4: According to the range of the number of strokes, screen and obtain candidate characters from the character stroke sequence library to form a candidate character set. The candidate character set includes the first set of characters, which is the set of all standard characters in the character stroke sequence library with the same number of strokes as the input character, the second set of characters, which is the set of all standard characters in the character stroke sequence library with one less stroke than the input character, and the third set of characters, which is the set of all standard characters in the character stroke sequence library with one more stroke than the input character.

[0029] Specifically, the candidate character set CandidateSet = [] includes: P[[ID=B1]] n [0000045],P [[ID=B2]] n-1 [0000046],P [[ID=B3]] n+1 [0000047] 。

[0030] The first set of characters P [[ID=B4]] n [0000048] : includes all standard characters in the character stroke sequence library StrokeLib with the same number of strokes as S_ocr; The second set of characters Pn-1 : Includes all standard characters with n-1 strokes in the character stroke library StrokeLib. When n=1, character set 2 is ignored. Character Set Three P n+1 : Includes all standard characters with n+1 strokes in the character stroke order library StrokeLib.

[0031] Step A5: Compare the input character with the candidate characters in character set 1, character set 2 and character set 3 in the candidate character set in turn, calculate the stroke difference based on the stroke difference scoring matrix to obtain the comparison score, and store the comparison score corresponding to the candidate character in the candidate character set.

[0032] Specifically, the following steps are included: Step A501: Perform a stroke order structure comparison of equal lengths, allowing for one different stroke.

[0033] For each candidate character c w ∈P n , get its pen sequence S_c=[t1,t2,...,t z ].

[0034] Initialize the difference count diff_count=0 and the comparison score score=0.0.

[0035] Bit-by-bit comparison S_ocr=[s1,s2,...,s k ] and S_c=[t1,t2,...,t z ], where S_ocr is the stroke sequence of the input character.

[0036] If s k With t z If they are not the same, then diff_count+=1 and score w +=StrokeDiffMatrix[s k ][t z ], if diff_count≤1, then (c w ,score w ) is added to the candidate character set CandidateSet, and CandidateSet.append((c w ,score w )).

[0037] And, when n>1 exists, go to step A502, and when n=1 exists, go to step A503.

[0038] Step A502: one-stroke structure matching.

[0039] For each position y∈[0,n-1] in the stroke sequence S_ocr of the input character, delete the y-th stroke s y Construct the deletion variant S_del y , record the deleted strokes s y , and (S_del y ,s y ) to the delete collection.

[0040] For all candidate characters c w-1 ∈P n-1 , if its sequence is equal to any deletion variant S_del y , then remember the score w-1 =StrokeDiffMatrix[s y ][0], and in (c w-1 ,score w-1 ) is added to the candidate character set CandidateSet and then the process goes to step A503 to obtain CandidateSet.append((c w-1 ,score w-1 )).

[0041] Step A503: One more stroke structure matching.

[0042] For each position r∈[0,n] in the stroke sequence S_ocr of the input character and the corresponding stroke code x, x∈{1,2,3,4,5}, insert x into the corresponding position in S_ocr to get S_ins r , and (S_ins r ,x) is added to the insertion set; For all candidate characters c w+1 ∈P n+1 , if its pen sequence is the same as any S_ins r If they are completely consistent, remember to score w+1 =StrokeDiffMatrix[0][x], and in (c w+1 ,score w+1 ) is added to the candidate character set CandidateSet and then the process goes to step A6 to obtain CandidateSet.append((c w+1 ,score w+1 )).

[0043] Step A6: Sort the candidate characters in the candidate character set CandidateSet in ascending order by comparison score, retain and output the top N_candidate items, and output the set of comparison scores of each retained candidate character and the degree of difference in their stroke structure with the input character. The expression is: TopCandidates = [(c1, score1), (c2, score2), ...], where each item is: (candidate character, comparison score). Lower comparison scores indicate closer structures. The characters are sorted in ascending order and are of type List[Tuple[str, int]].

[0044] The present invention can perform difference analysis on the OCR recognition results at the stroke structure level to determine whether they match the standard character structure, thereby identifying suspected misrecognized characters and marking structural anomalies, providing a clear basis for subsequent proofreading or replacement, and establishing a stroke difference scoring mechanism.

[0045] Based on stroke structure similarity, the present invention outputs multiple candidate characters that are structurally closest to the recognition result and provides a difference score as a reference. The candidate character set and its structural similarity score can be used as input for manual proofreading, OCR system post-processing, or automatic error correction modules, providing a structural reference for subsequent review, inspection, and automatic error correction.

[0046] The above description is merely a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Although the present invention has been disclosed as a preferred embodiment as above, it is not intended to limit the present invention. Any person skilled in the art can make some changes or modifications to equivalent embodiments using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any indirect modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.

Claims

1. A method for optimizing candidate character recommendation based on OCR recognition results based on stroke comparison, characterized in that: The steps include: Step A1: establishing a character stroke order library, which stores stroke sequence information of all standard characters arranged in ascending order, and each stroke sequence information includes a stroke code corresponding to a stroke; Step A2: establishing a stroke difference scoring matrix for evaluating the degree of structural difference between any two strokes; Step A3: receiving the single character result recognized by OCR as an input character, matching and obtaining the stroke sequence of the input character with the stroke order number from the character stroke order library; Step A4: Filter and obtain candidate characters from the character stroke order library according to the stroke order number range to form a candidate character set; Step A5: Compare the input character with the candidate characters in sequence, calculate the stroke difference based on the stroke difference scoring matrix to obtain a comparison score, and store the comparison score corresponding to the candidate character in the candidate character set; Step A6: Sort the candidate characters in the candidate character set in ascending order according to the comparison scores, retain and output the first N_candidate items, and output a set of each retained candidate character and its comparison score.

2. The method for recommending candidate characters based on stroke comparison and optimizing OCR recognition results according to claim 1, characterized in that: In step A1, the stroke sequence information stored in the character stroke library StrokeLib is represented as: {character c:[s1,s2,...,s k ]},s k Indicates the k-th stroke order of a character, where k = 1, 2, .... The stroke codes in the stroke sequence information of each standard character c are interpreted as follows: 1=horizontal, 2=vertical, 3=left stroke, 4=right stroke, 5=falling stroke, 0=empty stroke; Among them, empty strokes are used for insertion / deletion structure scoring.

3. The method for recommending candidate characters based on stroke comparison and optimizing OCR recognition results according to claim 2, characterized in that: In step A2, the expression of the stroke difference score matrix StrokeDiffMatrix is ​​as follows: ; Where StrokeDiffMatrix[i][j] represents the structural difference between the i-th stroke and the j-th stroke, and its value range is [0,1]. A larger value indicates a more obvious difference, and a smaller value indicates a closer structure. The value range of i and j is {0,1,2,3,4,5}, corresponding to the stroke code in the stroke sequence information of each character.

4. The method for recommending candidate characters based on stroke comparison and optimizing OCR recognition results according to claim 1, characterized in that: In step A4, the candidate character set includes character set 1 of all standard characters in the character stroke order library whose number of strokes is the same as the number of strokes of the input character, and character set 3 of all standard characters in the character stroke order library whose number of strokes is one more than the number of strokes of the input character. When the number of strokes of the input character is greater than 1, the candidate character set also includes character set 2 of all standard characters in the character stroke order library whose number of strokes is one less than the number of strokes of the input character.

5. The method for recommending candidate characters based on stroke comparison and optimizing OCR recognition results according to claim 4, characterized in that: In step A5, the process of comparing the input character with the candidate characters in sequence includes comparing the input character with the candidate characters in character set one and character set three in the candidate character set in sequence. When the number of strokes of the input character is greater than 1, it also includes comparing the input character with the candidate characters in character set two in the candidate character set.

6. The method for recommending candidate characters based on stroke comparison and optimizing OCR recognition results according to claim 5, characterized in that: The comparison process of the input character with the candidate characters of character set 1 in the candidate character set is as follows: For each candidate character c w ∈ character set 1, get its stroke sequence S_c=[t1,t2,...,t z ]; Initialize the difference count diff_count=0 and the comparison score score=0.0; Bit-by-bit comparison S_ocr=[s1,s2,...,s k ] and S_c=[t1,t2,...,t z ], where S_ocr is the stroke sequence with the number of strokes of the input character matched from the character stroke order library, k=1,2,..., z=1,2,...; If s k With t z If they are not the same, then diff_count+=1 and score w +=StrokeDiffMatrix[s k ][t z ], StrokeDiffMatrix[s k ][t z ] indicates the sth k Strokes and t z The difference in the structure of the strokes, if diff_count≤1, then (c w ,score w ) is added to the candidate character set CandidateSet, and CandidateSet.append((c w ,score w )).

7. The method for recommending candidate characters based on stroke comparison and optimizing OCR recognition results according to claim 6, characterized in that: The comparison process of the input character and the candidate characters of the character set 2 in the candidate character set is as follows: For each position y∈[0,n-1] in the stroke sequence S_ocr of the input character, delete the y-th stroke s y Construct the deletion variant S_del y , record the deleted strokes s y , and (S_del y ,s y ) is added to the deletion set, where n represents the length of the pen sequence column, n=len(S_ocr); For all candidate characters c w-1 ∈ character set 2, if its stroke sequence is equal to any deletion variant S_del y , then remember the score w-1 =StrokeDiffMatrix[s y ][0], and (c w-1 ,score w-1 ) is added to the candidate character set CandidateSet, and CandidateSet.append((c w-1 ,score w-1 )).

8. The method for recommending candidate characters based on stroke comparison and optimizing OCR recognition results according to claim 7, characterized in that: The comparison process of the input character and the candidate characters of character set 3 in the candidate character set is as follows: For each position r∈[0,n] in the stroke sequence S_ocr of the input character and the corresponding stroke code x, x∈{1,2,3,4,5}, insert x into the corresponding position in S_ocr to get S_ins r , and (S_ins r ,x) is added to the insertion set; For all candidate characters c w+1 ∈ character set three, if its stroke sequence is the same as any S_ins r If they are exactly the same, remember to score w+1 =StrokeDiffMatrix[0][x], and (c w+1 ,score w+1 ) is added to the candidate character set CandidateSet, and CandidateSet.append((c w+1 ,score w+1 )).

Citation Information

Patent Citations

  • Method and device for hand writing identification using character structural information for post treatment

    CN101149805A

  • Writing information evaluation method and device, electronic equipment and storage medium

    CN115346223A

  • Device and method for teaching writing order and number of strokes and recording medium including the method

    JP2001350396A