Character recognition method and device, storage medium and electronic equipment

By identifying the types of areas to be identified in the image and using corresponding dictionaries for recognition, the recognition confusion problem in text recognition technology is solved, and the recognition accuracy and efficiency are improved.

CN119296107APending Publication Date: 2025-01-10ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411321613.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

During the recognition process, the existing text recognition technology confirms the actual recognition results of the characters to be recognized from the same dictionary, resulting in problems of confusion and low accuracy. For example, the number 0 and the English character o, the number 1 and the English character I are easily confused.

Method used

By determining the character types corresponding to each area to be recognized in the image to be recognized, and using a corresponding dictionary for recognition, the actual recognition results of each character are avoided from confirming from the same dictionary, thereby improving the recognition accuracy.

Benefits of technology

It improves the accuracy of text recognition results, avoids recognition errors, enhances recognition efficiency, and achieves the "plug and play" effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119296107A_ABST
    Figure CN119296107A_ABST
Patent Text Reader

Abstract

The invention discloses a character recognition method and device, a storage medium and electronic equipment. The method comprises the following steps: acquiring an image to be recognized, determining each area to be recognized contained in the image to be recognized, determining a dictionary suitable for each area to be recognized according to a character type corresponding to the determined area to be recognized, and recognizing the area to be recognized through a preset recognition model. Identifying character information contained in each to-be-identified area in the to-be-identified image, obtaining a candidate identification result of each character contained in the to-be-identified area through an identification model, and identifying the character in the to-be-identified area according to the candidate identification result of each character contained in the to-be-identified area. And determining an identification result in the dictionary suitable for the to-be-identified area from candidate identification results of the character obtained through the identification model, taking the identification result as an actual identification result of the character, and determining a character identification result for the to-be-identified image according to the actual identification result of each character contained in the to-be-identified area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of computer technology and artificial intelligence, and in particular to a text recognition method, device, storage medium and electronic device. Background Art

[0002] Artificial intelligence technology is applied in many fields, and the recognition model in electronic identity authentication is an important application field of artificial intelligence technology. Electronic identity authentication is an identity authentication method based on network technology. It uses the recognition model to extract the user's personal information from the image of the document to be verified with the user's permission to identify the user.

[0003] For example, in the financial field, for bank card recognition and transaction data entry, the image information of the certificate permitted by the user can be recognized to improve the processing speed and accuracy of the business; in entry and exit management, entry management agencies such as airports and customs can quickly and accurately read passport information, improve work efficiency, and reduce human errors.

[0004] At present, in the recognition process, since the actual recognition results of each character to be recognized contained in the image to be recognized are confirmed from the same dictionary, recognition confusion may occur, such as recognizing the number 0 as the English character o, or recognizing the number 1 as the English character I. The emergence of this situation has resulted in the current text recognition accuracy being relatively low. Summary of the invention

[0005] The embodiments of this specification provide a text recognition method, device, storage medium and electronic device to partially solve the problems existing in the above-mentioned prior art.

[0006] The embodiments of this specification adopt the following technical solutions:

[0007] This manual provides a text recognition method, including:

[0008] Acquire an image to be identified, wherein the image to be identified contains text information to be identified;

[0009] Determine each to-be-recognized area contained in the to-be-recognized image, where different to-be-recognized areas correspond to text information of different character types;

[0010] For each area to be recognized, according to the determined character type corresponding to the area to be recognized, determine a dictionary applicable to the area to be recognized;

[0011] Using a preset recognition model, the text information contained in each to-be-recognized area in the to-be-recognized image is recognized, wherein for each to-be-recognized area, a candidate recognition result of each character contained in the to-be-recognized area is obtained through the recognition model, and for each character contained in the to-be-recognized area, a recognition result in a dictionary applicable to the to-be-recognized area is determined from the candidate recognition results of the character obtained through the recognition model as an actual recognition result of the character;

[0012] The text recognition result for the image to be recognized is determined according to the actual recognition result of each character contained in the area to be recognized.

[0013] Optionally, determining each to-be-recognized area contained in the to-be-recognized image specifically includes:

[0014] Determining an image template corresponding to the image to be identified;

[0015] According to the image areas pre-divided in the image template, each to-be-recognized area contained in the to-be-recognized image is determined.

[0016] Optionally, before determining each to-be-recognized area contained in the to-be-recognized image according to the image area pre-divided in the image template, the method further includes:

