CN111144400A - Identification method and device for identity card information, terminal equipment and storage medium - Google Patents

Identification method and device for identity card information, terminal equipment and storage medium Download PDF

Info

Publication number
CN111144400A
CN111144400A CN201811317603.9A CN201811317603A CN111144400A CN 111144400 A CN111144400 A CN 111144400A CN 201811317603 A CN201811317603 A CN 201811317603A CN 111144400 A CN111144400 A CN 111144400A
Authority
CN
China
Prior art keywords
information
text
identity card
text box
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811317603.9A
Other languages
Chinese (zh)
Other versions
CN111144400B (en
Inventor
张樱
师军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201811317603.9A priority Critical patent/CN111144400B/en
Publication of CN111144400A publication Critical patent/CN111144400A/en
Application granted granted Critical
Publication of CN111144400B publication Critical patent/CN111144400B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/62Text, e.g. of license plates, overlay texts or captions on TV images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/245Aligning, centring, orientation detection or correction of the image by locating a pattern; Special marks for positioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/146Aligning or centring of the image pick-up or image-field
    • G06V30/1475Inclination or skew detection or correction of characters or of image to be recognised
    • G06V30/1478Inclination or skew detection or correction of characters or of image to be recognised of characters or characters lines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Character Input (AREA)

Abstract

The invention provides a method and a device for identifying identity card information, terminal equipment and a storage medium, which relate to the technical field of intelligent identification, and the method comprises the following steps: acquiring an identity card image of identity card information to be identified; performing text line detection on the identity card image to obtain a plurality of text boxes; acquiring position information of a text box in an identity card image; performing character recognition on the text box to obtain character information corresponding to the text box; determining character information with a corresponding relation according to the position information and the character information of the text box; and determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation. The invention can effectively improve the identification accuracy of the identity card information.

Description

Identification method and device for identity card information, terminal equipment and storage medium
Technical Field
The present invention relates to the field of intelligent identification technologies, and in particular, to a method and an apparatus for identifying identification card information, a terminal device, and a storage medium.
Background
Identification of identity card information is needed in many situations to determine the identity of an identity card holder. In the prior art, most of the hardware devices such as an identity card reader and the like are used for directly reading identity information on an identity card.
With the development of the technology, the identification card image recognition technology is gradually started, which mainly performs recognition and extraction from characters on an identification card image so as to extract identification card information, such as name, gender, date of birth, identification card number, address, and the like. However, since there are many text messages on the identification card, the extracted text messages are scattered, other text such as watermarks may be added to the identification card image, and the identification card image is likely to be inclined, there are many reasons that the wrong identification card information may be extracted, and the identification accuracy of the identification card information is not high. For example, it is possible to obtain wrong information correspondence when performing text recognition, such as "name" and "man" may be considered as a group when the id card image is tilted, thereby obtaining a wrong conclusion that the name is "man".
Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, a terminal device and a storage medium for identifying identity card information, which can effectively improve the identification accuracy of the identity card information.
In a first aspect, an embodiment of the present invention provides an identification method for identity card information, including:
acquiring an identity card image of identity card information to be identified; performing text line detection on the identity card image to obtain a plurality of text boxes; acquiring position information of a text box in an identity card image; performing character recognition on the text box to obtain character information corresponding to the text box; determining character information with a corresponding relation according to the position information and the character information of the text box; and determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation.
With reference to the first aspect, an embodiment of the present invention provides a first possible implementation manner of the first aspect, where the step of performing text line detection on the identification card image to obtain a plurality of text boxes includes: acquiring the vertex coordinates of the identity card image, and judging whether the identity card image is inclined or not according to the vertex coordinates of the identity card image; if so, adjusting the identity card image; and performing text line detection on the adjusted identity card image to obtain a plurality of text boxes.
With reference to the first aspect, an embodiment of the present invention provides a second possible implementation manner of the first aspect, where the step of performing text line detection on the identification card image to obtain a plurality of text boxes includes: and performing text line detection on the identity card image through the CTPN network model to obtain a plurality of text boxes.
With reference to the first aspect, an embodiment of the present invention provides a third possible implementation manner of the first aspect, where the step of obtaining the position information of the text box in the identity card image includes: acquiring vertex coordinates of a text box in an identity card image; judging whether the text box is inclined or not according to the vertex coordinates of the text box; if so, aligning the text box; and acquiring the position information of the adjusted text box.
With reference to the first aspect, an embodiment of the present invention provides a fourth possible implementation manner of the first aspect, where the step of performing character recognition on the text box to obtain character information corresponding to the text box includes: and performing character recognition on the text box through the CRNN model to obtain character information corresponding to the text box.
With reference to any one of the first aspect to the fourth possible implementation manner of the first aspect, an embodiment of the present invention provides a fifth possible implementation manner of the first aspect, where the determining, according to the position information and the text information of the text box, text information having a correspondence relationship includes: determining the text boxes in the same line according to the position information of the text boxes; determining the text boxes with corresponding relations in the text boxes in the same line according to the position information of the text boxes in the same line; and determining the character information with the corresponding relation according to the text box with the corresponding relation and the character information of the text box.
With reference to the fifth possible implementation manner of the first aspect, an embodiment of the present invention provides a sixth possible implementation manner of the first aspect, where the position information of the text box includes a start point coordinate of the text box, and the start point coordinate includes a start abscissa and a start ordinate; the step of determining the text boxes in the same line according to the position information of the text boxes comprises the following steps: determining the text boxes with the difference of the vertical coordinates of the starting points within a preset first threshold value as the text boxes in the same line; determining the text boxes with the corresponding relation in the text boxes in the same line according to the position information of the text boxes in the same line, wherein the step comprises the following steps: and determining the text boxes with the difference of the horizontal coordinates of the starting points in the text boxes in the same line within a preset second threshold value as the text boxes with the corresponding relationship in the text boxes in the same line.
With reference to the fifth possible implementation manner of the first aspect, an embodiment of the present invention provides a seventh possible implementation manner of the first aspect, where the position information of the text box includes a longitudinal coordinate value range and a transverse coordinate value range of the text box; the step of determining the text boxes in the same line according to the position information of the text boxes comprises the following steps: determining two text boxes with longitudinal coordinate value ranges at least having a first overlapping length as text boxes in the same line; determining the text boxes with the corresponding relation in the text boxes in the same line according to the position information of the text boxes in the same line, wherein the step comprises the following steps: determining the minimum value of the abscissa of the text box according to the range of the abscissa of the text box in the same line; and determining the text boxes with the difference of the minimum value of the abscissas in the text boxes in the same line within a preset third threshold value as the text boxes with the corresponding relationship in the text boxes in the same line.
With reference to the fifth possible implementation manner of the first aspect, an embodiment of the present invention provides an eighth possible implementation manner of the first aspect, where the step of determining the text information having a correspondence relationship according to the text box having a correspondence relationship and the text information of the text box includes: checking whether the corresponding relation of the text boxes is correct or not according to the text boxes with the corresponding relation and the character information of the text boxes; and determining the character information of the text box with the correct corresponding relation as the character information with the corresponding relation.
With reference to the first aspect, an embodiment of the present invention provides a ninth possible implementation manner of the first aspect, where the step of determining, according to the text information having the corresponding relationship, the identity card information corresponding to the identity card image includes: determining the information category of the character information with the corresponding relation based on the character information with the corresponding relation; the information category comprises one or more of a name category, a gender category, a ethnic group category, a birth date category, an address category and an identity card number category; determining key words in the character information with the corresponding relation and characters with the corresponding relation with the key words according to the information categories; wherein, the key words comprise one or more of name, sex, ethnicity, birth, year, month, day, address and citizen identity card number; and determining the characters corresponding to the key words as the identity card information.
With reference to the ninth possible implementation manner of the first aspect, an embodiment of the present invention provides a tenth possible implementation manner of the first aspect, and the method further includes: checking whether the information of the identity card is correct or not according to the information type; if not, initiating an error prompt.
With reference to the tenth possible implementation manner of the first aspect, an embodiment of the present invention provides an eleventh possible implementation manner of the first aspect, where the step of checking whether the identity card information is correct according to the information category includes: checking whether the information corresponding to the birth date category in the identity card information and the information corresponding to the category in the identity card information are correct or not by adopting the information corresponding to the identity card number category in the identity card information; and/or checking whether the information corresponding to the category in the identity card information is one of preset gender words, wherein the preset gender words comprise males or females; and/or checking whether the information corresponding to the ethnic category in the identity card information is one of preset ethnic words, wherein the preset ethnic words comprise legal ethnic words; and/or checking whether the information corresponding to the birth date type in the identity card information is one of preset numbers; wherein the preset number is a legal date number.
With reference to the tenth possible implementation manner of the first aspect, an embodiment of the present invention provides a twelfth possible implementation manner of the first aspect, and the method further includes: and judging whether the identity card image is legal or not according to the information corresponding to the identity card number category in the identity card information.
With reference to the first aspect, an embodiment of the present invention provides a thirteenth possible implementation manner of the first aspect, where before the step of performing character recognition on the text box, the method further includes: judging whether a text box with an illegal position exists according to the position information of the text box and the preset legal position of the identity card text box; if so, deleting the text box with the illegal position.
With reference to the first aspect, an embodiment of the present invention provides a fourteenth possible implementation manner of the first aspect, where before the step of determining text information having a correspondence relationship, the method further includes: according to the position information and the character information of the text box, identifying and filtering illegal character information on the identity card image; and the position of the text box where the illegal character information is located does not belong to the preset legal position of the identity card text box.
In a second aspect, an embodiment of the present invention provides an apparatus for identifying identity card information, including: the to-be-identified image acquisition module is used for acquiring an identity card image of the to-be-identified identity card information; the text line detection module is used for performing text line detection on the identity card image to obtain a plurality of text boxes; the position information acquisition module is used for acquiring the position information of the text box in the identity card image; the character recognition module is used for carrying out character recognition on the text box to obtain character information corresponding to the text box; the corresponding relation determining module is used for determining the character information with the corresponding relation according to the position information and the character information of the text box; and the identity card information determining module is used for determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation.
In a third aspect, an embodiment of the present invention provides a terminal device, where the terminal device includes a memory and a processor, where the memory is used to store a program that supports the processor to execute the method described in any one of the first to fourteenth possible implementation manners of the first aspect, and the processor is configured to execute the program stored in the memory.
In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing computer software instructions for a method according to any one of the first to fourteenth possible implementation manners of the first aspect.
The invention provides an identification method, an identification device, terminal equipment and a storage medium of identity card information, which can firstly carry out text line detection on an identity card image of the identity card information to be identified to obtain a plurality of text boxes; and then acquiring the position information of the text box in the identity card image and the character information corresponding to the text box, further determining the character information with the corresponding relation according to the position information and the character information of the text box, and determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation. Compared with the prior art that most characters on the identity card image are directly identified to extract identity card information, and the problem that wrong identity card information is extracted due to the fact that the characters on the identity card image are scattered, the watermark is added, or the identity card image is inclined, the embodiment of the invention can detect the text box on the identity card image firstly, and then determine the character information with the corresponding relation according to the position information and the character information of the text box, so that the wrong identity card information can be prevented from being extracted, and the identification accuracy of the identity card information is effectively improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a first method for identifying identification card information according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an oblique ID card according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an aligned identity card according to an embodiment of the present invention;
fig. 4 is a flowchart of a second method for identifying information of an identification card according to an embodiment of the present invention;
fig. 5 is a flowchart of a third method for identifying information of an identification card according to an embodiment of the present invention;
fig. 6 is a block diagram of a first identification device for identification card information according to an embodiment of the present invention;
fig. 7 is a block diagram of a second identification device for identification card information according to an embodiment of the present invention;
fig. 8 is a block diagram of a third identification device for identification card information according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In view of the fact that in the prior art, most of the identification card images are directly subjected to character recognition and extraction, the recognition accuracy is not high, and in order to solve the problem, embodiments of the present invention provide an identification method, an identification device, a terminal device, and a storage medium for identification card information, which can monitor a text box on an identification card image, and then determine character information having a correspondence relationship according to position information and character information of the text box, so as to avoid extracting incorrect identification card information, and in this way, the recognition accuracy of the identification card information can be effectively improved. The technology can be applied to any occasions needing to identify the identity card image.
The following describes embodiments of the present invention in detail.
The embodiment of the present invention first provides a first identification method for identification card information, as shown in fig. 1, the method may be executed by a terminal device with processing capability, such as a computer, a mobile phone, a handheld identification terminal, and the like, and the method specifically includes the following steps:
step S102, obtaining an identity card image of identity card information to be identified; the identification card image to be identified can be an electronic version identification card printing piece directly uploaded manually, or an identification card image obtained by directly scanning an entity identification card through electronic equipment, and the like, and the acquisition mode of the identification card image is not limited. And step S104, performing text line detection on the identity card image to obtain a plurality of text boxes.
In specific implementation, the text detection can be performed on the identity card image through a related text line detection algorithm, and the shape of the obtained text box is usually rectangular.
In specific implementation, a text box detection model can be established in a machine learning mode, the input of the model is an identity card image, and the output of the model is each text box on the identity card image.
And step S106, acquiring the position information of the text box in the identity card image.
In an alternative embodiment, the position information of the corresponding text box may be represented by coordinates of a certain point at the same position in each text box by constructing a planar rectangular coordinate system on a plane shared by a plurality of text boxes, such as using a vertex coordinate of the upper left corner of each text box as the position information of the text box. In addition, a plurality of key points of each text box can be selected, and the coordinate set of the key points can be determined as the position information of each text box. The key point may be a point on a border of the text box. The number of the key points can be set according to actual requirements, and is not limited herein.
And step S108, performing character recognition on the text box to obtain character information corresponding to the text box.
In specific implementation, the text box can be subjected to character recognition through a related character recognition algorithm to obtain character information corresponding to the text box.
In specific implementation, a text box character recognition model can be established in a machine learning mode, the input of the model is an image corresponding to a text box in an identity card image, and the output of the model is character information in the text box image.
And step S110, determining character information with corresponding relation according to the position information and the character information of the text box.
For example, according to the position distribution characteristics of the text box actually having the corresponding relation of characters on the identification card, such as that the position distribution characteristics of the "name" and the "zhang san", "the gender" and the "woman", and the "nationality" and the "chinese" are relatively close in position distribution, the position information of the text box obtained in step S106 is analyzed and judged according to the position distribution characteristics of the text box having the corresponding relation, so that the correspondence relation between the "gender" and the "woman" is obtained, the correspondence relation between the "nationality" and the "chinese" is obtained, and the text information having the correspondence relation is preliminarily determined. Considering that the text boxes of the "woman" and the "nation" may have the same position and may have the wrong conclusion corresponding to the "woman" and the "nation", this embodiment further verifies whether there is a corresponding relationship between two adjacent text boxes by combining the text information, so as to eliminate the wrong corresponding relationships, such as the "woman" and the "nation", of the text boxes having similar position distribution but no text corresponding relationship, and screen out the text boxes having both the position distribution characteristics and the text corresponding relationship, thereby determining the text information having the corresponding relationship. In actual execution, the above steps S106 and S108 may not be sequentially executed.
For example, normally, the character information corresponding to the character information "female" and "male" is "gender", and when it is determined that the text box in which the character information "female" is located has a correspondence relationship with the text box in which the character information "ethnic" is located based on the positional relationship of the text boxes, the character information to which the character information "female" should correspond is "gender" instead of "ethnic" based on the character information "female" and "ethnic", and therefore, it can be determined that "female" does not correspond to "ethnic".
And step S112, determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation.
After the character information with the corresponding relation is obtained, the identity card information can be determined. The identification card information may include at least one of name, gender, date of birth, address, and identification card number.
For example, it is determined according to the above step S110 that "name" and "zhang san" in the identification card image have a corresponding relationship, that "gender" and "woman" have a corresponding relationship, that "nationality" and "han" have a corresponding relationship, and the determined identification card information may be, name: zhang III, sex: female, ethnic group: han dynasty. The determined identity card information may be presented, specifically, the identity card information may be presented as "name-zhang san sex-female ethnicity-han", or may be directly presented as "zhang san-female han", and the presentation form of the determined identity card information may be set according to the requirements, which is not limited herein.
According to the identification method of the identity card information, provided by the invention, the text line detection can be carried out on the identity card image of the identity card information to be identified to obtain a plurality of text boxes; and then acquiring the position information of the text box in the identity card image and the character information corresponding to the text box, further determining the character information with the corresponding relation according to the position information and the character information of the text box, and determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation. Compared with the prior art that most characters on the identity card image are directly identified to extract identity card information, and the problem that wrong identity card information is extracted due to the fact that the characters on the identity card image are scattered, the watermark is added, or the identity card image is inclined, the embodiment of the invention can detect the text box on the identity card image firstly, and then determine the character information with the corresponding relation according to the position information and the character information of the text box, so that the wrong identity card information can be prevented from being extracted, and the identification accuracy of the identity card information is effectively improved.
In an optional implementation manner, the step S104 of performing text line detection on the identification card image to obtain a plurality of text boxes includes:
(1) and acquiring the vertex coordinates of the identity card image, and judging whether the identity card image is inclined or not according to the vertex coordinates of the identity card image. The vertex coordinates of the identity card image can be an upper left vertex, a lower left vertex, an upper right vertex and a lower right vertex on the identity card image. When whether the identity card image is inclined or not is judged according to the vertex coordinates, whether the horizontal coordinates of the top left vertex and the bottom left vertex of the identity card image are the same or not and whether the vertical coordinate of the top left vertex is the same as the vertical coordinate of the top right vertex can be judged, and if the vertical coordinates are different, the identity card image is inclined.
(2) And (3) when the judgment result in the step (1) is yes, aligning the identity card image.
And the horizontal coordinate of the top left corner vertex of the identity card image after being adjusted is the same as the horizontal coordinate of the bottom left corner vertex, the vertical coordinate of the top left corner vertex is the same as the vertical coordinate of the top right corner vertex, and the distance between the top left corner vertex and the top right corner vertex is greater than the distance between the top left corner vertex and the bottom left corner vertex.
The mode of alignment is not limited and can be selected by those skilled in the art.
(3) And performing text line detection on the adjusted identity card image to obtain a plurality of text boxes.
In another optional implementation manner, when the step S104 is implemented, the identification card image may not be adjusted, but the text line detection may be directly performed on the identification card image, and if the detected text box is skewed, the position of the text box may be directly adjusted.
In any implementation mode, the CTPN network model can be used for carrying out text line detection on the ID card image to obtain a plurality of text boxes.
The ctpn (connection Text forward network) network model, also called a connection Text Proposal network model, is a full convolution network, and allows input images of any size. It detects lines of text by densely sliding small windows in the convolution signature map and outputs a series of fine-grained (e.g., 16 pixels in width) text suggestions, which in turn detect lines of text directly in the series of fine-grained text suggestions of the convolution map. The CTPN network model is provided with a vertical anchor point mechanism, and can jointly predict the precise position and the text/non-text score of each proposal, thereby realizing the accurate positioning of the text. The CTPN is adopted to overcome some main limitations brought by a bottom-up method established on the basis of character detection in the related technology; such as the use of sliding windows in convolutional layers, allows for shared convolution computations, which greatly reduces the amount of computation compared to the expensive sliding window-based methods of the related art. And through the design of the vertical anchor point and the detection strategy of fine granularity, the text lines of various scales and length-width ratios can be processed by using a single-scale image, so that the calculation amount is further reduced, and the accurate positions of the text lines are predicted.
In an alternative embodiment, when acquiring the position information of the text box in the identity card image, the following steps 1 to 4 may be referred to for implementation:
step 1, obtaining the vertex coordinates of a text box in an identity card image. Such as obtaining vertex coordinates for a text box, in one embodiment, the same vertex coordinates for each text box may be obtained uniformly, such as obtaining the top left vertex coordinates for a text box. In another embodiment, four vertex coordinates of the upper left corner, the lower left corner, the upper right corner and the lower right corner of each text box may be obtained.
And 2, judging whether the text box inclines or not according to the vertex coordinates of the text box.
In one embodiment, whether each text box is tilted may be determined individually. Specifically, if four vertex coordinates of the text box are acquired, whether the text box is inclined or not can be respectively judged according to the four vertex coordinates of each text box, such as if the abscissa of the top left vertex and the abscissa of the bottom left vertex of the text box are judged to be the same, and the ordinate of the top left vertex is judged to be the same as the ordinate of the top right vertex, the text box is determined not to be inclined. Otherwise, if the difference is different, the text box is inclined.
In another embodiment, whether the text box is inclined or not may be comprehensively determined according to the positions of the plurality of text boxes. Specifically, if the same vertex coordinates of the text box are acquired, whether the text box is tilted or not can be discriminated from those of the horizontally adjacent text box and/or the vertically adjacent text box. Specifically, for ease of understanding, referring to a tilted identification card diagram shown in fig. 2, a tilted identification card image 200 and a plurality of tilted text boxes (4 text boxes are simply illustrated in fig. 2, namely a first text box 202a, a second text box 202b, a third text box 204a, and a fourth text box 204b) on the identification card image 200 are illustrated in fig. 2. And selecting the vertex coordinate of the upper left corner of each text box to represent the position of the text box. In addition, in order to more intuitively show the relationship between the vertex coordinates of each text box, a plane rectangular coordinate axis is also illustrated in fig. 2; wherein, the x axis is a horizontal axis; the y-axis is the longitudinal axis; 0 denotes the origin. The vertex ordinates of the first text box 202a and the second text box 202b differ by 2by-2 ay; the vertex abscissas of the first text box 202a and the third text box 204a differ by 4ax-2 ax; the vertex ordinates of the third text box 204a differ by 4by-4ay from the vertex ordinates of the fourth text box 204 b; the vertex abscissa of the fourth text box 204b differs from the vertex abscissa of the second text box 202b by 4bx-2 bx.
It will be appreciated that if the text box is not tilted, the values of 2by-2ay, 4by-4ay, 4ax-2ax, and 4bx-2bx should all be 0, if not zero, then the text box is declared skewed.
It should be noted that fig. 2 is only a brief illustration, which simply illustrates the name and gender, and does not illustrate the information of the address, the nationality, the year, month, day of birth, etc. in detail. FIG. 2 is a simplified diagram of an identification card, which is not intended to correspond to a type setting on an actual identification card, and should not be taken as limiting.
And 3, when the text box inclines, adjusting the text box.
In an alternative embodiment, the position of each text box can be adjusted individually, so that the abscissa of the vertex at the upper left corner of the text box after alignment is the same as the abscissa of the vertex at the lower left corner, and the ordinate of the vertex at the upper left corner is the same as the ordinate of the vertex at the upper right corner. In specific implementation, a reference text box may be adjusted first (such as the first text box 202a), then the vertex vertical coordinate of the text box laterally adjacent to the reference text box is adjusted to be the same as the vertex vertical coordinate of the reference text box, and the laterally adjacent text box is adjusted based on the adjusted vertex of the laterally adjacent text box; and similarly, adjusting the vertex abscissa of the text box longitudinally adjacent to the reference text box to be the same as the vertex abscissa of the reference text box, and taking the adjusted vertex of the text box longitudinally adjacent to the reference text box as the reference to adjust the text box longitudinally adjacent to the reference text box. The positions of the text boxes on the identity card image can be adjusted through the method. The vertex coordinates of other text boxes are adjusted in a mode of setting the vertex coordinate of a certain text box as a reference point, and the efficiency of adjusting the text box can be effectively improved.
Specifically, for easy understanding, referring to fig. 3, an embodiment of the present invention provides a schematic diagram of an aligned identity card. In addition to fig. 2, taking the vertex coordinates of the top left corner of the text box as an example to represent the vertex coordinates of the text box, and taking the vertex coordinates of the top left text box (the first text box 202a) as a reference to adjust each text box, the vertex ordinate of the second text box 202b and the vertex ordinate of the first text box 202a are adjusted to be consistent, and both are 2 ay; the vertex abscissa of the third text box 204a and the vertex abscissa of the first text box 202a are adjusted to be consistent and are both 2 ax; correspondingly, the vertex ordinate of the fourth text box 204b and the vertex ordinate of the third text box 204a are adjusted to be consistent and are both 4 ay; the abscissa of the vertex of the fourth text box 204b is adjusted to be identical to the abscissa of the vertex of the second text box 202b, and is 2 bx. And each text box also adjusts the position of the text box by taking the vertex coordinate after self adjustment as a reference, the horizontal coordinate of the vertex at the upper left corner of the adjusted text box is the same as the horizontal coordinate of the vertex at the lower left corner, and the vertical coordinate of the vertex at the upper left corner is the same as the vertical coordinate of the vertex at the upper right corner.
And 4, acquiring the position information of the adjusted text box.
Similarly, one or more vertex coordinates of each text box after being adjusted, or key point coordinates on a border line, or the like may be acquired.
After the text box is detected, character recognition can be performed on the text box to obtain character information corresponding to the text box. This embodiment provides a specific character recognition method: and performing character recognition on the text box through the CRNN model to obtain character information corresponding to the text box.
Among them, the crnn (volumetric recovery Neural network) network model, also called convolution cyclic Neural network, is a network model for end-to-end character recognition. The CTPN network model can be matched with a CTPN network model for use, and comprises a convolution layer, a circulation layer and a transcription layer. At the bottom of CRNN, the convolutional layer automatically extracts a sequence of features from each input image. On top of the convolutional network, a cyclic network is constructed for predicting each frame of the feature sequence output by the convolutional layer. The transcription layer on top of CRNN is used to convert each frame prediction of the loop layer into a tag sequence. Although CRNN consists of different types of network architectures (e.g., CNN and RNN), joint end-to-end training may be performed by a loss function. And the CRNN network model is adopted to perform character recognition on the text box, so that a character recognition result can be obtained more accurately and reliably.
Further, considering that an interfering text other than the identification card information may exist on the identification card image to be recognized, such as "the identification card itself is only used in XX occasion" or the like, such as impurity information or watermark written in a blank, and the position of the text box of the interfering text is different from the legal position of the text box of the identification card information. Specifically, in an optional manner, before the step of performing character recognition on the text box, whether a text box with an illegal position exists may be determined according to the position information of the text box and a preset legal position of the identity card text box; if so, deleting the text box with the illegal position. In another alternative mode, before the character information with the corresponding relation is determined, the illegal character information on the identity card image can be identified and filtered according to the position information and the character information of the text box; and the position of the text box where the illegal character information is located does not belong to the preset legal position of the identity card text box.
In addition, a second identification method of the identification card information is further provided in the embodiments of the present invention, where the method is implemented on the basis of the method shown in fig. 1, and the method further describes a specific process of determining the text information having a correspondence relationship according to the position information and the text information of the text box, as shown in fig. 4, the method includes the following steps:
step S402, obtaining an identity card image of identity card information to be identified;
step S404, performing text line detection on the identity card image to obtain a plurality of text boxes;
step S406, acquiring position information of a text box in the identity card image;
step S408, performing character recognition on the text box to obtain character information corresponding to the text box;
step S410, determining the textboxes in the same line according to the position information of the textboxes;
the feature information of the distribution position of the text boxes on the same line on the identity card in practical application, such as the feature information of the vertical coordinate of the corresponding coordinate point on the text box on the same line in a rectangular plane coordinate system where a plurality of text boxes are located. For example, the distance between the vertical coordinates of the coordinate points corresponding to the text boxes in the same line is different within the preset threshold range no matter whether the identity card image is inclined or not. For example, if the id card image is not tilted, the vertical coordinates of the top left vertices of the two text boxes in the same line should be the same, and if the id card image is tilted, the vertical coordinates of the top left vertices of the two text boxes in the same line are deviated, but may be within a certain range. Or the vertical coordinate value ranges of the vertical borders of the text boxes on the same line have a certain overlapping degree.
Step S412, determining the text boxes with corresponding relations in the text boxes in the same line according to the position information of the text boxes in the same line;
for example, the horizontal coordinates of the text boxes in the same line in the rectangular plane coordinate system may be analyzed, and the text boxes with smaller differences in horizontal coordinates, that is, closer to each other, may be determined as the text boxes with the corresponding relationship.
Step S414, determining the text information having the corresponding relationship according to the text box having the corresponding relationship and the text information of the text box.
Whether the corresponding relation of the text boxes is correct or not can be checked according to the text boxes with the corresponding relation and the character information of the text boxes; and determining the character information of the text box with the correct corresponding relation as the character information with the corresponding relation. For example, if the "sex" is close to the text box in which the "woman" is located, and the "ethnicity" is close to the text box in which the "chinese" is located, it is determined in step S412 that the text boxes have a correspondence relationship, and it is determined through the text information verification that the "sex" and the "woman" are text information having a correspondence relationship, and the "ethnicity" and the "chinese" are text information having a correspondence relationship. Since "woman" and "nation" are also adjacent in the id card image, if the text boxes in which "woman" and "nation" are located are also determined to have a correspondence in step S412, it may be determined that "woman" and "nation" do not have a correspondence through text information verification in step S414.
Step S416, according to the character information with the corresponding relation, the identity card information corresponding to the identity card image is determined.
The second identification method for the information of the identification card provided by the embodiment of the invention includes determining the text boxes in the same line according to the position information of the text boxes, and then determining the text boxes with the corresponding relationship in the text boxes in the same line according to the position information of the text boxes in the same line; and determining the character information with the corresponding relation according to the text box with the corresponding relation and the character information of the text box. The method provided by the embodiment of the invention firstly determines the corresponding relation of the text box, and then determines the character information with the corresponding relation by combining the character information of the text box, thereby being beneficial to improving the accuracy of identification of the identity card information.
When the position information of the text box in the identity card image is obtained and the text box in the same line with the corresponding relation are determined, the following two main implementation modes can be referred to:
the first method is as follows:
the acquired position information of the text box comprises a starting point coordinate of the text box, and the starting point coordinate comprises a starting abscissa and a starting ordinate; the text box is mostly rectangular, and the starting point may be coordinates of any vertex of the text box, such as coordinates of a vertex at the top left corner of the text box.
The step S410 may be to determine the textbox in the same line according to the starting ordinate of the textbox, and specifically includes the following steps: and determining the text boxes with the vertical coordinates of the starting points within a preset first threshold as the text boxes in the same line.
Considering the fact that an actually acquired identity card image is skewed, a plurality of text boxes obtained by detecting text lines of the identity card image are possibly skewed, so that the values of the vertical coordinates of the text boxes in the same line on a rectangular plane coordinate system have deviation, a first threshold value can be preset, and when the difference value of the vertical coordinates of the starting points of the plurality of text boxes is smaller than the preset first threshold value, the plurality of text boxes are determined to be the text boxes in the same line. The preset first threshold may be set according to an empirical value, and is not limited herein.
Based on this, in step S412, that is, the step of determining the text boxes having the corresponding relationship in the text boxes in the same line according to the position information of the text boxes in the same line includes: and determining the text boxes with the difference of the horizontal coordinates of the starting points in the text boxes in the same line within a preset second threshold value as the text boxes with the corresponding relationship in the text boxes in the same line.
The distance between the text boxes with the corresponding relation in the same line on the actual identity card is smaller than the distance between the text boxes without the corresponding relation, namely the text boxes with the corresponding relation in the same line are relatively similar in position distribution, so that the difference value of the horizontal coordinates of the starting points in the text boxes in the same line is used as the distance between the text boxes and is compared with a preset second threshold value, and the text box with the difference value of the horizontal coordinates of the starting points in the text boxes in the same line within the preset second threshold value is determined as the text box with the corresponding relation in the text boxes in the same line. The preset second threshold may be set according to an empirical value, and is not limited herein.
The second method comprises the following steps:
the acquired position information of the text box comprises a longitudinal coordinate value range and an abscissa coordinate value range of the text box; the text box is mostly rectangular, and the longitudinal coordinate value range and the horizontal coordinate value range of the text box can be determined according to the coordinates of four vertexes of the text box.
The step S410 may be to determine the textbox in the same line according to the ordinate value range of the textbox, and specifically includes the following steps: and determining two text boxes with the longitudinal coordinate value range at least having the first overlapping length as the text boxes in the same line. For example, if the identity card is not skewed, the value range of the ordinate of the first text box (that is, the value range of the longitudinal edge of the first text box mapped to the Y axis) should be the same as (that is, completely overlap with) the value range of the ordinate of the second text box in the same row, and if the identity card is skewed, the text boxes in the same row may also be skewed correspondingly (specifically, see fig. 2), but the value range of the ordinate of the first text box may still overlap with the value range of the ordinate of the second text box to some extent.
Considering the fact that an actually acquired identity card image is skewed, a plurality of text boxes obtained by detecting text lines of the identity card image are possibly skewed, so that the longitudinal coordinate value ranges of the text boxes in the same line on a rectangular plane coordinate system cannot be completely overlapped, and certain deviation exists, a first overlapping length is preset, and when the overlapping area of the longitudinal coordinate value ranges of the two text boxes is larger than the first overlapping length, the two text boxes are determined to be the text boxes in the same line. The first overlap length may be set according to an empirical value, and is not limited herein.
Based on this, in step S412, that is, the step of determining the text boxes having the corresponding relationship in the text boxes in the same line according to the position information of the text boxes in the same line includes: determining the minimum value of the abscissa of the text box according to the range of the abscissa of the text box in the same line; specifically, the minimum value of the abscissa of the text box is also the abscissa of the top left corner vertex or the bottom left corner vertex of the text box. And determining the text boxes with the difference of the minimum value of the abscissas in the text boxes in the same line within a preset third threshold value as the text boxes with the corresponding relationship in the text boxes in the same line.
The distance between the text boxes with the corresponding relation in the same line on the actual identity card is smaller than the distance between the text boxes without the corresponding relation, namely the text boxes with the corresponding relation in the same line are relatively similar in position distribution, so that the difference value of the minimum horizontal coordinates of the text boxes in the same line is taken as the distance between the text boxes, the distance is compared with a preset third threshold value, and the text box with the difference value of the horizontal coordinates of the starting points in the text boxes in the same line within the preset third threshold value is determined as the text box with the corresponding relation in the text boxes in the same line. The preset third threshold may be set according to an empirical value, and is not limited herein.
The embodiment of the present invention further provides a third identification method for identification card information, which is implemented on the basis of the method shown in fig. 1, and the method further describes a specific process of determining the identification card information corresponding to the identification card image according to the text information having the corresponding relationship, as shown in fig. 5, and the method includes the following steps:
step S502, obtaining an identity card image of identity card information to be identified;
step S504, text line detection is carried out on the identity card image to obtain a plurality of text boxes;
step S506, acquiring position information of a text box in the identity card image;
step S510, determining character information with corresponding relation according to the position information and the character information of the text box;
step S512, determining the information category of the character information with the corresponding relation based on the character information with the corresponding relation;
for example, the information categories include one or more of a name category, a gender category, a ethnic group category, a date of birth category, an address category, and an identification number category.
Step S514, determining the key words in the character information with the corresponding relation and the characters with the corresponding relation with the key words according to the information categories;
wherein, the key words comprise one or more of name, gender, ethnicity, birth, year, month, day, address and citizen identity card number.
Step S516, determining the characters corresponding to the key words as the identity card information.
Specifically, the word corresponding to the keyword "name" is "Zhang III"; the corresponding character of the key word 'sex' is 'male'; if the corresponding character of the key word "ethnic group" is "Chinese", the character "Zhang three-Man-Han" having the corresponding relation with the key word is extracted and determined as the ID card information.
The third identification method for the information of the identification card provided by the embodiment of the present invention is to determine the information category of the text information having the corresponding relationship, and then determine the key word and the text having the corresponding relationship with the key word in the text information having the corresponding relationship according to the information category; and determining the characters corresponding to the key words as the identity card information. In the manner provided by the embodiment of the invention, the key words in the character information with the corresponding relation are determined according to the information categories, and the characters with the corresponding relation with the key words are determined as the identity card information, so that effective identity card information can be extracted, and the accuracy of identity card information identification can be improved.
In further consideration of the fact that in practical application, the identity card image to be identified may be an identity card image of an illegal identity card, the third method for identifying identity card information provided in the embodiment of the present invention further includes: checking whether the information of the identity card is correct or not according to the information type; and when the check result is negative, initiating an error prompt. There are various Error prompt manners, such as directly emptying the Error identification card information, or filling the Error identification card information as a specified value "Error" or other values representing the Error, or directly labeling the Error identification card information in a highlight manner, and any Error prompt manner may be used, which is not limited herein.
In specific implementation, according to the information category, whether the identity card information is correct can be checked by executing the following judgment conditions:
judgment condition 1: and checking whether the information corresponding to the birth date category in the identity card information and the information corresponding to the category in the identity card information are correct or not by adopting the information corresponding to the identity card number category in the identity card information. For example, 11-12 bits and 13-14 bits of the identification card number respectively represent the year, month and day of birth, whether the date of birth in the identification card information is correct can be checked through the number of a designated bit value on the identification card number, in addition, the parity of a certain designated bit value on the identification card number represents the sex, the odd number represents the male, the even number represents the female, and the parity of the designated bit value can be used for checking whether the sex in the identification card information is correct.
Judgment condition 2: checking whether the information corresponding to the category in the identity card information is one of preset sex words, wherein the preset sex words comprise males or females;
judgment condition 3: checking whether the information corresponding to the ethnic category in the identity card information is one of preset ethnic words, wherein the preset ethnic words comprise legal ethnic words such as Han nationality, Hui nationality, Manchu nationality and Uygur nationality;
judgment condition 4: checking whether the information corresponding to the birth date type in the identity card information is one of preset numbers; wherein the preset number is a legal date number. Such as the legal number of days of the month being 1-12, the legal number of days of the individual being 1-31, etc.
In specific implementation, one or more of the above judgment conditions may be selected to check whether the information of the identification card is correct.
In addition, the identification method of the identity card information provided by the embodiment further includes: and judging whether the identity card image is legal or not according to the information corresponding to the identity card number category in the identity card information.
For example, whether the identification card number is legal or not can be checked according to the numbering rule of the identification card number, and if not, the identification card image corresponding to the identification card number category is illegal.
Specifically, the identification number has 18 bits, and the numbering rules of each bit from left to right are as follows: 1-2 bits represent provincial administrative district codes; 3-4 bits represent a ground level administrative region division code; 5-6 bits represent administrative division codes of county and district; the 7-10, 11-12 and 13-14 bits represent the year, month and day of birth, respectively; the 15-17 bits represent a sequence code which is the number of the same-year, same-month and same-sunrise students in the same region, wherein odd numbers are males and even numbers are females; 18 bits are check codes, and different coefficients are multiplied by the first 17 bits of the ID card number respectively; wherein, the coefficients from the 1 st bit to the 17 th bit are respectively: 7-9-10-5-8-4-2-1-6-3-7-9-10-5-8-4-2; the result of multiplying the 17-bit number by the coefficient is added and divided by 11 to obtain the remainder, which is the check code, wherein the remainder is 0-9 when the remainder is 0-9, and X (roman numeral 10) when the remainder is 10. In specific implementation, whether the extracted identification number is legal or not can be verified through the coding rule.
Corresponding to the first identification card information identification method, an embodiment of the present invention provides a first identification card information identification apparatus, including:
an image to be recognized acquisition module 602, configured to acquire an identity card image of identity card information to be recognized;
the text line detection module 604 is configured to perform text line detection on the identity card image to obtain a plurality of text boxes;
a position information obtaining module 606, configured to obtain position information of a text box in an identity card image;
the character recognition module 608 is configured to perform character recognition on the text box to obtain character information corresponding to the text box;
a corresponding relation determining module 610, configured to determine text information having a corresponding relation according to the position information and the text information of the text box;
the identity card information determining module 612 is configured to determine, according to the text information having the corresponding relationship, identity card information corresponding to the identity card image.
The invention provides a first identification device for identification card information, which can firstly detect a text line of an identification card image of identification card information to be identified to obtain a plurality of text boxes; and then acquiring the position information of the text box in the identity card image and the character information corresponding to the text box, further determining the character information with the corresponding relation according to the position information and the character information of the text box, and determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation. Compared with the prior art that most characters on the identity card image are directly identified to extract identity card information, and the problem that wrong identity card information is extracted due to the fact that the characters on the identity card image are scattered, the watermark is added, or the identity card image is inclined, the embodiment of the invention can detect the text box on the identity card image firstly, and then determine the character information with the corresponding relation according to the position information and the character information of the text box, so that the wrong identity card information can be prevented from being extracted, and the identification accuracy of the identity card information is effectively improved.
In one embodiment, the text line detection module includes the following units:
the identity card inclination judging unit is used for acquiring the vertex coordinates of the identity card image and judging whether the identity card image is inclined or not according to the vertex coordinates of the identity card image;
the image alignment unit is used for aligning the identity card image when the judgment result of the identity card inclination judgment unit is positive;
the horizontal coordinate of the top left corner vertex of the identity card image after being adjusted is the same as the horizontal coordinate of the bottom left corner vertex, the vertical coordinate of the top left corner vertex is the same as the vertical coordinate of the top right corner vertex, and the distance between the top left corner vertex and the top right corner vertex is greater than the distance between the top left corner vertex and the bottom left corner vertex;
and the text line detection unit is used for performing text line detection on the adjusted ID card image to obtain a plurality of text boxes.
In a specific embodiment, the text line detection module is further configured to perform text line detection on the identity card image through the CTPN network model to obtain a plurality of text boxes.
In one embodiment, the position information acquiring module includes: the coordinate acquisition unit is used for acquiring the vertex coordinates of the text box in the identity card image; the text box inclination judging unit is used for judging whether the text box is inclined or not according to the vertex coordinates of the text box; the text box adjusting unit is used for adjusting the text box when the judgment result of the text box inclination judging unit is positive; and the position information acquisition unit is used for acquiring the position information of the adjusted text box.
In a specific embodiment, the text information determining module is further configured to: and performing character recognition on the text box through the CRNN model to obtain character information corresponding to the text box.
Further, the first identification card information identification method apparatus further includes an illegal text box deletion module, configured to determine whether a text box with an illegal position exists according to the position information of the text box and a preset legal position of the identification card text box before performing character identification on the text box; and when the text box with the illegal position exists, deleting the text box with the illegal position.
In addition, the first identification method and apparatus for identification of information on an identification card further include an illegal character information filtering module, configured to identify and filter illegal character information on an image of the identification card according to the position information and the character information of the text box before determining the character information having a correspondence; and the position of the text box where the illegal character information is located does not belong to the preset legal position of the identity card text box.
In response to the above-mentioned identification method for the second kind of identification card information, an embodiment of the present invention provides an identification apparatus for the second kind of identification card information, which further shows a specific structure of the corresponding relationship determining module 610 on the basis of the apparatus shown in fig. 6, and referring to fig. 7, the corresponding relationship determining module 610 includes:
a same-line text box determining unit 702, configured to determine a same-line text box according to the position information of the text box;
a corresponding text box determining unit 704, configured to determine, according to the position information of the text boxes in the same line, a text box in the same line that has a corresponding relationship.
The corresponding text information determining unit 706 is configured to determine text information having a corresponding relationship according to the text box having the corresponding relationship and the text information of the text box.
The second identification card information identification device provided in the embodiment of the present invention determines the textboxes in the same line according to the position information of the textbox, and then determines the textboxes in the same line that have a corresponding relationship according to the position information of the textboxes in the same line; and determining the character information with the corresponding relation according to the text box with the corresponding relation and the character information of the text box. The embodiment of the invention determines the corresponding relation of the text boxes firstly, and then determines the character information with the corresponding relation by combining the character information of the text boxes, thereby being beneficial to improving the accuracy of identification of the information of the identity card.
In a specific embodiment, when the position information of the text box includes coordinates of a start point of the text box, and the coordinates of the start point include a start abscissa and a start ordinate, the in-line text box determining unit is further configured to determine a text box whose ordinate of the start point differs by a preset first threshold as the in-line text box. Based on this, the corresponding text box determining unit is further configured to determine a text box with a difference between horizontal coordinates of starting points in the text boxes in the same line and a preset second threshold as a text box with a corresponding relationship in the text boxes in the same line.
In another specific embodiment, when the position information of the text box includes a vertical coordinate value range and a horizontal coordinate value range of the text box, the in-line text box determining unit is further configured to determine two text boxes with vertical coordinate value ranges at least having a first overlapping length as the text boxes in the same line; based on the above, the corresponding text box determining unit is further configured to determine the minimum abscissa value of the text box according to the abscissa value range of the text box in the same line; and determining the text boxes with the difference of the minimum value of the abscissas in the text boxes in the same line within a preset third threshold value as the text boxes with the corresponding relationship in the text boxes in the same line.
The corresponding character information determining unit is further configured to check whether the corresponding relationship of the text box is correct according to the text box having the corresponding relationship and the character information of the text box; and determining the character information of the text box with the correct corresponding relation as the character information with the corresponding relation.
Corresponding to the third identification card information identification method, the implementation of the present invention provides a third identification card information identification apparatus, which further shows a specific structure of an identification card information determination module 612 on the basis of the apparatus shown in fig. 6, and referring to fig. 8, the identification card information determination module 612 includes:
an information category determination unit 802 configured to determine an information category of the text information having the correspondence relationship based on the text information having the correspondence relationship; the information category comprises one or more of a name category, a gender category, a ethnic group category, a birth date category, an address category and an identity card number category;
a keyword and corresponding character determining unit 804, configured to determine, according to the information category, a keyword in the character information having a corresponding relationship and a character having a corresponding relationship with the keyword; wherein, the key words comprise one or more of name, sex, ethnicity, birth, year, month, day, address and citizen identity card number;
an identity card information determining unit 806, configured to determine, as the identity card information, a character having a correspondence relationship with the key word.
The third identification card information recognition device provided in the embodiment of the present invention determines the information category of the text information having a corresponding relationship, and then determines the key word and the text having a corresponding relationship with the key word in the text information having a corresponding relationship according to the information category; and determining the characters corresponding to the key words as the identity card information. According to the embodiment of the invention, the key words in the character information with the corresponding relation are determined according to the information categories, and the characters with the corresponding relation with the key words are determined as the identity card information, so that effective identity card information can be extracted, and the accuracy of identity card information identification can be improved.
Furthermore, the third identification card information recognition device further comprises a checking module and an error reporting module; the checking module is used for checking whether the information of the identity card is correct or not according to the information type; and the error reporting module is used for initiating an error reporting prompt when the judgment result of the checking module is negative.
Specifically, the checking module is further configured to check whether the information corresponding to the birth date category in the identification card information and the information corresponding to the category in the identification card information are correct by using the information corresponding to the category of the identification card number in the identification card information; and/or checking whether the information corresponding to the category in the identity card information is one of preset gender words, wherein the preset gender words comprise males or females; and/or checking whether the information corresponding to the ethnic category in the identity card information is one of preset ethnic words, wherein the preset ethnic words comprise legal ethnic words; and/or checking whether the information corresponding to the birth date type in the identity card information is one of preset numbers; wherein the preset number is a legal date number.
Further, the third identification device for identification card information further includes a legality determining module, configured to determine whether the identification card image is legal according to information corresponding to the type of the identification card number in the identification card information.
The implementation principle and the resulting technical effect of the above-mentioned apparatus provided in this embodiment are the same as those of the above-mentioned embodiment, and for the sake of brief description, reference may be made to the corresponding contents in the foregoing method embodiments for the part of the embodiment of the apparatus that is not mentioned.
Further, the present embodiment also provides a terminal device, where the terminal device includes a processor and a memory, where the memory is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor to implement the identification method of the identification card information.
Referring to a schematic structural diagram of a terminal device shown in fig. 9, a terminal device 900 is shown, which includes: the processor 90, the memory 91, the bus 92 and the communication interface 93, wherein the processor 90, the communication interface 93 and the memory 91 are connected through the bus 92; the processor 90 is arranged to execute executable modules, such as computer programs, stored in the memory 91.
The Memory 91 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 93 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used.
Bus 92 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 9, but this does not indicate only one bus or one type of bus.
The memory 91 is used for storing a program, the processor 90 executes the program after receiving an execution instruction, and the method executed by the apparatus defined by the flow process disclosed in any of the foregoing embodiments of the present invention may be applied to the processor 90, or implemented by the processor 90.
The processor 90 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 90. The Processor 90 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 91, and the processor 90 reads the information in the memory 91 and performs the steps of the above method in combination with the hardware thereof.
Further, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs any of the steps of the identification method for identification information of an identification card. For specific implementation, reference may be made to the method embodiment, which is not described herein again.
The method and apparatus for identifying identity card information and the computer program product of the terminal device provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (18)

1. A method for identifying identity card information is characterized by comprising the following steps:
acquiring an identity card image of identity card information to be identified;
performing text line detection on the identity card image to obtain a plurality of text boxes;
acquiring the position information of the text box in the identity card image;
performing character recognition on the text box to obtain character information corresponding to the text box;
determining character information with a corresponding relation according to the position information and the character information of the text box;
and determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation.
2. The method of claim 1, wherein the step of performing text line detection on the identification card image to obtain a plurality of text boxes comprises:
acquiring the vertex coordinates of the identity card image, and judging whether the identity card image is inclined or not according to the vertex coordinates of the identity card image;
if so, adjusting the identity card image;
and performing text line detection on the aligned identity card image to obtain a plurality of text boxes.
3. The method of claim 1, wherein the step of performing text line detection on the identification card image to obtain a plurality of text boxes comprises:
and performing text line detection on the identity card image through a CTPN network model to obtain a plurality of text boxes.
4. The method of claim 1, wherein the step of obtaining the location information of the text box in the identity card image comprises:
acquiring the vertex coordinates of the text box in the identity card image;
judging whether the text box inclines or not according to the vertex coordinates of the text box;
if so, adjusting the text box;
and acquiring the position information of the adjusted text box.
5. The method according to claim 1, wherein the step of performing character recognition on the text box to obtain character information corresponding to the text box comprises:
and performing character recognition on the text box through a CRNN network model to obtain character information corresponding to the text box.
6. The method according to any one of claims 1 to 5, wherein the step of determining the text information having a correspondence relationship according to the position information and the text information of the text box comprises:
determining the textboxes in the same line according to the position information of the textboxes;
determining the text boxes with corresponding relations in the text boxes in the same line according to the position information of the text boxes in the same line;
and determining the character information with the corresponding relation according to the text box with the corresponding relation and the character information of the text box.
7. The method of claim 6, wherein the position information of the text box comprises a start point coordinate of the text box, the start point coordinate comprising a start abscissa and a start ordinate;
the step of determining the textboxes in the same line according to the position information of the textbox comprises the following steps:
determining the text boxes with the difference of the vertical coordinates of the starting points within a preset first threshold value as the text boxes in the same line;
the step of determining the text boxes with the corresponding relationship in the text boxes in the same line according to the position information of the text boxes in the same line comprises the following steps:
and determining the text box with the difference of the horizontal coordinates of the starting points in the text boxes in the same line within a preset second threshold value as the text box with the corresponding relation in the text boxes in the same line.
8. The method of claim 6, wherein the position information of the text box comprises a vertical coordinate value range and a horizontal coordinate value range of the text box;
the step of determining the textboxes in the same line according to the position information of the textbox comprises the following steps:
determining two text boxes with longitudinal coordinate value ranges at least having a first overlapping length as text boxes in the same line;
the step of determining the text boxes with the corresponding relationship in the text boxes in the same line according to the position information of the text boxes in the same line comprises the following steps:
determining the minimum value of the abscissa of the text box according to the range of the abscissa of the text box in the same line;
and determining the text box with the difference of the minimum value of the horizontal coordinates in the text boxes in the same line within a preset third threshold value as the text box with the corresponding relation in the text boxes in the same line.
9. The method according to claim 6, wherein the step of determining the text information having a corresponding relationship according to the text box having a corresponding relationship and the text information of the text box comprises:
checking whether the corresponding relation of the text box is correct or not according to the text box with the corresponding relation and the character information of the text box;
and determining the character information of the text box with the correct corresponding relation as the character information with the corresponding relation.
10. The method according to claim 1, wherein the step of determining the identity card information corresponding to the identity card image according to the text information having the correspondence relationship comprises:
determining the information category of the character information with the corresponding relation based on the character information with the corresponding relation; the information category comprises one or more of a name category, a gender category, a ethnic category, a birth date category, an address category and an identity card number category;
determining key words in the text information with the corresponding relationship and the text with the corresponding relationship with the key words according to the information category; wherein, the key words comprise one or more of name, gender, ethnicity, birth, year, month, day, address and citizen identity card number;
and determining the characters corresponding to the key words as the identity card information.
11. The method of claim 10, further comprising:
checking whether the identity card information is correct or not according to the information type;
if not, initiating an error prompt.
12. The method of claim 11, wherein the step of checking whether the identity card information is correct according to the information category comprises:
checking whether the information corresponding to the birth date category in the identity card information and the information corresponding to the category in the identity card information are correct or not by adopting the information corresponding to the identity card number category in the identity card information;
and/or the presence of a gas in the gas,
checking whether the information corresponding to the gender category in the identity card information is one of preset gender words, wherein the preset gender words comprise males or females;
and/or the presence of a gas in the gas,
checking whether the information corresponding to the ethnic category in the identity card information is one of preset ethnic words, wherein the preset ethnic words comprise legal ethnic words;
and/or the presence of a gas in the gas,
checking whether the information corresponding to the birth date type in the identity card information is one of preset numbers; wherein the preset number is a legal date number.
13. The method of claim 11, further comprising:
and judging whether the identity card image is legal or not according to the information corresponding to the identity card number type in the identity card information.
14. The method of claim 1, wherein the step of text box word recognition is preceded by the method further comprising:
judging whether a text box with an illegal position exists according to the position information of the text box and the preset legal position of the identity card text box;
if so, deleting the text box with the illegal position.
15. The method of claim 1, wherein before the step of determining the text information having the corresponding relationship, the method further comprises:
according to the position information and the character information of the text box, identifying and filtering illegal character information on the identity card image; and the position of the text box where the illegal character information is located does not belong to the preset legal position of the identity card text box.
16. An apparatus for recognizing identity card information, comprising:
the to-be-identified image acquisition module is used for acquiring an identity card image of the to-be-identified identity card information;
the text line detection module is used for performing text line detection on the identity card image to obtain a plurality of text boxes;
the position information acquisition module is used for acquiring the position information of the text box in the identity card image;
the character recognition module is used for carrying out character recognition on the text box to obtain character information corresponding to the text box;
the corresponding relation determining module is used for determining the character information with the corresponding relation according to the position information and the character information of the text box;
and the identity card information determining module is used for determining the identity card information corresponding to the identity card image according to the character information with the corresponding relation.
17. A terminal device, characterized in that the terminal device comprises a memory for storing a program enabling a processor to perform the method of any of claims 1 to 15 and a processor configured to execute the program stored in the memory.
18. A computer storage medium storing computer software instructions for use in the method of any one of claims 1 to 15.
CN201811317603.9A 2018-11-06 2018-11-06 Identification method and device for identity card information, terminal equipment and storage medium Active CN111144400B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811317603.9A CN111144400B (en) 2018-11-06 2018-11-06 Identification method and device for identity card information, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811317603.9A CN111144400B (en) 2018-11-06 2018-11-06 Identification method and device for identity card information, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111144400A true CN111144400A (en) 2020-05-12
CN111144400B CN111144400B (en) 2024-03-29

Family

ID=70516542

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811317603.9A Active CN111144400B (en) 2018-11-06 2018-11-06 Identification method and device for identity card information, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111144400B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111985465A (en) * 2020-08-17 2020-11-24 中移(杭州)信息技术有限公司 Text recognition method, device, equipment and storage medium
CN112185520A (en) * 2020-09-27 2021-01-05 志诺维思(北京)基因科技有限公司 Text structured processing system and method for medical pathology report picture
CN112396060A (en) * 2020-11-17 2021-02-23 中国平安人寿保险股份有限公司 Identity card identification method based on identity card segmentation model and related equipment thereof
CN112836470A (en) * 2021-02-25 2021-05-25 珠海金山办公软件有限公司 Document typesetting method and device
CN112949523A (en) * 2021-03-11 2021-06-11 兴业银行股份有限公司 Method and system for extracting key information from identity card image picture
CN113065423A (en) * 2021-03-19 2021-07-02 国网电子商务有限公司 Ticket key information extraction method and device based on deep learning

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103488984A (en) * 2013-10-11 2014-01-01 从兴技术有限公司 Method and device for identifying second-generation identity cards based on intelligent mobile equipment
US20150078671A1 (en) * 2013-09-19 2015-03-19 IDChecker, Inc. Automated document recognition, identification, and data extraction
CN106295629A (en) * 2016-07-15 2017-01-04 北京市商汤科技开发有限公司 Structured text detection method and system
CN106326888A (en) * 2016-08-16 2017-01-11 北京旷视科技有限公司 Image recognition method and device
WO2017069385A1 (en) * 2015-10-23 2017-04-27 주식회사 피노텍 Identification recognition device using mobile device
CN106886774A (en) * 2015-12-16 2017-06-23 腾讯科技(深圳)有限公司 The method and apparatus for recognizing ID card information
CN107247950A (en) * 2017-06-06 2017-10-13 电子科技大学 A kind of ID Card Image text recognition method based on machine learning
CN107346427A (en) * 2017-06-23 2017-11-14 浙江大华技术股份有限公司 A kind of ID card No. recognition methods and device
CN108154132A (en) * 2018-01-10 2018-06-12 马上消费金融股份有限公司 A kind of identity card text extraction method, system and equipment and storage medium
CN108229299A (en) * 2017-10-31 2018-06-29 北京市商汤科技开发有限公司 The recognition methods of certificate and device, electronic equipment, computer storage media
CN108304761A (en) * 2017-09-25 2018-07-20 腾讯科技(深圳)有限公司 Method for text detection, device, storage medium and computer equipment
CN108717543A (en) * 2018-05-14 2018-10-30 北京市商汤科技开发有限公司 A kind of invoice recognition methods and device, computer storage media

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150078671A1 (en) * 2013-09-19 2015-03-19 IDChecker, Inc. Automated document recognition, identification, and data extraction
CN103488984A (en) * 2013-10-11 2014-01-01 从兴技术有限公司 Method and device for identifying second-generation identity cards based on intelligent mobile equipment
WO2017069385A1 (en) * 2015-10-23 2017-04-27 주식회사 피노텍 Identification recognition device using mobile device
CN106886774A (en) * 2015-12-16 2017-06-23 腾讯科技(深圳)有限公司 The method and apparatus for recognizing ID card information
CN106295629A (en) * 2016-07-15 2017-01-04 北京市商汤科技开发有限公司 Structured text detection method and system
CN106326888A (en) * 2016-08-16 2017-01-11 北京旷视科技有限公司 Image recognition method and device
CN107247950A (en) * 2017-06-06 2017-10-13 电子科技大学 A kind of ID Card Image text recognition method based on machine learning
CN107346427A (en) * 2017-06-23 2017-11-14 浙江大华技术股份有限公司 A kind of ID card No. recognition methods and device
CN108304761A (en) * 2017-09-25 2018-07-20 腾讯科技(深圳)有限公司 Method for text detection, device, storage medium and computer equipment
CN108229299A (en) * 2017-10-31 2018-06-29 北京市商汤科技开发有限公司 The recognition methods of certificate and device, electronic equipment, computer storage media
CN108154132A (en) * 2018-01-10 2018-06-12 马上消费金融股份有限公司 A kind of identity card text extraction method, system and equipment and storage medium
CN108717543A (en) * 2018-05-14 2018-10-30 北京市商汤科技开发有限公司 A kind of invoice recognition methods and device, computer storage media

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111985465A (en) * 2020-08-17 2020-11-24 中移(杭州)信息技术有限公司 Text recognition method, device, equipment and storage medium
CN112185520A (en) * 2020-09-27 2021-01-05 志诺维思(北京)基因科技有限公司 Text structured processing system and method for medical pathology report picture
CN112185520B (en) * 2020-09-27 2024-06-07 志诺维思(北京)基因科技有限公司 Text structuring processing system and method for medical pathology report picture
CN112396060A (en) * 2020-11-17 2021-02-23 中国平安人寿保险股份有限公司 Identity card identification method based on identity card segmentation model and related equipment thereof
CN112396060B (en) * 2020-11-17 2024-03-15 中国平安人寿保险股份有限公司 Identification card recognition method based on identification card segmentation model and related equipment thereof
CN112836470A (en) * 2021-02-25 2021-05-25 珠海金山办公软件有限公司 Document typesetting method and device
CN112949523A (en) * 2021-03-11 2021-06-11 兴业银行股份有限公司 Method and system for extracting key information from identity card image picture
CN113065423A (en) * 2021-03-19 2021-07-02 国网电子商务有限公司 Ticket key information extraction method and device based on deep learning

Also Published As

Publication number Publication date
CN111144400B (en) 2024-03-29

Similar Documents

Publication Publication Date Title
CN111144400B (en) Identification method and device for identity card information, terminal equipment and storage medium
CN107798299B (en) Bill information identification method, electronic device and readable storage medium
CN110766014B (en) Bill information positioning method, system and computer readable storage medium
CN109658584B (en) Bill information identification method and device
RU2613734C1 (en) Video capture in data input scenario
US11361570B2 (en) Receipt identification method, apparatus, device and storage medium
US8942484B2 (en) Text detection using image regions
CN106056114A (en) Business card content identification method and business card content identification device
CN111639648B (en) Certificate identification method, device, computing equipment and storage medium
CN111259878A (en) Method and equipment for detecting text
TW202042105A (en) Method, device and electronic device for document identification and computer readable storage medium thereof
CN111178147B (en) Screen crushing and grading method, device, equipment and computer readable storage medium
CN112396047B (en) Training sample generation method and device, computer equipment and storage medium
US10796143B2 (en) Information processing apparatus, information processing system, and non-transitory computer readable medium
CN111079480A (en) Identification method and device of identity card information and terminal equipment
CN111160395A (en) Image recognition method and device, electronic equipment and storage medium
CN113557520A (en) Character processing and character recognition method, storage medium and terminal device
CN114694161A (en) Text recognition method and equipment for specific format certificate and storage medium
CN112163110B (en) Image classification method and device, electronic equipment and computer-readable storage medium
CN110008960A (en) A kind of method and terminal detecting character fragments integrality
CN110909816B (en) Picture identification method and device
CN111753812A (en) Text recognition method and equipment
US9378428B2 (en) Incomplete patterns
CN116311327A (en) Prescription image detection method
US10032073B1 (en) Detecting aspect ratios of document pages on smartphone photographs by learning camera view angles

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant