A deep fake image detection method based on semantic disentanglement
Through the dual-stage training model architecture and the multi-scale high-frequency feature fusion module, the irrelevant content and forgery semantics in the entangled images are solved, the problem of entangled states in the existing technology is solved, and the robustness and generalization of deep forgery image detection are improved. capabilities, enabling more effective forgery semantic detection.
Patent Information
- Application Number
- CN202410757677.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-13
AI Technical Summary
Existing deep forgery image detection methods are entangled when dealing with irrelevant content semantics, unique forgery semantics, and common forgery semantics in images, resulting in limited generalization capabilities, overfitting to the color texture of specific forgery methods, and ignoring the video domain. Correlation of features with traditional color textures.
A two-stage training model architecture is adopted. In the first stage, the high-frequency features of the image are extracted through the adaptive high-pass filter, SwiftFormer branch and Xception branch. Combined with the multi-scale high-frequency feature fusion module, the irrelevant content semantics and forgery semantics of the entangled image are disentangled; The second stage further disentangles the special and common forgery semantics, and uses convolution blocks and loss functions to enhance the independence and detection capabilities of the semantics.
It improves the robustness and generalization ability of deep fake image detection, improves the independence and detection effect of fake semantics, and can more effectively distinguish between real and fake images, especially the performance across data sets is significantly improved.
Smart Images