[0017] Determining an image size of the image template;

[0018] Adjusting the image to be recognized to the image size to obtain an adjusted image;

[0019] Determining each to-be-recognized area contained in the to-be-recognized image according to the image area pre-divided in the image template specifically includes:

[0020] According to the image areas pre-divided in the image template, each to-be-identified area contained in the adjusted image is determined.

[0021] Optionally, determining the character type corresponding to the area to be recognized specifically includes:

[0022] Determine the coordinates of the area to be identified in the image to be identified;

[0023] The character type corresponding to the area to be recognized is determined according to the coordinates of the area to be recognized in the image to be recognized and the correspondence between each coordinate and each character type in the image template.

[0024] Optionally, for each area to be recognized and for each character contained in the area to be recognized, determining a recognition result in a dictionary applicable to the area to be recognized from candidate recognition results of the character obtained by the recognition model, specifically including:

[0025] For each character included in the to-be-recognized area, determining the probability of each candidate recognition result for the character by using the recognition model;

[0026] Sorting the candidate recognition results of the character in descending order of probability to obtain a sorting result;

[0027] For each candidate recognition result corresponding to the character, determine whether the candidate recognition result is located in the dictionary applicable to the area to be recognized. If so, use the candidate recognition result as the actual recognition result of the character. Otherwise, determine whether the next candidate recognition result located below the candidate recognition result in the sorting result is located in the dictionary applicable to the area to be recognized.

[0028] Optionally, for each character included in the area to be recognized, a recognition result in a dictionary applicable to the area to be recognized is determined from candidate recognition results of the character obtained by the recognition model as an actual recognition result of the character, specifically including:

[0029] Deploy a dictionary applicable to the area to be identified;

[0030] For each character contained in the area to be recognized, after determining the candidate recognition result of the character through the recognition model, the dictionary applicable to the area to be recognized is called to determine the recognition result located in the dictionary applicable to the area to be recognized from the candidate recognition results of the character as the actual recognition result of the character.

[0031] This specification provides a text recognition device, including:

[0032] An acquisition module is used to acquire an image to be recognized, wherein the image to be recognized contains text information to be recognized;

[0033] A region determination module, used to determine each region to be identified contained in the image to be identified, where different regions to be identified correspond to text information of different character types;

[0034] A dictionary determination module is used to determine, for each area to be identified, a dictionary applicable to the area to be identified according to the determined character type corresponding to the area to be identified;

[0035] A recognition module, used to recognize text information contained in each to-be-recognized area in the to-be-recognized image by using a preset recognition model, wherein for each to-be-recognized area, a candidate recognition result of each character contained in the to-be-recognized area is obtained by using the recognition model, and for each character contained in the to-be-recognized area, a recognition result in a dictionary applicable to the to-be-recognized area is determined from the candidate recognition results of the character obtained by using the recognition model as an actual recognition result of the character;

[0036] The result determination module is used to determine the text recognition result for the image to be recognized according to the actual recognition result of each character contained in the area to be recognized.

[0037] Optionally, the region determination module is specifically used to determine an image template corresponding to the image to be identified; and determine each region to be identified contained in the image to be identified according to the image region pre-divided in the image template.

[0038] Optionally, before determining each to-be-recognized area contained in the to-be-recognized image according to the image area pre-divided in the image template, the area determination module is further used to determine the image size of the image template, adjust the to-be-recognized image to the image size, and obtain an adjusted image;

[0039] The region determination module is specifically used to determine each to-be-identified region contained in the adjusted image according to the image region pre-divided in the image template.

[0040] Optionally, the dictionary determination module is specifically used to determine the coordinates of the area to be identified in the image to be identified; determine the character type corresponding to the area to be identified based on the coordinates of the area to be identified in the image to be identified and the correspondence between each coordinate and each character type in the image template.

[0041] Optionally, the recognition module is specifically used to determine, for each character contained in the area to be recognized, the probability of each candidate recognition result for the character through the recognition model; sort the candidate recognition results of the character in order of the probability of each candidate recognition result of the character from large to small to obtain a sorted result; for each candidate recognition result corresponding to the character, determine whether the candidate recognition result is located in the dictionary applicable to the area to be recognized; if so, use the candidate recognition result as the actual recognition result of the character; otherwise, determine whether the next candidate recognition result located below the candidate recognition result in the sorted result is located in the dictionary applicable to the area to be recognized.

