Face forgery detection method and system based on mask and frequency diffusion reconstruction

By employing mask-guided diffusion reconstruction and frequency-enhanced diffusion reconstruction techniques, the problem of existing detection methods specializing in a single type is solved, the detection accuracy for images generated by different generative models is improved, and a more robust cross-domain detection effect is achieved.

CN120853272AActive Publication Date: 2025-10-28QINGHAI UNIV FOR NATITIES

Patent Information

Application Number
CN202510978280.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-10-28
Estimated Expiration
2045-07-16

AI Technical Summary

Technical Problem

Existing deepfake detection methods are specialized for a single type and are difficult to generalize, resulting in a significant decrease in detection effectiveness when facing unknown forgery types, and are unable to effectively deal with the threat of deepfake technology with multiple variations.

Method used

Mask-guided diffusion reconstruction and frequency-enhanced diffusion reconstruction techniques are used to mask and decompose the input face image. The detector is trained by contrastive learning to learn spatial reconstruction error and frequency domain texture fidelity features, thereby improving the detector's cross-type generalization ability.

Benefits of technology

It significantly enhances the detector's ability to capture forgery traces, improves the detection accuracy of images generated by different generative models, and achieves more robust cross-domain detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120853272A_ABST
    Figure CN120853272A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of image processing, and particularly discloses a face forgery detection method and system based on mask and frequency diffusion reconstruction, and the method comprises the steps: applying spatial masking to a central region of an input face image, reconstructing the masking region through a diffusion model of a mask condition, and generating a mask reconstruction image; carrying out discrete cosine transform on an input face image, decomposing the input face image into a low-frequency component and a high-frequency component, and reconstructing the low-frequency component and the high-frequency component into a frequency domain enhanced image through inverse DCT; inputting the mask reconstruction image and the frequency domain enhancement image into a detector, and learning a spatial reconstruction error and a frequency domain texture fidelity feature through a contrast learning training detector; and inputting a to-be-detected image into the trained detector to carry out face counterfeiting detection, and outputting to obtain a detection result. The method solves the problem that the existing deep forgery detection method faces severe challenges in practical application due to the limitation that the existing deep forgery detection method is special, precise and single in type but is difficult to generalize.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing technology, specifically relating to a face forgery detection method and system based on mask and frequency diffusion reconstruction. Background Technology

[0002] Deepfake technology, relying on advanced artificial intelligence (AI) to generate highly realistic synthetic media, poses multi-dimensional risks to society. Addressing these risks is crucial for maintaining the security of the digital ecosystem in the AI ​​era. In the field of generative models, Generative Adversarial Networks (GANs), through an adversarial training mechanism between a generator and a discriminator, can synthesize highly realistic images, providing important technical support for high-quality image generation. Meanwhile, Denoising Diffusion Probabilistic Models (DDPM), through an iterative process of progressive noise addition and reverse denoising, have established a new technological paradigm for image generation, further improving the quality and diversity of generated data. However, these advanced generative technologies also face the risk of misuse—some attackers are leveraging the powerful generative capabilities of GANs and diffusion models to develop more difficult-to-detect deepfake techniques. This not only exacerbates the difficulty of verifying the authenticity of digital content but also poses a serious challenge to information security and the social trust system.

[0003] Current mainstream detectors perform well against specific types of forgery. However, due to the existence of various variants of deepfake technology (such as GAN generation, diffusion model synthesis, and face-swapping techniques), the performance of detectors often drops significantly when faced with unknown forgery types. For example, detection models specifically designed for GAN-generated face images show a significant decrease in detection effectiveness when dealing with images generated by diffusion models; similarly, face-swapping detection models struggle to effectively identify forgeries generated by face synthesis techniques. This limitation of "specializing in a single type but struggling to generalize" poses a serious challenge to existing detection methods in practical applications. Therefore, there is an urgent need to research and develop general-purpose deepfake detectors with cross-type generalization capabilities to address the ever-evolving threat of forgery technologies. Summary of the Invention

[0004] The purpose of this invention is to address the limitation of existing deepfake detection methods, which are specialized in a single type but difficult to generalize, leading to severe challenges in practical applications. This invention proposes a deepfake detection method and system that resists interference from depth image watermarks.

