A fake face detection method based on improved YOLOv5 and multi-branch Xception
By introducing a three-layer BiFPN structure and a multi-branch Xception network into the YOLOv5 detection network, combined with an improved Mish activation function and a hybrid pooling strategy, the problem of low accuracy in face forgery detection in existing technologies is solved, achieving higher detection accuracy and robustness in complex scenarios.
Patent Information
- Application Number
- CN202511308793.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-15
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-09-15
AI Technical Summary
Existing face forgery detection methods based on image classification have low detection accuracy, especially poor robustness in complex scenarios.
The Neck module in the improved YOLOv5 detection network is replaced with a three-layer BiFPN structure, and the target face image is input into a multi-branch Xception network to generate forgery probability. Feature extraction capability is enhanced by multi-branch convolutional modules and an improved Mish activation function, and detection accuracy is improved by combining a hybrid pooling strategy.
It improves the accuracy and robustness of face forgery detection in complex scenarios, enhances the ability to capture forged features, and improves the adaptability and accuracy of the detection method.
Smart Images

Figure CN120808455B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image object detection, specifically involving a method for detecting fake faces based on improved YOLOv5 and multi-branch Xception. Background Technology
[0002] With the rapid development of deep learning technology, facial image forgery technology based on Generative Adversarial Networks (GANs) has become increasingly sophisticated. Representative applications such as DeepFake can generate highly realistic facial images or video content. While this type of deepfake technology is widely used in film and entertainment, virtual reality, and other fields, it has also raised serious concerns about public safety, public opinion manipulation, and identity fraud.
[0003] Among related technologies, the main technical approaches for face forgery detection include image classification, frequency domain analysis, physiological signal capture, and image residual modeling. Image classification-based face forgery detection methods are widely used due to their versatility and simplicity. These methods typically use the entire image as input and employ convolutional neural network (CNN) models for feature extraction and binary classification. Research using architectures such as Visual Geometry Group (VGG), ResNet, and Xception has yielded some success.
[0004] However, because these methods use the entire image as input, their detection accuracy is often low. Summary of the Invention
[0005] The purpose of this application is to provide a fake face detection method based on improved YOLOv5 and multi-branch Xception, which can solve the problem of how to improve the detection accuracy of fake face detection methods.
[0006] To solve the above-mentioned technical problems, this application is implemented as follows:
[0007] In a first aspect, embodiments of this application provide a method for detecting fake faces based on improved YOLOv5 and multi-branch Xception, the method comprising:
[0008] The target face image is determined; the target face image is obtained by cropping the original input image based on the target detection box provided by the YOLOv5 detection network; the PAN+FPN structure of the Neck module in the YOLOv5 detection network is replaced with a three-layer BiFPN structure;
[0009] The target face image is input into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network includes multiple convolutional branches.
[0010] Based on the forgery probability, the detection result of face forgery detection is determined.
[0011] Optionally, during the training phase, the input to the YOLOv5 detection network is obtained, including:
[0012] Acquire multiple training images;
[0013] The training images are subjected to pixel normalization processing to obtain multiple normalized images;
[0014] The normalized image is scaled and stitched together to obtain the input of the YOLOv5 detection network.
[0015] Optionally, determining the target face image includes:
[0016] Determine the original input image;
[0017] The original input image is input into the YOLOv5 detection network to obtain multiple candidate detection boxes;
[0018] The target detection box is obtained by eliminating redundant parts of the candidate detection box based on nonmaximum suppression.
[0019] The target face image is obtained by cropping from the original input image based on the target detection box.
[0020] Optionally, the multi-branch Xception network includes at least a multi-branch convolutional module and a Stem layer, wherein the multi-branch convolutional module includes... The method involves parallel depthwise separable convolutional branches; the step of inputting the target face image into a multi-branch Xception network to generate a forgery probability includes:
[0021] Based on the Stem layer, input features are extracted from the target face image;
[0022] Input the input features into the Each parallel depthwise separable convolutional branch is used to obtain the intermediate features corresponding to each parallel depthwise separable convolutional branch.
[0023] right Channel concatenation is performed on the intermediate features, and the concatenated features are then processed. Convolutional compression yields the target output features;
[0024] Based on the target output features, a forgery probability is generated.
[0025] Optionally, the activation function in the parallel depthwise separable convolution branch is Mish, and the function representation of Mish is as follows:
[0026]
[0027] in, This is the output of a convolutional layer or a fully connected layer. is the base of the natural logarithm. Represents the natural logarithm function. This represents the hyperbolic tangent function.
[0028] Optionally, generating the forgery probability based on the target output features includes:
[0029] Perform global average pooling and global max pooling operations on the target output features to obtain the pooled features;
[0030] The pooled features are input into a fully connected layer to generate a forgery probability.
[0031] Optionally, determining the detection result of face forgery detection based on the forgery probability includes:
[0032] The combined forgery probability is obtained by weighted summing the confidence level provided by the YOLOv5 detection network and the forgery probability.
[0033] Based on the comprehensive forgery probability, the detection result of face forgery detection is determined.
[0034] Secondly, embodiments of this application provide a fake face detection device, the fake face detection device comprising:
[0035] An image processing module is used to determine a target face image; the target face image is obtained by cropping the original input image based on the target detection box provided by the YOLOv5 detection network; the PAN+FPN structure of the Neck module in the YOLOv5 detection network is replaced with a three-layer BiFPN structure;
[0036] The forgery detection module is used to input the target face image into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network includes multiple convolutional branches.
[0037] The forgery detection module is used to determine the detection result of face forgery detection based on the forgery probability.
[0038] Thirdly, embodiments of this application provide a computer device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0039] Fourthly, embodiments of this application provide a computer-readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0040] Fifthly, embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.
[0041] This application proposes a method for detecting forged faces based on an improved YOLOv5 and multi-branch Xception network. The method includes: determining a target face image; cropping the target face image from the original input image using a target detection bounding box provided by a YOLOv5 detection network; replacing the PAN+FPN structure of the Neck module in the YOLOv5 detection network with a three-layer BiFPN structure; inputting the target face image into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network including multiple convolutional branches; and determining the detection result of the forgery detection based on the forgery probability. This method improves the detection accuracy of the forgery detection method by cropping the image and then inputting the cropped target face image into the multi-branch Xception network for forgery detection, rather than directly inputting the target face image into the multi-branch Xception network. The reason is that the forged area often only appears in a small part of the image. Classifying the whole image may cover up the forged features, thus reducing the detection accuracy. However, classifying the target face image after cropping can avoid covering up the forged features, making the detection method sensitive to the regional information of the image and thus improving the detection accuracy. Attached Figure Description
[0042] Figure 1 This is a flowchart illustrating a method for detecting fake faces based on improved YOLOv5 and multi-branch Xception, provided in some embodiments of this application.
[0043] Figure 2 These are schematic diagrams illustrating the improved YOLOv5 network structure provided in some embodiments of this application;
[0044] Figure 3 These are schematic diagrams of the BiFPN multi-scale feature fusion structure provided in some embodiments of this application;
[0045] Figure 4 This is a diagram of a multi-branch Xception network structure provided in some embodiments of this application;
[0046] Figure 5This is a structural block diagram of a fake face detection device provided in some embodiments of this application;
[0047] Figure 6 These are internal structural diagrams of a computer device provided in some embodiments of this application. Detailed Implementation
[0048] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] In the specification and claims of this application, "and / or" means at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0050] In one exemplary embodiment, such as Figure 1 As shown, a method for detecting fake faces based on improved YOLOv5 and multi-branch Xception is provided. This method includes steps 102 to 106. Wherein:
[0051] Step 102: Determine the target face image; the target face image is obtained by cropping the original input image based on the target detection box provided by the YOLOv5 detection network; the PAN+FPN structure of the Neck module in the YOLOv5 detection network is replaced with a three-layer BiFPN structure.
[0052] like Figure 2 As shown, the YOLOv5 detection network consists of a backbone network, a Neck module, and a Head module. The backbone network is used to extract semantic and spatial features; the Neck module is used for feature fusion; and the Head module is used to output feature maps.
[0053] For the input of the YOLOv5 detection network, i.e., the original input image First, feature maps are extracted through the backbone network, specifically using the following formula 1.
[0054] (1)
[0055] The backbone network consists of modules such as Focus, CBS, and CSP, which can effectively extract deep features from the original input image.
[0056] The original input image can be obtained from any channel, such as social media, user input, etc.
[0057] It should be noted that in the original YOLOv5 network architecture, the Neck module uses a PAN + FPN structure. However, in order to further improve the multi-scale information fusion capability, in this embodiment, the PAN + FPN structure is replaced with a three-layer BiFPN structure.
[0058] This three-layer BiFPN structure fuses feature maps from different scales (including P3, P4, and P5) through bidirectional information flow and learnable weights, enhancing detection accuracy and semantic expression capabilities, as well as achieving efficient feature fusion between upper and lower layers.
[0059] The three feature maps are as follows: .
[0060] Specifically, such as Figure 3 As shown, the three-layer BiFPN structure improves the joint representation capability of shallow localization and deep semantics by weighted combination of learnable fusion weights and bidirectional paths to the three-layer feature maps. The weighted bidirectional fusion method in this three-layer BiFPN structure can be represented by the following formulas 2, 3, and 4:
[0061] (2)
[0062] (3)
[0063] (4)
[0064] The Head module outputs multi-scale candidate detection box feature maps. .
[0065] in, The number of anchors for each grid point; In this embodiment, the number of categories is... (Human face).
[0066] The output of each candidate detection box can be represented by the following formula 5:
[0067] (5)
[0068] in, This is the relative coordinate offset of the center point of the bounding box. These are the predicted parameters for the width and height of the bounding box. The confidence score for the candidate box to contain the target. This represents the probability distribution of the category to which the candidate box belongs.
[0069] Will Decoded into the form of real coordinates: ,
[0070] .
[0071] The final score for each candidate detection box can be calculated using the following formula 6:
[0072] (6)
[0073] It should be noted that the YOLOv5 detection network outputs multi-scale candidate detection boxes in the Head module. Each candidate detection box contains information such as center coordinates, width and height, target confidence and class probability.
[0074] After obtaining multiple candidate detection boxes, non-maximum suppression is performed on these boxes. Redundant detection boxes are removed based on their scores and intersection-union ratio (IU), retaining only the optimal target detection box. The original input image is then cropped based on the retained target detection boxes to extract several standard-sized face sub-images, i.e., target face images, which provide input for subsequent recognition models. For example, the standard size is 224×224.
[0075] Specifically, non-maximum suppression (NMS) is performed on all candidate detection boxes to remove redundant portions, thus obtaining the target detection box. This includes:
[0076] Let there be two candidate detection boxes (respectively...) and The intersection-union ratio of ) Formula 7 is as follows:
[0077] (7)
[0078] Then when (e.g., 0.5), and Remove Ultimately, only the optimal target detection bounding box is retained.
[0079] It should be noted that during the model training phase, the input training images are first received, and the RGB three-channel pixel values are normalized and scaled to the [0,1] interval to normalize the input feature space. Then, a Mosaic data augmentation strategy is introduced, which selects four images, scales, crops, and stitches them together to generate new training images, effectively improving the diversity of training samples and the model's generalization ability. All preprocessed images are uniformly adjusted to a size of 640×640 for easier subsequent network processing.
[0080] Specifically, firstly, multiple training images are acquired. The training image is then normalized using Formula 8 to obtain multiple normalized images.
[0081] (8)
[0082] Subsequently, Mosaic enhancement was used to normalize the four different images. Scale and stitch together into a single input image This enhances sample diversity.
[0083] After inputting the input image into the YOLOv5 detection network, several candidate detection boxes are obtained. By removing redundant parts from the candidate detection boxes, the target detection box corresponding to each input image can be obtained. The set of target detection boxes is denoted as […]. Based on this, each input image is cropped into a corresponding face region image. .
[0084] Step 104: Input the target face image into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network includes multiple convolutional branches.
[0085] This multi-branch Xception network has undergone structural optimization based on the original Xception network, specifically:
[0086] A multi-branch Xception network includes at least a multi-branch convolutional module and a Stem layer. The multi-branch convolutional module includes... The multi-branch Xception network contains parallel depthwise separable convolutional branches. The step of inputting the target face image into the multi-branch Xception network to generate a forgery probability includes: extracting input features from the target face image based on the Stem layer; and inputting the input features into the... Each parallel depthwise separable convolutional branch is used to obtain the intermediate features corresponding to each branch; for Channel concatenation is performed on the intermediate features, and the concatenated features are then processed. Convolutional compression is used to obtain the target output features; based on the target output features, a forgery probability is generated.
[0087] It should be noted that in the intermediate feature extraction stage, multiple parallel convolutional branches are introduced. The number of convolutional unit layers in different branches varies, which can cover multi-scale feature information from local details to global contours. The outputs (intermediate features) of each branch are integrated in the fusion stage through channel concatenation and convolutional compression to form a unified feature representation.
[0088] For the Stem layer, the target face image is used to extract input features using the following formula (Equation 9). This includes standard convolution, batch normalization, and non-linear activation.
[0089] (9)
[0090] For multi-branch convolutional modules, i.e., multi-branch convolutional structures, in the intermediate feature extraction stage, set... There are parallel depthwise separable convolutional branches. Among them, the first... Branches contain A unit, which refers to catch Its recursion is:
[0091] (10)
[0092] (11)
[0093] In summary, the branch output is denoted as Then, channel splicing was performed. The fusion is performed using convolutional compression, that is, ... Channel concatenation is performed on the intermediate features, and the concatenated features are then processed. Convolutional compression, this fusion process is implemented based on Equation 12.
[0094] (12)
[0095] in, Indicates the first The branch in its first Feature maps output by the layer Indicates that it will come from The feature maps of each branch are stitched together along the channel dimension. This indicates that an application is made to the spliced feature map. Convolution operations are used to compress the number of channels and enhance feature fusion. The fused multi-branch feature map and These represent the spatial height and width of the output feature map, respectively. This represents the number of channels in the output feature map obtained after the convolution operation.
[0096] This allows us to obtain a unified number of channels and the feature representations required for subsequent classification, i.e., to obtain the target output features.
[0097] It is understandable that the above design allows different branches to cover different receptive fields and depths, enhancing Xception's ability to capture multi-scale, fine-grained forged cues.
[0098] In one embodiment, such as Figure 4 As shown, in the convolutional units of the multi-branch convolutional module, specifically in the parallel depthwise separable convolutional branches, the traditional ReLU activation function is replaced with the smoother Mish activation function to preserve negative features and achieve more stable gradient propagation. The Mish function is represented as shown in Equation 13:
[0099]
[0100] in, This is the output of a convolutional layer or a fully connected layer. is the base of the natural logarithm. Represents the natural logarithm function. This represents the hyperbolic tangent function.
[0101] It is understandable that, compared to ReLU, Mish can provide a smoother gradient while preserving negative information, which is beneficial for the continuous representation of subtle fake textures and stable training.
[0102] After obtaining the target output features, the target output features can be processed using a hybrid pooling strategy, and then the forgery probability is generated through a fully connected layer.
[0103] Before classification output, a weighted fusion strategy of global average pooling and global max pooling is used to balance overall statistical information with local peak responses, thereby reducing the loss of forgery details during the pooling stage. Finally, the fused feature vector is input into a fully connected layer, and the forgery probability is output through the sigmoid function to determine whether a face image is forged.
[0104] Specifically, before classifying the output, the target output features are processed. First, perform Global Average Pooling (GAP) and Global Max Pooling (GMP), then calculate based on the learnable coefficients. The pooled features are obtained by fusing based on the following formula 14.
[0105] (14)
[0106] in, .
[0107] in, and Calculating by channel in the spatial dimension can simultaneously preserve overall statistics and local peak responses, thereby reducing the loss of forged clues during the convergence stage.
[0108] After that The input is a fully connected layer and then activated by a Sigmoid function to obtain the spoofing probability, as shown in Equation 15.
[0109] (15)
[0110] Step 106: Based on the forgery probability, determine the detection result of face forgery detection.
[0111] Specifically, a preliminary classification is performed based on the probability of forgery, typically using 0.5 as the judgment threshold: when the probability of forgery is higher than this threshold, it is marked as forgery; otherwise, it is marked as genuine. That is, the detection result can serve as a classification label, and the specific detection result can be determined using Formula 16.
[0112] (16)
[0113] In addition, the detection results may also include the location of the target detection box. Prediction confidence level, etc.
[0114] This application proposes a method for detecting forged faces based on an improved YOLOv5 and multi-branch Xception network. The method includes: determining a target face image; cropping the target face image from the original input image using a target detection bounding box provided by a YOLOv5 detection network; replacing the PAN+FPN structure of the Neck module in the YOLOv5 detection network with a three-layer BiFPN structure; inputting the target face image into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network including multiple convolutional branches; and determining the detection result of the forgery detection based on the forgery probability. This method improves the detection accuracy of the forgery detection method by cropping the image and then inputting the cropped target face image into the multi-branch Xception network for forgery detection, rather than directly inputting the target face image into the multi-branch Xception network. The reason is that the forged area often only appears in a small part of the image. Classifying the whole image may cover up the forged features, thus reducing the detection accuracy. However, classifying the target face image after cropping can avoid covering up the forged features, making the detection method sensitive to the regional information of the image and thus improving the detection accuracy.
[0115] In one embodiment, the detection result can be superimposed on the original input image for further decision-making by the user or system. For example, the annotation information (detection result) is presented intuitively in the image, making it easy for the user to quickly understand the detection result. The detection result can serve as input for subsequent application systems such as security auditing, image tracing, and automatic alarms, demonstrating good practicality and engineering integration capabilities.
[0116] In one embodiment, to further improve the stability and robustness of the identification, this embodiment can enable a dual-model collaborative discrimination mechanism based on the YOLOv5-Cls detection network and the multi-branch Xception network. This involves weighting and fusing the confidence values output by the two sub-models, for example using weight coefficients of 0.9 and 0.85, to calculate the overall forgery probability.
[0117] The final judgment result is based on the fusion value to output a label, which effectively enhances the ability to distinguish between fuzzy samples and boundary samples. The process of weighted fusion of the confidence values output by the two sub-models can be achieved through Equation 17.
[0118] (17)
[0119] Among them, if If it is true, it is marked as fake; otherwise, it is true.
[0120] In summary, this application embodiment combines the efficient detection capabilities of YOLOv5 with the deep forgery discrimination capabilities of Xception to construct a face forgery detection method that is highly accurate, fast in response, and flexible in structure. It can be implemented in conjunction with existing deep learning frameworks (such as PyTorch and TensorFlow).
[0121] In summary, image classification-based face forgery detection methods in related technologies still suffer from poor robustness in complex scenes. For example, after images are compressed, occluded, or blurred, the accuracy of the whole-image classification model drops significantly.
[0122] The applicant's research found that the reason for the poor robustness in complex scenarios is as follows:
[0123] In related technologies, Xception-type classification networks employ a single convolutional branch structure, which limits the parallel extraction capability of multi-scale features; their activation functions mostly use ReLU, which easily leads to the loss of negative value information; and the final feature aggregation usually only uses global average pooling, making it difficult to simultaneously retain overall features and local peak features. These limitations make it difficult to fully capture forged details, reducing the robustness of the model in multi-source data and complex distortion scenarios.
[0124] Therefore, the embodiments of this application enhance the ability to capture fine-grained fake features and the adaptability of the model by introducing a multi-branch convolutional structure in the intermediate feature extraction stage, adopting an improved Mish activation function, and utilizing a hybrid pooling strategy in the classification output stage, thereby improving the robustness of the model in multi-source data and complex distortion scenarios.
[0125] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0126] Based on the same inventive concept, this application also provides a forgery detection device for implementing the forgery detection method based on improved YOLOv5 and multi-branch Xception as described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations of one or more forgery detection device embodiments provided below can be found in the limitations of the forgery detection method based on improved YOLOv5 and multi-branch Xception described above, and will not be repeated here.
[0127] In one exemplary embodiment, such as Figure 5 As shown, a fake face detection device is provided, including: an image processing module 100, a fake recognition module 200, and a fake judgment module 300, wherein:
[0128] Image processing module 100 is used to determine a target face image; the target face image is obtained by cropping the original input image based on the target detection box provided by the YOLOv5 detection network; the PAN+FPN structure of the Neck module in the YOLOv5 detection network is replaced with a three-layer BiFPN structure;
[0129] The forgery detection module 200 is used to input the target face image into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network includes multiple convolutional branches.
[0130] The forgery judgment module 300 is used to determine the detection result of face forgery detection based on the forgery probability.
[0131] In one embodiment, the fake face detection device further includes:
[0132] The acquisition module is used to acquire multiple training images;
[0133] The normalization module is used to perform pixel normalization processing on the training images to obtain multiple normalized images;
[0134] The scaling and stitching module is used to scale and stitch the normalized image to obtain the input of the YOLOv5 detection network.
[0135] In one embodiment, the image processing module 100 is specifically used for:
[0136] Determine the original input image;
[0137] The original input image is input into the YOLOv5 detection network to obtain multiple candidate detection boxes;
[0138] The target detection box is obtained by eliminating redundant parts of the candidate detection box based on nonmaximum suppression.
[0139] The target face image is obtained by cropping from the original input image based on the target detection box.
[0140] In one embodiment, the multi-branch Xception network includes at least a multi-branch convolutional module and a Stem layer, wherein the multi-branch convolutional module includes... Parallel depthwise separable convolutional branches; the forgery detection module 200 is specifically used for:
[0141] Based on the Stem layer, input features are extracted from the target face image;
[0142] Input the input features into the Each parallel depthwise separable convolutional branch is used to obtain the intermediate features corresponding to each parallel depthwise separable convolutional branch.
[0143] right Channel concatenation is performed on the intermediate features, and the concatenated features are then processed. Convolutional compression yields the target output features;
[0144] Based on the target output features, a forgery probability is generated.
[0145] In one embodiment, the activation function in the parallel depthwise separable convolution branch is Mish, and the function representation of Mish is as follows:
[0146]
[0147] in, This is the output of a convolutional layer or a fully connected layer. is the base of the natural logarithm. Represents the natural logarithm function. This represents the hyperbolic tangent function.
[0148] In one embodiment, the forgery identification module 200 is further configured to:
[0149] Perform global average pooling and global max pooling operations on the target output features to obtain the pooled features;
[0150] The pooled features are input into a fully connected layer to generate a forgery probability.
[0151] In one embodiment, the forgery detection module 300 is specifically used for:
[0152] The combined forgery probability is obtained by weighted summing the confidence level provided by the YOLOv5 detection network and the forgery probability.
[0153] Based on the comprehensive forgery probability, the detection result of face forgery detection is determined.
[0154] The modules in the aforementioned fake face detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0155] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a fake face detection method based on an improved YOLOv5 and multi-branch Xception.
[0156] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0157] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0158] The target face image is determined; the target face image is obtained by cropping the original input image based on the target detection box provided by the YOLOv5 detection network; the PAN+FPN structure of the Neck module in the YOLOv5 detection network is replaced with a three-layer BiFPN structure;
[0159] The target face image is input into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network includes multiple convolutional branches.
[0160] Based on the forgery probability, the detection result of face forgery detection is determined.
[0161] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0162] Acquire multiple training images;
[0163] The training images are subjected to pixel normalization processing to obtain multiple normalized images;
[0164] The normalized image is scaled and stitched together to obtain the input of the YOLOv5 detection network.
[0165] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0166] Determine the original input image;
[0167] The original input image is input into the YOLOv5 detection network to obtain multiple candidate detection boxes;
[0168] The target detection box is obtained by eliminating redundant parts of the candidate detection box based on nonmaximum suppression.
[0169] The target face image is obtained by cropping from the original input image based on the target detection box.
[0170] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0171] The multi-branch Xception network includes at least a multi-branch convolutional module and a Stem layer, wherein the multi-branch convolutional module includes... Parallel depthwise separable convolutional branches;
[0172] Based on the Stem layer, input features are extracted from the target face image;
[0173] Input the input features into the Each parallel depthwise separable convolutional branch is used to obtain the intermediate features corresponding to each parallel depthwise separable convolutional branch.
[0174] right Channel concatenation is performed on the intermediate features, and the concatenated features are then processed. Convolutional compression yields the target output features;
[0175] Based on the target output features, a forgery probability is generated.
[0176] In one embodiment, the activation function in the parallel depthwise separable convolution branch is Mish, and the function representation of Mish is as follows:
[0177]
[0178] in, This is the output of a convolutional layer or a fully connected layer. is the base of the natural logarithm. Represents the natural logarithm function. This represents the hyperbolic tangent function.
[0179] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0180] Perform global average pooling and global max pooling operations on the target output features to obtain the pooled features;
[0181] The pooled features are input into a fully connected layer to generate a forgery probability.
[0182] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0183] The combined forgery probability is obtained by weighted summing the confidence level provided by the YOLOv5 detection network and the forgery probability.
[0184] Based on the comprehensive forgery probability, the detection result of face forgery detection is determined.
[0185] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0186] The target face image is determined; the target face image is obtained by cropping the original input image based on the target detection box provided by the YOLOv5 detection network; the PAN+FPN structure of the Neck module in the YOLOv5 detection network is replaced with a three-layer BiFPN structure;
[0187] The target face image is input into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network includes multiple convolutional branches.
[0188] Based on the forgery probability, the detection result of face forgery detection is determined.
[0189] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0190] Acquire multiple training images;
[0191] The training images are subjected to pixel normalization processing to obtain multiple normalized images;
[0192] The normalized image is scaled and stitched together to obtain the input of the YOLOv5 detection network.
[0193] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0194] Determine the original input image;
[0195] The original input image is input into the YOLOv5 detection network to obtain multiple candidate detection boxes;
[0196] The target detection box is obtained by eliminating redundant parts of the candidate detection box based on nonmaximum suppression.
[0197] The target face image is obtained by cropping from the original input image based on the target detection box.
[0198] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0199] The multi-branch Xception network includes at least a multi-branch convolutional module and a Stem layer, wherein the multi-branch convolutional module includes... Parallel depthwise separable convolutional branches;
[0200] Based on the Stem layer, input features are extracted from the target face image;
[0201] Input the input features into the Each parallel depthwise separable convolutional branch is used to obtain the intermediate features corresponding to each parallel depthwise separable convolutional branch.
[0202] right Channel concatenation is performed on the intermediate features, and the concatenated features are then processed. Convolutional compression yields the target output features;
[0203] Based on the target output features, a forgery probability is generated.
[0204] In one embodiment, the activation function in the parallel depthwise separable convolution branch is Mish, and the function representation of Mish is as follows:
[0205]
[0206] in, This is the output of a convolutional layer or a fully connected layer. is the base of the natural logarithm. Represents the natural logarithm function. This represents the hyperbolic tangent function.
[0207] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0208] Perform global average pooling and global max pooling operations on the target output features to obtain the pooled features;
[0209] The pooled features are input into a fully connected layer to generate a forgery probability.
[0210] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0211] The combined forgery probability is obtained by weighted summing the confidence level provided by the YOLOv5 detection network and the forgery probability.
[0212] Based on the comprehensive forgery probability, the detection result of face forgery detection is determined.
[0213] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0214] The target face image is determined; the target face image is obtained by cropping the original input image based on the target detection box provided by the YOLOv5 detection network; the PAN+FPN structure of the Neck module in the YOLOv5 detection network is replaced with a three-layer BiFPN structure;
[0215] The target face image is input into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network includes multiple convolutional branches.
[0216] Based on the forgery probability, the detection result of face forgery detection is determined.
[0217] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0218] Acquire multiple training images;
[0219] The training images are subjected to pixel normalization processing to obtain multiple normalized images;
[0220] The normalized image is scaled and stitched together to obtain the input of the YOLOv5 detection network.
[0221] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0222] Determine the original input image;
[0223] The original input image is input into the YOLOv5 detection network to obtain multiple candidate detection boxes;
[0224] The target detection box is obtained by eliminating redundant parts of the candidate detection box based on nonmaximum suppression.
[0225] The target face image is obtained by cropping from the original input image based on the target detection box.
[0226] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0227] The multi-branch Xception network includes at least a multi-branch convolutional module and a Stem layer, wherein the multi-branch convolutional module includes... Parallel depthwise separable convolutional branches;
[0228] Based on the Stem layer, input features are extracted from the target face image;
[0229] Input the input features into the Each parallel depthwise separable convolutional branch is used to obtain the intermediate features corresponding to each parallel depthwise separable convolutional branch.
[0230] right Channel concatenation is performed on the intermediate features, and the concatenated features are then processed. Convolutional compression yields the target output features;
[0231] Based on the target output features, a forgery probability is generated.
[0232] In one embodiment, the activation function in the parallel depthwise separable convolution branch is Mish, and the function representation of Mish is as follows:
[0233]
[0234] in, This is the output of a convolutional layer or a fully connected layer. is the base of the natural logarithm. Represents the natural logarithm function. This represents the hyperbolic tangent function.
[0235] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0236] Perform global average pooling and global max pooling operations on the target output features to obtain the pooled features;
[0237] The pooled features are input into a fully connected layer to generate a forgery probability.
[0238] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0239] The combined forgery probability is obtained by weighted summing the confidence level provided by the YOLOv5 detection network and the forgery probability.
[0240] Based on the comprehensive forgery probability, the detection result of face forgery detection is determined.
[0241] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0242] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0243] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for detecting fake human faces based on improved YOLOv5 and multi-branch Xception, characterized in that, The method comprises: determining a target face image; the target face image is obtained by cropping an original input image based on a target detection frame provided by a YOLOv5 detection network; a PAN+FPN structure of a Neck module in the YOLOv5 detection network is replaced by a three-layer BiFPN structure; the determination of the target face image comprises: determining an original input image; inputting the original input image into the YOLOv5 detection network to obtain a plurality of candidate detection frames; based on the non-maximum suppression, removing redundant parts in the candidate detection frames to obtain a target detection frame; cropping the target face image from the original input image based on the target detection frame; inputting the target face image into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network comprises a plurality of convolution branches; The multi-branch Xception network at least comprises a multi-branch convolution module and a Stem layer, wherein the multi-branch convolution module comprises a plurality of parallel deep separable convolution branches; and the inputting the target face image into the multi-branch Xception network to generate the forgery probability comprises: based on the Stem layer, extracting input features from the target face image; inputting the input feature into the a plurality of parallel depth separable convolution branches, to obtain intermediate features corresponding to the plurality of parallel depth separable convolution branches; the activation function in the parallel deep separable convolution branch is Mish, and the function of the Mish is as follows: wherein, is the output of a convolutional or fully connected layer, is the base of the natural logarithm, denotes the natural logarithm function, denotes the hyperbolic tangent function; right Channel concatenation is performed on the intermediate features, and the concatenated features are then processed. Convolutional compression yields the target output features; based on the target output feature, a forgery probability is generated; based on the forgery probability, a detection result of face forgery detection is determined.
2. The method of claim 1, wherein the method is characterized in that, In the training phase, the input of the YOLOv5 detection network comprises: obtaining a plurality of training images; performing pixel normalization on the training images to obtain a plurality of normalized images; scaling and splicing the normalized images to obtain the input of the YOLOv5 detection network.
3. The method of claim 1, wherein the method is characterized by, based on the target output feature, a forgery probability is generated, comprising: performing global average pooling and global maximum pooling operations on the target output feature to obtain pooled features; inputting the pooled features into a fully connected layer to generate a forgery probability.
4. The method of claim 1, wherein the method is characterized by, based on the forgery probability, a detection result of face forgery detection is determined, comprising: weighting and summing the confidence provided by the YOLOv5 detection network and the forgery probability to obtain a comprehensive forgery probability; based on the comprehensive forgery probability, a detection result of face forgery detection is determined.
5. A fake face detection device for implementing the fake face detection method based on improved YOLOv5 and multi-branch Xception according to any one of claims 1-4, characterized in that, The device comprises: an image processing module for determining a target face image; the target face image is obtained by cropping an original input image based on a target detection frame provided by a YOLOv5 detection network; the PAN+FPN structure of the Neck module in the YOLOv5 detection network is replaced by a three-layer BiFPN structure; a forgery identification module for inputting the target face image into a multi-branch Xception network to generate a forgery probability; the multi-branch Xception network comprises a plurality of convolution branches; a forgery judgment module for determining a detection result of face forgery detection based on the forgery probability.
6. A computer device, comprising: comprising a processor, a memory and a program or instructions stored on the memory and executable on the processor, the program or instructions being executed by the processor to implement the steps of the forgery face detection method based on the improved YOLOv5 and multi-branch Xception according to any one of claims 1-4.
7. A readable storage medium, characterized by, The readable storage medium stores programs or instructions, and the programs or instructions are executed by the processor to realize the steps of the improved YOLOv5 and multi-branch Xception-based fake face detection method in any one of claims 1-4.
Citation Information
Patent Citations
Face forgery detection method based on image block disruption
CN113269167A
Small target detection method based on adaptive feature fusion redundancy optimization
CN114078230A