[0042] Optionally, the recognition module is specifically used to deploy a dictionary applicable to the area to be recognized; for each character contained in the area to be recognized, after determining the candidate recognition result of the character through the recognition model, the dictionary applicable to the area to be recognized is called to determine the recognition result in the dictionary applicable to the area to be recognized from the candidate recognition results of the character as the actual recognition result of the character.

[0043] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned text recognition method is implemented.

[0044] The present specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned text recognition method when executing the program.

[0045] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:

[0046] In the embodiment of the present specification, after first acquiring the image to be recognized, each area to be recognized contained in the image to be recognized is determined, and the character types of the text information corresponding to different areas to be recognized are not exactly the same. For each area to be recognized, the dictionary applicable to the area to be recognized is determined according to the character type corresponding to the determined area to be recognized, and then, the text information contained in each area to be recognized in the image to be recognized is recognized through a preset recognition model, wherein, for each area to be recognized, a candidate recognition result of each character contained in the area to be recognized is obtained through the recognition model, and for each character contained in the area to be recognized, a recognition result located in the dictionary applicable to the area to be recognized is determined from the candidate recognition results of the character obtained through the recognition model as the actual recognition result of the character, and the text recognition result for the image to be recognized is determined according to the actual recognition result of each character contained in the area to be recognized, wherein the image to be recognized contains text information that needs to be recognized.

[0047] In this method, for each area in the image to be recognized, each character contained in the area can be recognized by using the dictionary applicable to the area, avoiding the problem of character recognition errors caused by confirming the actual recognition results of each character from the same dictionary, thereby improving the accuracy of the text recognition results. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0049] Figure 1 A flowchart of a text recognition method provided in an embodiment of this specification;

[0050] Figure 2 A schematic diagram of an image to be recognized obtained in a text recognition method provided in an embodiment of this specification;

[0051] Figure 3 A schematic diagram of each to-be-recognized area contained in an image to be recognized determined in a text recognition method provided in an embodiment of this specification;

[0052] Figure 4 A schematic diagram of an image template in a text recognition method provided in an embodiment of this specification;

[0053] Figure 5 A structural schematic diagram of a text recognition device provided in an embodiment of this specification;

[0054] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0056] Artificial intelligence technology is applied in many fields, and the recognition model in electronic identity authentication is an important application field of artificial intelligence technology.

[0057] Electronic identity authentication is an identity authentication method based on network technology. It uses the core advantages of artificial intelligence through recognition models to extract the user's personal information from the image of the document to be verified with the user's permission, so as to identify the user.

[0058] For example, in the financial field, for bank card recognition, transaction data entry, document management and other businesses, the image information of the certificate permitted by the user can be recognized to improve the processing speed and accuracy of the business; in entry and exit management, at airports and entry management agencies such as customs, passport information can be read quickly and accurately, improving work efficiency and reducing human errors.

[0059] However, since the recognition model confirms the actual recognition results of each character to be recognized from the same dictionary during the recognition process, incorrect recognition results may occur, such as confusing Chinese characters with similar characters in English, recognizing the number 0 as the English character o, or recognizing the number 1 as the English character I, which leads to errors in the output results after recognition and reduces the recognition accuracy.

[0060] In order to solve the above problem, in an embodiment of the present specification, after first acquiring the image to be recognized, each area to be recognized contained in the image to be recognized is determined, and the character types of the text information corresponding to different areas to be recognized are not exactly the same. For each area to be recognized, the dictionary applicable to the area to be recognized is determined according to the character type corresponding to the determined area to be recognized, and then, the text information contained in each area to be recognized in the image to be recognized is recognized through a preset recognition model, wherein, for each area to be recognized, a candidate recognition result of each character contained in the area to be recognized is obtained through the recognition model, and for each character contained in the area to be recognized, a recognition result in the dictionary applicable to the area to be recognized is determined from the candidate recognition results of the character obtained through the recognition model as the actual recognition result of the character, and the text recognition result for the image to be recognized is determined according to the actual recognition result of each character contained in the area to be recognized, wherein the image to be recognized contains text information that needs to be recognized.