[0005] The technical solution of the present invention is as follows: Firstly, a face forgery detection method based on mask and frequency diffusion reconstruction, comprising the following steps:

[0006] Mask-guided diffusion reconstruction: Spatial masking is applied to the central region of the input face image, and the masked region is reconstructed using a diffusion model with mask conditions to generate a mask-reconstructed image;

[0007] Frequency-enhanced diffusion reconstruction: The input face image is subjected to discrete cosine transform to decompose it into low-frequency and high-frequency components. Adaptive upsampling and downsampling are performed on the low-frequency and high-frequency components respectively, and then reconstructed into a frequency-domain enhanced image through inverse DCT.

[0008] The mask-reconstructed image and the frequency-domain enhanced image are input into the detector, and the detector is trained to learn spatial reconstruction error and frequency-domain texture fidelity features through contrastive learning.

[0009] The image to be detected is input into the trained detector to perform face forgery detection, and the detection result is output.

[0010] Preferably, the mask-guided diffusion reconstruction is accelerated by deterministic sampling using a denoising diffusion implicit model, specifically as follows:

[0011] The masking region of the masked image is generated using prediction-guided generation:

[0012]

[0013] in, This represents the denoised sample predicted at time step t-1 under known conditions, where t represents the time step index of the diffusion / denoising process, and f θ (x t ,t) represents the expression used to predict x t The corresponding clean data is a neural network with parameters θ and x. t This represents the noisy sample at the current time step t. This represents the cumulative noise product of the previous time step. This represents the noise attenuation coefficient at time step t;

[0014] Directly update the known regions of the masked image:

[0015]

[0016] in, x0 represents the denoising result of the mask region predicted at time step t-1. pred Represents the raw, clean data used in neural network predictions, ∈ new This represents the random noise from the newly sampled data;

[0017] Mask blending is performed to obtain the masked reconstructed image:

[0018]

[0019] Where, x t-1 denoted as the image reconstructed from the mask, m represents the binary mask matrix, and ⊙ represents element-wise multiplication.

[0020] As a preferred approach, frequency enhancement diffusion reconstruction incorporates discrete cosine transform domain processing into the traditional UNet architecture through the DCT-UNet module.

[0021] Preferably, the frequency enhancement diffusion reconstruction specifically includes the following steps:

[0022] The frequency domain representation F(u,v) of the input face image is obtained by two-dimensional DCT;

[0023] The input face image is decomposed into low-frequency and high-frequency components using a zigzag scanning pattern.

[0024] Based on the frequency domain representation F(u,v) of the input face image, the low-frequency components are upsampled and the high-frequency components are downsampled.

[0025] The frequency domain enhanced image is obtained by reconstructing the upsampled low-frequency components and the downsampled high-frequency components into the spatial domain through inverse DCT.

[0026] Preferably, the formula for calculating the frequency domain representation F(u,v) of the input face image is:

[0027]

[0028] Where M and N represent global scaling factors, C(u) and C(v) represent normalization functions, f(x,y) represents the pixel value with coordinates (x,y) in the spatial domain, and u and v represent frequency domain coordinates.

[0029] Preferably, upsampling the low-frequency component involves retaining the first k = |rHW| low-frequency coefficients and using zero-filling upsampling to obtain the upsampled low-frequency component F. low (u,v):

[0030]

[0031] Where r represents the retention ratio, Ω low H represents the low-frequency region that needs to be retained, H represents the height of the input face image, and W represents the width of the input face image.

[0032] Preferably, bilinear interpolation spatial downsampling is used to obtain the downsampled high-frequency component F. high :

[0033] F high =Interp(Crop(F(u,v)⊙(1-M low)), (H′, W′))

[0034] Where Interp represents interpolation, Crop represents cropping, ⊙ represents element-wise multiplication, and M represents... low H' represents the low-frequency mask matrix, H′ represents the height of the target size, and W′ represents the width of the target size.

[0035] Preferably, when training the detector through comparative learning, the loss function used is the two-component structure loss function, the specific formula of which is:

[0036] L bcl =λL + +(1-λ)L -

