CN111144400B - 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
CN111144400B
CN111144400B CN201811317603.9A CN201811317603A CN111144400B CN 111144400 B CN111144400 B CN 111144400B CN 201811317603 A CN201811317603 A CN 201811317603A CN 111144400 B CN111144400 B CN 111144400B
Authority
CN
China
Prior art keywords
text
information
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.)
Active
Application number
CN201811317603.9A
Other languages
Chinese (zh)
Other versions
CN111144400A (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

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 an identification method, a device, terminal equipment and a storage medium of identity card information, and relates to the technical field of intelligent identification, wherein 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 text recognition on the text box to obtain text information corresponding to the text box; determining text information with a corresponding relation according to the position information and the text information of the text box; and determining the identity card information corresponding to the identity card image according to the text 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 an identification method and apparatus for identification card information, a terminal device, and a storage medium.
Background
Identification of identification card information is currently required in many situations to determine the identity of the identity card holder. In the prior art, the identity information on the identity card is mostly directly read through hardware devices such as an identity card reader and the like.
With the development of technology, the identification technology of the identification card image is gradually rising, and the identification card image identification technology mainly identifies and extracts characters on the 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, because the text information on the identity card is more, the extracted text information is scattered, other text such as watermarks can be added on the identity card image, and the identity card image is likely to be inclined for various reasons, the false identity card information can be extracted, and the identification accuracy of the identity card information is not high. For example, it is possible to obtain an erroneous information correspondence when performing text recognition, such as "name" and "man" may be considered as a group when the identification card image is inclined, thereby obtaining an erroneous conclusion that the name is "man".
Disclosure of Invention
Accordingly, the present invention aims to provide a method, a device, 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 a method for identifying identification 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 text recognition on the text box to obtain text information corresponding to the text box; determining text information with a corresponding relation according to the position information and the text information of the text box; and determining the identity card information corresponding to the identity card image according to the text 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 yes, the identity card image is regulated; and detecting the text lines of the aligned identity card images 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 detecting the text lines of 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 location information of a text box in an identification card image includes: obtaining 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 yes, the text box is adjusted; and acquiring the position information of the aligned 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 text recognition on a text box to obtain text information corresponding to the text box includes: and carrying out text recognition on the text box through the CRNN network model to obtain text information corresponding to the text box.
With reference to any one of the fourth possible implementation manners of the first aspect to the first aspect, an embodiment of the present invention provides a fifth possible implementation manner of the first aspect, where the step of determining the text information with a correspondence relationship according to the location information and the text information of the text box includes: determining the text boxes of the same line according to the position information of the text boxes; determining text boxes with corresponding relations in the text boxes of the same line according to the position information of the text boxes of the same line; and determining the text information with the corresponding relation according to the text box with the corresponding relation and the text 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 location 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; determining the text boxes of the same line according to the position information of the text boxes, wherein the method comprises the following steps: determining the text boxes within a preset first threshold value of the difference of the ordinate of the starting point as the text boxes of the same row; determining the text boxes with corresponding relations in the text boxes of the same line according to the position information of the text boxes of the same line, wherein the method comprises the following steps: and determining the text boxes in the starting point abscissa differences among the text boxes in the same row within a preset second threshold as the text boxes with corresponding relations among the text boxes in the same row.
With reference to the five possible implementation manners of the first aspect, an embodiment of the present invention provides a seventh possible implementation manner of the first aspect, where the location information of the text box includes an ordinate value range and an abscissa value range of the text box; determining the text boxes of the same line according to the position information of the text boxes, wherein the method comprises the following steps: determining two text boxes with at least a first overlapping length in the ordinate value range as the text boxes in the same row; determining the text boxes with corresponding relations in the text boxes of the same line according to the position information of the text boxes of the same line, wherein the method comprises the following steps: determining the minimum value of the abscissa of the text boxes according to the value range of the abscissa of the text boxes in the same row; and determining the text boxes in the difference of the minimum values of the abscissas in the text boxes in the same row within a preset third threshold as the text boxes with the corresponding relation in the text boxes in the same row.
With reference to the five possible implementation manners 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 with the correspondence relationship according to the text box with the correspondence relationship and the text information of the text box includes: checking whether the corresponding relation of the text box is correct or not according to the text box with the corresponding relation and the text information of the text box; and determining the text information of the text box with the correct corresponding relation as the text 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 a correspondence relationship, identification card information corresponding to the identification card image includes: determining information category of the text information with the corresponding relation based on the text information with the corresponding relation; the information category comprises one or more of a name category, a gender category, a ethnicity category, a birth date category, an address category and an identification card number category; according to the information category, determining key words in the text information with the corresponding relation and texts with the corresponding relation with the key words; wherein the key words comprise one or more of name, gender, ethnicity, birth, year, month, day, address and citizen ID card number; and determining the characters with the corresponding relation with 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, where the method further includes: checking whether the identity card information is correct according to the information category; if not, initiating error reporting 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 id 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 neutral 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 neutral category in the identity card information is one of the preset gender words, wherein the preset gender words comprise men or women; and/or checking whether the information corresponding to the national category in the identity card information is one of preset national words, wherein the preset national words comprise legal national words; and/or checking whether the information corresponding to the birth date category 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, where 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 type 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 text recognition on a text box, the method further includes: judging whether a text box with illegal positions exists or not according to the position information of the text box and the legal positions of the preset identity card text boxes; if so, deleting the illegitimate text box.
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 with a correspondence relationship, the method further includes: identifying and filtering illegal character information on the identity card image according to the position information and the character information of the text box; the position of the text box where the illegal word information is located does not belong to the legal position of the preset identity card text box.
In a second aspect, an embodiment of the present invention provides an identification device for identification card information, including: the image acquisition module to be identified is used for acquiring an identity card image of the identity card information to be identified; the text line detection module is used for detecting text lines of 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 text recognition module is used for recognizing the text box to obtain text information corresponding to the text box; the corresponding relation determining module is used for determining text information with a corresponding relation according to the position information and the text information of the text box; the identity card information determining module is used for determining the identity card information corresponding to the identity card image according to the text information with the corresponding relation.
In a third aspect, an embodiment of the present invention provides a terminal device, the terminal device including a memory for storing a program supporting the processor to perform the method according to any one of the fourteenth possible implementation manners of the first aspect, and a processor configured to execute the program stored in the memory.
In a fourth aspect, embodiments of the present invention provide a computer storage medium storing computer software instructions for use with the method according to any one of the fourteenth possible implementations of the first aspect.
The invention provides an identification method, a device, a terminal device 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 text information corresponding to the text box, further determining the text information with the corresponding relation according to the position information and the text information of the text box, and determining the identity card information corresponding to the identity card image according to the text information with the corresponding relation. Compared with the prior art that the identification card information is extracted by directly identifying the characters on the identification card image mostly, and the problem that the false identification card information is extracted due to scattered characters on the identification card image, watermarks added or the inclination of the identification card image is solved, the embodiment of the invention can detect the text box on the identification card image firstly, then determine the corresponding character information according to the position information and the character information of the text box, avoid the false identification card information from being extracted, and effectively improve the identification accuracy of the identification card information.
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 above objects, features and advantages of the present invention more 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 that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for identifying first identification card information according to an embodiment of the present invention;
FIG. 2 is a schematic view of an inclined ID card according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an aligned ID card according to an embodiment of the present invention;
FIG. 4 is a flowchart of a second method for identifying identification card information according to an embodiment of the present invention;
FIG. 5 is a flowchart of a third method for identifying identification card information according to an embodiment of the present invention;
FIG. 6 is a block diagram of a first identification device according to an embodiment of the present invention;
FIG. 7 is a block diagram of a second identification device according to an embodiment of the present invention;
FIG. 8 is a block diagram illustrating a third embodiment of an apparatus for identifying identification card information according to the present invention;
fig. 9 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, 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 embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Considering that in the prior art, character recognition and extraction are mostly directly performed on an identity card image, the recognition accuracy is not high, and in order to improve the problem, the embodiment of the invention provides a recognition method, a device, terminal equipment and a storage medium for identity card information, which can monitor a text box on the identity card image first, and then determine corresponding character information according to the position information and the character information of the text box, so as to avoid extracting wrong identity card information, and the recognition accuracy of the identity card information can be effectively improved in the mode. The technology can be applied to any occasion needing to identify the identity card image.
Embodiments of the present invention are described in detail below.
The embodiment of the invention firstly provides a first identification method of identity card information, as shown in fig. 1, the method can be executed by terminal equipment with processing capability, such as a computer, a mobile phone, a handheld certificate identification terminal and the like, and the method specifically comprises the following steps:
step S102, an identity card image of identity card information to be identified is obtained; the identity card image to be identified can be an electronic version identity card printing part directly uploaded manually or an identity card image obtained by directly scanning an entity identity card through electronic equipment, and the acquisition mode of the identity card image is not limited. Step S104, detecting text lines of the identity card image to obtain a plurality of text boxes.
In specific implementation, text detection can be performed on the identity card image through a related text line detection algorithm, and the obtained text box is generally rectangular in shape.
In the implementation, a text box detection model can be constructed in a machine learning mode, the input of the model is an identity card image, and the input of the model is each text box on the identity card image.
Step S106, the position information of the text box in the identity card image is obtained.
In an alternative embodiment, the position information of the corresponding text box may be represented by coordinates of a point at the same position in each text box by constructing a plane rectangular coordinate system on a plane where a plurality of text boxes are co-located, such as using the vertex coordinates 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 a coordinate set of the plurality of key points is determined as the position information of each text box. The key point may be a point on a frame of the text box. The number of the key points can be set according to the actual requirement, and is not limited.
Step S108, performing text recognition on the text box to obtain text information corresponding to the text box.
In the implementation, text recognition can be performed on the text box through a related text recognition algorithm, so that text information corresponding to the text box is obtained.
In the implementation, a text box character recognition model can be constructed 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 input is character information in the text box image.
Step S110, according to the position information and the text information of the text box, the text information with the corresponding relation is determined.
For example, according to the position distribution characteristics of the text boxes with the literal correspondence on the identity card, such as the fact that the positions of the names and the Zhang Sans, the sexes and the women, the ethnicities and the Chinese are relatively close, the position information of the text boxes obtained in the step S106 is analyzed and judged according to the position distribution characteristics of the text boxes with the correspondence, so that the sexes and the women have the correspondence, and the ethnicities and the Chinese have the correspondence, namely the text information with the correspondence is primarily determined. In consideration of the fact that the possible positions of the text boxes where the female and the ethnic group are located are relatively close, the error conclusion that the female and the ethnic group correspond to each other can be obtained, therefore, the embodiment further verifies whether the text boxes with the adjacent text boxes have the corresponding relation or not according to the text information, so that the text boxes with similar position distribution and no text corresponding relation, such as the female and the ethnic group, are removed, the text boxes with the corresponding relation of the characters and the position distribution feature are screened, and the text information with the corresponding relation is determined. In actual implementation, the steps S106 and S108 may not be performed in the order of before and after.
For example, in a normal case, the text information corresponding to the text information "woman" and "man" is "sex", and when it is determined that the text box where the text information "woman" is located and the text box where the text information "ethnic" is located have a correspondence relationship based on the positional relationship of the text boxes, further based on the text information "woman" and "ethnic", "woman" should correspond to the text information "sex" rather than "ethnic", it may be determined that "woman" and "ethnic" do not correspond.
Step S112, according to the text information with the corresponding relation, the identity card information corresponding to the identity card image is determined.
After the text 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, identification card number.
For example, according to the above step S110, it is determined that the "name" and the "Zhang Sano" in the identification card image have a correspondence relationship, the "sex" and the "woman" have a correspondence relationship, the "ethnic" and the "chinese" have a correspondence relationship, and the determined identification card information may be the name: zhang III, sex: female, ethnic group: chinese. The determined identification card information may be presented, specifically, the identification card information may be presented as "name-Zhang three gender-female ethnicity-han", or may be directly presented as "Zhang three-female-han", and the presentation form of the determined identification card information may be set according to the requirement, which is not limited herein.
The identification method of the identity card information provided by the invention can be used for firstly carrying out text line detection 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 text information corresponding to the text box, further determining the text information with the corresponding relation according to the position information and the text information of the text box, and determining the identity card information corresponding to the identity card image according to the text information with the corresponding relation. Compared with the prior art that the identification card information is extracted by directly identifying the characters on the identification card image mostly, and the problem that the false identification card information is extracted due to scattered characters on the identification card image, watermarks added or the inclination of the identification card image is solved, the embodiment of the invention can detect the text box on the identification card image firstly, then determine the corresponding character information according to the position information and the character information of the text box, avoid the false identification card information from being extracted, and effectively improve the identification accuracy of the identification card information.
In an optional implementation manner, the step S104, that is, the step of performing text line detection on the identity card image to obtain a plurality of text boxes, includes:
(1) And obtaining 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 corner vertex, a lower left corner vertex, an upper right corner vertex and a lower right corner vertex on the identity card image. When judging whether the identity card image is inclined or not according to the vertex coordinates, whether the left upper corner vertex and the left lower corner vertex of the identity card image are identical in abscissa and whether the left upper corner vertex and the right upper corner vertex are identical in ordinate or not can be judged, and if the left upper corner vertex and the right upper corner vertex are different in ordinate, the inclination of the identity card image is indicated.
(2) And (3) when the judgment result in the step (1) is yes, the identity card image is regulated.
The left upper corner vertex abscissa and the left lower corner vertex abscissa of the identity card image after alignment are the same, the left upper corner vertex ordinate and the right upper corner vertex ordinate are the same, and the distance between the left upper corner vertex and the right upper corner vertex is greater than the distance between the left upper corner vertex and the left lower corner vertex.
The alignment means are not limited and can be reasonably selected by a person skilled in the art.
(3) And detecting the text lines of the aligned identity card images to obtain a plurality of text boxes.
In another alternative embodiment, when implementing the step S104, the text line detection may be directly performed on the identification card image instead of the adjustment on the identification card image, and if the detected text box is skewed, the position adjustment may be directly performed on the text box.
Regardless of the implementation mode, text line detection can be performed on the identity card image through the CTPN network model, so that a plurality of text boxes are obtained.
Among these, the CTPN (Connectionist Text Proposal Network) network model, also called the connection text proposal network model, is a full convolution network, allowing for an input image of arbitrary size. It detects text lines by densely sliding small windows in the convolution feature map and outputs a series of fine-grained (e.g., 16 pixels wide) text suggestions, which in turn directly detect text lines 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 the accurate position and text/non-text score of each proposal can be predicted in a combined mode, so that the accurate positioning of the text is realized. The CTPN overcomes some main limitations brought by a bottom-up method based on character detection in the related art; for example, the use of sliding windows in the convolutional layer allows for shared convolutional computations, which is significantly reduced in terms of computation compared to the expensive sliding window-based approach of the related art. And through the design of the vertical anchor point and the fine granularity detection strategy, the text lines with various scales and length-width ratios can be processed by using the single-scale image, so that the calculation amount is further reduced, and meanwhile, the accurate position of the text line is predicted.
In an alternative embodiment, when obtaining the position information of the text box in the identity card image, the following steps 1 to 4 may be referred to achieve:
and step 1, obtaining vertex coordinates of a text box in the identity card image. Such as obtaining vertex coordinates of the text boxes, in one embodiment the same vertex coordinates of each text box may be obtained in unison, such as obtaining the top left corner vertex coordinates of the text box. In another embodiment, four vertex coordinates may be obtained for each of the top left corner, bottom left corner, top right corner, and bottom right corner of the text box.
And step 2, judging whether the text box is inclined or not according to the vertex coordinates of the text box.
In one embodiment, it may be determined whether each text box is tilted individually. Specifically, if four vertex coordinates of the text box are acquired, whether the text box is inclined or not may be determined based on the four vertex coordinates of each text box, respectively, such as if it is determined that the left upper corner vertex and the left lower corner vertex of the text box have the same abscissa and the left upper corner vertex has the same ordinate as the right upper corner vertex, it is determined that the text box is not inclined. Otherwise, if the text boxes are different, the text boxes are inclined.
In another embodiment, whether the text box is tilted 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 obtained, whether the text box is inclined or not can be judged according to the horizontally adjacent text boxes and/or the vertically adjacent text boxes. Specifically, for ease of understanding, referring to an oblique identification card schematic diagram shown in fig. 2, an oblique identification card image 200 and a plurality of oblique text boxes on the identification card image 200 are illustrated in fig. 2 (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, respectively). The shape of the text box is rectangle, and the top left corner vertex coordinates of each text box are selected 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 the transverse axis; the y-axis is the longitudinal axis; 0 represents the origin. The vertex ordinate of the first text box 202a differs from the vertex ordinate of the second text box 202b by 2by-2ay; the vertex abscissas of the first text box 202a and the third text box 204a differ by 4ax-2ax; the vertex ordinate of the third text box 204a differs from the vertex of the fourth text box 204b by 4by-4ay; the fourth text box 204b differs from the vertex abscissa of the second text box 202b by 4bx-2bx.
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, e.g., not zero, then the text box is proved skewed.
It should be noted that fig. 2 is only a schematic illustration, simply illustrating names and sexes, and does not illustrate information such as addresses, nationalities, birth dates, etc. in detail. Fig. 2 is a simplified schematic diagram of an identification card, which does not correspond to the layout on an actual identification card, and should not be considered as limiting.
And 3, when the text box is inclined, aligning the text box.
In an alternative embodiment, the position of each text box may be adjusted individually such that the adjusted text box has the same left-upper corner vertex abscissa as the left-lower corner vertex abscissa and the same left-upper corner vertex ordinate as the right-upper corner vertex ordinate. In a specific implementation, a reference text box (e.g., the first text box 202 a) may be aligned first, then, the vertical coordinates of the vertices of the text boxes laterally adjacent to the reference text box are adjusted to be the same as the vertical coordinates of the vertices of the reference text box, and the horizontally adjacent text box is aligned based on the adjusted vertices of the horizontally adjacent text box; and similarly, adjusting the vertex abscissa of the text box vertically adjacent to the reference text box to be the same as the vertex abscissa of the reference text box, and adjusting the vertically adjacent text box based on the adjusted vertex of the vertically adjacent text box. The positions of the text boxes on the identity card image can be adjusted through the mode. By setting the vertex coordinates of a certain text box as the reference point and adjusting the vertex coordinates of other text boxes, the efficiency of aligning the text boxes can be effectively improved.
Specifically, for ease of understanding, referring to fig. 3, an embodiment of the present invention provides an aligned schematic diagram of an id card. Taking the top left corner vertex coordinates of the text box as an example, and taking the top left corner vertex coordinates of the text box (such as the first text box 202 a) as a reference, aligning the text boxes, wherein the vertical coordinates of the vertex of the second text box 202b and the vertical coordinates of the vertex of the first text box 202a are adjusted to be consistent, and are both 2ay; the vertex abscissas of the third text box 204a and the first text box 202a are adjusted to be consistent, and are both 2ax; correspondingly, the vertical coordinates of the vertex of the fourth text box 204b and the vertical coordinates of the vertex of the third text box 204a are adjusted to be consistent, and are both 4ay; the vertex abscissas of the fourth text box 204b and the second text box 202b are adjusted to be consistent with each other and are all 2bx. And each text box also adjusts the position of the text box by taking the self-adjusted vertex coordinates as a reference, wherein the left upper-corner vertex abscissa of the adjusted text box is the same as the left lower-corner vertex abscissa, and the left upper-corner vertex ordinate is the same as the right upper-corner vertex ordinate.
And 4, acquiring the position information of the aligned text box.
Also, one or more vertex coordinates of each text box after alignment or coordinates of key points on the frame lines, etc. can be obtained.
After the text box is detected, the text box can be subjected to text recognition, and text information corresponding to the text box is obtained. The embodiment provides a specific text recognition mode: and carrying out text recognition on the text box through the CRNN network model to obtain text information corresponding to the text box.
The CRNN (Convolutional Recurrent Neural Network) network model, also called convolutional neural network, is an end-to-end character recognition network model. Can be used with CTPN network model, including convolution layer, circulation layer and transcription layer. At the bottom of the CRNN, the convolution layer automatically extracts feature sequences from each input image. Above 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 of prediction of the loop layer into a tag sequence. Although CRNN is made up of different types of network architectures (e.g., CNN and RNN), joint end-to-end training can be performed through a loss function. The text box is subjected to character recognition by adopting the CRNN network model, so that a character recognition result can be obtained more accurately and reliably.
Further, considering that interference texts except identity card information possibly exist on an identity card image to be identified, such as impurity information written in a blank, such as 'own identification is only used in XX occasion', or watermarks, and the positions of text boxes of the interference texts are different from legal positions of the text boxes of the identity card information, the embodiment of the invention can filter the interference texts by judging that the positions of the text boxes of the interference texts are illegal. Specifically, in an optional manner, before performing the step of performing text recognition on the text box, whether a text box with an illegal position exists or not may be judged according to the position information of the text box and the legal position of the preset identity card text box; if so, deleting the illegitimate text box. In another alternative mode, before determining the text information with the corresponding relation, identifying and filtering illegal text information on the identity card image according to the position information and the text information of the text box; the position of the text box where the illegal word information is located does not belong to the legal position of the preset identity card text box.
In addition, the embodiment of the invention also provides a second identification method of the identity card information, the method is realized on the basis of the method shown in fig. 1, the method further describes a specific process of determining the text information with the corresponding relation according to the position information and the text information of the text box, and referring to fig. 4, the method comprises the following steps:
Step S402, an identity card image of identity card information to be identified is obtained;
step S404, detecting text lines of the identity card image to obtain a plurality of text boxes;
step S406, obtaining the position information of a text box in the identity card image;
step S408, performing text recognition on the text box to obtain text information corresponding to the text box;
step S410, determining the text boxes of the same line according to the position information of the text boxes;
the characteristic information of the distribution position of the text boxes on the same line on the identity card can be used according to the actual application, such as the characteristic information of the ordinate of the corresponding coordinate point on the text boxes on the same line in a plane rectangular coordinate system where a plurality of text boxes are shared. For example, whether the identity card image is inclined or not, the distance between the ordinate coordinates of the corresponding coordinate points of the text boxes of the same row is within a preset threshold range. For example, if the identification card image is not tilted, the vertical coordinates of the top left corner vertices of the two text boxes in the same row should be the same, and if the identification card image is tilted, the vertical coordinates of the top left corner vertices of the two text boxes in the same row deviate, but are also within a certain range. Alternatively, the range of values of the ordinate of the longitudinal border of the text boxes of the same line may have a certain degree of overlap.
Step S412, determining the text boxes with corresponding relation in the text boxes of the same line according to the position information of the text boxes of the same line;
for example, the text boxes with smaller difference in the abscissa, that is, the text boxes with closer distance are determined as the text boxes with corresponding relation, can be analyzed by the abscissa of the text boxes of the same row in the plane rectangular coordinate system.
Step S414, according to the text box with the corresponding relation and the text information of the text box, determining the text information with the corresponding relation.
Checking whether the corresponding relation of the text box is correct according to the text box with the corresponding relation and the text information of the text box; and determining the text information of the text box with the correct corresponding relation as the text information with the corresponding relation. For example, the text box where "sex" is similar to the text box where "woman" is located, the text box where "ethnicity" is similar to the text box where "chinese" is located, and it is determined in step S412 that the text box has a correspondence relationship, and the text information verification determines that "sex" and "woman" are text information having a correspondence relationship, and the text information where "ethnicity" and "chinese" are text information having a correspondence relationship. Since the "woman" and the "ethnic group" in the identification card image are also adjacent, if the text box where the "woman" and the "ethnic group" are located is also determined to have the correspondence in step S412, it may be determined that the "woman" and the "ethnic group" do not have the correspondence through the verification of the text information in step S414.
Step S416, according to the text information with the corresponding relation, the identity card information corresponding to the identity card image is determined.
According to the identification method of the second identity card information provided by the embodiment of the invention, firstly, the text boxes of the same row are determined according to the position information of the text boxes, and then the text boxes with corresponding relations in the text boxes of the same row are determined according to the position information of the text boxes of the same row; and determining the text information with the corresponding relation according to the text box with the corresponding relation and the text information of the text box. The method provided by the embodiment of the invention is beneficial to improving the accuracy of identification card information identification by firstly determining the corresponding relation of the text box and then determining the text information with the corresponding relation by combining the text information of the text box.
When the position information of the text boxes in the identity card image is acquired and the text boxes of the same line and the text boxes with the corresponding relation of the same line are determined, the following two main implementation modes can be referred to:
mode one:
the obtained position information of the text box comprises a starting point coordinate of the text box, wherein the starting point coordinate comprises a starting abscissa and a starting ordinate; where the text box is mostly rectangular, the starting point may be the coordinates of any vertex of the text box, such as the coordinates of the top left corner vertex of the text box as the starting point coordinates.
The step S410 may be to determine the text boxes of the same line by the starting ordinate of the text boxes, and specifically includes the following steps: and determining the text boxes within the difference of the ordinate of the starting point and the ordinate of the starting point by a preset first threshold value as the text boxes of the same row.
Considering that the actually acquired identity card image is askew, a plurality of text boxes obtained by text line detection of the identity card image may be askew, so that the values of the ordinate of the text boxes in the same line on a plane rectangular coordinate system have deviation, a first threshold value can be preset, and when the difference value of the ordinate of the starting point 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, the step S412, that is, the step of determining the text boxes with the corresponding relationship in the text boxes of the same line according to the position information of the text boxes of the same line, includes: and determining the text boxes in the starting point abscissa differences among the text boxes in the same row within a preset second threshold as the text boxes with corresponding relations among the text boxes in the same row.
The distance between the text boxes with corresponding relation in the same row on the actual identity card is smaller than the distance between the text boxes without corresponding relation, namely the text boxes with corresponding relation in the same row are similar in position distribution, so that the distance between the text boxes is compared with a preset second threshold value by taking the difference value of the starting point abscissa in the text boxes in the same row as the distance between the text boxes, and the text boxes with corresponding relation in the same row are determined as the text boxes with corresponding relation in the text boxes in the same row. The preset second threshold may be set based on an empirical value, and is not limited herein.
Mode two:
the obtained position information of the text box comprises a vertical coordinate value range and a horizontal coordinate value range of the text box; the text box is mostly rectangular, and the ordinate value range and the abscissa value range of the text box can be determined according to coordinates of four vertexes of the text box.
The step S410 may be a determination of the text boxes in the same row through the ordinate value range of the text boxes, and specifically includes the following steps: two text boxes with at least a first overlapping length in the ordinate range are determined as the text boxes in the same row. For example, if the id card is not skewed, the ordinate range of the first text box (i.e. the ordinate range of the first text box mapped to the value range on the Y axis) and the ordinate range of the second text box in the same row should be the same (i.e. completely overlap), and if the id card is skewed, the text boxes in the same row are skewed correspondingly (see fig. 2 in particular), but the ordinate range of the first text box and the ordinate range of the second text box still overlap to some extent.
Considering that the actually acquired identity card image is askew, a plurality of text boxes obtained by text line detection on the identity card image may be askew, so that the ordinate value ranges of the text boxes in the same line on a plane rectangular coordinate system cannot be completely overlapped, but have certain deviation, a first overlapping length is preset, and when the overlapping area of the ordinate 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, the step S412, that is, the step of determining the text boxes with the corresponding relationship in the text boxes of the same line according to the position information of the text boxes of the same line, includes: determining the minimum value of the abscissa of the text boxes according to the value range of the abscissa of the text boxes in the same row; specifically, the minimum value of the abscissa of the text box is the upper left corner vertex abscissa or lower left corner vertex abscissa of the text box. And determining the text boxes in the difference of the minimum values of the abscissas in the text boxes in the same row within a preset third threshold as the text boxes with the corresponding relation in the text boxes in the same row.
The distance between the text boxes with corresponding relation in the same row on the actual identity card is smaller than the distance between the text boxes without corresponding relation, namely the text boxes with corresponding relation in the same row are similar in position distribution, so that the minimum value phase difference value of the horizontal coordinates of the text boxes in the same row is used as the distance between the text boxes, the distance is compared with a preset third threshold value, and the text boxes with corresponding relation in the text boxes in the same row are determined as the text boxes with corresponding relation in the text boxes in the same row. The preset third threshold may be set according to an empirical value, and is not limited herein.
The embodiment of the invention also provides a third identification method of the identity card information, which is realized on the basis of the method shown in fig. 1, and the method further describes a specific process of determining the identity card information corresponding to the identity card image according to the text information with the corresponding relation, and the method comprises the following steps of:
step S502, an identity card image of identity card information to be identified is obtained;
step S504, detecting text lines of the identity card image to obtain a plurality of text boxes;
step S506, obtaining the position information of a text box in the identity card image;
step S510, determining text information with corresponding relation according to the position information and the text information of the text box;
step S512, determining the information category of the text information with the corresponding relation based on the text information with the corresponding relation;
such as one or more of a name category, a gender category, a ethnicity category, a date of birth category, an address category, and an identification number category.
Step S514, determining key words in the text information with the corresponding relation and texts with the corresponding relation with the key words according to the information category;
Wherein the key words include one or more of name, gender, ethnicity, birth, year, month, day, address, and citizen identification card number.
Step S516, the characters with corresponding relation with the key words are determined as identity card information.
Specifically, the corresponding text such as the keyword "name" is "Zhang san"; the corresponding text of the key word "sex" is "male"; the corresponding text of the keyword 'ethnic group' is 'Chinese', and the text 'Zhang San-Man-Chinese' with the corresponding relation with the keyword is extracted and determined as the identity card information.
The identification method of the third identity card information provided by the embodiment of the invention comprises the steps of firstly determining the information category of the text information with the corresponding relation, and then determining the keyword in the text information with the corresponding relation and the text with the corresponding relation with the keyword according to the information category; and further determining the characters with the corresponding relation with the key words as identity card information. According to the method provided by the embodiment of the invention, the key words in the text information with the corresponding relation are determined according to the information category, and the text with the corresponding relation with the key words is determined as the identity card information, so that the effective identity card information can be extracted, and the accuracy of identity card information identification is improved.
Further considering that in practical application, the identity card image to be identified may be an illegal identity card image, the identification method of the third identity card information provided by the embodiment of the invention further includes: checking whether the identity card information is correct according to the information category; and when the checking result is negative, initiating an error reporting prompt. Various Error reporting modes exist, such as directly emptying the wrong identity card information, or filling in the wrong identity card information as a designated value "Error" or other values representing the Error, or marking the wrong identity card information directly by highlighting and other modes, and any form of Error reporting mode can be adopted, so that the method is not limited.
In specific implementation, according to the information category, whether the identity card information is correct or not can be checked by executing the following judgment conditions:
judging condition 1: and checking whether the information corresponding to the birth date category in the identity card information and the information corresponding to the neutral 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, the 11-12 bits and 13-14 bits of the identification card number respectively represent the birth year, month and day, whether the birth date in the identification card information is correct can be checked through the digits of the specified bit value on the identification card number, in addition, the odd number represents the male and the even number represents the female, and whether the sex in the identification card information is correct can be checked through the odd number and the even number of the specified bit value on the identification card number.
Judging condition 2: checking whether the information corresponding to the neutral category in the identity card information is one of preset gender words, wherein the preset gender words comprise men or women;
judging condition 3: checking whether information corresponding to the national category in the identity card information is one of preset national words, wherein the preset national words comprise legal national words such as Chinese, hui, manchurian, uighur and the like;
judging condition 4: checking whether information corresponding to the birth date type in the identity card information is one of preset numbers or not; wherein the preset number is a legal date number. Such as a legal date number of month of 1 to 12, a legal date number of individual days of 1 to 31, and the like.
In the specific implementation, one or more of the above judging conditions can be selected to check whether the identity card information is correct or not.
In addition, the identification method of the identity card information provided by the embodiment further comprises the following steps: 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.
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 card number has 18 digits in total, and the numbering rule of each digit from left to right is as follows: bits 1-2 represent a provincial administrative district code; bits 3-4 represent a ground level administrative division code; bits 5-6 represent county administrative differentiation codes; 7-10, 11-12 and 13-14 respectively represent year, month and day of birth; 15-17 bits represent sequential codes, which are numbers of the same year, month and sunrise students in the same area, wherein, the odd number is a male, and the even number is a female; the 18 digits are check codes, and the first 17 digits of the identification card number are multiplied by different coefficients 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 digits and the coefficient is added and divided by 11, and the obtained remainder is the check code, wherein the remainder is represented by 0-9 when the remainder is 0-9, and X (roman numeral 10) when the remainder is 10. In the specific implementation, whether the extracted identification card number is legal or not can be verified through the coding rule.
Corresponding to the identification method of the first identity card information, the embodiment of the invention provides an identification device of the first identity card information, which comprises the following steps:
The image to be identified acquisition module 602 is configured to acquire an identity card image of identity card information to be identified;
the text line detection module 604 is configured to perform text line detection on the identification card image to obtain a plurality of text boxes;
a location information obtaining module 606, configured to obtain location information of a text box in the identification card image;
the text recognition module 608 is configured to perform text recognition on the text box to obtain text information corresponding to the text box;
the correspondence determining module 610 is configured to determine text information with a correspondence according to the position information and the text information of the text box;
the identification card information determining module 612 is configured to determine identification card information corresponding to the identification card image according to the text information having the correspondence.
The invention provides a recognition device of first identity card information, which can firstly detect text lines of an identity card image of the identity card information to be recognized to obtain a plurality of text boxes; and then acquiring the position information of the text box in the identity card image and the text information corresponding to the text box, further determining the text information with the corresponding relation according to the position information and the text information of the text box, and determining the identity card information corresponding to the identity card image according to the text information with the corresponding relation. Compared with the prior art that the identification card information is extracted by directly identifying the characters on the identification card image mostly, and the problem that the false identification card information is extracted due to scattered characters on the identification card image, watermarks added or the inclination of the identification card image is solved, the embodiment of the invention can detect the text box on the identification card image firstly, then determine the corresponding character information according to the position information and the character information of the text box, avoid the false identification card information from being extracted, and effectively improve the identification accuracy of the identification card information.
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 judging result of the identity card inclination judging unit is yes;
the left upper corner vertex abscissa and the left lower corner vertex abscissa of the aligned identity card image are the same, the left upper corner vertex ordinate and the right upper corner vertex ordinate are the same, and the distance between the left upper corner vertex and the right upper corner vertex is greater than the distance between the left upper corner vertex and the left lower corner vertex;
the text line detection unit is used for detecting the text line of the aligned identity 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 a CTPN network model, so as to obtain a plurality of text boxes.
In one embodiment, the location information obtaining module includes: the coordinate acquisition unit acquires vertex coordinates of a 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 alignment unit is used for aligning the text box when the judging result of the text box inclination judging unit is yes; and the position information acquisition unit is used for acquiring the position information of the aligned text box.
In a specific embodiment, the text information determining module is further configured to: and carrying out text recognition on the text box through the CRNN network model to obtain text information corresponding to the text box.
Further, the identification method device of the first identity card information further comprises an illegal text box deleting module, wherein the illegal text box deleting module is used for judging whether a text box with illegal positions exists or not according to the position information of the text box and the legal positions of the preset identity card text boxes before the text box is subjected to character identification; when the text box with illegal position exists, deleting the text box with illegal position.
In addition, the identification method device of the first identity card information further comprises an illegal character information filtering module, wherein the illegal character information filtering module is used for identifying and filtering illegal character information on the identity card image according to the position information and the character information of the text box before determining the character information with the corresponding relation; the position of the text box where the illegal word information is located does not belong to the legal position of the preset identity card text box.
Corresponding to the above-mentioned second identification card information identification method, the embodiment of the present invention provides a second identification card information identification device, which further shows a specific structure of a correspondence determining module 610 on the basis of the device shown in fig. 6, referring to fig. 7, where the correspondence determining module 610 includes:
A peer text box determining unit 702, configured to determine a text box of a peer according to the location information of the text box;
and a corresponding text box determining unit 704, configured to determine text boxes with a corresponding relationship in the text boxes of the same row according to the position information of the text boxes of the same row.
The corresponding text information determining unit 706 is configured to determine text information with a corresponding relationship according to the text box with the corresponding relationship and text information of the text box.
According to the identification device of the second identity card information, firstly, the text boxes of the same line are determined according to the position information of the text boxes, and then the text boxes with the corresponding relation in the text boxes of the same line are determined according to the position information of the text boxes of the same line; and determining the text information with the corresponding relation according to the text box with the corresponding relation and the text information of the text box. According to the embodiment of the invention, the corresponding relation of the text box is determined firstly, and then the text information with the corresponding relation is determined by combining the text information of the text box, so that the accuracy of identification of the identity card information is improved.
In a specific embodiment, when 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 peer text box determining unit is further configured to determine the text box whose start point ordinate differs by a preset first threshold value as a peer text box. Based on this, the corresponding text box determining unit is further configured to determine text boxes within a preset second threshold from a difference of start point abscissas in the text boxes in the same row as text boxes with a corresponding relationship in the text boxes in the same row.
In another specific embodiment, when the position information of the text box includes an ordinate value range and an abscissa value range of the text box, the peer text box determining unit is further configured to determine two text boxes with at least a first overlapping length in the ordinate value range as the text boxes of the same peer; based on the above, the corresponding text box determining unit is further configured to determine an abscissa minimum value of the text boxes according to an abscissa value range of the text boxes in the same row; and determining the text boxes in the difference of the minimum values of the abscissas in the text boxes in the same row within a preset third threshold as the text boxes with the corresponding relation in the text boxes in the same row.
The corresponding text information determining unit is further used for checking whether the corresponding relation of the text box is correct according to the text box with the corresponding relation and the text information of the text box; and determining the text information of the text box with the correct corresponding relation as the text information with the corresponding relation.
Corresponding to the above-mentioned third identification method, the present invention provides a third identification device for identification card information, where the device further shows a specific structure of the identification card information determining module 612 on the basis of the device shown in fig. 6, referring to fig. 8, and the identification card information determining module 612 includes:
An information category determining unit 802 for determining 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 ethnicity category, a birth date category, an address category and an identification card number category;
a keyword and corresponding text determining unit 804, configured to determine, according to the information category, a keyword in text information with a corresponding relationship and text with a corresponding relationship with the keyword; wherein the key words comprise one or more of name, gender, ethnicity, birth, year, month, day, address and citizen ID card number;
the identification card information determining unit 806 is configured to determine, as identification card information, characters having a corresponding relationship with the keyword.
The identification device of the third identity card information provided by the embodiment of the invention firstly determines the information category of the text information with the corresponding relation, and then determines the keyword in the text information with the corresponding relation and the text with the corresponding relation with the keyword according to the information category; and further determining the characters with the corresponding relation with the key words as identity card information. According to the embodiment of the invention, the key words in the text information with the corresponding relation are determined according to the information category, and the text with the corresponding relation with the key words is determined as the identity card information, so that the effective identity card information can be extracted, and the accuracy of identity card information identification is improved.
Further, the identification device of the third identity card information further comprises an inspection module and an error reporting module; the checking module is used for checking whether the identity card information is correct according to the information category; and the error reporting module is used for initiating error reporting prompt when the judging 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 neutral category in the identification card information are correct by using the information corresponding to the identification card number category in the identification card information; and/or checking whether the information corresponding to the neutral category in the identity card information is one of the preset gender words, wherein the preset gender words comprise men or women; and/or checking whether the information corresponding to the national category in the identity card information is one of preset national words, wherein the preset national words comprise legal national words; and/or checking whether the information corresponding to the birth date category in the identity card information is one of preset numbers; wherein the preset number is a legal date number.
Further, the identification device of the third identity card information further comprises a legal judgment module, which is used for 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.
The device provided in this embodiment has the same implementation principle and technical effects as those of the foregoing embodiment, and for the sake of brevity, reference may be made to the corresponding content in the foregoing method embodiment where the device embodiment is not mentioned.
Further, the embodiment also provides a terminal device, which comprises a processor and a memory, wherein the memory is used for storing one or more computer instructions, and the one or more computer instructions are executed by the processor so as to realize the identification method of the identity card information.
Referring to a schematic structural diagram of a terminal device shown in fig. 9, a terminal device 900 is shown, including: processor 90, memory 91, bus 92 and communication interface 93, processor 90, communication interface 93 and memory 91 being connected by 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, random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the system network element and the at least one other network element is implemented via at least one communication interface 93 (which may be wired or wireless), and may use the internet, a wide area network, a local network, a metropolitan area network, etc.
Bus 92 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in fig. 9, but not only one bus or one type of bus.
The memory 91 is configured to store a program, and the processor 90 executes the program after receiving an execution instruction, and the method executed by the apparatus for flow defining 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 circuitry in hardware or instructions in software in processor 90. The processor 90 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but may also be a digital signal processor (Digital Signal Processing, DSP for short), application specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA for short), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks 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 embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as 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 in combination with its hardware performs the steps of the method described above.
Further, the embodiment of the invention also provides a computer readable storage medium, and a computer program is stored on the computer readable storage medium, and the computer program is executed by a processor to execute the steps of the identification method of any one of the identity card information. The specific implementation may refer to a method embodiment, which is not described herein.
The identification method, the identification device and the computer program product of the terminal device provided by the embodiment of the invention comprise a computer readable storage medium storing program codes, wherein the instructions included in the program codes can be used for executing the method described in the method embodiment, and specific implementation can be referred to the method embodiment and will not be repeated here.
In addition, in the description of embodiments of the present invention, unless explicitly stated and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill 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 this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform 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, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific 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 examples are only specific embodiments of the present invention, and are not intended to limit the scope of the present invention, but it should be understood by those skilled in the art that the present invention is not limited thereto, and that the present invention is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (17)

