Face swapping image detection method and device based on reconstruction loss

By employing a detection method based on reconstruction loss, which utilizes blurred images and an identity feature extractor to calculate identity reconstruction loss, and combines a memory coding module and adversarial network optimization, the problem of insufficient generalization of existing detection methods is solved, and accurate detection of high-quality face-swapped images is achieved.

CN116631023BActive Publication Date: 2026-04-17ZHEJIANG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2023-04-12
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing face-swapping image detection methods have poor generalization ability when faced with new forgery methods, making it difficult to effectively distinguish high-quality face-swapping images from real faces, resulting in insufficient detection accuracy and generalization.

Method used

A detection method based on reconstruction loss is adopted. By acquiring a blurred image of the face to be tested, the reconstruction model is used to calculate the reconstructed face image, and an identity feature extractor is used to extract identity features. The identity reconstruction loss is calculated to make forgery judgment. The robustness and generalization of the model are improved by combining a memory encoding module and an adversarial network.

Benefits of technology

It significantly improves the accuracy and generalization of face-swapped image detection, effectively distinguishing between real and fake faces, and enhancing detection performance on new forgery methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116631023B_ABST
    Figure CN116631023B_ABST
Patent Text Reader

Abstract

This invention discloses a face-swapping image detection method and apparatus based on reconstruction loss, comprising the following steps: acquiring a face image to be tested and blurring it to obtain a blurred face image; calculating the reconstructed face image corresponding to the blurred face image using a reconstruction model; extracting identity features from the face image to be tested and the reconstructed face image respectively using an identity feature extractor; calculating the identity reconstruction loss based on the corresponding identity features of the two images, and performing forgery judgment based on the identity reconstruction loss to obtain the detection result. This method and apparatus can improve the accuracy of face-swapping image detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of fake face detection technology, specifically relating to a face-swapping image detection method and apparatus based on reconstruction loss. Background Technology

[0002] In recent years, thanks to the advancements in deep learning technology, face-swapping technology has developed rapidly, achieving remarkably realistic results. While face-swapping has positive applications in film and entertainment, it poses serious security risks to areas such as public opinion security. Malicious attackers can use face-swapping technology to create and disseminate fake videos, damaging personal reputations and undermining the authenticity of news reports. Furthermore, face-swapping technology can also attack existing facial recognition systems, endangering personal information and property security.

[0003] To address the security risks posed by the misuse of deepfake technology, research on deepfake detection technology has received continuous attention in recent years. The academic community has proposed various deepfake face detection algorithms, achieving high accuracy in classifying fake faces on relevant datasets. However, existing detection methods generally exhibit poor generalization to newly emerging forgery methods. Most existing methods require training the real-fake classification model on existing deepfake datasets, making it difficult to avoid overfitting. This leads to misclassification when detecting face-swapped images generated by new forgery methods not seen during training. In real-world scenarios, deepfake generation technology is constantly being updated and optimized, requiring detection technology performance that can generalize to fake faces generated by different forgery methods.

[0004] Most existing face-swapping detection methods are based on binary classification, which has achieved high detection performance on forged images generated by face-swapping methods included in the training set. However, their performance remains limited on face-swapping methods not included in the training set. Although recent work has made some progress in improving generalization through network design and other aspects, the performance degradation across forgery methods is still significant, indicating that binary classification-based methods are insufficient to address the overfitting problem of forgery methods within the training set. Furthermore, face-swapping forgery methods are constantly evolving and being updated, making it difficult for detectors to include forged images from all methods in the training set.

[0005] A few existing works use only real face images during training to improve detection generalization, thus avoiding overfitting to a particular forgery method. However, the detection performance of existing methods is still relatively low. For example, OC-FakeDect directly transfers the reconstruction model VAE and reconstruction loss calculation method used for anomaly detection. It performs well in detecting face-swapping methods such as Deepfakes with obvious early forgery traces, but performs poorly on newer face-swapping methods with higher quality. The reasons are: (1) High-quality face-swapping images are not visually significantly different from real faces, and the difference is smaller than that between abnormal samples and normal samples in the anomaly detection field, resulting in a smaller reconstruction loss for face-swapping images; (2) Real faces have more details and are more difficult to reconstruct, resulting in a higher reconstruction loss for real faces. In summary, it is difficult to distinguish between real faces and face-swapping images by directly using reconstruction models such as VAE and reconstruction loss indicators such as RMSE. Summary of the Invention

