Establishment method of multilingual identity card OCR text detection data set

By generating and labeling multilingual ID card pictures, the problem of lack of dense multilingual text recognition data is solved, and the high accuracy of the multilingual ID card OCR text detection model is achieved, which is suitable for multilingual ID card text recognition.

CN118887675APending Publication Date: 2024-11-01CHINACCS INFORMATION IND
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311517774.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-13
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

The existing OCR text recognition model performs well in monolingual text recognition, but encounters challenges in dense multilingual text recognition, mainly due to the lack of a large number of dense multilingual ID card pictures and their annotation data, and the annotation process is time-consuming and consuming. It is difficult to obtain on a large scale.

Method used

By generating ID card pictures with multilingual text information and automatically labeling and enhancement processing, a multilingual ID card OCR text detection data set is formed, including rendering text information, synchronous recording of label data, affine transformation, adding noise and simulated stains. , adapt to samples of different angles and morphology.

Benefits of technology

It realizes automatic annotation and data set generation of multilingual ID card text information, improves the accuracy of the multilingual ID card OCR text detection model, overcomes the shortcomings of the monolingual model, and is suitable for multilingual ID card text recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887675A_ABST
    Figure CN118887675A_ABST
Patent Text Reader

Abstract

The invention discloses a method for establishing a multilingual identity card OCR text detection data set, and relates to the technical field of OCR text recognition, and the technical scheme comprises the steps: obtaining text information based on a multilingual identity card picture; according to the residential ethnic proportion of the region, text information corresponding to the language of the region is generated, the generated text information is rendered to an empty identity card template to obtain an identity card picture, and the text information in the identity card picture is labeled; synchronously recording annotation data in an identity card picture generation stage; carrying out enhancement processing on the identity card picture; and the annotation data and the enhanced identity card picture form a data set. The method has the beneficial effects that in the process of generating the multilingual identity card picture, automatic labeling of the text information is realized; through enhancement processing, the device adapts to samples with different angles and different forms; based on the data set, a text detection deep learning model can be built to detect the identity card OCR text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of OCR text recognition, and in particular to a method for establishing a multilingual ID card OCR text detection data set. Background Art

[0002] Existing OCR text recognition models have made great progress in monolingual text recognition, with accuracy even exceeding that of humans, but have encountered challenges in dense multilingual text recognition, usually due to the failure of multilingual text detection. In many international venues or multilingual minority areas, many certificates are in more than two languages, and the texts in these different languages ​​are close to each other and densely distributed. In order to train such a text detection model, a large number of dense multilingual ID card images and their annotations are required as training data. On the one hand, ID cards are personal privacy data and are difficult to obtain on a large scale; on the other hand, dense multilingual text annotation is a time-consuming and labor-intensive task that requires a lot of manpower and material resources. Therefore, how to generate a large number of dense multilingual ID cards and complete automatic text annotation has become an urgent problem to be solved. Summary of the invention

[0003] The purpose of the present invention is to provide a method for establishing a multilingual ID card OCR text detection data set.

[0004] The present invention is achieved by the following measures: a method for establishing a multilingual ID card OCR text detection data set, characterized by comprising: Based on multilingual ID card images, obtain text information; the text information includes Chinese information and non-Chinese information, where Chinese information includes name, gender, ethnicity, birth, address, citizen ID number, issuing authority, validity period, etc., and non-Chinese information includes minority language information corresponding to Chinese information; According to the proportion of ethnic groups living in a region, text information in the language corresponding to the region is generated, the generated text information is rendered to an empty ID card template to obtain an ID card image, and the text information in the ID card image is annotated; Synchronously record the annotation data during the ID card image generation stage; Enhance the ID card image; The labeled data and enhanced ID card images constitute the dataset.