1. The identification method of the 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 text information with a corresponding relation according to the position information and the text information of the text box;
according to the text information with the corresponding relation, determining the identity card information corresponding to the identity card image;
the step of determining the text information with the corresponding relation according to the position information and the text information of the text box comprises the following steps:
determining the text boxes of the same line according to the position information of the text boxes;
determining text boxes with corresponding relations in the text boxes of the same line according to the position information of the text boxes of the same line;
and determining the text information with the corresponding relation according to the text box with the corresponding relation and the text information of the text box.
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 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 yes, the identity card image is regulated;
And detecting the text lines of the aligned identity card images 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 detecting the text lines of 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 location information of the text box in the identification card image comprises:
obtaining vertex coordinates of the text box in the identity card image;
judging whether the text box is inclined or not according to the vertex coordinates of the text box;
if yes, the text box is adjusted;
and acquiring the position information of the aligned text box.
5. The method of claim 1, wherein the step of performing text recognition on the text box to obtain text information corresponding to the text box comprises:
and carrying out character recognition on the text box through the CRNN network model to obtain character information corresponding to the text box.
6. The method of claim 1, wherein the location 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 text boxes of the same line according to the position information of the text boxes comprises the following steps:
determining the text boxes within a preset first threshold value of the difference of the ordinate of the starting point as the text boxes of the same row;
the step of determining the text boxes with the corresponding relation in the text boxes of the same line according to the position information of the text boxes of the same line comprises the following steps:
and determining the text boxes in the starting point abscissa differences among the text boxes in the same row within a preset second threshold as the text boxes with corresponding relations among the text boxes in the same row.
7. The method of claim 1, wherein the location information of the text box includes an ordinate range and an abscissa range of values of the text box;
the step of determining the text boxes of the same line according to the position information of the text boxes comprises the following steps:
determining two text boxes with at least a first overlapping length in the ordinate value range as the text boxes in the same row;
the step of determining the text boxes with the corresponding relation in the text boxes of the same line according to the position information of the text boxes of the same line comprises the following steps:
determining the minimum value of the abscissa of the text boxes according to the value range of the abscissa of the text boxes in the same row;
And determining the text boxes in the minimum difference of the abscissa values in the text boxes in the same row within a preset third threshold as the text boxes with corresponding relations in the text boxes in the same row.
8. The method according to claim 1, wherein the step of determining text information having a correspondence relationship from the text box having a correspondence relationship and text information of the text box includes:
checking whether the corresponding relation of the text box is correct or not according to the text box with the corresponding relation and the text information of the text box;
and determining the text information of the text box with the correct corresponding relation as the text information with the corresponding relation.
9. The method of claim 1, wherein the step of determining the identification card information corresponding to the identification card image according to the text information having the correspondence relationship comprises:
determining information category of the text information with the corresponding relation based on the text information with the corresponding relation; the information category comprises one or more of a name category, a gender category, a ethnicity category, a birth date category, an address category and an identification card number category;
According to the information category, determining key words in the text information with the corresponding relation and text with the corresponding relation with the key words; wherein the key words comprise one or more of name, gender, ethnicity, birth, year, month, day, address and citizen ID card number;
and determining the characters with the corresponding relation with the key words as identity card information.
10. The method according to claim 9, wherein the method further comprises:
checking whether the identity card information is correct according to the information category;
if not, initiating error reporting prompt.
11. The method of claim 10, wherein the step of checking whether the identification card information is correct based on the information category comprises:
checking whether information corresponding to the birth date category in the identity card information and information corresponding to the neutral 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 number of the groups of groups,
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 men or women;
And/or the number of the groups of groups,
checking whether the information corresponding to the national category in the identity card information is one of preset national words, wherein the preset national words comprise legal national words;
and/or the number of the groups of groups,
checking whether the information corresponding to the birth date category in the identity card information is one of preset numbers or not; wherein the preset number is a legal date number.
12. The method according to claim 10, wherein the method further comprises:
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.
13. The method of claim 1, wherein prior to the step of text recognition of the text box, the method further comprises:
judging whether a text box with illegal positions exists or not according to the position information of the text box and the legal positions of the preset identity card text boxes;
if yes, deleting the text box with illegal position.
14. The method of claim 1, wherein prior to the step of determining text information having a correspondence, the method further comprises:
identifying and filtering illegal character information on the identity card image according to the position information and the character information of the text box; the position of the text box where the illegal word information is located does not belong to the legal position of the preset identity card text box.
15. An identification device for identification card information, comprising:
the image acquisition module to be identified is used for acquiring an identity card image of the identity card information to be identified;
the text line detection module is used for detecting the text lines of 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 text recognition module is used for recognizing the text box to obtain text information corresponding to the text box;
the corresponding relation determining module is used for determining text information with a corresponding relation according to the position information and the text information of the text box;
the identity card information determining module is used for determining identity card information corresponding to the identity card image according to the text information with the corresponding relation;
the correspondence determining module includes:
the same-line text box determining unit is used for determining the text boxes of the same line according to the position information of the text boxes;
the corresponding text box determining unit is used for determining text boxes with corresponding relations in the text boxes of the same line according to the position information of the text boxes of the same line;
And the corresponding text information determining unit is used for determining text information with a corresponding relation according to the text box with the corresponding relation and the text information of the text box.
16. A terminal device, characterized in that it comprises a memory for storing a program supporting the processor to perform the method of any one of claims 1 to 14, and a processor configured to execute the program stored in the memory.
17. A computer storage medium storing computer software instructions for use with the method of any one of claims 1 to 14.
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 CN111144400A (en) 2020-05-12
CN111144400B true 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)