[0006] In view of the above, the purpose of this invention is to provide a face-swapping image detection method and apparatus based on reconstruction loss, so as to improve the accuracy and generalization of face-swapping image detection.

[0007] To achieve the above-mentioned objectives, an embodiment provides a face-swapping image detection method based on reconstruction loss, comprising the following steps:

[0008] The face image to be tested is acquired and blurred to obtain a blurred face image;

[0009] Calculate the reconstructed face image corresponding to the blurred face image using a reconstruction model;

[0010] An identity feature extractor was used to extract identity features from both the test face image and the reconstructed face image.

[0011] The identity reconstruction loss is calculated based on the corresponding identity features of the two images, and forgery judgment is performed based on the identity reconstruction loss to obtain the detection result.

[0012] In one embodiment, the reconstruction model includes an encoder, a decoder, and a memory encoding module. The output of the penultimate layer of the encoder is added to the output of the first layer of the decoder to form a residual connection. The encoder is used to encode the input blurred face image to obtain an encoding vector. The memory encoding module is used to re-encode the encoding vector using a memory feature vector matrix to obtain an approximate vector. The decoder performs decoding and reconstruction based on the approximate vector and the encoding result of the penultimate layer output of the encoder to obtain the reconstructed face image.

[0013] In one embodiment, the encoded vector is re-encoded using a memory feature vector matrix to obtain an approximate vector, including:

[0014] The attention weights w = Mz are calculated based on the memory feature vector matrix M and the encoding vector z, and the weights in the attention weights w that are less than the weight threshold are set to 0 in order to adjust the attention weights.

[0015] The memory feature vector matrix M and the adjusted attention weights are used. Multiplication yields an approximate vector

[0016] In one embodiment, the reconstruction model needs to undergo parameter optimization before it is applied. The parameter optimization process includes:

[0017] Construct training samples, each training sample including a real face image sample and another face image sample belonging to the same identity as the image sample;

[0018] A parameter optimization system is constructed, including a reconstruction model, a discriminator, an identity feature extractor, and a pre-trained perceptual network. The reconstruction model is used as a generator to form an adversarial network with the discriminator. The reconstruction model reconstructs the blurred image corresponding to the real face image sample to obtain the reconstructed face image. The discriminator is used to distinguish the face image sample from the reconstructed face image. The identity feature extractor is used to extract two identity features from the other face image sample and the reconstructed face image respectively. The pre-trained perceptual network is used to extract two visual features from the face image sample and the reconstructed face image respectively.

[0019] The loss functions are constructed, including identity loss based on two identity features, perceptual loss based on two visual features, image reconstruction loss based on face image samples and reconstructed face images, adversarial loss of the reconstruction model, and discriminant loss of the discriminator.

[0020] The parameter optimization system is trained using training samples based on a loss function to optimize the parameters.

[0021] In one embodiment, the identity feature extractor employs an ArcFace network.

[0022] In one embodiment, the pre-trained perceptual network uses VGG, and both the encoder and decoder use convolutional neural networks.

[0023] In one embodiment, the identity loss L id Represented as:

[0024] The perceived loss L p Represented as:

[0025] The image reconstruction loss L rec Represented as:

[0026] The resistance loss L adv Represented as:

[0027] The discriminant loss is expressed as: L d =max(0,1-yf) d (x))

[0028] in, Let x represent the reconstructed face image corresponding to face image sample x. same_id f represents another face image sample with the same identity as x. id () represents the identity features extracted by the identity feature extractor, cos() represents the cosine function, and φ i () represents the perceptual features extracted by the i-th layer of the pre-trained perceptual network, α i The weight of the loss in layer i represents the total number of layers, and |||1 represents the L1 norm. d () represents the discriminator output, and y represents the label that distinguishes between the face image sample and the reconstructed face image.

[0029] In one embodiment, during training, an adversarial training approach using adversarial networks is employed to construct the total loss L = λ of the reconstruction model. rec L rec +λ id L id +λ p L p +λ adv L adv , where λ rec , λ id , λ p , λ adv These represent the weights respectively;

[0030] The parameters of the reconstruction model are trained using the total loss L, and the parameters of the discriminator are trained using the discriminant loss, with adversarial training performed alternately.

[0031] In one embodiment, the step of calculating the identity reconstruction loss e based on the corresponding identity features of the two images is described. id ,include:

[0032]

[0033] in, f represents the reconstructed face image corresponding to the test face image x. id () represents the identity features extracted by the identity feature extractor, and cos() represents the cos function;

[0034] The method of using identity reconstruction loss to determine forgery and obtain detection results includes:

