Face image detection method, device, equipment, storage medium and program product
Patent Information
- Application Number
- CN202410302835.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-15
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2044-03-15
AI Technical Summary
[0002]相关技术中,对于伪造人脸的检测,只在特定场景及特定领域内取得了较好的效果,因此存在着显著的泛用性不足的问题
[0040]本申请实施例提供的人脸图像检测方法、装置、设备、存储介质和程序产品,其中,方法包括:将待检测人脸视频进行分割处理,得到所述待检测人脸视频对应的多个第一图像;将所述多个第一图像输入预先训练好的鉴别模型,得到所述多个第一图像对应的第一结果;所述第一结果表征将所述多个第一图像输入所述预先训练好的鉴别模型得到的输出值;对所述多个第一图像中的至少一个第一图像进行替换处理,得到替换处理后的多个第二图像;将所述多个第二图像输入所述预先训练好的鉴别模型,得到所述多个第二图像对应的第二结果;所述第二结果表征将所述多个第二图像输入所述预先训练好的鉴别模型得到的输出值;基于所述第一结果和所述第二结果确定所述待检测人脸视频的检测结果,本申请实施例的方案,通过对待检测人脸视频进行分割处理,以及对第一图像进行替换处理,得到多个检测结果,通过多次检测,降低模型误判的几率,提高了检测的正确性。
Smart Images