[0037] Among them, L bcl L represents the loss function for a two-component structure. + L represents the positive sample aggregation loss. - Let λ represent the negative sample separation loss, and λ∈(0,1) represent the weights used to balance positive and negative samples;

[0038]

[0039] Where m represents the boundary parameter, z represents the feature vector of the anchor sample generated by the encoder network. + This represents the feature vector of a positive sample generated by the encoder network;

[0040]

[0041] Among them, z _ This represents the feature vector of the negative sample generated by the encoder network.

[0042] The beneficial effects of this invention are:

[0043] In the data preprocessing stage, this invention employs a center masking technique to reconstruct the original image. The detector learns the pixel-level errors between the reconstructed image and the original image in the masked region, significantly enhancing its sensitivity to reconstruction errors and guiding the model to focus more on detecting local reconstruction errors. At the frequency domain, frequency enhancement diffusion technology explicitly optimizes the residual reconstruction of low-frequency and high-frequency subbands, effectively improving the recovery capability of the global structure and the fidelity of high-frequency details, thereby enhancing the model's ability to detect forgery traces. During the training stage, a contrastive learning strategy is introduced, using the real image after masking diffusion and frequency reconstruction as positive samples. This design enables the detector to simultaneously perceive spatial reconstruction error features and frequency domain texture fidelity, thus significantly improving its ability to detect detailed forgery traces.

[0044] Secondly, a face forgery detection system based on mask and frequency diffusion reconstruction includes:

[0045] The mask-guided diffusion reconstruction module is used to apply spatial masking to the central region of the input face image, and reconstruct the masked region through a diffusion model with mask conditions to generate a mask-reconstructed image.

[0046] The frequency enhancement diffusion reconstruction module is used to perform discrete cosine transform on the input face image, decompose it into low-frequency components and high-frequency components, perform adaptive upsampling and downsampling on the low-frequency components and high-frequency components respectively, and reconstruct it into a frequency domain enhanced image through inverse DCT.

[0047] The contrastive training module is used to input the mask-reconstructed image and the frequency domain enhanced image into the detector, and train the detector to learn spatial reconstruction error and frequency domain texture fidelity features through contrastive learning;

[0048] The detection module is used to input the image to be detected into the trained detector for face forgery detection and output the detection results.

[0049] Thirdly, a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method as described in the first aspect. Attached Figure Description

[0050] Figure 1 The diagram shows a flowchart of a face forgery detection method based on mask and frequency diffusion reconstruction provided in Embodiment 1 of the present invention. Detailed Implementation

[0051] Exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be understood that the embodiments shown and described in the drawings are merely exemplary and are intended to illustrate the principles and spirit of the invention, and are not intended to limit the scope of the invention.

[0052] The Denoising Diffusion Implicit Model (DDIM) significantly accelerates the sampling process while maintaining generation quality. DDIM's core innovation lies in redesigning the diffusion process as a non-Markov chain and introducing a deterministic sampling strategy, thereby achieving high-quality generation in fewer steps. DDIM's diffusion process reconstruction retains the forward diffusion kernel of DDPM but redefines the diffusion process as a non-Markov chain. The inverse process no longer relies on Markov assumptions but is directly modeled from x using an implicit probabilistic model. t To x t-1 The mapping. Specifically, the inverse generation distribution of DDIM is defined as:

[0053]

[0054] Where, p θ Let N represent the conditional probability distribution under the model with parameter , where N represents a Gaussian distribution. σ represents the cumulative noise product of the previous time step. t σ represents the user-defined variance parameter. 2 I represents the diagonal covariance matrix;