Families Citing this family (5)

* 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
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

Citations (11)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8995774B1 (en) * 2013-09-19 2015-03-31 IDChecker, Inc. Automated document recognition, identification, and data extraction

Patent Citations (11)

* 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
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

Also Published As

Publication number Publication date
CN111144400A (en) 2020-05-12

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
CN107862303B (en) Information identifying method, electronic device and the readable storage medium storing program for executing of form class diagram picture
CN110766014B (en) Bill information positioning method, system and computer readable storage medium
CN109685055B (en) Method and device for detecting text area in image
US11361570B2 (en) Receipt identification method, apparatus, device and storage medium
CN109658584B (en) Bill information identification method and device
CN110866495A (en) Bill image recognition method, bill image recognition device, bill image recognition equipment, training method and storage medium
CN110502985B (en) Form identification method and device and form identification equipment
WO2018233055A1 (en) Method and apparatus for entering policy information, computer device and storage medium
CN109255300B (en) Bill information extraction method, bill information extraction device, computer equipment and storage medium
WO2016112669A1 (en) Character information recognition method based on image processing
CN111950355A (en) Seal identification method and device and electronic equipment
CN111160395A (en) Image recognition method and device, electronic equipment and storage medium
CN111079480A (en) Identification method and device of identity card information and terminal equipment
CN113158895A (en) Bill identification method and device, electronic equipment and storage medium
CN112396047A (en) Training sample generation method and device, computer equipment and storage medium
CN112241739A (en) Method, device, equipment and computer readable medium for identifying text errors
JP4594952B2 (en) Character recognition device and character recognition method
CN113557520A (en) Character processing and character recognition method, storage medium and terminal device
CN110909816B (en) Picture identification method and device
CN111753812A (en) Text recognition method and equipment
CN111008635A (en) OCR-based multi-bill automatic identification method and system
CN114299509A (en) Method, device, equipment and medium for acquiring information
CN109409362A (en) The detection of picture sensitive word and localization method and device based on tesseract engine

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