[0005] Furthermore, according to the proportion of ethnic groups living in the region, an ID card image with text information in the language corresponding to the region is generated, including: Generate ID card name, gender, and ethnicity information in multiple languages ​​according to the proportion of ethnic groups living in the region; generally include: ① ID card information of ethnic minorities in ethnic minority areas, ② ID card information of Han ethnicity in ethnic minority areas, ③ ID card information of non-ethnic minority areas; Randomly generate date of birth information; since the date of birth is expressed in Arabic numerals, the date of birth information can be generated in a manner that complies with the year-month-day rules; Generate addresses in multiple languages ​​based on the population ratio of the region and city, and generate the corresponding issuing authority based on the address information; The validity period information is randomly generated. Since the validity period is expressed in Arabic numerals, the validity period information can be generated in a manner that complies with the year-month-day expiration rules.

[0006] Furthermore, the annotation data includes the four vertices, text content, labels and front and back information of each attribute name and attribute value. The attribute names generally include: "name", "gender", "ethnicity", "birth", "address", "citizen ID number", "issuing authority" and "validity period" and other multilingual information; the attribute values ​​include the specific multilingual descriptions corresponding to the attribute names, among which the ethnic language of "year, month, day" under "birth" is the attribute name.

[0007] Furthermore, before marking the text information in the ID card image, the ID card image needs to be rendered, and while rendering, a bounding box is automatically drawn and marked.

[0008] Furthermore, the ID card image is enhanced, including: The front and back of the generated ID card image are cut into pieces and randomly affine transformed; since people may tilt their ID cards when taking photos, the generated ID card is affine transformed to adapt to the condition of the real ID card photo. The transformation matrix is:

[0009] For the original pixel ( x , y ), through the new pixel position after the radiation transformation ( , )for:

[0010] Where a and e control the scaling factors in the horizontal and vertical directions respectively, b and d control the skew factors in the horizontal and vertical directions respectively, and c and f control the translation amounts in the horizontal and vertical directions respectively.

[0011] Gaussian blur is performed on the ID card image after affine transformation; since the real ID card may introduce noise during the photo shooting process, Gaussian noise is added to the generated ID card to simulate this noise. For a photo, a Gaussian kernel is designed and the Gaussian kernel is slidingly convolved in the image to obtain a Gaussian blurred image. The Gaussian function for adding noise is:

[0012] in, x , y is the distance from a pixel in the Gaussian kernel to the center origin. The size of the Gaussian kernel is randomly selected from the set {1,3,5}. is the standard deviation of a Gaussian distribution randomly selected from the set {1,2,3,...,10}.

[0013] Add stains to the ID card image after Gaussian blur. Finally, since the ID card may be worn, contaminated and aged during use, it will affect text detection and recognition. To solve this problem, a stain template image with a size larger than the ID card is randomly cut from it and superimposed with the ID card image. Assume that the ID card image is I , the stain image is S , randomly generated weights , the picture after pollution for: .

[0014] Furthermore, according to the proportion of ethnic groups living in the region, the name, gender, and ethnicity information of the ID card in multiple languages ​​are generated, including: For "gender", "male" or "female" is randomly generated with a probability of 50%; For “ethnicity”, it is randomly generated based on the ethnicity ratio of the province or region provided in the provincial statistical yearbook; For "name", according to the "ethnicity" and "gender" generated in the above process, the corresponding name is generated according to the naming rules of different ethnic groups; For identity cards in minority languages, the aforementioned “name”, “gender” and “nationality” shall be translated into the corresponding minority language and typeset above the corresponding Chinese language.

[0015] Furthermore, the date of birth information is randomly generated. For non-ethnic minorities, it is composed of Chinese characters + Arabic numerals; for ethnic minorities, it is composed of ethnic minority languages ​​+ Chinese + Arabic numerals.

[0016] Furthermore, when generating addresses, an address tree needs to be constructed, specifically: An address tree is constructed based on the Chinese administrative division code book. Each node of the tree is a four-tuple, namely Chinese address, minority language address, address code, and level.

[0017] Furthermore, the levels include provincial, municipal, district, county, township, and village addresses.