[0035] If the identity reconstruction loss is greater than or equal to the threshold, the face image to be tested is considered to be a fake image.

[0036] To achieve the above-mentioned objectives, an embodiment provides a face-swapping image detection device based on reconstruction loss, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-mentioned face-swapping image detection method based on reconstruction loss.

[0037] Compared with the prior art, the beneficial effects of the present invention include at least the following:

[0038] By using the blurred image corresponding to the face image as the input to the reconstruction model, the robustness and generalization of the reconstruction model are improved. Face swap detection is performed by comparing the identity reconstruction loss of the input face image and the reconstructed face image, which greatly improves the accuracy of the authenticity detection. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a schematic diagram of the parameter optimization system provided in the embodiment;

[0041] Figure 2 This is a flowchart of the face-swapping image detection method based on reconstruction loss provided in the embodiment. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the scope of protection of this invention.

[0043] The inventive concept of this invention is as follows: Addressing the growing threat posed by increasingly sophisticated deepfake technologies such as face-swapping to personal reputation, property security, and public opinion, and the fact that existing deepfake detection methods suffer from poor generalization in practical applications, making it difficult to guarantee effectiveness and accuracy, this invention provides a face-swapping image detection method based on reconstruction loss. For scenarios where a set of background faces needs to be detected for fake images, a reconstruction model is trained using the real face image to be protected. The blurred image corresponding to the face image is used as input to the reconstruction model. This improves the robustness and generalization of the reconstruction model, and face-swapping detection is performed by comparing the identity reconstruction loss between the input face image and the reconstructed face image, significantly enhancing the accuracy of authenticity detection.

[0044] like Figure 1 As shown, the reconstruction model provided in the embodiment includes an encoder, a decoder, a memory encoding module, and a high-dimensional residual connection structure. The encoder uses a convolutional neural network, such as a convolutional neural network with seven convolutional layers, to encode the input blurred face image to obtain an encoding vector. The high-dimensional residual connection structure adds the output of the penultimate layer of the encoder to the output of the first layer of the decoder and then inputs it into the second layer of the decoder to improve the reconstruction quality of the real face. The reason for not adding residual connections to other network layers is to increase the reconstruction loss of fake faces.

[0045] The memory encoding module's function is to memorize representative features of real faces, ensuring that the feature vectors input to the decoder all belong to the real face feature space, thereby reducing the reconstruction loss of fake faces. The memory module contains a memory feature vector matrix M∈R. m×d d represents the output dimension of the encoder, and m is the number of memory feature vectors. The memory encoding module re-encodes the encoded vector using the memory feature vector matrix to obtain an approximate vector. Specifically, the attention weights w = Mz are calculated based on the memory feature vector matrix M and the encoded vector z, and the weights in w that are less than a weight threshold are set to 0 to adjust the attention weights. The memory feature vector matrix M and the adjusted attention weights are then... Multiplication yields an approximate vector The embodiment applies the memory encoding module to the fake face detection task to solve the difficulty of high-quality face-swapped images being similar to real faces and thus having less reconstruction loss.

[0046] The decoder is a network implemented by combining upsampling layers and convolutional layers. It is used to decode and reconstruct the face image based on the approximate vector and the encoded result of the second-to-last layer output of the encoder.

[0047] To train the reconstruction model described above, a parameter optimization system was also constructed, such as... Figure 1As shown, this parameter optimization system includes a reconstruction model, a discriminator, an identity feature extractor, and a pre-trained perceptual network. The reconstruction model acts as a generator, forming an adversarial network with the discriminator. The reconstruction model reconstructs the blurred image corresponding to the face image sample to obtain the reconstructed face image. The discriminator distinguishes between the real face image sample and the reconstructed face image. The identity feature extractor extracts two identity features from the face image sample and the reconstructed face image respectively. The pre-trained perceptual network extracts two visual features from the face image sample and the reconstructed face image respectively. In this specific example, the identity feature extractor uses ArcFace. The pre-trained perceptual network uses VGG19. The discriminator uses a neural network consisting of six convolutional layers and one fully connected layer.

[0048] To train the above parameter optimization system, four loss functions were designed to guide the training of the reconstruction model: image reconstruction loss, identity loss, perceptual loss, and adversarial loss.

[0049] Image reconstruction loss L rec Based on face image samples and reconstructed face images, the following is constructed:

[0050]

