Method for detecting artificial human faces based on multi-stage attention

By using a multi-stage attention network and a self-supervised reconstruction pre-training method, the problems of insufficient local feature fusion and robustness in existing face forgery detection methods are solved, and efficient and accurate AI-synthesized face detection is achieved under limited labeled data.

CN122176772APending Publication Date: 2026-06-09HANGZHOU ZHONGKE RUIJIAN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU ZHONGKE RUIJIAN TECH CO LTD
Filing Date
2026-03-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing face forgery detection methods struggle to effectively integrate local and global features, lack robustness and generalization ability, and rely heavily on labeled data, resulting in insufficient detection accuracy and adaptability.

Method used

A multi-stage attention network is adopted to model the relationship between local facial details and background through local, interactive and feedback-adjusted attention submodules. The detection performance is improved with limited labeled data through self-supervised reconstruction pre-training and cross-stage feature fusion modules.

Benefits of technology

It improves the detection accuracy and robustness of AI-synthesized faces, enhances the model's adaptive adjustment capability, reduces the dependence on labeled data, and improves the model's ability to distinguish between various forgery methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122176772A_ABST
    Figure CN122176772A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of deep fake detection, in particular to an AI synthetic human face detection method based on multi-stage attention; the method comprises the following steps: firstly, a robust human face feature extractor is obtained through self-supervised reconstruction pretraining; the multi-stage attention network comprises a local, interactive and feedback adjustment attention submodule; the specific window division strategy is used to respectively model the human face local details and the interactive relationship between the human face and the background; and the feedback mechanism is used to dynamically optimize the network parameters; subsequently, a detection model is constructed based on the pretraining encoder; the multi-scale intermediate features are adaptively aggregated through a cross-stage feature fusion module; a comprehensive feature vector is formed; and finally, a classifier is connected to output a true or false probability; the classification part is fine-tuned through supervised training; the synthetic human face detection judgment of the input image is finally realized; and the detection accuracy and the generalization ability are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of deepfake detection technology, specifically to an AI-synthesized face detection method based on multi-stage attention. Background Technology

[0002] With the rapid development of AI Generated Content (AIGC) technology, deep learning-based technologies such as face synthesis, face swapping, expression transfer, and voice-driven lip synthesis have matured. These technologies have positive applications in entertainment, film and television production, and virtual human interaction, but they are also being exploited by criminals to generate fake facial images or videos, leading to serious privacy leaks, manipulation of public opinion, and social security issues. Therefore, how to effectively detect and identify AI-synthesized faces has become a research hotspot in academia and industry.

[0003] Existing methods for detecting face spoofing can be mainly classified into the following categories: Handcrafted feature-based methods classify images by extracting frequency domain features, edge features, texture information, etc. However, these methods rely on manually designed features, have poor adaptability, and are often unable to cope with diverse forgery techniques. Deep learning-based classification methods utilize deep models such as Convolutional Neural Networks (CNN) and Visual Transformer (ViT) to directly extract features and classify input face images. Although these methods improve detection accuracy, they have two prominent problems: first, they are not good at capturing details in local forged regions, making it easy to miss detections; second, the models rely too much on global information, resulting in poor robustness to different resolutions and forgery methods. In addition, existing deep learning detection methods usually rely on large-scale labeled data during training, which is costly to obtain. Furthermore, when faced with cross-dataset or unknown forgery methods, the model's generalization ability is insufficient, which can easily lead to a decline in detection performance.

[0004] Therefore, there is an urgent need for an AI-synthesized face detection method that can effectively integrate local and global features, has adaptive adjustment capabilities, and can achieve efficient learning under limited labeled data conditions, so as to improve the accuracy, robustness and generalization of detection. Summary of the Invention

[0005] The purpose of this invention is to address the problems existing in the background technology by proposing an AI-synthesized face detection method based on multi-stage attention.