[0055] f θ (x t Predict the original data x0, σ (t) t Controlling randomness. When σ t When = 0, the reverse process becomes a deterministic mapping, thus significantly accelerating sampling.

[0056] The key advantage of the deterministic sampling and acceleration mechanism DDIM lies in its deterministic sampling strategy. This is achieved by setting σ... t =0, the reverse process simplifies to:

[0057]

[0058] Where, ∈ θ (x t (t) represents the prediction noise. This simplified formula makes skip sampling possible (e.g., directly from t to tk), reducing the sampling steps from T1000 in DDPM to 50–100, with almost no loss in generation quality.

[0059] Example 1:

[0060] like Figure 1 As shown, a face forgery detection method based on mask and frequency diffusion reconstruction includes the following steps:

[0061] S1. Perform mask-guided diffusion reconstruction: Reconstruct the masked image using a diffusion model with mask conditions to generate a mask-reconstructed image;

[0062] S2. Perform frequency-enhanced diffusion reconstruction: Perform discrete cosine transform (DCT) on the input face image to decompose it into low-frequency components and high-frequency components. Perform adaptive upsampling and downsampling processing on the low-frequency components and high-frequency components respectively, and reconstruct it into a frequency-domain enhanced image through inverse DCT.

[0063] S3. Input the mask-reconstructed image and the frequency domain enhanced image into the detector, and train the detector to learn spatial reconstruction error and frequency domain texture fidelity features through contrastive learning;

[0064] S4. Input the image to be detected into the trained detector to perform face forgery detection, and output the detection result.

[0065] In this embodiment, the mask-guided diffusion reconstruction is accelerated by deterministic sampling using a denoising diffusion implicit model, specifically as follows:

[0066] Let x0∈R H×W×C Represents the original image, m∈0,1 H×W Let m be a binary mask matrix, where the masked region corresponds to m. i,j =0, the known region corresponds to m i,j =1. During the diffusion process, the masked noise image is represented as...

[0067] Based on the standard DDIM framework, the inverse process is redesigned as a region-adaptive operation. For the transition from step t to step t-1, the masking region of the masked image is generated using prediction-guided generation:

[0068]

[0069] in, This represents the denoised sample predicted at time step t-1 under known conditions, where t represents the time step index of the diffusion / denoising process, and f θ (x t ,t) represents the expression used to predict x t The corresponding clean data is a neural network with parameters θ and x. t This represents the noisy sample at the current time step t. This represents the cumulative noise product of the previous time step. Represents the noise attenuation coefficient at time step t (usually) where β t (Preset values ​​for the noise schedule);

[0070] Directly update the known regions of the masked image:

[0071]

[0072] in, x0 represents the denoising result of the mask region predicted at time step t-1. pred Represents the raw, clean data used in neural network predictions, ∈ new This represents the random noise from the newly sampled data;

[0073] Mask blending is performed to obtain the masked reconstructed image:

[0074]

[0075] Where, x t-1 denoted as the image reconstructed from the mask, m represents the binary mask matrix, and ⊙ represents element-wise multiplication.

[0076] In this embodiment, frequency enhancement diffusion reconstruction is implemented by integrating discrete cosine transform domain processing into the traditional UNet architecture through the DCT-UNet module.

[0077] In this embodiment, the frequency enhancement diffusion reconstruction specifically includes the following steps:

[0078] The input face image x∈R is obtained through two-dimensional DCT. H×W The frequency domain representation is the original frequency domain coefficient matrix F(u,v):

[0079]

[0080] Where M and N represent global scaling factors, C(u) and C(v) represent normalization functions, f(x,y) represents the pixel value with coordinates (x,y) in the spatial domain, and u and v represent frequency domain coordinates;

[0081] The input face image is decomposed into low-frequency and high-frequency components using a zigzag scanning pattern.

[0082] Upsampling of low-frequency components is performed based on the frequency domain representation F(u,v) of the input face image. Specifically, the first k = |rHW| low-frequency coefficients are retained, and zero-padding upsampling is used to obtain the upsampled low-frequency component F. low (u,v):

[0083]

[0084] Where r represents the retention ratio, Ω low H represents the low-frequency region that needs to be retained, H represents the height of the input face image, and W represents the width of the input face image.

[0085] Bilinear interpolation spatial downsampling is performed on the high-frequency components to obtain the downsampled high-frequency components F. high :

[0086] F high =Interp(Crop(F(u,v)⊙(1-M low )), (H′, W′))

[0087] Where Interp represents interpolation, Crop represents cropping, ⊙ represents element-wise multiplication, and M represents... low H′ represents the low-frequency mask matrix (with the same size as F(u,v), where the low-frequency region is 1 and the rest is 0), H′ represents the height of the target size, and W′ represents the width of the target size.

[0088] The frequency-domain enhanced image is obtained by reconstructing the upsampled low-frequency components and the downsampled high-frequency components into the spatial domain using inverse discrete cosine transform (IDCT).

[0089]

[0090] In this embodiment, sample pairs are defined within a binary contrastive learning framework. First, the sample pair construction criterion is defined: given sample x... a Positive sample x + From the same class, negative sample x - From different classes. The encoder network generates L2-normalized feature embeddings z. a , z + , z - ∈R d To establish a clear classification boundary, a boundary parameter m > 0 is introduced to constrain the similarity of positive and negative sample pairs. When training the detector through contrastive learning, the loss function used is the two-component structure loss function, the specific formula of which is:

[0091] L bcl =λL + +(1-λ)L -

[0092] Among them, L bcl L represents the loss function for a two-component structure. + L represents the positive sample aggregation loss. - Let λ represent the negative sample separation loss, and λ∈(0,1) represent the weights used to balance positive and negative samples;

[0093]

[0094] Where m represents the boundary parameter, The feature vector (after L2 normalization) representing the anchor sample, z + The feature vector representing a positive sample (samples of the same type);

[0095]

[0096] Among them, z _ The feature vector representing the negative sample (outlier sample).

[0097] Example 2:

[0098] Based on Example 1, this embodiment of the invention uses accuracy (ACC) as the performance evaluation index for detection. The ACC calculation threshold is 0.5. The method proposed in this invention is compared with the baseline model to verify the performance of the method proposed in this invention.

[0099] This invention is based on the DiffusionFace dataset. To obtain ADM reconstructed images, the DDIM method is used (default diffusion steps stop = 1000). Four classifiers were selected for performance comparison: EfficientNet b3, ResNet-50, F3Net, and Convnext. The dataset includes images generated by seven diffusion models: ADM, LDM, DDPM, DDIM, PNDM, SDv, and SDv2. All experimental images were uniformly 256×256 pixels, with EfficientNet-b3, ResNet-50, and Convnext using an input size of 224×224, and F3Net using an input size of 299×299. The training set was generated by the four diffusion methods: ADM, LDM, SDv1, and SDv2.

[0100] The baseline models compared include EfficientNet-b3 (a lightweight and efficient convolutional neural network that optimizes model depth, width, and resolution through compound scaling), ResNet-50 (a classic residual network that uses skip connections to alleviate gradient vanishing in deep architectures and is widely used for image classification), F3Net (a forgery detection model based on frequency domain analysis that enhances sensitivity to tampering artifacts through frequency-aware decomposition), ConvNext (a CNN architecture inspired by the visual Transformer that integrates modern training techniques to improve the performance of traditional convolutional networks), and DRCT (a reconstruction contrastive training framework for general detection of diffusion-generated images).

[0101] Four independent experiments were conducted by training the detector on four different diffusion models (ADM, LDM, SDv1, and SDv2). When the training and test data came from the same type of diffusion model, the proposed method consistently improved detection accuracy in all experimental groups. Experimental results show that when trained using ADM (Adversarial Diffusion Model), the detector exhibits high accuracy in recognizing images generated by DDPM, DDIM, and PNDM, but its performance significantly degrades when detecting images synthesized by LDM (Latent Diffusion Model), SDv1 (Stable Diffusion v1), and SDv2 (Stable Diffusion v2). This phenomenon can be attributed to the following factors:

[0102] Differences in Generation Mechanisms: DDPM, DDIM, and PNDM are all based on pixel spatial diffusion, and their data distribution is similar to that of ADM training data, resulting in good detection performance. However, LDM and SDv1 / SDv2 use latent spatial diffusion, and their generation process includes additional compression and reconstruction steps, leading to significant differences in image artifact patterns compared to ADM training data. Impact of Model Architecture: LDM and the StableDiffusion series models use VAE (Variational Autoencoder) for latent space mapping, which may introduce noise features not seen in ADM training, thus reducing the detector's generalization ability. When trained using LDM, the detection model generally performs poorly in recognizing images generated by ADM, DDPM, DDIM, PNDM, and SDv1 / SDv2, maintaining a low detection accuracy. Although SDv1 / SDv2 is also based on latent space diffusion, its VAE encoder and diffusion strategy differ from LDM, making it difficult for detectors trained with LDM to generalize effectively. When trained using Stable Diffusion v1 (SDv1), the detection model only exhibits good detection performance on images generated by Stable Diffusion v2 (SDv2), while its detection performance on images generated by DDPM, DDIM, PNDM, ADM, and LDM is poor. Similarly, the detector trained on SDv2 also shows good recognition ability only on images generated by SDv1. This is because SDv1 and SDv2 share similar latent diffusion architectures and VAE encoders, with differences only in model size, training data, or fine-tuning strategies, resulting in good compatibility across versions. In terms of generalization performance, the proposed method achieves an overall improvement in detection performance. By introducing multimodal feature fusion and domain adaptation mechanisms, the detector of this invention exhibits more robust cross-domain detection capabilities across images generated by different diffusion models. This advantage is particularly important in open-environment detection tasks that require handling multiple generative models.

[0103] Example 3:

[0104] Based on Embodiment 1, this embodiment of the invention provides a face forgery detection system based on mask and frequency diffusion reconstruction, used to implement the face forgery detection method based on mask and frequency diffusion reconstruction as described in Embodiment 1. The system includes:

[0105] The mask-guided diffusion reconstruction module is used to apply spatial masking to the central region of the input face image, and reconstruct the masked region through a diffusion model with mask conditions to generate a mask-reconstructed image.

[0106] The frequency enhancement diffusion reconstruction module is used to perform discrete cosine transform on the input face image, decompose it into low-frequency components and high-frequency components, perform adaptive upsampling and downsampling on the low-frequency components and high-frequency components respectively, and reconstruct it into a frequency domain enhanced image through inverse DCT.

[0107] The contrastive training module is used to input the mask-reconstructed image and the frequency domain enhanced image into the detector, and train the detector to learn spatial reconstruction error and frequency domain texture fidelity features through contrastive learning;

[0108] The detection module is used to input the image to be detected into the trained detector for face forgery detection and output the detection results.

[0109] According to embodiments of the present invention, the present invention also provides an electronic device, a readable storage medium, and a computer program product.

[0110] In an exemplary embodiment, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method as described in Embodiment 1 above.

[0111] In an exemplary embodiment, the readable storage medium may be a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method described in the above embodiments.

[0112] In an exemplary embodiment, the computer program product includes a computer program that, when executed by a processor, implements the method described in Embodiment 1 above.

[0113] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0114] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0116] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0117] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0118] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of this invention.