[0018] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention are: in the process of generating multilingual ID card images, automatic annotation of text information is realized; through enhanced processing, it is adapted to samples of different angles and different forms; based on this data set, a deep learning model for ID card OCR text detection can be built, and the ID card OCR text detection model can be trained. After evaluation, an applicable ID card OCR text detection model can be obtained. This model can overcome the defects of the currently popular single-language OCR text detection model and greatly improve the accuracy of the multilingual ID card text OCR recognition algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings used in the embodiments. Obviously, the drawings listed below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 It is a flow chart of a method for establishing a multilingual ID card OCR text detection data set in an embodiment of the present invention; Figure 2 Identity cards in three different languages ​​for the Xinjiang Uygur Autonomous Region provided in the embodiment of the present invention; Figure 3 The process of generating the ID card text information provided by the embodiment of the present invention; Figure 4 The process of rendering and enhancing the ID card image provided by the embodiment of the present invention; Figure 5 The generation process of the Uighur name provided by the embodiment of the present invention; Figure 6 The generation process of the Han Chinese name provided by the embodiment of the present invention; Figure 7 The Chinese administrative region code consisting of 12 Arabic numerals provided in the embodiment of the present invention; Figure 8 A schematic diagram of an administrative district tree provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. Of course, the specific embodiments described here are only used to explain the present invention and are not used to limit the present invention.

[0022] Embodiment 1: See also Figure 1-Figure 8This embodiment takes ethnic minority autonomous regions as an example. There are three types of ID cards in ethnic minority autonomous regions: each item of information in ethnic minority ID cards has Chinese and ethnic minority languages; Chinese ID cards in ethnic minority regions have an attribute name of ethnic minority language + Chinese bilingual, and the attribute value is Chinese; ID cards in non-ethnic minority regions are all in Chinese. Therefore, three types of ID cards need to be generated (such as Figure 2 ): a. Ethnic minority identity cards in ethnic minority areas, b. Han identity cards in ethnic minority areas, c. Identity cards in non-ethnic minority areas.

[0023] A method for establishing a multilingual ID card OCR text detection dataset, comprising: S1. Based on the multilingual ID card image, obtain text information. Multilingual ID card templates can generally be downloaded directly on the Internet, such as Figure 1 The three types of ID cards shown. The text information includes Chinese information and non-Chinese information, where the Chinese information includes name, gender, ethnicity, birth, address, citizen ID number, issuing authority, validity period, etc., and the non-Chinese information includes the minority language information corresponding to the Chinese information.

[0024] S2. Generate text information in the language corresponding to the region according to the proportion of ethnic groups living in the region, render the generated text information to an empty ID card template to obtain an ID card image, and annotate the text information in the ID card image; wherein the generated text information in the language corresponding to the region is Figure 3 ,include: S21. Generate name, gender, and ethnicity information for ID cards in multiple languages ​​according to the proportion of ethnic groups living in the area; generally including: ① ethnic minority ID card information in ethnic minority areas, ② Han ID card information in ethnic minority areas, ③ ID card information in non-ethnic minority areas. Generate the "name", "gender" and "ethnicity" information for the ID card. For "gender", randomly generate "male" or "female" with a probability of 50%. For "ethnicity", randomly generate it based on the proportion of ethnic groups in the province or region provided in the provincial statistical yearbook. For "name", generate the corresponding name based on the "ethnicity" and "gender" generated by the above process according to the naming rules of different ethnic groups. For example, the Uyghurs are usually "own name·father's name". The generation process is as follows: Figure 4 As shown, it includes constructing a set of male names and a set of female names; randomly selecting a name from the set of male names or the set of female names as the person's name according to gender; randomly selecting a name from the set of male names, and if it coincides with the person's name, randomly selecting a non-overlapping name as the surname; combining the person's name and the surname into a Uyghur name "personal name·father's name".

[0025] The Han Chinese usually use "surname + given name", and the generation process is as follows Figure 5As shown, it includes constructing a surname set using the Hundred Family Surnames, and constructing a male name set and a female name set at the same time; randomly selecting a name from the male name set or the female name set as the personal name according to gender; randomly generating surnames according to the population proportion of Chinese Han surnames; combining the surname and the personal name into a Han name "surname + personal name".