[0006] The technical solution of this invention: an AI-synthesized face detection method based on multi-stage attention, comprising the following specific implementation steps: S1. A robust face feature extractor is obtained through self-supervised reconstruction pre-training. This feature extractor adopts a multi-stage attention network that includes a local attention submodule, an interactive attention submodule, and a feedback-modulated attention submodule. It models the local details of the face and the interaction between the face and the background through a specific window partitioning strategy, and dynamically optimizes the network parameters using a feedback mechanism. S2. A detection model is built based on a pre-trained face feature extractor. The intermediate layer features of different stages in the multi-stage attention network are adaptively aggregated through a cross-stage feature fusion module to form a comprehensive feature vector. Finally, the classifier is connected to output the true and false probabilities. S3. Supervised training of the constructed detection model is performed using the labeled real and fake face image dataset. During the training process, the parameters of the pre-trained face feature extractor are kept fixed, and only the parameters of the cross-stage feature fusion module and the classifier are updated. S4. The trained model is used for actual inference. After face detection, alignment and standardization preprocessing of the image to be tested, the model is input to obtain the probability of the synthesized face, and the binary classification of real and fake faces is completed by setting a threshold.

[0007] Preferably, in step S1, the self-supervised reconstruction pre-training specifically includes: S11. Use a pre-trained face detection model to locate and align faces in the input image, and crop to obtain a standardized face image; S12. After adjusting the standardized face image to a fixed size, input it into the shallow feature extraction module consisting of several convolutional layers to obtain a shallow feature map. S13. Input the shallow feature map into the multi-stage attention network for encoding. The multi-stage attention network sequentially performs feature transformation and parameter adjustment through the local attention sub-module, the interactive attention sub-module, the feedforward neural network, and the feedback adjustment attention sub-module. S14. The encoded high-level feature map is upsampled through a decoder consisting of deconvolutional layers to reconstruct an image of the same size as the input. S15. With the goal of minimizing the pixel-level loss between the reconstructed image and the original input image, perform self-supervised training on the multi-stage attention network and the decoder.

[0008] Preferably, in step S13, the operation of the local attention submodule includes: A1. Divide the input feature map into K non-overlapping local windows, where the face region is divided into a larger window and the remaining background region is evenly divided into multiple smaller square windows. A2. Further divide the features within each window into image blocks, and perform linear projection on each image block to obtain an image label sequence; A3. Perform multi-head self-attention operation independently on the image label sequence for each window; A4. Restore the image label sequence after self-attention calculation to the original window space size, and reassemble it according to the original spatial position to obtain the output feature map.

[0009] Preferably, in step S13, the operation of the interactive attention submodule includes: B1. Divide the input feature map into M windows that span the boundary between the face and the background. Each window contains partial features of both the face region and the background region. B2. Perform block encoding on each interactive window to obtain an image tag sequence, and calculate the self-attention between all image tags within the window; B3. Restore and reassemble the processed window features to obtain the output feature map.

[0010] Preferably, in step S13, the operation of the feedback adjustment attention submodule includes: C1. Collect the original input features of the current multi-stage attention module and the features processed by the local attention sub-module, the interactive attention sub-module and the feedforward neural network, and then perform weighted fusion to generate the adjustment features. C2. Generate a set of adjustment vectors from the aforementioned adjustment features using a small neural network; C3. The adjustment vector is used to dynamically modulate the internal parameters of the local attention submodule, the interactive attention submodule, and the feedforward neural network within the current module.

[0011] Preferably, step S2, which involves adaptively aggregating intermediate layer features from different stages in a multi-stage attention network through a cross-stage feature fusion module, includes: S21. Extract the intermediate layer output features of the first to Nth attention modules in the multi-stage attention network; S22. Calculate an adaptive fusion weight for each intermediate layer output feature. The weight is obtained by calculating the correlation between features in adjacent stages. S23. Multiply the intermediate layer output features of each stage by their corresponding adaptive fusion weights, and then concatenate them along the feature dimension to generate the comprehensive feature vector.

[0012] Preferably, in step S22, the adaptive fusion weight corresponding to the nth intermediate layer output feature is calculated as follows: based on the result of element-wise multiplication of the (n-1)th intermediate layer output feature and the nth intermediate layer output feature in the transformed dimension.

[0013] Preferably, in step S3, the loss function used in supervised training is the cross-entropy loss function, and the gradient descent algorithm is used during the optimization process to update only the parameters of the cross-stage feature fusion module and the classifier.