Claims

1. A face forgery detection method based on mask and frequency diffusion reconstruction, characterized in that, Includes the following steps: Mask-guided diffusion reconstruction: Spatial masking is applied to the central region of the input face image, and the masked region is reconstructed using a diffusion model with mask conditions to generate a mask-reconstructed image; Frequency-enhanced diffusion reconstruction: The input face image is subjected to discrete cosine transform to decompose it into low-frequency and high-frequency components. Adaptive upsampling and downsampling are performed on the low-frequency and high-frequency components respectively, and then reconstructed into a frequency-domain enhanced image through inverse DCT. The mask-reconstructed image and the frequency-domain enhanced image are input into the detector, and the detector is trained to learn spatial reconstruction error and frequency-domain texture fidelity features through contrastive learning. The image to be detected is input into the trained detector to perform face forgery detection, and the detection result is output.

2. The face forgery detection method based on mask and frequency diffusion reconstruction according to claim 1, characterized in that, The mask-guided diffusion reconstruction is accelerated by deterministic sampling using a denoising diffusion implicit model, specifically as follows: The masking region of the masked image is generated using prediction-guided generation: in, This represents the denoised sample predicted at time step t-1 under known conditions, where t represents the time step index of the diffusion / denoising process, and f θ (x t ,t) represents the expression used to predict x t The corresponding clean data is a neural network with parameters θ and x. t This represents the noisy sample at the current time step t. This represents the cumulative noise product of the previous time step. This represents the noise attenuation coefficient at time step t; Directly update the known regions of the masked image: in, x0 represents the denoising result of the mask region predicted at time step t-1. pred Represents the raw, clean data used in neural network predictions, ∈ new This represents the random noise from the newly sampled data; Mask blending is performed to obtain the masked reconstructed image: Where, x t-1 denoted as the image reconstructed from the mask, m represents the binary mask matrix, and ⊙ represents element-wise multiplication.