[0061] In this method, the character type corresponding to each area to be recognized in the image to be recognized is determined to obtain a dictionary applicable to each area to be recognized. Thus, the actual recognition result of the character is determined using the dictionary applicable to the area to be recognized, thereby avoiding the problem of errors caused by confirming the actual recognition results of characters of different character types from the same dictionary, thereby improving the accuracy of the text recognition results.

[0062] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0063] Figure 1 A flowchart of a text recognition method provided in an embodiment of this specification includes:

[0064] S100: Acquire an image to be recognized, wherein the image to be recognized contains text information to be recognized.

[0065] For a text recognition method provided in this specification, a terminal device such as a desktop computer, a notebook computer, etc. can be used as an execution subject, or a server can be used as an execution subject. For the sake of ease of description, the following only takes the terminal device as the execution subject to describe a text recognition method provided in this specification.

[0066] In this specification, the terminal device first needs to obtain an image to be recognized, and the image to be recognized contains text information that needs to be recognized.

[0067] Among them, the image to be identified mentioned here can be a document image, such as an ID card, a driver's license, a student ID card and other types of documents. The image to be identified here is obtained by collecting the document that is photographed with the user's permission. By identifying the collected document image, the user's identity information is reviewed to help the user complete business operations such as verification or user registration.

[0068] Figure 2 A schematic diagram of an image to be recognized obtained in a text recognition method provided in an embodiment of this specification.

[0069] by Figure 2 For example, the document type of the image to be identified is an ID card, which contains information such as name, gender, ethnicity, birthplace, address, and citizen ID number. The terminal device uses a preset recognition model to identify the ID card. Figure 2 The image of the certificate is recognized and then the identity information of the user using the certificate is verified.

[0070] S102: Determine each to-be-recognized region contained in the to-be-recognized image, wherein the character types of text information corresponding to different to-be-recognized regions are not completely the same.

[0071] In the embodiments of the present specification, after the terminal device obtains the image to be identified, in order to clarify which features contained in the image to be identified need to be identified before completing the verification of the user, it is necessary to determine the various areas to be identified contained in the image to be identified, and then identify the characters in each area to be identified to obtain the recognition results of each area to be identified.

[0072] Among them, the character types of text information corresponding to different to-be-recognized areas are not completely the same, which can be understood as the content contained in each to-be-recognized area is different, so the character types contained in these to-be-recognized areas may also be different. For example, the character type in to-be-recognized area A is Chinese characters, and the character type in to-be-recognized area B is also Chinese characters.

[0073] Specifically, in the present specification, after the terminal device acquires the image to be identified, it will determine the image template corresponding to the image to be identified according to the type of certificate corresponding to the image to be identified. Since the image template indicates the positions of the various areas in the image template that contain the text information to be identified, when it is necessary to accurately determine the various areas to be identified contained in the image to be identified, it is necessary to adjust the image size of the image to be identified to the image size of the image template according to the image size of the image template to obtain the adjusted image, and then, determine the various areas to be identified contained in the image to be identified according to the image areas pre-divided in the image template.

[0074] Among them, the image template is the common regional features of the document type corresponding to the image to be identified. For example, if the image to be identified is an ID card type, then the image template is the ID card template, which contains the positions of the areas to be identified corresponding to the name, gender, nationality, birth, address and citizen ID number, and the character types corresponding to each area to be identified; for another example, if the image to be identified is a student ID card type, then the image template is the student ID card template, which contains the positions of the areas to be identified corresponding to the student number, name, gender, and college, and the character types corresponding to each area to be identified.

[0075] In addition, in addition to adjusting the image size of the image to be identified according to the image size of the image template, the image to be identified can also be corrected by performing an affine transformation on the image to be identified through an affine transformation matrix to obtain an image to be identified with a normal perspective and shape, thereby avoiding inaccurate recognition results caused by tilt, twist or distortion of the image to be identified, thereby improving the accuracy of the recognition results.

[0076] There are many methods for determining the area to be identified, such as using edge recognition method to determine the edge through the area where the grayscale changes sharply in the image to be identified, and then using an algorithm to connect these edge points to form a complete edge contour to obtain the area to be identified, or using a template matching method to match the image to be identified with the image area in the image template that was first divided in the image template, and use the area whose similarity reaches a preset similarity threshold as the area to be identified.

[0077] Figure 3 A schematic diagram of various areas to be identified contained in an image to be identified in a method for text recognition provided in an embodiment of this specification.

