A method, system, device and medium for detecting deep fakes in facial images
By constructing a forgery detection model, using the two-stage training mechanism of estimating branches and classifying branches with forgery force, the problem of difficult to capture weak forgery pixels in face images in the prior art is solved, and a higher precision and robust forgery detection is achieved.
Patent Information
- Application Number
- CN202510803790.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-17
AI Technical Summary
The prior art is difficult to fully capture fake features in face images, especially weak fake pixels, resulting in poor detection results.
Build a forged detection model, including forgery force estimation branches and forgery classification branches, extract strong forgery and weak forgery clues through a two-stage training mechanism, and update model parameters based on forgery force perception losses and forgery classification losses to enhance detection accuracy.
It improves the detection accuracy and robustness of face image forgery, can effectively capture forgery traces of different abilities, and adapt to the needs of multiple complex scenarios.
Smart Images

Figure CN120318894B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, system, device and medium for detecting deep fakes in facial images. Background Art
[0002] With the rapid development of deepfake technology, deep learning-based facial forgery techniques have significantly improved the authenticity of forged facial images and have been widely used in image generation and video processing. The misuse of these technologies has raised security risks in areas such as payment security, visual communication, and identity authentication.
[0003] Current deepfake detection methods primarily rely on specific forgery cues, such as detecting boundary fusion features, inconsistent local region information, or frequency domain differences in forged facial images to distinguish between real and fake facial images. However, these methods typically rely on a single forgery cue, and the traces produced by different forgery types vary significantly. A single cue (a strong forgery cue) cannot fully capture all forgery characteristics and often overlooks weakly forged pixels in forged facial images. Although these weak forgery pixels are faint, they contain key forgery cues that are crucial for improving detection accuracy. This results in some tampered areas being unrecognizable, resulting in poor detection results. Summary of the Invention
[0004] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and provide a method, system, device and medium for detecting deep fakes in facial images to solve the problems in the prior art.
[0005] The present invention specifically provides the following technical solutions:
[0006] A method for detecting deep fakes in facial images, comprising:
[0007] Obtaining historical face images including real face images and corresponding forged face images;
[0008] Construct a forgery detection model, including a forgery intensity estimation branch and a forgery classification branch, and train the forgery detection model using historical facial images. Use the trained forgery detection model to perform forgery detection on the facial image to be detected. Training the forgery detection model includes the following steps:
[0009] The forgery strength estimation branch extracts features from historical face images to obtain category labels and patch labels, which are then reshaped into intermediate features. A strong forgery estimation strength map and a complete forgery estimation strength map of the intermediate features are obtained through a two-stage training mechanism. The complete representation contains both strong and weak forgery clues.
[0010] Obtaining a first mask of a strong forged estimated force map and a second mask of a complete forged estimated force map, and generating a forged force-aware loss for the first mask and the second mask during two-stage training;
[0011] classifying the category labels through a forged classification branch, and constraining the classification results using a binary cross entropy loss function to obtain a forged classification loss for distinguishing real face images from forged face images;
[0012] The forgery intensity perception loss and the forgery classification loss are integrated, and the forgery detection model parameters are updated using the integrated losses to obtain a trained forgery detection model.
[0013] Preferably, the feature extraction of the historical face image by the forgery strength estimation branch to obtain the category label and the patch label is specifically as follows:
[0014] Utilize the visual transformer backbone network of the forgery detection model as the forgery strength estimation branch;
[0015] Historical facial images Input the visual transformer backbone network to extract relevant features and obtain category labels and Patch Marker ;
[0016] Among them, historical facial images , and Respectively represent the height and width of the historical face image, Indicates the number of channels of historical face images, is the dimension of the feature, , Indicates the number of patches into which the historical face image is divided.
[0017] Preferably, reshaping the patch mark into an intermediate feature and obtaining a strong forgery estimation force map and a complete forgery estimation force map of the intermediate feature through a two-stage training mechanism comprises:
[0018] Mark the patch Reshape into feature map , and the feature map Through linear transformation Projected into the forged force space, the intermediate features of the first stage are obtained ; The specific expression is:
[0019] ;
[0020] The intermediate features Through linear transformation Convert to estimated strong forgery estimation strength map , the specific expression is:
[0021] ;
[0022] Fusion of intermediate features from the first stage and feature maps , and through the linear transformation Generate a complete forgery estimation strength map containing strong and weak forgery cues , the specific expression is:
[0023] .
[0024] Preferably, the first mask for obtaining a strong forgery estimated force map and the second mask for obtaining a complete forgery estimated force map are specifically:
[0025] Through real face images and the corresponding forged face image Take the absolute value of the pixel difference to generate a fake force map , the specific expression is:
[0026] ;
[0027] in, Represents pixel-by-pixel absolute value operation;
[0028] Convert the forged force map to the first mask and the second mask ; Wherein, the first mask is a strong forged force map mask, and the second mask is a patch-based forged force map mask;
[0029] Among them, the first mask The conversion process specifically includes:
[0030] Forged Strength Map Setting the threshold , remove pixels whose forgery strength is lower than the threshold and generate a strong forgery strength map , the specific expression is:
[0031] ;
[0032] in, is the eigenvector, is the true label of the face image;
[0033] Will The three channels of are summed and reshaped into ,in is the patch size of the image, is the height of the face image data, is the number of patches;
[0034] Reshape the strong forgery intensity map along the first dimension Sum the pixel values to obtain the sum of the forgery strength in each patch, and divide the sum of the forgery strength of each patch by the patch area , generate the first mask ;in, The value range of is normalized to ;
[0035] Among them, the second mask The conversion process specifically includes:
[0036] Fake force map The three channels of are summed and reshaped into ;
[0037] Reshape the strong forgery intensity map along the first dimension Sum the pixel values of the patch, calculate the sum of the forgery strength within each patch, and divide the sum of the forgery strength of each patch by the patch area , generate the second mask ,in, The value range of is normalized to .
[0038] Preferably, the forged strength perception loss of generating the first mask and the second mask during the two-stage training is specifically:
[0039] The binary cross entropy loss function is used to constrain the forgery strength estimation process and obtain the strong forgery strength estimation loss in the first stage. and the second phase of comprehensive counterfeiting efforts to estimate losses , the specific expression is:
[0040] ;
[0041] ;
[0042] in, represents the binary cross entropy loss function;
[0043] Estimating losses through strong counterfeiting efforts in the first stage and the second phase of comprehensive counterfeiting efforts to estimate losses Obtain the final fake strength-aware loss , the specific expression is:
[0044] .
[0045] Preferably, the category labels are classified by a forged classification branch, and the classification results are constrained using a binary cross entropy loss function to obtain a forged classification loss for distinguishing real face images from forged face images, specifically:
[0046] Mark the category Input the binary classifier of the forged classification branch, use the binary cross entropy loss function to constrain the classification results, and obtain the specific expression of the forged classification loss:
[0047] ;
[0048] in, is the forgery probability predicted by the forgery detection model, Represents the true label of the face image, when When , the current face image is a real face image; when When , the current face image is a fake face image, is the loss of the forged classification branch, represents the binary cross entropy loss function, The specific expression is:
[0049] ;
[0050] in, For the i The feature vector of the samples, For the i The probability of sample prediction;
[0051] Distinguish real face images from forged face images through forged classification loss.
[0052] Preferably, after generating the forged force map, the method further includes:
[0053] Using shape transformation, force transformation and frequency transformation to forge force map Perform augmentation transformation to generate a forged force map after augmentation transformation , the forged force map after augmentation transformation and real face images Combine to generate new fake face images , the generating formula is:
[0054] = - ;
[0055] Through new fake face images As training data for forgery detection models.
[0056] The present invention provides a facial image deepfake detection system, comprising:
[0057] An acquisition module, configured to acquire historical facial images including real facial images and corresponding forged facial images;
[0058] The model building and detection module is used to build a forgery detection model, including a forgery intensity estimation branch and a forgery classification branch, and train the forgery detection model using historical facial images. The trained forgery detection model is used to perform forgery detection on the facial images to be detected. The training of the forgery detection model includes:
[0059] The forgery strength module is used to extract features of historical face images through the forgery strength estimation branch, obtain category labels and patch labels, and reshape the patch labels into intermediate features. A strong forgery estimation strength map and a complete forgery estimation strength map of the intermediate features are obtained through a two-stage training mechanism. The complete representation contains strong and weak forgery clues.
[0060] a perceptual loss acquisition module, configured to acquire a first mask of a strong forged estimated force map and a second mask of a complete forged estimated force map, and generate a forged force perceptual loss for the first mask and the second mask during two-stage training;
[0061] a classification loss acquisition module, configured to classify the category labels using a forged classification branch and constrain the classification results using a binary cross entropy loss function to obtain a forged classification loss for distinguishing between real face images and forged face images;
[0062] The model updating module is used to integrate the forgery intensity perception loss and the forgery classification loss, and update the forgery detection model parameters according to the integrated loss to obtain a trained forgery detection model.
[0063] The present invention provides a computer device, including a memory and a processor, wherein a program is stored in the memory, and when the program is executed by the processor, the processor performs the steps of the above-mentioned method for detecting deep fakes in facial images.
[0064] The present invention provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-mentioned method for detecting deep fakes in facial images.
[0065] Compared with the prior art, the present invention has the following significant advantages:
[0066] The present invention captures the dual characteristics of forged faces in macro-attribute distribution and micro-pixel anomalies by obtaining category labels and patch labels, obtains strong forgery estimation force maps and complete forgery estimation force maps of intermediate features through a two-stage training mechanism, and obtains forgery intensity perception loss during two-stage training based on the strong forgery estimation force map and the complete forgery estimation force map, thereby improving the sensitivity to local forgery traces, that is, improving weak forgery clues, and obtaining forgery classification loss through category labels, and updating the forgery detection model parameters in combination with the forgery intensity perception loss. The forgery detection model with updated parameters is used to re-perform forgery detection of the face image to be detected, distinguish between real face images and forged face images, and effectively capture forgery traces of different intensities by perceiving the full range of face forgery clues, thereby enhancing the accuracy and robustness in detecting forged face images, and improving the detection accuracy through multimodal feature fusion, thereby adapting to the needs of various complex scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 This is the overall network model framework diagram provided by the present invention;
[0068] Figure 2 is a flow chart of a data augmentation method based on forgery strength transformation provided by the present invention;
[0069] Figure 3 This is an overall flow chart of a facial image deepfake detection method provided by the present invention;
[0070] Figure 4 This is a flow chart of detection model detection in a method for detecting deep fakes in facial images of the present invention. DETAILED DESCRIPTION
[0071] The following is a clear and complete description of the technical solutions of the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0072] like Figure 3 and Figure 4 As shown, in this embodiment, a method for detecting deep fakes in facial images includes the following steps:
[0073] Step S1: Acquire historical face images including real face images and corresponding forged face images.
[0074] Step S2: Constructing a forgery detection model, including a forgery intensity estimation branch and a forgery classification branch, and training the forgery detection model using historical facial images. The trained forgery detection model is then used to perform forgery detection on the facial images to be detected. Training the forgery detection model includes the following steps:
[0075] Step S21: Extract features of historical facial images through the forgery strength estimation branch to obtain category labels and patch labels, and reshape the patch labels into intermediate features. A strong forgery estimation strength map and a complete forgery estimation strength map of the intermediate features are obtained through a two-stage training mechanism; the complete representation contains strong forgery and weak forgery clues.
[0076] The forgery intensity estimation branch is designed to extract a forgery intensity map from the input face image. This forgery intensity estimation is achieved through a two-stage training mechanism: the initial stage identifies regions of high forgery intensity, while subsequent stages enhance the capture of weaker forgery cues. The forgery intensity map is generated based on the pixel differences between the real and forged face images, and is then partitioned into patches to form a patch-level forgery intensity distribution, enabling the detection of a full range of forgery cues. The forgery intensity estimation branch utilizes the Vision Transformer (ViT) backbone network of the forgery detection model.
[0077] Historical facial images Input the visual transformer backbone network to extract relevant features and obtain category labels and Patch Marker .
[0078] Among them, historical facial images , and Respectively represent the height and width of the historical face image, Indicates the number of channels of historical face images, is the dimension of the feature, , Indicates the number of patches into which the historical face image is divided.
[0079] The patch labels are reshaped into intermediate features, and the strong forged estimated force maps and the complete forged estimated force maps of the intermediate features are obtained through a two-stage training mechanism, including:
[0080] Phase 1: Strong forgery strength estimation. The patch is marked Reshape into feature map , and the feature map Through linear transformation Projected into the forged force space, the intermediate features of the first stage are obtained ; The specific expression is:
[0081] ;
[0082] The intermediate features Through linear transformation Convert to estimated strong forgery estimation strength map , the specific expression is:
[0083] ;
[0084] The second stage: comprehensive forgery strength estimation. Fusion of intermediate features from the first stage and feature maps , and through the linear transformation Generate a complete forgery estimation strength map containing strong and weak forgery cues , the specific expression is:
[0085] .
[0086] Step S22: obtaining a first mask of a strong forged estimated force map and a second mask of a complete forged estimated force map, and generating a forged force perception loss of the first mask and the second mask during two-stage training.
[0087] The first mask of the strong forged estimated force map is obtained, and the second mask of the complete forged estimated force map is obtained, specifically:
[0088] Through real face images and the corresponding forged face image Take the absolute value of the pixel difference to generate a fake force map , the specific expression is:
[0089] ;
[0090] in, Represents a pixel-by-pixel absolute value operation.
[0091] Convert the forged force map to the first mask and the second mask ; Among them, the first mask is a strong forged force map mask, and the second mask is a patch-based forged force map mask.
[0092] Among them, the first mask The conversion process specifically includes:
[0093] To generate a strong mask , for the forged force map Setting the threshold In one embodiment, , remove pixels whose forgery strength is lower than the threshold and generate a strong forgery strength map , the specific expression is:
[0094] ;
[0095] in, is the eigenvector, is the true label of the face image.
[0096] Strong forgery strength map The pixel value range is ,Will Convert to patch-based strong forgery force map mask , the forgery strength within each block is quantified to simplify the estimation task, specifically:
[0097] Will The three channels of are summed and reshaped into ,in is the patch size of the image, is the height of the face image data, is the number of patches, The non-zero values of are directly set to 1; along the first dimension, the strong forgery force map is reshaped Sum the pixel values to obtain the sum of the forgery strength in each patch, and divide the sum of the forgery strength of each patch by the patch area , generate the first mask ;in, The value range of is normalized to .
[0098] Among them, the forged strength map The pixel value range is , the forged force map Convert to patch-based forged force map mask , quantify the forgery strength within each block to simplify the estimation task, the second mask The conversion process specifically includes:
[0099] Fake force map The three channels of are summed and reshaped into ,right The non-zero values of are directly set to 1; along the first dimension, the strong forgery force map is reshaped Sum the pixel values of the patch, calculate the sum of the forgery strength within each patch, and divide the sum of the forgery strength of each patch by the patch area , generate the second mask ,in, The value range of is normalized to .
[0100] Generate the fake force-aware loss for the first and second masks during two-stage training, specifically:
[0101] Loss function design: In order to constrain the above-mentioned forgery strength estimation process, the binary cross entropy loss function is used to constrain the forgery strength estimation process, and the strong forgery strength estimation loss of the first stage is obtained. and the second phase of comprehensive counterfeiting efforts to estimate losses , the specific expression is:
[0102] ;
[0103] ;
[0104] in, represents the binary cross entropy loss function.
[0105] Estimating losses through strong counterfeiting efforts in the first stage and the second phase of comprehensive counterfeiting efforts to estimate losses Obtain the final fake strength-aware loss , the specific expression is:
[0106] .
[0107] Step S23: classify the category labels through the forged classification branch, and use the binary cross entropy loss function to constrain the classification results to obtain the forged classification loss for distinguishing real face images from forged face images.
[0108] A deep fake classification branch is designed to extract global features of the input face image and combine it with the fake force map to classify the face image; the classification branch integrates the fake force perception loss and the classification loss to distinguish between real face images and fake face images; the model uses this branch to enhance its generalization ability in cross-domain scenarios.
[0109] The specific steps of this step are:
[0110] Category labels extracted by the Vision Transformer backbone network , the category tag The dimension is The global feature vector is used to represent the overall feature information of the input face image. Input the binary classifier of the forged classification branch, use the binary cross entropy loss function to constrain the classification results, and obtain the specific expression of the forged classification loss:
[0111] ;
[0112] in, is the forgery probability predicted by the forgery detection model, Represents the true label of the face image, when When , the current face image is a real face image; when When , the current face image is a fake face image, is the loss of the forged classification branch, represents the binary cross entropy loss function, The specific expression is:
[0113] ;
[0114] in, For the i The feature vector of the samples, For the i The probability of the sample prediction.
[0115] Distinguish real face images from forged face images through forged classification loss.
[0116] Step S24: Integrate the forgery intensity perception loss and the forgery classification loss, and update the forgery detection model parameters using the integrated loss to obtain a trained forgery detection model.
[0117] In order to comprehensively optimize the performance of the forged force perception branch and the forged classification branch, the forged force perception loss and the forged classification loss are integrated to obtain the overall loss function , through the overall loss function The forgery detection model is updated to obtain an updated forgery detection model, and the updated forgery detection model is used to distinguish real face images from forged face images. The overall loss function of the framework is Defined as:
[0118] ;
[0119] in, To fake the loss of the force-aware branch, is the loss of the forged classification branch. Through the above loss function ,Combining the forgery intensity perception loss and the forgery classification loss, the model uses the loss gradient to update parameters during the back-propagation training process, gradually optimizing its performance for face forgery detection. and They are and The weight coefficients are all set to 1 by default to ensure the comprehensive performance of the model in forged area strength perception and classification performance.
[0120] Most current forgery detection models suffer from insufficient generalization performance. They are typically trained on known forged data, whose distribution differs significantly from that of unknown forged samples. This results in a significant drop in detection accuracy when dealing with unknown forged samples. Furthermore, the generated forged samples often differ significantly from the actual distribution, further degrading the model's detection performance.
[0121] A data augmentation method based on fake force is designed to transform the shape, force and frequency of the fake force map to generate diverse fake samples; shape transformation adjusts the shape of the fake force map through random grid deformation; force transformation highlights weak clues by scaling the fake force values; frequency transformation adjusts the high-frequency features of the fake face image through Gaussian blur or Laplace convolution; after transformation, the fake force map is synthesized with the real face image to generate fake samples for model training.
[0122] The data augmentation method based on the forgery strength is:
[0123] We obtain a dataset containing both real and forged facial images. The source dataset covers a wide range of facial images, including both high-resolution and low-resolution images. We generate forged samples using established generative adversarial network (GAN) techniques and further employ various data augmentation operations to enrich the diversity of the dataset samples.
[0124] In the data augmentation process, real face images are used and forged face images Recalculate the forged force map The forged force map is used to characterize the force difference between real face images and forged face images. The calculation formula is as follows:
[0125] ;
[0126] Fake force map The pixel value range is .
[0127] like Figure 2 As shown, in order to increase To improve the diversity, the following data augmentation methods are used: (1) Shape transformation: Randomly sampling grid size , for the forged force map Perform random deformation operation. When the grid size is not 0, generate the corresponding deformation transformation. In order to avoid the negative impact of excessive deformation on the deep fake detection performance, the deformation degree is controlled within an appropriate range through the inverse deformation operation, and finally the deformed fake force map is generated. (2) Force transformation: For the pixel area with low fake force, randomly sample the scaling factor , for the forged force map Perform force scaling to reduce the overall force value to simulate the subtle forgery in real scenes. This operation can guide the deep forgery detection model to pay more attention to the details of the low forgery force, thereby improving the model's ability to perceive weak forgery features. (3) Frequency transformation: Based on high-frequency information, the forgery force map is transformed into a frequency map. Perform random transformation. Specifically, randomly select Gaussian blur or Laplace convolution operation to Processing is performed to enhance or weaken the high-frequency information of the forged face image, thereby changing its frequency characteristics. Through the above operations, the transformed forged force map is generated. , to increase the frequency diversity of the samples.
[0128] Using shape transformation, force transformation and frequency transformation to forge force map Perform augmentation transformation to generate a forged force map after augmentation transformation , the forged force map after augmentation transformation and real face images Combine to generate new fake face images , the generating formula is:
[0129] = - ;
[0130] Through new fake face images As training data for forgery detection models.
[0131] The above data augmentation method significantly improves the diversity of forged samples through shape transformation, force transformation and frequency transformation, providing richer and more robust sample support for the training of deep forgery detection models, thereby further improving the detection performance of the model. Figure 1 shown.
[0132] The present invention proposes a facial image deep fake detection system, comprising: an acquisition module and a model building and detection module.
[0133] Among them, the acquisition module is used to obtain historical face images containing real face images and corresponding forged face images; the model construction and detection module is used to construct a forgery detection model, including a forgery strength estimation branch and a forgery classification branch, and train the forgery detection model through historical face images, and perform forgery detection on the face images to be detected through the trained forgery detection model; the training of the forgery detection model includes: forgery strength module, perceptual loss acquisition module, classification loss acquisition module and model update module.
[0134] Among them, the forgery strength module is used to extract the features of historical face images through the forgery strength estimation branch, obtain category labels and patch labels, and reshape the patch labels into intermediate features, and obtain the strong forgery estimation force map and the complete forgery estimation force map of the intermediate features through a two-stage training mechanism; the complete representation contains strong forgery and weak forgery clues; the perceptual loss acquisition module is used to obtain the first mask of the strong forgery estimation force map and the second mask of the complete forgery estimation force map, and generate the forgery strength perception loss of the first mask and the second mask during two-stage training; the classification loss acquisition module is used to classify the category labels through the forgery classification branch, and use the binary cross entropy loss function to constrain the classification results to obtain the forgery classification loss for distinguishing real face images from forged face images; the model update module is used to integrate the forgery strength perception loss and the forgery classification loss, and update the forgery detection model parameters through the integrated loss to obtain the trained forgery detection model.
[0135] The present invention also provides a computer device, including a memory and a processor, wherein a program is stored in the memory. When the program is executed by the processor, the processor executes the steps of a method for detecting deep fakes of facial images.
[0136] According to the disclosed embodiments, a computing device may communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth communications, etc.), or any device (e.g., routers, modems, etc.) that enables a computing device to communicate with one or more other computing devices.
[0137] The present invention also provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for detecting deep fakes in facial images are implemented.
[0138] According to the disclosed embodiments, the storage medium may be a non-volatile computer-readable storage medium, such as, but not limited to, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. For purposes of the present invention, the storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0139] The above content is a further detailed description of the present invention in combination with specific preferred embodiments. For those skilled in the art to which the present invention belongs, several simple deductions or replacements can be made without departing from the concept of the present invention, which should be regarded as falling within the scope of protection of the present invention.
Claims
1. A method for detecting deep fakes in facial images, characterized in that: include: Obtaining historical face images including real face images and corresponding forged face images; Construct a forgery detection model, including a forgery intensity estimation branch and a forgery classification branch, and train the forgery detection model using historical facial images. Use the trained forgery detection model to perform forgery detection on the facial image to be detected. Training the forgery detection model includes the following steps: The forgery force estimation branch extracts features of historical face images to obtain category labels and patch labels, and reshapes the patch labels into intermediate features. A strong forgery estimation force map and a complete forgery estimation force map of the intermediate features are obtained through a two-stage training mechanism. where the complete representation contains both strong and weak forgery clues; Obtaining a first mask of a strong forged estimated force map and a second mask of a complete forged estimated force map, and generating a forged force-aware loss for the first mask and the second mask during two-stage training; classifying the category labels through a forged classification branch, and constraining the classification results using a binary cross entropy loss function to obtain a forged classification loss for distinguishing real face images from forged face images; Integrating the forgery intensity perception loss and the forgery classification loss, and updating the forgery detection model parameters using the integrated losses to obtain a trained forgery detection model; The patch mark is reshaped into an intermediate feature, and a strong forged estimated force map and a complete forged estimated force map of the intermediate feature are obtained through a two-stage training mechanism, including: Mark the patch Reshape into feature map , and the feature map Through linear transformation Projected into the forged force space, the intermediate features of the first stage are obtained ,in is the dimension of the feature, Indicates the number of patches into which the historical face image is divided; the specific expression is: ; The intermediate features Through linear transformation Convert to estimated strong forgery estimation strength map , the specific expression is: ; Fusion of intermediate features from the first stage and feature maps , and through the linear transformation Generate a complete forgery estimation strength map containing strong and weak forgery cues , the specific expression is: 。 2. A facial image deepfake detection method according to claim 1, characterized in that: The feature extraction of the historical face image by the forgery strength estimation branch to obtain the category label and patch label is specifically as follows: Utilize the visual transformer backbone network of the forgery detection model as the forgery strength estimation branch; Historical facial images Input the visual transformer backbone network to extract relevant features and obtain category labels and Patch Marker ; Among them, historical facial images , and Respectively represent the height and width of the historical face image, Indicates the number of channels of historical face images, is the dimension of the feature, , Indicates the number of patches into which the historical face image is divided.
3. The method for detecting deep fakes in facial images according to claim 1, wherein: The first mask for obtaining a strong forged estimated force map and the second mask for obtaining a complete forged estimated force map are specifically: Through real face images and the corresponding forged face image Take the absolute value of the pixel difference to generate a fake force map , the specific expression is: ; in, Represents pixel-by-pixel absolute value operation; Convert the forged force map to the first mask and the second mask ; Wherein, the first mask is a strong forged force map mask, and the second mask is a patch-based forged force map mask; Among them, the first mask The conversion process specifically includes: Forged Strength Map Setting the threshold , remove pixels whose forgery strength is lower than the threshold and generate a strong forgery strength map , the specific expression is: ; in, is the eigenvector, is the true label of the face image; Will The three channels of are summed and reshaped into ,in is the patch size of the image, is the height of the face image data, is the number of patches; Reshape the strong forgery intensity map along the first dimension Sum the pixel values to obtain the sum of the forgery strength in each patch, and divide the sum of the forgery strength of each patch by the patch area , generate the first mask ;in, The value range of is normalized to ; Among them, the second mask The conversion process specifically includes: Fake force map The three channels of are summed and reshaped into ; Reshape the strong forgery intensity map along the first dimension Sum the pixel values of the patch, calculate the sum of the forgery strength within each patch, and divide the sum of the forgery strength of each patch by the patch area , generate the second mask ,in, The value range of is normalized to .
4. A facial image deepfake detection method according to claim 3, characterized in that: The forged force perception loss of generating the first mask and the second mask during the two-stage training is specifically: The binary cross entropy loss function is used to constrain the forgery strength estimation process and obtain the strong forgery strength estimation loss in the first stage. and the second phase of comprehensive counterfeiting efforts to estimate losses , the specific expression is: ; ; in, represents the binary cross entropy loss function; Estimating losses through strong counterfeiting efforts in the first stage and the second phase of comprehensive counterfeiting efforts to estimate losses Obtain the final fake strength-aware loss , the specific expression is: 。 5. A facial image deepfake detection method according to claim 4, characterized in that: The forged classification branch is used to classify the category labels, and the classification results are constrained using a binary cross entropy loss function to obtain a forged classification loss for distinguishing real face images from forged face images, specifically: Mark the category Input the binary classifier of the forged classification branch, use the binary cross entropy loss function to constrain the classification results, and obtain the specific expression of the forged classification loss: ; in, is the forgery probability predicted by the forgery detection model, Represents the true label of the face image, when When , the current face image is a real face image; when When , the current face image is a fake face image, is the loss of the forged classification branch, represents the binary cross entropy loss function, The specific expression is: ; in, For the i The feature vector of the samples, For the i The probability of sample prediction; Distinguish real face images from forged face images through forged classification loss.
6. A facial image deepfake detection method according to claim 5, characterized in that: After the forged force map is generated, the method further includes: Using shape transformation, force transformation and frequency transformation to forge force map Perform augmentation transformation to generate a forged force map after augmentation transformation , the forged force map after augmentation transformation and real face images Combine to generate new fake face images , the generating formula is: = - ; Through new fake face images As training data for forgery detection models.
7. A facial image deep fake detection system, characterized by: include: An acquisition module, configured to acquire historical facial images including real facial images and corresponding forged facial images; A model building and detection module is used to build a forgery detection model, including a forgery intensity estimation branch and a forgery classification branch, and train the forgery detection model using historical facial images, and perform forgery detection on the facial images to be detected using the trained forgery detection model; The training of the forgery detection model includes: The forgery strength module is used to extract features of historical face images through the forgery strength estimation branch, obtain category labels and patch labels, and reshape the patch labels into intermediate features. A strong forgery estimation strength map and a complete forgery estimation strength map of the intermediate features are obtained through a two-stage training mechanism. The complete representation contains strong and weak forgery clues. a perceptual loss acquisition module, configured to acquire a first mask of a strong forged estimated force map and a second mask of a complete forged estimated force map, and generate a forged force perceptual loss for the first mask and the second mask during two-stage training; a classification loss acquisition module, configured to classify the category labels using a forged classification branch and constrain the classification results using a binary cross entropy loss function to obtain a forged classification loss for distinguishing between real face images and forged face images; a model updating module, configured to integrate the forgery intensity perception loss and the forgery classification loss, and update the forgery detection model parameters using the integrated losses to obtain a trained forgery detection model; The patch mark is reshaped into an intermediate feature, and a strong forged estimated force map and a complete forged estimated force map of the intermediate feature are obtained through a two-stage training mechanism, including: Mark the patch Reshape into feature map , and the feature map Through linear transformation Projected into the forged force space, the intermediate features of the first stage are obtained ,in is the dimension of the feature, Indicates the number of patches into which the historical face image is divided; the specific expression is: ; The intermediate features Through linear transformation Convert to estimated strong forgery estimation strength map , the specific expression is: ; Fusion of intermediate features from the first stage and feature maps , and through the linear transformation Generate a complete forgery estimation strength map containing strong and weak forgery cues , the specific expression is: 。 8. A computer device, characterized in that: The method comprises a memory and a processor, wherein a program is stored in the memory, and when the program is executed by the processor, the processor performs the steps of a method for detecting deep fakes of facial images as described in any one of claims 1 to 6.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a facial image deep fake detection method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Face forgery detection method based on feature decoupling
CN116416686A
Deep forgery detection method and system based on graph convolution and multi-scale prompt fusion
CN118941936A