3. The face forgery detection method based on mask and frequency diffusion reconstruction according to claim 1, characterized in that, Frequency enhancement diffusion reconstruction is achieved by integrating discrete cosine transform domain processing into the traditional UNet architecture through the DCT-UNet module.

4. The face forgery detection method based on mask and frequency diffusion reconstruction according to claim 1, characterized in that, The frequency enhancement diffusion reconstruction specifically includes the following steps: The frequency domain representation F(u,v) of the input face image is obtained by two-dimensional DCT; The input face image is decomposed into low-frequency and high-frequency components using a zigzag scanning pattern. Based on the frequency domain representation F(u,v) of the input face image, the low-frequency components are upsampled and the high-frequency components are downsampled. The frequency domain enhanced image is obtained by reconstructing the upsampled low-frequency components and the downsampled high-frequency components into the spatial domain through inverse DCT.

5. The face forgery detection method based on mask and frequency diffusion reconstruction according to claim 4, characterized in that, The formula for calculating the frequency domain representation F(u,v) of the input face image is: Where M and N represent global scaling factors, C(u) and C(v) represent normalization functions, f(x,y) represents the pixel value with coordinates (x,y) in the spatial domain, and u and v represent frequency domain coordinates.

6. The face forgery detection method based on mask and frequency diffusion reconstruction according to claim 4, characterized in that, Upsampling of the low-frequency component specifically involves: retaining the first k = |rHW| low-frequency coefficients, and using zero-padding upsampling to obtain the upsampled low-frequency component F. low (u,v): Where r represents the retention ratio, Ω low H represents the low-frequency region that needs to be retained, H represents the height of the input face image, and W represents the width of the input face image.