[0078] by Figure 3 For example, after confirming the areas to be identified contained in the image to be identified, Figure 3 In the form represented in , the image area to be identified is framed, and the determined areas to be identified are identified by a preset recognition model to obtain the final recognition result.

[0079] S104: For each area to be recognized, determine a dictionary applicable to the area to be recognized according to the determined character type corresponding to the area to be recognized.

[0080] After obtaining each area to be recognized in the above manner, the coordinates of each area to be recognized in the image to be recognized can be obtained according to the bounding box corresponding to each area to be recognized. In order to clarify in which character type dictionary the recognition model should search for the text characters in the area to be recognized, the terminal device needs to determine the character type corresponding to each area to be recognized and according to the character type corresponding to each area to be recognized contained in the image template corresponding to the image to be recognized, and then obtain the dictionary applicable to each area to be recognized, wherein the coordinate information corresponding to each area to be recognized may refer to the coordinates of the four corners of the bounding box of each area to be recognized.

[0081] Specifically, in the present specification, for each area to be recognized, since the image template not only indicates each area to be recognized, but also indicates the character type corresponding to the position of each area to be recognized, therefore, according to the character type corresponding to the position of each area to be recognized indicated in the image template, and the coordinates of each area to be recognized in the image to be recognized, the character type corresponding to each area to be recognized is obtained, and then, the dictionary applicable to each area to be recognized is determined according to the character type.

[0082] Figure 4 A schematic diagram of an image template used in a text recognition method provided in an embodiment of this specification.

[0083] like Figure 4 As shown, Figure 4 The image template of the ID card is shown in the figure. The image template not only contains the location of each area to be recognized, but also includes the text type corresponding to each area to be recognized. For example, the character types corresponding to the areas to be recognized corresponding to the name, gender and ethnicity are all Chinese characters, the character types corresponding to the areas to be recognized corresponding to the birth and citizen ID number are all numbers (0-9), and the character types corresponding to the areas to be recognized corresponding to the address include both Chinese characters and numbers (0-9).

[0084] In detail, the coordinates corresponding to each area to be identified are compared with the coordinates corresponding to the image area pre-divided in the image template, and the character type corresponding to each area to be identified is determined based on the correspondence between each image area pre-divided in the image template and each character type.

[0085] Furthermore, the terminal device determines the dictionary applicable to each area to be recognized according to the character type corresponding to each area to be recognized, so that in the subsequent character recognition process, it is clear which character type dictionary to use to obtain the actual recognition results of the characters contained in each area to be recognized.

[0086] S106: The text information contained in each area to be recognized in the image to be recognized is recognized through a preset recognition model, wherein, for each area to be recognized, a candidate recognition result of each character contained in the area to be recognized is obtained through the recognition model, and for each character contained in the area to be recognized, a recognition result in the dictionary applicable to the area to be recognized is determined from the candidate recognition results of the character obtained through the recognition model as the actual recognition result of the character.

[0087] In this specification, after the terminal device clearly defines the dictionary applicable to each area to be recognized, it uses a preset recognition model to recognize the text information contained in each area to be recognized in the image to be recognized, wherein, for each area to be recognized, a candidate recognition result of each character contained in the area to be recognized is obtained through the preset recognition model, and for each character contained in the area to be recognized, the recognition result in the dictionary applicable to the area to be recognized is determined from the candidate recognition results of the character obtained by the recognition model as the actual recognition result of the character, that is, the actual recognition result of each character is confirmed from the candidate recognition results of each character contained in the area to be recognized through the dictionary applicable to the area to be recognized.

[0088] Specifically, in this specification, it is necessary to deploy a dictionary applicable to each area to be recognized in the terminal device. Then, when the preset recognition model performs character recognition on the area to be recognized, the dictionary applicable to the area to be recognized can be called, and the recognition result in the dictionary applicable to each area to be recognized is obtained from the candidate recognition results of each character contained in each area to be recognized determined by the preset recognition model as the actual recognition result of the character.

[0089] To elaborate, the terminal device can input each area to be recognized into a preset recognition model, and for each area to be recognized, determine the probability of each candidate recognition result for the character through the preset recognition model, and sort the candidate recognition results of the character in order of the probability of each candidate recognition result of the character from large to small to obtain a sorted result, thereby, for each candidate recognition result corresponding to the character, determine whether the candidate recognition result is located in the dictionary applicable to the area to be recognized, and if so, use the candidate recognition result as the actual recognition result of the character, otherwise, determine whether the next candidate recognition result located below the candidate recognition result in the sorted result is located in the dictionary applicable to the area to be recognized.

