Detection method of forged face image based on target positioning and mask reconstruction
By employing target localization and mask reconstruction methods, facial regions are accurately identified, diverse samples are generated, and image reconstruction and difference analysis are performed using an autoencoder. This solves the robustness and accuracy problems of fake face detection in existing technologies and achieves efficient forgery trace recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN VOCATIONAL COLLEGE OF CHEM TECH
- Filing Date
- 2025-11-25
- Publication Date
- 2026-05-01
AI Technical Summary
Existing face image detection technologies struggle to effectively identify subtle and scattered traces of face forgery. Traditional models exhibit poor robustness in complex scenarios and are prone to fitting specific forgery methods, resulting in low detection accuracy and high false positive rates.
By employing target localization and mask reconstruction methods, we can accurately identify facial regions, eliminate background interference, generate diverse local mask samples, reconstruct images using an autoencoder with skip connections, extract the most dissimilar features through multi-scale geometric mean similarity measurement and connected component analysis, and optimize model training by combining adaptive learning rate and threshold adjustment.
It significantly improves the recognition accuracy and robustness of fake face images, reduces the false positive rate, adapts to face image detection of different poses and scales, and improves the accuracy and adaptability of detection.
Smart Images

Figure CN121963267A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, specifically to a method for detecting forged face images based on target localization and mask reconstruction. Background Technology
[0002] Face image detection is a technology based on computer vision and deep learning. It extracts forgery traces such as GAN-generated artifacts, abnormal lighting and texture, and missing physiological features from images. It combines traditional feature engineering with models such as CNN and Transformer to identify face-swapping and generative forgery images. The core goal is to improve the detection accuracy and anti-attack capability in complex scenarios. It is widely used in security fields such as identity verification and content moderation.
[0003] The invention patent application with application number 202411675883.6 discloses a method and system for detecting deepfake face images. The application aims to solve the problem that "at present, deepfake detection technology is not mature and there are research difficulties such as poor robustness to adversarial perturbation processing (such as resizing, blurring, etc.), weak generalization ability, and increased difficulty in detecting biological signals".
[0004] However, existing technologies for detecting forged facial images have the following drawbacks:
[0005] The traces of deepfakes (such as discontinuities in skin texture, inconsistent lighting, and shadows) are usually subtle and concentrated in the facial features. Existing methods process the entire image directly, causing the complex textures of the background to become strong noise, drowning out the real forgery signals, making it difficult for the model to focus and learn effective discriminative features.
[0006] Most current deepfake detection methods rely on "discriminative models," which directly learn the mapping from the input image to "real" or "fake" labels. These models are prone to fitting to specific "artifacts" produced by specific forgery methods in the training data. For a fake face, the model will unintentionally "correct" some unnatural forgery traces during the reconstruction process, resulting in a quantifiable and significant difference between the reconstructed image and the original input image.
[0007] Traditional convolutional neural networks have limitations in extracting long-range dependencies and global contextual features of images, while some deepfake face traces are subtle and scattered throughout the face region, causing these key features to be missed.
[0008] Therefore, there is an urgent need for a method for detecting forged face images based on target localization and mask reconstruction. Summary of the Invention
[0009] In view of the above-mentioned shortcomings of the existing technology, the present invention provides a method for detecting fake face images based on target localization and mask reconstruction, which can effectively solve the problems of the existing technology.
[0010] To achieve the above objectives, the present invention is implemented through the following technical solutions;
[0011] This invention discloses a method for detecting forged face images based on target localization and mask reconstruction, comprising:
[0012] The system performs accurate facial region recognition and separation on the input image to be detected, extracting clean face images without background interference. Local masking is randomly applied to the clean face images to generate multiple face samples with partially obscured information, constructing a diverse sample set for model training. An autoencoder model with skip connections is constructed, where the encoder integrates a global attention mechanism and local feature extraction capabilities, and the decoder receives multi-scale features from the encoder for accurate face image reconstruction. The diverse sample set is input into the autoencoder model for iterative training. A multi-scale geometric mean similarity metric is applied to calculate the pixel-level difference distribution map between the clean face image to be detected and the reconstructed image output by the model. Multi-scale analysis is performed on the difference distribution map, and the maximum difference feature is extracted. Based on whether this feature exceeds a preset threshold, it is determined whether the image to be detected is a forged face image.
[0013] Furthermore, when performing accurate facial region recognition and separation on the input image to be detected, a YOLOv11 target detection model optimized for face detection scenarios is adopted. Through the pre-training stage, the anchor box parameter configuration is adapted to the face scale to enhance the model's adaptability to the localization of faces with different poses and scales.
[0014] During model execution, the input image is first adaptively scaled to ensure that the input resolution meets the model's inference requirements. Then, multi-scale image features are extracted through the feature pyramid network, and the non-maximum suppression algorithm is applied to select the optimal bounding box to select the smallest bounding rectangle of the face region.
[0015] Finally, the corresponding image region is cropped based on the bounding box coordinates. Pixel-level background removal is then performed to remove a small number of residual background pixels within the bounding box, ultimately resulting in a clean face image with no background interference and continuous texture.
[0016] Furthermore, when randomly applying local masking to a clean face image, a non-uniform random generation strategy is used to construct the local mask based on the distribution area of facial organs.
[0017] The local mask includes continuous region masks and discrete pixel masks;
[0018] The continuous region mask is a continuous block of pixels in the shape of an irregular polygon or ellipse, and the discrete pixel mask is a set of randomly distributed isolated pixels.
[0019] The area covered by the mask is within a preset range as a proportion of the total area of the clean face image. When the mask is generated, it avoids the key recognition area of the core facial organs or actively covers the area to form two mask types with different masking logics.
[0020] By repeatedly performing mask generation and occlusion operations, each generated mask is unique in position, shape, and type, ultimately resulting in several face samples with differences in the degree of local information occlusion, occlusion position, and occlusion type.
[0021] Furthermore, in the autoencoder model with skip connections, the encoder includes a CNN local feature extraction module and a Transformer global attention module connected in sequence. The CNN local feature extraction module extracts local texture and detail features of the face image through multi-layer convolution and activation functions. The Transformer global attention module captures long-distance dependencies and global context features of the face image based on the Bottleneck Transformer structure. The skip connections directly pass feature maps from different levels in the encoder to the corresponding levels in the decoder, enabling the fusion of low-level detail features and high-level semantic features.
[0022] Furthermore, the decoder includes a deconvolution layer, a batch normalization layer, and an activation function layer. The deconvolution layer is used to progressively restore the image resolution, the batch normalization layer is used to maintain the training process, and the activation function layer is used to enhance the nonlinear expressive power of the model. After receiving the multi-scale features transmitted by the encoder, the decoder combines them with the low-level features passed in by the skip connections to perform pixel-by-pixel image reconstruction and outputs a reconstructed image with the same size as the input clean face image.
[0023] Furthermore, the method involves inputting a diverse set of samples into the autoencoder model for iterative training, using mean squared error as the reconstruction loss function, employing an adaptive learning rate adjustment strategy during training, dynamically adjusting the learning rate based on the changes in the loss value of the training batch, and terminating the iterative training when the training loss value is lower than a preset loss threshold or when a preset number of iterations is reached.
[0024] Furthermore, when calculating the pixel-level difference distribution map using the multi-scale geometric mean similarity metric method, multi-scale downsampling is performed on the clean face image and the reconstructed image to obtain image pairs with different resolutions;
[0025] At each scale, the geometric mean similarity matrix of the corresponding image pair is calculated, and the local difference map at that scale is obtained by matrix difference operation;
[0026] After upsampling the local difference maps at all scales to the original image size, a weighted fusion strategy is used to obtain the final pixel-level difference distribution map.
[0027] Furthermore, when performing multi-scale analysis on the difference distribution map and extracting the maximum difference feature, the Gaussian pyramid decomposition algorithm is used to decompose the difference distribution map at multiple scales to obtain difference feature maps at different resolution levels. Then, adaptive threshold segmentation is performed on the difference feature maps at each level to filter out regions with significant differences. Finally, connected component analysis is performed on the filtered significant regions to calculate the difference peak value in each connected component. The maximum value among the difference peak values of all connected components is determined as the maximum difference feature.
[0028] Furthermore, the preset threshold is obtained by training on a verification dataset, which includes a preset number of fake face images and real face images;
[0029] The preset threshold used to determine whether an image to be detected is a fake face image is initially defined by the user on the system side, and is adaptively adjusted according to the detection accuracy and false positive rate in the verification dataset.
[0030] Compared with the known prior art, the technical solution provided by this invention has the following beneficial effects:
[0031] This invention provides a method for detecting forged face images based on target localization and mask reconstruction. During execution, the method accurately identifies and separates face regions, removes background interference to obtain clean face images, laying a reliable foundation for detection. It randomly applies diverse local masks to generate rich samples, effectively improving the model's adaptability to different occlusion conditions. It utilizes an autoencoder with skip connections to achieve accurate face image reconstruction, fully integrates multi-scale features to restore details and global information, and employs a multi-scale geometric mean similarity measurement method to accurately calculate pixel-level differences. Combining multi-scale decomposition and connected component analysis to extract the maximum difference features significantly improves the accuracy of forgery trace recognition. Furthermore, it adaptively adjusts the learning rate and preset threshold to optimize model training effects and detection adaptability. The overall process is logically rigorous, effectively handling forged face images of different poses, scales, and types, significantly reducing the false positive rate and improving detection accuracy and robustness. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0033] Figure 1 This is a flowchart illustrating a method for detecting forged face images based on target localization and mask reconstruction.
[0034] Figure 2 This is a diagram of the Transformer encoder-decoder structure in this invention. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0036] The present invention will be further described below with reference to embodiments.
[0037] Example:
[0038] This embodiment presents a method for detecting forged face images based on target localization and mask reconstruction, such as... Figure 1 As shown, it includes:
[0039] Accurately identify and separate the face region from the input image to be detected, and extract a clean face image without background interference;
[0040] When performing accurate face region recognition and separation on the input image to be detected, the YOLOv11 target detection model optimized for face detection scenarios is adopted. By adapting the anchor box parameter configuration to the face scale during the pre-training stage, the adaptability of the model to the localization of faces with different poses and scales is enhanced.
[0041] During model execution, the input image is first adaptively scaled to ensure that the input resolution meets the model's inference requirements. Then, multi-scale image features are extracted through the feature pyramid network, and the non-maximum suppression algorithm is applied to select the optimal bounding box to select the smallest bounding rectangle of the face region.
[0042] Finally, the corresponding image region is cropped according to the bounding box coordinates. The pixel-level background removal verification is performed, that is, the texture consistency between the edge pixels and the center pixels of the cropped region is judged, and a small number of residual background pixels in the bounding box are removed. Finally, a clean face image with no background interference and continuous texture is obtained.
[0043] Randomly apply local masking to clean face images to generate multiple face samples with partially obscured information, and construct a diverse sample set for model training;
[0044] When randomly applying local mask processing to a clean face image, a non-uniform random generation strategy is used to construct the local mask based on the distribution area of the face organs, which include the eyes, nose, mouth, and cheeks.
[0045] Local masks include continuous region masks and discrete pixel masks;
[0046] A continuous region mask is a continuous block of pixels in the shape of an irregular polygon or ellipse, while a discrete pixel mask is a set of randomly distributed isolated pixels.
[0047] The area covered by the mask is within a preset range as a proportion of the total area of the clean face image. When the mask is generated, it avoids the key recognition area of the core facial organs or actively covers the area to form two mask types with different masking logics.
[0048] By repeatedly performing mask generation and occlusion operations, each generated mask is unique in position, shape, and type, resulting in several face samples with differences in the degree of local information occlusion, occlusion position, and occlusion type.
[0049] Key identification areas include the pupils and the nasal wings;
[0050] In the autoencoder model with skip connections, the encoder includes a CNN local feature extraction module and a Transformer global attention module connected in sequence. The CNN local feature extraction module extracts local texture and detail features of the face image through multi-layer convolution and activation functions. The Transformer global attention module captures long-distance dependencies and global context features of the face image based on the Bottleneck Transformer structure. Skip connections directly pass feature maps from different levels in the encoder to the corresponding levels in the decoder, enabling the fusion of low-level detail features and high-level semantic features.
[0051] An autoencoder model with skip connections is constructed. Its encoder integrates global attention mechanism and local feature extraction capability, and the decoder receives multi-scale features transmitted by the encoder to accurately reconstruct face images.
[0052] The decoder includes deconvolution layers, batch normalization layers, and activation function layers. The deconvolution layers are used to progressively restore the image resolution, the batch normalization layers are used to maintain the training process, and the activation function layers are used to enhance the nonlinear expressive power of the model. After receiving the multi-scale features from the encoder, the decoder combines them with the low-level features from the skip connections to perform pixel-by-pixel image reconstruction and outputs a reconstructed image with the same size as the input clean face image.
[0053] A diverse set of samples is input into the autoencoder model for iterative training.
[0054] A diverse set of samples is input into the autoencoder model for iterative training. Mean squared error is used as the reconstruction loss function. An adaptive learning rate adjustment strategy is adopted during training. The learning rate is dynamically adjusted according to the change of the loss value of the training batch. The termination condition of iterative training is that the training loss value is lower than the preset loss threshold or the preset number of iterations is reached.
[0055] A multi-scale geometric mean similarity metric method is applied to calculate the pixel-level difference distribution map between the clean face image to be detected and the reconstructed image output by the model;
[0056] When calculating the pixel-level difference distribution map using the multi-scale geometric mean similarity measurement method, multi-scale downsampling is performed on the clean face image and the reconstructed image to obtain image pairs with different resolutions.
[0057] At each scale, the geometric mean similarity matrix of the corresponding image pair is calculated, and the local difference map at that scale is obtained by matrix difference operation;
[0058] After upsampling the local difference maps at all scales to the original image size, a weighted fusion strategy is used to obtain the final pixel-level difference distribution map;
[0059] Multi-scale analysis is performed on the difference distribution map and the maximum difference feature is extracted. Based on whether the feature exceeds a preset threshold, it is determined whether the image to be detected is a fake face image.
[0060] When performing multi-scale analysis on the difference distribution map and extracting the maximum difference feature, the Gaussian pyramid decomposition algorithm is used to decompose the difference distribution map into multiple scales to obtain difference feature maps at different resolution levels. Then, adaptive threshold segmentation is performed on the difference feature maps at each level to filter out regions with significant differences. Finally, connected component analysis is performed on the filtered significant regions to calculate the difference peak value in each connected component. The maximum value among the difference peak values of all connected components is determined as the maximum difference feature.
[0061] The preset threshold is obtained by training on a verification dataset, which includes a preset number of fake face images and real face images.
[0062] The preset threshold used to determine whether an image to be detected is a fake face image is initially defined by the user on the system side, and is adaptively adjusted according to the detection accuracy and false positive rate in the verification dataset.
[0063] The method in this embodiment can accurately extract face images without background interference. By training with diverse occlusion samples, the model's adaptability to different situations is improved. With the help of accurate reconstruction and multi-scale difference analysis, subtle traces of fake faces are efficiently captured. Combined with adaptively adjusted threshold judgment, the accuracy and reliability of fake face detection are greatly improved, the false judgment rate is effectively reduced, and it is adapted to face detection scenarios with different poses and scales. The detection is efficient and practical.
[0064] In addition to the methods described above, the methods in the above embodiments also include the following example configuration:
[0065] The YOLOv11 object detection model employs three sets of anchor boxes adapted to face scales, with sizes of [12,16], [19,36], and [40,80], and an aspect ratio of 1:1.2. During pre-training, the Wideface dataset (containing 32,203 images and 159,429 face annotations) is used, covering various poses (frontal, side, tilted, etc.) and different face scales (10-1000 pixels). In addition to the anchor box configuration, the YOLOv11 backbone network is fine-tuned, freezing the weights of the first three convolutional layers and training only the last four convolutional layers and the detection head. The CIoU loss function is used to improve bounding box regression accuracy. During adaptive scaling, the input image is uniformly scaled to 640×640 resolution. The feature pyramid network retains the original model's P3-P5 layers. The confidence threshold for non-maximum suppression is set to 0.5, and the IOU threshold is set to 0.45.
[0066] The core parameters and logic of local mask generation are as follows: the area of the mask coverage region is within a preset range of 15%-35% of the total area of the clean face image; the specific implementation of the non-uniform random generation strategy is as follows: the mask generation probability is allocated according to the importance of facial organs, with a 30% probability for the eye and nose regions, a 40% probability for the mouth and cheek regions, and a 30% probability for other regions. The random generation algorithm uses the Fisher-Yates shuffling algorithm to ensure positional randomness; the triggering conditions for the two occlusion logics are: actively covering the key recognition areas of core organs (pupils, nostrils) in the first 50% of the training iterations, and avoiding these areas in the next 50% of the iterations; the number of sides of the irregular polygon of the continuous region mask is 4-8, the major axis range of the ellipse is 20-50 pixels, the minor axis range is 15-35 pixels, and the number of isolated pixels of the discrete pixel mask is 50-200;
[0067] The core structural parameters of the autoencoder model are as follows: The CNN local feature extraction module contains 3 convolutional layers. The first layer has a kernel size of 3×3, 64 kernels, and a stride of 1. The second layer has a kernel size of 3×3, 128 kernels, and a stride of 2. The third layer has a kernel size of 3×3, 256 kernels, and a stride of 2. GELU is used as the activation function for all layers. The Transformer global attention module contains 3 encoder layers, each with 8 attention heads. The hidden layer dimension is 512. The compression ratio of the Bottleneck Transformer is 4. The code employs LayerNorm layers for normalization; skip connections pass feature maps from layers 1 and 3 of the encoder to layers 3 and 1 of the decoder; the decoder contains 3 deconvolutional layers: the first deconvolutional layer has a kernel size of 4×4, a number of kernels of 128, and a stride of 2; the second deconvolutional layer has a kernel size of 4×4, a number of kernels of 64, and a stride of 2; the third deconvolutional layer has a kernel size of 3×3, a number of kernels of 3, and a stride of 1. The momentum of the batch normalization layer is set to 0.99, the epsilon is set to 1e-5, and the activation function is LeakyReLU (negative slope 0.01).
[0068] Key parameters for model training: The batch size is set to 32; the adaptive learning rate adjustment strategy uses the AdamW optimizer with an initial learning rate of 1e-4, a learning rate adjustment coefficient of 0.95, and a decay period of 5 epochs. When the loss value does not decrease for 3 consecutive epochs, the learning rate decays by an additional 50%; the preset loss threshold is set to 0.0005, and the preset number of iterations is set to 200 epochs. Training is terminated when either condition is met; an early stopping strategy is used during training. If the loss value is higher than 0.001 for 10 consecutive epochs, training is terminated early and the optimal model weights are loaded.
[0069] Specific parameters for multi-scale similarity measurement: The multi-scale downsampling processing is set to four scales: original resolution (1×), 2x downsampling (0.5×), 4x downsampling (0.25×), and 8x downsampling (0.125×). The geometric mean similarity matrix is calculated using the geometric mean of pixel grayscale values (i.e., the square root of the product of corresponding pixel grayscale values in two images), and the matrix difference operation uses the absolute difference. The weight allocation of the weighted fusion strategy is as follows: original resolution local difference map weight 0.4, 2x downsampling map weight 0.3, 4x downsampling map weight 0.2, and 8x downsampling map weight 0.1. After fusion, the difference values are mapped to the range of 0-255 through linear normalization.
[0070] The algorithm parameters for differential feature extraction are as follows: Gaussian pyramid decomposition is set to 5 scale levels, with a Gaussian kernel size of 5×5 and a standard deviation of 1.0 for each level; adaptive threshold segmentation uses the Otsu algorithm to automatically calculate the global threshold, and performs binarization on the differential feature map of each level, retaining regions with gray values higher than the threshold as significantly different regions; the screening criteria for connected component analysis are: the minimum connected component area is ≥20 pixels, and isolated small regions with an area smaller than the threshold are removed; the connected component analysis adopts the 8-neighborhood connection rule, and the peak difference is calculated as the maximum value of the difference values of all pixels within the connected component;
[0071] Validation dataset and threshold adjustment rules: The validation dataset contains 100,000 images, including 50,000 real face images (covering different ages, genders, and ethnicities) and 50,000 fake face images (including GAN-generated, face stitching, and face swapping images, with each category accounting for 40%, 30%, and 30% of the samples, respectively). The initial threshold is user-defined at 0.7. The threshold adjustment rules are as follows: if the detection accuracy of the validation dataset is <90%, the threshold is lowered by 0.05; if the false positive rate is >5%, the threshold is raised by 0.05; if the detection accuracy is ≥95% and the false positive rate is ≤3%, the current threshold is fixed. During the adjustment process, the threshold range is limited to between 0.5 and 0.9 to avoid extreme values that may cause detection failure.
[0072] See Figure 2 As shown, this figure is a Transformer encoder-decoder structure diagram in an autoencoder model with skip connections. It is a visual representation of the core architecture of the model, clearly showing the connection relationship and signal flow of each functional module. Figure 2The left / upper part is the encoder module, which receives clean face samples after 3-channel (RGB) masking at 640×640 resolution. The front-end CNN local feature extraction submodule annotates the parameters of the 3 convolutional layers (e.g., "Conv1: 3×3, 64, stride=1") and the GELU activation function. The back-end Transformer global attention submodule (based on Bottleneck Transformer) annotates the 3 encoder units (including 8-head MHSA, 1×1 convolution, LayerNorm, and 4:1 compression ratio), and outputs high-level semantic features and low-level detail features from the 1st and 3rd layers of the CNN; the middle part... Two skip connection paths (CNN layer 1 → decoder layer 3, CNN layer 3 → decoder layer 1) are represented by dashed lines labeled "low-level detail feature fusion". The right / lower half is the decoder module, which receives high-level semantic features from the encoder and low-level features from the skip connections. The parameters of the three deconvolution units (e.g., "DeConv1: 4×4, 256, stride=2"), BN layers, and LeakyReLU (negative slope 0.01) are labeled. Finally, a 3-channel reconstructed image with a resolution of 640×640 is output. Overall, this helps technicians intuitively understand the feature extraction, transfer, and reconstruction logic, and provides a visual basis for model structure reproduction.
[0073] Referring to the method in the above embodiments, it accurately identifies and separates the face region, removes background interference to obtain a clean face image, laying a reliable foundation for detection. It randomly applies diverse local masks to generate rich samples, effectively improving the model's adaptability to different occlusion situations. It uses an autoencoder with skip connections to achieve accurate reconstruction of the face image, fully integrates multi-scale features to restore details and global information, and uses a multi-scale geometric mean similarity measurement method to accurately calculate pixel-level differences. It combines multi-scale decomposition and connected component analysis to extract the maximum difference features, significantly improving the accuracy of forgery trace recognition. It also optimizes the model training effect and detection adaptability by adaptively adjusting the learning rate and preset threshold. The overall process is logically rigorous and can effectively deal with forged face images of different poses, scales and types, significantly reducing the false positive rate and improving the accuracy and robustness of detection.
[0074] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting forged face images based on target localization and mask reconstruction, characterized in that, include: Accurately identify and separate the face region from the input image to be detected, and extract a clean face image without background interference; Randomly apply local masking to clean face images to generate multiple face samples with partially obscured information, and construct a diverse sample set for model training; An autoencoder model with skip connections is constructed. Its encoder integrates global attention mechanism and local feature extraction capability, and the decoder receives multi-scale features transmitted by the encoder to accurately reconstruct face images. A diverse set of samples is input into the autoencoder model for iterative training. A multi-scale geometric mean similarity metric method is applied to calculate the pixel-level difference distribution map between the clean face image to be detected and the reconstructed image output by the model; Multi-scale analysis is performed on the difference distribution map and the maximum difference feature is extracted. Based on whether the feature exceeds a preset threshold, it is determined whether the image to be detected is a fake face image.
2. The method for detecting forged face images based on target localization and mask reconstruction according to claim 1, characterized in that, When performing accurate facial region recognition and separation on the input image to be detected, the YOLOv11 target detection model optimized for the facial detection scenario is adopted. Through the pre-training stage, the anchor box parameter configuration is adapted to the facial scale to enhance the model's adaptability to the localization of faces with different poses and different scales. During model execution, the input image is first adaptively scaled to ensure that the input resolution meets the model's inference requirements. Then, multi-scale image features are extracted through the feature pyramid network, and the non-maximum suppression algorithm is applied to select the optimal bounding box to select the smallest bounding rectangle of the face region. Finally, the corresponding image region is cropped based on the bounding box coordinates. Pixel-level background removal is then performed to remove a small number of residual background pixels within the bounding box, ultimately resulting in a clean face image with no background interference and continuous texture.
3. The method for detecting forged face images based on target localization and mask reconstruction according to claim 1, characterized in that, When randomly applying local mask processing to a clean face image, a non-uniform random generation strategy is used to construct the local mask based on the distribution area of the facial organs. The local mask includes continuous region masks and discrete pixel masks; The continuous region mask is a continuous block of pixels in the shape of an irregular polygon or ellipse, and the discrete pixel mask is a set of randomly distributed isolated pixels. The area covered by the mask is within a preset range as a proportion of the total area of the clean face image. When the mask is generated, it avoids the key recognition area of the core facial organs or actively covers the area to form two mask types with different masking logics. By repeatedly performing mask generation and occlusion operations, each generated mask is unique in position, shape, and type, ultimately resulting in several face samples with differences in the degree of local information occlusion, occlusion position, and occlusion type.
4. The method for detecting forged face images based on target localization and mask reconstruction according to claim 1, characterized in that, In the autoencoder model with skip connections, the encoder includes a CNN local feature extraction module and a Transformer global attention module connected in sequence. The CNN local feature extraction module extracts local texture and detail features of the face image through multi-layer convolution and activation functions. The Transformer global attention module captures long-distance dependencies and global context features of the face image based on the Bottleneck Transformer structure. The skip connections directly pass the feature maps of different levels in the encoder to the corresponding levels in the decoder, enabling the fusion of low-level detail features and high-level semantic features.
5. The method for detecting forged face images based on target localization and mask reconstruction according to claim 1, characterized in that, The decoder includes a deconvolution layer, a batch normalization layer, and an activation function layer. The deconvolution layer is used to gradually restore the image resolution, the batch normalization layer is used to maintain the training process, and the activation function layer is used to enhance the nonlinear expressive ability of the model. After receiving the multi-scale features transmitted by the encoder, the decoder combines them with the low-level features passed in by the skip connections to perform pixel-by-pixel image reconstruction and outputs a reconstructed image with the same size as the input clean face image.
6. The method for detecting forged face images based on target localization and mask reconstruction according to claim 1, characterized in that, The process involves inputting a diverse set of samples into the autoencoder model for iterative training, using mean squared error as the reconstruction loss function, employing an adaptive learning rate adjustment strategy during training, dynamically adjusting the learning rate based on the changes in the loss value of each training batch, and terminating the iterative training when the training loss value is lower than a preset loss threshold or when a preset number of iterations is reached.
7. The method for detecting forged face images based on target localization and mask reconstruction according to claim 1, characterized in that, When calculating the pixel-level difference distribution map using the multi-scale geometric mean similarity measurement method, multi-scale downsampling is performed on the clean face image and the reconstructed image to obtain image pairs with different resolutions. At each scale, the geometric mean similarity matrix of the corresponding image pair is calculated, and the local difference map at that scale is obtained by matrix difference operation; After upsampling the local difference maps at all scales to the original image size, a weighted fusion strategy is used to obtain the final pixel-level difference distribution map.
8. The method for detecting forged face images based on target localization and mask reconstruction according to claim 1, characterized in that, When performing multi-scale analysis on the difference distribution map and extracting the maximum difference feature, the Gaussian pyramid decomposition algorithm is used to decompose the difference distribution map at multiple scales to obtain difference feature maps at different resolution levels. Then, adaptive threshold segmentation is performed on the difference feature maps at each level to filter out regions with significant differences. Finally, connected component analysis is performed on the filtered significant regions to calculate the difference peak value in each connected component. The maximum value among the difference peak values of all connected components is determined as the maximum difference feature.
9. The method for detecting forged face images based on target localization and mask reconstruction according to claim 1, characterized in that, The preset threshold is obtained by training on a verification dataset, which includes a preset number of fake face images and real face images. The preset threshold used to determine whether an image to be detected is a fake face image is initially defined by the user on the system side, and is adaptively adjusted according to the detection accuracy and false positive rate in the verification dataset.
Citation Information
Patent Citations
A method and system for detecting a deepfake face image
CN119625804B