[0051] Where x represents a face image sample, Let L represent the reconstructed face image output by the reconstruction model, and |||1 represent the L1 norm. The loss L... rec It measures the pixel-level face image reconstruction loss and is the basic loss function of the reconstruction model. However, using only this loss for supervision can easily make the reconstruction results blurry and lose details. Therefore, identity loss, perceptual loss and adversarial loss are added.

[0052] Identity loss L id Based on two identity features, it is represented as follows:

[0053]

[0054] Where, x same_id f represents a random face image sample with the same identity as x. id () represents the identity features extracted by the identity feature extractor, and cos() represents the cosine function. Decrease L id That is, to add reconstructed images The similarity of identity features between the real face and the original image is used to achieve the goal of ensuring that the identity remains the same before and after the reconstruction. Calculate L. id Using a real face image with the same identity as the input image, instead of directly using the identity features of the input image, as supervision, helps the reconstruction model better learn the reconstruction of high-level identity features, rather than simply being similar to the input image.

[0055] Perceived loss L p Constructed based on two visual features, and represented as:

[0056]

[0057] Where, φ i () represents the perceptual features extracted by the i-th layer of the pre-trained perceptual network, α i α represents the weight of the loss in the i-th layer, and n represents the total number of layers. In this invention, the values ​​are set as follows: n = 3, α1 = 1.0, α2 = 0.2, α3 = 0.5.

[0058] Adversarial loss originates from the generative adversarial network (GAN), which alternately trains the discriminator and reconstruction model to make the reconstructed face clearer and more realistic. This invention uses hinge loss, and the adversarial loss L of the reconstruction model... adv Represented as:

[0059]

[0060] Among them, f d () indicates the output of the discriminator.

[0061] In this embodiment, when training the parameter optimization system, the discriminant loss L of the discriminator is also required. d , is represented as:

[0062] L d =max(0,1-yf) d (x))

[0063] Here, y∈{-1,1} represents the label that distinguishes between the original real face image sample and the reconstructed face image. The original real face image sample is labeled with 1, and the reconstructed face image is labeled with -1. The discriminator aims to correctly classify the real face image and the reconstructed face image, while the reconstruction model aims to deceive the discriminator, making the reconstructed face image be recognized as a real face image, thereby further improving the reconstruction effect of the real face image and reducing the reconstruction loss of the real face image.

[0064] To train the parameter optimization system, training samples were also prepared, specifically targeting face-swapping image detection scenarios where a particular face is used as the background face. Examples include evidence collection when copyrighted works are used for secondary distribution and profit-making through face-swapping. In the implementation of this invention, a video dataset is used as an example. For each video segment to be protected (i.e., a set of image frames where the age, hairstyle, etc., of a specific face remains largely unchanged, averaging 300 frames in the dataset), 10 face images are taken as the dataset.

[0065] To further increase the difference in reconstruction losses between real and fake face images, the face images input to the reconstruction model are blurred to obtain blurred face images. Various losses are calculated between the reconstructed face image and the original face image. This serves to encourage the memory encoding module to better remember and reconstruct real faces from the training set. On the other hand, under the influence of the memory encoding module, the reconstructed face-swapping image will more closely resemble the real face used as the face-swapping background, thus creating a significant identity difference from the original input face image. In this invention, the blurring of the training face images uses Gaussian blurring with a Gaussian kernel of 11 and a standard deviation randomly selected between 1.0 and 5.0.

[0066] When optimizing the parameters of the parameter optimization system based on the above training samples, an adversarial training method using adversarial networks is adopted to construct the total loss L = λ of the reconstruction model. rec L rec +λ id L id +λ p L p +λ adv L adv , where λ rec , λ id , λ p , λ adv These represent weights, with values ​​of 10, 10, 5, and 1 respectively. The parameters of the reconstruction model are trained using the total loss L, and the parameters of the discriminator are trained using the discriminant loss, employing adversarial training. Training hyperparameters include: a batch size of 64, the use of the Adam optimizer, a learning rate of 0.0004, and training terminated after 100 epochs.

[0067] Based on the reconstruction model and identity recognition model obtained through the above training, the embodiment also provides a face-swapping image detection method based on reconstruction loss, such as... Figure 2 As shown, it includes the following steps:

[0068] Step 1: Obtain the face image to be tested and blur it to obtain a blurred face image.

[0069] Specifically, during the blurring process, Gaussian blurring with a kernel of 11 and a standard deviation of 5.0 is used to obtain a blurred face image.

[0070] Step 2: Calculate the reconstructed face image corresponding to the blurred face image using the reconstruction model.