[0090] Taking the area A to be recognized as an example, the terminal device inputs the area A to be recognized into the preset recognition model, and obtains the probability of each candidate recognition result for the character through the preset recognition model. It is assumed that the probability of candidate recognition result 1 is 89%, and the corresponding character is English character I, the probability of candidate recognition result 2 is 93%, and the corresponding character is number 1, ..., the probability of candidate recognition result 11 is 95%, and the corresponding character is number 2, ..., the probability of candidate recognition result n is 9%, and the corresponding character is Chinese character one. According to the order of the probabilities of each candidate recognition result of the character from large to small, the candidate recognition results of the character are sorted to obtain the sorting result, that is, the sorting result is that the probability of candidate recognition result 11 is 95%, and the corresponding character is number 2, the probability of candidate recognition result 2 is 93%, and the corresponding character is number 1, ..., the probability of candidate recognition result n is 9%, and the corresponding character is Chinese character one. Then, according to the order of the probabilities of each candidate recognition result from large to small, it is judged in turn whether the candidate recognition result is located in the dictionary applicable to the area to be recognized.

[0091] For the candidate recognition result 11 that is ranked first in the sorting result, if it is determined that the candidate recognition result is located in the dictionary applicable to the area to be recognized, then the candidate recognition result is used as the actual recognition result of the character; otherwise, it is determined whether the next candidate recognition result located below the candidate recognition result in the sorting result is located in the dictionary applicable to the area to be recognized.

[0092] That is, the character number 2 with the highest probability of 95% is searched in the dictionary applicable to the area A to be recognized, that is, the digital dictionary. If it is determined that the number 2 is in the digital dictionary, the actual recognition result of the character is considered to be the number 2.

[0093] Here, it is only assumed that the highest probability of the candidate recognition results is 95% and the lowest probability is 9%. In specific application scenarios, the candidate recognition results can be accurately sorted according to the actual probabilities of the candidate recognition results.

[0094] S108: Determine a text recognition result for the image to be recognized according to an actual recognition result of each character included in the area to be recognized.

[0095] After obtaining the actual recognition results of each character contained in each area to be recognized in the above manner, for each area to be recognized, the actual recognition results of each character contained in the area to be recognized are integrated according to the order of the output results to obtain the text recognition result corresponding to the area to be recognized.

[0096] Furthermore, the actual recognition result corresponding to each area to be identified is compared with the ID information stored by the user in the preset database to determine whether the ID information verified by the user is consistent with the ID information entered into the preset database, thereby helping the user to perform identity authentication or user registration and other operations.

[0097] It can be seen from the above content that by determining the character type corresponding to each area to be identified in the image to be identified, the applicable dictionary for each area to be identified is obtained. Thus, the actual recognition result of the character is determined using the dictionary applicable to the area to be identified, thereby avoiding the problem of errors in confirming the actual recognition results of different character types from the same dictionary, thereby improving the accuracy of the text recognition results.

[0098] In addition, this manual does not require the use of a large amount of similar character data to retrain the preset recognition model. It only requires that when the original preset recognition model is confirming the actual recognition result of the candidate results corresponding to each character, the dictionary applicable to each area to be recognized is called to select the actual recognition result corresponding to the character to be recognized from the characters corresponding to the candidate recognition results of the character to be recognized contained in the area to be recognized, thereby achieving a "plug and play" effect, thereby effectively improving the efficiency of text recognition.

[0099] The above is a text recognition method provided in an embodiment of this specification. Based on the same idea, this specification also provides corresponding devices, storage media and electronic devices.

[0100] Figure 5 A schematic diagram of a text recognition device provided in an embodiment of this specification, the device comprising:

[0101] The acquisition module 501 is used to acquire an image to be recognized, wherein the image to be recognized contains text information to be recognized;

[0102] The region determination module 502 is used to determine each region to be identified contained in the image to be identified, and different regions to be identified correspond to text information of different character types;

[0103] A dictionary determination module 503 is used to determine, for each area to be recognized, a dictionary applicable to the area to be recognized according to the determined character type corresponding to the area to be recognized;

