Certificate identification method and device, electronic equipment and storage medium
By acquiring images of the human and non-human faces of the document, extracting and comparing text information, the problem of low accuracy in identifying abnormal documents was solved, and a higher accuracy in identifying abnormal documents was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
- Filing Date
- 2022-07-29
- Publication Date
- 2026-06-12
AI Technical Summary
In existing technologies, when two photos of the front and back of an ID are uploaded separately, it cannot be guaranteed that they are the same ID. Furthermore, there are cases where information on both sides of the ID is photoshopped, resulting in a low accuracy rate for identifying abnormal IDs.
By acquiring images of the human and non-human faces of the document, extracting text information and comparing them, it is determined whether the document is an abnormal document.
It improves the accuracy of identifying abnormal documents by comparing the information on the front and back of the document to identify abnormal documents with inconsistent information on the front and back.
Smart Images

Figure CN116311324B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, electronic device and storage medium for document recognition. Background Technology
[0002] In related technologies, with the development of mobile internet, more and more companies have launched their own mobile apps. Most of these apps involve the input and authentication of personal document information (i.e., authentication of the unique identifier of the document). Users can upload images of documents via their mobile phones and then extract text information from the document images. Since the front and back photos of the document are uploaded separately, it cannot be guaranteed that the two photos are of the same document. In addition, there may be cases where information on both sides of the document is photoshopped. Therefore, it is difficult to accurately identify abnormal documents. Summary of the Invention
[0003] This disclosure provides a method, apparatus, electronic device, and storage medium for document recognition, to at least solve the problem of low accuracy in recognizing abnormal documents in related technologies. The technical solution of this disclosure is as follows:
[0004] According to a first aspect of the present disclosure, a document recognition method is provided, comprising:
[0005] Obtain a first image to be identified and a second image to be identified corresponding to the document to be identified; the first image to be identified includes a human face image of the document to be identified, and the second image to be identified includes a non-human face image of the document to be identified.
[0006] Extract the document text information from the first image to be identified to obtain the first target text;
[0007] Extract the document text information from the second image to be identified to obtain the second target text;
[0008] The first target text is compared with the second target text to obtain the target text comparison result;
[0009] Based on the target text comparison results, determine whether the document to be identified is an abnormal document.
[0010] In one exemplary embodiment, comparing the first target text with the second target text to obtain a target text comparison result includes:
[0011] If the first target text and the second target text do not match, a text matching inconsistency result is obtained.
[0012] The step of determining whether the document to be identified is an abnormal document based on the target text comparison result includes:
[0013] Based on the inconsistency results of the text comparison, the document to be identified is determined to be an abnormal document.
[0014] In one exemplary embodiment, comparing the first target text with the second target text to obtain a target text comparison result includes:
[0015] The first target text is parsed to obtain a first information set; each piece of first information in the first information set is sorted according to its position in the first target text.
[0016] The second target text is parsed to obtain a second information set; each piece of second information in the second information set is sorted according to its position in the second target text.
[0017] The first information in the first information set is compared with the second information in the second information set to obtain the target text comparison result.
[0018] In one exemplary embodiment, the method further includes:
[0019] The step of comparing the first information in the first information set with the second information in the second information set to obtain the target text comparison result includes:
[0020] The first information in the first information set, which is ranked last, is taken as the first current information, and the second information in the second information set, which is ranked last, is taken as the second current information.
[0021] The first current information is compared with the second current information to obtain the current comparison result;
[0022] If the current comparison result is inconsistent, the target text is obtained as inconsistent.
[0023] In one exemplary implementation, comparing the first current information with the second current information to obtain the current comparison result includes:
[0024] The first current information is compared with the second current information to obtain the initial current comparison result;
[0025] If the initial current comparison result is a mismatch result, the target administrative level information corresponding to the target current information is obtained as the first comparison information; the target current information is either the first current information or the second current information; the target administrative level is higher than the administrative level corresponding to the target current information.
[0026] The information in the first current information and the second current information other than the target current information is used as the second comparison information;
[0027] The first information to be compared is compared with the second information to be compared to obtain the current comparison result.
[0028] In one exemplary embodiment, the method further includes:
[0029] If the current comparison result is a matching result, the first information in the first information set that is one position before the first current information is re-established as the first current information, and the second information in the second information set that is one position before the second current information is re-established as the second current information;
[0030] Jump to the step of comparing the first current information with the second current information to obtain the current comparison result.
[0031] In one exemplary embodiment, the method further includes:
[0032] If the first current information or the second current information is the information ranked first, and the current comparison result is a matching result, a matching result of the target text is obtained.
[0033] In one exemplary embodiment, extracting the document text information from the first image to be recognized to obtain the first target text includes:
[0034] Extract the document text information from the first image to be recognized to obtain the first text to be recognized;
[0035] Extract the address information from the first text to be identified to obtain the first target text;
[0036] The step of extracting the document text information from the second image to be identified to obtain the second target text includes:
[0037] Extract the document text information from the second image to be recognized to obtain the second text to be recognized;
[0038] Extract the document issuance location information from the second text to be identified to obtain the second target text.
[0039] In one exemplary embodiment, comparing the first target text with the second target text to obtain a target text comparison result includes:
[0040] If the first target text matches the second target text, a text matching result is obtained;
[0041] The step of determining whether the document to be identified is an abnormal document based on the target text comparison result includes:
[0042] Based on the text comparison results, the document to be identified is determined as the initial screening document.
[0043] In one exemplary embodiment, the method further includes:
[0044] Obtain the first target text format corresponding to the first text to be identified and the second target text format corresponding to the second text to be identified;
[0045] Determine the first matching result between the first text to be identified in the initially screened document and the first target text format;
[0046] Determine the second matching result between the second text to be identified in the initially screened document and the second target text format;
[0047] Based on the first matching result and the second matching result, determine whether the initially screened document is an abnormal document.
[0048] In one exemplary implementation, determining whether the initially screened document is an abnormal document based on the first matching result and the second matching result includes:
[0049] If at least one of the first matching result and the second matching result is an inconsistent match, the initially screened document will be identified as an abnormal document.
[0050] In one exemplary embodiment, the method further includes:
[0051] Determine the first text comparison results of the first text to be identified for each of at least two documents to be identified;
[0052] If there are a first number of text comparison results corresponding to the first number of documents to be identified that are consistent, the first image to be identified corresponding to the first number of documents to be identified is determined as the first candidate image.
[0053] Determine the second text comparison result of the second text to be identified corresponding to each of the at least two documents to be identified;
[0054] If there are a second number of text matching results for the second number of documents to be identified, the second images to be identified corresponding to the second number of documents to be identified are determined as the second candidate images.
[0055] In one exemplary embodiment, the method further includes:
[0056] The first number of first candidate images are processed to obtain a first processed image set; the first regions of each first processed image in the first processed image set are of the same size; the first regions of each first processed image are determined based on the target character in each first processed image.
[0057] Each first processed image in the first processed image set is moved to overlap with the first region of each first processed image to obtain a first overlapping image set;
[0058] The background and pixels of each first overlapping image in the first overlapping image set are compared;
[0059] If the background and pixels of each first overlapping image in the first overlapping image set are consistent, the document to be identified corresponding to the first candidate image is determined to be an abnormal document.
[0060] In one exemplary embodiment, the method further includes:
[0061] The second number of second candidate images are processed to obtain a second processed image set; the second region of each second processed image in the second processed image set has the same size; the second region of each second processed image is the region corresponding to the target object in each second processed image.
[0062] Each second processed image in the second processed image set is moved to overlap with the second region of each second processed image to obtain a second overlapping image set;
[0063] The background and pixels of each second overlapping image in the second overlapping image set are compared;
[0064] If the background and pixels of each second overlapping image in the second overlapping image set are consistent, the document to be identified corresponding to the second candidate image is determined to be an abnormal document.
[0065] In one exemplary embodiment, the method further includes:
[0066] Obtain the first attribute to be identified of the first text to be identified and the second attribute to be identified of the second text to be identified from the initially screened document;
[0067] Determine the first and second legal texts of the legal document; the first legal text corresponds to the first text to be identified, and the second legal text corresponds to the second text to be identified;
[0068] Obtain the first legal attribute of the first legal text and the second legal attribute of the second legal text;
[0069] Based on the comparison results of the first attribute and the comparison results of the second attribute, it is determined whether the initially screened document is an abnormal document; the first attribute comparison result is the comparison result of the first attribute to be identified and the first legal attribute, and the second attribute comparison result is the comparison result of the second attribute to be identified and the second legal attribute.
[0070] In one exemplary implementation, determining whether the initially screened document is an abnormal document based on the comparison results of the first attribute and the comparison results of the second attribute includes:
[0071] The first attribute to be identified is compared with the first legal attribute to obtain the first attribute comparison result;
[0072] The second attribute to be identified is compared with the second legal attribute to obtain the comparison result of the second attribute;
[0073] If at least one of the first attribute comparison results and the second attribute comparison results is inconsistent, the initially screened document is determined to be an abnormal document.
[0074] According to a second aspect of the present disclosure, an identification document recognition device is provided, comprising:
[0075] The image acquisition module is configured to acquire a first image to be identified and a second image to be identified corresponding to the document to be identified; the first image to be identified includes a human face image of the document to be identified, and the second image to be identified includes a non-human face image of the document to be identified.
[0076] The first target text extraction module is configured to extract document text information from the first image to be recognized to obtain the first target text.
[0077] The second target text extraction module is configured to extract document text information from the second image to be recognized to obtain the second target text.
[0078] The target text comparison result determination module is configured to compare the first target text with the second target text to obtain the target text comparison result;
[0079] The document recognition module is configured to determine whether the document to be recognized is an abnormal document based on the target text comparison result.
[0080] In one exemplary embodiment, the target text comparison result determination module includes:
[0081] The first result determination unit is configured to perform the operation of obtaining a text comparison inconsistency result if the first target text and the second target text do not match.
[0082] In one exemplary embodiment, the document recognition module includes:
[0083] The first abnormal document determination unit is configured to determine the document to be identified as an abnormal document based on the text comparison inconsistency result.
[0084] In one exemplary embodiment, the target text comparison result determination module includes:
[0085] The first information set determination unit is configured to parse the first target text to obtain a first information set; each piece of first information in the first information set is sorted according to its position in the first target text.
[0086] The second information set determination unit is configured to parse the second target text to obtain a second information set; the second information set is sorted according to the position of each second information in the second target text.
[0087] The target text comparison result determination unit is configured to perform a comparison between the first information in the first information set and the second information in the second information set to obtain the target text comparison result.
[0088] In one exemplary embodiment, the target text comparison result determination unit includes:
[0089] The current information determination subunit is configured to take the first information that is ranked last in the first information set as the first current information and the second information that is ranked last in the second information set as the second current information.
[0090] The current comparison result determination subunit is configured to compare the first current information with the second current information to obtain the current comparison result;
[0091] The comparison result determination subunit is configured to execute, if the current comparison result is an inconsistency result, to obtain the target text comparison inconsistency result.
[0092] In one exemplary implementation, the current alignment result determination subunit includes:
[0093] The initial current comparison result determination subunit is configured to compare the first current information with the second current information to obtain the initial current comparison result;
[0094] The first subunit for determining information to be compared is configured to, if the initial current comparison result is a mismatch result, obtain the information of the target administrative level corresponding to the target current information, as the first information to be compared; the target current information is either the first current information or the second current information; the target administrative level is higher than the administrative level corresponding to the target current information.
[0095] The second comparison information determination subunit is configured to use the information other than the target current information in the first current information and the second current information as the second comparison information;
[0096] The current result determination subunit is configured to perform a comparison between the first information to be compared and the second information to be compared, and obtain the current comparison result.
[0097] In one exemplary embodiment, the apparatus further includes:
[0098] The information redeter module is configured to perform the following actions if the current comparison result is a matching result: if the current comparison result is a matching result, the first information in the first information set that is located before the first current information is re-established as the first current information, and the second information in the second information set that is located before the second current information is re-established as the second current information.
[0099] The jump module is configured to execute the step of jumping to compare the first current information with the second current information to obtain the current comparison result.
[0100] In one exemplary embodiment, the apparatus further includes:
[0101] The matching result determination module is configured to execute if the first current information or the second current information is the first information in the sorting order, and the current matching result is a matching result, to obtain a matching result for the target text.
[0102] In one exemplary embodiment, the first target text extraction module includes:
[0103] The first text to be identified unit is configured to extract document text information from the first image to be identified to obtain the first text to be identified.
[0104] The first target text determination unit is configured to extract address information from the first text to be identified to obtain the first target text.
[0105] In one exemplary embodiment, the second target text extraction module includes:
[0106] The second text to be identified unit is configured to extract document text information from the second image to be identified to obtain the second text to be identified.
[0107] The second target text determination unit is configured to extract address information from the second text to be identified to obtain the second target text.
[0108] In one exemplary embodiment, the target text comparison result determination module includes:
[0109] The second result determination unit is configured to perform the operation of obtaining a text matching result if the first target text matches the second target text.
[0110] In one exemplary embodiment, the document recognition module includes:
[0111] The initial screening document determination unit is configured to determine the document to be identified as the initial screening document based on the text comparison consistency result.
[0112] In one exemplary embodiment, the apparatus further includes:
[0113] The target text format acquisition module is configured to acquire the first target text format corresponding to the first text to be recognized and the second target text format corresponding to the second text to be recognized.
[0114] The first matching result determination module is configured to determine the first matching result between the first text to be identified of the initially screened document and the first target text format.
[0115] The second matching result determination module is configured to determine the second matching result between the second text to be identified of the initially screened document and the second target text format.
[0116] The initial screening document result determination module is configured to determine whether the initial screening document is an abnormal document based on the first matching result and the second matching result.
[0117] In one exemplary embodiment, the initial screening document result determination module includes:
[0118] The second abnormal document determination unit is configured to determine the initially screened document as an abnormal document if at least one of the first matching result and the second matching result is an inconsistent matching result.
[0119] In one exemplary embodiment, the apparatus further includes:
[0120] The first text comparison result determination module is configured to determine the first text comparison result of the first text to be identified corresponding to at least two documents to be identified.
[0121] The first candidate image determination module is configured to determine the first image to be identified corresponding to the first number of documents to be identified as the first candidate image if the first text comparison result of the first number of documents to be identified is a matching result.
[0122] The second text comparison result determination module is configured to perform a second text comparison result to determine the second text to be identified corresponding to each of the at least two documents to be identified.
[0123] The second candidate image determination module is configured to determine the second image to be identified corresponding to the second number of documents to be identified as the second candidate image if the second text comparison result is consistent with the second number of documents to be identified.
[0124] In one exemplary embodiment, the apparatus further includes:
[0125] The first image set determination module is configured to perform image processing on the first number of first candidate images to obtain a first processed image set; the first regions of each first processed image in the first processed image set have the same size; the first regions of each first processed image are determined based on the target characters in each first processed image.
[0126] The first overlapping image set determination module is configured to move each first processed image in the first processed image set to overlap with the first region of each first processed image to obtain the first overlapping image set;
[0127] The first pixel comparison module is configured to perform a comparison of the background and pixels of each first overlapping image in the first overlapping image set.
[0128] The first abnormal document recognition module is configured to determine the document to be recognized corresponding to the first candidate image as an abnormal document if the background and pixels of each first overlapping image in the first overlapping image set are consistent.
[0129] In one exemplary embodiment, the apparatus further includes:
[0130] The second image set determination module is configured to perform image processing on the second number of second candidate images to obtain a second image set; the second regions of each second processed image in the second image set are of the same size; the second region of each second processed image is the region corresponding to the target object in each second processed image; the second overlapping image set determination module is configured to move each second processed image in the second image set to overlap with the second regions of each second processed image to obtain a second overlapping image set;
[0131] The second pixel comparison module is configured to perform a comparison of the background and pixels of each second overlapping image in the second overlapping image set.
[0132] The second abnormal document recognition module is configured to determine the document to be recognized corresponding to the second candidate image as an abnormal document if the background and pixels of each second overlapping image in the second overlapping image set are consistent.
[0133] In one exemplary embodiment, the apparatus further includes:
[0134] The module for obtaining the attribute to be identified is configured to obtain the first attribute to be identified of the first text to be identified and the second attribute to be identified of the second text to be identified of the initial screening document.
[0135] The legitimate text determination module is configured to determine a first legitimate text and a second legitimate text of a legitimate document; the first legitimate text corresponds to the first text to be identified, and the second legitimate text corresponds to the second text to be identified;
[0136] The legal attribute acquisition module is configured to acquire the first legal attribute of the first legal text and the second legal attribute of the second legal text.
[0137] The initial screening document recognition module is configured to determine whether the initially screened document is an abnormal document based on the first attribute comparison result and the second attribute comparison result; the first attribute comparison result is the comparison result between the first attribute to be identified and the first legal attribute, and the second attribute comparison result is the comparison result between the second attribute to be identified and the second legal attribute.
[0138] In one exemplary embodiment, the initial screening document recognition module includes:
[0139] The first attribute comparison result determination unit is configured to perform a comparison between the first attribute to be identified and the first legal attribute to obtain the first attribute comparison result;
[0140] The second attribute comparison result determination unit is configured to compare the second attribute to be identified with the second legal attribute to obtain the second attribute comparison result;
[0141] The third abnormal document identification unit is configured to determine the initially screened document as an abnormal document if at least one of the first attribute comparison result and the second attribute comparison result is inconsistent.
[0142] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0143] processor;
[0144] Memory used to store the processor's executable instructions;
[0145] The processor is configured to execute the instructions to implement the document recognition method described above.
[0146] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein when instructions in the computer-readable storage medium are executed by an electronic device processor, the electronic device is enabled to perform the document recognition method as described above.
[0147] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the document recognition method as described above.
[0148] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects:
[0149] This disclosure obtains a first image and a second image corresponding to a document to be identified; the first image includes a portrait image of the document, and the second image includes a non-portrait image of the document; document text information is extracted from the first image to obtain a first target text; document text information is extracted from the second image to obtain a second target text; the first target text and the second target text are compared to obtain a target text comparison result; based on the target text comparison result, it is determined whether the document to be identified is an abnormal document. This disclosure, by comparing the first target text in the portrait image of the document with the second target text in the non-portrait image, can identify abnormal documents with inconsistent information on the front and back, thereby improving the accuracy of abnormal document identification.
[0150] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0151] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0152] Figure 1 This is an application environment diagram illustrating a document recognition method according to an exemplary embodiment.
[0153] Figure 2 This is a flowchart illustrating a document recognition method according to an exemplary embodiment.
[0154] Figure 3 This is a flowchart illustrating a method for determining a first candidate image and a second candidate image according to an exemplary embodiment.
[0155] Figure 4 This is a flowchart illustrating a method for determining abnormal documents based on a first candidate image, according to an exemplary embodiment.
[0156] Figure 5 This is a flowchart illustrating a method for determining abnormal documents based on a second candidate image, according to an exemplary embodiment.
[0157] Figure 6 This is a flowchart illustrating a method for determining whether a pre-screened document is an abnormal document based on a first matching result and a second matching result, according to an exemplary embodiment.
[0158] Figure 7 This is a flowchart illustrating a method for determining whether a pre-screened document is an abnormal document based on a first attribute comparison result and a second attribute comparison result, according to an exemplary embodiment.
[0159] Figure 8 This is a flowchart illustrating a method for determining abnormal documents based on image processing of two first candidate images, according to an exemplary embodiment.
[0160] Figure 9 This is a flowchart illustrating a method for determining abnormal documents based on image processing of two second candidate images, according to an exemplary embodiment.
[0161] Figure 10 This is a schematic diagram illustrating a method for comparing information from two administrative regions at the same level, according to an exemplary embodiment.
[0162] Figure 11 This is a schematic diagram illustrating a method for comparing information from two administrative regions at different levels, according to an exemplary embodiment.
[0163] Figure 12This is a block diagram illustrating an identification document recognition device according to an exemplary embodiment.
[0164] Figure 13 This is a block diagram illustrating an electronic device for document recognition according to an exemplary embodiment. Detailed Implementation
[0165] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0166] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0167] During the document recognition process, the two photos are uploaded separately, so there is no effective way to ensure that the two document photos are of the same document. It is possible that the two photos are taken from two different documents, or that the key feature image of the document is repeatedly used from other people's document photos (because this photo does not have much effective verification information). In addition, the key feature image includes the document's validity period information. If the system recognizes this information, it may make incorrect business judgments on the document's validity period, leading to compliance and risk issues.
[0168] The documents contain information on both sides, with limited verifiable information on each side. Most of the information can be altered, and both sides show signs of being photoshopped. The modifications are significant. These abnormal documents pose a substantial risk to both companies and individuals.
[0169] To improve the accuracy of identifying abnormal documents, this disclosure provides a document identification method, apparatus, electronic device, and storage medium.
[0170] Please see Figure 1 The diagram illustrates an application environment for a document recognition method according to an exemplary embodiment. The application environment may include a server 01 and a client 02.
[0171] Specifically, in the embodiments of this specification, server 01 may include a standalone server, a distributed server, or a server cluster composed of multiple servers. It may also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 01 may include a network communication unit, a processor, and a memory, etc. Specifically, the server 01 can be used to acquire a first image to be identified and a second image to be identified corresponding to the document to be identified; the first image to be identified includes a portrait image of the document to be identified, and the second image to be identified includes a non-portrait image of the document to be identified; extract the document text information from the first image to be identified to obtain a first target text; extract the document text information from the second image to be identified to obtain a second target text; compare the first target text with the second target text to obtain a target text comparison result; determine whether the document to be identified is an abnormal document based on the target text comparison result, and send the determination of whether the document to be identified is an abnormal document to the client 02.
[0172] Specifically, in this embodiment of the specification, the client 02 may include physical devices such as smartphones, desktop computers, tablets, laptops, digital assistants, smart wearable devices, and in-vehicle terminals, and may also include software running on the physical device, such as web pages provided to users by service providers, or applications provided to users by such service providers. Specifically, the client 02 can be used to query online whether the document to be identified is an abnormal document.
[0173] Figure 2 This is a flowchart illustrating a document recognition method according to an exemplary embodiment, such as... Figure 2 As shown, this method can be applied to Figure 1 The server 01 shown includes the following steps.
[0174] In step S21, a first image to be identified and a second image to be identified corresponding to the document to be identified are obtained; the first image to be identified includes a human face image of the document to be identified, and the second image to be identified includes a non-human face image of the document to be identified.
[0175] In this embodiment of the disclosure, obtaining the first image to be identified and the second image to be identified corresponding to the document to be identified includes:
[0176] The system receives a document recognition request sent by the client, the document recognition request carrying a first image to be recognized and a second image to be recognized corresponding to the document to be recognized.
[0177] Specifically, in some embodiments, the method further includes:
[0178] The client displays authentication prompts on the authentication page of the target application, and the authentication prompts are used to obtain document information;
[0179] In response to an operation command triggered based on the authentication prompt information, the first image to be identified and the second image to be identified are acquired.
[0180] In this embodiment of the disclosure, the user can select the first image to be identified and the second image to be identified from the client's gallery or album and upload them.
[0181] In this embodiment, the first image to be identified includes a complete portrait image of the document to be identified, and the second image to be identified includes a complete non-portrait image of the document to be identified. The document to be identified may include, but is not limited to, social security cards, driver's licenses, or other documents that can represent user identity information. The portrait image of the document to be identified may include information such as name, portrait, document number, gender, date of birth, registered residence, and address. The non-portrait image of the document to be identified may include key feature maps, document validity period, and issuing authority. The first and second images to be identified may include partial images of the subject being photographed, and may also include the background at the time of photographing.
[0182] In step S23, the document text information in the first image to be identified is extracted to obtain the first target text.
[0183] In this embodiment of the disclosure, the first target text may be address information.
[0184] In this embodiment of the disclosure, the step of extracting the document text information from the first image to be identified to obtain the first target text includes:
[0185] Extract the document text information from the first image to be recognized to obtain the first text to be recognized;
[0186] In this embodiment, text information in an image can be extracted using OCR technology. OCR (Optical Character Recognition) refers to the process by which electronic devices (such as scanners or digital cameras) examine characters printed on paper, determine their shapes by detecting dark and light patterns, and then translate the shapes into computer text using character recognition methods. It is mainly used to convert printed text in paper documents into a text format that computers can process, for further editing and processing by word processing software.
[0187] In this embodiment of the disclosure, the identification document to be identified includes fixed common text. When multiple identification documents exist, the common text in each document is the same. The common text can be one or more characters from the identification document. Document text information can be selectively extracted from the first image to be identified, and the first text to be identified does not include the common text of the document in the first image to be identified.
[0188] The address information is extracted from the first text to be identified to obtain the first target text.
[0189] In this embodiment of the disclosure, based on the first image to be identified, the document text information in the image can be extracted first to be identified to obtain the first text to be identified that does not include public text; then, the address information can be extracted from the first text to be identified to obtain the first target text, thereby quickly extracting the address information of the user corresponding to the document to be identified.
[0190] In some embodiments, the method further includes:
[0191] Parse the first text to be identified to obtain the first identification information and the second identification information of the document to be identified;
[0192] In this embodiment of the disclosure, the first identification information of the document to be identified can be the user's name, and the second identification information can be the document number; and the name and the document number have a corresponding relationship, one name can correspond to a fixed number of document numbers, and a group of document numbers corresponds to a unique name.
[0193] The first identification information and the second identification information are compared;
[0194] In this embodiment of the disclosure, the first identification information and the second identification information can be compared using the database of the XX system to obtain the comparison result.
[0195] Based on the comparison results of the first identification information and the second identification information, it is determined whether the document to be identified is an abnormal document.
[0196] In this embodiment of the disclosure, determining whether the document to be identified is an abnormal document based on the comparison result of the first identification information and the second identification information includes:
[0197] If the first identification information does not match the second identification information, the document to be identified is determined to be a preliminary screening document.
[0198] In this embodiment of the disclosure, when the first identification information and the second identification information do not match, the document to be identified can be determined as a preliminary screening document, thereby allowing for further judgment and avoiding misjudgment of documents with changed names; when the first identification information and the second identification information match, the document to be identified can be further verified, improving the accuracy of identifying abnormal documents.
[0199] In this embodiment of the disclosure, when the target text comparison result shows that the document to be identified is not an abnormal document, the document can be further identified by the first identification information and the second identification information, thereby improving the identification accuracy of abnormal documents.
[0200] In step S25, the document text information in the second image to be identified is extracted to obtain the second target text.
[0201] In this embodiment of the disclosure, the second target text can be information about the place of issuance of the document, such as the issuing authority of the document.
[0202] In this embodiment of the disclosure, the step of extracting the document text information from the second image to be identified to obtain the second target text includes:
[0203] Extract the document text information from the second image to be recognized to obtain the second text to be recognized;
[0204] In this embodiment, the second text to be identified does not include the common text of the document in the second image to be identified; the document to be identified includes fixed common text, and when there are multiple documents to be identified, the common text in each document is the same; for example, in the non-human image of the document, the common text of the document in the second image to be identified may include "issuing authority," "validity period," etc.; document text information in the second image to be identified can be selectively extracted, and the second text to be identified does not include the common text of the document in the second image to be identified. For example, based on the bold part of the document photo, that is, the content part, the non-common text, the font, font size or font size ratio, height, width, spacing, and the size and positional relationship between the bold and blue text are identified to determine whether the text part has been tampered with. For normal document photos, the above options all fall within the normal range.
[0205] Extract the document issuance location information from the second text to be identified to obtain the second target text.
[0206] In this embodiment of the disclosure, based on the second image to be identified, the document text information in the image can be extracted first to obtain the second text to be identified that does not include public text; then, the document issuance location information can be extracted from the second text to be identified to obtain the second target text, thereby quickly extracting the document issuance location information corresponding to the document to be identified.
[0207] In this embodiment of the disclosure, such as Figure 3 As shown, the method further includes:
[0208] S301: Determine the first text comparison result of the first text to be identified for each of the at least two documents to be identified;
[0209] In this embodiment of the disclosure, determining the first text comparison result corresponding to the first text to be identified for each of the at least two documents to be identified may include:
[0210] The first identification information and the second identification information are deleted from the first text to be identified corresponding to each of the at least two documents to be identified, so as to obtain the text to be compared corresponding to each of the at least two documents to be identified.
[0211] Determine the first text comparison result of the text to be compared corresponding to each of the at least two documents to be identified.
[0212] In this embodiment of the disclosure, the first identification information (name) and the second identification information (document number) can be deleted from the first text to be identified to obtain a text to be compared that does not include the name and document number, thereby improving the accuracy of the first text comparison result.
[0213] S303: If there are first text comparison results corresponding to a first number of documents to be identified that are consistent with the comparison results, the first image to be identified corresponding to the first number of documents to be identified shall be determined as the first candidate image.
[0214] In this embodiment, the first quantity is greater than a first threshold, which can be set according to actual conditions. The first text comparison result can be determined by calculating the similarity between the first texts corresponding to at least two documents to be identified. When the similarity between a first quantity of first texts to be identified is greater than the first similarity threshold, the first text comparison result can be determined to be a matching result. The first similarity threshold can be set according to actual conditions. In a set of documents to be identified, if there are a first quantity of duplicate first texts to be identified, then the first images to be identified corresponding to the first quantity of documents to be identified are determined as first candidate images. In practical applications, the information in the facial images of documents to be identified by users in the same community or village, except for the name and document number, can be the same. Therefore, by comparing this information, these documents to be identified cannot be determined as abnormal documents and further identification is required.
[0215] S305: Determine the second text comparison result of the second text to be identified corresponding to each of the at least two documents to be identified;
[0216] S307: If there are second text comparison results corresponding to a second number of documents to be identified that are consistent with the comparison results, the second images to be identified corresponding to the second number of documents to be identified shall be determined as the second candidate images.
[0217] In this embodiment, the second quantity is greater than the second threshold; the second threshold can be set according to actual conditions; the second text comparison result can be determined by calculating the similarity between the second texts corresponding to at least two documents to be identified; when the similarity between the second quantity of second texts to be identified is greater than the second similarity threshold, the second text comparison result can be determined as a matching result; the second similarity threshold can be set according to actual conditions, and the second similarity threshold and the first similarity threshold can be the same or different. In a set of documents to be identified, if there are a second quantity of duplicate second texts to be identified, then the second images to be identified corresponding to the second quantity of documents to be identified are determined as second candidate images; the second quantity and the first quantity can be the same or different; in practical applications, the visa authority and validity period information of the documents to be identified by users in the same community or village can be the same or similar, so by comparing this information, these documents to be identified cannot be determined as abnormal documents, and further identification is required.
[0218] In this embodiment of the disclosure, suspicious first candidate images can be filtered out by comparing the first text corresponding to each of the multiple documents to be identified; suspicious second candidate images can be filtered out by comparing the second text corresponding to each of the multiple documents to be identified; the screening range of abnormal documents is narrowed by the first candidate images and the second candidate images, thereby realizing the rapid screening of abnormal documents from a large number of documents to be identified, and thus improving the identification efficiency of abnormal documents.
[0219] In this embodiment of the disclosure, such as Figure 4 As shown, the method further includes:
[0220] S401: The first number of first candidate images are processed to obtain a first processed image set; the first regions of each first processed image in the first processed image set have the same size; the first regions of each first processed image are determined based on the target character in each first processed image.
[0221] In this embodiment, the target characters can be determined according to actual conditions. For example, the three characters "surname" in "name", "day" in "date", and "public" in "citizen" can be identified as target characters. The triangular area formed by connecting the three target characters is identified as the first area. In this embodiment, the first area can also be an area of other shapes determined by other characters. Image processing can be performed on all first candidate images, or only on a portion of them, as long as the size of each document image in the first processed image set is the same. For example, the image with the smallest document image size among the first candidate images can be obtained as the first reference image, and the other first candidate images can be processed so that the document image in the processed image has the same size as the first area in the first reference image.
[0222] In this embodiment of the disclosure, image processing of a first number of first candidate images may include at least one of operations such as zooming in, zooming out, rotating, and flipping; rotation and flipping operations can be used to make the borders of each image in the first processed image set lie in the same direction, thereby facilitating subsequent movement operations. During rotation and flipping operations, a first region in the first candidate image can be fixed for rotation and flipping.
[0223] S403: Move each first processed image in the first processed image set to overlap with the first region of each first processed image to obtain a first overlapping image set; the first region of each first processed image is determined based on the target character in each first processed image.
[0224] In this embodiment of the disclosure, each of the first processed images in the first processed image set can be moved to overlap with the first region in each of the first processed images.
[0225] S405: Compare the background and pixels of each first overlapping image in the first overlapping image set;
[0226] In this embodiment of the disclosure, the background may include the boundary background of the document (e.g., the photographer's hand) and the shooting background; the background and pixels of each first overlapping image at the same coordinate point can be obtained through a coordinate system, and then compared separately; thereby, abnormal documents can be determined based on the comparison results.
[0227] S407: If the background and pixels of each first overlapping image in the first overlapping image set are consistent, the document to be identified corresponding to the first candidate image is determined to be an abnormal document. The abnormal document may be a document that has been used repeatedly.
[0228] In this embodiment of the disclosure, if the background and / or a preset number of pixels of each of the first overlapping images in the first overlapping image set are inconsistent, wherein the preset number can be set according to the actual situation, for example, the preset number can be set to 80%, 90%, etc. of all pixels in the image; at this time, the identification document corresponding to the first candidate image can be further identified through subsequent steps.
[0229] In this embodiment of the disclosure, abnormal documents can be quickly screened out based on the comparison results of the background and pixels of a first number of processed first candidate images.
[0230] In a specific embodiment, such as Figure 8 As shown, Figure 8 This is a flowchart of a method for identifying abnormal identification documents based on image processing of two first candidate images; the two first candidate images are portrait images of the identification document, and the method includes:
[0231] (1) Connect the three characters “surname”, “day” and “public” in each first candidate image to construct a triangular region. Use each triangular region as a calibration point to rotate and flip the two first candidate images corresponding to Li Si and Zhang San respectively, so that the corresponding borders of the document images in the two processed images are in the same direction.
[0232] (2) Scale the two processed images separately to make the triangular regions in the scaled images the same size;
[0233] (3) Translate the two scaled images until they overlap in the triangular region of the two scaled images;
[0234] In this embodiment of the disclosure, during image translation, the triangular region in the scaled image can be used as the origin of the coordinate system.
[0235] (4) Determine the authenticity of the document to be identified based on the comparison results of the background and pixels of the same coordinate point in two overlapping images.
[0236] In this embodiment of the disclosure, the method further includes:
[0237] If the background and pixels of each first overlapping image in the first overlapping image set are consistent, the first candidate image is determined as the first blacklist corresponding to the first image to be identified.
[0238] In this embodiment of the disclosure, after constructing the first blacklist, the first candidate image corresponding to the newly determined document to be identified can be compared with the first blacklist, so that the repeatedly used document can be quickly identified based on the first blacklist.
[0239] In this embodiment of the disclosure, such as Figure 5As shown, the method further includes:
[0240] S501: The second number of second candidate images are processed to obtain a second processed image set; the second region of each second processed image in the second processed image set has the same size; the second region of each second processed image is the region corresponding to the target object in each second processed image.
[0241] In this embodiment of the disclosure, when the document to be identified is an ID card, the target object can be the key feature map of the non-human face of the document; the key feature map is used as a calibration point to process each second processing image; when the document to be identified is another document, the target object can be set as an object in the other document; or the second region can be determined by the characters in the other document; at this time, the second processing image can be processed by the second region determined by other objects or characters in the other document.
[0242] In this embodiment of the disclosure, image processing can be performed on all second candidate images, or only on a portion of them, as long as the size of each document image in the second processed image set is the same; for example, the image with the smallest document image size among the second candidate images can be obtained as the second reference image, and the other second candidate images can be processed so that the document image in the processed image has the same size as the document image in the second reference image.
[0243] In this embodiment of the disclosure, image processing of the second number of second candidate images may include at least one of operations such as zooming in, zooming out, rotating, and flipping; rotation and flipping operations can be used to make the borders of each image in the second processed image set lie in the same direction, thereby facilitating subsequent movement operations. During rotation and flipping operations, the second region in the second candidate image can be fixed for rotation and flipping.
[0244] S503: Move each of the second processed images in the second processed image set to overlap with the second region of each of the second processed images to obtain a second overlapping image set;
[0245] S505: Compare the background and pixels of each second overlapping image in the second overlapping image set;
[0246] In this embodiment of the disclosure, the background may include the boundary background of the document (e.g., the photographer's hand) and the shooting background; the background and pixels of each second overlapping image at the same coordinate point can be obtained through a coordinate system and then compared separately; thereby determining the abnormal document based on the comparison result.
[0247] S507: If the background and pixels of each second overlapping image in the second overlapping image set are consistent, the document to be identified corresponding to the second candidate image is determined to be an abnormal document.
[0248] In this embodiment of the disclosure, if the background and pixels of each second overlapping image in the second overlapping image set are inconsistent, the identification of the document to be identified corresponding to the second candidate image can be further performed through subsequent steps.
[0249] In this embodiment of the disclosure, abnormal documents can be quickly screened out based on the comparison results of the background and pixels of the second number of processed second candidate images.
[0250] In a specific embodiment, such as Figure 9 As shown, Figure 9 This is a flowchart of a method for determining abnormal identification documents based on image processing of two second candidate images; the two second candidate images are non-human face images of the identification document, and the method includes:
[0251] (1) Using the region corresponding to the key feature map in each second candidate image as the calibration point, rotate and flip the two second candidate images corresponding to Li Si and Zhang San respectively, so that the corresponding borders of the document images in the two processed images are in the same direction;
[0252] (2) Scale the two processed images separately to make the scaled document images the same size;
[0253] (3) Translate the two scaled images until they overlap in the key feature map regions of the two scaled images;
[0254] In this embodiment of the disclosure, during the image translation process, the key feature map region in the scaled image can be used as the origin of the coordinate system.
[0255] (4) Determine the authenticity of the document to be identified based on the comparison results of the background and pixels of the same coordinate point in two overlapping images.
[0256] In this embodiment of the disclosure, the method further includes:
[0257] If the background and pixels of each second overlapping image in the second overlapping image set are consistent, the second candidate image is determined as the second blacklist corresponding to the second image to be identified.
[0258] In this embodiment of the disclosure, after constructing the second blacklist, the second candidate image corresponding to the newly determined document to be identified can be compared with the second blacklist, thereby quickly identifying the abnormal document based on the second blacklist.
[0259] In step S27, the first target text is compared with the second target text to obtain the target text comparison result.
[0260] In this embodiment of the disclosure, comparing the first target text with the second target text to obtain the target text comparison result includes:
[0261] The first target text is parsed to obtain a first information set; each piece of first information in the first information set is sorted according to its position in the first target text.
[0262] In this embodiment of the disclosure, multiple pieces of first information can be obtained by parsing the first target text, forming a first information set; for example, if the address of the person's face on the document to be identified is: XX Province, aa City, bb District, xxxxxxx; then, the first target text is: XX, aa, bb; the first information set includes the first information corresponding to the province, city, and district: XX, aa, bb. The first information in the first information set is ordered sequentially according to its position.
[0263] The second target text is parsed to obtain a second information set; each piece of second information in the second information set is sorted according to its position in the second target text.
[0264] In this embodiment of the disclosure, multiple pieces of second information can be obtained by parsing the second target text, forming a second information set; for example, if the issuing authority of the non-human face side of the document to be identified is: AA City XXXX Bureau; then the second target text is: AA, BB; the second information set includes the second information corresponding to the city and district: AA, BB. The second information in the second information set is ordered sequentially according to its position.
[0265] In this embodiment of the disclosure, the method further includes:
[0266] The first information in the first information set is compared with the second information in the second information set to obtain the target text comparison result.
[0267] In this embodiment of the disclosure, the matching degree of the front and back information of the document to be identified can be quickly determined by comparing the information of the same type on the front and back, thereby quickly identifying abnormal documents with mismatched front and back information.
[0268] In this embodiment of the disclosure, during the information comparison process, information is obtained sequentially from the last information in the two information sets for comparison, starting from the last information in the sorting.
[0269] In this embodiment of the disclosure, comparing the first information in the first information set with the second information in the second information set to obtain the target text comparison result includes:
[0270] The first information in the first information set, which is ranked last, is taken as the first current information, and the second information in the second information set, which is ranked last, is taken as the second current information.
[0271] In this embodiment of the disclosure, the first piece of information that is ranked last in the first information set is the information with the lowest administrative level in the first information set, and the second piece of information that is ranked last in the second information set is the information with the lowest administrative level in the second information set.
[0272] The first current information is compared with the second current information to obtain the current comparison result;
[0273] If the current comparison result is inconsistent, the target text is obtained as inconsistent.
[0274] In this embodiment of the disclosure, if the first current information and the second current information are inconsistent, and the first current information and the second current information correspond to the same administrative level, it is determined that the target text comparison is inconsistent, indicating that the two sides of the document to be identified are inconsistent, thereby determining that the document to be identified is an abnormal document, which improves the recognition accuracy of abnormal documents.
[0275] In this embodiment of the disclosure, comparing the first current information with the second current information to obtain the current comparison result includes:
[0276] The first current information is compared with the second current information to obtain the initial current comparison result;
[0277] If the initial current comparison result is a mismatch result, the target administrative level information corresponding to the target current information is obtained as the first comparison information; the target current information is either the first current information or the second current information; the target administrative level is higher than the administrative level corresponding to the target current information.
[0278] In this embodiment of the disclosure, if the initial current comparison result is inconsistent, it indicates that the first current information and the second current information may be information of different administrative levels. In this case, the target administrative level information corresponding to either of the two information can be obtained and subsequent comparisons can be performed. Since the administrative level of the first current information and the second current information cannot be determined, the target administrative level information of the first current information can be obtained first and compared with the second current information. If the comparison is inconsistent, the target administrative level information of the second current information can be obtained and compared with the first current information to determine the initial current comparison result.
[0279] In this embodiment of the disclosure, the superior information corresponding to the current target information can be one or more levels higher than the administrative level of the current target information; therefore, the administrative level of the target can be one or more levels higher than the administrative level of the current target information; for example, the first target text is KK Province LL City XXX; the second target text is zz District xxxx Bureau; then if Figure 11 As shown, the first information can be LL, and the second information can be zz. Since the two pieces of information do not match, it is necessary to obtain the superior administrative region information corresponding to either piece of information, for example, zz district corresponds to city U. Then, compare U and LL to obtain the comparison result. Obviously, the two do not match, indicating that the document to be identified is an abnormal document. Some target administrative region information does not have superior administrative region information. For example, in province A, if there is "xx reclamation area", there is no corresponding city. The corresponding superior administrative region directly belongs to "province A". For example, the first target text is the address: province A, zz county, xxxxx; the second target text is the issuing authority: RR reclamation area xx bureau. Then, the target level administrative region information "province A" corresponding to "RR reclamation" can be obtained. Compare it with "province A" in the first target text. If the two match, it can be preliminarily determined that the document to be identified is not an abnormal document.
[0280] The information in the first current information and the second current information other than the target current information is used as the second comparison information;
[0281] The first information to be compared is compared with the second information to be compared to obtain the current comparison result.
[0282] In this embodiment of the disclosure, for two comparison information with different administrative levels, the information of the target administrative level corresponding to either information can be obtained as the first comparison information, and compared with the second comparison information to obtain the target text comparison result; thus improving the accuracy of text comparison in identifying abnormal documents.
[0283] In this embodiment of the disclosure, the method further includes:
[0284] If the target current information is the first current information and there is no corresponding target administrative level information, obtain the account identification information in the first image to be identified;
[0285] In this embodiment of the disclosure, the account identification information can be an identification number, for example, an identification number.
[0286] Based on the account identification information, the information to be compared is determined;
[0287] In this embodiment of the disclosure, the address information corresponding to the document to be identified can be determined by the first six digits of the document.
[0288] The information to be compared is compared with the second current information to obtain the current comparison result.
[0289] In this embodiment of the disclosure, for example, the address of the portrait face is: XX Village; the issuing authority of the key feature map is: XX Bureau of LL City, KK Province; at this time, it is impossible to obtain the higher-level information corresponding to the "village"; at this time, the province and city information can be determined by the first six digits of the ID number on the portrait face, and then compared with the key feature map to determine the comparison result.
[0290] In this embodiment of the disclosure, the method further includes:
[0291] If the current comparison result is a match, the first information in the first information set that precedes the first current information is re-established as the first current information, and the second information in the second information set that precedes the second current information is re-established as the second current information.
[0292] Jump to the step of comparing the first current information with the second current information to obtain the current comparison result.
[0293] In one specific embodiment, the method includes:
[0294] The first piece of information, which is ranked last in the first information set, is compared with the second piece of information, which is ranked last in the second information set, to obtain the first comparison result;
[0295] If the first comparison result is a matching result, the first piece of information that is second to last in the first information set is compared with the second piece of information that is second to last in the second information set to obtain the second comparison result;
[0296] By analogy, the comparison results of all information in the two information sets can be obtained; if the comparison result of the last information is consistent, it is determined that the front and back information of the document to be identified are consistent, and abnormal documents with inconsistent front and back are excluded.
[0297] In this embodiment of the disclosure, if the current comparison result is a matching result, it means that the two pieces of comparison information correspond to the same administrative level; for example, such as Figure 10 As shown, the first current information "aa" and the second current information "aa"; the first current information "bb" and the second current information "bb"; both match; it can be determined that the front and back images of the document to be identified match, and it can be preliminarily determined that the document to be identified is not an abnormal document.
[0298] In this embodiment of the disclosure, if the last information in the two information sets matches, then the information in the first position of the two information sets is compared, and so on, so as to obtain the comparison results of each piece of information in the two information sets, and abnormal documents with mismatched front and back images can be excluded.
[0299] In this embodiment of the disclosure, the method further includes:
[0300] If the first current information or the second current information is the information ranked first, and the current comparison result is a matching result, a matching result of the target text is obtained.
[0301] In this embodiment of the disclosure, during the process of comparing information in two sets of information in reverse order, if the information in one set is the last information to be compared, the final target text comparison result can be determined after the comparison is completed; this realizes the comparison and recognition of the corresponding information in the document to be identified one by one, thereby improving the recognition accuracy of abnormal documents.
[0302] In this embodiment of the disclosure, comparing the first target text with the second target text to obtain the target text comparison result includes:
[0303] If the first target text and the second target text do not match, a text matching inconsistency result is obtained.
[0304] In this embodiment of the disclosure, the inconsistency between the first target text and the second target text means that the two are not completely identical.
[0305] The step of comparing the first target text with the second target text to obtain the target text comparison result includes:
[0306] If the first target text matches the second target text, a text matching result is obtained.
[0307] In this embodiment of the disclosure, matching the first target text with the second target text means that the two are completely identical.
[0308] In step S29, based on the target text comparison result, it is determined whether the document to be identified is an abnormal document.
[0309] In this embodiment of the disclosure, abnormal documents may include other people's documents that are used fraudulently, fake documents, or other abnormal documents.
[0310] In this embodiment of the disclosure, determining whether the document to be identified is an abnormal document based on the target text comparison result includes:
[0311] Based on the inconsistency results of the text comparison, the document to be identified is determined to be an abnormal document.
[0312] In this embodiment of the disclosure, the document to be identified is determined to be an abnormal document based on the text comparison inconsistency result.
[0313] In this embodiment of the disclosure, abnormal documents can be quickly identified by comparing the text on both sides of the document to be identified.
[0314] In this embodiment of the disclosure, determining whether the document to be identified is an abnormal document based on the target text comparison result includes:
[0315] Based on the text comparison results, the document to be identified is determined as the initial screening document.
[0316] In this embodiment of the disclosure, the document to be identified can be preliminarily determined to be an abnormal document based on the text comparison consistency results.
[0317] In this embodiment of the disclosure, the document can be initially screened by comparing the text on the front and back of the document to be identified to identify the inconsistencies, and then further identified to avoid missing abnormal documents.
[0318] In this embodiment of the disclosure, such as Figure 6 As shown, the method further includes:
[0319] S601: Obtain the first target text format corresponding to the first text to be identified and the second target text format corresponding to the second text to be identified;
[0320] In this embodiment of the disclosure, the target text format can be the text format corresponding to the text in the legal document; among the 8 sets of text information in the document, there are certain text format rules, such as gender only having "male" and "female"; the date format conforms to the rules and has a fixed length, and will not have "32 days", "13 months" or "200.02.2"; any abnormal information is an error.
[0321] S603: Determine the first matching result between the first text to be recognized of the initially screened document and the first target text format;
[0322] S605: Determine the second matching result between the second text to be identified of the initially screened document and the second target text format;
[0323] S607: Based on the first matching result and the second matching result, determine whether the initially screened document is an abnormal document.
[0324] In this embodiment of the disclosure, if at least one of the first matching result and the second matching result is a non-matching result, the initially screened document is determined to be an abnormal document, which may be a fake document.
[0325] In this embodiment of the disclosure, abnormal documents can be quickly identified by text format based on the first matching result between the first text to be identified and the first target text format, and the second matching result between the second text to be identified and the second target text format.
[0326] In this embodiment of the disclosure, determining whether the initially screened document is an abnormal document based on the first matching result and the second matching result includes:
[0327] If at least one of the first matching result and the second matching result is a mismatch, the initially screened document will be identified as an abnormal document.
[0328] If both the first matching result and the second matching result are consistent, the initially screened document is determined as a candidate document.
[0329] In this embodiment of the disclosure, abnormal documents and candidate documents can be determined based on the first matching result between the first text to be identified of the initially screened document and the first target text format, and the second matching result between the second text to be identified and the second target text format, and the determined candidate documents can be further identified, thereby improving the identification efficiency of abnormal documents.
[0330] In this embodiment of the disclosure, such as Figure 7 As shown, the method further includes:
[0331] S701: Obtain the first attribute to be identified of the first text to be identified and the second attribute to be identified of the second text to be identified from the preliminary screening document;
[0332] In this embodiment of the disclosure, the first attribute to be identified and the second attribute to be identified may include attributes such as font type, font size, font style, font color, font size ratio, height, width, and character spacing.
[0333] S703: Determine the first legal text and the second legal text of the legal document; the first legal text corresponds to the first text to be identified, and the second legal text corresponds to the second text to be identified;
[0334] In this embodiment of the disclosure, the correspondence between the first legal text and the first text to be identified means that they are texts of the same type, and the first legal text is text extracted from the legal text portrait face image; the correspondence between the second legal text and the second text to be identified means that they are texts of the same type, and the second legal text is text extracted from the legal text portrait face image.
[0335] S705: Obtain the first legal attribute of the first legal text and the second legal attribute of the second legal text;
[0336] In this embodiment of the disclosure, the first legal attribute and the first attribute to be identified are of the same type; the second legal attribute and the second attribute to be identified are of the same type.
[0337] S707: Based on the first attribute comparison result and the second attribute comparison result, determine whether the initially screened document is an abnormal document; the first attribute comparison result is the comparison result between the first attribute to be identified and the first legal attribute, and the second attribute comparison result is the comparison result between the second attribute to be identified and the second legal attribute.
[0338] In this embodiment of the disclosure, the legal attributes of the text in a legal document can be obtained and compared with the attributes of the text to be identified, thereby enabling the screening of abnormal documents based on the attribute information of the text and improving the accuracy of abnormal document identification.
[0339] In this embodiment of the disclosure, determining whether the initially screened document is an abnormal document based on the comparison results of the first attribute and the comparison results of the second attribute includes:
[0340] The first attribute to be identified is compared with the first legal attribute to obtain the first attribute comparison result;
[0341] The second attribute to be identified is compared with the second legal attribute to obtain the comparison result of the second attribute;
[0342] If at least one of the first attribute comparison results and the second attribute comparison results is inconsistent, the initially screened document is determined to be an abnormal document.
[0343] In this embodiment of the disclosure, abnormal documents can be quickly identified by comparing the first attribute of the first attribute to be identified with the first attribute of the first legal attribute, and the second attribute of the second attribute to be identified with the second legal attribute.
[0344] This disclosure obtains a first image and a second image corresponding to a document to be identified; the first image includes a portrait image of the document, and the second image includes a non-portrait image of the document; document text information is extracted from the first image to obtain a first target text; document text information is extracted from the second image to obtain a second target text; the first target text and the second target text are compared to obtain a target text comparison result; based on the target text comparison result, it is determined whether the document to be identified is an abnormal document. This disclosure, by comparing the first target text in the portrait image of the document with the second target text in the non-portrait image, can identify abnormal documents with inconsistent information on the front and back, thereby improving the accuracy of abnormal document identification.
[0345] Figure 12 This is a block diagram illustrating a document recognition device according to an exemplary embodiment. (Refer to...) Figure 12 The device includes:
[0346] The image acquisition module 1210 is configured to acquire a first image to be identified and a second image to be identified corresponding to the document to be identified; the first image to be identified includes a human face image of the document to be identified, and the second image to be identified includes a non-human face image of the document to be identified.
[0347] The first target text extraction module 1220 is configured to extract document text information from the first image to be recognized to obtain the first target text.
[0348] The second target text extraction module 1230 is configured to extract document text information from the second image to be recognized to obtain the second target text.
[0349] The target text comparison result determination module 1240 is configured to compare the first target text with the second target text to obtain the target text comparison result;
[0350] The document recognition module 1250 is configured to determine whether the document to be recognized is an abnormal document based on the target text comparison result.
[0351] In some embodiments, the target text comparison result determination module includes:
[0352] The first result determination unit is configured to perform the operation of obtaining a text comparison inconsistency result if the first target text and the second target text do not match.
[0353] In some embodiments, the document recognition module includes:
[0354] The first abnormal document determination unit is configured to determine the document to be identified as an abnormal document based on the text comparison inconsistency result.
[0355] In some embodiments, the target text comparison result determination module includes:
[0356] The first information set determination unit is configured to parse the first target text to obtain a first information set; each piece of first information in the first information set is sorted according to its position in the first target text.
[0357] The second information set determination unit is configured to parse the second target text to obtain a second information set; the second information set is sorted according to the position of each second information in the second target text.
[0358] The target text comparison result determination unit is configured to perform a comparison between the first information in the first information set and the second information in the second information set to obtain the target text comparison result.
[0359] In some embodiments, the target text comparison result determination unit includes:
[0360] The current information determination subunit is configured to take the first information that is ranked last in the first information set as the first current information and the second information that is ranked last in the second information set as the second current information.
[0361] The current comparison result determination subunit is configured to compare the first current information with the second current information to obtain the current comparison result;
[0362] The comparison result determination subunit is configured to execute, if the current comparison result is an inconsistency result, to obtain the target text comparison inconsistency result.
[0363] In some embodiments, the current alignment result determination subunit includes:
[0364] The initial current comparison result determination subunit is configured to compare the first current information with the second current information to obtain the initial current comparison result;
[0365] The first subunit for determining information to be compared is configured to, if the initial current comparison result is a mismatch result, obtain the information of the target administrative level corresponding to the target current information, as the first information to be compared; the target current information is either the first current information or the second current information; the target administrative level is higher than the administrative level corresponding to the target current information.
[0366] The second comparison information determination subunit is configured to use the information other than the target current information in the first current information and the second current information as the second comparison information;
[0367] The current result determination subunit is configured to perform a comparison between the first information to be compared and the second information to be compared, and obtain the current comparison result.
[0368] In some embodiments, the apparatus further includes:
[0369] The information redeter module is configured to perform the following actions if the current comparison result is a matching result: if the current comparison result is a matching result, the first information in the first information set that is located before the first current information is re-established as the first current information, and the second information in the second information set that is located before the second current information is re-established as the second current information.
[0370] The jump module is configured to execute the step of jumping to compare the first current information with the second current information to obtain the current comparison result.
[0371] In some embodiments, the apparatus further includes:
[0372] The matching result determination module is configured to execute if the first current information or the second current information is the first information in the sorting order, and the current matching result is a matching result, to obtain a matching result for the target text.
[0373] In some embodiments, the first target text extraction module includes:
[0374] The first text to be identified unit is configured to extract document text information from the first image to be identified to obtain the first text to be identified.
[0375] The first target text determination unit is configured to extract address information from the first text to be identified to obtain the first target text.
[0376] In some embodiments, the second target text extraction module includes:
[0377] The second text to be identified unit is configured to extract document text information from the second image to be identified to obtain the second text to be identified.
[0378] The second target text determination unit is configured to extract address information from the second text to be identified to obtain the second target text.
[0379] In some embodiments, the target text comparison result determination module includes:
[0380] The second result determination unit is configured to perform the operation of obtaining a text matching result if the first target text matches the second target text.
[0381] In some embodiments, the document recognition module includes:
[0382] The initial screening document determination unit is configured to determine the document to be identified as the initial screening document based on the text comparison consistency result.
[0383] In some embodiments, the apparatus further includes:
[0384] The target text format acquisition module is configured to acquire the first target text format corresponding to the first text to be recognized and the second target text format corresponding to the second text to be recognized.
[0385] The first matching result determination module is configured to determine the first matching result between the first text to be identified of the initially screened document and the first target text format.
[0386] The second matching result determination module is configured to determine the second matching result between the second text to be identified of the initially screened document and the second target text format.
[0387] The initial screening document result determination module is configured to determine whether the initial screening document is an abnormal document based on the first matching result and the second matching result.
[0388] In some embodiments, the initial screening document result determination module includes:
[0389] The second abnormal document determination unit is configured to determine the initially screened document as an abnormal document if at least one of the first matching result and the second matching result is an inconsistent matching result.
[0390] In some embodiments, the apparatus further includes:
[0391] The first text comparison result determination module is configured to determine the first text comparison result of the first text to be identified corresponding to at least two documents to be identified.
[0392] The first candidate image determination module is configured to determine the first image to be identified corresponding to the first number of documents to be identified as the first candidate image if the first text comparison result of the first number of documents to be identified is a matching result.
[0393] The second text comparison result determination module is configured to perform a second text comparison result to determine the second text to be identified corresponding to each of the at least two documents to be identified.
[0394] The second candidate image determination module is configured to determine the second image to be identified corresponding to the second number of documents to be identified as the second candidate image if the second text comparison result is consistent with the second number of documents to be identified.
[0395] In some embodiments, the apparatus further includes:
[0396] The first image set determination module is configured to perform image processing on the first number of first candidate images to obtain a first processed image set; the first regions of each first processed image in the first processed image set have the same size; the first regions of each first processed image are determined based on the target characters in each first processed image.
[0397] The first overlapping image set determination module is configured to move each first processed image in the first processed image set to overlap with the first region of each first processed image to obtain the first overlapping image set;
[0398] The first pixel comparison module is configured to perform a comparison of the background and pixels of each first overlapping image in the first overlapping image set.
[0399] The first abnormal document recognition module is configured to determine the document to be recognized corresponding to the first candidate image as an abnormal document if the background and pixels of each first overlapping image in the first overlapping image set are consistent.
[0400] In some embodiments, the apparatus further includes:
[0401] The second image set determination module is configured to perform image processing on the second number of second candidate images to obtain a second image set; the second regions of each second processed image in the second image set are of the same size; the second region of each second processed image is the region corresponding to the target object in each second processed image; the second overlapping image set determination module is configured to move each second processed image in the second image set to overlap with the second regions of each second processed image to obtain a second overlapping image set;
[0402] The second pixel comparison module is configured to perform a comparison of the background and pixels of each second overlapping image in the second overlapping image set.
[0403] The second abnormal document recognition module is configured to determine the document to be recognized corresponding to the second candidate image as an abnormal document if the background and pixels of each second overlapping image in the second overlapping image set are consistent.
[0404] In some embodiments, the apparatus further includes:
[0405] The module for obtaining the attribute to be identified is configured to obtain the first attribute to be identified of the first text to be identified and the second attribute to be identified of the second text to be identified of the initial screening document.
[0406] The legitimate text determination module is configured to determine a first legitimate text and a second legitimate text of a legitimate document; the first legitimate text corresponds to the first text to be identified, and the second legitimate text corresponds to the second text to be identified;
[0407] The legal attribute acquisition module is configured to acquire the first legal attribute of the first legal text and the second legal attribute of the second legal text.
[0408] The initial screening document recognition module is configured to determine whether the initially screened document is an abnormal document based on the first attribute comparison result and the second attribute comparison result; the first attribute comparison result is the comparison result between the first attribute to be identified and the first legal attribute, and the second attribute comparison result is the comparison result between the second attribute to be identified and the second legal attribute.
[0409] In some embodiments, the initial screening document recognition module includes:
[0410] The first attribute comparison result determination unit is configured to perform a comparison between the first attribute to be identified and the first legal attribute to obtain the first attribute comparison result;
[0411] The second attribute comparison result determination unit is configured to compare the second attribute to be identified with the second legal attribute to obtain the second attribute comparison result;
[0412] The third abnormal document identification unit is configured to determine the initially screened document as an abnormal document if at least one of the first attribute comparison result and the second attribute comparison result is inconsistent.
[0413] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0414] This disclosure obtains a first image and a second image corresponding to a document to be identified; the first image includes a portrait image of the document, and the second image includes a non-portrait image of the document; document text information is extracted from the first image to obtain a first target text; document text information is extracted from the second image to obtain a second target text; the first target text and the second target text are compared to obtain a target text comparison result; based on the target text comparison result, it is determined whether the document to be identified is an abnormal document. This disclosure, by comparing the first target text in the portrait image of the document with the second target text in the non-portrait image, can identify abnormal documents with inconsistent information on the front and back, thereby improving the accuracy of abnormal document identification.
[0415] In some embodiments, an electronic device is also provided, including a processor; a memory for storing processor-executable instructions; wherein, when the processor is configured to execute the instructions stored in the memory, it implements the document recognition method provided in any of the above embodiments.
[0416] The electronic device can be a terminal, a server, or a similar computing device. Taking a server as an example... Figure 13 This is a block diagram illustrating an electronic device according to an exemplary embodiment, such as... Figure 13 As shown, the server 1300 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1310 (CPUs 1310 may include, but are not limited to, microprocessors (MCUs) or programmable logic devices (FPGAs), a memory 1330 for storing data, and one or more storage media 1320 (e.g., one or more mass storage devices) for storing application programs 1323 or data 1322. The memory 1330 and storage media 1320 may be temporary or persistent storage. The program stored in the storage media 1320 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 1310 may be configured to communicate with the storage media 1320 and execute the series of instruction operations stored in the storage media 1320 on the server 1300. Server 1300 may also include one or more power supplies 1360, one or more wired or wireless network interfaces 1350, one or more input / output interfaces 1340, and / or one or more operating systems 1321, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0417] The input / output interface 1340 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 1300. In one example, the input / output interface 1340 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 1340 may be a radio frequency (RF) module used for wireless communication with the Internet.
[0418] Those skilled in the art will understand that Figure 13The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 1300 may also include... Figure 13 The more or fewer components shown, or having the same Figure 13 The different configurations shown.
[0419] In some embodiments, a computer-readable storage medium including instructions is also provided, such as a memory 1330 including instructions, which can be executed by a processor 1310 of server 1300 to perform the above-described method. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0420] In some embodiments, a computer program product is also provided, including a computer program that, when executed by a processor, implements the document recognition method provided in any of the above embodiments.
[0421] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0422] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0423] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for identifying identification documents, characterized in that, include: Acquire a first image to be identified and a second image to be identified corresponding to the document to be identified; the first image to be identified includes a human face image of the document to be identified, and the second image to be identified includes a non-human face image of the document to be identified; the document to be identified is an ID card. Extract the document text information from the first image to be identified to obtain the first target text; Extract the document text information from the second image to be identified to obtain the second target text; The first target text is compared with the second target text. If the first target text and the second target text match, a text matching result is obtained. Based on the text comparison results, the document to be identified is identified as the initial screening document; Obtain the first target text format corresponding to the first target text and the second target text format corresponding to the second target text; Determine the first matching result between the first text to be identified in the initially screened document and the first target text format; Determine the second matching result between the second text to be identified in the initially screened document and the second target text format; Based on the first matching result and the second matching result, determine whether the initially screened document is an abnormal document; Calculate the similarity between the first text to be identified corresponding to at least two documents to be identified; the first text to be identified corresponding to each document to be identified is the text in the first image to be identified corresponding to each document to be identified, excluding common text. If there exists a first number of first texts to be identified whose similarity is greater than a first similarity threshold, the first image to be identified corresponding to the document to be identified of the first number of first texts to be identified is determined as the first candidate image. The first candidate image is used to identify the abnormal document among the at least two documents to be identified.
2. The method according to claim 1, characterized in that, The step of comparing the first target text with the second target text includes: The first target text is parsed to obtain a first information set; each piece of first information in the first information set is sorted according to its position in the first target text. The second target text is parsed to obtain a second information set; each piece of second information in the second information set is sorted according to its position in the second target text. The first information in the first information set is compared with the second information in the second information set to obtain the target text comparison result.
3. The method according to claim 2, characterized in that, The step of comparing the first information in the first information set with the second information in the second information set to obtain the target text comparison result includes: The first information in the first information set, which is ranked last, is taken as the first current information, and the second information in the second information set, which is ranked last, is taken as the second current information. The first current information is compared with the second current information to obtain the current comparison result; If the current comparison result is inconsistent, the target text is obtained as inconsistent.
4. The method according to claim 3, characterized in that, The step of comparing the first current information with the second current information to obtain the current comparison result includes: The first current information is compared with the second current information to obtain the initial current comparison result; If the initial current comparison result is a mismatch result, the information of the target administrative level is obtained as the first comparison information; the target administrative level is higher than the administrative level corresponding to the target current information; the target current information is the first current information or the second current information. The information in the first current information and the second current information other than the target current information is used as the second comparison information; The first information to be compared is compared with the second information to be compared to obtain the current comparison result.
5. The method according to claim 3, characterized in that, The method further includes: If the current comparison result is a matching result, the first information in the first information set that is one position before the first current information is re-established as the first current information, and the second information in the second information set that is one position before the second current information is re-established as the second current information; Jump to the step of comparing the first current information with the second current information to obtain the current comparison result.
6. The method according to claim 1, characterized in that, The method further includes: Determine the second text comparison result of the second text to be identified corresponding to each of the at least two documents to be identified; the second text to be identified corresponding to each document to be identified is the text in the second image to be identified corresponding to each document to be identified, excluding common text; If the second text comparison results for a second number of documents to be identified are consistent, the second image to be identified corresponding to the second number of documents to be identified is determined as the second candidate image; the second candidate image is used to identify the abnormal document among the at least two documents to be identified.
7. A document recognition device, characterized in that, include: The image acquisition module is configured to acquire a first image to be identified and a second image to be identified corresponding to the document to be identified; the first image to be identified includes a portrait image of the document to be identified, and the second image to be identified includes a non-portrait image of the document to be identified; the document to be identified is an ID card. The first target text extraction module is configured to extract document text information from the first image to be recognized to obtain the first target text. The second target text extraction module is configured to extract document text information from the second image to be recognized to obtain the second target text. The target text comparison result determination module is configured to compare the first target text with the second target text, and if the first target text and the second target text match, a text comparison match result is obtained; The document recognition module is configured to determine the document to be recognized as a preliminary screening document based on the text comparison consistency result; The device is further configured to perform the task of acquiring a first target text format corresponding to the first target text and a second target text format corresponding to the second target text; Determine the first matching result between the first text to be identified in the initially screened document and the first target text format; Determine the second matching result between the second text to be identified in the initially screened document and the second target text format; Based on the first matching result and the second matching result, determine whether the initially screened document is an abnormal document; The first text comparison result determination module is configured to perform calculations of the similarity between the first texts corresponding to at least two documents to be identified; the first text corresponding to each document to be identified is the text in the first image to be identified corresponding to each document to be identified, excluding common text. The first candidate image determination module is configured to determine the first image to be identified corresponding to the first document of the first number of first texts to be identified as the first candidate image if the similarity between the first number of first texts to be identified is greater than the first similarity threshold. The first candidate image is used to identify the abnormal document among the at least two documents to be identified.
8. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the document recognition method as described in any one of claims 1-6.