[0014] Preferably, in step S4, the preprocessing operation is consistent with the operation in step S1, including face detection, key point alignment, affine transformation cropping, and size standardization.

[0015] Compared with the prior art, the above-mentioned technical solution of the present invention has the following beneficial technical effects: This invention designs an AI-synthesized face detection method based on multi-stage attention. First, by introducing a multi-stage attention mechanism, the model can more accurately focus on abnormal regions that may appear in the synthesized face. The local attention submodule focuses on capturing subtle inconsistencies in the details inside the face, while the interactive attention submodule models the contextual relationship between the face and the background to detect traces of edge blending or lighting inconsistencies. This division of labor and cooperation enhances the ability to identify diverse forgery traces. Second, the feedback-adjusted attention submodule enables dynamic adaptation and adjustment of network parameters, allowing the model to flexibly optimize its processing strategy based on input features, improving the model's robustness and adaptability to images of different qualities and sources. Third, a self-supervised reconstruction pre-training strategy is adopted, enabling the model to learn the essential structure and texture features of real faces without the need for a large amount of labeled data, constructing a more generalizable feature extractor and effectively reducing the dependence on labeled data. Finally, the cross-stage feature fusion module fully utilizes multi-scale information from local details to global semantics by adaptively aggregating features at different depths during the encoding process, forming a more discriminative comprehensive feature representation, thereby improving the overall accuracy and reliability of the detection system in the face of constantly evolving AI synthesis technologies. Attached Figure Description

[0016] Figure 1 This is a flowchart of an AI-synthesized face detection method based on multi-stage attention proposed in this invention; Figure 2 This is a schematic diagram of the face self-supervised reconstruction pre-training method proposed in this invention; Figure 3 This is a schematic diagram of the multi-level attention self-supervised pre-training proposed in this invention; Figure 4 This is a schematic diagram of the local window division proposed in this invention; Figure 5 This is a schematic diagram of the interactive window division proposed in this invention; Figure 6 This is a schematic diagram of the feedback-regulated attention mechanism proposed in this invention; Figure 7This is a schematic diagram of the feedback-regulated attention module proposed in this invention; Figure 8 This is a schematic diagram of the AI-synthesized face detection process based on multi-stage attention proposed in this invention; Figure 9 This is a schematic diagram of the cross-stage feature fusion module proposed in this invention; Figure labels: stage 0 represents the face image extraction stage, i.e., the preprocessing stage; stage 1 represents feature extraction and dimensionality reduction, i.e., shallow feature extraction; stage 2 represents the multi-level attention interaction stage, i.e., the core feature learning stage; stage 3 represents the feature recovery and reconstruction stage, i.e., the decoding and pre-training target stage; stage 4 represents the classification stage; H represents the spatial height of the input feature map; W represents the spatial width of the input feature map; C represents the number of channels of the input feature map; r represents the reduction rate, i.e., the hyperparameter, used to compress the channel dimension, with the aim of reducing model complexity and the number of parameters, while introducing a non-linear bottleneck structure; Sigmoid represents applying the Sigmoid function to the C-dimensional vector from the previous step; Scale represents broadcasting (element-wise multiplication) the generated C channel weights to the corresponding channels of the original input feature map; x represents the input feature. Detailed Implementation