Figure CN118823842B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, storage medium, and program product for detecting human face images. Background Technology
[0002] In related technologies, the detection of forged faces has only achieved good results in specific scenarios and domains, thus exhibiting a significant lack of general applicability. Currently, there is no effective solution to this problem. Summary of the Invention
[0003] To address the existing technical problems, embodiments of this application provide a method, apparatus, device, storage medium, and program product for detecting face images.
[0004] To achieve the above objectives, the technical solution of this application embodiment is implemented as follows:
[0005] This application provides a method for detecting face images, including:
[0006] The video of the face to be detected is segmented to obtain multiple first images corresponding to the video of the face to be detected;
[0007] The plurality of first images are input into a pre-trained discrimination model to obtain a first result corresponding to the plurality of first images; the first result represents the output value obtained by inputting the plurality of first images into the pre-trained discrimination model;
[0008] At least one of the plurality of first images is replaced to obtain a plurality of second images after replacement.
[0009] The plurality of second images are input into the pre-trained discrimination model to obtain a second result corresponding to the plurality of second images; the second result represents the output value obtained by inputting the plurality of second images into the pre-trained discrimination model;
[0010] The detection result of the face video to be detected is determined based on the first result and the second result.
[0011] In the above scheme, the step of segmenting the face video to be detected to obtain multiple first images corresponding to the face video to be detected includes:
[0012] The video of the face to be detected is processed to extract and obtain multiple third images corresponding to the face to be detected;
[0013] The plurality of third images are segmented using a preset neural network model to obtain the plurality of first images.
[0014] The method in the above scheme further includes:
[0015] The real face video and the fake face video are segmented separately to obtain multiple real face images corresponding to the real face video and multiple fake face images corresponding to the fake face video.
[0016] The multiple real face images and the multiple fake face images are input into the initial identification model for training to obtain the pre-trained identification model.
[0017] In the above scheme, the step of inputting the multiple real face images and the multiple fake face images into the initial identification model for training to obtain the pre-trained identification model includes:
[0018] The multiple real face images and the multiple fake face images are input into the convolutional layer of the initial identification model to obtain the first encoding information corresponding to the real face images and the second encoding information corresponding to the fake face images;
[0019] The weight parameters corresponding to the initial discrimination model are determined based on the first encoding information and the second encoding information.
[0020] The initial discrimination model is trained based on the weight parameters to obtain the pre-trained discrimination model.
[0021] In the above scheme, the step of replacing at least one of the plurality of first images to obtain a plurality of second images after replacement includes:
[0022] At least one of the plurality of first images is replaced with a blank image to obtain the plurality of second images.
[0023] In the above scheme, determining the detection result of the face video to be detected based on the first result and the second result includes:
[0024] The first result and the second result are processed by a preset algorithm to obtain a first value;
[0025] The detection result of the face video to be detected is determined based on the first value and the preset value.
[0026] In the above scheme, determining the detection result of the face video to be detected based on the first value and the preset value includes:
[0027] If the first value is less than or equal to the preset value, the face video to be detected is determined to be a real face video;
[0028] If the first value is greater than the preset value, the face video to be detected is determined to be a fake face video.
[0029] This application embodiment also provides a face image detection device, the device comprising:
[0030] The segmentation processing unit is used to segment the face video to be detected to obtain multiple first images corresponding to the face video to be detected.
[0031] The first input unit is used to input the plurality of first images into a pre-trained discrimination model to obtain a first result corresponding to the plurality of first images; the first result represents the output value obtained by inputting the plurality of first images into the pre-trained discrimination model;
[0032] A replacement processing unit is used to perform replacement processing on at least one of the plurality of first images to obtain a plurality of second images after replacement processing;
[0033] The second input unit is used to input the plurality of second images into the pre-trained discrimination model to obtain a second result corresponding to the plurality of second images; the second result represents the output value obtained by inputting the plurality of second images into the pre-trained discrimination model;
[0034] A determining unit is configured to determine the detection result of the face video to be detected based on the first result and the second result.
[0035] This application also provides an electronic device, including:
[0036] Memory, used to store executable instructions;
[0037] A processor, when executing executable instructions stored in the memory, implements any step of the method described above.
[0038] This application also provides a computer-readable storage medium storing executable instructions for implementing any step of the method described above when executed by a processor.
[0039] This application also provides a computer program product, including a computer program that, when executed by a processor, implements any step of the method described above.
[0040] The face image detection method, apparatus, device, storage medium, and program product provided in this application embodiment include: segmenting a face video to be detected to obtain multiple first images corresponding to the face video; inputting the multiple first images into a pre-trained discrimination model to obtain a first result corresponding to the multiple first images; the first result represents the output value obtained by inputting the multiple first images into the pre-trained discrimination model; replacing at least one of the multiple first images to obtain multiple second images after replacement; inputting the multiple second images into the pre-trained discrimination model to obtain a second result corresponding to the multiple second images; the second result represents the output value obtained by inputting the multiple second images into the pre-trained discrimination model; and determining the detection result of the face video to be detected based on the first result and the second result. The solution in this application embodiment, by segmenting the face video to be detected and replacing the first images to obtain multiple detection results, reduces the probability of model misjudgment and improves the accuracy of detection through multiple detections. Attached Figure Description
[0041] Figure 1 A schematic flowchart illustrating a face image detection method provided in an embodiment of this application;
[0042] Figure 2 This is a schematic diagram of a face image detection device according to an embodiment of this application;
[0043] Figure 3 This is a schematic diagram of the hardware entity structure of an electronic device in an embodiment of this application. Detailed Implementation
[0044] The present application will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0045] In related technologies, one approach to detecting fake faces combines a CNN-based model and a VIT-based model. By fusing the detection results of multiple base models, a more accurate fused model detection result is obtained. However, this method, which integrates the detection results of all base models, does not consider the significant biases that different models may have in their detection capabilities for different types of input images. In certain specific scenarios, the detection results of some base models may mislead other base models, resulting in a lower accuracy of the fused detection result compared to the original model.
[0046] Another approach primarily uses consistency detection between ambient lighting features and facial lighting features to perform deepfake face identification, without relying on a reference video for comparison. Therefore, this method exhibits superior generalization performance. However, it's important to note that this method requires significant lighting feature information in the video for deepfake face identification. Otherwise, if the video lacks sufficient lighting information, it will be difficult to effectively distinguish between genuine and fake faces.
[0047] Another approach utilizes subtle forgery features extracted from the color gradient domain for forgery detection. Specifically, they convert typical primary color (Red, Green, Blue, RGB) images to the HueSaturation Value (HSV) color space, and then extract horizontal and vertical gradient domain information from it. They use the Local Direction Number (LDN) features extracted from the gradient domain to detect genuine and fake images. However, this method requires high resolution of the video / image being detected and is not suitable for blurry or heavily compressed media files.
[0048] Another approach involves obtaining a first sample image set and a second sample image set. The fake faces in the first sample image set are forged using a first forgery method, and the fake faces in the second sample image set are forged using a second forgery method. A first teacher model is trained based on the first sample image set to identify the first forgery method. A second teacher model is trained based on the second sample image set to identify the second forgery method. The first teacher model and the second teacher model are then merged to train a student model, generating a target face forgery image identification model for identifying both the first and second forgery methods.
[0049] Based on this, the solution in this application obtains multiple detection results by segmenting the face video to be detected and replacing the first image. By performing multiple detections, the probability of model misjudgment is reduced and the accuracy of detection is improved.
[0050] This application provides a method for detecting facial images, applied to an electronic device. The function implemented by this method can be achieved by a processor in the electronic device calling program code. The program code can be stored in a computer storage medium. Therefore, the electronic device includes at least a processor and a storage medium. As an example, the electronic device can be a mobile phone, computer, terminal, information transceiver, tablet device, personal digital assistant, etc.
[0051] Figure 1 This is a flowchart illustrating a face image detection method provided in an embodiment of this application; as shown below. Figure 1 As shown, the method includes:
[0052] Step 101: Segment the video of the face to be detected to obtain multiple first images corresponding to the video of the face to be detected;
[0053] Step 102: Input the plurality of first images into a pre-trained discrimination model to obtain a first result corresponding to the plurality of first images; the first result represents the output value obtained by inputting the plurality of first images into the pre-trained discrimination model;
[0054] Step 103: Replace at least one of the plurality of first images to obtain a plurality of second images after replacement;
[0055] Step 104: Input the plurality of second images into the pre-trained discrimination model to obtain a second result corresponding to the plurality of second images; the second result represents the output value obtained by inputting the plurality of second images into the pre-trained discrimination model;
[0056] Step 105: Determine the detection result of the face video to be detected based on the first result and the second result.
[0057] In step 101, the first image can be understood as the image obtained by segmenting the facial image extracted from the video of the face to be detected. The number of the first images can be determined according to the actual situation and is not limited here. As an example, the number of the first images can be 9.
[0058] The step of segmenting the face video to be detected to obtain multiple first images corresponding to the face video can be understood as extracting the face video to be detected to obtain multiple third images corresponding to the face to be detected; and using a preset neural network model to segment the multiple third images to obtain the multiple first images.
[0059] It should be noted that the video of the face to be detected can also be replaced with an image to be detected, and the rest of the steps are the same. It can also detect whether the face in the image to be detected is a real face or a fake face.
[0060] In step 102, the method for obtaining the pre-trained discrimination model can be as follows: segmenting the real face video and the fake face video respectively to obtain multiple real face images corresponding to the real face video and multiple fake face images corresponding to the fake face video; inputting the multiple real face images and the multiple fake face images into the initial discrimination model for training to obtain the pre-trained discrimination model.
[0061] The step of inputting the plurality of first images into a pre-trained discrimination model to obtain the first result corresponding to the plurality of first images can be understood as stitching the plurality of first images together to obtain a stitched image, and then inputting the stitched image into the pre-trained discrimination model to obtain the first result. The first result can be understood as a logistic value.
[0062] In step 103, the method of replacing at least one of the plurality of first images can be determined according to the actual situation and is not limited here. As an example, at least one of the plurality of first images can be replaced with a blank image.
[0063] To facilitate understanding, a practical application is illustrated here, in which each of the plurality of first images is replaced to obtain a plurality of second images.
[0064] The number of second images depends on the number of first images. For example, after segmenting the face image in the face video to be detected, nine local images (i.e., multiple first images) are obtained. Then, each of the nine local images is replaced with a blank image to obtain nine replaced face images (i.e., multiple second images).
[0065] In step 104, the pre-trained discrimination model for the multiple second image inputs can be the same model as the pre-trained discrimination model for the multiple first image inputs.
[0066] The number of second results corresponds to the number of second images. For example, inputting nine replaced face images (i.e., multiple second images) into a pre-trained discrimination model yields nine sets of output results (i.e., second results). These second results can be understood as logits.
[0067] In step 105, the detection result of the face video to be detected includes whether the face in the face video to be detected is a real face or a fake face.
[0068] The step of determining the detection result of the face video to be detected based on the first result and the second result can be understood as processing the first result and the second result using a preset algorithm to obtain a first value; and determining the detection result of the face video to be detected based on the first value and the preset value.
[0069] The solution in this application embodiment obtains multiple detection results by segmenting the face video to be detected and replacing the first image. By performing multiple detections, the probability of model misjudgment is reduced and the accuracy of detection is improved.
[0070] In one embodiment, the step of segmenting the video of the face to be detected to obtain multiple first images corresponding to the video of the face to be detected includes:
[0071] The video of the face to be detected is processed to extract and obtain multiple third images corresponding to the face to be detected;
[0072] The plurality of third images are segmented using a preset neural network model to obtain the plurality of first images.
[0073] The plurality of third images can be understood as multiple image frames extracted from the video of the face to be detected. The method of extracting and processing the video of the face to be detected can be determined according to the actual situation and is not limited here.
[0074] The preset neural network model can be determined according to the actual situation and is not limited here. As an example, the preset neural network module can be a region-based convolutional neural network (RCNN) model.
[0075] The process of segmenting the multiple third images using a preset neural network model to obtain the multiple first images can be understood as follows: using a preset neural network to locate faces in the multiple third images, cropping out the face images obtained after the location processing, correcting the position and angle of the obtained face images to obtain aligned face images, scaling the aligned face images to obtain face images of a target size, and segmenting the face images of the target size to obtain the multiple first images.
[0076] The target size can be determined according to the actual situation and is not limited here. As an example, the target size can be 96×96. The segmentation method can be determined according to the actual situation and is not limited here. As an example, a 3*3 segmentation can be performed.
[0077] For ease of understanding, the process of segmenting the target-size facial image to obtain the plurality of first images can be illustrated by, for example, segmenting a 96×96-size facial image into 3*3 segments to obtain 9 32*32 first images.
[0078] In one embodiment, the method further includes:
[0079] The real face video and the fake face video are segmented separately to obtain multiple real face images corresponding to the real face video and multiple fake face images corresponding to the fake face video.
[0080] The multiple real face images and the multiple fake face images are input into the initial identification model for training to obtain the pre-trained identification model.
[0081] The initial identification model can be understood as a convolutional neural network model. The method for segmenting real and fake face videos is the same as the method for segmenting the face video to be detected described above, and will not be repeated here. It should be noted that the number of real and fake face images obtained is the same.
[0082] The step of inputting the plurality of real face images and the plurality of fake face images into the initial identification model for training to obtain a pre-trained identification model can be understood as follows: inputting the plurality of real face images and the plurality of fake face images into the convolutional layer of the initial identification model to obtain first encoding information corresponding to the real face images and second encoding information corresponding to the fake face images; determining the weight parameters corresponding to the initial identification model based on the first encoding information and the second encoding information; and training the initial identification model based on the weight parameters to obtain the pre-trained identification model.
[0083] In this model, real face images are input with real labels, while fake face images are input with fake labels.
[0084] It should be noted that the pre-trained discrimination model includes discrimination models with different architectures and parameters.
[0085] In one embodiment, the step of inputting the plurality of real face images and the plurality of fake face images into an initial identification model for training to obtain the pre-trained identification model includes:
[0086] The multiple real face images and the multiple fake face images are input into the convolutional layer of the initial identification model to obtain the first encoding information corresponding to the real face images and the second encoding information corresponding to the fake face images;
[0087] The weight parameters corresponding to the initial discrimination model are determined based on the first encoding information and the second encoding information.
[0088] The initial discrimination model is trained based on the weight parameters to obtain the pre-trained discrimination model.
[0089] The first encoding information can be understood as the nonlinear encoding information corresponding to the real face image, and can be denoted as I. a Or I b The second encoding information can be understood as the nonlinear encoding information corresponding to the forged face image, which can be denoted as I. n .
[0090] The step of determining the weight parameters corresponding to the initial discrimination model based on the first encoding information and the second encoding information, and training the initial discrimination model based on the weight parameters to obtain the pre-trained discrimination model can be understood as performing a preset loss function operation based on the first encoding information and the second encoding information to obtain the corresponding weight parameters, continuously inputting the face image into the convolutional layer of the initial discrimination model to obtain the weight parameters, until the initial discrimination model converges, thus obtaining the pre-trained discrimination model.
[0091] The solution in this application comprehensively considers multiple features of facial images in videos and trains multiple neural network models to detect the authenticity of faces. The detection using multiple models is more reliable.
[0092] In one embodiment, the step of replacing at least one of the plurality of first images to obtain a plurality of second images after replacement includes:
[0093] At least one of the plurality of first images is replaced with a blank image to obtain the plurality of second images.
[0094] The number of first images to be replaced can be determined according to the actual situation and is not limited here. As an example, each of the multiple first images is replaced with a blank image.
[0095] It should be noted that the number of the first image and the number of the second image are the same. For example, one of the nine first images is replaced with a blank image, and this process is repeated nine times (each time the first image being replaced is different), resulting in nine second images.
[0096] The solution in this application involves multiple segmentation and recombination of the face image to be detected. The multiple images obtained through multiple recombinations reduce the false alarm rate and false negative rate, resulting in higher detection accuracy.
[0097] In one embodiment, determining the detection result of the face video to be detected based on the first result and the second result includes:
[0098] The first result and the second result are processed by a preset algorithm to obtain a first value;
[0099] The detection result of the face video to be detected is determined based on the first value and the preset value.
[0100] The first result and the second result are processed by a preset algorithm to obtain a first value. The preset algorithm can be determined according to actual circumstances and is not limited here. As an example, the preset algorithm can be a calculation using a preset formula. The first value can be understood as an outlier (ADD) obtained through the preset algorithm. For ease of understanding, an example is provided here, where the first result is processed using... The Shannon entropy corresponding to the first result (1 set of Shannon entropy) is calculated, and the second result is calculated in the same way. The Shannon entropy corresponding to the second result (9 sets of Shannon entropy) was calculated. Based on the Shannon entropy obtained above, the following was adopted: The outlier value (i.e., the first value) is obtained through calculation; where, This is the output obtained by replacing 1 to 9 local image blocks with blank image blocks respectively. This is the output obtained without using blank image blocks. It is the maximum value of all entropy. It is the minimum of all entropy.
[0101] The step of determining the detection result of the face video to be detected based on the first value and the preset value can be understood as follows: if the first value is less than or equal to the preset value, the face video to be detected is determined to be a real face video; if the first value is greater than the preset value, the face video to be detected is determined to be a fake face video. The preset value can be determined according to actual circumstances and is not limited here.
[0102] The solution in this application calculates outliers using Shannon entropy of multiple sets of logical values and uses these outliers as labels to determine the authenticity of face images, resulting in higher detection accuracy.
[0103] In one embodiment, determining the detection result of the face video to be detected based on the first value and the preset value includes:
[0104] If the first value is less than or equal to the preset value, the face video to be detected is determined to be a real face video;
[0105] If the first value is greater than the preset value, the face video to be detected is determined to be a fake face video.
[0106] Wherein, if the first value is less than or equal to the preset value, it can be understood that the 10 output values of the model are relatively stable and the image to be detected does not contain forged features; if the first value is greater than the preset value, it can be understood that the detection result of replacing the image block containing forged features with a blank image block and the detection result of replacing the image block containing non-forged features with a blank image block should be different, that is, the outlier value is larger.
[0107] To better understand, here's an example of a face image detection method specifically for identifying fake faces in videos using a convolutional neural network:
[0108] Step 1: Segment the real face video and the fake face video into single frames, locate and crop the face images from the frames to obtain aligned facial images. Simultaneously, label these images as real / fake to construct the training set for the discrimination model.
[0109] Step 1 includes the following sub-steps:
[0110] Step 1.1: For several real face videos and fake face videos, obtain the same number of image frames from each video.
[0111] Step 1.2: Use the RCNN model to locate faces in each image frame and crop out the located face images. At the same time, correct the position and angle of the face images to obtain aligned facial images.
[0112] Step 1.3: Scaling the obtained facial images to a uniform size of 96×96 and labeling them as real or fake.
[0113] Step 2: Input each image from the training set into the discrimination model, and train the discrimination model using the gradient backpropagation algorithm based on the output of the discrimination model until the discrimination model converges. This training process is iterative and is used to train multiple discrimination models with different parameters and architectures.
[0114] Step 2 includes the following sub-steps:
[0115] Step 2.1: Input the face image I into the convolutional layer of the discrimination model to obtain the nonlinear encoding f(I) of the corresponding face image. a And use the Siamese loss to optimize the weights of the discrimination model: Where δ + =f(I a )-f(I p )2,δ -=f(I a )-f(I n )2, μ is a relaxation term that is always positive, I a and I p It is a non-linear encoding of real human facial images, I n It is a non-linear encoding for forging human face images.
[0116] Step 2.2: Iterate through Step 2.1 until the identification model converges.
[0117] Step 2.3: Continuously iterate through Step 2.2 to train multiple discrimination models with different architectures and parameters.
[0118] Step 3: Segment the image / video of the face to be detected into single frames, locate and crop the face image in the frame to obtain the aligned face image, and cut it into 9 small blocks.
[0119] Step 3 includes the following sub-steps:
[0120] Step 3.1: Extract several image frames from the image / video to be detected.
[0121] Step 3.2: Use the RCNN model to locate faces in each image frame and crop out the located face images. At the same time, correct the position and angle of the face images to obtain aligned facial images.
[0122] Step 3.3: Scaling the obtained facial images to a uniform size of 96×96.
[0123] Step 3.4: Divide the obtained face image into 3*3 segments to obtain 9 32*32 partial images.
[0124] Step 4: Input the facial image into the set of discrimination models obtained in Step 2 to obtain a set of authenticity scores.
[0125] Step 4 includes the following sub-steps:
[0126] Step 4.1: Piece the 9 partial images back to the original order and size of 96*96.
[0127] Step 4.2: Input the stitched 96*96 size image into the identification model and record the model's output logits.
[0128] Step 4.3: Replace one of the nine partial images with a blank image block, leave the other image blocks unprocessed, and stitch all the image blocks back to the original order to a size of 96*96.
[0129] Step 4.4: Input the stitched 96*96 size image into the discrimination model and record the model's output logits.
[0130] Step 4.5: Repeat steps 4.3 and 4.4 until all local image blocks have been replaced by blank image blocks once, resulting in 9 sets of output logits.
[0131] Step 4.4: Integrate the model output logits obtained in Steps 4.2 and 4.5 to obtain a total of 10 sets of model output logits.
[0132] Step 5: Perform outlier detection on the 10 sets of model output logits obtained in Step 4, and determine whether they are real human faces based on the outlier detection results.
[0133] Step 5 includes the following sub-steps:
[0134] Step 5.1: Use the formula Calculate the Shannon entropy for each set of logits. For the Shannon entropy of 10 sets of logits, use the following formula. Calculate outlier values; where, This is the output obtained by replacing 1 to 9 local image blocks with blank image blocks respectively. This is the output obtained without using blank image blocks. It is the maximum value of all entropy. It is the minimum of all entropy.
[0135] Step 5.2: If the face image to be detected does not contain forged features, the model's 10 output logits should be relatively stable, i.e., the outlier value should be small. If the face image to be detected contains forged features, the detection result of replacing the image block containing the forged features with a blank image block should differ from the detection result of replacing the image block containing the non-forged features with a blank image block, i.e., the outlier value should be large. By determining whether the outlier value is greater than a certain threshold N, we can determine whether the target image is a forged face.
[0136] Step 6: Weight the detection results of each model to obtain the final result.
[0137] Step 6 includes the following sub-steps:
[0138] Step 6.1: Perform a relative majority vote on the detection results of each model to obtain the final detection result.
[0139] The method in this application embodiment has the following technical effects:
[0140] 1. It does not require model fusion or knowledge distillation between student and teacher models, and has the advantages of lower implementation difficulty and lower computational cost.
[0141] 2. The facial images to be detected are segmented, replaced, recombined, and subjected to complex reasoning multiple times. This multiple reasoning reduces the false alarm rate and false negative rate, resulting in higher detection accuracy.
[0142] 3. By integrating multiple convolutional neural network models and comprehensively considering various features of facial images in videos, reliable detection of fake faces is achieved. Compared with existing technologies that rely on a single model or specific video features, this technology has greater versatility.
[0143] 4. The training set for training models contains heterogeneous data from multiple sources, which is more representative than methods that rely on a single dataset, thus improving the model's generalization performance.
[0144] To implement the method of this application embodiment, this application embodiment also provides a face image detection device 200, which is installed on an electronic device. Figure 2 This is a schematic diagram of a face image detection device according to an embodiment of this application; as shown Figure 2 As shown, it includes:
[0145] The segmentation processing unit 201 is used to segment the face video to be detected to obtain multiple first images corresponding to the face video to be detected.
[0146] The first input unit 202 is used to input the plurality of first images into a pre-trained discrimination model to obtain a first result corresponding to the plurality of first images; the first result represents the output value obtained by inputting the plurality of first images into the pre-trained discrimination model;
[0147] The replacement processing unit 203 is used to perform replacement processing on at least one of the plurality of first images to obtain a plurality of second images after replacement processing.
[0148] The second input unit 204 is used to input the plurality of second images into the pre-trained discrimination model to obtain a second result corresponding to the plurality of second images; the second result represents the output value obtained by inputting the plurality of second images into the pre-trained discrimination model;
[0149] The determining unit 205 is used to determine the detection result of the face video to be detected based on the first result and the second result.
[0150] Here, in one embodiment, the segmentation processing unit 201 is further configured to extract and process the video of the face to be detected to obtain multiple third images corresponding to the face to be detected; and to segment the multiple third images using a preset neural network model to obtain the multiple first images.
[0151] In one embodiment, the device 200 further includes a training unit, which is used to segment the real face video and the fake face video respectively to obtain multiple real face images corresponding to the real face video and multiple fake face images corresponding to the fake face video; and input the multiple real face images and the multiple fake face images into an initial discrimination model for training to obtain the pre-trained discrimination model.
[0152] Here, in one embodiment, the training unit is further configured to input the plurality of real face images and the plurality of fake face images into the convolutional layer of the initial discrimination model to obtain first encoding information corresponding to the real face images and second encoding information corresponding to the fake face images; determine the weight parameters corresponding to the initial discrimination model based on the first encoding information and the second encoding information; and train the initial discrimination model based on the weight parameters to obtain the pre-trained discrimination model.
[0153] Here, in one embodiment, the replacement processing unit 203 is further configured to replace at least one of the plurality of first images with a blank image to obtain the plurality of second images.
[0154] Here, in one embodiment, the determining unit 205 is further configured to process the first result and the second result using a preset algorithm to obtain a first value; and to determine the detection result of the face video to be detected based on the first value and the preset value.
[0155] Here, in one embodiment, the determining unit 205 is further configured to determine that the face video to be detected is a real face video when the first value is less than or equal to the preset value; and to determine that the face video to be detected is a fake face video when the first value is greater than the preset value.
[0156] It should be noted that the face image detection device provided in the above embodiments is only illustrated by the division of the above-described program modules. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. Furthermore, the face image detection device and the face image detection method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0157] Based on the hardware implementation of the above program modules, this application embodiment also provides an electronic device, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements the steps in the face image detection method provided in the above embodiment.
[0158] Correspondingly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the face image detection method provided in the above embodiments.
[0159] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0160] It should be noted that, Figure 3 This is a schematic diagram of a hardware entity structure of an electronic device in an embodiment of this application, such as... Figure 3 As shown, the hardware entity of the electronic device 300 includes a processor 301 and a memory 303. Optionally, the electronic device 300 may also include a communication interface 302.
[0161] It is understood that memory 303 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 303 described in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0162] The methods disclosed in the embodiments of this application can be applied to or implemented by the processor 301. The processor 301 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 301 or by instructions in the form of software. The processor 301 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 301 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in the memory 303. The processor 301 reads the information in the memory 303 and combines its hardware to complete the steps of the aforementioned method.
[0163] In an exemplary embodiment, the device may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned method.
[0164] For example, this application also provides a computer program product, including a computer program; the computer program can be executed by the processor 301 of the electronic device 300 to perform the steps described in any of the foregoing methods.
[0165] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0166] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0167] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0168] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0169] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0170] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for detecting human face images, characterized in that, The method includes: The video of the face to be detected is segmented to obtain multiple first images corresponding to the video of the face to be detected; The plurality of first images are input into a pre-trained discrimination model to obtain a first result corresponding to the plurality of first images; the first result represents the output value obtained by inputting the plurality of first images into the pre-trained discrimination model; the first result is a logical value; At least one of the plurality of first images is replaced to obtain a plurality of second images after replacement. The plurality of second images are input into the pre-trained discrimination model to obtain a second result corresponding to the plurality of second images; the second result represents the output value obtained by inputting the plurality of second images into the pre-trained discrimination model; the second result is a logical value; The detection result of the face video to be detected is determined based on the first result and the second result; The step of replacing at least one of the plurality of first images to obtain a plurality of second images after replacement includes: At least one of the plurality of first images is replaced with a blank image to obtain the plurality of second images; The step of determining the detection result of the face video to be detected based on the first result and the second result includes: The first result and the second result are processed by a preset algorithm to obtain a first value; The detection result of the face video to be detected is determined based on the first value and the preset value; Determining the detection result of the face video to be detected based on the first value and the preset value includes: If the first value is less than or equal to the preset value, the face video to be detected is determined to be a real face video; If the first value is greater than the preset value, the face video to be detected is determined to be a fake face video; The step of processing the first result and the second result using a preset algorithm to obtain a first value includes: using the first result... The Shannon entropy corresponding to the first result is calculated; the second result is then used... The Shannon entropy corresponding to the second result is calculated; the outlier value is calculated for the Shannon entropy corresponding to the first result and the Shannon entropy corresponding to the second result; the outlier value is the first value.
2. The method according to claim 1, characterized in that, The step of segmenting the video of the face to be detected to obtain multiple first images corresponding to the video of the face to be detected includes: The video of the face to be detected is processed to extract and obtain multiple third images corresponding to the face to be detected; The plurality of third images are segmented using a preset neural network model to obtain the plurality of first images.
3. The method according to claim 1, characterized in that, The method further includes: The real face video and the fake face video are segmented separately to obtain multiple real face images corresponding to the real face video and multiple fake face images corresponding to the fake face video. The multiple real face images and the multiple fake face images are input into the initial identification model for training to obtain the pre-trained identification model.
4. The method according to claim 3, characterized in that, The step of inputting the multiple real face images and the multiple fake face images into the initial identification model for training to obtain the pre-trained identification model includes: The multiple real face images and the multiple fake face images are input into the convolutional layer of the initial identification model to obtain the first encoding information corresponding to the real face images and the second encoding information corresponding to the fake face images; The weight parameters corresponding to the initial discrimination model are determined based on the first encoding information and the second encoding information. The initial discrimination model is trained based on the weight parameters to obtain the pre-trained discrimination model.
5. A face image detection device, characterized in that, The apparatus for implementing the face image detection method according to any one of claims 1 to 4 includes: The segmentation processing unit is used to segment the face video to be detected to obtain multiple first images corresponding to the face video to be detected. The first input unit is used to input the plurality of first images into a pre-trained discrimination model to obtain a first result corresponding to the plurality of first images; the first result represents the output value obtained by inputting the plurality of first images into the pre-trained discrimination model; A replacement processing unit is used to perform replacement processing on at least one of the plurality of first images to obtain a plurality of second images after replacement processing; The second input unit is used to input the plurality of second images into the pre-trained discrimination model to obtain a second result corresponding to the plurality of second images; the second result represents the output value obtained by inputting the plurality of second images into the pre-trained discrimination model; A determining unit is configured to determine the detection result of the face video to be detected based on the first result and the second result.
6. An electronic device, characterized in that, include: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the face image detection method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, It stores executable instructions for use by a processor to implement the face image detection method according to any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the face image detection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Forgery detection method for spliced and distorted digital photos
CN102609947A
Counterfeit face detection method and device based on difference perception element learning
CN112784781A