[0071] Specifically, a blurred face image is input into a trained reconstruction model, and the reconstructed face image is obtained through forward propagation calculation.

[0072] Step 3: Use an identity feature extractor to extract identity features from the test face image and the reconstructed face image respectively.

[0073] Specifically, the face image to be tested and the reconstructed face image are input into a pre-trained identity feature extractor, and the corresponding identity features are obtained through forward propagation calculation.

[0074] Step 4: Calculate the identity reconstruction loss based on the corresponding identity features of the two images, and perform forgery judgment based on the identity reconstruction loss to obtain the detection result.

[0075] Specifically, the identity reconstruction loss e is calculated using the following formula based on the corresponding identity features of the two images. id :

[0076]

[0077] In obtaining identity reconstruction loss e id Afterwards, when identity reconstruction results in loss e id If the value is greater than or equal to the threshold, the face image to be tested is considered a fake image.

[0078] The threshold is obtained through testing. Specifically, real and fake test samples are collected, input into the trained reconstruction model, and the identity reconstruction loss is obtained. Based on the size of the identity reconstruction loss and the real labels of the test samples, the optimal threshold for real and fake classification is determined.

[0079] The face-swapping image detection method based on reconstruction loss provided in the embodiment uses identity reconstruction loss instead of image pixel-level reconstruction loss as the face-swapping detection index because the reconstruction model tends to lose facial details. The size of pixel-level differences is easily affected by the reconstruction effect of these details, resulting in larger differences in real faces and smaller differences in fake faces. In contrast, differences in identity features are robust to facial image details. When used together with the reconstruction model with memory module designed in this invention, it can better distinguish between real and fake faces.

[0080] To test the effectiveness of the face-swapping image detection method provided in the above embodiments, tests were conducted on some face-swapping forgery datasets following the steps of the specific implementation examples described above. AUC (Area Under Curve) was used as the evaluation metric; the closer the AUC is to 1.0, the better the detection performance. Table 1 shows the test results on four datasets: FaceForensics++, Celeb-DF, DeepperForensics-1.0, and Deepfake Detection (DFD). FaceForensics++ only includes three face-swapping forgery components: DeepFakes, FaceSwap, and FaceShifter, and does not include facial animation forgery.

[0081] The comparison methods include the best existing technologies (RECCE[3], ICT-Ref[4]) and OC-FakeDect. Among them, RECCE is a binary classification method trained on FF++. It can be seen that its AUC drops significantly on datasets such as Celeb-DF, indicating insufficient generalization. ICT-Ref is a detection method that utilizes the identity features of reference images, while OC-FakeDect is a method that directly uses VAE to reconstruct the model. Here, we compare the second form of OC-FakeDect, which has higher results in the paper. It can be seen that the AUC is lower on high-quality face-swapping datasets (such as Celeb-DF).

[0082] Table 1. Authenticity Detection Test Results (AUC%)

[0083]

[0084] Based on the same inventive concept, the embodiment also provides a face-swapping image detection device based on reconstruction loss, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described face-swapping image detection method based on reconstruction loss, including the following steps:

[0085] Step 1: Obtain the face image to be tested and blur it to obtain a blurred face image;

[0086] Step 2: Calculate the reconstructed face image corresponding to the blurred face image using the reconstruction model;

[0087] Step 3: Use an identity feature extractor to extract identity features from the test face image and the reconstructed face image respectively;

[0088] Step 4: Calculate the identity reconstruction loss based on the corresponding identity features of the two images, and perform forgery judgment based on the identity reconstruction loss to obtain the detection result.

[0089] The memory can be volatile memory located at the near end, such as RAM, or non-volatile memory, such as ROM, FLASH, floppy disk, solid-state drive, hard disk, etc., or it can be a remote storage cloud. The computer processor can be a central processing unit (CPU), microprocessor (MPU), digital signal processor (DSP), or field-programmable gate array (FPGA), meaning that the steps of the face-swapping image detection method based on reconstruction loss can be implemented through these processors.

