Generative face detection method and system based on improved YOLOv11n
By improving the YOLOv11n face detection algorithm AFAS-YOLO, and introducing an adaptive residual downsampling module, a multi-scale fusion module, and a SaE channel attention module, the challenges of high accuracy and efficient deployment in generative face detection are solved, and efficient and accurate identification of generative fake face images is achieved.
Patent Information
- Application Number
- CN202511130195.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-13
- Publication Date
- 2025-11-14
AI Technical Summary
Existing generative face detection methods face challenges in achieving high-precision detection and efficient deployment, especially when dealing with generatively forged face images. They struggle to meet the requirements of high-security scenarios, and traditional models are insufficient in distinguishing subtle differences between forged textures and real details.
The face detection algorithm AFAS-YOLO in YOLOv11n is improved by introducing an adaptive residual downsampling module, a multi-scale fusion module, and a SaE channel attention module, which enhances the model's detection accuracy and adaptability in complex environments.
It significantly improves the performance and inference speed of generative face detection, can better distinguish between real and fake faces, is suitable for high-security scenarios, and features high accuracy and efficient deployment.
Smart Images

Figure CN120954069A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection, and in particular to an improved generative face detection method and system for YOLOv11n. Background Technology
[0002] With the rapid development of generative face spoofing technology, the realism of forged images is increasingly approaching that of real faces, bringing unprecedented risks to scenarios such as public safety, identity authentication, financial risk control, judicial evidence collection, and smart device interaction. Therefore, efficient and reliable detection technologies are needed to address this. Current mainstream face detection methods are mostly based on deep learning-based object detection architectures, primarily categorized into single-stage and two-stage models. Single-stage models, such as RetinaNet, SSD (Single Shot MultiBox Detector), YOLO, EfficientDet (Scalable and Efficient Object Detection), and DETR (DEtection TRansformer), possess end-to-end modeling capabilities, fast inference speed, and low computational resource consumption, making them suitable for mobile devices and real-time scenarios. However, their detection accuracy is limited when dealing with small, dense targets and complex backgrounds. Two-stage models, such as R-CNN (Region-based Convolutional Neural Network), Faster R-CNN, and Mask R-CNN, improve detection accuracy through candidate region mechanisms; however, their higher computational cost limits their application in edge devices.
[0003] To address these key challenges in fake face detection, several innovative methods have been proposed. In feature modeling, Li Ying et al. constructed a face forgery detection framework that combines CNN and Transformer. By introducing a dual-branch structure in the spatial and frequency domains and a cross-attention mechanism, they significantly enhanced the adaptability to compression distortion, multi-source forgery, and image quality variations, improving cross-scene robustness. For lightweight deployment, Zhuo Wenqi et al. proposed an integer quantization method that does not require original data. Through activation distribution modeling and low-bit-width representation, they compressed the fake face detection model to a scale suitable for terminal operation and combined it with synthesized forged images for parameter calibration, significantly reducing model overhead while maintaining accuracy. Addressing the need for facial image privacy protection, Wu Wei et al. designed a detection framework based on an additive secret sharing mechanism. This framework divides the input image into irreversible local shares and performs forgery detection inference in an encrypted state, effectively avoiding image leakage. Its performance is close to that of ResNet50 in plaintext, making it suitable for privacy-sensitive scenarios such as judicial evidence collection and identity authentication.
[0004] Despite significant progress in generative face detection, challenges remain in balancing high-precision detection with efficient deployment. Summary of the Invention
[0005] To address the problems existing in the prior art, this invention provides an improved YOLOv11n face detection algorithm, AFAS-YOLO, to enhance the model's detection accuracy and adaptability in complex environments.
[0006] The first aspect of this invention proposes an improved generative face detection method for YOLOv11n, comprising: Build and train a generative face detection model based on YOLOv11n. The face image to be detected is input into the trained generative face detection model, and the detection result is output. The generative face detection model includes a backbone network, a feature fusion network, and a detection head; The backbone network is used for image feature extraction, and an adaptive residual downsampling module is introduced into the backbone network. The adaptive residual downsampling module integrates the adaptive downsampling mechanism, the residual aligned convolution module, the convolutional block channel attention mechanism, and the parallel path structure for dynamic adjustment and effective fusion of information.
[0007] The feature fusion network is used to fuse image features at different scales. A multi-scale fusion module is introduced into the feature fusion network. The multi-scale fusion module completes the fusion and reconstruction of semantic information at different levels through multi-branch spatial adaptive convolution and a unified scale alignment strategy. In addition, a multi-branch fully connected transformation structure is established using a SaE channel attention module to complete channel correlation modeling and dynamic weight allocation. The detection head is used to output the detection results.
[0008] As a preferred embodiment, the backbone network includes a first Conv module, a second Conv module, a first C3k2 module, a first adaptive residual downsampling module, a second C3k2 module, a second adaptive residual downsampling module, a third C3k2 module, a third adaptive residual downsampling module, an SPPF module, and a C2PSA module connected in sequence, and provides input to the feature fusion network through the second C3k2 module, the third C3k2 module, and the C2PSA module, respectively.
[0009] As a preferred embodiment, the feature fusion network includes a first Upsample module, a first multi-scale fusion module, a fourth C3k2 module, a second Upsample module, a second multi-scale fusion module, a fifth C3k2 module, a first SaE channel attention module, a third Conv module, a first Concat module, a sixth C3k2 module, a second SaE channel attention module, a fourth Conv module, a second Concat module, a seventh C3k2 module, and a third SaE channel attention module connected in sequence. The first multi-scale fusion module simultaneously receives the output of the second C3k2 module; the second multi-scale fusion module simultaneously receives the output of the third C3k2 module; the first Concat module simultaneously receives the output of the fourth C3k2 module; the second Concat module simultaneously receives the output of the C2PSA module; and the first SaE channel attention module, the second SaE channel attention module, and the third SaE channel attention module all output to the detection head.
[0010] As a preferred embodiment, the adaptive residual downsampling module includes an input module, a residual branch convolution module, an adaptive downsampling mechanism, a residual aligned convolution module, a batch normalization module, a SiLU activation function module, a convolutional block attention mechanism, a fusion output convolution module, and a final output module; wherein, The input module is connected to the input ends of the residual branch convolution module, the adaptive downsampling mechanism, and the residual aligned convolution module, respectively. The output end of the residual branch convolution module is connected to the final output module. The output ends of the adaptive downsampling mechanism and the residual aligned convolution module are both connected to the input end of the batch normalization module. The output end of the batch normalization module is connected to the final output end via the SiLU activation function module, the convolutional block attention mechanism, and the fusion output convolution module. The final output end and the residual branch convolution module complete the dimension alignment and output the result.
[0011] As a preferred embodiment, the adaptive downsampling mechanism includes: After reducing the spatial size of the input features by average pooling, the input is fed into two branches; one branch is downsampled by a convolution kernel; the other branch is downsampled by a convolution kernel after max pooling; the outputs of the two branches are concatenated along the channel dimension and then fused using the SiLU activation function before output.
[0012] As a preferred embodiment, the residual aligned convolution module includes: dynamically adjusting the standard convolution weights by introducing a weight mapping function to obtain aligned convolution weights, and then using the aligned convolution weights to calculate the output features.
[0013] As a preferred embodiment, the convolutional block attention mechanism includes: channel attention using average pooling and max pooling to generate channel weights; spatial attention by concatenating average and max pooling features compressed from the channels and applying 7×7 convolution to calculate spatial weights; and input features are weighted sequentially using channel weights and spatial weights.
[0014] As a preferred embodiment, the multi-scale fusion module includes: Adjust all input features to the target scale; Features at each scale are transformed using switchable dilated convolutions, which include local branches and context branches. The outputs of the local and context branches are adaptively fused using a structure switching factor. The local branches use regular convolutions for texture and edge detail extraction, while the context branches use dilated convolutions to enhance global semantic understanding. The transformed features are then additively fused and normalized, provided that the channels are aligned with the dimensions. The output features are obtained by integrating the features of each channel through 1×1 convolution. The final output feature is obtained by superimposing the output features through residual connections of the input features.
[0015] As a preferred embodiment, the SaE channel attention module includes: Global average pooling is performed on the input features to generate channel description vectors; The channel description vector is input into multiple parallel fully connected paths, each path containing a layer of dimension reduction linear transformation and ReLU activation; Multiple parallel fully connected paths are concatenated at the channel dimension to form a joint representation; The joint representation generates channel attention weights through a linear mapping layer and a Sigmoid activation. After extending the channel attention weights to the spatial dimension, they are multiplied element-wise with the original input features to complete the channel weighting.
[0016] A second aspect of the present invention proposes a system comprising a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed corresponding to the improved YOLOv11n generative face detection method as described in the first aspect.
[0017] A third aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, are used to implement the process corresponding to the improved YOLOv11n generative face detection method described in the first aspect.
[0018] Compared with existing technologies, the advantages of adopting the above technical solution are as follows: This invention helps to build a more secure and reliable identity verification mechanism, providing technical support for risk prevention and social governance of generative faces. The proposed detection method has significant advantages in generative face detection tasks and is highly practical. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the network structure of the generative face detection model proposed in an embodiment of the present invention.
[0020] Figure 2 This is a schematic diagram of the adaptive residual downsampling module structure proposed in an embodiment of the present invention.
[0021] Figure 3(a) is a schematic diagram of the network structure of the convolutional block channel attention mechanism proposed in an embodiment of the present invention; Figure 3(b) is a schematic diagram of the network structure of the adaptive downsampling mechanism proposed in an embodiment of the present invention; Figure 3(c) is a schematic diagram of the network structure of the residual aligned convolutional module proposed in an embodiment of the present invention.
[0022] Figure 4 This is a schematic diagram of the multi-scale fusion module network structure proposed in an embodiment of the present invention.
[0023] Figure 5 This is a schematic diagram of the network structure of the SaE channel attention module in an embodiment of the present invention.
[0024] Figure 6(a) shows the detection effect of the original model, and Figure 6(b) shows the detection effect of the generative face detection model proposed in the embodiment of the present invention.
[0025] Figure 7 This is a system schematic diagram of an embodiment of this application.
[0026] Figure 8 This is a schematic diagram of the structure of a computer system suitable for implementing the system of the embodiments of this application. Detailed Implementation
[0027] The embodiments of this application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar modules or modules having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application. Rather, the embodiments of this application include all variations, modifications, and equivalents falling within the spirit and scope of the appended claims.
[0028] In response to the increasing risks of deepfakes and identity theft, this invention proposes an improved generative face detection method for YOLOv11n, which can simultaneously achieve high-precision detection and efficient deployment. The specific solution is as follows: S100. Establish a generative face detection model based on YOLOv11n and complete its training.
[0029] S200. Input the face image to be detected into the trained generative face detection model and output the detection result.
[0030] The key feature of the improved YOLOv11n generative face detection method proposed in this embodiment of the invention lies in the design of the generative face detection model.
[0031] YOLOv11, based on a lightweight CSP (Cross Stage Partial) network structure, combines multi-scale feature fusion and a fast feature pyramid design to achieve high real-time efficiency and high detection accuracy. However, when faced with generatively forged face images, its ability to distinguish subtle differences between forged textures and real details is insufficient, leading to false detections and failing to meet the requirements of high-security scenarios. Therefore, this embodiment proposes a generative face detection model, AFAS-YOLO (Adaptive Fusion Attention Shield-YOLO), which is an improvement on YOLOv11 and mainly consists of three parts: a backbone network, a feature fusion network (Neck), and a detection head (Detect).
[0032] The backbone network is primarily used for image feature extraction. In this embodiment, an adaptive residual downsampling module (ArDown) is designed into the backbone network. ArDown integrates the adaptive downsampling mechanism (ADown), the residual-aligned convolutional module (RefConv), the convolutional block attention module (CBAM), and a parallel path structure for dynamic adjustment and effective fusion of information. By organically combining the adaptive downsampling mechanism (ADown), the residual-aligned convolutional module (RefConv), the convolutional block attention module (CBAM), and parallel branches, the information flow can be intelligently adjusted according to the spatial and channel distribution of the feature map, thereby reducing the loss of detail caused by downsampling and improving multi-scale representation capabilities.
[0033] Feature fusion networks are primarily used to fuse image features at different scales. In this embodiment, a multi-scale fusion module, FSAFasion (Feature-aligned Scale-aware Fusion), is designed within the feature fusion network. This module uses multi-branch spatial adaptive convolution (SAConv2d) and a unified scale alignment strategy to reconstructively integrate semantic features at different levels, significantly enhancing the capture and discrimination of local forged regions. Simultaneously, a SaE channel attention module, SENetV2, is introduced to establish a multi-branch fully connected transformation structure, completing channel correlation modeling and dynamic weight allocation. This enables efficient attention recalibration across channel dimensions, further amplifying the differences between real and forged features.
[0034] The detection head is used to output the detection results.
[0035] The generative face detection model AFAS-YOLO, with the above-mentioned improvements, has significantly enhanced both its generative face detection performance and inference speed in complex scenarios.
[0036] Specifically, Figure 1 The network structure of the generative face model AFAS-YOLO proposed in this embodiment is shown. The backbone network includes a first Conv module, a second Conv module, a first C3k2 module, a first adaptive residual downsampling module, a second C3k2 module, a second adaptive residual downsampling module, a third C3k2 module, a third adaptive residual downsampling module, an SPPF module, and a C2PSA module, which are connected sequentially. The second C3k2 module, the third C3k2 module, and the C2PSA module provide input to the feature fusion network, respectively.
[0037] The feature fusion network includes a first Upsample module, a first multi-scale fusion module, a fourth C3k2 module, a second Upsample module, a second multi-scale fusion module, a fifth C3k2 module, a first SaE channel attention module, a third Conv module, a first Concat module, a sixth C3k2 module, a second SaE channel attention module, a fourth Conv module, a second Concat module, a seventh C3k2 module, and a third SaE channel attention module connected in sequence. The first multi-scale fusion module simultaneously receives the output of the second C3k2 module; the second multi-scale fusion module simultaneously receives the output of the third C3k2 module; the first Concat module simultaneously receives the output of the fourth C3k2 module; the second Concat module simultaneously receives the output of the C2PSA module; the first SaE channel attention module, the second SaE channel attention module, and the third SaE channel attention module all output to the detection head.
[0038] exist Figure 1 In the network structure shown, the Conv module, C3k2 module, SPPF module, C2PSA module, Upsample module, and Concat module are all existing modules in YOLOv11. In this embodiment, each module is briefly described.
[0039] Conv modules (the first and second Conv modules in the backbone network): perform preliminary convolution operations on the input face image to extract basic image features, such as edges and textures, laying the foundation for subsequent feature extraction.
[0040] C3k2 module: This module is used to further extract and enhance features. Through a specific network structure design, it can better capture mid-level semantic features in face images, while helping to reduce computation.
[0041] SPPF module: Through spatial pyramid pooling operations, features are fused and aggregated at multiple scales, enhancing the expressive power of features and enabling the model to better handle face targets of different sizes.
[0042] The C2PSA module is responsible for extracting high-level semantic features and using an attention mechanism to focus on key areas of the face, thereby enhancing the discriminative power of the features and providing more valuable information for subsequent feature fusion.
[0043] The Upsample module upsamples the size of the feature map to match the size of other feature maps at different scales, facilitating cross-scale feature fusion.
[0044] The Concat module stitches feature maps from different sources along the channel dimension, integrating multi-scale and multi-stage feature information to further enrich the expression of features.
[0045] The Conv module (the third and fourth Conv modules in the feature fusion module) performs further convolution processing on the fused feature map, adjusts the number of channels in the feature map, and optimizes the feature representation.
[0046] Next, the improvements in the generative face detection model proposed in this embodiment of the invention will be described in detail: Traditional convolutional algorithms have certain limitations in generative face image detection tasks. These limitations primarily manifest as weak adaptability to details in different regions, difficulty in fully capturing subtle features of forged regions, and insufficient information exchange across scales and channels, resulting in limited ability to distinguish highly realistic forged samples. To overcome these shortcomings, this embodiment introduces an adaptive residual downsampling module to replace the traditional convolutional structure, improving the model's sensitivity to forged details and its multi-scale feature fusion capability. Please refer to [reference needed]. Figure 2 The adaptive residual downsampling module ArDown integrates the convolutional block attention mechanism CBAM (as shown in Figure 3(a), the adaptive downsampling mechanism ADown (as shown in Figure 3(b), and the residual aligned convolutional module RefConv (as shown in Figure 3(c)). It employs a dual-path parallel design to fully leverage the advantages of each sub-module, achieving dynamic adjustment and effective fusion of information. The input feature map is denoted as XϵR^(C×H×W), where C, H, and W represent the number of channels, height, and width, respectively. The input feature map of this module is denoted as... Where C, H, and W represent the number of channels, height, and width, respectively.
[0047] Specifically, the adaptive residual downsampling module ArDown includes an input module Input, a residual branch convolution module Refconv, an adaptive downsampling mechanism Adown, a residual aligned convolution module Conv2d(res), a batch normalization module BatchNorm, a SiLU activation function module SILU, a convolutional block attention mechanism CBAM, a fusion output convolution module Conv2d(fuse), and a final output module Output. The input module Input is connected to the residual branch convolution module Refconv, the adaptive downsampling mechanism Adown, and the residual aligned convolution module Conv2d. The input of the residual branch convolutional module Conv2d(res) is connected to the final output module Output. The outputs of the adaptive downsampling mechanism Adown and the residual alignment convolutional module Refconv are both connected to the input of the batch normalization module BatchNorm. The output of the batch normalization module BatchNorm is sequentially connected to the SiLU activation function module SILU, the convolutional block attention mechanism CBAM, and the fusion output convolutional module Conv2d(fuse) to the final output module Output. The final output module Output and the residual branch convolutional module complete the dimension alignment and output the result. That is to say, in the adaptive residual downsampling module ArDown proposed in this embodiment, the adaptive downsampling mechanism Adown and the residual alignment convolutional module Refconv form two paths to process the features respectively. Then, through channel concatenation, fusion using batch normalization and SiLU activation function, and channel and spatial attention weighting, the final output is formed with the residual branch. The working process of the entire adaptive residual downsampling module ArDown is described below: Please refer to Figure 3(b). The implementation process of the adaptive downsampling mechanism Adown is as follows: The spatial size of the input feature X is reduced by a two-dimensional average pooling operation to obtain... Then, the channel is split into two branches. The first branch is weighted by a 3×3 convolution kernel. Perform downsampling (the second branch first performs downsampling) (Perform two-dimensional max pooling operation), then pass through 1×1 convolution kernel weights. Perform downsampling: (1) The outputs of the two branches are concatenated along the channel dimension and then fused using the SiLU activation function: (2) Please refer to Figure 3(c). The implementation process of the residual aligned convolution module RefConv is as follows: Construct trainable basis weights W and frozen basis weights branches. The trainable branch directly performs depthwise separable convolution on the input feature map X, outputting: (3) The frozen branches are first subjected to a refocusing transformation to obtain the fusion weights: (4) Then convolve X to output: (5) Ultimately achieved through residual fusion: (6) Please continue to refer to this. Figure 2 The output of the adaptive downsampling mechanism in the main path The output y of the convolutional module aligned with the residuals in the auxiliary path is concatenated through channels and then fused using batch normalization (BatchNorm) and the SiLU activation function. (7) To ensure channel number matching, the fused features are zero-padding or cropped, and then channel fusion is performed through 1×1 convolution. The fused features are then fed into the Convolutional Block Attention (CBAM) mechanism (see Figure 3(a)). CBAM then uses channel attention... and spatial attention The two parts focus on key feature information. Channel attention utilizes average pooling. and max pooling Generate channel weights: (8) Spatial attention is achieved by concatenating average and max-pooling features from channel compression, and then applying... Convolution calculation: (9) Attention-weighted features sequentially apply channel and spatial weights to the input features: (10) Finally, the fused features are combined with the input residual branch. Perform element-wise addition to obtain the final output: (11) in, This represents element-wise multiplication. It is the Sigmoid activation function. This represents the convolution operation. These represent global average pooling and max pooling, respectively. The convolution operation, where M is the weight mapping function, and * denotes convolution computation. For residual input, The activation function is used; the MLP is a multilayer perceptron. Residual input. The module input feature X is directly skipped to ensure the complete transmission of key information and the stability of the gradient flow.
[0048] Therefore, this module, through multi-path fusion adaptive downsampling mechanism, residual aligned convolution and convolutional block attention mechanism, can fully mine and enhance key micro-features and multi-scale semantic information in generative face images, significantly improving the accuracy and recall of the detection model.
[0049] Furthermore, in feature fusion networks, traditional multi-scale feature fusion methods typically integrate feature maps from different levels using direct concatenation or weighted summation. However, these methods suffer from difficulties in information alignment and semantic conflicts when dealing with features with large scale and strong semantic differences. This is particularly problematic in generative face forgery detection, where the fused feature representation capabilities are often diminished, failing to fully extract fine-grained semantic information from forged regions. To address these issues, this embodiment proposes a multi-scale fusion module, FSAfusion, to replace the traditional concatenation fusion strategy. This module achieves dynamic consistency alignment and fusion enhancement of cross-scale semantic information, improving sensitivity and discriminative power for local forged regions.
[0050] The following is combined with Figure 4 The schematic diagram of the multi-scale fusion module FSAFusion network structure shown illustrates the specific implementation process.
[0051] The input to this module is a set of feature maps at multiple scales. in, These represent the number of channels, height, and width of the feature in the i-th layer, respectively.
[0052] First, all input features are resized to the target scale (H, W) to unify the spatial resolution. For each input feature... If its size is larger than the target size, then adaptive average pooling is used: (12) If its size is smaller than the target scale, then it is upsampled using bilinear interpolation: (13) After unifying the dimensions, features at each scale are first fed into a spatial attention convolution for feature transformation. The spatial attention convolution contains two parallel paths: a local branch. : Uses regular convolution, focusing on texture and edge detail extraction. Context branching. Dilated convolutions are used to expand the receptive field and enhance global semantic understanding. The two-branch outputs are processed through a structure switching factor. Adaptive fusion is performed to obtain the output features: (14) in These are learnable parameters, typically obtained through a... Convolutional processing with a sigmoid activation function generates features that can be dynamically adjusted based on spatial location, resulting in enhanced features at each scale. Then, perform additive fusion while ensuring channel dimension alignment: (15) The fusion features were then normalized to their mean. (16) Finally passed Convolution performs channel compression to obtain the output feature Y: (17) The residual design of this module gives it stable gradient flow capability, which helps to prevent the loss of core information of the input features: (18) in, This represents element-wise multiplication. It is the Sigmoid activation function. This represents the convolution operation. , representing global average pooling and max pooling, respectively. This represents a 7×7 convolution operation, where M is the weight mapping function, and * indicates convolution computation. is the activation function, and MLP is a multilayer perceptron. The residual input is the main branch, which is the original feature from the backbone network.
[0053] This module unifies the scale of multi-path input features, processes different path features separately using multiple spatial attention convolutions (including convolutions with attention mechanisms), performs additive fusion and mean averaging, and finally integrates the output through 1x1 convolution. This fully mines and enhances key micro-features and multi-scale semantic information in generative face images, significantly improving the accuracy and recall of the detection model.
[0054] Furthermore, traditional attention mechanisms typically employ single-path global average pooling for channel weight calculation. While this enhances feature representation, it is often insufficient to fully capture complex inter-channel relationships when dealing with generative face forgery detection, limiting the model's ability to identify key micro-features. To address this issue, this embodiment introduces the SaE attention module SENetV2, which utilizes a multi-branch fully connected transformation structure to achieve richer channel correlation modeling and dynamic weight allocation. The SaE attention module structure is as follows: Figure 4 As shown.
[0055] Specifically, the input to the SaE attention module is the feature map. Where C, H, and W represent the number of channels, height, and width, respectively. The specific implementation process is as follows: First, global average pooling is performed on the input feature X to generate channel description vectors: (19) Subsequently, Z is fed into multiple parallel fully connected paths, each containing a layer of dimensionality reduction linear transformation and ReLU activation: (20) in, Let r be the weight matrix for the k-th branch and be the dimensionality reduction ratio. The outputs of the four paths are concatenated along the channel dimension to form a joint representation: (twenty one) Next, channel attention weights are generated through a linear mapping layer and sigmoid activation: (twenty two) in, It is a fusion weight matrix. This represents the Sigmoid function. Finally, the channel weights are... After expanding to the spatial dimension, it is multiplied element-wise with the original features to complete the channel weighting: (twenty three) in, This represents element-wise multiplication. Indicates that the broadcast has been extended to The weight tensor.
[0056] In this embodiment, the multi-branch parallel structure effectively increases the expressive power of channel attention, enabling the capture of more fine-grained and diverse inter-channel dependencies. With this module introduced, the model becomes more sensitive to forgery details in generative face forgery detection tasks, strengthening the distinction between real and forged facial regions, resulting in more discriminative feature representation and significantly improving detection accuracy and recall.
[0057] To verify the feasibility of the generative face detection model and method proposed in this invention, this embodiment also presents a specific verification process, which includes: (1) Dataset creation and evaluation metrics In this embodiment, the face dataset is divided into two categories: the high-quality FFHQ and CelebA face datasets. The generative face dataset is generated by StyleGAN3, consisting of 1952 labeled images. The dataset is divided into training, validation, and test sets in an 8:1:1 ratio. Six metrics were selected in this experiment, including precision (P), recall (R), average detection accuracy (mAP) (including mAP@50% and mAP@50%~90%), number of parameters, and computational cost.
[0058] (2) Experimental environment and parameter settings The experiment was run on a Win11 system with an AMD Ryzen 7 7745HX processor with Radeon Graphics, 16GB of DDR5 RAM, an NVIDIA GeForce RTX 4070 Laptop GPU, and Python 3.8, PyTorch 2.3.0 + cu118. The input image size was set to 256×256 by default. The parameters are shown in Table 1.
[0059] Table 1 Training parameters
[0060] (3) Ablation test In this embodiment, four ablation experiments were designed, with each experiment conducted under the same conditions. The results of the ablation experiments are shown in Table 2.
[0061] Table 2 Ablation Experiment Results
[0062] As shown in Table 2, after introducing the adaptive residual downsampling module ArDown, the precision of Group 2 improved by 3.9%, mAP@50% by approximately 3.0%, and mAP@50%-90% by approximately 2.0%. Simultaneously, the number of model parameters decreased from 2.58M to 2.51M, the computational cost remained at 6.3 GFLOPs, and the recall slightly decreased. This indicates that the adaptive residual downsampling module ArDown significantly improved the model's detection accuracy without increasing the computational burden. Group 3 further introduced the multi-scale fusion module FSAFusion based on Group 2, resulting in a 1.8% improvement in precision. Furthermore, the computational cost decreased from 6.3 GFLOPs to 5.7 GFLOPs, the number of parameters slightly increased, and mAP@50% and recall slightly decreased. This demonstrates that FSAFusion can further improve detection performance and optimize computational efficiency to some extent, despite a slight increase in parameters and a decrease in recall. Group 4 further introduced the SaE channel attention module based on Group 3, resulting in a 6.4% improvement in precision, approximately a 4.8% improvement in mAP@50%, and approximately a 2.3% improvement in mAP@50%-90%. Simultaneously, the number of parameters increased slightly, and the recall decreased slightly, but the computational cost remained at 5.7 GFLOPs. Overall, the SaE channel attention module improved detection accuracy while maintaining low computational cost, and despite the slight decrease in recall, the overall detection performance was effectively enhanced.
[0063] Ablation experiments show that the generative face detection model proposed in this invention performs well during training, but further comparison with the original model in actual detection is needed. The comparison of detection performance between the original model and the generative face detection model of this invention is shown in Figures 6(a) and 6(b), where two images are grouped together: the left image is the real image, and the right image is the AI-generated image. It can be seen that the traditional model misdetects the first group of images, while the model of this invention significantly enhances the ability to recognize both real and AI-generated faces, correctly detecting the authenticity of the images and effectively optimizing detection accuracy, thus more reliably distinguishing between the two types of faces. This fully demonstrates that the model of this invention possesses superior recognition ability and detection accuracy in face detection scenarios, demonstrating significant effectiveness.
[0064] To intuitively and fully demonstrate the outstanding advantages of the model proposed in this invention, comparative experiments were conducted with several mainstream algorithms widely used and exhibiting excellent performance in the current object detection field. These included YOLO series algorithms such as YOLOv5s, YOLOv5n, YOLOv8n, YOLOv9t, YOLOv10n, and YOLOv11n. The results are shown in Table 3. Table 3 Comparison of different models
[0065] As shown in Table 3, the improved generative face detection model AFAS-YOLO of this invention outperforms the compared models YOLOv5n (75.2%), YOLOv5s (77.8%), YOLOv8n (77.3%), YOLOv9t (77.2%), YOLOv10n (73.9%), and YOLOv11n (77.2%) in terms of mean accuracy (mAP50) with 84% accuracy. Although the compared models have fewer parameters and lower computational complexity than the model of this invention, their mAP50 performance is significantly lower. Therefore, the improved generative face detection model of this invention has higher accuracy, meets the requirements of real-time monitoring, and demonstrates superior performance in generative face detection tasks, enabling efficient and high-precision detection.
[0066] Reference Figure 7 As shown, a system 100 according to an embodiment of this application includes: a memory 101 and a processor 102, wherein the memory 101 stores a computer program corresponding to the aforementioned improved YOLOv11n generative face detection method that can be loaded by the processor 102 and executed.
[0067] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0068] It should be noted that, Figure 8 The computer system 200 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0069] like Figure 8 As shown, the computer system 200 includes a Central Processing Unit (CPU) 201, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 202 or programs loaded from Storage Section 208 into Random Access Memory (RAM) 203, such as performing the methods described in the above embodiments. The RAM 203 also stores various programs and data required for system operation. The CPU 201, ROM 202, and RAM 203 are interconnected via a bus 204. An Input / Output (I / O) interface 205 is also connected to the bus 204.
[0070] The following components are connected to I / O interface 205: an input section 206 including a keyboard, mouse, etc.; an output section 207 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to I / O interface 205 as needed. A removable storage medium 211, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 210 as needed so that computer programs read from it can be installed into storage section 208 as needed.
[0071] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 209, and / or installed from removable storage medium 211. When the computer program is executed by central processing unit (CPU) 201, it performs various functions defined in the system of this application.
[0072] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0073] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0074] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0075] In another aspect, this application also provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the improved YOLOv11n generative face detection method described in the above embodiments.
[0076] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to implement the improved YOLOv11n generative face detection method described in the above embodiments.
[0077] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0078] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0079] For those skilled in the art, the specific meanings of the above terms in this invention can be understood according to the specific circumstances; the accompanying drawings in the embodiments are used to clearly and completely describe the technical solutions in the embodiments of this invention. Obviously, the described embodiments are some embodiments of this invention, but not all embodiments. Generally, the components of the embodiments of this invention described and shown in the accompanying drawings can be arranged and designed in various different configurations.
[0080] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. An improved generative face detection method for YOLOv11n, characterized in that, include: Build and train a generative face detection model based on YOLOv11n. The face image to be detected is input into the trained generative face detection model, and the detection result is output. The generative face detection model includes a backbone network, a feature fusion network, and a detection head; The backbone network is used for image feature extraction, and an adaptive residual downsampling module is introduced into the backbone network. The adaptive residual downsampling module integrates the adaptive downsampling mechanism, the residual aligned convolution module, the convolutional block channel attention mechanism, and the parallel path structure for dynamic adjustment and effective fusion of information. The feature fusion network is used to fuse image features at different scales. A multi-scale fusion module is introduced into the feature fusion network. The multi-scale fusion module completes the fusion and reconstruction of semantic information at different levels through multi-branch spatial adaptive convolution and a unified scale alignment strategy. In addition, a multi-branch fully connected transformation structure is established using a SaE channel attention module to complete channel correlation modeling and dynamic weight allocation. The detection head is used to output the detection results.
2. The improved YOLOv11n generative face detection method according to claim 1, characterized in that, The backbone network includes a first Conv module, a second Conv module, a first C3k2 module, a first adaptive residual downsampling module, a second C3k2 module, a second adaptive residual downsampling module, a third C3k2 module, a third adaptive residual downsampling module, an SPPF module, and a C2PSA module connected in sequence. The second C3k2 module, the third C3k2 module, and the C2PSA module provide input to the feature fusion network, respectively.
3. The improved generative face detection method for YOLOv11n according to claim 2, characterized in that, The feature fusion network comprises, in sequence, a first Upsample module, a first multi-scale fusion module, a fourth C3k2 module, a second Upsample module, a second multi-scale fusion module, a fifth C3k2 module, a first SaE channel attention module, a third Conv module, a first Concat module, a sixth C3k2 module, a second SaE channel attention module, a fourth Conv module, a second Concat module, a seventh C3k2 module, and a third SaE channel attention module. The first multi-scale fusion module simultaneously receives the output of the second C3k2 module; the second multi-scale fusion module simultaneously receives the output of the third C3k2 module; the first Concat module simultaneously receives the output of the fourth C3k2 module; the second Concat module simultaneously receives the output of the C2PSA module; and the first SaE channel attention module, the second SaE channel attention module, and the third SaE channel attention module all output to the detection head.
4. The improved YOLOv11n generative face detection method according to claim 1, characterized in that, The adaptive residual downsampling module includes an input module, a residual branch convolution module, an adaptive downsampling mechanism, a residual aligned convolution module, a batch normalization module, a SiLU activation function module, a convolutional block attention mechanism, a fused output convolution module, and a final output module; wherein... The input module is connected to the input ends of the residual branch convolution module, the adaptive downsampling mechanism, and the residual aligned convolution module, respectively. The output end of the residual branch convolution module is connected to the final output module. The output ends of the adaptive downsampling mechanism and the residual aligned convolution module are both connected to the input end of the batch normalization module. The output end of the batch normalization module is connected to the final output end via the SiLU activation function module, the convolutional block attention mechanism, and the fusion output convolution module. The final output end and the residual branch convolution module complete the dimension alignment and output the result.
5. The improved YOLOv11n generative face detection method according to claim 4, characterized in that, The adaptive downsampling mechanism includes: After reducing the spatial size of the input features by average pooling, the input is fed into two branches; one branch is downsampled by a convolution kernel; the other branch is downsampled by a convolution kernel after max pooling; the outputs of the two branches are concatenated along the channel dimension and then fused using the SiLU activation function before output.
6. The improved generative face detection method for YOLOv11n according to claim 4 or 5, characterized in that, The residual aligned convolution includes: dynamically adjusting the standard convolution weights by introducing a weight mapping function to obtain aligned convolution weights, and then using the aligned convolution weights to calculate the output features.
7. The improved YOLOv11n generative face detection method according to claim 4, characterized in that, The convolutional block attention mechanism includes: channel attention uses average pooling and max pooling to generate channel weights; spatial attention concatenates the average and max pooling features of the channel compression and applies 7×7 convolution to calculate spatial weights; and the input features are weighted sequentially using channel weights and spatial weights.
8. The improved generative face detection method for YOLOv11n according to claim 1, characterized in that, The multi-scale fusion module includes: Adjust all input features to the target scale; Features at each scale are transformed using switchable dilated convolutions, which include local branches and context branches. The outputs of the local and context branches are adaptively fused using a structure switching factor. The local branches use regular convolutions for texture and edge detail extraction, while the context branches use dilated convolutions to enhance global semantic understanding. The transformed features are then additively fused and normalized, provided that the channels are aligned with the dimensions. The output features are obtained by integrating the features of each channel through 1×1 convolution. The final output feature is obtained by superimposing the output features through residual connections of the input features.
9. A system, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed corresponding to the generative face detection method of the improved YOLOv11n as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, It stores computer program instructions, which, when executed by a processor, are used to implement the process corresponding to the improved YOLOv11n generative face detection method as described in any one of claims 1 to 8.