[0017] Example 1: This invention proposes an AI-synthesized face detection method based on multi-stage attention, such as... Figure 1 As shown, the specific implementation steps include the following: S1. A self-supervised reconstruction pre-training method based on multi-stage attention is provided to obtain a robust face feature extractor. It first performs detection alignment and shallow feature extraction on the input face image, then performs deep feature encoding through a multi-stage attention network containing local, interactive, and feedback-modulated attention submodules. This network uses a special window partitioning strategy to model local facial details and the interaction between the face and the background, and dynamically adjusts parameters through a feedback mechanism. Finally, the image is reconstructed through a decoder and self-supervised training is performed using pixel-level reconstruction loss. Figure 2 As shown, specifically: S11. Use a pre-trained face detection model to locate and crop the aligned face regions to obtain a standardized face image, i.e.: Input any image containing a human face, and process the input image using a pre-trained face detection and alignment model (such as MTCNN or RetinaFace); The model outputs the coordinates of key points on the face (usually 5 or 106 points); Based on these key points, the face is aligned to a standard frontal pose using affine transformation, and then cropped according to a predefined bounding box to obtain a standardized aligned face image. ; S12. After adjusting the standardized image to a fixed size, input it into a module consisting of three convolutional layers for spatial downsampling and preliminary feature extraction to obtain a shallow feature map, i.e.: Standardized aligned face images Adjust the space size to a fixed size (This embodiment is set as) (pixels) to obtain the input image ; Input image A shallow feature extraction module is introduced, which consists of three consecutive convolutional layers; For example, the specific parameters of the convolutional layer can be set as follows: First layer: 7×7 kernel, stride 2, padding 3, output channels 64; Second layer: 3×3 convolutional kernel, stride 2, padding 1, output channels 64; Third layer: 3×3 convolutional kernel, stride 1, padding 1, output channels 64; After passing through this module, a shallow feature map is obtained. ; Where H and W represent the height and width of the image, respectively; S13. The shallow features are input into a multi-stage attention module. This module sequentially performs feature transformation through a local attention submodule (performing self-attention calculation within the divided face and background windows), an interactive attention submodule (performing self-attention calculation within a window spanning the face and background), and a feedforward layer. It then utilizes a feedback-adjusted attention submodule to generate adjustment signals based on the original and processed features, dynamically optimizing the internal parameters of the aforementioned submodules. shallow feature map Input a feature encoder consisting of L cascaded "multi-stage attention modules"; Each multi-stage attention module (e.g.) Figure 3 (Illustrative) It consists of: a Local Attention Submodule (LA), an Interactive Attention Submodule (IA), a Feedforward Neural Network (FFN), and a Feedback-Regulated Attention Submodule (FA); the modules are connected by residual connections. Module 1: Local Attention Submodule, such as Figure 4 As shown, the operation process is as follows: A1. Window partitioning: dividing the input feature map (i.e., shallow feature map) The face is divided into K non-overlapping local windows. The division strategy is as follows: first, locate the face region (e.g., the central region), and divide it into a larger window. (size The remaining background area is evenly divided into K-1 smaller square windows. (size There are a total of K=13 windows; A2. Patch Embedding: For each window's features, further divide them into smaller image patches; set the patch size P=7; for face windows... Its dimensions are 56×56×64, which can be divided into (56 / 7)×(56 / 7)=8×8=64 blocks; the flattened dimensions of each block are 7×7×64=3136; through a learnable linear projection layer, the 3136-dimensional vector of each block is mapped to a uniform embedding dimension D (e.g., D=3136 remains unchanged, or it is compressed to a lower dimension such as 256), resulting in a set of image tokens. For each background window The dimensions are 28×28×64, which can be divided into 4×4=16 blocks. After processing... ; in, This represents the image tag sequence corresponding to each background window; A3. Intra-window self-attention calculation: Standard multi-head self-attention (MSA) operation is performed independently on the labeled sequence of each window; taking a face window as an example, the calculation process is as follows: ; It should be noted that Q, K, and V are obtained by linear transformation of the label sequence. It is the dimension of the key vector; this operation establishes feature associations between all image patches within the same window, focusing on mining local details and texture relationships within the window; Where Q represents the query vector; K represents the key vector; and V represents the value vector; This indicates a bullish self-attention strategy; Indicates the dimension of the key vector; A4. Feature Restoration and Window Reshaping: The labeled sequence after self-attention computation is restored to its original window spatial size through inverse linear projection (if needed) and spatial reconstruction (reshape); finally, all processed windows are reassembled according to their original spatial positions to obtain the output feature map of the local attention module. ; Module 2: Interactive Attention Submodule, such as Figure 5 As shown, the operation process is as follows: B1. Interactive Window Partitioning: Employing a different window partitioning strategy from local attention; dividing feature maps... Divide into M windows (e.g., M=16), each window is 28×28 in size; It should be noted that the coverage area of ​​each window spans the boundary between the face and the background; that is, a window simultaneously contains a portion of the image from the face region and a portion of the image from the surrounding background region. This division forces the model to consider both the internal features of the face and the features of the external environment when calculating attention. B2. Block Coding and Self-Attention Calculation: Perform the same block coding and in-window self-attention calculation as the local attention module on each interactive window; each window generates 16 image tags and calculates the attention between all tags within it; this enables the tags in the face region to directly interact with the tags in the background region, thereby modeling the contextual relationship between the face and the environment, which helps to discover traces such as lighting, color difference, and edge blending anomalies caused by inconsistent synthesis methods; B3. Feature Restoration and Recombination: After processing, the features of each window are restored and recombined to obtain the output feature map of the interactive attention module. ; Module 3: Feedback-based attention regulation submodule, such as... Figure 6 and Figure 7 As shown, the operation process is as follows: C1. Feature Collection and Fusion: Let the original input features of the current multi-stage attention module be... The features after processing by local attention, interactive attention, and FFN layers are: ;Will and Perform weighted fusion to generate a moderating feature. : C2, will A set of adjustment vectors is generated using a small neural network (e.g., two fully connected layers with a non-linear activation function such as ReLU in between). C3. The generated adjustment vector is used to modulate local attention, interactive attention, and certain parameters in the FFN layer (such as the gain and bias of the LayerNorm layer, or the bias term of the attention weights) within the current module, to achieve dynamic, input-dependent adjustments to the module's behavior; such as Figure 6 As shown by the dashed line, the modulated module parameters are used for the forward propagation of the current data, forming a fine feedback adjustment loop. S14. The high-level features encoded through several multi-stage attention modules are upsampled by a decoder consisting of deconvolutional layers to reconstruct an image of the same size as the input. After encoding by L multi-stage attention modules, a high-level feature map is obtained. A symmetric decoder (consisting of multiple deconvolutional or transposed convolutional layers) is used to... Upsampling is performed to gradually restore the image spatial dimensions, and the final output is the reconstructed image. ; S15. After applying random occlusion or perturbation to the input image, input it into the network. Perform self-supervised pre-training of the model with the goal of minimizing the pixel-level loss between the reconstructed image and the original image. During training, the input is either real or fake face images. The training input image is obtained by applying perturbations such as random occlusion, color jitter, or Gaussian noise. ; with the original To reconstruct the target, the loss function uses pixel-level L1 or L2 reconstruction loss; The network is optimized by minimizing this loss until the model converges. At this point, the encoder part has become a powerful feature extractor that focuses on facial structural details and contextual relationships.

[0018] S2. A detection model is built based on a pre-trained feature extractor. An intermediate layer feature from different attention modules in the encoder is aggregated through a cross-stage feature fusion module. This module calculates the similarity of features from adjacent stages as adaptive weights, weights the features at each stage, and concatenates them to form a comprehensive feature vector that integrates multi-scale information. Finally, it connects to a classifier to output the probability of real versus fake faces. Specifically: S21. Freeze the pre-trained multi-stage attention encoder, and sequentially connect the cross-stage feature fusion module and the classifier at its back end to form a complete detection model architecture, namely: like Figure 8 As shown, all weights of the multi-stage attention encoder pre-trained in stage 1 are frozen; after the encoder, the cross-stage feature fusion module proposed in this invention is connected, and finally a classifier is connected. S22. Extract the intermediate layer features of each multi-stage attention module in the encoder. Calculate the correlation between features from adjacent stages to obtain the adaptive fusion weights for each stage. After weighting the features, concatenate them along the feature dimensions to generate the final fused features, such as... Figure 9 As shown, that is: Intermediate Feature Extraction: Suppose the encoder has N multi-stage attention modules; during inference, not only is the output of the last module taken, but also the intermediate layer features located after the attention calculation and before the FFN layer from the 1st to the Nth modules are extracted, denoted as the set. ; in, This represents the output characteristics of the intermediate layer of the nth module. ; C represents the number of spatial locations after the feature map is flattened; C represents the number of channels. Adaptive weight calculation: An adaptive fusion weight is calculated for the features of each stage, taking into account the correlation between features from adjacent stages. ; in, and These represent the features of the (n-1)th and nth multi-order attention modules in the i-th dimension, respectively. This represents the weight coefficient of the nth multi-order attention module in the feature fusion stage; This represents the element-wise multiplication operation; This represents a lightweight feature transformation (such as 1×1 convolution or global average pooling) used to adjust features to a comparable dimension; Weighted fusion: After multiplying the features of each stage with their corresponding weights, the results are concatenated along the feature dimensions. ; Wherein, H represents a comprehensive feature vector that integrates information from multiple scales and stages; Indicates a splicing operation; S23. After the fused features are processed by global pooling and fully connected layers, the Softmax function outputs a two-dimensional probability distribution indicating whether the image belongs to a real human face or an AI-synthesized face, i.e.: The fused feature H is input into a classifier, which typically consists of a global average pooling layer and one or more fully connected layers. The final output layer uses the Softmax activation function to output a two-dimensional vector. , representing the probability that the input image is a real human face and an AI-synthesized human face, respectively.

[0019] S3. Supervised training of the constructed detection model is performed using the labeled dataset of real and fake face images. During training, the pre-trained encoder parameters are kept fixed, and only the parameters of the cross-stage feature fusion module and the classifier are updated. The cross-entropy loss function is used for optimization until the model converges. Specifically: S31. Prepare a dataset containing real human faces and AI-synthesized faces generated by various technologies. All images must undergo unified face alignment and standardization preprocessing, i.e.: Collect a large-scale, diverse dataset containing pairs of real face images and fake face images synthesized by various different generation methods (such as GANs and Diffusion Models); all images must undergo preprocessing in step S11. S32. Using the aforementioned data as input and cross-entropy loss as the optimization objective, the gradient descent algorithm is used to perform end-to-end supervised training only on the trainable parts of the model (fusion module and classifier), i.e.: The pre-trained encoder, cross-stage fusion module, and classifier are combined into a complete detection model; the encoder parameters are frozen, and only the cross-stage fusion module and classifier are trained. Using standard cross-entropy loss as the objective function: ; in, This represents the classification loss function; y is the label of the real image (e.g., 1 for true, 0 for false). End-to-end training is performed using stochastic gradient descent (SGD) or the Adam optimizer, updating the parameters of the trainable part through backpropagation until the model's performance on the validation set stabilizes.

[0020] S4. Design the inference process of the trained model in practical applications, including performing the same face preprocessing on the test image, inputting it into the model to obtain the probability of the synthesized face, and finally completing the binary classification of real and fake faces by setting a threshold. Specifically: For the unknown image to be detected, perform the following steps in sequence: Perform the exact same face detection, alignment, and size normalization operations on the images to be tested as during the training phase; The preprocessed image is input into the trained detection model, and forward propagation yields the probability value that it is identified as a synthetic face. ; Compare the probability value output by the model with the preset threshold. (e.g., 0.5) for comparison: If If the result is positive, it is determined to be a synthetic face; otherwise, it is determined to be a real face.

[0021] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited thereto. Various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of the present invention.

Claims

1. An AI-synthesized face detection method based on multi-stage attention, characterized in that, The specific implementation steps include the following: S1. A robust face feature extractor is obtained through self-supervised reconstruction pre-training. This feature extractor adopts a multi-stage attention network that includes a local attention submodule, an interactive attention submodule, and a feedback-modulated attention submodule. It models the local details of the face and the interaction between the face and the background through a specific window partitioning strategy, and dynamically optimizes the network parameters using a feedback mechanism. S2. A detection model is built based on a pre-trained face feature extractor. The intermediate layer features of different stages in the multi-stage attention network are adaptively aggregated through a cross-stage feature fusion module to form a comprehensive feature vector. Finally, the classifier is connected to output the true and false probabilities. S3. Supervised training of the constructed detection model is performed using the labeled real and fake face image dataset. During the training process, the parameters of the pre-trained face feature extractor are kept fixed, and only the parameters of the cross-stage feature fusion module and the classifier are updated. S4. The trained model is used for actual inference. After face detection, alignment and standardization preprocessing of the image to be tested, the model is input to obtain the probability of the synthesized face, and the binary classification of real and fake faces is completed by setting a threshold.

2. The AI-synthesized face detection method based on multi-stage attention according to claim 1, characterized in that, In step S1, the self-supervised reconstruction pre-training specifically includes: S11. Use a pre-trained face detection model to locate and align faces in the input image, and crop to obtain a standardized face image; S12. After adjusting the standardized face image to a fixed size, input it into the shallow feature extraction module consisting of several convolutional layers to obtain a shallow feature map. S13. Input the shallow feature map into the multi-stage attention network for encoding. The multi-stage attention network sequentially performs feature transformation and parameter adjustment through the local attention sub-module, the interactive attention sub-module, the feedforward neural network, and the feedback adjustment attention sub-module. S14. The encoded high-level feature map is upsampled through a decoder consisting of deconvolutional layers to reconstruct an image of the same size as the input. S15. With the goal of minimizing the pixel-level loss between the reconstructed image and the original input image, perform self-supervised training on the multi-stage attention network and the decoder.

3. The AI-synthesized face detection method based on multi-stage attention according to claim 2, characterized in that, In step S13, the operations of the local attention submodule include: A1. Divide the input feature map into K non-overlapping local windows, where the face region is divided into a larger window and the remaining background region is evenly divided into multiple smaller square windows. A2. Further divide the features within each window into image blocks, and perform linear projection on each image block to obtain an image label sequence; A3. Perform multi-head self-attention operation independently on the image label sequence for each window; A4. Restore the image label sequence after self-attention calculation to the original window space size, and reassemble it according to the original spatial position to obtain the output feature map.

4. The AI-synthesized face detection method based on multi-stage attention according to claim 3, characterized in that, In step S13, the operations of the interactive attention submodule include: B1. Divide the input feature map into M windows that span the boundary between the face and the background. Each window contains partial features of both the face region and the background region. B2. Perform block encoding on each interactive window to obtain an image tag sequence, and calculate the self-attention between all image tags within the window; B3. Restore and reassemble the processed window features to obtain the output feature map.

5. The AI-synthesized face detection method based on multi-stage attention according to claim 4, characterized in that, In step S13, the operations of the feedback adjustment attention submodule include: C1. Collect the original input features of the current multi-stage attention module and the features processed by the local attention sub-module, the interactive attention sub-module and the feedforward neural network, and then perform weighted fusion to generate the adjustment features. C2. Generate a set of adjustment vectors from the aforementioned adjustment features using a small neural network; C3. The adjustment vector is used to dynamically modulate the internal parameters of the local attention submodule, the interactive attention submodule, and the feedforward neural network within the current module.

6. The AI-synthesized face detection method based on multi-stage attention according to claim 5, characterized in that, Step S2, which involves adaptively aggregating intermediate layer features from different stages in a multi-stage attention network through a cross-stage feature fusion module, includes: S21. Extract the intermediate layer output features of the first to Nth attention modules in the multi-stage attention network; S22. Calculate an adaptive fusion weight for each intermediate layer output feature. The weight is obtained by calculating the correlation between features in adjacent stages. S23. Multiply the intermediate layer output features of each stage by their corresponding adaptive fusion weights, and then concatenate them along the feature dimension to generate the comprehensive feature vector.

7. The AI-synthesized face detection method based on multi-stage attention according to claim 6, characterized in that, In step S22, the adaptive fusion weight corresponding to the nth intermediate layer output feature is calculated as follows: it is determined by multiplying the (n-1)th intermediate layer output feature and the nth intermediate layer output feature element-wise in the transformed dimension.

8. The AI-synthesized face detection method based on multi-stage attention according to claim 7, characterized in that, In step S3, the loss function used in supervised training is the cross-entropy loss function, and the gradient descent algorithm is used during the optimization process to update only the parameters of the cross-stage feature fusion module and the classifier.

9. The AI-synthesized face detection method based on multi-stage attention according to claim 8, characterized in that, In step S4, the preprocessing operation is consistent with the operation in step S1, including face detection, key point alignment, affine transformation cropping, and size standardization.