Method and device for document text recognition
By using the method of text recognition and matching the keyword database for ID images, the problem of non-common identification of different types of IDs is solved, and an efficient and expandable document text recognition effect is achieved.
Patent Information
- Application Number
- CN202111287764.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-02
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2041-11-02
AI Technical Summary
In the prior art, the text recognition methods of different types of documents are not universal, resulting in repeated development. The deep convolutional neural network method consumes a lot of resources in training and computing, and cannot upgrade the categories.
Provide a document text recognition method, which can obtain document images, perform text recognition, match the keyword database with multiple types of documents, filter out the type with the highest matching degree, and output the recognition results according to the field structure rules of this type.
It has achieved high scalability in the identification of different types of documents, improved the recognition speed and efficiency, and avoided the problems of repeated development and high resource consumption.
Smart Images

Figure CN114005131B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of text recognition, and in particular to a document text recognition method and device. Background Art
[0002] OCR (Optical Character Recognition) technology is a technology that uses optical technology to scan and recognize text and characters. The general OCR output results are generally the coordinates of the border position of the text line and the position of the text line. The recognition of images of ID cards, bank cards, driver's licenses, vehicle registration certificates, business licenses, etc. often requires structured output field information. For example, an ID card needs to extract fields such as name, ID number, name, ethnicity, date of birth, address, etc., and the corresponding information of each field must be known.
[0003] In the prior art, each certificate uses a dedicated text recognition method for text recognition, which has low universality and often requires repeated development. Summary of the invention
[0004] The present invention provides a document text recognition method and device, which are used to solve the defect that the text recognition methods of different types of documents in the prior art are not universal, and realize a document text recognition method with strong universality.
[0005] The present disclosure provides a document text recognition method, comprising:
[0006] Get the document image;
[0007] Obtaining text recognition results on the certificate according to the certificate image;
[0008] Obtain key field lexicon for multiple types of certificates;
[0009] Matching the text recognition results with the contents of the key field word library of each type of certificate to obtain corresponding matching results;
[0010] Processing each of the matching results to obtain the type of the text recognition result with the highest matching degree;
[0011] The text recognition result is output according to the field structuring rules of the certificate type with the highest matching degree.
[0012] According to a document text recognition method provided by the present disclosure, obtaining a text recognition result on the document according to the document image specifically includes:
[0013] Inputting the document image into a text line detection model to obtain text line border information output by the text line detection model;
[0014] Inputting the text line frame information into a text line recognition model to obtain a text recognition result output by the text line recognition model;
[0015] Among them, the text line detection model is obtained by training the text line border position data and text line border position data labels of various types of certificates; the text line recognition model is obtained by training the text line text data and text line text data labels of various types of certificates.
[0016] According to a document text recognition method provided by the present disclosure, the text recognition results are matched with the contents in the key field word library of each type of document to obtain corresponding matching results, specifically including:
[0017] Set a score for each key field in the key field word library of each type of certificate;
[0018] The text recognition results are traversed and matched with the key fields in the key field word library of each type of certificate to obtain the matching scores of the text recognition results corresponding to each type of certificate, and the matching scores are used as matching results.
[0019] According to a document text recognition method provided by the present disclosure, the text recognition result is traversed and matched with each key field in the key field word library of each type of certificate, and the matching score of the text recognition result corresponding to each type of certificate is obtained, and the matching score is used as the matching result, which specifically includes:
[0020] The text recognition result is matched with each key field in the key field vocabulary of the set type of certificate in turn. When there is a key field in the text recognition result, the score corresponding to the matched key field is included in the score of the text recognition result. After traversing and matching each key field, the accumulated score of the text recognition result is used as the matching score of the text recognition result corresponding to the set type of certificate.
[0021] According to a document text recognition method provided by the present disclosure, the processing of each of the matching results to obtain the type of the text recognition result with the highest matching degree specifically includes:
[0022] Set matching threshold scores for each type of certificate;
[0023] Compare the matching scores of the text recognition results corresponding to each type of certificate with the matching threshold scores of each type of certificate, and select the pre-selected types whose matching scores are greater than the matching threshold scores;
[0024] The matching scores corresponding to the pre-selected types are standardized, and the pre-selected type with the largest value in the standardized processing result is taken as the type with the highest matching degree.
[0025] According to a method for document text recognition provided by the present disclosure, the matching scores corresponding to each pre-selected type are standardized, and the pre-selected type with the largest value of the standardized processing result is used as the type with the highest matching degree, specifically including: taking the ratio of the matching score corresponding to each pre-selected type to the corresponding matching threshold score as the standardized processing result, and taking the pre-selected type with the largest ratio value as the type with the highest matching degree.
[0026] According to a method for document text recognition provided by the present disclosure, the matching scores of the text recognition results corresponding to each type of document are compared with the matching threshold scores of each type of document, and pre-selected types with matching scores greater than the matching threshold scores are screened out. The method then also includes: when the number of pre-selected types screened out is 0, the text recognition results are directly standardized and outputted.
[0027] The present disclosure also provides a document text recognition device, comprising:
[0028] An image acquisition unit, used for acquiring a document image;
[0029] A text recognition unit, used to obtain text recognition results on the document based on the document image;
[0030] A key field word library acquisition unit, used to acquire key field word libraries of multiple types of certificates;
[0031] A key field matching unit, used to match the text recognition results with the contents of the key field word library of each type of certificate to obtain corresponding matching results;
[0032] A matching result processing and screening unit, used to process each of the matching results to obtain the type of the text recognition result with the highest matching degree;
[0033] The recognition result output unit is used to output the text recognition result according to the field structuring rule of the certificate type with the highest matching degree.
[0034] The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned methods for document text recognition are implemented.
[0035] The present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-mentioned methods for document text recognition.
[0036] The document text recognition method and device provided by the present invention recognize the image of the document as a text recognition result, then match it with the key field vocabulary of each type of document, screen out the type with the highest matching degree, and implement structured output of the text recognition result according to the field structuring rules of the document with the highest matching degree. The method and device have high scalability for the recognition of different types of documents and improve the recognition speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the present disclosure or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 It is a flowchart of the document text recognition method provided by the present disclosure;
[0039] Figure 2 yes Figure 1 Specific flow diagram of step 120;
[0040] Figure 3 yes Figure 1 A specific flow chart of step 140;
[0041] Figure 4 yes Figure 1 A specific flow chart of step 150;
[0042] Figure 5 It is a structural schematic diagram of the document text recognition device provided by the present disclosure;
[0043] Figure 6 It is a schematic diagram of the structure of an electronic device provided by the present disclosure. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of the present disclosure.
[0045] In the prior art, the recognition of images of ID cards, bank cards, driver's licenses, vehicle registration certificates, business licenses, etc. requires the identification of structured field information. For example, an ID card needs to extract fields such as name, ID number, name, ethnicity, date of birth, address, etc., and the corresponding information of each field must be known.
[0046] In the prior art, one of the methods for text recognition of certificate documents is to establish a corresponding special recognition method for each type of certificate to extract structured information. The second method is to use a deep convolutional neural network to extract image features and perform image classification.
[0047] However, developing a special method for each type of document has weak universality and often requires repeated development. The method of using deep convolutional neural networks for image classification and recognition requires relevant data training. After training, the category cannot be upgraded, and each type of document requires a large amount of data. In actual operation, due to the large amount of computation required by deep convolutional neural networks, it will take up more computing time and computing resources.
[0048] like Figure 1 As shown, the embodiment of the present disclosure provides a document text recognition method, comprising:
[0049] Step 110: Obtaining a document image;
[0050] Specifically, the ID card, driver's license, passport and other physical documents are photographed to obtain the corresponding document image.
[0051] Step 120: Obtain text recognition results on the certificate based on the certificate image;
[0052] Specifically, a general OCR technology is used on the document image to perform text recognition on the image to obtain a text recognition result on the document.
[0053] The document text recognition method provided by the embodiment of the present disclosure obtains the text recognition result on the document according to the document image, such as Figure 2 As shown, specifically including:
[0054] Step 210: inputting the document image into a text line detection model to obtain text line border information output by the text line detection model; wherein the text line detection model is obtained by training text line border position data and text line border position data labels of various types of documents;
[0055] Specifically, the text line border and the position of the text line border in the document image are identified through the text line detection model to form text box border information.
[0056] Step 220: Input the text line border information into a text line recognition model to obtain a text recognition result output by the text line recognition model; wherein the text line recognition model is obtained by training text line text data and text line text data labels of various types of certificates.
[0057] Specifically, the text line border information identified in step 210 is input into the text line recognition model, the text contents in the text line borders are respectively identified, and the text contents identified in the text line borders are summarized to obtain the text recognition result.
[0058] Step 130: Obtain key field word libraries of multiple types of certificates;
[0059] Specifically, in the embodiment of the present disclosure, in the subsequent steps, since the text recognition results are matched with the key field word library of each type of certificate, multiple key field word libraries of similar types can be set according to the type of certificate that actually needs to be matched. Therefore, the recognition method provided by the embodiment of the present disclosure has good scalability, and the key field word library of the corresponding type of certificate can be obtained before matching. For example, the key field word library of the ID card, the key field word library of the driver's license, the key field word library of the vehicle registration certificate, the key field word library of the passport, etc. can be obtained.
[0060] Step 140: Match the text recognition results with the contents in the key field word library of each type of certificate to obtain corresponding matching results;
[0061] Specifically, the text recognition results are matched and compared with the key fields in the key field word library corresponding to each type, and the matching results corresponding to each type of certificate are obtained.
[0062] The document text recognition method provided by the embodiment of the present disclosure matches the text recognition results with the contents in the key field word library of each type of document to obtain corresponding matching results, such as Figure 3 As shown, specifically including:
[0063] Step 310: setting a score for each key field in the key field word library of each type of certificate;
[0064] Specifically, each key field is assigned a value in the key field word library of each type of certificate. In some embodiments, different key fields may be assigned different scores to reflect the importance of the key field matching in the key field word library. For example, the key field word library of the Chinese ID card includes key fields such as "citizen identity number", "address", and "name". The key field of "citizen identity number" has a relatively large degree of distinction compared to other key fields in the key field word library of this type of certificate, and a larger score may be assigned to it. For example, the score of "citizen identity number" may be set to 5 points, and the score of "name" may be set to 1 point in the key field word library of the Chinese ID card. For another example, the key fields with relatively large degree of distinction may be set in the key field word library of the Hong Kong and Macau Pass: "Hong Kong and Macau Pass", "Exit and Entry Administration Bureau of the Ministry of Public Security" and larger scores.
[0065] Step 320: traverse and match the text recognition results with the key fields in the key field word library of each type of certificate to obtain the matching score of the text recognition results corresponding to each type of certificate, and use the matching score as the matching result.
[0066] Specifically, the characters in the text recognition result are matched with the key fields in the key field vocabulary in sequence, and when the content of the corresponding key field exists, the score corresponding to the key field is added to the matching score of the text recognition result corresponding to the certificate of this type.
[0067] In the embodiment of the present disclosure, the text recognition result is traversed and matched with each key field in the key field word library of each type of certificate, and the matching score of the text recognition result corresponding to each type of certificate is obtained, and the matching score is used as the matching result, which specifically includes:
[0068] The text recognition result is matched with each key field in the key field vocabulary of the set type of certificate in turn. When there is a key field in the text recognition result, the score corresponding to the matched key field is included in the score of the text recognition result. After traversing and matching each key field, the accumulated score of the text recognition result is used as the matching score of the text recognition result corresponding to the set type of certificate.
[0069] Specifically, after matching the text recognition results with the key field word library of each type of certificate, the matching results corresponding to each type of certificate, namely, the matching scores, are obtained.
[0070] For example, the matching score of the text recognition result corresponding to type A certificate is 10 points, the matching score corresponding to type B certificate is 8 points, and the matching score corresponding to type C certificate is 3 points.
[0071] Step 150: Processing each of the matching results to obtain the type of the text recognition result with the highest matching degree;
[0072] Specifically, the type with the highest matching degree is considered to be the certificate type most similar to the type of the certificate corresponding to the text recognition result, and the type with the highest matching degree is used as the type of the certificate corresponding to the identified text recognition result.
[0073] The document text recognition method provided by the embodiment of the present disclosure processes each of the matching results to obtain the type of the text recognition result with the highest matching degree, such as Figure 4 As shown, specifically including:
[0074] Step 410: setting a matching threshold score for each type of certificate;
[0075] Since the text processing results may include key fields in the key field word library corresponding to multiple types of certificates, the text processing results have a certain score for each certificate type. For example, the text recognition result in the above example has a matching score of 10 points for type A certificates, 8 points for type B certificates, and 3 points for type C certificates.
[0076] Specifically, the matching threshold score for type A certificates is set to 5 points, the matching threshold score for type B certificates is set to 5 points, and the matching threshold score for type C certificates is set to 4 points.
[0077] Specifically, the purpose of setting the matching threshold scores for each type of certificate is that when the text recognition result is greater than the certificate type corresponding to the matching threshold score, it is considered to be a valid type recognition, that is, the text recognition result has a greater similarity with the corresponding certificate type and the effectively recognized certificate type.
[0078] Step 420: Compare the matching scores of the text recognition results corresponding to each type of certificate with the matching threshold scores of each type of certificate, and select the pre-selected types whose matching scores are greater than the matching threshold scores;
[0079] Specifically, the certificate type with a high similarity to the certificate type corresponding to the text recognition result is screened out as the pre-selected type.
[0080] As in the above example, the matching score of the text recognition result corresponding to type A certificate is 10 points, and the matching threshold score of type A certificate is 5 points, so type A is used as the pre-selected type. Similarly, type B is used as the pre-selected type, while type C is not used as the pre-selected type.
[0081] In some embodiments, the matching scores of the text recognition results corresponding to each type of certificate are compared with the matching threshold scores of each type of certificate, and pre-selected types with matching scores greater than the matching threshold scores are screened out, and then the text recognition results are directly standardized and output when the number of pre-selected types screened out is 0. Specifically, after the text recognition results are matched with the key field word library of each type of certificate, the matching scores corresponding to each type are all lower than the matching threshold scores of the corresponding types, that is, the number of pre-selected types is 0, indicating that there are no certificates similar to the certificate type corresponding to the text recognition results among the matched types of certificates, so the text recognition results can be directly standardized and output.
[0082] Step 430: normalize the matching scores corresponding to the pre-selected types, and take the pre-selected type with the largest normalization result value as the type with the highest matching degree.
[0083] Specifically, the pre-selected type with the highest matching degree with the certificate type corresponding to the text recognition result is selected from the pre-selected types as the certificate type corresponding to the text recognition result.
[0084] In the disclosed embodiment, the matching scores corresponding to the pre-selected types are standardized, and the pre-selected type with the largest standardized processing result value is used as the type with the highest matching degree, specifically including: taking the ratio of the matching score corresponding to each pre-selected type to the corresponding matching threshold score as the standardized processing result, and taking the pre-selected type with the largest ratio value as the type with the highest matching degree. For each type of certificate, the matching score is compared with the matching threshold score, which can enhance the independence of the threshold setting of each type of certificate and achieve higher scalability of matching types.
[0085] Specifically, as in the above example, since type A and type B are pre-selected types, where the ratio of the standardized processing results of type A is 2 and the ratio of the standardized processing results of type B is 1.6, type A is selected as the type with the highest matching degree.
[0086] Step 160: Output the text recognition result according to the field structuring rules of the certificate type with the highest matching degree.
[0087] Specifically, as in the above example, type A is the type with the highest matching degree, that is, the document type corresponding to the text recognition result is considered to be type A. For example, when type A is the Chinese ID card type, the text recognition result is output after field structuring according to the field structuring rules on the Chinese ID card.
[0088] The embodiment of the present disclosure provides a text recognition method applicable to certificate documents, which is used to automatically recognize text on certificate documents. In some other embodiments, the method provided by the embodiment of the present disclosure is also applicable to the recognition of text on documents such as bills, medical prescriptions, and medical records.
[0089] The following is a description of a certificate text recognition device provided in an embodiment of the present disclosure. The certificate text recognition device described below and the certificate text recognition method described above can be referenced to each other.
[0090] like Figure 5 As shown, the present disclosure also provides a document text recognition device, comprising:
[0091] An image acquisition unit 510, used to acquire a document image;
[0092] Specifically, the image acquisition unit 510 photographs the physical documents such as the ID card, driver's license, passport, etc. to obtain the corresponding document image.
[0093] A text recognition unit 520, used to obtain text recognition results on the document based on the document image;
[0094] Specifically, the text recognition unit 520 uses the common OCR technology to perform text recognition on the document image to obtain the text recognition result on the document.
[0095] In the embodiment of the present disclosure, the text recognition unit 520 includes a text line detection subunit and a text line recognition subunit.
[0096] A text line detection subunit, used for inputting the document image into a text line detection model to obtain text line border information output by the text line detection model; wherein the text line detection model is obtained by training the text line border position data and text line border position data labels of various types of documents;
[0097] Specifically, the text line detection subunit identifies the text line frame and the text line frame position in the document image to form text frame frame information.
[0098] The text line recognition subunit is used to input the text line border information into the text line recognition model to obtain the text recognition result output by the text line recognition model; wherein the text line recognition model is obtained by training the text line text data and text line text data labels of various types of certificates.
[0099] Specifically, the text line recognition subunit inputs the text line frame information recognized by the text line detection subunit into the text line recognition model, recognizes the text content in the text line frame respectively, and summarizes the text content recognized in the text line frame to obtain the text recognition result.
[0100] A key field word library acquisition unit 530 is used to acquire key field word libraries of multiple types of certificates;
[0101] Specifically, in the embodiment of the present disclosure, the keyword word library corresponding to multiple types of certificates can be obtained according to actual needs through the keyword word library acquisition unit 530. Therefore, the recognition device provided by the embodiment of the present disclosure has good scalability, and the keyword word library of the corresponding type of certificate can be obtained before matching. For example, the keyword word library of the ID card, the keyword word library of the driver's license, the keyword word library of the vehicle registration certificate, the keyword word library of the passport, etc. can be obtained.
[0102] A key field matching unit 540 is used to match the text recognition result with the content in the key field word library of each type of certificate to obtain a corresponding matching result;
[0103] Specifically, the key field matching unit 540 matches and compares the text recognition results with the key fields in the key field word library corresponding to each type, and obtains the matching results corresponding to each type of certificate.
[0104] Specifically, the key field matching unit 540 includes: a key field score setting subunit and a matching subunit. Among them:
[0105] The key field score setting subunit is used to set the score for each key field in the key field word library of each type of certificate;
[0106] Specifically, through the key field score setting subunit, each key field in the key field word library of each type of certificate is assigned a value. In some embodiments, in order to reflect the importance of the key field matching in the key field word library, different key fields can be assigned different scores. For example, the key field word library of the Chinese ID card includes key fields such as "citizen identity number", "address", and "name". Among them, the key field of "citizen identity number" has a relatively large degree of distinction compared to other key fields in the key field word library of this type of certificate, and a larger score can be assigned to it. For another example, the key field word library of the Hong Kong and Macau Pass can set key fields with relatively large distinctions: "Hong Kong and Macau Pass", "Exit and Entry Administration Bureau of the Ministry of Public Security" and larger scores.
[0107] The matching subunit is used to traverse and match the text recognition result with each key field in the key field vocabulary of each type of certificate, obtain the matching score of the text recognition result corresponding to each type of certificate, and use the matching score as the matching result.
[0108] Specifically, the text in the text recognition result is matched with the key fields in the key field vocabulary in sequence through the matching sub-units. When the content of the corresponding key field exists, the score corresponding to the key field is added to the matching score of the text recognition result corresponding to the certificate of this type.
[0109] In the disclosed embodiment, the matching sub-unit matches the text recognition result with each key field in the key field vocabulary of the set type of certificate in turn. When there is a key field in the text recognition result, the score corresponding to the matched key field is included in the score of the text recognition result. After traversing and matching each key field, the accumulated score of the text recognition result is used as the matching score of the text recognition result corresponding to the certificate of the set type.
[0110] A matching result processing and screening unit 550 is used to process each of the matching results to obtain the type of the text recognition result with the highest matching degree;
[0111] Specifically, the type with the highest matching degree obtained by the matching result processing and screening unit 550 is considered to be the certificate type most similar to the type of the certificate corresponding to the text recognition result, and the type with the highest matching degree is used as the type of the certificate corresponding to the identified text recognition result.
[0112] In the embodiment of the present disclosure, the matching result processing and screening unit 550 includes: a matching threshold score setting subunit, a pre-selected type screening subunit, and a highest matching type screening subunit. Among them:
[0113] A matching threshold score setting subunit is used to set matching threshold scores for each type of certificate;
[0114] Since the text processing result may include key fields in the key field vocabulary corresponding to multiple types of certificates at the same time, the text processing result has a certain score corresponding to each certificate type.
[0115] Specifically, the purpose of setting the matching threshold scores for each type of certificate is that when the text recognition result is greater than the certificate type corresponding to the matching threshold score, it is considered to be a valid type recognition, that is, the text recognition result has a greater similarity with the corresponding certificate type and the effectively recognized certificate type.
[0116] A pre-selected type screening subunit is used to compare the matching scores of the text recognition results corresponding to each type of certificate with the matching threshold scores of each type of certificate, and screen out the pre-selected types whose matching scores are greater than the matching threshold scores;
[0117] Specifically, the certificate type with a high similarity to the certificate type corresponding to the text recognition result is screened out as the pre-selected type.
[0118] In some embodiments, the matching result processing and screening unit 550 further includes a standardized output subunit, which is used to directly output the text recognition result in a standardized manner when the number of pre-selected types screened out is 0. Specifically, when the text recognition result is matched with the key field word library of each type of certificate, the matching score of each type is lower than the matching threshold score of the corresponding type, that is, the number of pre-selected types is 0, indicating that there is no certificate similar to the certificate type corresponding to the text recognition result among the matched certificates of each type, so the text recognition result can be directly output in a standardized manner.
[0119] The highest matching type screening subunit is used to standardize the matching scores corresponding to the pre-selected types, and take the pre-selected type with the largest value of the standardized processing result as the type with the highest matching degree.
[0120] Specifically, the highest matching type screening subunit screens out the pre-selected type with the highest matching degree with the certificate type corresponding to the text recognition result from the pre-selected types as the certificate type corresponding to the text recognition result.
[0121] In the disclosed embodiment, the highest matching type screening subunit uses the ratio of the matching score corresponding to each pre-selected type to the corresponding matching threshold score as the normalization processing result, and uses the pre-selected type with the largest ratio value as the type with the highest matching degree. For each type of certificate, the matching score is compared with the matching threshold score, which can enhance the independence of the threshold setting of each type of certificate and achieve higher scalability of matching types.
[0122] The recognition result output unit 560 is used to output the text recognition result according to the field structuring rule of the certificate type with the highest matching degree.
[0123] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the document text recognition method, which includes: obtaining a document image; obtaining a text recognition result on the document according to the document image; obtaining a key field word library of multiple types of documents; matching the text recognition result with the content in the key field word library of each type of document respectively to obtain corresponding matching results; processing each matching result to obtain the type with the highest matching degree of the text recognition result; and outputting the text recognition result according to the field structuring rule of the document with the highest matching degree.
[0124] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the embodiment of the present disclosure is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.
[0125] On the other hand, the present disclosure also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the document text recognition method provided by the above-mentioned methods, and the method includes: obtaining a document image; obtaining a text recognition result on the document based on the document image; obtaining a key field vocabulary of multiple types of documents; matching the text recognition result with the content in the key field vocabulary of each type of document to obtain corresponding matching results; processing each of the matching results to obtain the type with the highest matching degree of the text recognition result; and outputting the text recognition result according to the field structuring rules of the document of the type with the highest matching degree.
[0126] On the other hand, the present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the above-mentioned document text recognition methods, the methods comprising: obtaining a document image; obtaining a text recognition result on the document based on the document image; obtaining a key field vocabulary of multiple types of documents; matching the text recognition results with the contents in the key field vocabulary of each type of document to obtain corresponding matching results; processing each of the matching results to obtain the type with the highest matching degree of the text recognition result; and outputting the text recognition result according to the field structuring rules of the document of the type with the highest matching degree.
[0127] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A document text recognition method, characterized in that: include: Get the document image; Obtaining text recognition results on the document according to the document image; Obtain key field lexicon for multiple types of certificates; Matching the text recognition results with the contents of the key field word library of each type of certificate to obtain corresponding matching results; Processing each of the matching results to obtain the type of the text recognition result with the highest matching degree; Outputting the text recognition result according to the field structuring rule of the certificate type with the highest matching degree; The text recognition results are matched with the contents of the key field word library of each type of certificate to obtain corresponding matching results, specifically including: A score is set for each key field in the key field word library of each type of certificate; wherein the score of the key field is positively correlated with the discrimination degree of the key field, and the discrimination degree is the discrimination degree of the key field compared with other key fields in the key field word library of the type of certificate; The text recognition results are traversed and matched with the key fields in the key field word library of each type of certificate to obtain the matching score of the text recognition results corresponding to each type of certificate, and the matching score is used as the matching result; Among them, the key field word library can set multiple key field word libraries of similar types according to the type of certificate that actually needs to be matched.
2. The document text recognition method according to claim 1, characterized in that: The step of obtaining a text recognition result on the certificate according to the certificate image specifically includes: Inputting the document image into a text line detection model to obtain text line border information output by the text line detection model; Inputting the text line frame information into a text line recognition model to obtain a text recognition result output by the text line recognition model; Among them, the text line detection model is obtained by training the text line border position data and text line border position data labels of various types of certificates; the text line recognition model is obtained by training the text line text data and text line text data labels of various types of certificates.
3. The document text recognition method according to claim 1, characterized in that: The character recognition results are traversed and matched with the key fields in the key field word library of each type of certificate to obtain the matching scores of the character recognition results corresponding to each type of certificate, and the matching scores are used as matching results, specifically including: The text recognition result is matched with each key field in the key field vocabulary of the set type of certificate in turn. When there is a key field in the text recognition result, the score corresponding to the matched key field is included in the score of the text recognition result. After traversing and matching each key field, the accumulated score of the text recognition result is used as the matching score of the text recognition result corresponding to the set type of certificate.
4. The document text recognition method according to claim 3, characterized in that: The processing of each of the matching results to obtain the type of the text recognition result with the highest matching degree specifically includes: Set matching threshold scores for each type of certificate; Compare the matching scores of the text recognition results corresponding to each type of certificate with the matching threshold scores of each type of certificate, and select the pre-selected types whose matching scores are greater than the matching threshold scores; The matching scores corresponding to the pre-selected types are standardized, and the pre-selected type with the largest value in the standardized processing result is taken as the type with the highest matching degree.
5. The document text recognition method according to claim 4, characterized in that: The method of normalizing the matching scores corresponding to the pre-selected types and taking the pre-selected type with the largest normalization result value as the type with the highest matching degree specifically includes: taking the ratio of the matching scores corresponding to the pre-selected types to the corresponding matching threshold scores as the normalization result, and taking the pre-selected type with the largest ratio value as the type with the highest matching degree.
6. The document text recognition method according to claim 4, characterized in that: The matching scores of the text recognition results corresponding to each type of certificate are compared with the matching threshold scores of each type of certificate, and pre-selected types with matching scores greater than the matching threshold scores are screened out. The method also includes: when the number of pre-selected types screened out is 0, the text recognition results are directly standardized and outputted.
7. A document character recognition device, characterized in that: include: An image acquisition unit, used for acquiring a document image; A text recognition unit, used to obtain text recognition results on the document based on the document image; A key field word library acquisition unit, used to acquire key field word libraries of multiple types of certificates; A key field matching unit, used to match the text recognition results with the contents of the key field word library of each type of certificate to obtain corresponding matching results; A matching result processing and screening unit, used to process each of the matching results to obtain the type of the text recognition result with the highest matching degree; A recognition result output unit, configured to output the text recognition result according to the field structuring rule of the certificate of the type with the highest matching degree; The key field matching unit includes: a key field score setting subunit and a matching subunit; wherein: The key field score setting subunit is used to set a score for each key field in the key field word library of each type of certificate; the score of the key field is positively correlated with the discrimination degree of the key field, and the discrimination degree is the discrimination degree of the key field compared with other key fields in the key field word library of the type of certificate; The matching subunit is used to traverse and match the text recognition result with each key field in the key field word library of each type of certificate, obtain the matching score of the text recognition result corresponding to each type of certificate, and use the matching score as the matching result; Among them, the key field word library can set multiple key field word libraries of similar types according to the type of certificate that actually needs to be matched.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the document text recognition method as described in any one of claims 1 to 6 are implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the document text recognition method as described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Certificate image classification method and device, computer equipment and readable storage medium
CN111046879A
Identification and verification of an unknown document according to an eigen image process
US20090154778A1