A false identity card back photo recognition method based on feature extraction
By constructing a custom dataset of photos of the back of ID cards, the system accurately identifies and removes background pixels in text areas. Using a lightweight classification model, it solves the problem of low efficiency in detecting various types of image tampering in existing technologies, achieving high accuracy and fast identification of fake ID card photos.
Patent Information
- Application Number
- CN202210563406.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-20
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2042-05-20
AI Technical Summary
Existing technologies cannot effectively detect various types of image tampering, and image modification detection models in sensitive scenes are not performing well, especially when the dataset is scarce, resulting in low detection efficiency.
By collecting and constructing a custom dataset of photos of the back of ID cards, we accurately identify and remove background pixels in text areas, construct a feature extraction method that contains only text pixel features, and use a lightweight classification model for recognition.
It achieves high-precision identification of fake ID photos, significantly improves classification results, has a fast detection speed, and an accuracy rate of over 90%, reducing the cost of identification by third-party platforms.
Smart Images

Figure CN115294437B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of image recognition, and particularly relates to a false ID back photo recognition method based on feature extraction. BACKGROUND
[0002] With the accelerated development of the network, the importance of monitoring and supervision of the network ecology is increasing. In recent years, with the development of the Internet, more and more financial scenarios have moved from offline to online, and the proof materials have changed from paper materials to relevant scans or pictures. However, this brings about the behavior of picture tampering, which changes the non-existent proof materials into false pictures through picture tampering software or tampering technology. Picture tampering brings great economic loss and social risk, therefore, the picture tampering detection method is increasingly valued by people. In the existing picture tampering detection process, only one type of picture tampering can be detected, and multiple different types of picture tampering cannot be detected at the same time, thereby leading to low picture tampering detection efficiency.
[0003] Based on the implanted text in the picture, the existing technology mainly adopts the text line extraction method for detection. Text line extraction refers to finding the area where the text is located from the picture as much as possible, predicting the candidate boundary box through a target detector, and processing and extracting the final text based on semantic segmentation and segmentation mapping. For the detection method of text line extraction, due to different picture resolutions, the length-width ratio of the text line changes greatly, and the direction of the text in the picture exists. The existing method mainly detects by intercepting part of the picture, and cannot adapt to picture modification detection of different resolutions.
[0004] From the scene, the image modification detection of many sensitive scenes (such as ID image detection) nowadays is not ideal due to the lack of data sets and the lack of positive sample samples in the data set, and the image modification detection is currently mainly based on deep learning methods, which makes the samples need to be enough to get better detection effect, and such a model is relatively complex, and the detection speed is not ideal. SUMMARY
[0005] In order to solve the defects existing in the prior art, the purpose of the present application is to provide a false ID back photo recognition method based on feature extraction, which aims to improve the classification effect of the data set and the recognition and detection speed of the false photo. The present application can be used to ID front picture, and only the ID back picture is considered due to sensitivity.
[0006] The technical scheme adopted by the present application is as follows:
[0007] A false ID back photo recognition method based on feature extraction, comprising the following steps:
[0008] Step 1: Collect the back of the ID card photo data set;
[0009] Step 2: Based on the real ID card back photo, a fake ID card back photo data set is constructed, and the real ID card back photo data set is combined to form an ID card photo data set;
[0010] Step 3: Preprocess the ID card photo data set, extract the picture target text area data features, and establish a training set;
[0011] Step 4: Input the training set into the classification model for training;
[0012] Step 5: Collect the ID card back picture to be detected, preprocess the ID card back picture to be detected in the same way as step 3, and then input the classification model trained in step 4 to obtain the judgment result of the ID card back picture to be detected.
[0013] In the above technical solution, by batch producing accurate fake ID card back pictures, the problem of lack of positive examples in the existing picture data set is effectively solved. In this technical solution, a small amount of sensitive data set can be collected to produce a large number of fake photos that cannot be identified by online AI platforms. At the same time, the fake photos are difficult for human eyes to identify. In this way, a large number of high-quality positive examples are generated to fill and make up the current data set imbalance problem. Then, by accurately identifying the differences between the detection area and the reference area of the picture, classification features are constructed, and finally a simple model is used to achieve the technical effect of high recognition rate of fake ID card photos.
[0014] Further, the step 1 mainly includes the following steps:
[0015] Step 1.1: Collect the corresponding format ID card back picture according to the ID card upload format required by the financial business application;
[0016] Step 1.2: Collect high-resolution ID card back photos taken by mobile phones;
[0017] Step 1.3: Collect ID card back photos taken at a normal angle;
[0018] Step 1.4: The collected pictures form the real data set of the ID card data set.
[0019] Further, the construction method of the ID card back photo data set of step 2 mainly includes the following steps:
[0020] Step 2.1: Perform text recognition on the picture based on the Baidu paddle platform ocr text recognition model, and extract the rectangular frame coordinates of the text area to be modified;
[0021] Step 2.2: Obtain the text region in the to-be-modified text region by using the binarization processing based on adaptive selection of a threshold value;
[0022] Step 2.3: Based on the image inpainting technology, perform image inpainting by using the text region mask obtained in step 2.2.
[0023] Step 2.4: Place the text in the original text region based on the Image.Text() method of the Pillow library, and complete the generation of the fake ID photo.
[0024] Further, the step 2.2 includes:
[0025] Step 2.2.1: Determine the threshold pixel value that can best distinguish the background region and the text region according to the pixel distribution by obtaining the image histogram of the to-be-modified text region.
[0026] Step 2.2.2: Based on the threshold value, obtain the text region pixel coordinates by using image binarization.
[0027] Further, the image inpainting in step 2.3 is specifically operated as follows: remove the text in the text region, fill the pixels in the text region with the weighted text adjacent background pixels, and realize the "cutting" of the text in the text region.
[0028] Further, the region where the fields containing "Public Security Bureau" and "-" in the rectangular frame coordinates of the to-be-modified text region is the potential modified region.
[0029] Further, the image preprocessing operation and feature extraction of step 3 mainly include the following steps:
[0030] Step 3.1: Perform text recognition on the picture based on the Baidu padd le platform ocr text recognition model, and extract the rectangular frame coordinates of the potential modified text region and the control region.
[0031] Step 3.2: Obtain the text region in the potential modified text region and the control region by using the binarization processing based on adaptive selection of a threshold value.
[0032] Step 3.3: Calculate the picture features based on the text regions of the two regions respectively and construct a feature vector.
[0033] Further, the region where the fields containing "Issuing Authority" and "Valid Date" in the rectangular frame coordinates of the potential modified text region and the control region is the control region.
[0034] As described above, due to the adoption of the above technical solutions, the present application has the following advantages:
[0035] 1) Compared with the prior art picture tampering identification technology, the prior art mainly extracts the pixel features of the whole picture and the partial area for classification, which is different from the technical scheme. In the technical scheme, the background pixels of the text area are accurately identified and removed, and the features containing only text pixel features are constructed, which solves the problems of low recognition rate and large sample demand in the prior art, and unexpected high-precision identification effect is produced by using a light model.
[0036] 2) The application builds a large number of data sets, and a large number of false samples can be generated in batches according to the data sets to balance the data sets, so that the classification effect is significantly improved.
[0037] 3) The application proposes a light classification model based on picture statistical feature extraction, which has a faster detection speed and good classification model effect, and the accuracy can reach more than 90% (including AUC).
[0038] 4) In the actual scene, if all the application materials are detected through a third-party platform, it will bring a large cost, and the model can preliminarily screen some false data with obvious errors, and reduce the cost of identification through the third-party platform. BRIEF DESCRIPTION OF DRAWINGS
[0039] The application will be illustrated by examples and with reference to the accompanying drawings, in which:
[0040] Fig. 1 is a flow chart of a false ID photo identification method based on feature extraction in the application;
[0041] Fig. 2 is a pixel frequency histogram of the target area of the ID photo;
[0042] Fig. 3 is an image repair display diagram, the upper half refers to the result diagram of the text part, and the lower half refers to the result diagram after pasting the generated text. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical scheme and advantages of the embodiments of the application clearer, the technical scheme of the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, not all the embodiments. The components of the embodiments of the application described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the application provided in the drawings is not intended to limit the scope of the claimed application, but only represents selected embodiments of the application. Based on the embodiments of the application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the application.
[0044] The purpose of the present application aims to solve the above problems, thereby providing a false ID photo recognition method based on feature extraction. The following collection Figs. 1-3 Further detailed description of the present application. Referring to Fig. 1 The method comprises the following steps:
[0045] Step 1: Collecting ID photo data set, which only contains real ID photos;
[0046] In this embodiment, because the ID photo data set is sensitive, the data set construction uses a self-built data set.
[0047] Further, the step 1 mainly comprises the following steps:
[0048] Step 1.1: Collect the corresponding format ID picture according to the ID upload format required by the financial business application;
[0049] Step 1.2: Collect high-resolution ID photos taken by mobile phone;
[0050] Step 1.3: Collect the photos taken at a proper angle on the back of the ID;
[0051] Step 1.4: The collected pictures constitute the real data set of the ID data set.
[0052] In this embodiment, the pictures corresponding to step 1.2 are taken by mobile phone, simulating the scene of uploading ID by mobile phone in the current application business.
[0053] Step 2: Based on the real ID photo, construct a false ID photo data set, and together with the real ID photo data set, form an ID photo data set;
[0054] In this embodiment, because the number of false ID samples is small, it is necessary to generate false ID samples according to the existing false making logic, and in this application, in order to ensure that the false ID is realistic enough, special processing including Gaussian blur operation is done to ensure that the human eye cannot directly judge. In this application, the generated false ID can pass the existing online AI platform ID recognition (i.e. all are recognized as real ID), among which the ID photo generated in this paper can pass the online commercial AI platform recognition interface, and all are recognized as formal ID.
[0055] Further, the ID back photo data set production operation of step 2 mainly comprises the following steps:
[0056] Step 2.1: Based on the baidu paddle platform ocr text recognition model, the picture is subjected to text recognition, and the rectangular frame coordinates of the modified text area (the area containing "public security bureau" and "-" is the potential modified area) are extracted;
[0057] Step 2.2: Obtain the text region in the to-be-modified text region by using a binarization process based on adaptive selection of a threshold value (distinguish the text from the background region);
[0058] Step 2.3: Based on the image inpainting technique, perform image inpainting using the text region mask obtained in step 2.2, that is, remove the text in the text region, and fill the pixels of the text region with the weighted pixels adjacent to the text. Finally, the text in the text region is "subtracted";
[0059] Step 2.4: Place the text in the original text region based on the Image.Text() method of the Pillow library to complete the generation of a fake ID photo (the generated image can be recognized by various AI platform recognition systems).
[0060] In this embodiment, step 2.1 locates the potential modified text region of an ID photo by using a text recognition model, that is, it can identify the rectangular frame region where the text is located. The text region is marked at the upper left, upper right, lower left, and lower right four coordinate points, forming a total of eight values [x1, y1, x2, y2, x3, y3, x4, y4], which correspond to the horizontal coordinates and vertical coordinates of the four corners, respectively. According to this, the target text region coordinates can be identified.
[0061] In this embodiment, step 2.2 aims to obtain the specific coordinate set of the text in the rectangular frame (i.e., to obtain the text region and discard the background region).
[0062] Further, the text region extraction operation of step 2.2 mainly includes the following steps:
[0063] Step 2.2.1: In order to obtain the text region pixel coordinate set, the image histogram of the to-be-modified text region is obtained, and the threshold pixel value that best distinguishes the background region from the text region is determined according to the pixel distribution, as shown in FIG. 2. Fig. 2 ;
[0064] Step 2.2.2: Based on the threshold value, the text region pixel coordinates are obtained by using image binarization;
[0065] In this embodiment, step 2.3 replaces the pixel value of the text region with a pixel value similar to the background region by positioning the text region, that is, filling the pixels of the text region with the weighted pixels adjacent to the text, as shown in FIG. 3. Fig. 3 ,
[0066] In this embodiment, step 2.4 uses the method in the existing library (Python) Pillow to place editable text in the original text region, that is, a new ID back image can be obtained by modifying the text in the text region of an ID, as shown in FIG. 4. Fig. 2According to the threshold, the text is separated from the background, and the text region coordinates are obtained.
[0067] Step 3: Preprocessing of the ID card photo dataset, extracting the picture target text region data features, and establishing a training set.
[0068] In this embodiment, step 3 extracts features based on the features of the picture itself, that is, the same logic as step 2 is used to extract the picture slice of the text region, see the attached Fig. 3 That is, the potential modification area of the picture is obtained, and the binary processing based on the automatic threshold is performed to obtain the text region, the picture features are calculated based on the text region, and the feature vector is constructed.
[0069] Further, the image preprocessing operation and feature extraction of step 3 mainly include the following steps:
[0070] Step 3.1: Based on the Baidu paddle platform ocr text recognition model, the picture is subjected to text recognition, and the rectangular frame coordinates of the potential modified text region and the control region (the region where the "issuing authority" and "validity date" fields are located is the control region) are extracted;
[0071] Step 3.2: Use the binary processing based on the adaptive selected threshold to obtain the text region in the potential modified text region and the control region (distinguish the text from the background);
[0072] Step 3.3: Calculate the picture features based on the text regions of the two regions respectively and construct the feature vector.
[0073] In this application, step 3.3 constructs different statistics by analyzing the statistical characteristics of the pixel values of the potential modified text region and the control region, that is, different features constitute the feature vector of this picture.
[0074] Step 4), input the training set into the classification model for training;
[0075] In this embodiment, the classification model adopts a random forest classification model, and the picture features obtained by feature engineering are good, so a light and low complexity classification model can achieve good classification effect.
[0076] Step 5: Collect the ID card back picture to be detected, preprocess the ID card back picture to be detected in the same way as step 3, and then input the classification model trained in step 4 to obtain the judgment result of the ID card back picture to be detected.
[0077] It should be noted that the picture classification model used in this application is a prior art known to those skilled in the art, so the principle and use process are not limited and described in detail.
[0078] The above-described embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalent replacements; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A feature extraction-based false identification card back photo recognition method, characterized in that, It comprises the following steps: Step 1: Collect the back photo data set of the ID card; Step 2: Based on the real back photo data set of the ID card, a false back photo data set of the ID card is constructed, and the two data sets are combined to form the ID card photo data set; Step 3: Preprocess the ID card photo data set, extract the picture target text area data features, and establish a training set; Step 4: Input the training set into the classification model for training; Step 5: Collect the ID card back picture to be detected, preprocess the ID card back picture to be detected in the same way as step 3, and then input the classification model trained in step 4 to obtain the judgment result of the ID card back picture to be detected; The image preprocessing operation and feature extraction of step 3 mainly include the following steps: Step 3.1: Based on the baidu paddle platform ocr text recognition model, the text recognition of the picture is carried out, and the rectangular frame coordinates of the potential modified text area and the contrast area are extracted; Step 3.2: The binary processing based on adaptive threshold selection is used to obtain the text area in the potential modified text area and the contrast area; Step 3.3: Based on the text area of the two areas, the picture features are calculated respectively and the feature vectors are constructed.
2. The method of claim 1, wherein the method is characterized by, The step 1 mainly includes the following steps: Step 1.1: Collect the corresponding format ID card back picture according to the ID card upload format required by the financial business application; Step 1.2: Collect the ID card back photo with clear pixels taken by mobile phone; Step 1.3: Collect the ID card back photo with correct shooting angle; Step 1.4: The collected pictures constitute the real data set of the ID card data set.
3. The method of claim 1, wherein the method is characterized by: The construction method of the ID card back photo data set of step 2 mainly includes the following steps: Step 2.1: Based on the baidu paddle platform ocr text recognition model, the text recognition of the picture is carried out, and the rectangular frame coordinates of the text area to be modified are extracted; Step 2.2: The binary processing based on adaptive threshold selection is used to obtain the text area in the text area to be modified; Step 2.3: Based on the image repair technology, the text area mask obtained in step 2.2 is used for image repair; Step 2.4: Based on the Image.Text() method of Pillow library, the text is placed in the original text area to complete the generation of false ID card photo.
4. The method of claim 3, wherein the method is characterized by, The step 2.2 includes: Step 2.2.1: By obtaining the image histogram of the text area to be modified, the threshold pixel value that can best distinguish the background area and the text area is determined according to the pixel distribution; Step 2.2.2: Based on the threshold, the image binary is used to obtain the text area pixel coordinates.
5. The method of claim 3, wherein the method is characterized by: The specific operation of image repair in step 2.3 is to remove the text in the text area, fill the pixels in the text area with the weighted text adjacent background pixels, and realize the "cutting" of the text area.
6. The method of claim 3, wherein the method is characterized by: The rectangular frame coordinates of the potential modified area in the text area to be modified include the fields of "public security bureau" and "-".
7. The method of claim 1, wherein the method is characterized by: The rectangular frame coordinates of the potential modified text area and the contrast area include the fields of "issuing authority" and "valid date".
Citation Information
Patent Citations
Tamper detection method and system
CN112597808A