Full-page recognition method for multilingual documents based on word recognition

Through a method based on word recognition, using target detection algorithm and cosine distance calculation, the problem of model parameter expansion and data annotation difficulty in full-page recognition of multi-lingual documents is solved, and fast and efficient document information recognition is achieved.

CN118230344BActive Publication Date: 2024-08-27SHENZHEN MAXVISION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410635137.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2024-08-27
Estimated Expiration
2044-05-22

AI Technical Summary

Technical Problem

Existing full-page recognition technology for multilingual documents requires training recognition models in multiple languages, resulting in algorithm model parameter expansion and slow inference speed, and data annotation and collection are difficult.

Method used

A method based on word recognition is used to obtain the document area through the target detection algorithm, detect and identify characters and phrases, and use cosine distance calculation to match the preset character library, avoiding parameter expansion and simplifying the model training process.

Benefits of technology

It achieves rapid recognition of full-page information in multi-lingual documents without the need to train language models one by one, saving manpower and equipment resources and improving recognition speed and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118230344B
    Figure CN118230344B
Patent Text Reader

Abstract

The invention discloses a full-page recognition method for a multilingual certificate based on word recognition, comprising: step A: using a target detection algorithm through a certificate data image to obtain four coordinate points of a certificate area, a certificate area, a certificate photo area and a machine-readable code area; step B: straightening the certificate area of ​​the certificate; step C: detecting words on the full page of the certificate; step D: recognizing the detected characters and phrases, and using search results for the recognition results; step E: performing overall layout analysis on the full page of the certificate through the detection and recognition results of the characters and phrases and the coordinate information of the machine-readable code area to obtain a title bar and a content bar; step F: performing structured output on the content bar through the result of the layout analysis on the full page of the certificate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of certificate recognition, and in particular to a full-page recognition method for multilingual certificates based on word recognition. Background Art

[0002] Taking passports as an example, modern certificates tend to have diversified languages. The foreign language recognition solution for multilingual certificates in the existing technology is to detect text lines in the certificate through a character recognition algorithm based on Baidu's Paddle OCR. The text lines in the certificate are detected and a convolutional recurrent neural network is used for character recognition. However, when performing full-page recognition of the certificate, there are the following problems: Since certificates of many countries carry more than one language, the use of conventional convolutional recurrent neural networks requires training recognition models for multiple languages. Putting language data from multiple countries together will cause the parameters of the algorithm model to expand and the inference speed to slow down. However, if the languages ​​of multiple countries are trained separately into multiple language models, in order to train a robust and usable recognition model, data annotation and data collection are more difficult. Summary of the invention

[0003] One object of the present invention is to provide a full-page recognition method for multilingual certificates based on word recognition. Data annotation personnel do not need to identify all foreign language content. The method based on word search can identify all foreign languages ​​of the certificate by only identifying specific phrases, thereby avoiding parameter expansion of the algorithm model and accelerating the model reasoning speed.

[0004] Other advantages and features of the present invention will become more apparent from the following detailed description and may be realized by means of the instrumentalities and combinations particularly pointed out in the appended claims.

[0005] According to one aspect of the present invention, a full-page recognition method for multilingual documents based on word recognition, which can achieve the aforementioned objectives and other objectives and advantages, comprises:

[0006] Step A: Using the document data image, the target detection algorithm is used to obtain the four coordinate points of the document area, the document area, the document photo area and the machine-readable code area;

[0007] Step B: Align the ID area of ​​the ID;

[0008] Step C: Check the words on the entire page of the certificate;

[0009] Step D: Recognize the detected characters and phrases, and use the search results as the recognition results;

[0010] Step E: Based on the detection and recognition results of characters and phrases and the coordinate information of the machine-readable code area, the entire page of the certificate is analyzed to obtain the title bar and content bar;

[0011] Step F: Based on the results of the layout analysis of the entire page of the certificate, the content column is output in a structured manner.

