Authentication Method, Device, Computer Equipment, and Storage Medium
The method enhances identity verification by capturing and processing identity document videos, selectively extracting frames, and comparing enhanced facial images to improve authenticity determination, addressing the challenge of verifying identity documents without prior facial data.
Patent Information
- Application Number
- CN202110049447.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-14
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-01-14
AI Technical Summary
Traditional authentication methods cannot identify the authenticity of the ID image that lacks pre-storing facial information, resulting in insufficient accuracy of identity verification.
By obtaining the ID video, filtering clear video frames, extracting the first and second face images, using image enhancement processing parameters to process the first face image, and comparing it with the second face image to determine the ID authentication result.
It improves the accuracy of the identity verification of the target certificate, can accurately identify the authenticity of the certificate, and enhances the security of user information.
Smart Images

Figure CN114840830B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to an identity authentication method, apparatus, computer device, and storage medium. Background Art
[0002] With the development of computer technology, there is a risk that personal information may be stolen or misappropriated by others. Therefore, various methods for authenticating the authenticity of personal certificates have emerged. For example, comparing the face in the certificate image with the pre-stored face, and providing corresponding services to users who pass the identity authentication, so as to ensure the security of user information.
[0003] However, traditional identity authentication methods often rely on pre-stored user face information. For users without pre-stored face information, it is impossible to identify the authenticity of the user certificate image. Summary of the Invention
[0004] Based on this, in view of the above technical problems, it is necessary to provide an identity authentication method, apparatus, computer device, and storage medium that can accurately verify the authenticity of a certificate image.
[0005] An identity authentication method, the method comprising:
[0006] Obtain a certificate video obtained by video capturing a target certificate, and screen out target video frames that meet the image clarity condition from the certificate video;
[0007] Extract a first face image and a second face image corresponding to the target certificate from the target video frames, wherein the image size of the first face image is smaller than the image size of the second face image;
[0008] Obtain at least one set of target image processing parameters, and perform image enhancement processing on the first face image based on each set of target image processing parameters to obtain at least one third face image;
[0009] Compare each of the third face images with the second face image respectively to obtain corresponding image comparison results, and determine the identity authentication result of the target certificate according to the image comparison results.
[0010] In one embodiment, the method further comprises:
[0011] Obtain sample certificate images, and determine the sample categories to which the sample certificate images belong respectively;
[0012] Extract a first sample face image and a second sample face image from the sample certificate images, wherein the image size of the first sample face image is smaller than the image size of the second sample face image;
[0013] Obtain multiple groups of candidate image processing parameters, and perform image enhancement processing on the first sample face image respectively based on each group of candidate image processing parameters to obtain a third sample face image corresponding to each group of candidate image processing parameters;
[0014] Compare each of the third sample face images with the corresponding second sample face image respectively to obtain corresponding sample image comparison results;
[0015] Based on the sample image comparison results and the sample categories, screen out at least one group of target image processing parameters from the multiple groups of candidate image processing parameters.
[0016] In one embodiment, the obtaining multiple groups of candidate image processing parameters, and performing image enhancement processing on the first sample face image respectively based on each group of candidate image processing parameters to obtain a third sample face image corresponding to each group of candidate image processing parameters includes:
[0017] Determine the current candidate image processing parameter corresponding to the current iteration from the sample parameter set, and obtain the backup image processing parameter screened out through the previous iteration;
[0018] Based on the current candidate image processing parameter and the backup image processing parameter, perform image enhancement processing on the first sample face image respectively to obtain a third sample face image corresponding to each group of image processing parameters;
[0019] The screening out at least one group of target image processing parameters from the multiple groups of candidate image processing parameters based on the sample image comparison results and the sample categories includes:
[0020] For each group of image processing parameters in the current iteration, generate a characteristic curve according to the corresponding sample comparison result and the corresponding sample category, determine the corresponding characteristic area based on the characteristic curve, and screen out the backup image processing parameter that meets the area matching condition in the current iteration based on the characteristic area;
[0021] Select the candidate image processing parameter that has not participated in the iterative calculation from the sample parameter set as the current candidate image processing parameter corresponding to the next iteration, and use the backup image processing parameter screened out in the current iteration as the backup image processing parameter required for the next iteration;
[0022] Continue to execute the step of performing image enhancement processing on the first sample face image based on the current candidate image processing parameters and the backup image processing parameters respectively to obtain third sample face images corresponding to each group of image processing parameters until all candidate image processing parameters in the sample parameter set are traversed and then stop, and screen out the image processing parameters that meet the area matching condition in the last iteration based on the feature area obtained in the last iteration;
[0023] Take the image processing parameters that meet the area matching condition in the last iteration as the target image processing parameters.
[0024] An identity authentication device, the device includes:
[0025] An acquisition module, configured to acquire a certificate video obtained by performing video acquisition on a target certificate, and screen out a target video frame that meets the image clarity condition from the certificate video;
[0026] An extraction module, configured to extract a first face image and a second face image corresponding to the target certificate from the target video frame, and the image size of the first face image is smaller than the image size of the second face image;
[0027] An image enhancement module, configured to acquire at least one group of target image processing parameters, and perform image enhancement processing on the first face image based on each group of target image processing parameters to obtain at least one third face image;
[0028] A comparison module, configured to compare each of the third face images with the second face image respectively to obtain corresponding image comparison results, and determine the identity authentication result of the target certificate according to the image comparison results.
[0029] A computer device, including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0030] Acquire a certificate video obtained by performing video acquisition on a target certificate, and screen out a target video frame that meets the image clarity condition from the certificate video;
[0031] Extract a first face image and a second face image corresponding to the target certificate from the target video frame, and the image size of the first face image is smaller than the image size of the second face image;
[0032] Acquire at least one group of target image processing parameters, and perform image enhancement processing on the first face image based on each group of target image processing parameters to obtain at least one third face image;
[0033] Compare each of the third face images with the second face image respectively to obtain corresponding image comparison results, and determine the identity verification result of the target document according to the image comparison results.
[0034] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0035] Obtain a document video obtained by video capturing of a target document, and screen out target video frames that meet the image clarity condition from the document video;
[0036] Extract a first face image and a second face image corresponding to the target document from the target video frames, wherein the image size of the first face image is smaller than that of the second face image;
[0037] Obtain at least one set of target image processing parameters, and perform image enhancement processing on the first face image respectively based on each set of target image processing parameters to obtain at least one third face image;
[0038] Compare each of the third face images with the second face image respectively to obtain corresponding image comparison results, and determine the identity verification result of the target document according to the image comparison results.
[0039] In the above identity verification method, device, computer device and storage medium, target video frames that meet the image clarity condition are screened out from a document video containing a target document to obtain clear video frames, so as to obtain a clear target document. A first face image and a second face image corresponding to the target document are extracted from the target video frames to obtain the first face image and the second face image in the target document. Since the image size of the first face image is smaller than that of the second face image, the first face image is more susceptible to the influence of light and angle during video capturing. At least one set of target image processing parameters are used to perform image enhancement processing on the first face image respectively to remove the influence of video capturing angle, light, etc. on the first face image, and at least one third face image after image enhancement processing is obtained. Each of the third face images after removing the influence of video capturing angle, light, etc. on the first face image is compared with the second face image respectively to obtain the image comparison results of the third face image and the second face image corresponding to different target image processing parameters, so as to obtain the image comparison results of different third face images obtained by different image enhancement methods and the same second face image. According to the image comparison results of different third face images and the same second face image, it is possible to accurately identify whether the two face images in the target document are the face images of the same user, so as to be able to identify the authenticity of the target document and realize the identity verification of the target document.
[0040] A training method for an image recognition model, the method comprising:
[0041] Obtain sample certificate images and determine the sample categories to which each of the sample certificate images belongs;
[0042] Extract a first sample face image and a second sample face image from the sample certificate images, wherein the image size of the first sample face image is smaller than the image size of the second sample face image;
[0043] Perform image enhancement processing on the first sample face image respectively through each group of candidate image processing parameters in the image recognition model to be trained, and obtain a third sample face image corresponding to each group of candidate image processing parameters;
[0044] Compare each of the third sample face images with the corresponding second sample face image respectively to obtain corresponding sample image comparison results;
[0045] Train the image recognition model to be trained based on the sample image comparison results and the sample categories, and stop until the training stop condition is reached, to obtain a trained target image recognition model; at least one group of target image processing parameters is included in the trained target image recognition model for authenticating the identity of a target certificate.
[0046] An apparatus for training an image recognition model, the apparatus comprising:
[0047] A sample acquisition module for obtaining sample certificate images and determining the sample categories to which each of the sample certificate images belongs;
[0048] A face extraction module for extracting a first sample face image and a second sample face image from the sample certificate images, wherein the image size of the first sample face image is smaller than the image size of the second sample face image;
[0049] A processing module for performing image enhancement processing on the first sample face image respectively through each group of candidate image processing parameters in the image recognition model to be trained, and obtaining a third sample face image corresponding to each group of candidate image processing parameters;
[0050] A comparison result obtaining module for comparing each of the third sample face images with the corresponding second sample face image respectively to obtain corresponding sample image comparison results;
[0051] A training module, configured to train the image recognition model to be trained based on the sample image comparison results and the sample categories until the training stop condition is reached, and then stop to obtain a trained target image recognition model; the trained target image recognition model includes at least one set of target image processing parameters for authenticating the identity of a target document.
[0052] A computer device, comprising a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0053] Obtain sample document images, and determine the sample categories to which the sample document images belong respectively;
[0054] Extract a first sample face image and a second sample face image from the sample document images, where the image size of the first sample face image is smaller than that of the second sample face image;
[0055] Perform image enhancement processing on the first sample face image respectively through each group of candidate image processing parameters in the image recognition model to be trained, to obtain a third sample face image corresponding to each group of candidate image processing parameters;
[0056] Compare each of the third sample face images with the corresponding second sample face image respectively to obtain corresponding sample image comparison results;
[0057] Train the image recognition model to be trained based on the sample image comparison results and the sample categories until the training stop condition is reached, and then stop to obtain a trained target image recognition model; the trained target image recognition model includes at least one set of target image processing parameters for authenticating the identity of a target document.
[0058] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0059] Obtain sample document images, and determine the sample categories to which the sample document images belong respectively;
[0060] Extract a first sample face image and a second sample face image from the sample document images, where the image size of the first sample face image is smaller than that of the second sample face image;
[0061] Perform image enhancement processing on the first sample face image respectively through each group of candidate image processing parameters in the image recognition model to be trained, to obtain a third sample face image corresponding to each group of candidate image processing parameters;
[0062] Compare each of the third sample face images with the corresponding second sample face image to obtain corresponding sample image comparison results;
[0063] Train the image recognition model to be trained based on the sample image comparison results and the sample categories until the training stop condition is reached and then stop to obtain a trained target image recognition model; the trained target image recognition model includes at least one set of target image processing parameters for authenticating the identity of a target document.
[0064] For the above image recognition model training method, device, computer device, and storage medium, in this embodiment, a first sample face image and a second sample face image are extracted from a sample document image. The image size of the first sample face image is smaller than that of the second sample face image, so the first sample face image is more susceptible to the influence of light and angle during image acquisition. The first sample face image is subjected to image enhancement processing respectively by each set of target image processing parameters in the image recognition model to be trained to remove the influence of image acquisition angle, light, etc. on the first sample face image, and each third sample face image after image enhancement processing to different degrees is obtained. After excluding the interference caused by angle, light, etc., each third sample face image is compared with the corresponding second sample face image to obtain corresponding sample image comparison results. Based on the difference between the sample image comparison results and the sample categories, the target image processing parameters with the best image enhancement effect can be selected from multiple sets of image processing parameters. By using the trained image recognition model to authenticate the identity of a target document, the authenticity of the target document can be accurately identified, and the accuracy of identity authentication can be improved. The trained image recognition model has high recognition accuracy and fast calculation speed, and can improve the efficiency of identity authentication of the target document. Description of the Drawings
[0065] Figure 1 It is an application environment diagram of the identity authentication method in an embodiment;
[0066] Figure 2 It is a flowchart of the identity authentication method in an embodiment;
[0067] Figure 3 It is an interface diagram for calculating the horizontal tilt angle in an embodiment;
[0068] Figure 4 It is a schematic diagram of the face key point detection result in another embodiment;
[0069] Figure 5 It is an application scenario of identity authentication in an embodiment;
[0070] Figure 6Schematic flowchart of steps for determining target image processing parameters in one embodiment;
[0071] Figure 7 Schematic flowchart of a training method for an image recognition model in one embodiment;
[0072] Figure 8 Schematic flowchart of steps for obtaining third sample face images corresponding to each group of candidate image processing parameters in one embodiment;
[0073] Figure 9 Schematic flowchart of performing image enhancement processing on a group of candidate image processing parameters of an image recognition model in one embodiment;
[0074] Figure 10 Schematic diagram of a test process of an image recognition model in one embodiment;
[0075] Figure 11 Structural block diagram of an identity authentication device in one embodiment;
[0076] Figure 12 Structural block diagram of a training device for an image recognition model in one embodiment;
[0077] Figure 13 Internal structure diagram of a computer device in one embodiment. Detailed implementation manners
[0078] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0079] The present application relates to the technical field of artificial intelligence (AI). Among them, artificial intelligence is to use a digital computer or a machine controlled by a digital computer to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results in theory, method, technology and application system. In other words, artificial intelligence is a comprehensive technology of computer science. It attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence is also to study the design principles and implementation methods of various intelligent machines to make the machines have the functions of perception, reasoning and decision-making. The solution provided in the embodiment of the present application relates to an identity authentication method of artificial intelligence, and will be specifically described through the following embodiments.
[0080] The identity authentication method provided by the present application can be applied to an identity authentication system as shown in Figure 1 shown. As shown in Figure 1As shown in the figure, the authentication system includes a terminal 110 and a server 120. In one embodiment, both the terminal 110 and the server 120 can independently execute the authentication method provided in the embodiments of the present application. The terminal 110 and the server 120 can also be used in cooperation to execute the authentication method provided in the embodiments of the present application. When the terminal 110 and the server 120 are used in cooperation to execute the authentication method provided in the embodiments of the present application, the terminal 110 acquires a document video obtained by video-capturing a target document, and sends the document video to the server 120. The server 120 filters out target video frames that meet the image clarity condition from the document video, and extracts a first face image 112 and a second face image 114 corresponding to the target document from the target video frames. The image size of the first face image 112 is smaller than that of the second face image 114. The server 120 acquires at least one set of target image processing parameters, and respectively performs image enhancement processing on the first face image based on each set of target image processing parameters to obtain at least one third face image. The server 120 respectively compares each third face image with the second face image to obtain corresponding image comparison results, and determines the authentication result of the target document according to the image comparison results. The server 120 returns the authentication result of the target document to the terminal 110.
[0081] Among them, the terminal 110 can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices. The server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal 110 and the server 120 can be directly or indirectly connected through wired or wireless communication methods, which are not limited in this application.
[0082] In one embodiment, as Figure 2 shown, a method for authentication is provided. Taking the method applied to Figure 1 the computer device in Figure 1 (the computer device can specifically be the terminal or server in
[0083] Step S202: Acquire a document video obtained by video-capturing a target document, and filter out target video frames that meet the image clarity condition from the document video.
[0084] Among them, the target certificate is a certificate used to represent the user's identity, such as the resident identity card, Hong Kong and Macau permit, or temporary residence permit corresponding to different regions. The certificate video refers to the video obtained by video capturing the target certificate. During the video capturing process, the target certificate can be kept stable and stationary for display, or can be flipped for display, etc. When the target certificate is flipped for display, it can specifically be at least one of tilting up and down, flipping up and down, or tilting left and right, flipping up and down. When the target certificate is kept stable and stationary, the corresponding video capturing device can also be kept stable and stationary, or the capturing angle can be changed during the video capturing process. The embodiments of the present application do not limit this.
[0085] The image clarity condition refers to a preset condition related to the clarity degree of the image, including the certificate clarity condition. The certificate clarity condition can be characterized by the tilting angle of the certificate.
[0086] In one embodiment, the image clarity condition may further include a face clarity condition, and the face clarity condition can be characterized by the blurriness of the face image.
[0087] Specifically, the computer device can obtain the certificate video obtained by video capturing the target certificate. When the computer device is a server, the computer device can obtain the certificate video uploaded by the terminal, or can obtain the certificate video stored in the server, and the stored certificate video is obtained by the terminal pre-video capturing the target certificate.
[0088] When the computer device is a terminal, the terminal can obtain the certificate video pre-video captured locally, or obtain the certificate video obtained by video capturing from a third-party terminal.
[0089] In this embodiment, the terminal can video capture the target certificate through the camera to obtain the corresponding certificate video. Further, during the video capturing process, the target certificate can be flipped up and down or flipped left and right at least one time to obtain the corresponding certificate video.
[0090] After the computer device obtains the certificate video, for each candidate video frame in the certificate video, it determines whether the candidate video frame meets the image clarity condition, and uses the video frame that meets the image clarity condition as the target video frame.
[0091] Further, when the image clarity condition is the certificate clarity condition, the candidate video frames that meet the certificate clarity condition are captured from the certificate video as the target video frames. When the image clarity condition is the face clarity condition, the candidate video frames that meet the face clarity condition are captured from the certificate video as the target video frames. When the image clarity condition includes the certificate clarity condition and the face clarity condition, the candidate video frames that meet both the certificate clarity condition and the face clarity condition are captured from the certificate video as the target video frames.
[0092] In one embodiment, the computer device may extract a preset number of candidate video frames from the document video. The extracting of a preset number of candidate video frames from the document video includes: determining the video duration of the document video, determining candidate moments for extracting each candidate video frame based on the video duration of the document video and the preset number, and extracting video frames from each candidate moment in the document video to obtain a preset number of candidate video frames. For example, if 5 candidate video frames are to be extracted from a document video with a duration of 50 seconds, then video frames can be extracted every 10 seconds, and the candidate video frames at 10, 20, 30, 40, and 50 seconds can be obtained.
[0093] In one embodiment, the computer device may obtain a document video obtained by video-capturing a target document, and screen out a first face image that meets the image clarity condition from the document video. Further, the computer device may determine whether the first face images in each candidate video frame in the document video meet the image clarity condition, so as to screen out each first face image that meets the image clarity condition.
[0094] Step S204: Extract a first face image and a second face image corresponding to the target document from the target video frame, where the image size of the first face image is smaller than that of the second face image.
[0095] Specifically, the target document includes a first face image and a second face image. The image size of the first face image is smaller than that of the second face image. For each frame of the target video frame, the computer device may perform target face detection on the target video frame to segment out the first face image and the second face image in the target video frame.
[0096] Step S206: Obtain at least one set of target image processing parameters, and respectively perform image enhancement processing on the first face image based on each set of target image processing parameters to obtain at least one third face image.
[0097] Among them, image enhancement processing refers to a processing method of clarifying a blurred image or enhancing the features of the region of interest and suppressing the features of the non-region of interest. Image processing parameters are parameters used for image enhancement processing.
[0098] The target image processing parameters may include at least one of a de-stripe parameter, a sharpening parameter, a de-white noise parameter, and a de-haze parameter. The de-stripe parameter is used to remove stripes in the image, the sharpening parameter is used to enhance the contrast of the image, the de-white noise parameter is used to remove white noise in the image, and the de-haze parameter is used to remove the fogging effect in the image. Contrast refers to the degree of light and dark contrast of the image. White noise refers to noise with equal noise energy contained in each equal-bandwidth frequency band within a relatively wide frequency range.
[0099] Specifically, the computer device obtains at least one set of target image processing parameters. For each set of target image processing parameters obtained, the first face image is subjected to image enhancement processing using the target image processing parameters to obtain a third face image corresponding to the target image processing parameters, thereby obtaining third face images corresponding to each set of target image processing parameters respectively.
[0100] When the target image processing parameters include at least two processing sub-parameters, the first face image is subjected to image enhancement processing in accordance with the processing order corresponding to each processing sub-parameter. Moreover, for the processing sub-parameters in the same set of target image processing parameters, the image obtained by processing the previous processing sub-parameter is used as the object for processing the next processing sub-parameter. For example, if a set of target image processing parameters includes a de-stripe parameter, a sharpening parameter, and a denoising parameter, the first face image can be subjected to de-stripe processing using the de-stripe parameter, the image obtained after stripe processing can be subjected to sharpening processing using the sharpening parameter, and then the image obtained after sharpening parameter processing can be subjected to denoising processing using the denoising parameter to obtain a third face image corresponding to this set of target image processing parameters.
[0101] Step S208: Each third face image is compared with the second face image respectively to obtain a corresponding image comparison result, and the identity verification result of the target document is determined according to the image comparison result.
[0102] Among them, the image comparison result includes at least one of the similarity and the difference degree between the third face image and the second face image respectively. The identity verification result includes verification passed and verification failed.
[0103] Specifically, for each third face image, the computer device calculates the similarity between the third face image and the second face image, and uses the similarity as the image comparison result. When the similarity is greater than a preset similarity threshold, it is determined that the identity verification of the target document has passed. When the similarity is less than or equal to the preset similarity threshold, it is determined that the identity verification of the target document has failed. For example, the preset similarity threshold is 0.65. Verification passed indicates that the target document is a genuine document, that is, the first face image and the second face image in the target image are the face images of the same person. Verification failed indicates that the target document is a forged document, that is, the first face image and the second face image in the target image are not the face images of the same person.
[0104] In one embodiment, the computer device compares each similarity with the preset similarity threshold respectively. When each similarity is greater than the preset similarity threshold, it is determined that the identity verification result of the target document is verification passed.
[0105] In one embodiment, the computer device compares each similarity with a preset similarity threshold. When there are a specified number of similarities that are all greater than the preset similarity threshold, it determines that the authentication result of the target certificate is passed.
[0106] In one embodiment, for each third face image, the computer device calculates the difference degree between the third face image and the second face image, and uses the difference degree as the image comparison result. Further, the computer device compares each difference degree with a preset difference degree threshold. When each difference degree is less than the preset difference degree threshold, it determines that the authentication result of the target certificate is passed.
[0107] In one of the embodiments, the computer device compares each difference degree with a preset difference degree threshold. When there are a specified number of difference degrees that are less than the preset difference degree threshold, it determines that the authentication result of the target certificate is passed.
[0108] In the above authentication method, the target video frames that meet the image clarity condition are screened out from the certificate video containing the target certificate to obtain clear video frames, so as to obtain a clear target certificate. The first face image and the second face image corresponding to the target certificate are extracted from the target video frames, so as to obtain the first face image and the second face image in the target certificate. If the image size of the first face image is smaller than that of the second face image, the first face image is more susceptible to the influence of light and angle during video acquisition. The first face image is subjected to image enhancement processing by at least one set of target image processing parameters to remove the influence of video acquisition angle, light, etc. on the first face image, and at least one third face image after image enhancement processing is obtained. Each third face image after removing the influence of video acquisition angle, light, etc. on the first face image is compared with the second face image respectively, and the image comparison results of the third face image and the second face image corresponding to different target image processing parameters are obtained, so as to obtain the image comparison results of different third face images obtained by different image enhancement methods and the same second face image. According to the image comparison results of different third face images and the same second face image, it can accurately identify whether the two face images in the target certificate are the face images of the same user, so as to be able to identify the authenticity of the target certificate and realize the authentication of the identity of the target certificate.
[0109] In one embodiment, the first face image is a three-dimensional face image. Screening out the target video frames that meet the image clarity condition from the certificate video includes:
[0110] Extract more than one candidate video frame from the document video; detect the target documents in each candidate video frame respectively to determine the document tilt angles corresponding to the target documents in each candidate video frame; based on the document tilt angles, screen out the alternative video frames that meet the document clarity condition from the candidate video frames; detect the stereo face images corresponding to the target documents in each alternative video frame to determine the face blurriness corresponding to the stereo face images in each alternative video frame; based on the face blurriness, screen out the target video frames that meet the face clarity condition from the alternative video frames.
[0111] Among them, the face blurriness is used to characterize the clarity of the face image. The smaller the face blurriness, the clearer the face image.
[0112] Specifically, the target document includes a first face image and a second face image. The first face image is a stereo image, and the second face image is a planar face image. Stereo face images are easily affected by factors such as light and acquisition angle, and the clarity of the face images detected at different angles is different.
[0113] The image clarity condition includes the document clarity condition and the face clarity condition. The document clarity condition is characterized by the tilt angle of the document, and the face clarity condition is characterized by the blurriness of the face image.
[0114] The computer device can extract more than one candidate video frame from the document video. For example, the computer device can extract a preset number of candidate video frames from the document video. For each frame of candidate video frame, the computer device can detect the tilt angle corresponding to the candidate video frame in the document video, and use the tilt angle of the candidate video frame in the document video as the document tilt angle corresponding to the target document in the candidate video frame. The computer device can determine whether the document tilt angle meets the document clarity condition, and use the candidate video frames that meet the document clarity condition as alternative video frames.
[0115] For each frame of alternative video frame, the computer device can perform face blurriness detection on the stereo face image in the alternative video frame, that is, the first face image, to determine the face blurriness of the stereo face image in the alternative video frame. The computer device can determine whether the face blurriness meets the face clarity condition, and use the alternative video frames that meet the face clarity condition as target video frames.
[0116] In one embodiment, the document clarity condition includes: screening out the first preset number of video frames from the smallest to the largest based on the tilt angle. After the computer device determines the document tilt angles corresponding to each candidate video frame respectively, it screens out the first preset number of document tilt angles from the smallest to the largest among the various document tilt angles, and uses the candidate video frames corresponding to the screened document tilt angles as alternative video frames.
[0117] The face clarity condition includes: screening out a second preset number of video frames from the smallest to the largest based on the face blurriness. The computer device can determine the face blurriness corresponding to the three-dimensional face image in each candidate video frame, screen out a second preset number of face blurriness values from all the face blurriness values from the smallest to the largest, and use the candidate video frames corresponding to the screened face blurriness values as target video frames. The smaller the face blurriness, the clearer each part of the face is.
[0118] In one embodiment, the document clarity condition includes an inclination angle threshold, and the face clarity condition includes a face clarity threshold. The computer device can compare each document inclination angle with the inclination angle threshold. When the document inclination angle is less than or equal to the inclination angle threshold, the computer device uses the candidate video frames with the document inclination angle less than or equal to the inclination angle threshold as candidate video frames.
[0119] In one embodiment, when there are no candidate video frames with a document inclination angle less than or equal to the inclination angle threshold, a preset number of candidate video frames with the smallest inclination angle are selected as candidate video frames.
[0120] The computer device can determine the face blurriness corresponding to the three-dimensional face image in each candidate video frame, compare each face blurriness with the face blurriness threshold. When the face blurriness is less than or equal to the face blurriness threshold, the computer device uses the candidate video frames with the face blurriness less than or equal to the face blurriness threshold as candidate video frames.
[0121] It can be understood that the document clarity condition and the face clarity condition do not limit the order of judgment. The computer device extracts more than one frame of candidate video frames from the document video; detects the three-dimensional face images corresponding to the target documents in each candidate video frame to determine the face blurriness corresponding to each three-dimensional face image in each candidate video frame; based on the face blurriness, screens out candidate video frames that meet the face clarity condition from the candidate video frames; detects the target documents in each candidate video frame respectively to determine the document inclination angle corresponding to the target document in each candidate video frame; based on the document inclination angle, screens out target video frames that meet the document clarity condition from the candidate video frames.
[0122] In one embodiment, both the first face image and the second face image are three-dimensional face images. The computer device can determine whether the first face image and the second face image meet the document clarity condition and the face clarity condition respectively in a similar manner. The computer device uses the same candidate video frame where the first video frame and the second video frame that simultaneously meet the document clarity condition and the face clarity condition are located as the target video frame.
[0123] In this embodiment, the three-dimensional face image is easily affected by factors such as light and acquisition angle, and the clarity of the face images detected at different tilt angles is different. Then, the tilt angle of the target document in the document video and the face blurriness of the three-dimensional face image can be used to determine whether the target document is clear, so as to screen out the video frames corresponding to the three-dimensional face images in which all parts are in a clear state in the document video.
[0124] In one embodiment, the target documents in each candidate video frame are respectively detected to determine the document tilt angles corresponding to the target documents in each candidate video frame, including:
[0125] The target documents in each candidate video frame are respectively detected, and a candidate boundary region including the target document is segmented from the candidate video frame; for each candidate video frame, the boundary angle formed by the corresponding candidate boundary region and the preset boundary region is respectively determined, and the boundary angle is used as the document tilt angle corresponding to the target document in the corresponding candidate video frame.
[0126] Specifically, for each candidate video frame extracted by the computer device, the target document in the candidate video frame is detected to segment the candidate boundary region where the target document is located from the candidate video frame, so as to obtain the candidate boundary region corresponding to the target document in each candidate video frame. Further, the computer device can perform target detection on the candidate video frame to obtain the candidate boundary region of the target document in the candidate video frame.
[0127] The computer device can calculate the boundary angle formed by each candidate boundary region and the preset boundary region, and use the boundary angle as the document tilt angle corresponding to the target document in the corresponding candidate video frame.
[0128] Further, the preset boundary region includes a horizontal boundary region and a vertical boundary region. The computer device can calculate the boundary angle formed by the same candidate boundary region and the horizontal boundary region, and the boundary angle formed by the same candidate boundary region and the vertical boundary region. In the same processing manner, the boundary angles formed by each candidate boundary region and the horizontal boundary region and the vertical boundary region can be calculated respectively, so as to obtain two document tilt angles corresponding to each candidate boundary region respectively.
[0129] In this embodiment, for each candidate video frame, the boundary angle formed by the corresponding candidate boundary region and the preset boundary region is respectively determined. The candidate boundary region is the region where the target document is located in the candidate video frame, so the boundary angle can accurately represent the tilt angle of the target document in the document video.
[0130] In one embodiment, the document tilt angle includes a horizontal tilt angle and a vertical tilt angle, and the preset boundary region includes a horizontal boundary region and a vertical boundary region; for each candidate video frame, the boundary angle formed by the corresponding candidate boundary region and the preset boundary region is determined respectively, and the boundary angle is used as the document tilt angle corresponding to the target document in the corresponding candidate video frame, including:
[0131] For each candidate video frame, the length information of the corresponding candidate boundary region and the projection information corresponding to the tilt of the corresponding candidate boundary region are obtained; for each candidate video frame, based on the boundary length information of the corresponding candidate boundary region and the corresponding projection information, the horizontal tilt angle between the candidate boundary region and the horizontal boundary region and the vertical tilt angle between the candidate boundary region and the vertical boundary region are calculated.
[0132] Among them, the length information of the candidate boundary region includes the horizontal boundary length and the vertical boundary length forming the candidate boundary region, such as the length and width of the candidate boundary region.
[0133] Specifically, the document tilt angle includes a horizontal tilt angle and a vertical tilt angle, and the preset boundary region includes a horizontal boundary region and a vertical boundary region. The computer can obtain the length information of the target document, and based on the length information of the target document, determine the length information of the candidate boundary region in the corresponding candidate video frame, and. The length information of the target document refers to the actual horizontal boundary length and vertical boundary length of the target document, such as the true length and width of the target document.
[0134] For example, the computer device performs physical measurement on the target document to obtain the length and width of the target document, and takes the length and width of the target document as the length information of the target document. The computer device performs video acquisition on the target document to obtain a document video, and the computer device can determine the length information of the target document in the video through the length information of the target document and the acquisition magnification of the video acquisition.
[0135] The computer device can determine the corresponding horizontal projection area when each candidate boundary area is tilted in the horizontal boundary area, and determine the corresponding vertical projection area when the candidate boundary area is tilted in the vertical boundary area. The computer device can detect the projection information of the horizontal projection area and the projection information of the vertical projection area. The computer calculates the horizontal tilt angle between the candidate boundary area and the horizontal projection area based on the length information of the candidate boundary area and the projection information of the corresponding horizontal projection area. The horizontal tilt angle between the candidate boundary area and the horizontal projection area is used as the horizontal tilt angle between the candidate boundary area and the horizontal boundary area. The computer calculates the vertical tilt angle between the candidate boundary area and the vertical projection area based on the length information of the candidate boundary area and the projection information of the corresponding vertical projection area. The vertical tilt angle between the candidate boundary area and the vertical projection area is used as the vertical tilt angle between the candidate boundary area and the vertical boundary area.
[0136] According to the same calculation method, the computer can calculate the horizontal tilt angle formed by each candidate boundary area and the horizontal boundary area, and the vertical tilt angle formed by the candidate boundary area and the vertical boundary area.
[0137] Such as Figure 3 shown, it is a schematic diagram of the interface for calculating the horizontal tilt angle in an embodiment. Such as Figure 3 shown in (a) is the actual target document S302. The length information of the target document S302 includes length w1 and width h1. Figure 3 Shown in (b) is a candidate boundary area S304 in a candidate video frame in the document video. The length information of the candidate boundary area S304 includes length w2 and width h2. The candidate boundary area is similar to the target document, that is:
[0138]
[0139] The computer device determines the corresponding horizontal projection area S306 when the candidate boundary area S304 is tilted in the horizontal boundary area. The computer device can detect the projection information of the horizontal projection area S306, that is, the length and width d of the horizontal projection area S306. The computer device calculates the included angle α between h2 and d, and uses the included angle α as the horizontal tilt angle between the candidate boundary area S304 and the horizontal boundary area. The calculation method of the included angle α is as follows:
[0140]
[0141] In this embodiment, the projection information of the target document when tilted is detected in the horizontal boundary region and the vertical boundary region respectively. Based on the length information of the candidate boundary region and the projection information in the horizontal boundary region, the tilt angle formed by the candidate boundary region and the horizontal boundary region can be accurately calculated. Based on the length information of the candidate boundary region and the projection information in the vertical boundary region, the tilt angle formed by the candidate boundary region and the vertical boundary region can be accurately calculated. Thus, the two tilt angles of the same candidate boundary region in different directions are used as the conditions for screening the target video frames, so that the target video frames corresponding to the clearer target document can be screened out.
[0142] In one embodiment, the stereo face images corresponding to the target document in each spare video frame are detected to determine the face blurriness corresponding to the stereo face images in each spare video frame, including:
[0143] The stereo face images corresponding to the target document in each spare video frame are detected respectively to obtain the face key point detection results in each spare video frame; based on the face key point detection results in each spare video frame, the face blurriness corresponding to each spare video frame is determined.
[0144] Specifically, the computer device can perform face detection on each spare video frame to determine the stereo face images corresponding to the target document in each spare video frame. The computer device performs face key point detection on the stereo face images respectively, and the computer device obtains the face key point detection results based on the face key points corresponding to the stereo face images. The face key point detection results include the key points of each part of the detected face, such as at least one of the key points of the left eye, the right eye, the nose, the mouth, and the hairline.
[0145] For each frame of the spare video frame, the computer device can obtain the gray values of the face key points in the stereo face image of the spare video frame, calculate the gradient values of the face key points based on the gray values of the face key points, and perform normalization processing on the gradient values of the face key points. The computer device can use the sum of the products of the gradient values of the face key points after normalization processing as the corresponding face blurriness.
[0146] In one embodiment, the computer device can obtain the weights corresponding to the key points of different parts, and use the sum of the products of the gradient values of the key points after normalization processing and the corresponding weights as the corresponding face blurriness.
[0147] In this embodiment, facial key point detection is performed on the three-dimensional facial image. Based on the facial key point detection results, the blur change of the image can be reflected from various parts of the face. Moreover, only the key points of each part of the face are used to calculate the blur degree, which can reduce the amount of calculation. The gradient value is relatively sensitive to blur, and using the gradient value of the key points can accurately calculate the blur degree of the image.
[0148] As Figure 4 shown, it is a schematic diagram of the facial key point detection results in an embodiment. As Figure 4 shown in (a) of Figure 4 it, the key points of the left eye, the right eye, the nose, the mouth, and the hairline in this three-dimensional facial image can be collected. As Figure 4 shown in (a) of Figure 4 it, the key points of the right eye, the nose, the mouth, and the hairline can be collected. As Figure 4 shown in (c) of
[0149] it, the key points of the right eye can be collected. As
[0150] shown in (d) of
[0151] it, the key points of each part of the face cannot be collected. Based on the gradient value of the key points, the blur degrees of (a), (b), (c), and (d) in Figure 4 can be determined: (a) < (b) < (c) < (d).
[0149] In one embodiment, each set of target image processing parameters includes at least one processing sub-parameter corresponding to each image processing method; based on each set of target image processing parameters, image enhancement processing is respectively performed on the first facial image to obtain at least one third facial image, including:
[0150] For each set of target image processing parameters, based on the corresponding processing sub-parameters, and in accordance with the image processing methods respectively corresponding to each processing sub-parameter, image enhancement processing is sequentially performed on the first facial image until the corresponding third facial image is obtained; the multiple image processing methods include at least one of despeckling, sharpening, and denoising.
[0151] Among them, despeckling can be achieved through despeckling parameters, and the image processing method corresponding to the despeckling parameters can be wavelet transform, but is not limited thereto. The despeckling parameters may include the wavelet transform type and the number of wavelet transforms. Wavelet transform extracts the information of interest from the image signal through local transformation between the spatial domain and the frequency domain, or local transformation between the time domain and the frequency domain. The wavelet transform types include Haar Wavelet, symlets Wavelets, Daubechies Wavelets, etc., but are not limited thereto. Further, Daubechies Wavelets is also divided into multiple wavelets, such as db1, db2... dbN. symlets Wavelets is also divided into multiple wavelets, such as sym1, sym2,... symN.
[0152] The number of wavelet transform times refers to the depth of wavelet decomposition. The number of wavelet transform times can be 1, 2, 3, etc., but is not limited thereto. Different numbers of wavelet transform times have different processing methods. For example, when the number of wavelet transform times is 1, the wavelet is first forward-transformed once, decomposing one low-frequency information and three high-frequency sub-bands. The low-frequency information refers to the average information, and the three high-frequency sub-bands refer to the horizontal, vertical, and diagonal sub-bands. When the number of wavelet transform times is 2, the wavelet is first forward-transformed once, decomposing one low-frequency information and three high-frequency sub-bands: horizontal, vertical, and diagonal sub-bands. The diagonal sub-band includes regular noises such as stripes and white noises, etc. Then, it is decomposed again on the low-frequency information. After two transformations, the horizontal and vertical sub-band images are set to zero, and then it is converted into a noise-free image by two inverse wavelet transforms.
[0153] Sharpening refers to enhancing the contrast effect of an image, which can be achieved by histogram equalization, but is not limited thereto. Histogram equalization assigns different weights to image regions with different saturations and brightnesses for histogram equalization. After the image equalization process, the histogram of the image is flat, that is, each gray level has the same occurrence frequency. Since the gray levels have a uniform probability distribution, the image becomes clearer.
[0154] The corresponding image processing method for removing white noise can be mean filtering, but is not limited thereto.
[0155] Specifically, each set of target image processing parameters includes at least one processing sub-parameter corresponding to each image processing method. For example, the de-stripe parameter corresponding to de-stripe processing, the sharpening parameter corresponding to sharpening processing, and the white noise removal parameter corresponding to white noise removal. De-stripe processing can include removing at least one of horizontal stripes, vertical stripes, and oblique stripes.
[0156] For each set of target image processing parameters obtained, the computer device can obtain the processing sub-parameters in the target image processing parameters, and perform corresponding processing on the first face image according to the image processing methods and processing orders corresponding to the respective processing sub-parameters. Moreover, for each processing sub-parameter in the same set of target image processing parameters, the image obtained by processing the previous processing sub-parameter is used as the object to be processed by the next processing sub-parameter.
[0157] In one embodiment, the image processing method corresponding to the de-striation parameter is wavelet transform, the image processing method corresponding to the sharpening parameter is histogram equalization, and the processing method corresponding to the de-noising parameter is mean filtering. For example, a set of target image processing parameters includes three processing sub-parameters: de-striation parameter, sharpening parameter, and de-noising parameter. The computer device can perform de-striation processing on the first face image through the wavelet transform method corresponding to the de-striation parameter, perform sharpening processing on the image obtained after the de-striation processing through the histogram equalization method corresponding to the sharpening parameter, and then perform de-noising processing on the image obtained after the sharpening parameter processing through the mean filtering method corresponding to the de-noising parameter to obtain the third face image corresponding to the set of target image processing parameters.
[0158] In this embodiment, for each set of target processing parameters, according to the image processing methods corresponding to the processing sub-parameters in each set of target image processing parameters, the first face image is sequentially subjected to de-striation, sharpening, de-noising, etc., so as to obtain the third face image after de-striation, sharpening, and de-noising. The processing sub-parameters of de-striation, sharpening, and de-noising for each third face image are different, so the degrees of de-striation, sharpening, and de-noising for each third face image are different, thereby obtaining multiple third face images with different degrees of image enhancement processing.
[0159] In one embodiment, each third face image is compared with the second face image respectively to obtain the corresponding image comparison result, and the identity verification result of the target certificate is determined according to the image comparison result, including:
[0160] Calculate the similarity between each third face image and the second face image respectively; determine the maximum value in the similarities. When the maximum value is greater than the preset similarity threshold, determine that the identity verification result of the target certificate is verified.
[0161] Specifically, for each third face image, the computer device calculates the similarity between the third face image and the second face image to obtain each similarity. The computer device can determine the maximum value in each similarity and compare the similarity corresponding to the maximum value with the preset similarity threshold. When the maximum value is greater than the preset similarity threshold, determine that the identity verification result of the target certificate is verified.
[0162] In this embodiment, the similarity between each third face image after image enhancement processing and the second face image is calculated, so that the identity verification result of the target certificate can be accurately judged based on the comparison result between the maximum similarity and the preset similarity threshold.
[0163] In one embodiment, the first face image is a three-dimensional face image, and the method further includes: obtaining multiple frames of video frames to be compared corresponding to different perspectives from the document video; comparing the three-dimensional face images in the multiple frames of video frames to be compared to obtain corresponding angle comparison results;
[0164] Determine the identity verification result of the target document according to the image comparison result, including: determining the identity verification result of the target document according to the image comparison result and the angle comparison result.
[0165] Specifically, the computer device obtains the video frames to be compared corresponding to different degrees of inclination of the target document from the document video. For example, the computer device obtains the video frames corresponding to the target document inclined at 10°, 15°, and 30° in the document video to obtain the video frames to be compared.
[0166] The computer device can perform target face detection on each frame of the video frames to be compared to determine the three-dimensional face image in each frame of the video frames to be compared. The computer device can compare the three-dimensional face images to obtain corresponding angle comparison results. Further, the computer device can calculate the similarity or difference degree between the three-dimensional face images.
[0167] The computer device determines the identity verification result of the target document according to each image comparison result and each angle comparison result. Further, the computer device obtains the first verification result of the target document according to the image comparison result, and obtains the second verification result of the target document according to the angle comparison result. When the first verification result and the second verification result are the same, it is determined that the identity verification of the target document is successful. When the first verification result and the second verification result are different, it is determined that the identity verification of the target document fails.
[0168] In this embodiment, the three-dimensional face images detected from different perspectives vary greatly. Multiple frames of video frames to be compared from different perspectives in the document video are obtained to compare the three-dimensional face images from different perspectives, so as to determine the similarity or difference degree between the three-dimensional face images from different perspectives. A low similarity or a large difference degree indicates that the three-dimensional face image may be obtained by fusing multiple different face images, and then the three-dimensional face image is a forged face image. Based on the similarity or difference degree between the three-dimensional face images from different perspectives, it is possible to identify whether the three-dimensional face image is a forged face, thereby improving the accuracy of identity verification of the target document. Combining the image comparison result and the angle comparison result can use two different methods to perform identity verification on the target document, further improving the accuracy of identity verification, and thus improving the security of user information.
[0169] As Figure 5 shown, it is an application scenario of identity verification in one embodiment.
[0170] The front end collects the ID video through the SDK (Software Development Kit) and sends the ID video to the back end. The back end uses the identity verification methods in each embodiment to verify the target ID in the ID video and obtains the identity verification result. The back end returns the identity verification result to the front end. The front end makes corresponding actions based on the identity verification result. When the identity verification result is successful, the user is allowed to perform corresponding business processes. When the identity verification result is failed, the user is refused to perform any business processes, or it is prompted that there is an abnormality with the target ID.
[0171] For example, if a user needs to handle business at a bank, the ID of the user is verified through the identity verification methods in each embodiment. If the verification is successful, the user is allowed to handle relevant banking services, such as opening a bank account, getting a bank card, modifying personal information, querying personal information, etc.
[0172] In one embodiment, as Figure 6 shown, the method further includes:
[0173] Step S602, obtaining sample ID images and determining the sample categories to which the sample ID images belong respectively.
[0174] Among them, the sample categories include positive categories and negative categories. The positive category indicates that the sample ID image is a real ID image, that is, the first sample face image and the second sample face image in the sample ID image are the face images of the same person. The negative category indicates that the sample ID image is a forged ID image, that is, the first sample face image and the second sample face image in the sample ID image are not the face images of the same person.
[0175] Specifically, the computer device can obtain the sample ID video obtained by video capturing the sample ID. The computer device can extract each sample video frame from the sample ID video and segment the sample ID images from each sample video frame to obtain each sample ID image. The first sample face image in the sample ID can be a real face image or a forged face image.
[0176] Step S604, extracting the first sample face image and the second sample face image from the sample ID image, where the image size of the first sample face image is smaller than that of the second sample face image.
[0177] Specifically, the sample ID image contains the first sample face image and the second sample face image. The image size of the first face image is smaller than that of the second face image. For each frame of the sample video frame, the computer device can perform face detection on the sample video frame to segment the first sample face image and the second sample face image in the sample video frame.
[0178] In one embodiment, the first sample face image is a three-dimensional face image, and the second sample face image is a two-dimensional face image.
[0179] In one of the embodiments, both the first sample face image and the second sample face image are three-dimensional face images.
[0180] Step S606: Obtain multiple groups of candidate image processing parameters, and perform image enhancement processing on the first sample face image respectively based on each group of candidate image processing parameters to obtain a third sample face image corresponding to each group of candidate image processing parameters.
[0181] Specifically, the computer device obtains multiple groups of candidate image processing parameters, where "multiple groups" means at least two groups. For each group of candidate image processing parameters obtained, perform image enhancement processing on the first sample face image through the candidate image processing parameters to obtain the third sample face image corresponding to this group of candidate image processing parameters, so as to obtain the third sample face images corresponding to each group of candidate image processing parameters respectively.
[0182] In one embodiment, each group of image processing parameters includes multiple processing sub-parameters, and each processing sub-parameter corresponds to its own image processing method. For each group of candidate image processing parameters, the computer device obtains each processing sub-parameter in the candidate image processing parameters, and performs image enhancement processing on the first face image according to the processing sequence corresponding to each processing sub-parameter. Moreover, for each processing sub-parameter in the same group of candidate image processing parameters, use the image processed by the previous processing sub-parameter as the object to be processed by the next processing sub-parameter until the third sample face image processed by the image processing method corresponding to the last processing sub-parameter is obtained.
[0183] Step S608: Compare each third sample face image with the corresponding second sample face image respectively to obtain the corresponding sample image comparison result.
[0184] Among them, the sample image comparison result includes at least one of the similarity and the difference degree between the third sample face image and the second sample face image respectively.
[0185] Specifically, for each third sample face image, the computer device calculates the similarity between the third sample face image and the second sample face image, and uses the similarity as the sample image comparison result.
[0186] In one embodiment, for each third sample face image, the computer device calculates the difference degree between the third sample face image and the second sample face image, and uses the difference degree as the sample image comparison result.
[0187] Step S610: Based on the sample image comparison results and sample categories, at least one set of target image processing parameters is selected from multiple sets of candidate image processing parameters.
[0188] Specifically, the computer device generates a characteristic curve according to each sample comparison result and the corresponding sample category, and determines the corresponding characteristic area based on the characteristic curve. The computer device selects the candidate image processing parameters that meet the area matching condition from multiple sets of candidate image processing parameters as the target image processing parameters.
[0189] The characteristic curve can be an ROC curve (receiver operating characteristic curve), also known as a sensitivity curve. The receiver operating characteristic curve is a coordinate graph with the false positive rate (FPR) as the horizontal axis and the true positive rate (TPR) as the vertical axis, and a curve drawn from different results obtained by the subject under specific stimulus conditions due to different judgment criteria.
[0190] The sample certificate images are divided into positive or negative classes. For a binary classification, there are 4 cases: a positive sample certificate image is predicted as positive, which is a true positive (TP); a negative sample certificate image is predicted as positive, which is called a false positive (FP); a negative sample certificate image is predicted as negative, which is called a true negative (TN); a positive sample certificate image is predicted as negative, which is called a false negative (FN).
[0191] The true positive rate TPR refers to the proportion of the number of true positives TP to the number of all positive sample certificate images, and the calculation formula is TPR = TP / (TP + FN). The false positive rate FPR refers to the proportion of the number of sample certificate images that are identified as positive but are actually negative to the number of all negative sample certificate images, and the calculation formula is FPR = FP / (FP + TN). The characteristic area can be the AUC area (Area under Curve).
[0192] In one embodiment, for each set of candidate image processing parameters, the computer device determines the respective sample image comparison results corresponding to each set of candidate image processing parameters. For example, if there are 3 sets of image processing parameters and 100 sample ID images, then each set of image processing parameters performs image enhancement processing on the first sample face image in the processing of 100 sample IDs, and the 100 sample image comparison results corresponding to each set of image processing parameters. The computer device calculates the false positive probability and the true positive probability corresponding to each set of candidate image processing parameters according to the respective sample image comparison results corresponding to each set of candidate image processing parameters and the corresponding sample categories. In the same way, the computer device can obtain the false positive probability and the true positive probability corresponding to each set of candidate image processing parameters. The ROC curve is drawn based on the false positive probability and the true positive probability.
[0193] The computer device calculates the feature area included under each feature curve according to the drawn feature curve. The computer device can select the candidate image processing parameters corresponding to the feature areas greater than the area threshold from multiple feature areas as the target image processing parameters, and obtain at least one set of target image processing parameters.
[0194] In one embodiment, the computer device can screen out a preset number of feature areas from largest to smallest from multiple feature areas, and use the groups of candidate image processing parameters corresponding to the preset number of feature areas as the target image processing parameters.
[0195] In this embodiment, the first sample face image and the second sample face image are extracted from the sample ID image. The image size of the first sample face image is smaller than that of the second sample face image. Then the first sample face image is more susceptible to the influence of light and angle during image acquisition. Each group of target image processing parameters performs image enhancement processing on the first sample face image respectively to remove the influence of image acquisition angle, light, etc. on the first sample face image, and obtains each third sample face image after image enhancement processing to different degrees. After excluding the interference caused by angle, light, etc., each third sample face image is compared with the corresponding second sample face image respectively to obtain the corresponding sample image comparison result. Based on the difference between the sample image comparison result and the sample category, at least one set of target image processing parameters with the best interference removal effect caused by angle and light can be screened out from multiple groups of candidate image processing parameters. By performing identity verification on the target ID with the target image processing parameters, the authenticity of the target ID can be accurately identified, and the accuracy of identity verification can be improved.
[0196] In one embodiment, obtaining multiple groups of candidate image processing parameters and performing image enhancement processing on the first sample face image based on each group of candidate image processing parameters respectively to obtain the third sample face image corresponding to each group of candidate image processing parameters includes:
[0197] Determine the current candidate image processing parameters corresponding to the current iteration from the sample parameter set, and obtain the backup image processing parameters filtered out by the previous iteration;
[0198] Based on the current candidate image processing parameters and the backup image processing parameters, perform image enhancement processing on the first sample face image respectively to obtain the third sample face images corresponding to each group of image processing parameters;
[0199] Based on the sample image comparison results and sample categories, screen out at least one group of target image processing parameters from multiple groups of candidate image processing parameters, including:
[0200] For each group of image processing parameters in the current iteration, generate a characteristic curve according to the corresponding sample image comparison result and the corresponding sample category, determine the corresponding characteristic area based on the characteristic curve, and screen out the backup image processing parameters that meet the area matching condition in the current iteration based on the characteristic area;
[0201] Select the candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set as the current candidate image processing parameters corresponding to the next iteration, and use the backup image processing parameters filtered out in the current iteration as the backup image processing parameters required for the next iteration;
[0202] Return to the step of performing image enhancement processing on the first sample face image respectively based on the current candidate image processing parameters and the backup image processing parameters to obtain the third sample face images corresponding to each group of image processing parameters, and continue to execute until all candidate image processing parameters in the sample parameter set are traversed and then stop. Screen out the image processing parameters that meet the area matching condition in the last iteration based on the characteristic area obtained in the last iteration;
[0203] Use the image processing parameters that meet the area matching condition in the last iteration as the target image processing parameters.
[0204] There are multiple groups of candidate image processing parameters in the sample parameter set. Each time the computer device iterates, it can use a preset number of groups of candidate image processing parameters to perform image enhancement processing on the first sample face image. For example, 10 groups, 15 groups, 20 groups, but not limited to this. In the first iteration, the computer device obtains a preset number of groups of candidate image processing parameters from the sample parameter set, performs image enhancement processing on the first sample face image respectively, obtains the sample image comparison results corresponding to each group of candidate image processing parameters. The computer device generates a characteristic curve based on each group of sample image comparison results and the corresponding sample category, determines the corresponding characteristic area based on the characteristic curve, and screens out the backup image processing parameters that meet the area matching condition from each group of candidate image processing parameters used in the first iteration.
[0205] Starting from the second iteration, obtain the spare image processing parameters selected in the previous iteration, and obtain the current candidate image processing parameters from the sample set for the next iteration process. The sum of the number of groups of the spare image processing parameters and the number of groups of the current candidate image processing parameters is the preset number of groups.
[0206] According to the current candidate image processing parameters and the spare image processing parameters, perform image enhancement processing on the first sample face image respectively to obtain the third sample face images corresponding to each group of image processing parameters. Each group of the image processing parameters includes the current candidate image processing parameters and the spare image processing parameters.
[0207] For each group of image processing parameters, the computer device determines the comparison results of each sample image corresponding to each group of image processing parameters. The computer device calculates the false positive probability and the true positive probability corresponding to each group of image processing parameters according to the comparison results of each sample image corresponding to each group of image processing parameters and the corresponding sample categories. Based on the false positive probability and the true positive probability corresponding to each group of image processing parameters, the characteristic curves corresponding to each group are drawn respectively. The corresponding characteristic areas are obtained according to the characteristic curves, and the corresponding characteristic areas for each group are obtained. The computer device can screen out the preset number of characteristic areas from the multiple characteristic areas from large to small, and use the groups of image processing parameters corresponding to the preset number of characteristic areas as the spare image processing parameters. For example, screen out the three groups of image processing parameters corresponding to the largest three characteristic areas as the spare image processing parameters.
[0208] The computer device obtains the candidate image processing parameters that have not participated in the iterative calculation from the sample set as the current candidate image processing parameters corresponding to the next iteration. Use the spare image processing parameters selected in the current iteration as the spare image processing parameters required for the next iteration. The sum of the number of groups of the spare image processing parameters and the number of groups of the current candidate image processing parameters is the preset number of groups.
[0209] After the computer device obtains the current candidate image processing parameters and the spare image processing parameters corresponding to the next iteration, return to the step of performing image enhancement processing on the first sample face image respectively based on the current candidate image processing parameters and the spare image processing parameters to obtain the third sample face images corresponding to each group of image processing parameters and continue to execute. In each iteration, the computer device can screen out the preset number of characteristic areas from the multiple characteristic areas from large to small, and use the groups of image processing parameters corresponding to the preset number of characteristic areas as the spare image processing parameters for the next iteration.
[0210] Stop after performing the above iterative processing until all candidate image processing parameters in the sample parameter set are traversed. Based on the feature areas obtained in the last iteration, screen out a preset number of feature areas from largest to smallest, and use the groups of image processing parameters corresponding to the preset number of feature areas as the target image processing parameters.
[0211] In this embodiment, by calculating the feature area corresponding to each group of image processing parameters in each iteration and screening out the image processing parameters that meet the area matching condition in the current iteration based on the feature area, it is possible to screen out the groups of image processing parameters with the best image enhancement processing effect in the current iteration. Select the candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set and the groups of image processing parameters screened out in the previous iteration, and continue the next iterative calculation. In each iterative calculation, the groups of image processing parameters with the best image enhancement processing effect can be screened out. Based on the traversal of the groups of candidate image processing parameters in the sample parameter set, through traversal iteration, the groups of image processing parameters can be continuously screened until the traversal ends and the groups of image processing parameters with the best image enhancement processing effect are automatically screened out.
[0212] In one embodiment, as Figure 7 shown, a method for training an image recognition model is provided. Taking this method as an example applied to Figure 1 the computer device in (this computer device can specifically be Figure 1 the terminal or server in), the method includes the following steps:
[0213] Step S702, obtain sample document images and determine the sample categories to which the respective sample document images belong.
[0214] Among them, the sample categories include positive classes and negative classes. The positive class indicates that the sample document image is a genuine document image, that is, the first sample face image and the second sample face image in the sample document image are the face images of the same person. The negative class indicates that the sample document image is a forged document image, that is, the first sample face image and the second sample face image in the sample document image are not the face images of the same person.
[0215] Specifically, the computer device can obtain the sample document videos obtained by video capturing the sample documents. The computer device can extract each sample video frame from the sample document videos and segment the sample document images from each sample video frame to obtain each sample document image. The first sample face image in the sample document can be a real face image or a forged face image.
[0216] In one embodiment, 100 document videos captured in different environments can be collected for training. The computer device can perform face key point annotation on the first sample face image in the document video, as Figure 4As shown, key points of each part of the face are marked, such as key points of the left eye, right eye, nose, mouth, hairline, etc., to facilitate subsequent detection of the face blur degree of the first sample face image through face key points.
[0217] Step S704: Extract the first sample face image and the second sample face image from the sample ID image. The image size of the first sample face image is smaller than that of the second sample face image.
[0218] Specifically, the sample ID image contains the first sample face image and the second sample face image. The image size of the first face image is smaller than that of the second face image. For each frame of the sample video frame, the computer device can perform face detection on the sample video frame to segment out the first sample face image and the second sample face image in the sample video frame.
[0219] In one embodiment, the first sample face image is a three-dimensional face image, and the second sample face image is a two-dimensional face image.
[0220] In one of the embodiments, both the first sample face image and the second sample face image are three-dimensional face images.
[0221] Step S706: Perform image enhancement processing on the first sample face image respectively through each group of candidate image processing parameters in the image recognition model to be trained, and obtain the third sample face image corresponding to each group of candidate image processing parameters respectively.
[0222] Specifically, the computer device inputs the first sample face image, the second sample image, and the corresponding sample category into the image recognition model to be trained. The image recognition model to be trained performs image enhancement processing on the first sample face image respectively through each group of candidate image processing parameters, and obtains the third sample face image corresponding to each group of candidate image processing parameters respectively.
[0223] In one embodiment, each group of image processing parameters includes multiple processing sub-parameters, and each processing sub-parameter corresponds to its own image processing method. For each group of candidate image processing parameters, the image recognition model to be trained performs image enhancement processing on the first face image based on each processing sub-parameter in each group of candidate image processing parameters, in accordance with the processing order corresponding to each processing sub-parameter. Moreover, for each processing sub-parameter in the same group of candidate image processing parameters, the image processed by the previous processing sub-parameter is used as the object to be processed by the next processing sub-parameter, until the third sample face image processed by the image processing method corresponding to the last processing sub-parameter is obtained.
[0224] Step S708: Compare each third sample face image with the corresponding second sample face image respectively to obtain the corresponding sample image comparison result.
[0225] Among them, the sample image comparison result includes at least one of the similarity and the difference degree between the third sample face image and the second sample face image.
[0226] Specifically, for each third sample face image, the image recognition model to be trained calculates the similarity between the third sample face image and the second sample face image, and takes the similarity as the sample image comparison result.
[0227] In one embodiment, for each third sample face image, the image recognition model to be trained calculates the difference degree between the third sample face image and the second sample face image, and takes the difference degree as the sample image comparison result.
[0228] Step S710: Train the image recognition model to be trained based on the sample image comparison result and the sample category until the training stop condition is reached, and then stop to obtain the trained target image recognition model; the trained target image recognition model includes at least one set of target image processing parameters for authenticating the identity of the target certificate.
[0229] Specifically, the computer device generates a characteristic curve corresponding to each set of candidate image processing parameters according to each sample comparison result and the corresponding sample category respectively corresponding to each set of candidate image processing parameters. The computer device calculates the characteristic area corresponding to each set of candidate image processing parameters based on the characteristic curve corresponding to each set of candidate image processing parameters. The computer device screens out the candidate image processing parameters that meet the area matching condition from multiple sets of candidate image processing parameters based on the characteristic area.
[0230] The computer device obtains the candidate image processing parameters from the sample parameter set, takes the screened candidate image processing parameters and the candidate image processing parameters obtained from the sample parameter set as the image processing parameters for the next training of the image recognition model, and continues the training. Stop until all candidate image processing parameters in the sample parameter set are traversed, and take the candidate image processing parameters obtained from the sample parameter set for the last time and the candidate image processing parameters screened out last time as the image processing parameters for the last training of the image recognition model. Based on the characteristic area corresponding to each set of image processing parameters obtained from the last training, screen out the image processing parameters that meet the area matching condition from multiple sets of candidate image processing parameters as the target image processing parameters of the image recognition model to obtain the trained image recognition model.
[0231] The computer device can select the image processing parameters corresponding to the feature areas larger than the area threshold from multiple feature areas as the target image processing parameters, and obtain at least one set of target image processing parameters.
[0232] In one embodiment, the computer device can screen out a preset number of feature areas from the multiple feature areas in descending order, and use the groups of image processing parameters corresponding to the preset number of feature areas as the target image processing parameters.
[0233] In this embodiment, the first sample face image and the second sample face image are extracted from the sample ID image. The image size of the first sample face image is smaller than that of the second sample face image. Then the first sample face image is more vulnerable to the influence of light and angle during image acquisition. The first sample face image is respectively subjected to image enhancement processing by each group of target image processing parameters in the image recognition model to be trained, so as to remove the influence of image acquisition angle, light, etc. on the first sample face image, and obtain each third sample face image after image enhancement processing to different degrees. After excluding the interference caused by angle, light, etc., each third sample face image is respectively compared with the corresponding second sample face image to obtain the corresponding sample image comparison result. Based on the difference between the sample image comparison result and the sample category, the target image processing parameters with the best image enhancement effect can be screened out from multiple groups of image processing parameters. By using the trained image recognition model to authenticate the identity of the target ID, the authenticity of the target ID can be accurately identified, and the accuracy of identity authentication can be improved. The trained image recognition model has high recognition accuracy and fast calculation speed, and can improve the efficiency of identity authentication of the target ID.
[0234] In one embodiment, as Figure 8 shown, the first sample face image is respectively subjected to image enhancement processing by each group of candidate image processing parameters in the image recognition model to be trained, and the third sample face image corresponding to each group of candidate image processing parameters is obtained, including:
[0235] Step S802, determine the current candidate image processing parameter corresponding to the current iteration from the sample parameter set in the image recognition model to be trained, and obtain the backup image processing parameter screened out through the previous iteration.
[0236] Specifically, there are multiple sets of candidate image processing parameters in the sample parameter set. Each iteration of the image recognition model can use a preset number of sets of candidate image processing parameters to perform image enhancement processing on the first sample face image. For example, 10 sets, 15 sets, 20 sets, but not limited to this. In the first iteration, the image recognition model to be trained obtains a preset number of sets of candidate image processing parameters from the sample parameter set, performs image enhancement processing on the first sample face image respectively, obtains the sample image comparison results corresponding to each set of candidate image processing parameters, generates a feature curve based on each set of sample image comparison results and the corresponding sample category, determines the corresponding feature area based on the feature curve, and filters out the standby image processing parameters that meet the area matching condition from each set of candidate image processing parameters used in the first iteration.
[0237] Starting from the second iteration, obtain the standby image processing parameters filtered out in the previous iteration, and obtain the current candidate image processing parameters from the sample set for the next iteration process. The sum of the number of sets of standby image processing parameters and the number of sets of current candidate image processing parameters is the preset number of sets.
[0238] Step S804: Based on the current candidate image processing parameters and the standby image processing parameters, perform image enhancement processing on the first sample face image respectively to obtain the third sample face images corresponding to each set of image processing parameters.
[0239] Specifically, the image recognition model performs image enhancement processing on the first sample face image respectively according to the current candidate image processing parameters and the standby image processing parameters to obtain the third sample face images corresponding to each set of image processing parameters. Each set of these image processing parameters includes the current candidate image processing parameters and the standby image processing parameters.
[0240] Train the image recognition model to be trained based on the sample image comparison results and the sample category until the training stop condition is reached and then stop to obtain the trained target image recognition model, including:
[0241] Step S806: For each set of image processing parameters in the current iteration, generate a feature curve according to the corresponding sample comparison result and the corresponding sample category, determine the corresponding feature area based on the feature curve, and filter out the standby image processing parameters that meet the area matching condition in the current iteration based on the feature area.
[0242] Specifically, for each set of image processing parameters, the image recognition model determines the comparison results of each sample image corresponding to each set of image processing parameters. Multiple recognition thresholds are obtained. For each recognition threshold, the image recognition model obtains the predicted category of each sample document image based on the comparison results of each sample image corresponding to each set of image processing parameters and the recognition threshold. The predicted category refers to whether the sample document image is a genuine document image or a forged document image. According to the predicted category of each sample document image corresponding to each set of image processing parameters and the corresponding sample category, the false positive probability and true positive probability corresponding to each set of image processing parameters at this recognition threshold are calculated. In the same processing manner, the false positive probability and true positive probability corresponding to each set of image processing parameters at each recognition threshold are obtained.
[0243] Taking the false positive probability and true positive probability of the same set of image processing parameters at a recognition threshold as a coordinate, the coordinates corresponding to each recognition threshold of the same set of image processing parameters are obtained accordingly. Based on these coordinates, the characteristic curve corresponding to this set of image processing parameters is plotted. In the same processing manner, the characteristic curve corresponding to each set of image processing parameters can be obtained.
[0244] The corresponding characteristic area is calculated based on the characteristic curve, and the characteristic area corresponding to each set is obtained. The image recognition model can screen out a preset number of characteristic areas from the multiple characteristic areas in descending order, and use the sets of image processing parameters corresponding to the preset number of characteristic areas as the backup image processing parameters. For example, the three sets of image processing parameters corresponding to the largest three characteristic areas are screened out as the backup image processing parameters.
[0245] Step S808: Select the candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set as the current candidate image processing parameters for the next iteration, and use the backup image processing parameters screened out in the current iteration as the backup image processing parameters required for the next iteration.
[0246] Specifically, the image recognition model obtains the candidate image processing parameters that have not participated in the iterative calculation from the sample set as the current candidate image processing parameters for the next iteration. The backup image processing parameters screened out in the current iteration are used as the backup image processing parameters required for the next iteration. The sum of the number of groups of the backup image processing parameters and the number of groups of the current candidate image processing parameters is the preset number of groups.
[0247] Step S810: Return to the step of performing image enhancement processing on the first sample face image based on the current candidate image processing parameters and the backup image processing parameters respectively to obtain the third sample face images corresponding to each set of image processing parameters, and continue to execute until all candidate image processing parameters in the sample parameter set are traversed and the training stops, obtaining the trained target image recognition model.
[0248] After the image recognition model obtains the current candidate image processing parameters and the backup image processing parameters corresponding to the next iteration, it returns to continue the step of performing image enhancement processing on the first sample face image based on the current candidate image processing parameters and the backup image processing parameters respectively, and obtaining the third sample face image corresponding to each group of image processing parameters. In each iteration, the image recognition model can screen out a preset number of feature areas from largest to smallest among multiple feature areas, and use the groups of image processing parameters corresponding to the preset number of feature areas as the backup image processing parameters for the next iteration.
[0249] According to the above iterative processing, stop until all candidate image processing parameters in the sample parameter set are traversed. Based on the feature areas obtained from the last iteration, screen out a preset number of feature areas from largest to smallest, and use the groups of image processing parameters corresponding to the preset number of feature areas as the target image processing parameters.
[0250] In this embodiment, by calculating the feature area corresponding to each group of image processing parameters in each iteration of the image recognition model, and screening out the image processing parameters that meet the area matching condition in the current iteration based on the feature area, it is possible to screen out the groups of image processing parameters with the best image enhancement processing effect in the current iteration. Select the candidate image processing parameters that have not participated in the iterative calculation and the groups of image processing parameters screened out in the previous iteration from the sample parameter set, and continue the next iterative calculation. In each iterative calculation, the groups of image processing parameters with the best image enhancement processing effect can be screened out. Based on the traversal of the groups of candidate image processing parameters in the sample parameter set, through traversal iteration, the groups of image processing parameters can be continuously screened until the traversal ends, and the image recognition model can automatically screen out the groups of image processing parameters with the best image enhancement processing effect. By performing identity verification on the target certificate with each group of target image processing parameters in the trained image recognition model, the authenticity of the target certificate can be accurately identified, and the accuracy of identity verification can be improved.
[0251] The false recognition rate FAR and the rejection rate FRR of the target image recognition model in this embodiment and the image recognition models of other methods on the same test set are compared as follows. The test set is the first-generation ID cards and second-generation ID cards in Area A:
[0252]
[0253] It can be seen that the trained target image recognition model is very stable, and the false recognition rate FAR and the rejection rate FRR tested on multiple test sets are both less than 5%, which is a significant improvement compared to the image recognition models of other methods.
[0254] Such as Figure 9As shown, it is a schematic flowchart of image enhancement processing for a set of candidate image processing parameters of an image recognition model in an embodiment.
[0255] Step S902, the computer device extracts a first sample face image and a second sample face image from each sample ID image. The image size of the first sample face image is smaller than that of the second sample face image, and the first sample face image is a three-dimensional face image.
[0256] Step S904, for each first sample face image, the image recognition model performs wavelet transform processing on the red channel, green channel, and blue channel of the first sample face image respectively to remove stripes in the first face image. This wavelet transform processing is achieved by using a wavelet transform function and the number of wavelet transform times.
[0257] Step S906, the image recognition model sharpens the image after stripes through the DHE (Dynamic Histogram Equalization) algorithm to improve the contrast of the image.
[0258] Step S908, the image recognition model removes white noise from the image with improved contrast through white noise removal parameters to obtain the third sample face image in step S910, thereby obtaining the third sample face image corresponding to each first sample face image respectively.
[0259] Step S912, the image recognition model compares each third sample face image with the corresponding second sample face image to obtain each similarity in step S914.
[0260] Step S916, a characteristic curve corresponding to this set of image processing parameters is drawn based on each similarity, and the characteristic area under the characteristic curve is calculated.
[0261] As Figure 10 shown, it is a schematic flowchart of the test process of an image recognition model in an embodiment.
[0262] Step S1002, the computer device can perform video acquisition on the target ID to obtain the corresponding ID video. The target ID contains a large-size face image and a small-size face image, that is, an adult face and a child face.
[0263] Step S1004, 15 candidate video frames are screened out from the ID video, and step S1006 is executed, that is, each candidate video frame is segmented and the tilt angle is calculated, and the standby video frames that meet the ID clarity condition are screened out from the 15 candidate video frames based on the tilt angle.
[0264] Step S1008, determine the face blurriness of the small faces in the backup video frames. Based on the face blurriness, screen out the target video frames that meet the face clarity condition from the backup video frames.
[0265] Step S1010, perform target face detection on the screened target video frames, and segment out the small faces in the target video frames.
[0266] Step S1012, perform image enhancement processing on the small faces respectively through the groups of target image processing parameters in the trained image recognition model to obtain the small faces after image enhancement processing for each group.
[0267] Step S1014, compare the small faces after image enhancement processing with the corresponding large faces respectively to obtain comparison scores, and test the image recognition model based on the comparison scores.
[0268] In one embodiment, the computer device can be tested using the real ID videos of 300 real IDs and the forged ID videos of 50 face-swapped IDs.
[0269] In one embodiment, an identity authentication method is provided, including:
[0270] Step (S1), obtain sample ID images, and determine the sample categories to which the sample ID images belong respectively; extract the first sample face image and the second sample face image from the sample ID images, the image size of the first sample face image is smaller than that of the second sample face image, and the first sample face image is a three-dimensional face image.
[0271] Step (S2), perform image enhancement processing on the first sample face image respectively through the groups of candidate image processing parameters in the image recognition model to be trained to obtain the third sample face images corresponding to each group of candidate image processing parameters.
[0272] Step (S3), compare each third sample face image with the corresponding second sample face image respectively to obtain the corresponding sample image comparison results.
[0273] Step (S4), generate a characteristic curve according to the corresponding sample comparison results and the corresponding sample categories, determine the corresponding characteristic area based on the characteristic curve, and screen out three groups of backup image processing parameters that meet the area matching condition from large to small based on the characteristic area.
[0274] Step (S5), determine the current candidate image processing parameters corresponding to the current iteration from the sample parameter set in the image recognition model to be trained, and obtain the backup image processing parameters filtered out by the previous iteration; based on the current candidate image processing parameters and the backup image processing parameters, perform image enhancement processing on the first sample face image respectively to obtain the third sample face images corresponding to each group of image processing parameters.
[0275] Step (S6), for each group of image processing parameters in the current iteration, generate a feature curve according to the corresponding sample comparison result and the corresponding sample category, determine the corresponding feature area based on the feature curve, and filter out the backup image processing parameters that meet the area matching condition in the current iteration based on the feature area.
[0276] Step (S7), select the candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set as the current candidate image processing parameters corresponding to the next iteration, and use the backup image processing parameters filtered out in the current iteration as the backup image processing parameters required for the next iteration.
[0277] Step (S8), return to the step of performing image enhancement processing on the first sample face image respectively based on the current candidate image processing parameters and the backup image processing parameters to obtain the third sample face images corresponding to each group of image processing parameters, and continue to execute until all candidate image processing parameters in the sample parameter set are traversed and the training stops to obtain the trained target image recognition model.
[0278] Step (S9), obtain the certificate video obtained by video capturing the target certificate, input the certificate video into the target image recognition model, and the target image recognition model extracts more than one frame of candidate video frames from the certificate video.
[0279] Step (S10), the target image recognition model detects the target certificates in each candidate video frame respectively, and segments the candidate boundary regions including the target certificates from the candidate video frames.
[0280] Step (S11), for each frame of candidate video frame, obtain the length information of the corresponding candidate boundary region and the projection information corresponding to the inclination of the corresponding candidate boundary region.
[0281] Step (S12), for each frame of candidate video frame, calculate the horizontal inclination angle between the candidate boundary region and the horizontal boundary region and the vertical inclination angle between the candidate boundary region and the vertical boundary region based on the boundary length information of the corresponding candidate boundary region and the corresponding projection information; based on the horizontal inclination angle and the vertical inclination angle, filter out the backup video frames that meet the certificate clarity condition from the candidate video frames.
[0282] Step (S13): Detect the three-dimensional face images corresponding to the target certificates in each spare video frame respectively to obtain the face key point detection results in each spare video frame.
[0283] Step (S14): Based on the face key point detection results in each spare video frame, determine the face blurriness corresponding to each spare video frame respectively; based on the face blurriness, screen out the target video frames that meet the face clarity condition from the spare video frames.
[0284] Step (S15): Extract the first face image and the second face image corresponding to the target certificate from the target video frame. The image size of the first face image is smaller than that of the second face image, and the first face image is a three-dimensional face image.
[0285] Step (S16): Obtain each group of target image processing parameters. Each group of target image processing parameters includes the processing sub-parameters corresponding to the three image processing methods respectively. The three image processing methods are stripe removal, sharpening, and white noise removal.
[0286] Step (S17): For each group of target image processing parameters, based on the corresponding processing sub-parameters, and in accordance with the image processing methods corresponding to each processing sub-parameter respectively, perform image enhancement processing on the first face image in sequence until the third face image corresponding to each group of target image processing parameters is obtained.
[0287] Step (S18): Calculate the similarity between each third face image and the second face image respectively, and determine the maximum value among the similarities.
[0288] Step (S19): Obtain multiple frames of comparison video frames corresponding to different perspectives from the certificate video; compare the three-dimensional face images in the multiple frames of comparison video frames to obtain the similarity between each three-dimensional face image.
[0289] Step (S20): When the maximum value is greater than the preset similarity threshold and the similarity between each three-dimensional face image is greater than the preset similarity threshold, determine that the identity verification result of the target certificate is verification passed.
[0290] Step (S21): When the maximum value is less than or equal to the preset similarity threshold and there is at least one similarity among the similarities between each three-dimensional face image that is not greater than the preset similarity threshold, determine that the identity verification result of the target certificate is verification passed.
[0291] In this embodiment, there are two face images in the certificate. The face image with a small image size is a three-dimensional face image, and the three-dimensional face image is a dynamic anti-counterfeiting point. The three-dimensional face image is easily affected by different lights and angles when the certificate is tilted, resulting in unclear face images. The first sample face images are subjected to image enhancement processing respectively by each group of target image processing parameters in the image recognition model to be trained, so as to remove the influences of the image acquisition angle, light, etc. on the first sample face images, and obtain each third sample face image after image enhancement processing to different degrees. After excluding the interferences caused by angles, lights, etc., each third sample face image is compared with the corresponding second sample face image respectively to obtain the corresponding sample image comparison results. A characteristic curve is generated based on the sample image comparison results and the sample categories to obtain a characteristic area, and multiple groups of candidate image processing parameters are screened according to the characteristic area.
[0292] Based on the characteristic area corresponding to each group of image processing parameters calculated by each iteration of the image recognition model, and screening out the image processing parameters that meet the area matching condition in the current iteration based on the characteristic area, the image processing parameters with the best image enhancement processing effect in the current iteration can be screened out. Select the candidate image processing parameters that have not participated in the iterative calculation and the image processing parameters of each group screened out in the previous iteration from the sample parameter set, and continue the next iterative calculation. The image processing parameters with the best image enhancement processing effect in each group can be screened out in each iterative calculation. Based on the traversal of each group of candidate image processing parameters in the sample parameter set, the image processing parameters of each group can be continuously screened through traversal iteration until the traversal ends and the image recognition model can automatically screen out the image processing parameters with the best image enhancement processing effect in each group.
[0293] In the actual application process, the target video frames with appropriate tilt angles of the target certificate and clear three-dimensional face images are extracted from the certificate video through the trained target image recognition model. The three-dimensional face images in the target video frames are subjected to image enhancement processing to different degrees by each group of target image processing parameters in the target image recognition model, and multiple processed third face images are obtained. According to the image comparison results between different third face images and the same second face image respectively, it can be accurately determined whether the two face images in the target certificate are the face images of the same user, so as to be able to identify the authenticity of the target certificate and realize the identity verification of the target certificate.
[0294] This application also provides an application scenario, and this application scenario applies the above identity verification method. Specifically, the application of the identity verification method in this application scenario is as follows:
[0295] Obtain the sample ID card video obtained by video capturing of the sample ID card, and screen out the video frames with both the horizontal tilt angle and the vertical tilt angle less than 30° from the sample ID card video. Screen out the sample video frames with clear facial parts from the screened video frames. The small face in the sample ID card is a three-dimensional face image.
[0296] From the sample video frames, obtain the sample ID card images, and determine the true labels corresponding to each sample ID card image. The true label refers to whether the sample ID card image is a real ID card or a forged ID card. Extract the sample small face and the sample large face from the sample ID card images.
[0297] For the 10 sets of candidate image processing parameters in the image recognition model to be trained, each set of candidate image processing parameters includes a de-striping parameter, a sharpening parameter, and a de-noising parameter. The de-striping parameter includes a wavelet transform function and the number of wavelet transform times, and the de-striping parameter corresponds to wavelet transform processing. The sharpening parameter corresponds to histogram equalization, and the de-noising parameter corresponds to mean filtering. That is, the candidate image processing parameter can be [p1, p2, p3, p4], where p1 refers to different wavelet functions used in wavelet transform. p2 is the number of wavelet transform times, that is, the depth of wavelet decomposition. p3 is the sharpening parameter, and p4 is the de-noising parameter. p1 = [db1, sym2, sym3, sym4,...], p2 = [1, 2, 3, 4,...], p3 = [0.02, 0.04, 0.06,..., 0.48, 0.5], p4 = [a, b, c, d,...], and the candidate image processing parameter is the combination of different p1, p2, p3, and p4.
[0298] Perform wavelet transform processing on the sample small face through the wavelet transform function and the number of wavelet transform times to obtain an image with stripes removed. Perform histogram equalization on the image with stripes removed through the sharpening parameter to obtain an image with enhanced contrast. Perform mean filtering processing on the image with enhanced contrast through the de-noising parameter to obtain an image with white noise removed. The image with white noise removed is the predicted small face.
[0299] The de-striping parameter, the sharpening parameter, and the de-noising parameter in each set of candidate image processing parameters are not completely the same, so each set of candidate image processing parameters is different.
[0300] Compare the predicted small faces corresponding to the 10 sets of candidate image processing parameters with the corresponding sample large faces respectively to obtain each similarity. When the similarity is greater than the preset similarity threshold, predict that the sample ID card image corresponding to the similarity is a real ID card. When the similarity is not greater than the preset similarity threshold, predict that the sample ID card image corresponding to the similarity is a forged ID card.
[0301] The recognition threshold can be set to 0.5, 0.6, 0.65, or 0.7. For the similarity degrees corresponding to a set of candidate image processing parameters, when the recognition thresholds are respectively 0.5, 0.6, 0.65, and 0.7, determine the predicted categories of the sample ID card images by the image recognition model to be trained. The predicted category is whether the sample ID card image is a genuine ID card or a forged ID card.
[0302] For a recognition threshold of 0.5, calculate, in each sample ID card image, the number FN of genuine ID cards predicted as forged ID cards by the image recognition model to be trained, the number TP of genuine ID cards predicted as genuine ID cards, the number TN of forged ID cards predicted as forged ID cards, and the number FP of forged ID cards predicted as genuine ID cards. Then, calculate the true positive rate TPR = TP / (TP + FN), and the false positive rate FPR = FP / (FP + TN). According to the false positive rate and the true positive rate, a coordinate can be obtained. In the same processing manner, coordinates for recognition thresholds of 0.6, 0.65, and 0.7 can be obtained respectively, thus obtaining 4 coordinates corresponding to this set of candidate image processing parameters. Based on these 4 coordinates, with the false positive rate as the horizontal axis and the true positive rate as the vertical axis, construct a coordinate system, determine these 4 coordinates in this coordinate system, and connecting these 4 coordinates can obtain an ROC curve. The area under this ROC curve is the corresponding AUC area. Thus, the ROC curve and the AUC area corresponding to this set of candidate image processing parameters can be obtained.
[0303] For the remaining 9 groups, perform the same processing to obtain the remaining 9 ROC curves and the corresponding 9 AUC areas. Select 3 of the largest AUC areas from these 10 AUC areas, thereby screening out the 3 groups of candidate image processing parameters corresponding to these 3 largest AUC areas.
[0304] Select 7 groups of candidate image processing parameters from the sample parameter set, and use these 7 groups of candidate image processing parameters and the 3 groups of candidate image processing parameters screened out as the image processing parameters for the next iteration of the image recognition model.
[0305] According to this grid search training method, in each iteration, select 7 groups of candidate image processing parameters from the sample parameter set. Until all candidate image processing parameters in the sample parameter set are selected, perform the last iteration, and select 3 groups of candidate image processing parameters from the 10 AUC areas obtained in the last iteration as the target candidate image parameters. For example, these three groups of target candidate image parameters are [p1 = sym2, p2 = 1, p3 = 0.02, p4 = a], [p1 = sym3, p2 = 2, p3 = 0.04, p4 = b], and [p1 = sym4, p2 = 2, p3 = 0.16, p4 = c].
[0306] In the actual application process, the ID card video of the user can be collected, and the ID card video is input into the target image recognition model. The target image recognition model recognizes the ID card video to obtain the small face and the large face in the clearest video frame.
[0307] The small face in the ID card video is subjected to image enhancement processing respectively through 3 groups of target image processing parameters in the target image recognition model to obtain 3 small faces after image enhancement processing. Calculate the similarity between each small face and the large face respectively. When all these 3 similarities are greater than 0.65, it is determined that the small face and the large face in the ID card are the face images of the same person, and then the ID card is a genuine ID card.
[0308] When at least one of these 3 similarities is not greater than 0.65, it is determined that the small face and the large face in the ID card are not the face images of the same person, and then the ID card is a forged ID card.
[0309] When the user needs to handle relevant bank business, the bank can verify the user's ID card through the processing method of this embodiment. When the user's ID card verification passes, that is, when the user's ID card is a genuine ID card, the user is allowed to handle personal-related bank business, such as applying for a bank card, querying and modifying bank reserved information, etc. When the user's ID card verification fails, that is, when the user's ID card is a forged ID card, the user is not allowed to handle any business, and the bank staff is notified.
[0310] Applying the identity verification method of this embodiment to bank business handling can accurately identify whether the ID card of the user who needs to handle bank business is genuine, and can prevent criminals from misusing others' information and illegally obtaining others' information and property, thereby ensuring the security of user information and property in the bank, as well as the security of business handling.
[0311] It can be understood that the identity verification method in this embodiment can be applied to any document with two face images, and can be applied to any scenario where ID card verification is required, not limited to banks. For example, it can also be ID card recognition at stations, airports, hotels, and recognition of ID card images uploaded during personal registration information, etc.
[0312] It should be understood that although Figure 2 、 Figures 5 - 10 the steps in the flowchart are displayed in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, Figure 2 、 Figures 5 - 10At least some of the steps may include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turns with at least some of the steps or stages in other steps or other steps.
[0313] In one embodiment, as Figure 11 shown, an authentication device is provided. The authentication device 1100 can be a software module, a hardware module, or a combination of both to form a part of a computer device. Specifically, the device includes: an acquisition module 1102, an extraction module 1104, an image enhancement module 1106, and a comparison module 1108, where:
[0314] The acquisition module 1102 is configured to acquire a document video obtained by performing video acquisition on a target document, and screen out a target video frame that meets the image clarity condition from the document video.
[0315] The extraction module 1104 is configured to extract a first face image and a second face image corresponding to the target document from the target video frame, and the image size of the first face image is smaller than the image size of the second face image.
[0316] The image enhancement module 1106 is configured to acquire at least one set of target image processing parameters, and perform image enhancement processing on the first face image based on each set of target image processing parameters to obtain at least one third face image.
[0317] The comparison module 1108 is configured to compare each of the third face images with the second face image respectively to obtain a corresponding image comparison result, and determine the identity verification result of the target document according to the image comparison result.
[0318] In this embodiment, target video frames that meet the image clarity condition are screened out from the document video containing the target document to obtain clear video frames, so as to obtain a clear target document. The first face image and the second face image corresponding to the target document are extracted from the target video frames, and the first face image and the second face image in the target document are obtained. If the image size of the first face image is smaller than that of the second face image, the first face image is more susceptible to the influence of light and angle during video acquisition. At least one set of target image processing parameters is used to perform image enhancement processing on the first face image respectively to remove the influence of video acquisition angle, light, etc. on the first face image, and at least one third face image after image enhancement processing is obtained. Each third face image after removing the influence of video acquisition angle, light, etc. on the first face image is compared with the second face image respectively, and the image comparison results of the third face image and the second face image corresponding to different target image processing parameters are obtained, so as to obtain the image comparison results of different third face images obtained by different image enhancement methods and the same second face image. According to the image comparison results of different third face images and the same second face image, it is possible to accurately identify whether the two face images in the target document are the face images of the same user, so as to be able to identify the authenticity of the target document and realize the identity verification of the target document.
[0319] In one embodiment, the first face image is a three-dimensional face image; the obtaining module 1102 is further configured to: extract more than one frame of candidate video frames from the document video; detect the target documents in each candidate video frame respectively to determine the document tilt angles corresponding to the target documents in each candidate video frame; based on the document tilt angles, screen out the standby video frames that meet the document clarity condition from the candidate video frames; detect the three-dimensional face images corresponding to the target documents in each standby video frame to determine the face blurriness corresponding to each three-dimensional face image in each standby video frame; based on the face blurriness, screen out the target video frames that meet the face clarity condition from the standby video frames.
[0320] In one embodiment, the three-dimensional face image is susceptible to the influence of light and acquisition angle, etc. The clarity of the face images detected at different tilt angles is different. Then, whether the target document is clear can be judged through the tilt angle of the target document in the document video and the face blurriness of the three-dimensional face image, so as to be able to screen out the video frames corresponding to the three-dimensional face images in a clear state at each part in the document video.
[0321] In one embodiment, the obtaining module 1102 is further configured to: detect the target certificates in each candidate video frame respectively, and segment out the candidate boundary regions including the target certificates from the candidate video frames; for each candidate video frame, determine the boundary angle formed by the corresponding candidate boundary region and the preset boundary region respectively, and use the boundary angle as the certificate tilt angle corresponding to the target certificate in the corresponding candidate video frame.
[0322] In this embodiment, for each candidate video frame, determine the boundary angle formed by the corresponding candidate boundary region and the preset boundary region respectively. The candidate boundary region is the region where the target certificate is located in the candidate video frame, so the boundary angle can accurately represent the tilt angle of the target certificate in the certificate video.
[0323] In one embodiment, the certificate tilt angle includes a horizontal tilt angle and a vertical tilt angle, and the preset boundary region includes a horizontal boundary region and a vertical boundary region; the obtaining module 1102 is further configured to: for each candidate video frame, obtain the length information of the corresponding candidate boundary region, and the projection information corresponding to the tilt of the corresponding candidate boundary region; for each candidate video frame, calculate the horizontal tilt angle between the candidate boundary region and the horizontal boundary region, and the vertical tilt angle between the candidate boundary region and the vertical boundary region based on the boundary length information of the corresponding candidate boundary region and the corresponding projection information.
[0324] In this embodiment, detect the projection information of the target certificate when tilted in the horizontal boundary region and the vertical boundary region respectively. Based on the length information of the candidate boundary region and the projection information in the horizontal boundary region, the tilt angle formed by the candidate boundary region and the horizontal boundary region can be accurately calculated. Based on the length information of the candidate boundary region and the projection information in the vertical boundary region, the tilt angle formed by the candidate boundary region and the vertical boundary region can be accurately calculated. Therefore, the two tilt angles of the same candidate boundary region in different directions are used as the conditions for screening the target video frames, so that the target video frames corresponding to the clearer target certificates can be screened out.
[0325] In one embodiment, the obtaining module 1102 is further configured to: detect the stereo face images corresponding to the target certificates in each backup video frame respectively, and obtain the face key point detection results in each backup video frame; determine the face blurriness corresponding to each backup video frame based on the face key point detection results in each backup video frame.
[0326] In this embodiment, face key point detection is performed on the three-dimensional face image. Based on the face key point detection results, the blurred changes of the image can be reflected from various parts of the face. Moreover, by only calculating the blur degree using the key points of each part of the face, the computational amount can be reduced. The gradient value is relatively sensitive to blur, and using the gradient value of the key points can accurately calculate the blur degree of the image.
[0327] In one embodiment, each group of target image processing parameters includes at least one processing sub-parameter corresponding to each image processing method; the image enhancement module 1106 is further configured to: for each group of target processing parameters, based on the corresponding processing sub-parameters, and in accordance with the image processing methods respectively corresponding to each processing sub-parameter, sequentially perform image enhancement processing on the first face image until the corresponding third face image is obtained; the multiple image processing methods include at least one of despeckling, sharpening, and denoising.
[0328] In this embodiment, for each group of target processing parameters, the first face image is sequentially subjected to despeckling, sharpening, denoising, etc. in accordance with the image processing methods respectively corresponding to the processing sub-parameters in each group of target image processing parameters, so as to obtain the third face image after despeckling, sharpening, and denoising. The processing sub-parameters of despeckling, sharpening, and denoising for each third face image are different, so the degrees of despeckling, sharpening, and denoising for each third face image are different, thereby obtaining multiple third face images with different degrees of image enhancement processing.
[0329] In one embodiment, the comparison module 1108 is further configured to: calculate the similarity between each third face image and the second face image respectively; determine the maximum value among the similarities, and when the maximum value is greater than the preset similarity threshold, determine that the identity verification result of the target certificate is verified.
[0330] In this embodiment, the similarity between each third face image after image enhancement processing and the second face image is calculated, so that the identity verification result of the target certificate can be accurately determined based on the comparison result between the maximum similarity and the preset similarity threshold.
[0331] In one embodiment, the first face image is a three-dimensional face image, and the device further includes: an angle comparison module. The angle comparison module is configured to: obtain multiple frames of video frames to be compared corresponding to different perspectives from the certificate video; compare the three-dimensional face images in the multiple frames of video frames to be compared to obtain the corresponding angle comparison result;
[0332] The comparison module 1108 is further configured to: determine the identity verification result of the target certificate according to the image comparison result and the angle comparison result.
[0333] In this embodiment, the changes in the stereo face images detected from different perspectives are relatively large. Multiple frames of video frames to be compared from different perspectives in the ID video are obtained to compare the stereo face images from different perspectives, so as to determine the similarity or difference degree between the stereo face images from different perspectives. A low similarity or a large difference degree indicates that the stereo face image may be obtained by fusing multiple different face images, and thus the stereo face image is a forged face image. Based on the similarity or difference degree between the stereo face images from different perspectives, it is possible to identify whether the stereo face image is a forged face, thereby improving the accuracy of authenticating the identity of the target ID. Combining the image comparison result and the angle comparison result, it is possible to authenticate the identity of the target ID in two different ways, further improving the accuracy of identity authentication, and thus enhancing the security of user information.
[0334] In one embodiment, the device further includes: an image processing parameter determination module. The image processing parameter determination module is configured to: obtain sample ID images and determine the sample categories to which the respective sample ID images belong; extract a first sample face image and a second sample face image from the sample ID images, where the image size of the first sample face image is smaller than that of the second sample face image; obtain multiple groups of candidate image processing parameters, and perform image enhancement processing on the first sample face image based on each group of candidate image processing parameters to obtain third sample face images corresponding to each group of candidate image processing parameters; compare each third sample face image with the corresponding second sample face image to obtain corresponding sample image comparison results; and screen out at least one group of target image processing parameters from the multiple groups of candidate image processing parameters based on the sample image comparison results and the sample categories.
[0335] In this embodiment, a first sample face image and a second sample face image are extracted from the sample ID images, and the image size of the first sample face image is smaller than that of the second sample face image. Then, the first sample face image is more susceptible to the influence of light and angle during image acquisition. Image enhancement processing is performed on the first sample face image through each group of target image processing parameters to remove the influence of image acquisition angle, light, etc. on the first sample face image, and third sample face images after image enhancement processing to different degrees are obtained. After excluding the interference caused by angle, light, etc., each third sample face image is compared with the corresponding second sample face image to obtain corresponding sample image comparison results. Based on the difference between the sample image comparison results and the sample categories, at least one group of target image processing parameters with the best interference removal effect caused by angle and light can be screened out from the multiple groups of candidate image processing parameters. Authenticating the identity of the target ID through the target image processing parameters can accurately identify the authenticity of the target ID and improve the accuracy of identity authentication.
[0336] In one embodiment, the image processing parameter determination module is further configured to: determine, from the sample parameter set, the current candidate image processing parameters corresponding to the current iteration, and obtain the spare image processing parameters filtered out through the previous iteration; based on the current candidate image processing parameters and the spare image processing parameters, perform image enhancement processing on the first sample face image respectively to obtain the third sample face images corresponding to each group of image processing parameters; for each group of image processing parameters in the current iteration, generate a feature curve according to the corresponding sample comparison result and the corresponding sample category, determine the corresponding feature area based on the feature curve, and filter out the spare image processing parameters that meet the area matching condition in the current iteration based on the feature area; select the candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set as the current candidate image processing parameters corresponding to the next iteration, and use the spare image processing parameters filtered out in the current iteration as the spare image processing parameters required for the next iteration; return to the step of performing image enhancement processing on the first sample face image respectively based on the current candidate image processing parameters and the spare image processing parameters to obtain the third sample face images corresponding to each group of image processing parameters, and continue to execute until all the candidate image processing parameters in the sample parameter set are traversed and stopped, and filter out the image processing parameters that meet the area matching condition in the last iteration based on the feature area obtained in the last iteration; use the image processing parameters that meet the area matching condition in the last iteration as the target image processing parameters.
[0337] In this embodiment, by calculating the feature area corresponding to each group of image processing parameters obtained through each iteration, and filtering out the image processing parameters that meet the area matching condition in the current iteration based on the feature area, it is possible to filter out the groups of image processing parameters with the best image enhancement processing effect in the current iteration. Select the candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set and the groups of image processing parameters filtered out in the previous iteration, and continue the next iterative calculation. In each iterative calculation, the groups of image processing parameters with the best image enhancement processing effect can be filtered out. Based on the traversal of each group of candidate image processing parameters in the sample parameter set, through iterative traversal, each group of image processing parameters can be continuously filtered until the traversal ends and the groups of image processing parameters with the best image enhancement processing effect are automatically filtered out.
[0338] In one embodiment, as Figure 12 shown, a training device 1200 for an image recognition model is provided. The device can be a software module, a hardware module, or a combination of both to form a part of a computer device. The device specifically includes: a sample acquisition module 1202, a face extraction module 1204, a processing module 1206, and a comparison result acquisition module 1208, where:
[0339] A sample acquisition module 1202, configured to acquire sample document images and determine the sample categories to which the sample document images belong respectively.
[0340] A face extraction module 1204, configured to extract a first sample face image and a second sample face image from the sample document images, wherein the image size of the first sample face image is smaller than that of the second sample face image.
[0341] A processing module 1206, configured to perform image enhancement processing on the first sample face image respectively through each group of candidate image processing parameters in the image recognition model to be trained, and obtain a third sample face image corresponding to each group of candidate image processing parameters respectively.
[0342] A comparison result acquisition module 1208, configured to compare each of the third sample face images with the corresponding second sample face image respectively to obtain a corresponding sample image comparison result.
[0343] A training module 1210, configured to train the image recognition model to be trained based on the sample image comparison result and the sample category until the training stop condition is reached and then stop, so as to obtain a trained target image recognition model; the trained target image recognition model includes at least one group of target image processing parameters for performing identity verification on a target document.
[0344] In this embodiment, a first sample face image and a second sample face image are extracted from the sample document images. The image size of the first sample face image is smaller than that of the second sample face image. Then the first sample face image is more susceptible to the influence of light and angle during image acquisition. Each group of target image processing parameters in the image recognition model to be trained is used to perform image enhancement processing on the first sample face image respectively to remove the influence of image acquisition angle, light, etc. on the first sample face image, and obtain each third sample face image after image enhancement processing to different degrees. After excluding the interference caused by angle, light, etc., each third sample face image is compared with the corresponding second sample face image respectively to obtain a corresponding sample image comparison result. Based on the difference between the sample image comparison result and the sample category, the target image processing parameter with the best image enhancement effect can be selected from multiple groups of image processing parameters. By using the trained image recognition model to perform identity verification on the target document, the authenticity of the target document can be accurately identified, and the accuracy of identity verification can be improved. The trained image recognition model has high recognition accuracy and fast calculation speed, and can improve the efficiency of identity verification of the target document.
[0345] In one embodiment, the processing module 1206 is further configured to: determine, from a sample parameter set in an image recognition model to be trained, current candidate image processing parameters corresponding to the current iteration, and obtain backup image processing parameters filtered out in the previous iteration;
[0346] Based on the current candidate image processing parameters and the backup image processing parameters, perform image enhancement processing on the first sample face image respectively to obtain third sample face images corresponding to each group of image processing parameters;
[0347] The training module 1210 is further configured to: for each group of image processing parameters in the current iteration, generate a characteristic curve according to the corresponding sample comparison result and the corresponding sample category, determine the corresponding characteristic area based on the characteristic curve, and filter out the backup image processing parameters that meet the area matching condition in the current iteration based on the characteristic area; select candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set as the current candidate image processing parameters corresponding to the next iteration, and use the backup image processing parameters filtered out in the current iteration as the backup image processing parameters required for the next iteration; return to the step of performing image enhancement processing on the first sample face image respectively based on the current candidate image processing parameters and the backup image processing parameters to obtain third sample face images corresponding to each group of image processing parameters, and continue to execute until all candidate image processing parameters in the sample parameter set are traversed and the training stops, and a trained target image recognition model is obtained.
[0348] In this embodiment, by the characteristic area corresponding to each group of image processing parameters calculated by the image recognition model in each iteration, and filtering out the image processing parameters that meet the area matching condition in the current iteration based on the characteristic area, the image processing parameters with the best image enhancement processing effect in the current iteration can be filtered out. Select candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set and the image processing parameters of each group filtered out in the previous iteration, and continue the next iterative calculation. In each iterative calculation, the image processing parameters with the best image enhancement processing effect can be filtered out. Based on the traversal of each group of candidate image processing parameters in the sample parameter set, through iterative traversal, each group of image processing parameters can be continuously filtered until the traversal ends and the image recognition model can automatically filter out the image processing parameters with the best image enhancement processing effect of each group. By using each group of target image processing parameters in the trained image recognition model to authenticate the identity of the target certificate, the authenticity of the target certificate can be accurately identified, and the accuracy of identity verification can be improved.
[0349] For the specific limitations of the authentication device and the training device of the image recognition model, reference may be made to the limitations of the authentication method and the training method of the image recognition model in the foregoing text, which will not be elaborated herein. Each module in the above-mentioned authentication device and the training device of the image recognition model can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so as to facilitate the processor to call and execute the operations corresponding to each of the above modules.
[0350] In one embodiment, a computer device is provided. The computer device can be a server, and its internal structural diagram can be as Figure 13 shown. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store authentication data and training data of the image recognition model. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements an authentication method and a training method of the image recognition model.
[0351] Those skilled in the art can understand that Figure 13 the structure shown in
[0352] is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0353] In one embodiment, a computer-readable storage medium is also provided, storing a computer program, and when the computer program is executed by a processor, it implements the steps in the above-mentioned method embodiments.
[0354] In one embodiment, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in the above-mentioned method embodiments.
[0355] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0356] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0357] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A training method for an image recognition model, characterized in that, The method includes: Obtaining sample document images and determining the sample categories to which the respective sample document images belong; Extracting a first sample face image and a second sample face image from the sample document images, wherein the image size of the first sample face image is smaller than the image size of the second sample face image; In each iteration, performing image enhancement processing on the first sample face image respectively through multiple groups of candidate image processing parameters in the image recognition model to be trained, and obtaining third sample face images corresponding to each group of candidate image processing parameters; Comparing each of the third sample face images with the corresponding second sample face image to obtain corresponding sample image comparison results; For each group of image processing parameters in the current iteration, generating a characteristic curve according to the corresponding sample comparison result and the corresponding sample category, determining the corresponding characteristic area based on the characteristic curve, and screening out the spare image processing parameters that meet the area matching condition in the current iteration based on the characteristic area; Determining multiple groups of candidate image processing parameters for the next iteration by using the spare image processing parameters screened out in the current iteration and the candidate image processing parameters in the sample set that have not participated in the iteration, and continuing the iteration until all the candidate image processing parameters in the sample set have participated in the iteration, and obtaining the trained target image recognition model; at least one group of target image processing parameters is included in the trained target image recognition model for authenticating the identity of the target document.
2. The method according to claim 1, wherein The step of, in each iteration, performing image enhancement processing on the first sample face image respectively through multiple groups of candidate image processing parameters in the image recognition model to be trained, and obtaining third sample face images corresponding to each group of candidate image processing parameters, includes: If it is the first iteration, obtaining a preset number of groups of candidate image processing parameters from the sample parameter set in the image recognition model to be trained, and performing image enhancement processing on the first sample face image respectively to obtain third sample face images corresponding to each group of candidate image processing parameters; If it is the iteration starting from the second time, determining the current candidate image processing parameters corresponding to the current iteration from the sample parameter set in the image recognition model to be trained, and obtaining the spare image processing parameters screened out through the previous iteration; Based on the current candidate image processing parameters and the spare image processing parameters, performing image enhancement processing on the first sample face image respectively to obtain third sample face images corresponding to each group of image processing parameters; The step of determining multiple groups of candidate image processing parameters for the next iteration by using the spare image processing parameters screened out in the current iteration and the candidate image processing parameters in the sample set that have not participated in the iteration, and continuing the iteration until all the candidate image processing parameters in the sample set have participated in the iteration, and obtaining the trained target image recognition model, includes: Selecting the candidate image processing parameters that have not participated in the iterative calculation from the sample parameter set as the current candidate image processing parameters corresponding to the next iteration, and using the spare image processing parameters screened out in the current iteration as the spare image processing parameters required for the next iteration; Continue to execute the step of performing image enhancement processing on the first sample face image based on the current candidate image processing parameters and the alternative image processing parameters respectively, to obtain third sample face images corresponding to each group of image processing parameters, until all candidate image processing parameters in the sample parameter set are traversed and the training stops, and a trained target image recognition model is obtained.
3. An authentication method, characterized in that, The method includes: Obtain a document video obtained by video capturing of a target document, and screen out target video frames that meet the image clarity condition from the document video; Extract a first face image and a second face image corresponding to the target document from the target video frames, wherein the image size of the first face image is smaller than that of the second face image; Obtain at least one group of target image processing parameters in a trained target image recognition model, and perform image enhancement processing on the first face image based on each group of target image processing parameters respectively, to obtain at least one third face image; the target image recognition model is obtained by training through the image recognition model training method described in Claim 1 or 2; Compare each of the third face images with the second face image respectively to obtain corresponding image comparison results, and determine the identity verification result of the target document according to the image comparison results.
4. The method according to claim 3, wherein The first face image is a three-dimensional face image, and the screening out of the target video frames that meet the image clarity condition from the document video includes: Extract more than one frame of candidate video frames from the document video; Detect the target document in each of the candidate video frames respectively to determine the document tilt angle corresponding to the target document in each of the candidate video frames; Based on the document tilt angle, screen out alternative video frames that meet the document clarity condition from the candidate video frames; Detect the three-dimensional face images corresponding to the target document in each of the alternative video frames respectively to determine the face blur degree corresponding to each of the three-dimensional face images in the alternative video frames; Based on the face blur degree, screen out target video frames that meet the face clarity condition from the alternative video frames.
5. The method according to claim 4, wherein The detecting the target document in each of the candidate video frames respectively to determine the document tilt angle corresponding to the target document in each of the candidate video frames includes: Detect the target document in each of the candidate video frames respectively, and segment out a candidate boundary region including the target document from the candidate video frames; For each frame of candidate video frame, determine the boundary angle formed by the corresponding candidate boundary region and a preset boundary region respectively, and use the boundary angle as the document tilt angle corresponding to the target document in the corresponding candidate video frame.
6. The method according to claim 5, characterized in that The document tilt angle includes a horizontal tilt angle and a vertical tilt angle, and the preset boundary region includes a horizontal boundary region and a vertical boundary region; the determining the boundary angle formed by the corresponding candidate boundary region and the preset boundary region respectively for each frame of candidate video frame, and using the boundary angle as the document tilt angle corresponding to the target document in the corresponding candidate video frame includes: For each candidate video frame, the length information of the corresponding candidate boundary region and the projection information corresponding to the inclination of the corresponding candidate boundary region are obtained. For each candidate video frame, based on the boundary length information of the corresponding candidate boundary region and the corresponding projection information, the horizontal inclination angle between the candidate boundary region and the horizontal boundary region and the vertical inclination angle between the candidate boundary region and the vertical boundary region are calculated.
7. The method according to claim 4, characterized in that, The detecting the three-dimensional face images corresponding to the target certificates in each of the alternative video frames to determine the face blurriness corresponding to the three-dimensional face images in each of the alternative video frames includes: Detecting the three-dimensional face images corresponding to the target certificates in each of the alternative video frames respectively to obtain the face key point detection results in each of the alternative video frames. Based on the face key point detection results in each of the alternative video frames, the face blurriness corresponding to each of the alternative video frames is determined.
8. The method according to claim 3, characterized in that Each group of target image processing parameters includes at least one processing sub-parameter corresponding to each image processing method; the performing image enhancement processing on the first face image respectively based on each group of target image processing parameters to obtain at least one third face image includes: For each group of target image processing parameters, based on the corresponding processing sub-parameters and in accordance with the image processing methods corresponding to the respective processing sub-parameters, the first face image is sequentially subjected to image enhancement processing until the corresponding third face image is obtained; the multiple image processing methods include at least one of descreening, sharpening, and denoising.
9. The method according to claim 3, characterized in that, The comparing each of the third face images with the second face image respectively to obtain the corresponding image comparison result and determining the identity verification result of the target certificate according to the image comparison result includes: Calculating the similarity between each of the third face images and the second face image respectively. Determining the maximum value of the similarities, and when the maximum value is greater than a preset similarity threshold, determining that the identity verification result of the target certificate is verification passed.
10. The method according to claim 3, wherein The first face image is a three-dimensional face image, and the method further includes: Obtaining multiple frames of video frames to be compared corresponding to different perspectives from the certificate video. Comparing the three-dimensional face images in the multiple frames of video frames to be compared to obtain the corresponding angle comparison result. The determining the identity verification result of the target certificate according to the image comparison result includes: Determining the identity verification result of the target certificate according to the image comparison result and the angle comparison result.
11. A training device for an image recognition model, characterized in that, The device includes: A sample acquisition module, configured to acquire sample certificate images and determine the sample categories to which the respective sample certificate images belong. A face extraction module, configured to extract a first sample face image and a second sample face image from the sample certificate images, where the image size of the first sample face image is smaller than the image size of the second sample face image. A processing module, configured to perform image enhancement processing on the first sample face image respectively by using multiple groups of candidate image processing parameters in the image recognition model to be trained in each iteration, so as to obtain third sample face images respectively corresponding to each group of candidate image processing parameters; A comparison result obtaining module, configured to compare each of the third sample face images with the corresponding second sample face image respectively to obtain corresponding sample image comparison results; A screening module, configured to generate a characteristic curve for each group of image processing parameters in the current iteration according to the corresponding sample comparison result and the corresponding sample category, determine the corresponding characteristic area based on the characteristic curve, and screen out the standby image processing parameters that meet the area matching condition in the current iteration based on the characteristic area; An iteration module, configured to determine multiple groups of candidate image processing parameters for the next iteration by using the standby image processing parameters screened out in the current iteration and the candidate image processing parameters in the sample set that have not participated in the iteration, and continue the iteration until the candidate image processing parameters in the sample set have all participated in the iteration and then stop, so as to obtain a trained target image recognition model; at least one group of target image processing parameters is included in the trained target image recognition model for identity verification of target certificates.
12. The training device for an image recognition model according to claim 11, wherein The processing module is further configured to: if it is the first iteration, obtain a preset number of groups of candidate image processing parameters from the sample parameter set in the image recognition model to be trained, and perform image enhancement processing on the first sample face image respectively to obtain third sample face images respectively corresponding to each group of candidate image processing parameters; if it is the iteration starting from the second time, determine the current candidate image processing parameters corresponding to the current iteration from the sample parameter set in the image recognition model to be trained, and obtain the standby image processing parameters screened out through the previous iteration; Based on the current candidate image processing parameters and the standby image processing parameters, perform image enhancement processing on the first sample face image respectively to obtain third sample face images respectively corresponding to each group of image processing parameters; The iteration module is further configured to select the candidate image processing parameters that have not participated in the iteration calculation from the sample parameter set as the current candidate image processing parameters corresponding to the next iteration, and use the standby image processing parameters screened out in the current iteration as the standby image processing parameters required for the next iteration; Return to the step of performing image enhancement processing on the first sample face image respectively based on the current candidate image processing parameters and the standby image processing parameters to obtain third sample face images respectively corresponding to each group of image processing parameters, and continue to execute until all the candidate image processing parameters in the sample parameter set are traversed and then stop training to obtain a trained target image recognition model.
13. An authentication device, characterized in that, The device includes: An acquisition module, configured to acquire a certificate video obtained by video acquisition of a target certificate, and screen out target video frames that meet the image clarity condition from the certificate video; An extraction module, configured to extract a first face image and a second face image corresponding to the target certificate from the target video frame, wherein the image size of the first face image is smaller than that of the second face image; An image enhancement module, configured to obtain at least one set of target image processing parameters in a trained target image recognition model, and respectively perform image enhancement processing on the first face image based on each set of target image processing parameters to obtain at least one third face image; the target image recognition model is obtained by training with the image recognition model training device as described in claim 11 or 12; A comparison module, configured to respectively compare each of the third face images with the second face image to obtain corresponding image comparison results, and determine the identity verification result of the target certificate according to the image comparison results.
14. The authentication device according to claim 13, wherein The first face image is a three-dimensional face image, and the acquisition module is further configured to extract more than one candidate video frame from the certificate video; respectively detect the target certificates in each of the candidate video frames to determine the certificate tilt angles corresponding to the target certificates in each of the candidate video frames; based on the certificate tilt angles, screen out standby video frames that meet the certificate clarity condition from the candidate video frames; detect the three-dimensional face images corresponding to the target certificates in each of the standby video frames to determine the face blur degrees corresponding to the three-dimensional face images in each of the standby video frames; based on the face blur degrees, screen out target video frames that meet the face clarity condition from the standby video frames.
15. The authentication device according to claim 14, characterized in that The acquisition module is further configured to respectively detect the target certificates in each of the candidate video frames, and segment candidate boundary regions including the target certificates from the candidate video frames; for each candidate video frame, respectively determine the boundary angle formed by the corresponding candidate boundary region and a preset boundary region, and use the boundary angle as the certificate tilt angle corresponding to the target certificate in the corresponding candidate video frame.
16. The authentication device according to claim 15, wherein The certificate tilt angle includes a horizontal tilt angle and a vertical tilt angle, and the preset boundary region includes a horizontal boundary region and a vertical boundary region; the acquisition module is further configured to, for each candidate video frame, obtain the length information of the corresponding candidate boundary region and the projection information corresponding to the inclination of the corresponding candidate boundary region; for each candidate video frame, calculate the horizontal tilt angle between the candidate boundary region and the horizontal boundary region and the vertical tilt angle between the candidate boundary region and the vertical boundary region based on the boundary length information of the corresponding candidate boundary region and the corresponding projection information.
17. The authentication device according to claim 14, wherein The acquisition module is further configured to respectively detect the three-dimensional face images corresponding to the target certificates in each of the standby video frames to obtain face key point detection results in each of the standby video frames; determine the face blur degrees corresponding to each of the standby video frames based on the face key point detection results in each of the standby video frames.
18. The authentication device according to claim 13, wherein Each set of target image processing parameters includes at least one processing sub-parameter corresponding to each image processing method; the image enhancement module is further configured to, for each set of target image processing parameters, based on the corresponding processing sub-parameters, and in accordance with the image processing methods respectively corresponding to the respective processing sub-parameters, sequentially perform image enhancement processing on the first face image until the corresponding third face image is obtained; the multiple image processing methods include at least one of de-stripping, sharpening, and de-white noise.
19. The authentication device according to claim 13, characterized in that, The comparison module is further configured to calculate the similarity between each of the third face images and the second face image; determine the maximum value among the similarities, and when the maximum value is greater than a preset similarity threshold, determine that the identity verification result of the target document is verification passed.
20. The authentication device according to claim 13, wherein The first face image is a three-dimensional face image, and the device further includes: An angle comparison module, configured to obtain multiple frames of video frames to be compared corresponding to different perspectives from the document video; compare the three-dimensional face images in the multiple frames of video frames to be compared to obtain corresponding angle comparison results; The comparison module is further configured to determine the identity verification result of the target document according to the image comparison result and the angle comparison result.
21. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the method according to any one of claims 1 to 10 is implemented.
22. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1 to 10 is implemented.
23. A computer program product comprising computer instructions, characterized in that, When the computer instruction is executed by the processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Certificate identification method, device and equipment
CN110516739A
Certificate authenticity verification method and system, computer equipment and readable storage medium
CN110751041A
Face recognition method and system
CN111461034A
Face image preprocessing method and device and apparatus and storage medium
CN112084936A