7. The face forgery detection method based on mask and frequency diffusion reconstruction according to claim 4, characterized in that, The high-frequency components are spatially downsampled using bilinear interpolation to obtain the downsampled high-frequency component F. high : F high =Interp(Crop(F(u,v)⊙(1-M low )),(H′,W′)) Where Interp represents interpolation, Crop represents cropping, ⊙ represents element-wise multiplication, and M represents... low H' represents the low-frequency mask matrix, H′ represents the height of the target size, and W′ represents the width of the target size.

8. The face forgery detection method based on mask and frequency diffusion reconstruction according to claim 1, characterized in that, When training the detector through comparative learning, the loss function used is the two-component structure loss function, the specific formula of which is: THE bcl =λL + +(1-λ)L - Among them, L bcl L represents the loss function for a two-component structure. + L represents the positive sample aggregation loss. - Let λ represent the negative sample separation loss, and λ∈(0,1) represent the weights used to balance positive and negative samples; Where m represents the boundary parameter, z represents the feature vector of the anchor sample generated by the encoder network. + This represents the feature vector of a positive sample generated by the encoder network; Among them, z _ This represents the feature vector of the negative sample generated by the encoder network.

9. A face forgery detection system based on mask and frequency diffusion reconstruction, characterized in that, include: The mask-guided diffusion reconstruction module is used to apply spatial masking to the central region of the input face image, and reconstruct the masked region through a diffusion model with mask conditions to generate a mask-reconstructed image. The frequency enhancement diffusion reconstruction module is used to perform discrete cosine transform on the input face image, decompose it into low-frequency components and high-frequency components, perform adaptive upsampling and downsampling on the low-frequency components and high-frequency components respectively, and reconstruct it into a frequency domain enhanced image through inverse DCT. The contrastive training module is used to input the mask-reconstructed image and the frequency domain enhanced image into the detector, and train the detector to learn spatial reconstruction error and frequency domain texture fidelity features through contrastive learning; The detection module is used to input the image to be detected into the trained detector for face forgery detection and output the detection results.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Down-sampling method and up-sampling method of video frames, and transmission processing method

    CN105263027A

  • Fine-grained forged image detection method and model training method thereof

    CN116645562A

  • Unsupervised pavement crack detection method and system based on de-noising diffusion model

    CN119784764A

  • KR20240103346A

Cited By

  • Face deep counterfeiting evidence obtaining method, system and device and storage medium

    CN122090520A