[0012] According to one embodiment of the present invention, step D includes sub-step D1: establishing a set of characters and phrases, preset as a character library, extracting image features of characters or phrases and character features in the character library, using cosine distance to measure the distance of image features, and then sorting the distances of image features to obtain the result with the shortest distance, which is the recognition information of the character or phrase to be recognized. The cosine distance formula is:

[0013] ,

[0014] Wherein, X and Y represent the image feature to be recognized and any type of image feature in the character library, respectively.

[0015] According to an embodiment of the present invention, the step E includes a sub-step E1: using a rotating target detection algorithm on the machine-readable code area to obtain coordinate information of the machine-readable code area.

[0016] According to one embodiment of the present invention, step E includes sub-step E2: obtaining key column information through the recognition results of the phrase, obtaining prior information on the layout distribution of any type of certificate through various types of certificates collected in the database, and obtaining the coordinate area of ​​the recognition result that needs to be output, and obtaining the recognition result of each key area through the prior layout information.

[0017] According to one embodiment of the present invention, step F includes sub-step F1: through the association relationship between the title bar and the content bar obtained in step E, step D recognizes the words in the content bar, outputs the full-page recognition information of the document to be recognized, and completes the full-page recognition of the document.

[0018] According to an embodiment of the present invention, step C includes sub-step C1: using a target detection algorithm to detect all words in the document area.

[0019] According to one embodiment of the present invention, step C includes sub-step C2: when the document data is cropped and sent to the target detection algorithm, it is cropped into four areas of the same size, and the four areas are partially overlapped, the recognition results in the four areas are spliced ​​as a whole, and based on the maximum suppression algorithm, the repeated recognition parts of the characters are removed.

[0020] According to one embodiment of the present invention, step B includes sub-step B1: straightening the document area of ​​the document, which is divided into an upright document area and an inverted document area, and performing perspective transformation on the document area through the four coordinate points of the document area detected in step A to generate four target coordinate points.

[0021] According to an embodiment of the present invention, step A includes sub-step A1: when detecting tilted targets, adding a key point detection branch to locate four coordinate points of the document area.

[0022] According to one embodiment of the present invention, step A includes sub-step A2: capturing a document data image.

[0023] The beneficial effects of the present invention are as follows: without the need for professionals who know foreign languages, only algorithm matching search is required for unknown characters or phrases to quickly complete the recognition of foreign languages ​​in various countries, thereby saving the workload of training algorithm models for each language one by one and avoiding excessive human resources and equipment resources. The full-page recognition method of multilingual certificates based on word recognition of the present invention only needs to establish a character library, extract convolution features from unknown characters through an algorithm, and calculate feature distances with characters or phrases in the character library to complete the recognition of foreign languages. Even if character samples that have not appeared in the training samples exist in the character library, they can be correctly recognized. When the number of character categories increases, the speed of the algorithm is less affected. The method of the present invention can quickly and rapidly recognize the full page information of the certificate. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 The present invention is an algorithm flow chart of a method for full-page recognition of multilingual certificates based on word recognition according to an embodiment of the present invention.

[0025] Figure 2 Schematic diagram of the algorithm framework of the full-page recognition method for multilingual documents based on word recognition according to the above embodiment of the present invention.

[0026] Figure 3 It is a schematic diagram of the detection effect of the full-page recognition method of multilingual documents based on word recognition according to the above embodiment of the present invention.

[0027] Figure 4 It is a schematic diagram of the perspective transformation effect of the full-page recognition method of multilingual documents based on word recognition according to the above embodiment of the present invention.

[0028] Figure 5 It is a cropped schematic diagram of the full-page recognition method for multilingual documents based on word recognition according to the above embodiment of the present invention.

[0029] Figure 6 This is an algorithm flow chart of the full-page recognition method for multilingual certificates based on word recognition according to the above embodiment of the present invention.

[0030] Figure 7 This is a model training framework diagram of the full-page recognition method for multilingual documents based on word recognition according to the above embodiment of the present invention.

[0031] Figure 8 This is a recognition framework diagram of the full-page recognition method for multilingual certificates based on word recognition according to the above embodiment of the present invention.