[0026] For identity cards in minority languages, the aforementioned “name”, “gender” and “ethnicity” shall be translated into the corresponding ethnic language (such as Uyghur) and typeset above the corresponding Chinese language.

[0027] S22. Randomly generate date of birth information; since the date of birth is expressed in Arabic numerals, the date of birth information can be generated in a way that complies with the date of birth rules; there are two types of "birth" information: 1) non-minority provinces and regions, composed of Chinese characters + Arabic numerals; 2) minority provinces and regions, composed of minority languages ​​+ Chinese + Arabic numerals. (For example: May 8, 1992, the Chinese characters are fixed, and the corresponding minority languages ​​are mainly the minority language translations of "year", "month" and "day") S23. Generate addresses in multiple languages ​​based on the proportion of the resident population in the region and city, and generate the corresponding issuing authority based on the address information; "Citizen ID number", "issuing authority" and "address" are related to each other. The issuing authority is the public security department of the county-level administrative district, so the county where the issuing authority is located is the same as the county where the address is located. In addition, the first six digits of the citizen ID number are also the first six digits of the administrative district code. The administrative district code is as follows: Figure 6 shown.

[0028] In order to quickly generate a random "address", it is necessary to construct an address tree such as Figure 7 As shown. First, an address tree is constructed based on the Chinese administrative division code book. Each node of the tree is a four-tuple: (Chinese address, minority language address, address code, level). Secondly, each random address thereafter only needs to start from the root of the tree, and randomly generate provincial, municipal, district, county, township, and village addresses step by step. Constructing a tree of more than 600,000 village-level administrative units across the country can be completed within a few seconds (the time consumed mainly occurs in reading the disk), and then the tree can be reused to generate a random address within milliseconds, and the proportion of addresses at the same level can be adjusted according to actual conditions. S24. Randomly generate validity period information. Since the validity period is expressed in Arabic numerals, the validity period information can be generated in a manner that complies with the year-month-day expiration rule.

[0029] In addition, before marking the text information in the ID card image, the ID card image needs to be rendered, and the bounding box is automatically drawn and marked during the rendering.

[0030] S3, synchronously record the annotation data during the ID card image generation stage; wherein the annotation data includes four vertices of each attribute name and attribute value , external frame coordinate points, text content, labels and front and back information. The attribute names generally include: "name", "gender", "ethnicity", "birth", "address", "citizen ID number", "issuing authority" and "validity period" and other multilingual information; the attribute value includes the specific multilingual description corresponding to the attribute name, among which the ethnic language of "year, month, day" under "birth" is the attribute name.

[0031] S4. Enhance the ID card image, including: S41, the front and back of the generated ID card image are cut into pieces and randomly affine transformed; since people may tilt their ID cards when taking photos, in order to adapt to the conditions of the real ID card photo, the generated ID card is affine transformed. The transformation matrix is:

[0032] For the original pixel point (x, y), the new pixel point position (x', y') after the radial transformation is:

[0033] Where a and e control the scaling factors in the horizontal and vertical directions respectively, b and d control the skew factors in the horizontal and vertical directions respectively, and c and f control the translation amounts in the horizontal and vertical directions respectively.

[0034] S42, Gaussian blur the ID card image after affine transformation; since the real ID card may introduce noise during the photo shooting process, Gaussian noise is added to the generated ID card to simulate the noise. For a photo, a Gaussian kernel is designed and the Gaussian kernel is slidingly convolved in the image to obtain a Gaussian blurred image. The Gaussian function for adding noise is:

[0035] in, x , y is the distance from a pixel in the Gaussian kernel to the center origin. The size of the Gaussian kernel is randomly selected from the set {1,3,5}. is the standard deviation of a Gaussian distribution randomly selected from the set {1,2,3,...,10}.

[0036] S43, add stains to the ID card image after Gaussian blur. Finally, since the ID card may be worn, contaminated and aged during use, it will affect text detection and recognition. To solve this problem, a stain template image with a size larger than the ID card is randomly cut from it and superimposed with the ID card image. Assume that the ID card image is I , the stain image is S , randomly generated weights , the picture after pollution for: .