[0090] The specific embodiments described above illustrate the technical solution and beneficial effects of the present invention in detail. It should be understood that the above description is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, additions, and equivalent substitutions made within the scope of the principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A face-swapping image detection method based on reconstruction loss, characterized in that, Includes the following steps: The face image to be tested is acquired and blurred to obtain a blurred face image; A reconstruction model is used to calculate the reconstructed face image corresponding to the blurred face image. The reconstruction model includes an encoder, a decoder, and a memory encoding module. The output of the penultimate layer of the encoder is added to the output of the first layer of the decoder to form a residual connection. The encoder is used to encode the input blurred face image to obtain an encoding vector. The memory encoding module is used to re-encode the encoding vector using a memory feature vector matrix to obtain an approximate vector. The decoder performs decoding and reconstruction based on the approximate vector and the encoding result of the penultimate layer of the encoder to obtain the reconstructed face image. An identity feature extractor was used to extract identity features from both the test face image and the reconstructed face image. The identity reconstruction loss is calculated based on the corresponding identity features of the two images, and forgery judgment is performed based on the identity reconstruction loss to obtain the detection result.

2. The face-swapping image detection method based on reconstruction loss according to claim 1, characterized in that, An approximate vector is obtained by re-encoding the encoded vector using a memory feature vector matrix, including: The attention weights w = Mz are calculated based on the memory feature vector matrix M and the encoding vector z, and the weights in the attention weights w that are less than the weight threshold are set to 0 in order to adjust the attention weights. The memory feature vector matrix M and the adjusted attention weights are used. Multiplication yields an approximate vector 3. The face-swapping image detection method based on reconstruction loss according to claim 1 or 2, characterized in that, The reconstruction model needs to undergo parameter optimization before it can be applied. The parameter optimization process includes: Construct training samples, each training sample including a real face image sample and another face image sample belonging to the same identity as the image sample; A parameter optimization system is constructed, including a reconstruction model, a discriminator, an identity feature extractor, and a pre-trained perceptual network. The reconstruction model is used as a generator to form an adversarial network with the discriminator. The reconstruction model reconstructs the blurred image corresponding to the real face image sample to obtain the reconstructed face image. The discriminator is used to distinguish between the real face image sample and the reconstructed face image. The identity feature extractor is used to extract two identity features from the other face image sample and the reconstructed face image respectively. The pre-trained perceptual network is used to extract two visual features from the face image sample and the reconstructed face image respectively. The loss functions are constructed, including identity loss based on two identity features, perceptual loss based on two visual features, image reconstruction loss based on face image samples and reconstructed face images, adversarial loss of the reconstruction model, and discriminant loss of the discriminator. The parameter optimization system is trained using training samples based on a loss function to optimize the parameters.

4. The face-swapping image detection method based on reconstruction loss according to claim 1, characterized in that, The identity feature extractor uses the ArcFace network.

5. The face-swapping image detection method based on reconstruction loss according to claim 3, characterized in that, The pre-trained perceptual network uses VGG, and both the encoder and decoder use convolutional neural networks.

6. The face-swapping image detection method based on reconstruction loss according to claim 3, characterized in that, The identity loss L id Represented as: The perceived loss L p Represented as: The image reconstruction loss L rec Represented as: The resistance loss L adv Represented as: The discriminant loss is expressed as: L d =max(0,1-yf) d (x)) in, Let x represent the reconstructed face image corresponding to face image sample x. same_id f represents another face image sample with the same identity as x. id () represents the identity features extracted by the identity feature extractor, cos() represents the cosine function, and φ i () represents the perceptual features extracted by the i-th layer of the pre-trained perceptual network, α i f represents the weight of the loss in layer i, n represents the total number of layers, ||||1 represents the L1 norm, and f d () represents the discriminator output, and y represents the label that distinguishes between the face image sample and the reconstructed face image.

7. The face-swapping image detection method based on reconstruction loss according to claim 6, characterized in that, During training, an adversarial training approach using adversarial networks is employed to construct the total loss L = λ for the reconstruction model. rec L rec +λ id L id +λ p L p +λ adv L adv , where λ rec , λ id , λ p , λ adv These represent the weights respectively; The parameters of the reconstruction model are trained using the total loss L, and the parameters of the discriminator are trained using the discriminant loss, with adversarial training performed alternately.

8. The face-swapping image detection method based on reconstruction loss according to claim 1, characterized in that, The identity reconstruction loss e is calculated based on the corresponding identity features of the two images. id ,include: in, f represents the reconstructed face image corresponding to the test face image x. id () represents the identity features extracted by the identity feature extractor, and cos() represents the cos function; The method of using identity reconstruction loss to determine forgery and obtain detection results includes: If the identity reconstruction loss is greater than or equal to the threshold, the face image to be tested is considered to be a fake image.

9. A face-swapping image detection device based on reconstruction loss, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the face-swapping image detection method based on reconstruction loss as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Method and system for detecting fake face changing image based on identity difference quantization

    CN115035052A