[0032] Fig. 9 It is a schematic diagram of information parsing of the full-page recognition method of multilingual documents based on word recognition according to the above embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art can think of other obvious variations. The basic principles of the present invention defined in the following description can be applied to other embodiments, variations, improvements, equivalents, and other technical solutions that do not deviate from the spirit and scope of the present invention.

[0034] Those skilled in the art should understand that, in the disclosure of the present invention, the terms "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicating the orientation or position relationship are based on the orientation or position relationship shown in the drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, the above terms should not be understood as limiting the present invention.

[0035] It is understood that the term "one" should be understood as "at least one" or "one or more", that is, in one embodiment, the number of an element can be one, while in another embodiment, the number of the element can be multiple, and the term "one" cannot be understood as a limitation on the number. In addition, in the description of the present invention, unless otherwise specified, the meaning of "multiple" is two or more than two.

[0036] In the description of the present invention, it should be understood that "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through a medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0037] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0038] like Figures 1 to 9 As shown, a full-page recognition method for multilingual certificates based on word recognition is disclosed in an embodiment of the present invention. The full-page recognition method for multilingual certificates based on word recognition only needs to perform algorithm matching search on unknown characters or phrases to quickly complete the recognition of foreign languages ​​of various countries, thereby saving the workload of training algorithm models for each language one by one and avoiding excessive human resources and equipment resources. By adopting the full-page recognition method for multilingual certificates based on word recognition of the present invention, it is only necessary to establish a character library, extract convolution features from unknown characters through an algorithm, and calculate feature distances with characters or phrases in the character library to complete the recognition of foreign languages. Even if character samples that have not appeared in the training samples exist in the character library, they can be correctly recognized. When the number of character categories increases, the speed of the algorithm is less affected. The method of the present invention can quickly and rapidly recognize the full page information of the certificate.

[0039] like Figure 1 FIG. 1 is an algorithm flow chart of the full-page recognition method for multilingual documents based on word recognition according to the above embodiment of the present invention. The full-page recognition method for multilingual documents based on word recognition comprises the following steps:

[0040] Step 1: Capture the document data image. The document data image can be acquired by pressing the document on the screen to obtain a flat and non-deformed data image, or by directly using an imaging device, such as a mobile phone, to obtain a deformed data image.

[0041] Step 2: Detect the four coordinate points of the document area, the document area, the document photo area and the machine-readable code area through the document data image. The target detection algorithm may be, but is not limited to, yolov5-obb. It is worth noting that the conventional tilt target detection uses rectangular coordinates with angles, while the non-rigid document area with rotation may be severely deformed, and the document area is no longer a standard rectangle. Further, Figures 2 to 3As shown, Figure 2 Schematic diagram of the algorithm framework of the full-page recognition method for multilingual documents based on word recognition according to the above embodiment of the present invention, Figure 3 The figure is a schematic diagram of the detection effect of the full-page recognition method of multilingual documents based on word recognition in the above embodiment of the present invention. When detecting tilted targets, a key point detection branch is added to locate the four coordinate points of the document area, which is beneficial to the subsequent straightening of the document area. That is, a key point detection algorithm is added to the rotation target detection algorithm. Figure 3 The four '●' in the figure are the four coordinate points of the document area, and the dotted box represents the detection result of the rotating target;