[0037] S5. The labeled data and enhanced ID card images constitute the dataset.

[0038] Embodiment 2: A multilingual ID card OCR text detection method is disclosed. Based on the data set of embodiment 1, a text detection deep learning model can be built to train the ID card OCR text detection model. After evaluation, an applicable ID card OCR text detection model can be obtained. This model can be used for multilingual ID card OCR text detection, and can overcome the defects of the currently popular single-language OCR text detection model, greatly improving the accuracy of the multilingual ID card text OCR recognition algorithm.

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

Claims

1. A method for establishing a multilingual ID card OCR text detection dataset, It is characterized in that include: Get text information based on multilingual ID card images; According to the proportion of ethnic groups living in a region, text information in the language corresponding to the region is generated, the generated text information is rendered to an empty ID card template to obtain an ID card image, and the text information in the ID card image is annotated; Synchronously record the annotation data during the ID card image generation stage; Enhance the ID card image; The labeled data and enhanced ID card images constitute the dataset.

2. The method for establishing a multilingual ID card OCR text detection dataset according to claim 1, It is characterized in that According to the proportion of ethnic groups living in a region, generate ID card images with text information in the language corresponding to the region, including: Generate ID card name, gender, and ethnicity information in multiple languages ​​according to the proportion of ethnic groups living in the area; Randomly generate date of birth information; Generate addresses in multiple languages ​​based on the population ratio of the region and city, and generate the corresponding issuing authority based on the address information; Randomly generate expiration date information.

3. The method for establishing a multilingual ID card OCR text detection dataset according to claim 1, It is characterized in that The annotation data includes four vertices of each attribute name and attribute value, text content, label and front and back information.

4. The method for establishing a multilingual ID card OCR text detection dataset according to claim 3, It is characterized in that Before marking the text information in the ID card image, the ID card image needs to be rendered, and the bounding box is automatically drawn and marked during the rendering.

5. The method for establishing a multilingual ID card OCR text detection dataset according to claim 1, It is characterized in that Enhance the ID card image, including: Cut the front and back of the generated ID card image into two parts and perform random affine transformation; Perform Gaussian blur on the ID card image after affine transformation; Add stains to the ID card image after Gaussian blur.

6. The method for establishing a multilingual ID card OCR text detection dataset according to claim 2, It is characterized in that Generate ID card name, gender, and ethnicity information in multiple languages ​​according to the ethnicity ratio of the region, including: For "gender", "male" or "female" is randomly generated with a probability of 50%; For "ethnicity", it is randomly generated based on the ethnicity ratio of the province or region provided in the provincial statistical yearbook; For "name", according to the "ethnicity" and "gender" generated in the above process, the corresponding name is generated according to the naming rules of different ethnic groups; For identity cards in minority languages, the aforementioned "name", "gender" and "ethnicity" shall be translated into the corresponding minority language and typeset above the corresponding Chinese language.

7. The method for establishing a multilingual ID card OCR text detection dataset according to claim 2, It is characterized in that The date of birth information is randomly generated. For non-ethnic minorities, it is composed of Chinese characters + Arabic numerals; for ethnic minorities, it is composed of minority languages ​​+ Chinese + Arabic numerals.

8. The method for establishing a multilingual ID card OCR text detection dataset according to claim 2, It is characterized in that When generating an address, you need to construct an address tree, specifically: An address tree is constructed based on the Chinese administrative division code book. Each node of the tree is a four-tuple, namely Chinese address, minority language address, address code, and level.

9. The method for establishing a multilingual ID card OCR text detection dataset according to claim 7, It is characterized in that The levels include provincial, municipal, district, county, township, and village addresses.

10. A multilingual ID card OCR text detection method, It is characterized in that The invention comprises a data set, wherein the data set is established based on the method for establishing a multilingual ID card OCR text detection data set according to any one of claims 1 to 9; an ID card OCR text detection model is built based on the data set, the ID card OCR text detection model is trained, and multilingual ID card OCR text detection is performed by using the trained ID card OCR text detection model.