Figure CN118334473B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection technology, and specifically to a deep fake image detection method based on semantic disentanglement. Background Art
[0002] In recent years, the emergence of deepfake technology has brought significant challenges to the authenticity and credibility of visual content. These complex algorithms can generate synthetic face images and videos with remarkable realism, making it increasingly difficult to distinguish between real and fake media. When synthesizing faces, these complex algorithms not only leave fake semantics unique to the method in the synthesized face, but also leave fake semantics common between different fake methods. Although various deepfake detection methods have been developed, their performance in real scenarios is often unsatisfactory. First, due to the entanglement of irrelevant content semantics, unique fake semantics, and common fake semantics in the image, existing detection methods are often disturbed by irrelevant content semantics or overfit to unique fake semantics, resulting in limited generalization ability. They often perform well only when detecting on datasets similar to the training dataset, but suffer from severe performance degradation when detecting on datasets different from the training dataset. Second, most existing methods rely only on semantics extracted from the image as input, which may also cause the detector to overly rely on color textures specific to certain fake methods. In addition, although some methods try to utilize frequency domain features, they usually ignore the correlation between frequency domain features and traditional color textures. Summary of the invention
[0003] The purpose of the present invention is to provide a deep fake image detection method based on semantic disentanglement to solve the problem that the existing irrelevant content semantics, special fake semantics, and common fake semantics are entangled and difficult to detect.
[0004] To achieve the above object, the present invention provides the following technical solution: a deep fake image detection method based on semantic disentanglement, the deep fake image detection method comprising the following steps:
[0005] S1. Design the model architecture for the first stage of training;
[0006] S2, design the model architecture for the second stage of training;
[0007] The model architecture trained in the first stage includes: an adaptive high-pass filter, a first encoder and a first decoder; the model architecture trained in the second stage includes a second encoder and a second decoder;
[0008] The above step S1 further includes the following steps: S11, designing an adaptive high-pass filter;
[0009] The adaptive high-pass filter is used to extract high-frequency features of an image. The calculation method of the adaptive high-pass filter is as follows:
[0010]
[0011] In the formula, represents the kernel of the adaptive high-pass filter, x and y represent the position of the point inside the kernel, represents the standard deviation, represents a matrix with 1 at the center and 0 at the rest. represents normalization;
[0012] In addition, the center of the adaptive high-pass filter kernel is reset to 1 after initialization and each back-propagation, and the remaining positions are normalized. The calculation method is as follows:
[0013]
[0014] Where (x, y) = (0, 0) represents the center position within the nucleus.
[0015] Preferably, the above step S1 further comprises the following steps: S12, designing a first encoder;
[0016] The first encoder includes a SwiftFormer branch and two Xception branches, the SwiftFormer branch includes four SwiftFormer basic blocks for extracting irrelevant content semantics of the image, the two Xception branches are used to extract RGB information and high-frequency features of the image to form all forged semantics of the image, and the Xception branch includes two convolution blocks and three Xception basic blocks;
[0017] The first encoder also includes a multi-scale high-frequency feature fusion module based on the Pag feature fusion method, and the multi-scale high-frequency feature fusion module is used to dynamically integrate features from two Xception branches.
[0018] Preferably, the above step S1 further comprises the following steps: S13, designing a first decoder;
[0019] The first decoder includes four SwiftFormer basic blocks for processing image-irrelevant content semantics. The first decoder also includes four convolution blocks for processing all the fake semantics of the image. The first decoder incorporates the fake semantics of the processed image multiple times when processing the irrelevant content semantics of the image, and finally reconstructs a reconstructed image.
[0020] Preferably, the above step S1 further includes the following steps: S14, designing a loss function of the first stage;
[0021] The loss function of the first stage includes a classification loss function and a reconstruction loss function. The calculation method of the classification loss function is as follows:
[0022]
[0023] Where: represents the classification loss of all forged semantics, represents the cross entropy loss, represents a detector for detecting all fake semantics, represents all the fake semantics that are untangled, Represents the true and false labels of all the fake semantic corresponding images of the input;
[0024] The reconstruction loss function is calculated as follows:
[0025]
[0026] In the formula, represents the reconstruction loss, for Loss function, represents the original image, Represents the image reconstructed from the corresponding original image;
[0027] The calculation method of the loss function in the first stage is as follows:
[0028]
[0029] In the formula, and is a hyperparameter.
[0030] Preferably, the above step S2 further includes the following steps: S21, designing a second encoder;
[0031] The second encoder uses the branch of all the fake semantics extracted by the first encoder, and the second encoder includes two convolution blocks for further disentangling special fake semantics and common fake semantics based on the extracted all the fake semantics.
[0032] Preferably, the above step S2 further includes the following steps: S22, designing a second decoder;
[0033] The second decoder includes two convolution block branches for processing special forged semantics and common forged semantics respectively. When processing the common forged semantics of an image, the second decoder multiple times incorporates the special forged semantics of the processed image and finally reconstructs the forged semantics of the image.
[0034] Preferably, the above step S2 further includes the following steps: S23, designing a loss function for the second stage;
[0035] The loss functions in the second stage include two classification loss functions, a contrast loss function, and a reconstruction loss function;
[0036] For detecting the special forged semantics of disentanglement, the classification loss function is calculated as follows:
[0037]
[0038] In the formula, Represents the classification loss of special forgery semantics, represents the cross entropy loss, represents a detector for detecting special fake semantics, represents the special forged semantics of disentanglement, The label of the forging method corresponding to the special forging semantics of the input;
[0039] For detecting the common forged semantics of disentanglement, the classification loss function is calculated as follows:
[0040]
[0041] In the formula, Represents the classification loss of the common forgery semantics, represents the cross entropy loss, represents a detector for detecting common fake semantics, represents the common forgery semantics of disentanglement, Indicates the true or false labels of the images corresponding to the common forged semantics of the input;
[0042] The contrast loss function is calculated as follows:
[0043]
[0044] In the formula, represents the contrast loss, For L 2 Loss function, is a hyperparameter, To anchor image semantics, is the semantics of the positive sample image, is the semantics of negative sample images;
[0045] The reconstruction loss function is calculated as follows:
[0046]
[0047] In the formula, represents the reconstruction loss, for Loss function, represents the full forgery semantics of the original graph, Represents the corresponding special forgery semantics and the forgery semantics reconstructed by the common forgery semantics;
[0048] The calculation method of the loss function of the second stage is as follows:
[0049]
[0050] In the formula, , , and is a hyperparameter.
[0051] Preferably, the deep fake image detection method obtains a detection model through the above steps S1 and S2, and the detection model includes a second encoder and a detector for detecting common fake semantics;
[0052] The test image and its high-frequency features are input into the second encoder, the second encoder extracts the common forged semantics, the detector for detecting the common forged semantics detects the common forged semantics obtained by the second encoder, and the detector for detecting the common forged semantics outputs a judgment result.
[0053] Preferably, the deep fake image detection method further comprises the following steps: S3, testing the effects of the multi-scale high frequency feature extraction module and the multi-scale high frequency feature fusion module. S4, analyzing the performance of the deep fake image.
[0054] Compared with the prior art, the present invention has the following beneficial effects: the first-stage training model and the second-stage training model are used to disentangle the common forgery semantics of the image, the special forgery semantics of the image, and the semantics of the image-irrelevant content, so as to improve the robustness and generalization ability of forensics. An adaptive high-pass filter, a multi-scale high-frequency feature extraction module, and a multi-scale high-frequency feature fusion module are designed to make full use of high-frequency information. A two-stage training method is proposed to strengthen the disentanglement of semantics, enhance the independence of the extracted forgery semantics, and improve the effectiveness of semantics in forensics. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0056] Figure 1A technical roadmap for a deep fake image detection method based on semantic disentanglement;
[0057] Figure 2 This is the overall block diagram of the model architecture for the first stage of training;
[0058] Figure 3 is a schematic diagram of a first encoder;
[0059] Figure 4 is a diagram of the architecture of a first decoder;
[0060] Figure 5 The overall block diagram of the model architecture for the second stage of training;
[0061] Figure 6 is a schematic diagram of the second encoder;
[0062] Figure 7 is a diagram of the architecture of a second decoder;
[0063] Figure 8 This is the overall block diagram of the detection model. DETAILED DESCRIPTION
[0064] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0065] In this article, the terms "upper, lower, inside, outside" and the like are established based on the positional relationships shown in the drawings. The corresponding positional relationships may also change depending on the drawings, and therefore cannot be understood as absolute limitations on the scope of protection; moreover, relational terms such as "first" and "second" and the like are merely used to distinguish one component from another with the same name, and do not necessarily require or imply any actual relationship or order between these components.
[0066] Example
[0067] like Figure 1 As shown, this embodiment provides a deep fake image detection method based on semantic disentanglement, and the deep fake image detection method includes the following steps: S1. Design a model architecture for the first stage training. S2. Design a model architecture for the second stage training. S3. Verify the effects of the multi-scale high-frequency feature extraction module and the multi-scale high-frequency feature fusion module. S4. Analyze the performance of the method for detecting deep fake images.
[0068] Specifically, the images include real images, fake images, and test images. The first-stage training model and the second-stage training model are used to disentangle the common forgery semantics of the image, the special forgery semantics of the image, and the semantics of the image-irrelevant content, so as to improve the robustness and generalization ability of forensics. In order to make full use of high-frequency information, an adaptive high-pass filter module is designed. In order to strengthen the disentanglement of semantics and enhance the independence of the extracted forgery semantics, a two-stage training method is proposed to improve the effectiveness of semantics in forensics.
[0069] Furthermore, the model architecture of the first stage training includes the following related functional modules: (1) adaptive high-pass filter (2) first encoder (3) first decoder;
[0070] The model architecture trained in the first stage is as follows Figure 2 As shown in the figure, it mainly includes 3 modules. The design of each module is described in detail below.
[0071] S11. Design an adaptive high-pass filter;
[0072] Traditional high-pass filters cannot be adaptively updated to adapt to data during training. The design is inspired by the Gaussian filter, and the initial value of the convolution kernel is obtained through the Gaussian function. Since the Gaussian filter is a low-pass filter and produces low-frequency information, we create our high-pass filter kernel by subtracting the Gaussian kernel from a matrix with a center position of 1 and the rest of the positions of 0, and set its parameters to be trainable, thus getting rid of the limitation of fixed parameters in traditional high-pass filtering. The calculation method is as follows:
[0073]
[0074] In the formula, represents the kernel of the adaptive high-pass filter, x and y represent the position of the point inside the kernel, represents the standard deviation, represents a matrix with 1 at the center and 0 at the rest. Indicates normalization.
[0075] In addition, in order to keep the high-pass filter always having the characteristics of high-pass filtering during the training process, we reset the center of the high-pass filter kernel to 1 during initialization and after each backpropagation, and normalize the remaining positions:
[0076]
[0077] Where (x, y) = (0, 0) represents the center position within the nucleus.
[0078] S12, designing a first encoder;
[0079] In the first encoder, taking into full consideration the fact that the irrelevant content of the image is mainly low-frequency information and the forged features of the image are mainly high-frequency information, a SwiftFormer branch is used to extract the irrelevant content of the image, and two Xception branches are used to extract RGB information and high-frequency features. The designed adaptive high-pass filter is used to extract high-frequency features. The SwiftFormer branch includes four SwiftFormer basic blocks for extracting the semantics of irrelevant content of the image, and the Xception branch includes two convolution blocks and three Xception basic blocks. In addition, in order to make full use of high-frequency features, a multi-scale high-frequency feature extraction module based on an adaptive high-pass filter is designed. In addition, in order to be able to integrate high-frequency features into the RGB stream, thereby preventing the detector from being overly dependent on specific color textures, a multi-scale high-frequency feature fusion module based on the Pag feature fusion method is also designed to dynamically integrate features from the two branches.
[0080] The specific structure of the first encoder is as follows Figure 3 As shown. Figure 3 In the embodiment, the first encoder further includes two multi-scale high-frequency feature extraction modules composed of adaptive high-pass filter structures and two multi-scale high-frequency feature fusion modules composed of Pag structures. Figure 3 We only use the input of a real image and the high-frequency features corresponding to the real image as an example to show the process of disentangling all features to obtain the semantics of the real image irrelevant content and the semantics of all fake real images. The same process is also used when the input is a fake image and the high-frequency features corresponding to the fake image.
[0081] S13, designing a first decoder;
[0082] In the first decoder, we also fully consider that the image-irrelevant content semantics are mainly low-frequency information, and the image forgery features are mainly high-frequency information. We use 4 SwiftFormer basic blocks to process the image-irrelevant content semantics, and 4 convolution blocks to process the image's entire forgery semantics. When processing the image-irrelevant content semantics, we incorporate the processed image's entire forgery semantics multiple times, and finally reconstruct the reconstructed image.
[0083] The specific structure of the first decoder is as follows Figure 4 shown. Figure 4Only by taking the input of the real image irrelevant content semantics and the real image all forged semantics as examples, the process of reconstructing the self-reconstructed graph of the real image is demonstrated. When the input is the fake image irrelevant content semantics and the fake image all forged semantics, the same process is followed, and the self-reconstructed graph of the fake image will be reconstructed. In addition to self-reconstruction, we also use cross-reconstruction, which can further enhance the independence of the disentangled semantics. When the input is the real image irrelevant content semantics and the fake image all forged semantics, the same process will be followed to reconstruct the cross-reconstructed graph of the real image. When the input is the fake image irrelevant content semantics and the real image all forged semantics, the same process will be followed to reconstruct the cross-reconstructed graph of the fake image.
[0084] S14. Design the loss function of the first stage;
[0085] The loss function of the first training stage is a weighted combination of a classification loss function and a reconstruction loss function. The classification loss function is aimed at detecting all fake semantics of the disentangled images, and the reconstruction loss function is aimed at reconstructing the self-reconstructed images of the true images, the cross-reconstructed images of the true images, the self-reconstructed images of the fake images, and the cross-reconstructed images of the fake images.
[0086] To detect all the forged semantics of disentanglement, we use cross entropy loss. The calculation method of classification loss function is as follows:
[0087]
[0088] In the formula, represents the classification loss of all forged semantics, represents the cross entropy loss, represents a detector for detecting all fake semantics, represents all the fake semantics that are untangled, Represents the true and false labels of all the fake semantic correspondence images of the input.
[0089] For the self-reconstructed images of the real images, the cross-reconstructed images of the real images, the self-reconstructed images of the fake images, and the cross-reconstructed images of the fake images, we use The loss function is used to ensure the consistency between the original image and the reconstructed image:
[0090]
[0091] In the formula, represents the reconstruction loss, for Loss function, represents the original image, Represents the image reconstructed from the corresponding original image.
[0092] Therefore, our first-stage loss function is:
[0093]
[0094] In the formula, and is a hyperparameter. After testing, Get the best results.
[0095] Furthermore, the model architecture of the second stage training includes the following related functional modules: (1) second encoder (2) second decoder;
[0096] The model architecture of the second stage training is as follows Figure 5 As shown in the figure, it mainly includes two modules. The design of each module is described in detail below.
[0097] S21, design a second encoder;
[0098] In the second encoder, we use the first encoder to extract the branch of all fake semantics, and then add two convolutional blocks to further disentangle the special fake semantics and common fake semantics based on the extracted all fake semantics.
[0099] The specific structure of the second encoder is as follows Figure 6 As shown. Figure 6 In the example, the branch before all the fake semantics are extracted has the same parameters as the branch where all the fake semantics are extracted by the first encoder. Figure 6 We only use the input of the real image and the high-frequency features corresponding to the real image as an example to show the process of disentangling all features to obtain special forged semantics and common forged semantics. The same process is also used when the input is a fake image and the high-frequency features corresponding to the fake image.
[0100] S22, designing a second decoder;
[0101] In the second decoder, we take into full account the fact that the forged features of an image are mainly high-frequency information, and use two convolutional block branches to process image-specific forged semantics and image-common forged semantics. The convolutional block branch for processing image-specific forged semantics includes two convolutional blocks, and the convolutional block branch for processing image-common forged semantics includes three convolutional blocks. When processing image-common forged semantics, the processed image-specific forged features are integrated multiple times, and the image forged semantics are finally reconstructed.
[0102] The specific structure of the second decoder is as follows Figure 7 shown. Figure 7Only by taking the input of the special fake semantics of the real image and the common fake semantics of the real image as examples, the process of reconstructing the self-reconstructed fake semantics of the real image is demonstrated. When the input is the special fake semantics of the fake image and the common fake semantics of the fake image, the same process is followed, and the self-reconstructed fake semantics of the fake image will be reconstructed. Similarly, in the second training stage, in addition to self-reconstruction, we also use cross-reconstruction, which can further enhance the independence of the disentangled semantics. When the input is the common fake semantics of the real image and the special fake semantics of the fake image, the cross-reconstructed fake semantics of the real image will be reconstructed according to the same process. When the input is the common fake semantics of the fake image and the special fake semantics of the real image, the cross-reconstructed fake semantics of the fake image will be reconstructed according to the same process.
[0103] S23. Design the loss function for the second stage.
[0104] The loss function of the second training stage is generated by weighting two classification loss functions, a contrast loss function and a reconstruction loss function. The two classification loss functions are respectively aimed at detecting the special forged semantics of the disentangled images and the common forged semantics of the images, the contrast loss is aimed at the semantics disentangled between different images, and the reconstruction loss function is aimed at the self-reconstructed forged semantics of the true image, the cross-reconstructed forged semantics of the true image, the self-reconstructed forged semantics of the false image, and the cross-reconstructed forged semantics of the false image.
[0105] To detect the special forged semantics of disentanglement, we use cross entropy loss, and its classification loss function is as follows:
[0106]
[0107] In the formula, Represents the classification loss of special forgery semantics, represents the cross entropy loss, represents a detector for detecting special fake semantics, represents the special forged semantics of disentanglement, The label of the forging method corresponding to the special forging semantics of the input.
[0108] To detect the common forged semantics of disentanglement, we use cross entropy loss, and its classification loss function is as follows:
[0109]
[0110] In the formula, Represents the classification loss of the common forgery semantics, represents the cross entropy loss, represents a detector for detecting common fake semantics, represents the common forgery semantics of disentanglement, Indicates the true and false labels of the images corresponding to the common forgery semantics of the input.
[0111] In order to enhance the encoder's ability to encode different image semantics, we use a contrastive loss function. This loss function can minimize the anchor image semantics The corresponding positive sample image semantics The distance between them, while maximizing the semantics of the anchor image and its corresponding negative sample image The distance between them. Among them, positive samples represent the same source, and negative samples represent different sources. The loss function is as follows:
[0112]
[0113] In the formula, represents the contrast loss, For L 2 Loss function, is a hyperparameter. After testing, The best results can be obtained. In addition, for real images, the same source refers to other real images, and different sources refer to forged images. For forged images, the same source refers to other forged images created using the same forging method, and different sources refer to real images.
[0114] For the self-reconstruction forgery semantics of the real image, the cross-reconstruction forgery semantics of the real image, the self-reconstruction forgery semantics of the fake image, and the cross-reconstruction forgery semantics of the fake image, we use The loss is used to ensure the consistency between the overall forgery semantics of the original image and the forgery semantics of the reconstructed image:
[0115]
[0116] In the formula, represents the reconstruction loss, for Loss function, represents the full forgery semantics of the original graph, Represents the fake semantics generated by the reconstruction of the corresponding special fake semantics and common fake semantics.
[0117] Therefore, our loss function for the second stage is:
[0118]
[0119] In the formula, , , and is a hyperparameter. After testing, Get the best results.
[0120] After two stages of training, the second encoder trained in the second stage and the detector for detecting common forged semantics are used. As the composition of the detection model, such as Figure 8 The test image and its high-frequency features are input into the second encoder, which extracts the common forged semantics and the detector for detecting the common forged semantics. Detecting the common forged semantics obtained by the second encoder, and detecting the common forged semantics detector Output the judgment result (true or false).
[0121] Furthermore, after the detection model was obtained through two-stage training, the effects of the multi-scale high-frequency feature extraction module and the multi-scale high-frequency feature fusion module were tested, and the following combinations were used for experiments:
[0122] RGB: Only RGB is used as input. High-frequency: Only high-frequency features are used as input. Fusion: Use RGB and high-frequency features as input at the same time. Fusion+ME: Use RGB and high-frequency features as input at the same time, and add a multi-scale high-frequency feature extraction module. Fusion+MF: Use RGB and high-frequency features as input at the same time, and add a multi-scale high-frequency feature fusion module. Fusion+ME+MF: Use RGB and high-frequency features as input at the same time, and add a multi-scale high-frequency feature extraction module and a multi-scale high-frequency feature fusion module.
[0123] Each combination is trained on the FaceForensics++ (FF++) dataset and tested on the FF++, Celeb-DF, DeepFake Detection (DFD), and DeepFake Detection Challenge (DFDC) datasets. The test results are shown in Table 1, with AUC (model evaluation index) as the indicator, where the higher the AUC, the better.
[0124]
[0125] Table 1 Deep fake image detection results of each combination
[0126] It can be seen from Table 1 that the RGB and High-frequency modalities have complementary properties, and the effectiveness of the multi-scale high-frequency feature extraction module and the multi-scale high-frequency feature fusion module can be demonstrated.
[0127] Furthermore, in order to analyze the performance of the detection model in detecting deep fake images, we tested it on sub-datasets within the domain and across datasets. In addition, we selected Resnet-50, EfficientNet-B4, Xception, SRM, F3-Net, UCF and Lin et al (the latest method proposed by Lin et al.) as baseline networks, and each network was trained on the dataset FF++.
[0128] The sub-datasets of FF++ include: DeepFakes (DF), Face2Face (F2F), FaceSwap (FS), NeuralTexture (NT), and FaceShifter (FST). The test results on the sub-datasets of FF++ are shown in Table 2, with AUC as the indicator, where the higher the AUC, the better.
[0129]
[0130] Table 2 The deep fake image detection effect of each model on the FF++ sub-dataset
[0131] As can be seen from Table 2, our detection model achieves higher AUC on all sub-datasets of FF++, which shows that our model has outstanding in-domain performance.
[0132]
[0133] Table 3. Deep fake image detection results of each model on cross-datasets
[0134] It can be seen from Table 3 that the detection model of the deep fake image detection method based on semantic disentanglement also achieved a higher AUC in the test on cross-datasets, which indicates that the detection model of the deep fake image detection method based on semantic disentanglement not only has outstanding performance in the domain, but also has strong detection capabilities on cross-datasets, indicating that the detection model of the deep fake image detection method based on semantic disentanglement has excellent generalization ability.
[0135] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A deep fake image detection method based on semantic disentanglement, characterized in that: The deep fake image detection method includes the following steps: S1. Design the model architecture for the first stage of training; S2, design the model architecture for the second stage of training; Among them, the model architecture trained in the first stage includes: an adaptive high-pass filter, a first encoder and a first decoder; the model architecture trained in the second stage includes a second encoder and a second decoder; The above step S1 further includes the following steps: S11, designing an adaptive high-pass filter; The adaptive high-pass filter is used to extract high-frequency features of an image. The calculation method of the adaptive high-pass filter is as follows: In the formula, represents the kernel of the adaptive high-pass filter, x and y represent the position of the point inside the kernel, represents the standard deviation, represents a matrix with 1 at the center and 0 at the rest. represents normalization; In addition, the center of the adaptive high-pass filter kernel is reset to 1 after initialization and each back-propagation, and the remaining positions are normalized. The calculation method is as follows: Where, (x, y) = (0, 0) represents the center position within the nucleus; The above step S1 further includes the following steps: S12, designing a first encoder; The first encoder includes a SwiftFormer branch and two Xception branches, the SwiftFormer branch includes four SwiftFormer basic blocks for extracting unrelated content semantics of an image, two Xception branches are used to extract RGB information and image high-frequency features to form the image full fake semantics, the Xception branch includes two convolution blocks and three Xception basic blocks; The first encoder also includes a multi-scale high-frequency feature fusion module based on the Pag feature fusion method, and the multi-scale high-frequency feature fusion module is used to dynamically integrate features from two Xception branches; The above step S1 further includes the following steps: S13, designing a first decoder; The first decoder includes four SwiftFormer basic blocks for processing image-independent content semantics, the first decoder further includes four convolution blocks for processing all fake semantics of the image. The first decoder multiple times when processing image-independent content semantics, and finally reconstructs the reconstruction map; The above step S1 further includes the following steps: S14, designing a loss function of the first stage; The loss function of the first stage includes a classification loss function and a reconstruction loss function. The calculation method of the classification loss function is as follows: Where: represents the classification loss of all forged semantics, represents the cross entropy loss, represents a detector for detecting all fake semantics, represents all the fake semantics that are untangled, Represents the true and false labels of all the fake semantic corresponding images of the input; The reconstruction loss function is calculated as follows: In the formula, represents the reconstruction loss, for Loss function, represents the original image, Represents the image reconstructed from the corresponding original image; The calculation method of the loss function in the first stage is as follows: In the formula, and is a hyperparameter; The above step S2 further includes the following steps: S21, designing a second encoder; The second encoder uses the branches of all forged semantics extracted by the first encoder, and the second encoder includes two convolution blocks for further detangling the special forged semantics and common forged semantics based on the extracted all forged semantics; The above step S2 further includes the following steps: S22, designing a second decoder; The second decoder includes two convolution block branches for processing special forgery semantics and common forgery semantics, respectively. The second decoder processes the common forgery semantics of the image and integrates the special forgery semantics of the processed image multiple times, and finally reconstructs the forgery semantics of the image; The above step S2 further includes the following steps: S23, designing a loss function for the second stage; The loss functions in the second stage include two classification loss functions, a contrast loss function, and a reconstruction loss function; For detecting the special forged semantics of disentanglement, the classification loss function is calculated as follows: In the formula, Represents the classification loss of special forgery semantics, represents the cross entropy loss, represents a detector for detecting special fake semantics, represents the special forged semantics of disentanglement, The label of the forging method corresponding to the special forging semantics of the input; For detecting the common forged semantics of disentanglement, the classification loss function is calculated as follows: In the formula, Represents the classification loss of the common forgery semantics, represents the cross entropy loss, represents a detector for detecting common fake semantics, represents the common forgery semantics of disentanglement, Indicates the true or false labels of the images corresponding to the common forged semantics of the input; The contrast loss function is calculated as follows: In the formula, represents the contrast loss, is the L2 loss function, is a hyperparameter, To anchor image semantics, is the semantics of the positive sample image, is the semantics of negative sample images; The reconstruction loss function is calculated as follows: In the formula, represents the reconstruction loss, for Loss function, represents the full forgery semantics of the original graph, Represents the corresponding special forgery semantics and the forgery semantics reconstructed by the common forgery semantics; The calculation method of the loss function of the second stage is as follows: In the formula, , , and is a hyperparameter; The deep fake image detection method obtains a detection model through the above steps S1 and S2, wherein the detection model includes a second encoder and a detector for detecting common fake semantics; The test diagram and the high-frequency characteristics of the test diagram are input into the second encoder. The second encoder extracts the common forged semantics, and the detector that detects the common forged semantics detects the common forged semantics obtained by the second encoder, and outputs the judgment result of the detector that detects the common forged semantics.
2. A deep fake image detection method based on semantic disentanglement according to claim 1, characterized in that: The depth forged image detection method also includes the following steps: S3. Check the effects of the multi-scale high-frequency feature extraction module and the multi-scale high-frequency feature fusion module; S4. The analysis method detects the performance of the deep forged image.