[0042] Step 3: Straighten the document area of ​​the document. Specifically, there are two kinds of results of the straightening: an upright document area and an inverted document area. The document area is perspective transformed through the four coordinate points of the document area detected in step 2. According to the current general standard, such as a passport, the standard size is 1250*880mm, the width is 1250mm, and the height is 880mm. Therefore, the subsequent perspective transformation standard size is 1250*880mm. The four target coordinate points of the document area after the perspective transformation are (0,0), (0,1250), (1250,880), and (0,880). Figure 4 As shown, it is a schematic diagram of the perspective transformation effect of the full-page recognition method of multilingual documents based on word recognition of the above embodiment of the present invention. The coordinate points detected in the document area are (x0, y0), (x1, y1), (x2, y2), and (x3, y3). It is worth noting that the order of the four coordinate points is listed in a clockwise direction starting from the upper left point. The four target coordinate points after the transformation are obtained by perspective transformation (x0', y0'), (x1', y1'), (x2', y2'), and (x3', y3'), which are the coordinate points (0, 0), (0, 1250), (1250, 880), and (0, 880) mentioned above. In detail, as Figure 4 As shown, for the perspective transformed coordinate points (x0, y0), (x1, y1), (x2, y2), (x3, y3), a cross-platform computer vision library (opencv) is used to obtain the perspective transformation matrix and the result image after perspective transformation, and generate the target coordinate points (x0', y0'), (x1', y1'), (x2', y2'), (x3', y3');

[0043] Step 4: Detect words on the entire page of the document. Specifically, all words in the document area are detected. This can be, but is not limited to, using a common target detection algorithm without anchors, such as yolov8. Since the length of words is inconsistent in the document area, in order to take into account the extreme word size, an algorithm without anchors is used to detect words. Since some documents, such as passports, are large in size, Figure 5 As shown, it is a cropping schematic diagram of the full-page recognition method of multilingual certificates based on word recognition of the above embodiment of the present invention. When the certificate data is cropped and sent to the target detection algorithm during model training, it is cropped into four areas of the same size, and the four areas are partially overlapped to prevent character loss due to cropping. Figure 5 The oblique line part in is the overlapping area. When cropping, the overlapping area between the image blocks is retained to avoid problems such as incomplete characters and missed characters caused by cropping, and to ensure the subsequent recognition effect. In detail, Figure 6 As shown, it is an algorithm flow chart of the full-page recognition method of multilingual certificates based on word recognition according to the above embodiment of the present invention, the recognition results in the four areas are spliced ​​as a whole, and the repeated recognition parts of the characters are removed based on the maximum suppression algorithm;

[0044] Step 5: Identify word content. Specifically, identify the detected characters and phrases, and use search results for the recognition results. The specific steps are as follows: first, establish a set of characters and phrases, which is preset as a character library. The character library covers common foreign characters, English characters, and Chinese characters, and also includes phrases that often appear on passports, such as name, name, nationality, etc. When training the algorithm, use a conventional classification network structure to obtain an adapted backbone network for extracting character features, such as resnet18. When testing, extract the image features of the characters or phrases and the character features in the character library, use the cosine distance to measure the distance of the image features, and then sort the distances of the image features to obtain the closest result, which is the recognition information of the character or phrase to be recognized, such as Figure 7 As shown in FIG. 1 , it is a model training framework diagram of the full-page recognition method of multilingual documents based on word recognition according to the above embodiment of the present invention, as shown in FIG. Figure 8 As shown, it is a framework diagram of the full-page recognition method of multilingual documents based on word recognition in the above embodiment of the present invention when recognizing characters or phrases to be recognized. The cosine distance formula is

[0045] ,

[0046] Wherein, X and Y represent the image feature to be recognized and any type of image feature in the character library, respectively. The full-page recognition method for multilingual certificates based on word recognition can continuously expand the categories of words without affecting the inference speed of the algorithm. When the certificate contains text information of multiple categories, the full-page recognition method for multilingual certificates based on word recognition is applicable to the above-mentioned text recognition scenario;