[0104] The recognition module 504 is used to recognize the text information contained in each to-be-recognized area in the to-be-recognized image by using a preset recognition model, wherein for each to-be-recognized area, a candidate recognition result of each character contained in the to-be-recognized area is obtained by using the recognition model, and for each character contained in the to-be-recognized area, a recognition result in a dictionary applicable to the to-be-recognized area is determined from the candidate recognition results of the character obtained by using the recognition model as an actual recognition result of the character;

[0105] The result determination module 505 is used to determine the text recognition result for the image to be recognized according to the actual recognition result of each character contained in the area to be recognized.

[0106] Optionally, the region determination module 502 is specifically configured to determine an image template corresponding to the image to be identified; and determine each region to be identified contained in the image to be identified according to image regions pre-divided in the image template.

[0107] Optionally, the region determination module 502 is further configured to determine an image size of the image template before determining each to-be-recognized region contained in the to-be-recognized image according to the image regions pre-divided in the image template; and adjust the to-be-recognized image to the image size to obtain an adjusted image;

[0108] The region determination module 502 is specifically configured to determine each to-be-identified region contained in the adjusted image according to the image region pre-divided in the image template.

[0109] Optionally, the area determination module 502 is specifically used to determine the coordinates of the area to be identified in the image to be identified; determine the character type corresponding to the area to be identified based on the coordinates of the area to be identified in the image to be identified and the correspondence between each coordinate and each character type in the image template.

[0110] Optionally, the recognition module 504 is specifically used to determine, for each character contained in the area to be recognized, the probability of each candidate recognition result for the character through the recognition model; sort the candidate recognition results of the character in order of the probability of each candidate recognition result of the character from large to small to obtain a sorted result; for each candidate recognition result corresponding to the character, determine whether the candidate recognition result is located in the dictionary applicable to the area to be recognized; if so, use the candidate recognition result as the actual recognition result of the character; otherwise, determine whether the next candidate recognition result located below the candidate recognition result in the sorted result is located in the dictionary applicable to the area to be recognized.

[0111] Optionally, the recognition module 504 is specifically used to deploy a dictionary applicable to the area to be recognized; for each character contained in the area to be recognized, after determining the candidate recognition result of the character through the recognition model, the dictionary applicable to the area to be recognized is called to determine the recognition result in the dictionary applicable to the area to be recognized from the candidate recognition results of the character as the actual recognition result of the character.

[0112] This specification also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, it can be used to perform the above Figure 1 A text recognition method is provided.

[0113] based on Figure 1 A text recognition method is shown, and the embodiment of this specification also provides Figure 6 The structural diagram of the electronic device shown in FIG. Figure 6 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 A text recognition method.

[0114] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0115] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0116] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0117] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0118] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0119] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0120] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0121] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0122] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0123] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0124] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0125] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0126] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0127] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0128] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0129] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0130] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.

Claims

1. A text recognition method, comprising: Acquire an image to be identified, wherein the image to be identified contains text information to be identified; Determine each to-be-recognized area contained in the to-be-recognized image, where the character types of text information corresponding to different to-be-recognized areas are not completely the same; For each area to be recognized, according to the determined character type corresponding to the area to be recognized, determine a dictionary applicable to the area to be recognized; Using a preset recognition model, the text information contained in each to-be-recognized area in the to-be-recognized image is recognized, wherein for each to-be-recognized area, a candidate recognition result of each character contained in the to-be-recognized area is obtained through the recognition model, and for each character contained in the to-be-recognized area, a recognition result in a dictionary applicable to the to-be-recognized area is determined from the candidate recognition results of the character obtained through the recognition model as an actual recognition result of the character; The text recognition result for the image to be recognized is determined according to the actual recognition result of each character contained in the area to be recognized.

2. The method according to claim 1, wherein determining each area to be identified contained in the image to be identified comprises: Determining an image template corresponding to the image to be identified; According to the image areas pre-divided in the image template, each to-be-recognized area contained in the to-be-recognized image is determined.

3. The method according to claim 2, before determining each to-be-recognized area contained in the to-be-recognized image according to the image area pre-divided in the image template, the method further comprises: Determining an image size of the image template; Adjusting the image to be recognized to the image size to obtain an adjusted image; Determining each to-be-recognized area contained in the to-be-recognized image according to the image area pre-divided in the image template specifically includes: According to the image areas pre-divided in the image template, each to-be-identified area contained in the adjusted image is determined.

