Face forgery detection method and device, and electronic device
By using real face videos to train the face image reconstruction model, reconstructed face images that closely resemble real face images are generated, solving the problem of multiple distribution centers affecting detection accuracy and achieving more efficient face forgery detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DUXIAOMAN TECH (BEIJING) CO LTD
- Filing Date
- 2022-09-27
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, the increased number of real face video samples used in the training process of machine learning models leads to multiple distribution centers of features in the feature space, affecting the accuracy of face forgery detection.
By inputting the face video to be detected into the face image reconstruction model, the model trained with real face videos is used for frame sampling and feature extraction to generate a reconstructed face image that is close to the real face image. The difference detection is then used to determine whether the face video to be detected is a fake face video.
This improves the accuracy of face forgery detection, avoids detection errors caused by multiple distribution centers, and ensures the accuracy of detection results.
Smart Images

Figure CN115512416B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence (AI) technology, and in particular to a method, apparatus and electronic device for detecting face forgery. Background Technology
[0002] Deepfake is an artificial intelligence technique that uses machine learning models such as Generative Adversarial Networks (GANs) to stitch together a person's voice, facial expressions, and body movements to create fake images or videos. Face forgery specifically refers to the techniques used in deepfake to alter human faces.
[0003] With the increasing security risks associated with face spoofing technology, face spoofing detection technology has received more and more attention. Currently, the commonly used face spoofing detection method is as follows: first, a machine learning model is used to obtain the distribution of features of real face video samples in the feature space; then, the distribution of features of the face video to be detected is determined by judging whether the face video to be detected deviates from the center of the above distribution to determine whether the face video to be detected was obtained through face spoofing technology.
[0004] However, as the number of real face video samples used in the training process of machine learning models increases, the number of features in the feature space increases, resulting in multiple distributions of the features of real face video samples in the feature space. This leads to multiple distribution centers, which in turn affects the judgment of whether the features of the face video to be detected deviate from the distribution center, thus affecting the accuracy of face forgery detection. Summary of the Invention
[0005] This application provides a method, apparatus, and electronic device for detecting face forgery, so as to improve the accuracy of face forgery detection.
[0006] In a first aspect, this application provides a method for detecting face forgery, the method comprising: acquiring a face video to be detected; inputting the face video to be detected into a face image reconstruction model, so as to sample the face video to be detected frame by frame through the face image reconstruction model to obtain N first face video frames to be detected at the current resolution; extracting features from the N first face video frames to be detected to obtain at least one first initial feature of the N face video frames to be detected; determining first reconstructed face image features based on at least one first real face feature and at least one first initial feature; obtaining N first reconstructed face images based on the first reconstructed face image features, where N is a positive integer; detecting whether the face video to be detected is a forged face video based on the difference between the N first face video frames to be detected and the N first reconstructed face images; wherein, the face image reconstruction model is trained using real face videos.
[0007] Secondly, this application provides a face forgery detection device, comprising: an acquisition module, an input module, a processing module, and a detection module. The acquisition module is used to acquire a face video to be detected; the input module is used to input the face video to be detected into a face image reconstruction model; the processing module is used to: sample frames of the face video to be detected using the face image reconstruction model to obtain N first face video frames to be detected at the current resolution; extract features from the N first face video frames to obtain at least one first initial feature of the N face video frames to be detected; determine first reconstructed face image features based on at least one first real face feature and at least one first initial feature; and determine N first reconstructed face images based on the first reconstructed face image features, where N is a positive integer; the detection module is used to detect whether the face video to be detected is a forged face video based on the differences between the N first face video frames to be detected and the N first reconstructed face images; wherein the face image reconstruction model is trained using real face videos.
[0008] Thirdly, an electronic device is provided, comprising: a processor and a memory for storing a computer program, the processor for calling and running the computer program stored in the memory, and performing the methods as described in the first aspect or its various implementations.
[0009] Fourthly, a computer-readable storage medium is provided for storing a computer program that causes a computer to perform the methods described in the first aspect or its various implementations.
[0010] Fifthly, a computer program product is provided, including computer program instructions that cause a computer to perform the methods as described in the first aspect or its various implementations.
[0011] Sixthly, a computer program is provided that causes a computer to perform the methods described in the first aspect or its various implementations.
[0012] According to the technical solution of this application, the electronic device can first acquire a face video to be detected. Then, the electronic device can input the face video to be detected into a face image reconstruction model to sample the face video frame by frame, and obtain N first face video frames to be detected at the current resolution. Feature extraction is performed on the N first face video frames to be detected to obtain at least one first initial feature of the N face video frames to be detected. Based on at least one first real face feature and at least one first initial feature, a first reconstructed face image feature is determined. Based on the first reconstructed face image feature, N first reconstructed face images are obtained, where N is a positive integer. Finally, the electronic device can detect whether the face video to be detected is a fake face video based on the difference between the N first face video frames to be detected and the N first reconstructed face images. The face image reconstruction model is trained using real face videos. Compared to existing technologies that require first determining the distribution of features of real face video samples in the feature space and then judging whether the face video to be detected is a fake face video by judging whether the features of the face video to be detected deviate from the center of the distribution, the technical solution provided in this application does not require determining whether the face video to be detected is a fake face video based on the above distribution center. This can solve the problem that the existence of multiple distribution centers affects the accuracy of face forgery detection, thereby improving the accuracy of face forgery detection. In the above process, since the face image reconstruction model is trained on real face videos, and the face image reconstruction model uses the first real face features when determining the first reconstructed face image features, the first reconstructed face image features are relatively close to the real face features. Therefore, the first reconstructed face image obtained by the electronic device through the above face image reconstruction model is relatively close to the real face image. Based on this, for a face video to be detected that belongs to a fake face video, after the electronic device inputs it into the above face image reconstruction model, it can obtain a first reconstructed face image that is close to the real face image. Obviously, this first reconstructed face image that is close to the real face image and the first face to be detected corresponding to the above-mentioned fake face video to be detected are similar. If there are significant differences between video frames, the electronic device can detect whether the video to be detected is a fake face video based on these differences. Similarly, for a real face video to be detected, after the electronic device inputs it into the face image reconstruction model, it can obtain a first reconstructed face image that is close to a real face image. Then, the electronic device can detect whether the video to be detected is a fake face video based on the small difference between the first reconstructed face image that is close to a real face image and the first frame of the video to be detected corresponding to the video to be detected. In other words, through the technical solution of this application, the electronic device can more accurately detect whether the video to be detected is a fake face video, thus improving the accuracy of face forgery detection. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 A schematic diagram of a system architecture provided for an embodiment of this application;
[0015] Figure 2 A flowchart illustrating a face forgery detection method provided in this application embodiment;
[0016] Figure 3 A schematic diagram illustrating a face forgery detection method provided in an embodiment of this application;
[0017] Figure 4 A flowchart illustrating another face forgery detection method provided in this application embodiment;
[0018] Figure 5 A schematic diagram illustrating another face forgery detection method provided in an embodiment of this application;
[0019] Figure 6 A schematic diagram illustrating another face forgery detection method provided in an embodiment of this application;
[0020] Figure 7 A schematic diagram illustrating yet another face forgery detection method provided in an embodiment of this application;
[0021] Figure 8 A flowchart illustrating another face forgery detection method provided in this application embodiment;
[0022] Figure 9 A flowchart illustrating yet another face forgery detection method provided in this application embodiment;
[0023] Figure 10 A flowchart illustrating yet another face forgery detection method provided in this application embodiment;
[0024] Figure 11 A flowchart illustrating yet another face forgery detection method provided in this application embodiment;
[0025] Figure 12 A schematic diagram illustrating yet another face forgery detection method provided in an embodiment of this application;
[0026] Figure 13 A flowchart illustrating a model training method provided in this application embodiment;
[0027] Figure 14 A schematic diagram of a face forgery detection device 1400 provided in an embodiment of this application;
[0028] Figure 15 This is a schematic block diagram of the electronic device 1500 provided in the embodiments of this application. Detailed Implementation
[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0031] As mentioned above, existing face forgery detection methods require first determining the distribution of features of real face video samples in the feature space, and then determining whether the face video to be detected is a forgery by judging whether the features deviate from the center of the distribution. However, as the number of real face video samples used in the training process of the machine learning model increases, the number of features in the feature space increases, resulting in multiple distributions of features of real face video samples in the feature space. This leads to multiple distribution centers, which in turn affects the judgment of whether the features of the face video to be detected deviate from the distribution center, thus affecting the accuracy of face forgery detection.
[0032] To address the aforementioned technical problems, the inventive concept of this application is as follows: An electronic device can input a face video to be detected into a face image reconstruction model, and obtain a first reconstructed face image through the face image reconstruction model based on the first real face features and the first initial features of the first face video frame corresponding to the face video to be detected. The difference between the first reconstructed face image and the first face video frame to be detected is used to detect whether the face video to be detected is a fake face video. The face image reconstruction model is trained using real face videos.
[0033] It should be understood that the technical solution of this application can be applied to the following scenarios, but is not limited to:
[0034] The technical solution of this application can be applied to various face spoofing detection scenarios. For example, face spoofing detection scenarios can include verifying facial videos uploaded to a video player, or confirming product transaction information based on the user's own facial video.
[0035] The system architecture involved in the embodiments of this application will be described below:
[0036] Figure 1 This is a schematic diagram of a system architecture provided for an embodiment of this application. Figure 1 As shown, the system architecture may include: user equipment 101, data acquisition equipment 102, training equipment 103, execution equipment 104, database 105, and content library 106.
[0037] The data acquisition device 102 is used to read real face videos from the content library 106 and store the read real face videos in the database 105.
[0038] Training device 103 trains a face image reconstruction model based on real face videos maintained in database 105, enabling the trained face image reconstruction model to accurately output the reconstructed face image corresponding to the real face video. The face image reconstruction model obtained by training device 103 can be applied to different systems or devices.
[0039] In addition, such as Figure 1As shown, the execution device 104 is equipped with an I / O interface 107 for data interaction with external devices. For example, it receives a video of a face to be detected sent by the user device 101 through the I / O interface. The computing module 109 in the execution device 104 processes the input video of the face to be detected using a trained face image reconstruction model, outputs a reconstructed face image corresponding to the video of the face to be detected, and sends the output reconstructed face image to the user device 101 through the I / O interface. User equipment 101 can detect whether a face video to be detected is a fake face video based on the difference between the reconstructed face image and the corresponding face video frame to be detected. The face video frame to be detected can be generated by user equipment 101 based on the face video to be detected. Alternatively, the calculation module 109 in execution device 104 can use a trained face image reconstruction model to perform frame sampling on the input face video to be detected to obtain the face video frame to be detected, and send the obtained face video frame to be detected to user equipment 101 through the I / O interface. This application does not impose any restrictions on this.
[0040] User equipment 101 may include mobile phones, tablets, laptops, handheld computers, mobile internet devices (MIDs), or other terminal devices with browser installation capabilities.
[0041] The execution device 104 can be a server. Optionally, the server can be a rack server, blade server, tower server, or cabinet server, etc. The server can be a standalone test server or a test server cluster composed of multiple test servers.
[0042] The execution device 104 can be connected to the user equipment 101 via a network. This network can be an intranet, the Internet, Global System for Mobile Communications (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, a voice communication network, or other wireless or wired networks.
[0043] It should be noted that, Figure 1The positional relationships between the devices, components, modules, etc. shown are not restrictive. Optionally, the data acquisition device 102, user device 101, training device 103, and execution device 104 may be the same device; the database 105 may be distributed on one server or multiple servers; and the content library 106 may be distributed on one server or multiple servers. This application does not impose any restrictions on these aspects.
[0044] The technical solution of this application will be described in detail below:
[0045] Figure 2 A flowchart illustrating a face forgery detection method provided in this application embodiment. This method can be executed by an electronic device, for example, the electronic device may be... Figure 1 The execution device in the process. Furthermore, this electronic device can also be a processor, etc., and this application does not limit this. Figure 2 As shown, the method may include:
[0046] S201: Obtain the video of the face to be detected;
[0047] S202: Input the video of the face to be detected into the face image reconstruction model;
[0048] S203: The face image reconstruction model is used to sample frames of the face video to be detected, and N first face video frames to be detected at the current resolution are obtained. The face image reconstruction model is trained on real face videos, and N is a positive integer.
[0049] S204: Extract features from N first face video frames to be detected using a face image reconstruction model to obtain at least one first initial feature from the N face video frames to be detected.
[0050] S205: Determine the first reconstructed face image features using a face image reconstruction model based on at least one first real face feature and at least one first initial feature;
[0051] S206: Based on the features of the first reconstructed face image, N first reconstructed face images are obtained through the face image reconstruction model;
[0052] S207: Detect whether the face video to be detected is a fake face video based on the differences between N first face video frames to be detected and N first reconstructed face images.
[0053] In some possible implementations, the face video to be detected can be a face video obtained by an electronic device from a video player, or it can be a user face authentication video obtained by an electronic device in a commodity transaction scenario. This application does not impose any restrictions on this.
[0054] In some possible implementations, such as Figure 3 As shown, the electronic device can first acquire a video of a face to be detected. Then, the electronic device can input the video of the face to be detected into a face image reconstruction model, which may include a frame sampling module, an encoder, a combination module, and a decoder. Next, the electronic device can use the frame sampling module of the face image reconstruction model to sample the video of the face to be detected, obtaining three first video frames of the face to be detected at the current resolution. Then, the electronic device can use the encoder of the face image reconstruction model to extract features from the three first video frames of the face to be detected, obtaining multiple first initial features of the three video frames of the face to be detected. Next, the electronic device can use the combination module of the face image reconstruction model to combine the multiple first real face features and the multiple first initial features to determine the first reconstructed face image features. Then, the electronic device can use the decoder of the face image reconstruction model to obtain three first reconstructed face images based on the first reconstructed face image features. Finally, the electronic device can detect whether the video of the face to be detected is a fake face video based on the differences between the three first video frames of the face to be detected and the three first reconstructed face images.
[0055] For example, at least one first initial feature of the face video frame to be detected may include spatial distribution features and / or temporal distribution features. The spatial distribution features include facial features included in each face video frame to be detected, such as facial edge features, facial feature features, facial shadow features, facial distortion features, etc. The temporal distribution features include the temporal distribution features of the spatial distribution features of multiple face video frames to be detected, such as the temporal distribution features of facial edge features of multiple face video frames to be detected, the temporal distribution features of facial feature features of multiple face video frames to be detected, etc. This application does not impose any limitations on this. Similarly, the first real face feature may also include spatial distribution features and / or temporal distribution features, and the first reconstructed face image feature may also include spatial distribution features and / or temporal distribution features. This application will not elaborate on this further.
[0056] For example, the frame sampling performed by the electronic device on the video of the face to be detected using the face image reconstruction model can be relatively sparse. For instance, assuming the video of the face to be detected is a 100-second video with a frame rate of 30fps, when the electronic device performs frame sampling on the video of the face to be detected using the face image reconstruction model, it can choose a frame sampling interval of 10 seconds, sampling 1 frame per second, to obtain 10 video frames of the face to be detected; or it can choose a frame sampling interval of 5 seconds, sampling 1 frame per second, to obtain 20 video frames of the face to be detected. In this way, the similarity between adjacent video frames of the face to be detected is lower, which in turn lowers the similarity of the spatial distribution features of adjacent video frames of the face to be detected extracted by the face image reconstruction model. This allows the face image reconstruction model to extract richer temporal distribution features of the video frames of the face to be detected, resulting in a more accurate first reconstructed face image, which can further improve the accuracy of face forgery detection. Similarly, when training a face image reconstruction model, sparser frame sampling can be performed on real face videos. This increases the difficulty of feature extraction by the face image reconstruction model, improves its learning ability, prevents model degradation, and allows for better output results obtained through sparser frame sampling, rather than overfitting the output results obtained through denser frame sampling. In other words, it can achieve regularization of the face image model and prevent it from getting trapped in local minima.
[0057] It should be noted that the first real face feature is obtained by the electronic device based on multiple real face images or multiple real face videos. For example, the electronic device can first acquire multiple real face images, and then extract features from these multiple real face images to obtain the first real face feature.
[0058] For example, an electronic device can store the first real facial features in its local database or cloud database. Before the electronic device combines the first real facial features and the first initial features through the combination module of the facial image reconstruction model, the electronic device can first read the first real facial features from its local database or cloud database through the combination module. Then, the electronic device can combine the read first real facial features and the first initial features through the combination module. Alternatively, the electronic device can input the first real facial features into the facial image reconstruction model before combining the first real facial features and the first initial features through the combination module of the facial image reconstruction model. In this case, the electronic device can directly combine the first real facial features and the first initial features through the combination module. This application does not impose any restrictions on this.
[0059] For example, the electronic device may combine multiple real face features and multiple first initial features through the combination module of the face image reconstruction model, which may be to stitch together multiple real face features and multiple first initial features, but is not limited to this.
[0060] In the above embodiments, the face image reconstruction model determines the first reconstructed face image features based on the first real face features and the first initial features, which can suppress the model's generalization. The model's generalization can be understood as the trained model's ability to make relatively accurate predictions on new input data. It is understandable that if the electronic device determines the first reconstructed face image features based solely on the first initial features using the face image reconstruction model, the model's generalization and the fact that the first initial features are obtained by feature extraction from the video frame to be detected will lead to the face image reconstruction model obtaining a first reconstructed face image with minimal difference from the video frame to be detected, based solely on the first initial features. Therefore, when the video to be detected is a forged face video, the electronic device may determine that the video to be detected is not a forged face video because the difference between the first reconstructed face image and the video frame to be detected is small, which obviously affects the accuracy of face forgery detection. However, when the first reconstructed face image features are determined by the face image reconstruction model by combining the first real face features and the first initial features, if the face video to be detected is a fake face video, although the first initial features are obtained by feature extraction from the face video frame to be detected, i.e., the fake face video frame, the first real face features are obtained based on the real face image. Therefore, the first reconstructed face image features determined by combining the first real face features and the first initial features are close to the real face features. Thus, the first reconstructed face image determined by the first reconstructed face image features is close to the real face image. For the face video to be detected that belongs to the fake face video, the electronic device can determine that there is a large difference between the face video to be detected and the first reconstructed face image that is close to the real face image, and thus it can determine that the face video to be detected is a fake face video. Therefore, determining the features of the first reconstructed face image based on the first real face features and the first initial features can prevent the first reconstructed face image from being too close to the fake face image, thus affecting the electronic device's ability to detect whether the face video to be detected is a fake face video. In other words, it can suppress the generalization of the model and improve the accuracy of face forgery detection.
[0061] It should be noted that the first initial feature of the face video frame to be detected, obtained by the encoder after feature extraction, can be in the form of a feature vector. This feature vector can express the image information in the face video frame to be detected, such as facial edge information, facial feature information, facial shadow information, facial distortion information, etc. Similarly, the first real face feature can also be in the form of a feature vector, which can express information such as the facial edge information of the first real face. The first reconstructed face image feature can also be in the form of a feature vector, which can express the facial edge information, facial feature information, facial shadow information, facial distortion information, etc. of the first reconstructed face image. Then, the decoder obtains the first reconstructed face image based on the first reconstructed face image feature. Specifically, the decoder can identify the reconstructed face image information such as facial edge information, facial feature information, facial shadow information, and facial distortion information expressed by the feature vector corresponding to the first reconstructed face image feature. Then, the decoder can draw pixels based on the identified reconstructed face image information to obtain the first reconstructed face image.
[0062] For example, the encoder and decoder can adopt a transformer-based structure or a convolutional neural network (CNN)-based structure, and this application does not limit them in this regard.
[0063] In the above embodiments, the electronic device can first acquire a face video to be detected. Then, the electronic device can input the face video to be detected into a face image reconstruction model to sample the face video to be detected frame by frame through the face image reconstruction model, to obtain N first face video frames to be detected at the current resolution. Feature extraction is performed on the N first face video frames to be detected to obtain at least one first initial feature of the N face video frames to be detected. First reconstructed face image features are determined based on at least one first real face feature and at least one first initial feature. Based on the first reconstructed face image features, N first reconstructed face images are obtained, where N is a positive integer. Finally, the electronic device can detect whether the face video to be detected is a fake face video based on the difference between the N first face video frames to be detected and the N first reconstructed face images. The face image reconstruction model is trained using real face videos. Compared to existing technologies that require first determining the distribution of features of real face video samples in the feature space and then judging whether the face video to be detected is a fake face video by judging whether the features of the face video to be detected deviate from the center of the distribution, the technical solution provided in this application does not require determining whether the face video to be detected is a fake face video based on the above distribution center. This can solve the problem that the existence of multiple distribution centers affects the accuracy of face forgery detection, thereby improving the accuracy of face forgery detection. In the above process, since the face image reconstruction model is trained on real face videos, and the face image reconstruction model uses the first real face features when determining the first reconstructed face image features, the first reconstructed face image features are relatively close to the real face features. Therefore, the first reconstructed face image obtained by the electronic device through the above face image reconstruction model is relatively close to the real face image. Based on this, for a face video to be detected that belongs to a fake face video, after the electronic device inputs it into the above face image reconstruction model, it can obtain a first reconstructed face image that is close to the real face image. Obviously, this first reconstructed face image that is close to the real face image and the first face to be detected corresponding to the above-mentioned fake face video to be detected are similar. If there are significant differences between video frames, the electronic device can detect whether the video to be detected is a fake face video based on these differences. Similarly, for a real face video to be detected, after the electronic device inputs it into the face image reconstruction model, it can obtain a first reconstructed face image that is close to a real face image. Then, the electronic device can detect whether the video to be detected is a fake face video based on the small difference between the first reconstructed face image that is close to a real face image and the first frame of the video to be detected corresponding to the video to be detected. In other words, through the technical solution of this application, the electronic device can more accurately detect whether the video to be detected is a fake face video, thus improving the accuracy of face forgery detection.
[0064] In some feasible implementations, before the electronic device extracts features from N first face video frames to be detected through the encoder of the face image reconstruction model to obtain at least one initial feature of the N first face video frames to be detected, the electronic device can first pre-encode, i.e., pre-extract features from the N first face video frames to be detected to obtain the original features of the N first face video frames to be detected. Then, the electronic device can input the original features of the N first face video frames to be detected into the encoder to obtain at least one initial feature, wherein the format of the original feature conforms to the input data format of the encoder so that the encoder can perform feature extraction better.
[0065] In some feasible implementations, when an electronic device performs frame sampling on a video of a face to be detected using a face image reconstruction model, it can perform frame sampling based on a face detector to ensure that the faces in each of the N first video frames to be detected are consistent, i.e., to ensure frame alignment, thereby further improving the accuracy of face forgery detection.
[0066] Figure 4 A flowchart of another face forgery detection method provided in this application embodiment, based on Figure 2 ,like Figure 4 As shown, before S204 above, it also includes:
[0067] S401: Divide each of the N first-to-detect face video frames into multiple regions using a face image reconstruction model, where N is a positive integer;
[0068] S402: Erasure at least one region in N first-detection face video frames using a face image reconstruction model;
[0069] S403: Determine the first type region and the second type region through the face image reconstruction model. The first type region is the same region that has been erased in all N first video frames of the face to be detected. The second type region is the region other than the first type region among multiple regions.
[0070] S404: Determine the location encoding of the first type of region using a face image reconstruction model;
[0071] S405: The second real face features and the location codes of the first type region are concatenated by the face image reconstruction model to obtain the features of the first type region.
[0072] Correspondingly, such as Figure 4 As shown, the above S204 may include:
[0073] S406: Extract features from the second type regions in N first video frames of the face to be detected using a face image reconstruction model to obtain at least one first initial feature.
[0074] Correspondingly, such as Figure 4 As shown, the above S205 may include:
[0075] S407: Determine the first reconstructed face image features using a face image reconstruction model based on features of a first type region, at least one first real face feature, and at least one first initial feature.
[0076] In some possible implementations, such as Figure 5 As shown, the electronic device can first acquire a video of a face to be detected. Then, the electronic device can input the video of the face to be detected into a face image reconstruction model. This face image reconstruction model can include: a frame sampling module, an erasing module, an encoder, a combination module, and a decoder. Next, the electronic device can use the frame sampling module of the face image reconstruction model to sample the video of the face to be detected, obtaining three first video frames of the face to be detected at the current resolution. Then, the electronic device can use the erasing module of the face image reconstruction model to divide each of the three first video frames of the face to be detected into multiple regions and erase at least one region of the three first video frames of the face to be detected. Then, the electronic device can use the erasing module of the face image reconstruction model to determine a first type region and a second type region. The first type region is the same region that has been erased in all three first video frames of the face to be detected, and the second type region is the region other than the first type region among the multiple regions. Next, the electronic device can determine the location code of the first type region through the encoder of the face image reconstruction model, and concatenate the location code of the second real face feature and the first type region through the combination module of the face image reconstruction model to obtain the feature of the first type region. Then, the electronic device can extract features of the second type region in the three first face video frames to be detected through the encoder of the face image reconstruction model to obtain multiple first initial features. Next, the electronic device can combine the feature of the first type region, multiple first real face features and multiple first initial features through the combination module of the face image reconstruction model to determine the first reconstructed face image feature. Then, the electronic device can obtain three first reconstructed face images based on the first reconstructed face image feature through the decoder of the face image reconstruction model. Finally, the electronic device can detect whether the face video to be detected is a fake face video based on the differences between the three first face video frames to be detected and the three first reconstructed face images.
[0077] For example, the combination of features of the first type region, multiple first real face features and multiple first initial features by the combination module of the face image reconstruction model of the electronic device may be a combination of features of the first type region, multiple first real face features and multiple first initial features, but is not limited to this.
[0078] Understandably, to facilitate the electronic device's detection of whether a face video is a forged face video based on the difference between the first face video frame to be detected and the first reconstructed face image, the number of first reconstructed face images obtained by the electronic device should be consistent with the number of first face video frames to be detected. Therefore, the number of first reconstructed face image features used to construct the first reconstructed face image should be consistent with the number of first initial features of the first face video frame to be detected before erasure. However, since the number of first initial features obtained by the encoder will decrease after erasing the first type of region in the first face video frame to be detected, the electronic device needs to generate features of the first type of region to ensure that the number of first reconstructed face image features is consistent with the number of first initial features of the first face video frame to be detected before erasure. Figure 5 As shown in the diagram, the number of the first initial features corresponding to the "9 squares" in the first video frame of the face to be detected when it has not been erased is "9". Figure 6 As shown in the diagram, the number of initial features corresponding to the first initial feature is reduced to "6" after erasing the first type region of the first video frame to be detected. Therefore, as shown in the diagram, the number of initial features obtained by the encoder is reduced to "6". Figure 6 The first type of region in the image corresponds to "3 squares". The electronic device needs to generate "3" features for the first type of region.
[0079] It should be noted that the second real face feature is obtained by the electronic device based on multiple real face images or multiple real face videos. For example, the electronic device can first acquire multiple real face images, and then use an encoder to extract features from these multiple real face images to obtain the second real face feature. Similar to the first initial feature, the second real face image feature may also include spatial distribution features and / or temporal distribution features.
[0080] For example, the electronic device can store the second real facial features in its local database or cloud database. Before the electronic device uses the combination module of the facial image reconstruction model to stitch the second real facial features and the location code of the first type region together, the electronic device can first read the second real facial features from its local database or cloud database through the combination module. Then, the electronic device can use the combination module to stitch the read second real facial features and the location code of the first type region together. Alternatively, the electronic device can input the second real facial features into the facial image reconstruction model before using the combination module of the facial image reconstruction model to stitch the second real facial features and the location code of the first type region together. In this case, the electronic device can directly use the combination module to stitch the second real facial features and the location code of the first type region together. This application does not impose any restrictions on this.
[0081] For example, an electronic device can determine the positional encoding of a first-type region based on its positional information in a first video frame of a face to be detected, but is not limited thereto. It is understood that the positional encoding can represent the positional information of a region within an image.
[0082] In the above embodiments, by splicing the position encoding of the first type region and the second real face features, the features of the first type region are obtained. This not only supplements the "missing features" in the features of the first reconstructed face image after erasing the first type region of the first face video frame to be detected, but also makes the "supplemented" features of the first reconstructed face image closer to the real face features, making the obtained first reconstructed face image closer to the real face, and further improving the accuracy of face forgery detection.
[0083] For example, such as Figure 6 As shown in (a), the electronic device can divide each of the three first face detection video frames into nine regions using the erasure module. The sequence number of each region is as follows: Figure 6 As shown in (a) of the table, then, as Figure 6 As shown by the slash in (b), the electronic device can erase regions 1, 3, and 5 in the first face-to-be-detected video frame 1 using the erasure module, resulting in the erased first face-to-be-detected video frame 1. Similarly, the electronic device can erase regions 1 and 5 in the first face-to-be-detected video frame 2 using the erasure module, resulting in the erased first face-to-be-detected video frame 2. The electronic device can erase regions 1, 6, and 8 in the first face-to-be-detected video frame 3 using the erasure module, resulting in the erased first face-to-be-detected video frame 3. Obviously, region 1 in each of the first face-to-be-detected video frames is erased. Therefore, the electronic device can determine the first type of region as region 1 in the above three first face-to-be-detected video frames, and the second type of region as regions 2, 3, 4, 5, 6, 7, 8, and 9 in the above three first face-to-be-detected video frames. Of course, when erasing at least one region, the electronic device can first determine the erasure ratio, such as 80%, and then erase the first face-to-be-detected video frame according to the erasure ratio.
[0084] It should be noted that this application does not limit the method by which the electronic device divides each of the N first face video frames to be detected into multiple regions, or the method by which it erases at least one region of the N first face video frames to be detected.
[0085] Understandably, after the electronic device erases multiple regions from the first video frame containing the face to be detected, the image information in each video frame decreases, resulting in fewer spatial distribution features. This allows the face image reconstruction model to extract richer temporal distribution features from each frame, leading to a more accurate first reconstructed face image and further improving the accuracy of face forgery detection. Similarly, when training the face image reconstruction model, real face videos can be erased to increase the difficulty of feature extraction, enhance the model's learning ability, and prevent model degradation.
[0086] In some possible implementations, when an electronic device determines the first reconstructed face image features based on the features of a first type region, at least one first real face feature, and at least one first initial feature, it may determine the weight of each of the at least one first real face features for each of the at least one first initial features, perform a weighted summation of each first real face feature based on the weight of each first real face feature to obtain a second reconstructed face image feature, concatenate the first initial feature and the second reconstructed face image feature to obtain a third reconstructed face image feature, and determine the first reconstructed face image feature based on the features of the first type region and the third reconstructed face image features corresponding to the at least one first initial feature respectively.
[0087] For example, when an electronic device determines the first reconstructed face image features based on the features of the first type region and the third reconstructed face image features corresponding to at least one first initial feature, it can combine the features of the first type region and the third reconstructed face image features corresponding to at least one first initial feature to obtain the first reconstructed face image features, but is not limited thereto.
[0088] For example, when an electronic device determines the weight of each of the at least one first real face features, it may first calculate the similarity between the first initial feature and each first real face feature, and then convert the similarity between the first initial feature and each first real face feature into the weight of each first real face feature. Alternatively, the electronic device may determine any value as the weight of each of the at least one first real face features.
[0089] For example, this application describes how an electronic device determines third reconstructed face image features using at least one first initial feature q1 as an example. The method for determining third reconstructed face image features based on other first initial features among at least one first initial features is similar and will not be described again here. Figure 7As shown, for a first initial feature q1, the electronic device can calculate the similarity between the first initial feature q1 and the first real face feature pi, i = 1, 2, ..., I, where I is a positive integer and I represents the number of first real face features included in at least one first real face feature. For example, the electronic device can calculate this similarity through an attention mechanism, but is not limited to this. Then, the electronic device can convert this similarity into a weight wi of the first real face feature pi using softmax. Then, the electronic device can perform a weighted summation of the first real face feature pi according to the weight wi of the first real face feature pi to obtain the second reconstructed face image feature P1.
[0090] For example, after obtaining at least one third reconstructed face image feature corresponding to a first initial feature, such as Figure 7 As shown, the electronic device can combine the features of the first type region and the third reconstructed face image features corresponding to at least one first initial feature to obtain the first reconstructed face image features.
[0091] It should be understood that this application does not limit the manner in which the electronic device determines the first reconstructed face image features based on the features of the first type region, at least one first real face feature, and at least one first initial feature.
[0092] It is understandable that when an electronic device determines the first reconstructed face image features based on at least one first real face feature and at least one first initial feature, it can do so in a similar way to the method described above for determining the third reconstructed face image features: for each of the at least one first initial features, the electronic device can determine the weight of each of the at least one first real face features, perform a weighted summation of each first real face feature based on its weight, obtain the reconstructed face image feature corresponding to the first initial feature, and then concatenate the first initial feature and the reconstructed face image feature corresponding to the first initial feature to obtain the third reconstructed face image features.
[0093] Figure 8 A flowchart illustrating another face forgery detection method provided in this application embodiment, based on Figure 2 ,like Figure 8 As shown, the above S207 may include:
[0094] S801: Calculate the square of the difference between the RGB value of each pixel in the N first video frames of the first face to be detected and the RGB value of the corresponding pixel in the N first reconstructed face images, where N is a positive integer;
[0095] S802: Determine the first reconstruction error based on the square of the difference between the RGB values of each pixel in the N first video frames of the first face to be detected and the RGB values of the corresponding pixels in the N first reconstructed face images;
[0096] S803: Detect whether the face video to be detected is a fake face video based on the first reconstruction error.
[0097] In some implementations, the electronic device may also determine the first reconstruction error based on the absolute value of the difference between the RGB values of each pixel in the N first face detection video frames and the corresponding RGB values in the N first reconstructed face images. Alternatively, the electronic device may determine the first reconstruction error based on the absolute value of the difference between the pixel values of each pixel in the N first face detection video frames and the corresponding pixel values in the N first reconstructed face images. It may also determine the first reconstruction error based on the square of the difference between the pixel values of each pixel in the N first face detection video frames and the corresponding pixel values in the N first reconstructed face images. This application does not impose any limitations on this.
[0098] It is understandable that the color of each pixel in an image is formed by the superposition of the three primary colors: red, green, and blue. Each of the three primary colors has 256 brightness levels. Therefore, different combinations of the three primary colors with varying brightness can form 256 * 256 * 256 = 16,777,216 colors. The RGB value of a pixel represents the brightness of each of the red, green, and blue components that make up that pixel's color. For example, an RGB value of (11, 22, 33) means that the brightness of the red, green, and blue components in that pixel's color is 11, 22, and 33, respectively. For two different images, there will always be at least one pair of corresponding pixels with different RGB values. Therefore, an electronic device can determine the first reconstruction error of the N first face detection video frames and the N first reconstructed face images based on the difference (such as the square of the difference) between the RGB values of each pixel in the N first face detection video frames and the corresponding pixels in the N first reconstructed face images. This first reconstruction error can then be used to detect whether the face video being detected is a fake face video.
[0099] It is understandable that the pixel value of a pixel represents the average brightness information of that pixel. For two images that are different, there will be at least one pair of corresponding pixels whose pixel values are different. Then, the electronic device can determine the first reconstruction error of the N first face video frames to be detected and the N first reconstructed face images based on the difference between the pixel values of each pixel in the N first face video frames to be detected and the corresponding pixel values in the N first reconstructed face images, such as the square of the difference. Thus, it can detect whether the face video to be detected is a fake face video based on the first reconstruction error.
[0100] For example, this application describes a method for calculating the square of the difference between the RGB value of the first pixel at the top left corner of the first first face to be detected video frame and the RGB value of the first pixel at the top left corner of the first first reconstructed face image among N first face to be detected video frames. The method for calculating the square of the difference between other pixels in the N first face to be detected video frames and N first reconstructed face images is similar and will not be described again here. Assuming the RGB value of the first pixel at the top left corner of the first first face to be detected video frame is (11, 22, 33) and the RGB value of the first pixel at the top left corner of the first first reconstructed face image is (10, 20, 30), then the square of their difference is [(11, 22, 33) - (10, 20, 30)] * [(11, 22, 33) - (10, 20, 30)] = (1, 4, 9).
[0101] For example, the electronic device determines the first reconstruction error based on the squared differences between the RGB values of each pixel in the N first video frames of the first face to be detected and the corresponding RGB values in the N first reconstructed face images. This can be achieved by calculating the sum of the squared differences between the RGB values of each pixel in the N first video frames of the first face to be detected and the corresponding RGB values in the N first reconstructed face images, thus obtaining the first reconstruction error. Alternatively, the electronic device can average the squared differences of all the corresponding pixel values and then determine the first reconstruction error based on the calculated average. For example, suppose there is a first video frame of a face to be detected and a first reconstructed face image, each with 3 pixels. The electronic device can calculate that the square of the difference between the RGB values of the first pair of corresponding pixels is (3, 3, 9), the square of the difference between the RGB values of the second pair of corresponding pixels is (0, 0, 0), and the square of the difference between the RGB values of the third pair of corresponding pixels is (3, 0, 0). Then the electronic device can calculate that the sum of the squares of the differences between the RGB values of these 3 pairs of corresponding pixels is (6, 3, 9), and the average of the squares of the differences between the RGB values of these 3 pairs of corresponding pixels is (2, 1, 3). The electronic device can then determine (6, 3, 9) as the first reconstruction error, or it can determine (2, 1, 3) as the first reconstruction error.
[0102] It should be noted that when the electronic device determines the first reconstruction error based on the difference between the pixel values of each pixel in the N first face detection video frames and the corresponding pixel values in the N first reconstructed face images, it can determine the first reconstruction error based on the sum, average, median, maximum, and minimum values of the above differences. This is similar to the method described above for determining the first reconstruction error based on the RGB values of the corresponding pixels in the N first face detection video frames and the N first reconstructed face images, and will not be elaborated further in this application.
[0103] It should be noted that this application does not limit the way in which the electronic device obtains the first reconstruction error.
[0104] For example, the electronic device's method of detecting whether a face video to be detected is a fake face video based on a first reconstruction error can specifically include: the electronic device can first set a first preset threshold, and then the electronic device can determine whether the face video to be detected is a fake face video by comparing the first preset threshold and the first reconstruction error. If the first reconstruction error is greater than the first preset threshold, then the face video to be detected is determined to be a fake face video; if the first reconstruction error is less than or equal to the first preset threshold, then the face video to be detected is determined not to be a fake face video. For example, assuming the first preset threshold is (5, 5, 5), if the first reconstruction error is (6, 6, 9), then the electronic device can determine that the first reconstruction error is greater than the first preset threshold, thereby determining that the face video to be detected is a fake face video; if the first reconstruction error is (1, 1, 1), then the electronic device can determine that the first reconstruction error is less than the first preset threshold, thereby determining that the face video to be detected is a fake face video.
[0105] Figure 9 A flowchart illustrating another face forgery detection method provided in this application embodiment, based on Figure 2 ,like Figure 9 As shown, prior to S207 above, it also includes:
[0106] S901: The N first face video frames to be detected are adjusted into M groups of second face video frames to be detected through a face image reconstruction model. Each group of the M groups of second face video frames to be detected includes N second face video frames to be detected, and the resolution of each group of second face video frames to be detected is different from that of the N first face video frames to be detected. M is a positive integer and N is a positive integer.
[0107] S902: For each group of second face video frames to be detected, feature extraction is performed on the group of second face video frames to be detected using a face image reconstruction model to obtain at least one second initial feature of the group of second face video frames to be detected. Based on at least one first real face feature and at least one second initial feature, a fourth reconstructed face image feature is determined. Based on the fourth reconstructed face image feature, N second reconstructed face images are determined.
[0108] Correspondingly, such as Figure 9 As shown, the above S207 may include:
[0109] S903: Based on N first face video frames to be detected, N first reconstructed face images, M groups of second face video frames to be detected, and N second reconstructed face images corresponding to the M groups of second face video frames to be detected, detect whether the face video to be detected is a fake face video.
[0110] In some feasible implementations, assuming the resolution of the three first face video frames to be detected is 640*480, the electronic device can adjust the above three first face video frames to be detected into two sets of second face video frames to be detected using a face image reconstruction model. The first set of second face video frames to be detected includes three second face video frames to be detected with a resolution of 1280*720, and the second set of second face video frames to be detected includes three second face video frames to be detected with a resolution of 320*240.
[0111] In some feasible implementations, adjusting the resolution of the first face video frame to be detected by an electronic device through a face image reconstruction model can be understood as adjusting the scale of the first face video frame to be detected through the face image reconstruction model. The scale can represent the resolution of the face video frame to be detected. For example, assuming that the scale of N first face video frames to be detected is 1, the electronic device can adjust the N first face video frames to be detected into M groups of second face video frames to be detected through the face image reconstruction model. Each group of second face video frames to be detected includes N second face video frames to be detected, and the scale of the N second face video frames to be detected can be different from 1, such as 0.25, 0.5, 1.5, 2.0, etc.
[0112] It should be noted that the explanation, content, and effects of S902 are similar to those of S204 and S205, at least one second initial feature is similar to at least one first initial feature, and the first reconstructed face image feature is similar to the fourth reconstructed face image feature. This application will not elaborate further here.
[0113] It is understandable that image resolution can be used to represent the amount of information stored in an image. Image resolution can be expressed as: horizontal pixels * vertical pixels. For example, an image resolution of 640*480 means that the image has 640 pixels horizontally and 480 pixels vertically. Therefore, adjusting the image resolution can change the number of pixels and the amount of information stored in the image. Similarly, in the above embodiment, since the resolution of the second face video frame to be detected is different from that of the first face video frame to be detected, the amount of information stored in the second face video frame is different from that in the first face video frame. Therefore, the second initial feature corresponding to the second face video frame to be detected is different from the first initial feature corresponding to the first face video frame to be detected. For example, a second face video frame to be detected with a higher resolution than the first face video frame to be detected stores more information, such as richer facial features and facial shadow information, and thus has richer corresponding second initial features. When the second initial feature corresponding to the second face video frame to be detected differs from the first initial feature corresponding to the first face video frame to be detected, the electronic device, through a face image reconstruction model, determines different reconstructed face images based on the corresponding second and first initial features. For example, for a second face video frame to be detected with a higher resolution than the first face video frame, since its corresponding second initial features are richer, the reconstructed face image determined by the face image reconstruction model, i.e., the fourth reconstructed face image, contains richer information, such as facial features and facial shadows. In this way, the electronic device can determine multiple different reconstructed face images based on face video frames to be detected at different resolutions through the face image reconstruction model. These multiple reconstructed face images store different facial features and facial shadow information, and thus, these multiple reconstructed face images can approximate real face images to varying degrees. Therefore, the above embodiment can more accurately detect whether the face video to be detected is a forged face video, that is, it can further improve the accuracy of face forgery detection.
[0114] In some possible ways, Figure 10 A flowchart illustrating another face forgery detection method provided in this application embodiment, based on Figure 9 ,like Figure 10 As shown, the above S903 may include:
[0115] S1001: Calculate the square of the difference between the RGB value of each pixel in the N first video frames of the first face to be detected and the RGB value of the corresponding pixel in the N first reconstructed face images, where N is a positive integer;
[0116] S1002: Determine the first reconstruction error based on the square of the difference between the RGB values of each pixel in the N first video frames of the first face to be detected and the RGB values of the corresponding pixels in the N first reconstructed face images;
[0117] S1003: For each group of second face video frames to be detected in M groups of second face video frames to be detected, calculate the square of the difference between the RGB value of each pixel in the group of second face video frames to be detected and the RGB value of the corresponding pixel in the corresponding N second reconstructed face images, and determine the second reconstruction error based on the square of the difference between the RGB value of each pixel in the group of second face video frames to be detected and the RGB value of the corresponding pixel in the corresponding N second reconstructed face images, where M is a positive integer;
[0118] S1004: Detect whether the face video to be detected is a fake face video based on the first reconstruction error and the second reconstruction error corresponding to the second face video frame to be detected in group M.
[0119] It is understood that the explanations, contents, and effects of S1001, S1002, and S1003 above are similar to those of S801 and S802 above. You can refer to the explanations, contents, and effects of S801 and S802 above. This application will not repeat them here.
[0120] In some implementations, S1004 may include: calculating a first reconstruction error and the second reconstruction errors corresponding to the M groups of second face video frames to be detected, respectively, to obtain a third reconstruction error; and detecting whether the face video to be detected is a fake face video based on the third reconstruction error. For example, assuming the first reconstruction error is (2, 1, 3), and the second reconstruction errors corresponding to the two groups of second face video frames to be detected are (0, 1, 1) and (1, 1, 0) respectively, then the electronic device can determine the third reconstruction error as (3, 3, 4). Of course, the electronic device may also use the average, median, maximum, or minimum value of the first reconstruction error and the second reconstruction errors corresponding to the M groups of second face video frames to be detected as the third reconstruction error; this application does not limit this.
[0121] For example, the electronic device's method of detecting whether a face video to be detected is a fake face video based on a third reconstruction error can specifically include: the electronic device can first set a second preset threshold, and then the electronic device can determine whether the face video to be detected is a fake face video by comparing the second preset threshold and the third reconstruction error. If the third reconstruction error is greater than the second preset threshold, then the face video to be detected is determined to be a fake face video; if the third reconstruction error is less than or equal to the second preset threshold, then the face video to be detected is determined not to be a fake face video. For example, assuming the second preset threshold is (5, 5, 5), if the third reconstruction error is (6, 6, 9), then the electronic device can determine that the third reconstruction error is greater than the second preset threshold, and thus can determine that the face video to be detected is a fake face video; if the third reconstruction error is (1, 1, 1), then the electronic device can determine that the third reconstruction error is less than the second preset threshold, and thus can determine that the face video to be detected is a fake face video.
[0122] Figure 11 A flowchart illustrating another face forgery detection method provided in this application embodiment, based on Figure 2 ,like Figure 11 As shown, following S206 above, it also includes:
[0123] S1101: For each of the at least one first real face features, determine the weight of each of the at least one first initial features, perform a weighted summation of each first initial feature according to the weight of each first initial feature to obtain a third real face feature, perform a weighted summation of the third real face feature and the first real face feature to obtain a fourth real face feature, and update the first real face feature to the fourth real face feature.
[0124] This application describes a method for an electronic device to update a first real face feature p1 to a fourth real face feature Q1, taking at least one first real face feature p1 as an example. The method for updating other first real face features by the electronic device is similar and will not be described in detail here.
[0125] In some possible implementations, such as Figure 12As shown, for a first real face feature p1, the electronic device can calculate the similarity between the first real face feature p1 and the first initial feature qj, where j = 1, 2, ..., J, and J is a positive integer, representing the number of first initial features included in at least one first initial feature. For example, the electronic device can calculate this similarity through an attention mechanism, but is not limited to this. Then, the electronic device can convert this similarity into a weight vj of the first initial feature qj using softmax. Then, the electronic device can map the first initial feature qj to a first initial feature mj so that the expression of the first initial feature mj is consistent with the expression of the first real face feature p1, facilitating weighted summation. Then, the electronic device can perform weighted summation on the first initial feature mj according to the weight vj of the first initial feature qj, i.e., the weight vj of the first initial feature mj, to obtain the third real face feature M1. Then, the electronic device can perform weighted summation on the third real face feature M1 and the first real face feature p1 to obtain the fourth real face feature Q1. Finally, the electronic device can update the first real face feature p1 to the fourth real face feature Q1.
[0126] In the above embodiments, the electronic device can update the first real face feature using a fourth real face feature determined based on the first initial feature and the first real face feature, thereby making the face information expressed by the updated first real face feature universal, thus applicable to the detection of various face videos to be detected, improving the accuracy and application scope of face forgery detection.
[0127] The training steps of the above face image reconstruction model are explained below:
[0128] Figure 13 A flowchart illustrating a model training method provided in this application embodiment. This method can be executed by the aforementioned electronic device, or it can also be executed by other electronic devices, such as... Figure 1 The training device can be a processor, etc., and this application does not limit this. Figure 13 As shown, the method may include:
[0129] S1301: Obtain real face video;
[0130] S1302: Input the real face video into the face image reconstruction model;
[0131] S1303: Frame sampling of real face video is performed using a face image reconstruction model to obtain N first real face video frames at the current resolution, where N is a positive integer;
[0132] S1304: Extract features from N first real face video frames using a face image reconstruction model to obtain at least one first initial feature from the N first real face video frames;
[0133] S1305: Determine the first reconstructed face image features using a face image reconstruction model based on at least one first real face feature and at least one first initial feature;
[0134] S1306: Based on the features of the first reconstructed face image, N first reconstructed face images are obtained through the face image reconstruction model;
[0135] S1307: Train the face image reconstruction model based on N first real face video frames and N first reconstructed face images.
[0136] It is understandable that when electronic devices train a face image reconstruction model, they use real face videos and do not need to use fake face videos, thus eliminating the need to annotate the face videos. Therefore, the face image reconstruction model provided in this application belongs to the unsupervised learning model. However, when electronic devices train a face image reconstruction model, they can train the face image reconstruction model based on the input of the face image reconstruction model, i.e., the real face video, and the output of the face image reconstruction model, i.e., the reconstructed face image. Therefore, the face image reconstruction model provided in this application belongs to the self-supervised learning model.
[0137] In some possible implementations, prior to S1303, the electronic device can divide each of the N first real face video frames into multiple regions using a face image reconstruction model, and erase at least one region in the N real face video frames. Then, the electronic device can determine a first type region and a second type region using the face image reconstruction model. The first type region is the same region that has been erased in all N first real face video frames, and the second type region is the region other than the first type region among the multiple regions. Next, the electronic device can determine the position code of the first type region using the face image reconstruction model, and concatenate the second real face features and the position code of the first type region to obtain the features of the first type region. Accordingly, S1304 may include: extracting features from the second type region in the N first real face video frames to obtain at least one first initial feature. Accordingly, S1305 may include: determining the reconstructed face image features based on the features of the first type region, at least one first real face feature, and at least one initial feature. It should be understood that the face image reconstruction model can be used to implement the face forgery detection method described above. The content and effects here can be referred to the face forgery detection method described above, and this application will not repeat the content and effects.
[0138] In some implementations, S1307 may include: calculating the square of the difference between the RGB values of each pixel in N first real face video frames and the corresponding RGB values in N first reconstructed face images; determining a first reconstruction error based on the square of the difference between the RGB values of each pixel in the N first real face video frames and the corresponding RGB values in the N first reconstructed face images; and training a face image reconstruction model based on the first reconstruction error. It should be understood that this face image reconstruction model can be used to implement the aforementioned face forgery detection method. The content and effects described here are similar to those of the aforementioned face forgery detection method, and this application will not elaborate on their content and effects further.
[0139] In some possible implementations, before S1307 above, the following may be included: adjusting N first real face video frames into M groups of second real face video frames using a face image reconstruction model, wherein each group of the M groups of second real face video frames includes N second real face video frames, and the resolution of each group of second real face video frames is different from that of the N first real face video frames, where M is a positive integer; for each group of second real face video frames, performing feature extraction on the group of second real face video frames using a face image reconstruction model to obtain at least one second initial feature of the group of second real face video frames; determining a fourth reconstructed face image feature based on at least one first real face feature and at least one second initial feature; and determining N second reconstructed face images based on the fourth reconstructed face image feature; correspondingly, S1307 above includes: training the face image reconstruction model based on the N first real face video frames, the N first reconstructed face images, the M groups of second real face video frames, and the N second reconstructed face images corresponding to the M groups of second real face video frames respectively. It should be understood that the face image reconstruction model can be used to implement the face forgery detection method described above. The content and effects here can be referred to the face forgery detection method described above, and this application will not repeat the content and effects.
[0140] In some possible implementations, after S1306 above, the method further includes: for each of the at least one first real face features, determining the weight of each of the at least one first initial features; performing a weighted summation of each first initial feature according to its weight to obtain a third real face feature; performing a weighted summation of the third real face feature and the first real face feature to obtain a fourth real face feature; and updating the first real face feature to the fourth real face feature. It should be understood that this face image reconstruction model can be used to implement the above-described face forgery detection method. The content and effects described here are similar to those of the above-described face forgery detection method, and this application will not elaborate on their content and effects further.
[0141] It should be understood that the face image reconstruction model can be used to implement the above-mentioned face forgery detection method, and its content and effect can be referred to the above-mentioned face forgery detection method. This application will not elaborate on its content and effect.
[0142] Figure 14 This is a schematic diagram of a face forgery detection device 1400 provided in an embodiment of this application, as shown below. Figure 14 As shown, the device 1400 includes: an acquisition module 1401, an input module 1402, a processing module 1403, and a detection module 1404, wherein,
[0143] The acquisition module 1401 is used to acquire the video of the face to be detected;
[0144] The input module 1402 is used to input the face video to be detected into the face image reconstruction model. The processing module 1403 is used to perform frame sampling on the face video to be detected through the face image reconstruction model to obtain N first face video frames to be detected at the current resolution, extract features from the N first face video frames to obtain at least one first initial feature of the N face video frames to be detected, determine the first reconstructed face image features based on at least one first real face feature and at least one first initial feature, and obtain N first reconstructed face images based on the first reconstructed face image features, where N is a positive integer.
[0145] The detection module 1404 is used to detect whether the face video to be detected is a fake face video based on the differences between N first face video frames to be detected and N first reconstructed face images;
[0146] The face image reconstruction model is trained using real face videos.
[0147] In some implementations, the device 1400 further includes: a division module 1405, an erasure module 1406, a first determination module 1407, a second determination module 1408, and a stitching module 1409. The division module 1405 is used to divide each of the N first face-to-detect video frames into multiple regions; the erasure module 1406 is used to erase at least one region in the N first face-to-detect video frames; the first determination module 1407 is used to determine a first type region and a second type region, wherein the first type region is the same region that has been erased in all N first face-to-detect video frames, and the second type region... The regions are regions other than the first type of region among multiple regions; the second determining module 1408 is used to determine the position code of the first type of region; the splicing module 1409 is used to splice the second real face features and the position code of the first type of region to obtain the features of the first type of region; correspondingly, the processing module 1403 is specifically used to extract features from the second type of region in N first face video frames to be detected to obtain at least one first initial feature; correspondingly, the processing module 1403 is specifically used to determine the first reconstructed face image features based on the features of the first type of region, at least one first real face feature and at least one first initial feature.
[0148] In some implementations, the processing module 1403 is specifically configured to, for each of the at least one first initial features, determine the weight of each of the at least one first real face features, perform a weighted summation of each first real face feature according to the weight of each first real face feature to obtain a second reconstructed face image feature, concatenate the first initial features and the second reconstructed face image feature to obtain a third reconstructed face image feature, and determine the first reconstructed face image feature according to the features of the first type region and the third reconstructed face image features corresponding to the at least one first initial feature respectively.
[0149] In some implementations, the processing module 1403 is specifically used to combine the features of the first type region and the third reconstructed face image features corresponding to at least one first initial feature to obtain the first reconstructed face image features.
[0150] In some implementations, the processing module 1403 is specifically used to calculate the similarity between the first initial feature and each first real face feature; and to convert the similarity between the first initial feature and each first real face feature into a weight for each first real face feature.
[0151] In some implementations, the detection module 1404 is specifically used to calculate the square of the difference between the RGB values of each pixel in the N first face video frames to be detected and the RGB values of the corresponding pixels in the N first reconstructed face images; determine a first reconstruction error based on the square of the difference between the RGB values of each pixel in the N first face video frames to be detected and the RGB values of the corresponding pixels in the N first reconstructed face images; and detect whether the face video to be detected is a fake face video based on the first reconstruction error.
[0152] In some implementations, the detection module 1404 is specifically used to calculate the sum of the squares of the differences between the RGB values of each pixel in the N first video frames of the face to be detected and the RGB values of the corresponding pixels in the N first reconstructed face images, to obtain the first reconstruction error.
[0153] In some implementations, the detection module 1404 is specifically used to determine that the face video to be detected is a fake face video if the first reconstruction error is greater than the first preset threshold; and to determine that the face video to be detected is not a fake face video if the first reconstruction error is less than or equal to the first preset threshold.
[0154] In some implementations, the apparatus 1400 further includes: an adjustment module 1410, an extraction module 1411, a third determination module 1412, and a fourth determination module 1413. The adjustment module 1410 is used to adjust N first face video frames to be detected into M groups of second face video frames to be detected using a face image reconstruction model. Each group of the M groups of second face video frames to be detected includes N second face video frames to be detected, and the resolution of each group of second face video frames to be detected is different from that of the N first face video frames to be detected. For each group of second face video frames to be detected, the extraction module 1411 is used to extract the second face video frames to be detected using a face image reconstruction model. Feature extraction is performed on the video frames to obtain at least one second initial feature of the second group of face video frames to be detected. The third determining module 1412 is used to determine the fourth reconstructed face image features based on at least one first real face feature and at least one second initial feature. The fourth determining module 1413 is used to determine N second reconstructed face images based on the fourth reconstructed face image features. Correspondingly, the detection module 1404 is specifically used to detect whether the face video to be detected is a fake face video based on the N first face video frames to be detected, the N first reconstructed face images, the M groups of second face video frames to be detected, and the N second reconstructed face images corresponding to the M groups of second face video frames to be detected, where M is a positive integer.
[0155] In some implementations, the detection module 1404 is specifically used to calculate the square of the difference between the RGB values of each pixel in N first face video frames to be detected and the RGB values of the corresponding pixels in N first reconstructed face images; determine a first reconstruction error based on the square of the difference between the RGB values of each pixel in N first face video frames to be detected and the RGB values of the corresponding pixels in N first reconstructed face images; for each group of M groups of second face video frames to be detected, calculate the square of the difference between the RGB values of each pixel in that group of second face video frames to be detected and the RGB values of the corresponding pixels in the N second reconstructed face images, and determine a second reconstruction error based on the square of the difference between the RGB values of each pixel in that group of second face video frames to be detected and the RGB values of the corresponding pixels in the N second reconstructed face images; and detect whether the face video to be detected is a fake face video based on the first reconstruction error and the second reconstruction errors corresponding to the M groups of second face video frames to be detected.
[0156] In some implementations, the detection module 1404 is specifically used to calculate the sum of the first reconstruction error and the second reconstruction errors corresponding to the M groups of second face video frames to be detected, to obtain the third reconstruction error; and to detect whether the face video to be detected is a fake face video based on the third reconstruction error.
[0157] In some implementations, the detection module 1404 is specifically used to determine that the face video to be detected is a fake face video if the third reconstruction error is greater than the second preset threshold; and to determine that the face video to be detected is not a fake face video if the third reconstruction error is less than or equal to the second preset threshold.
[0158] In some possible implementations, the apparatus 1400 further includes: a fifth determining module 1414, a first weighted summation module 1415, a second weighted summation module 1416, and an updating module 1417, wherein, for each of the at least one first real face features, the fifth determining module 1414 is used to determine the weight of each of the at least one first initial features; the first weighted summation module 1415 is used to perform a weighted summation on each first initial feature according to the weight of each first initial feature to obtain a third real face feature; the second weighted summation module 1416 is used to perform a weighted summation on the third real face feature and the first real face feature to obtain a fourth real face feature; and the updating module 1417 is used to update the first real face feature to the fourth real face feature.
[0159] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, further details will not be provided here. Specifically, Figure 14The apparatus 1400 shown can execute the above-described method embodiments, and the aforementioned and other operations and / or functions of each module in the apparatus 1400 are respectively for implementing the corresponding processes in the above-described methods. For the sake of brevity, they will not be described in detail here.
[0160] The apparatus 1400 of this application embodiment has been described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that this functional module can be implemented in hardware, in software instructions, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in this application can be completed by integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the method disclosed in this application embodiment can be directly embodied as being executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps in the above method embodiments.
[0161] Figure 15 This is a schematic block diagram of the electronic device 1500 provided in the embodiments of this application.
[0162] like Figure 15 As shown, the electronic device 1500 may include:
[0163] The system includes a memory 1510 and a processor 1520. The memory 1510 stores computer programs and transfers the program code to the processor 1520. In other words, the processor 1520 can retrieve and run the computer program from the memory 1510 to implement the methods described in the embodiments of this application.
[0164] For example, the processor 1520 can be used to execute the above-described method embodiments according to instructions in the computer program.
[0165] In some embodiments of this application, the processor 1520 may include, but is not limited to:
[0166] General-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0167] In some embodiments of this application, the memory 1510 includes, but is not limited to:
[0168] Volatile memory and / or non-volatile memory. 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), or flash memory. 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 RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0169] In some embodiments of this application, the computer program may be divided into one or more modules, which are stored in the memory 1510 and executed by the processor 1520 to perform the method provided in this application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the electronic device.
[0170] like Figure 15 As shown, the electronic device may also include:
[0171] Transceiver 1530, which can be connected to processor 1520 or memory 1510.
[0172] The processor 1520 can control the transceiver 1530 to communicate with other devices; specifically, it can send information or data to other devices or receive information or data sent by other devices. The transceiver 1530 may include a transmitter and a receiver. The transceiver 1530 may further include antennas, and the number of antennas may be one or more.
[0173] It should be understood that the various components in the electronic device are connected through a bus system, which includes a data bus, a power bus, a control bus, and a status signal bus.
[0174] This application also provides a computer storage medium storing a computer program thereon, which, when executed by a computer, enables the computer to perform the methods of the above-described method embodiments. Alternatively, embodiments of this application also provide a computer program product containing instructions that, when executed by a computer, cause the computer to perform the methods of the above-described method embodiments.
[0175] When implemented using software, it can be implemented entirely or partially as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0176] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0177] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0178] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. For example, the functional modules in the various embodiments of this application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0179] The above are merely specific embodiments 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 face forgery, characterized in that, include: Obtain the video of the face to be detected; The face video to be detected is input into a face image reconstruction model to perform frame sampling on the face video to be detected, thereby obtaining N first face video frames to be detected at the current resolution. Feature extraction is performed on the N first face video frames to be detected to obtain at least one first initial feature of the N face video frames to be detected. First reconstructed face image features are determined based on at least one first real face feature and the at least one first initial feature. Based on the first reconstructed face image features, N first reconstructed face images are obtained, where N is a positive integer. The difference between the N first face video frames to be detected and the N first reconstructed face images is used to determine whether the face video to be detected is a fake face video; The face image reconstruction model is obtained by training on real face videos; Before extracting features from the N first face video frames to be detected to obtain at least one first initial feature of the N face video frames to be detected, the method further includes: Each of the N first face video frames to be detected is divided into multiple regions; Erase at least one region in the N first video frames of the face to be detected; A first type region and a second type region are determined. The first type region is the same region that is erased in all N first face video frames to be detected. The second type region is the region other than the first type region among the plurality of regions. Determine the location code of the first type of region; The second real face feature and the location code of the first type region are concatenated to obtain the feature of the first type region; Accordingly, the step of extracting features from the N first face video frames to be detected, to obtain at least one first initial feature of the N face video frames to be detected, includes: Feature extraction is performed on the second type region in the N first video frames of the face to be detected to obtain at least one first initial feature; Accordingly, determining the first reconstructed face image features based on at least one first real face feature and the at least one first initial feature includes: The first reconstructed face image features are determined based on the features of the first type region, the at least one first real face feature, and the at least one first initial feature; Determining the first reconstructed face image features based on the features of the first type region, the at least one first real face feature, and the at least one first initial feature includes: For each of the at least one first initial features, determine the weight of each of the at least one first real face features, perform a weighted summation of each first real face feature according to the weight of each first real face feature to obtain a second reconstructed face image feature, and concatenate the first initial features and the second reconstructed face image feature to obtain a third reconstructed face image feature. The first reconstructed face image features are determined based on the features of the first type region and the third reconstructed face image features corresponding to the at least one first initial feature.
2. The method according to claim 1, characterized in that, Determining the first reconstructed face image features based on the features of the first type region and the third reconstructed face image features corresponding to the at least one first initial feature includes: The features of the first type region and the third reconstructed face image features corresponding to the at least one first initial feature are combined to obtain the first reconstructed face image features.
3. The method according to claim 1, characterized in that, Determining the weight of each of the at least one first real face features includes: Calculate the similarity between the first initial feature and each of the first real face features; The similarity between the first initial feature and each first real face feature is converted into a weight for each first real face feature.
4. The method according to any one of claims 1-3, characterized in that, The step of detecting whether the face video to be detected is a fake face video based on the differences between the N first face video frames to be detected and the N first reconstructed face images includes: Calculate the square of the difference between the RGB value of each pixel in the N first video frames of the face to be detected and the RGB value of the corresponding pixel in the N first reconstructed face images; The first reconstruction error is determined by the square of the difference between the RGB value of each pixel in the N first first face video frames to be detected and the RGB value of the corresponding pixel in the N first first reconstructed face images; The detection method determines whether the face video to be detected is a fake face video based on the first reconstruction error.
5. The method according to claim 4, characterized in that, The step of determining the first reconstruction error based on the square of the difference between the RGB values of each pixel in the N first video frames of the face to be detected and the RGB values of the corresponding pixels in the N first reconstructed face images includes: The first reconstruction error is obtained by summing the squares of the differences between the RGB values of each pixel in the N first video frames of the face to be detected and the RGB values of the corresponding pixels in the N first reconstructed face images.
6. The method according to claim 4, characterized in that, The step of detecting whether the face video to be detected is a fake face video based on the first reconstruction error includes: If the first reconstruction error is greater than the first preset threshold, then the face video to be detected is determined to be a fake face video; If the first reconstruction error is less than or equal to the first preset threshold, then the face video to be detected is determined not to be a fake face video.
7. The method according to any one of claims 1-3, characterized in that, Before detecting whether the face video to be detected is a fake face video based on the differences between the N first face video frames to be detected and the N first reconstructed face images, the method further includes: The face image reconstruction model adjusts the N first face video frames to be detected into M groups of second face video frames to be detected. Each group of the M groups of second face video frames to be detected includes N second face video frames to be detected, and the resolution of each group of second face video frames to be detected is different from that of the N first face video frames to be detected. M is a positive integer. For each group of second face video frames to be detected, the face image reconstruction model is used to extract features from the group of second face video frames to obtain at least one second initial feature of the group of second face video frames to be detected. Based on the at least one first real face feature and the at least one second initial feature, a fourth reconstructed face image feature is determined. Based on the fourth reconstructed face image feature, N second reconstructed face images are determined. Accordingly, the step of detecting whether the face video to be detected is a fake face video based on the differences between the N first face video frames to be detected and the N first reconstructed face images includes: Based on the N first face video frames to be detected, the N first reconstructed face images, the M groups of second face video frames to be detected, and the N second reconstructed face images corresponding to the M groups of second face video frames to be detected, it is determined whether the face video to be detected is a fake face video.
8. The method according to claim 7, characterized in that, The step of detecting whether the face video to be detected is a fake face video based on the N first face video frames to be detected, the N first reconstructed face images, the M groups of second face video frames to be detected, and the N second reconstructed face images corresponding to the M groups of second face video frames to be detected, includes: Calculate the square of the difference between the RGB value of each pixel in the N first video frames of the face to be detected and the RGB value of the corresponding pixel in the N first reconstructed face images; The first reconstruction error is determined by the square of the difference between the RGB value of each pixel in the N first first face video frames to be detected and the RGB value of the corresponding pixel in the N first first reconstructed face images; For each of the M groups of second face video frames to be detected, calculate the square of the difference between the RGB value of each pixel in the group of second face video frames to be detected and the RGB value of the corresponding pixel in the corresponding N second reconstructed face images, and determine the second reconstruction error based on the square of the difference between the RGB value of each pixel in the group of second face video frames to be detected and the RGB value of the corresponding pixel in the corresponding N second reconstructed face images. Based on the first reconstruction error and the second reconstruction error corresponding to the second face video frames of the M groups to be detected, it is determined whether the face video to be detected is a fake face video.
9. The method according to claim 8, characterized in that, The step of detecting whether the face video to be detected is a fake face video based on the first reconstruction error and the second reconstruction errors corresponding to the M groups of second face video frames to be detected includes: The third reconstruction error is obtained by summing the first reconstruction error and the second reconstruction errors corresponding to the M groups of second face video frames to be detected. The third reconstruction error is used to determine whether the face video to be detected is a fake face video.
10. The method according to claim 9, characterized in that, The step of detecting whether the face video to be detected is a fake face video based on the third reconstruction error includes: If the third reconstruction error is greater than the second preset threshold, then the face video to be detected is determined to be a fake face video; If the third reconstruction error is less than or equal to the second preset threshold, then the face video to be detected is determined not to be a fake face video.
11. The method according to any one of claims 1-3, characterized in that, After determining the first reconstructed face image features based on at least one first real face feature and the at least one first initial feature, the method further includes: For each of the at least one first real face features, determine the weight of each of the at least one first initial features. Summate each first initial feature according to its weight to obtain a third real face feature. Summate the third real face feature and the first real face feature according to their weights to obtain a fourth real face feature. Update the first real face feature to the fourth real face feature.
12. A face forgery detection device, characterized in that, The face forgery detection device is used to implement the method as described in any one of claims 1-11, and the face forgery detection device includes: an acquisition module, an input module, a processing module, and a detection module; The acquisition module is used to acquire the video of the face to be detected; The input module is used to input the face video to be detected into the face image reconstruction model. The processing module is used to: sample the face video to be detected frame by the face image reconstruction model to obtain N first face video frames to be detected at the current resolution; extract features from the N first face video frames to obtain at least one first initial feature of the N face video frames to be detected; determine first reconstructed face image features based on at least one first real face feature and the at least one first initial feature; and determine N first reconstructed face images based on the first reconstructed face image features, where N is a positive integer. The detection module is used to detect whether the face video to be detected is a fake face video based on the differences between the N first face video frames to be detected and the N first reconstructed face images; The face image reconstruction model is obtained by training on real face videos.
13. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1-11 by executing the executable instructions.