[0047] Step 6: Perform layout analysis on the entire page of the certificate. Specifically, the entire page of the certificate is analyzed as a whole using the character and phrase detection and recognition results obtained in step 5 and the coordinate information of the machine-readable code area obtained in step 2 to obtain the title bar and the content bar. The recognition result of the machine-readable code is obtained using the machine-readable code area obtained in step 2 and the word coordinates obtained by the word detection algorithm in step 5. Preferably, in step 2, the coordinate information of the machine-readable code area can be obtained by using a rotating target detection algorithm on the machine-readable code area. Furthermore, according to the current general standard information interpretation, the machine-readable code result can be used to determine which country and type of certificate the certificate belongs to. Through the recognition results of the phrases, key column information, such as name, nationality, and certificate type, can be obtained. Through the various types of certificates collected in the database, the prior information of the layout distribution of any type of certificate can be obtained, and the coordinate area of ​​the recognition result to be output can be obtained. The recognition result of each key area is obtained through this prior layout information, such as Fig. 9 FIG. 1 is a schematic diagram of information parsing of the full-page recognition method for multilingual certificates based on word recognition according to the above embodiment of the present invention, that is, a detailed diagram of information parsing of a machine-readable code according to the current general standard, where the information of the issuing country is obtained through the 3rd to 5th characters of the first line of the machine-readable code, and the type of the certificate is obtained through the 1st to 2nd characters of the first line;

[0048] Step seven: Based on the results of the layout analysis of the entire page of the certificate, the content column is structured and outputted. Specifically, based on the association between the title column and the content column obtained in step six, the words in the content column are identified in step five, and the full-page identification information of the certificate to be identified is outputted to complete the full-page identification of the certificate.

Claims

1. A full-page recognition method for multilingual documents based on word recognition, characterized in that: include: Step A: Using the document data image, the target detection algorithm is used to obtain the four coordinate points of the document area, the document area, the document photo area and the machine-readable code area; Step B: When detecting tilted targets, a key point detection branch is added to locate the four coordinate points of the document area. A key point detection algorithm is added to the rotation target detection algorithm to straighten the document area of ​​the document. There are two types of straightening results: an upright document area and an inverted document area. The document area is perspectively transformed through the four coordinate points of the detected document area to generate four target coordinate points. Step C: Detect the words on the entire page of the certificate. Use the target detection algorithm to detect all the words in the certificate area. When the certificate data is cropped and sent to the target detection algorithm, it is cropped into four areas of the same size, and the four areas are partially overlapped. The recognition results in the four areas are spliced ​​as a whole image, and the repeated recognition parts of the characters are removed based on the maximum suppression algorithm; Step D: Recognize the detected characters and phrases, and use the search results as the recognition results; Step E: Based on the detection and recognition results of characters and phrases and the coordinate information of the machine-readable code area, the entire page of the certificate is analyzed to obtain the title bar and content bar; Step F: Based on the results of the layout analysis of the entire page of the certificate, the content column is output in a structured manner.

2. The full-page recognition method according to claim 1, characterized in that: The step D comprises sub-step D1: establishing a set of characters and phrases, which is preset as a character library, extracting image features of characters or phrases and character features in the character library, using cosine distance to measure the distance of image features, and then sorting the distances of image features to obtain the result with the shortest distance, which is the recognition information of the character or phrase to be recognized. The cosine distance formula is: , Wherein, X and Y represent the image feature to be recognized and any type of image feature in the character library, respectively.

3. The full-page recognition method according to claim 1, characterized in that: The step E comprises a sub-step E1: using a rotating target detection algorithm on the machine-readable code area to obtain coordinate information of the machine-readable code area.

4. The full-page recognition method according to claim 3, characterized in that: The step E includes sub-step E2: obtaining key column information through the recognition results of the phrase, obtaining prior information on the layout distribution of any type of certificate through various types of certificates collected in the database, and obtaining the coordinate area of ​​the recognition result that needs to be output, and obtaining the recognition result of each key area through the prior layout information.

5. The full-page recognition method according to claim 4, characterized in that: The step F includes sub-step F1: through the association relationship between the title bar and the content bar obtained in the step E, the step D recognizes the words in the content bar, outputs the full-page recognition information of the document to be recognized, and completes the full-page recognition of the document.

6. The full-page recognition method according to claim 1, characterized in that: The step A includes sub-step A1: when detecting tilted targets, adding a key point detection branch to locate four coordinate points of the document area.

7. The full-page recognition method according to claim 6, characterized in that: The step A includes sub-step A2: collecting the document data image.