4. The method according to claim 2, wherein determining the character type corresponding to the area to be recognized comprises: Determine the coordinates of the area to be identified in the image to be identified; The character type corresponding to the area to be recognized is determined according to the coordinates of the area to be recognized in the image to be recognized and the correspondence between each coordinate and each character type in the image template.

5. The method according to claim 1, for each area to be recognized and for each character contained in the area to be recognized, determining a recognition result in a dictionary applicable to the area to be recognized from candidate recognition results of the character obtained by the recognition model, specifically comprising: For each character included in the to-be-recognized area, determining the probability of each candidate recognition result for the character by using the recognition model; Sorting the candidate recognition results of the character in descending order of probability to obtain a sorting result; For each candidate recognition result corresponding to the character, determine whether the candidate recognition result is located in the dictionary applicable to the area to be recognized. If so, use the candidate recognition result as the actual recognition result of the character. Otherwise, determine whether the next candidate recognition result located below the candidate recognition result in the sorting result is located in the dictionary applicable to the area to be recognized.

6. The method according to claim 1, for each character contained in the area to be recognized, determining a recognition result in a dictionary applicable to the area to be recognized from the candidate recognition results of the character obtained by the recognition model as the actual recognition result of the character, specifically comprising: Deploy a dictionary applicable to the area to be identified; For each character contained in the area to be recognized, after determining the candidate recognition result of the character through the recognition model, the dictionary applicable to the area to be recognized is called to determine the recognition result located in the dictionary applicable to the area to be recognized from the candidate recognition results of the character as the actual recognition result of the character.

7. A text recognition device, comprising: An acquisition module is used to acquire an image to be recognized, wherein the image to be recognized contains text information to be recognized; A region determination module, used to determine each region to be identified contained in the image to be identified, where different regions to be identified correspond to text information of different character types; A dictionary determination module is used to determine, for each area to be identified, a dictionary applicable to the area to be identified according to the determined character type corresponding to the area to be identified; A recognition module, used to recognize text information contained in each to-be-recognized area in the to-be-recognized image by using a preset recognition model, wherein for each to-be-recognized area, a candidate recognition result of each character contained in the to-be-recognized area is obtained by using the recognition model, and for each character contained in the to-be-recognized area, a recognition result in a dictionary applicable to the to-be-recognized area is determined from the candidate recognition results of the character obtained by using the recognition model as an actual recognition result of the character; The result determination module is used to determine the text recognition result for the image to be recognized according to the actual recognition result of each character contained in the area to be recognized.

8. The device as claimed in claim 7, wherein the region determination module is specifically used to determine the image template corresponding to the image to be identified; and determine each region to be identified contained in the image to be identified based on the image region pre-divided in the image template.

9. The device according to claim 8, wherein the region determination module is further used to determine the image size of the image template before determining each to-be-recognized region contained in the to-be-recognized image according to the image regions pre-divided in the image template, and adjust the to-be-recognized image to the image size to obtain an adjusted image; The region determination module is specifically used to determine each to-be-identified region contained in the adjusted image according to the image region pre-divided in the image template.

10. In the device as described in claim 8, the dictionary determination module is specifically used to determine the coordinates of the area to be recognized in the image to be recognized; and determine the character type corresponding to the area to be recognized based on the coordinates of the area to be recognized in the image to be recognized and the correspondence between each coordinate and each character type in the image template.

11. In the device as described in claim 7, the recognition module is specifically used to determine, for each character contained in the area to be recognized, the probability of each candidate recognition result for the character through the recognition model; sort the candidate recognition results of the character in order of the probability of each candidate recognition result of the character from large to small to obtain a sorted result; for each candidate recognition result corresponding to the character, determine whether the candidate recognition result is located in the dictionary applicable to the area to be recognized, and if so, use the candidate recognition result as the actual recognition result of the character, otherwise, determine whether the next candidate recognition result located at the candidate recognition result in the sorted result is located in the dictionary applicable to the area to be recognized.

12. In the device as described in claim 7, the recognition module is specifically used to deploy a dictionary applicable to the area to be recognized; for each dictionary contained in the area to be recognized, after determining the candidate recognition result of the character through the recognition model, the field applicable to the area to be recognized is called to determine the recognition result in the dictionary applicable to the area to be recognized from the candidate recognition results of the character as the actual recognition result of the character.

13. A computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 6 when executing the program.