Method and apparatus for detecting a fake image, computing apparatus, storage medium, and computer program product

By extracting local image patches and aggregating forgery probability scores on the image detection model, the problems of insufficient anti-perturbation ability in existing forgery image detection methods are solved, and high-precision and robust forgery image detection is achieved.

CN122243957APending Publication Date: 2026-06-19INST OF AUTOMATION CHINESE ACAD OF SCI

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INST OF AUTOMATION CHINESE ACAD OF SCI
Filing Date
2026-03-20
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing methods for detecting forged images are insufficient in dealing with unknown generative models and in terms of perturbation resistance, making it difficult to achieve high robustness and generalization. In particular, methods based on global image features are prone to overfitting, while methods based on local image patch features lack stability and interpretability.

Method used

The image detection model extracts local image patches from the input image, determines the forgery probability score of each local image patch, and forms the final forgery probability judgment through aggregation. Sliding window and random reservoir sampling techniques are used to ensure coverage and diversity. Feature extraction network and classifier are used to independently judge local features, and the stability is improved by combining the pruning average aggregation function.

Benefits of technology

It achieves high generalization ability, robustness against perturbations, and high accuracy in detecting forged images, and can maintain stability and interpretability under different generation models and perturbation conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122243957A_ABST
    Figure CN122243957A_ABST
Patent Text Reader

Abstract

A method, apparatus, computing device, storage medium, and computer program product for detecting forged images are provided. The image detection method includes: acquiring an input image; extracting local image patches from the input image using an image detection model to obtain at least some local image patches of the input image; determining a forgery probability score for each local image patch in the at least some local image patches using the image detection model; obtaining a forgery probability of the input image by aggregating the forgery probability scores of each local image patch in the at least some local image patches; and determining the input image as a forged image in response to the forgery probability of the input image being greater than a preset probability threshold. According to this disclosure, the forgery probabilities of multiple local image patches can be aggregated, and a final authenticity judgment result can be formed through spatial consensus, thereby achieving excellent generalization ability and robustness against disturbances while maintaining high accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the fields of computer vision, deep learning, and digital multimedia security technologies. More specifically, this disclosure relates to a method and apparatus for detecting forged images, a computing device, a storage medium, and a computer program product. Background Technology

[0002] With groundbreaking advancements in generative artificial intelligence (AIGC) technology, images generated using this technology have achieved or even surpassed levels of visual realism that are difficult for the human eye to distinguish. Generative AI technologies can include, for example, but are not limited to, diffusion models and generative adversarial networks. While generative AI technology has propelled the development of the creative industries, it has also brought unprecedented and severe challenges to the management of issues such as the spread of misinformation, digital identity fraud, and the social trust system. Therefore, accurately and robustly detecting images generated using generative AI technology has become one of the core technologies for ensuring the authenticity of digital content and cyberspace security.

[0003] Related methods for detecting images generated using generative artificial intelligence techniques can be mainly divided into two categories based on their basic processing and analysis units: detection methods based on global image features and detection methods based on local image patch features.

[0004] In methods based on global image features, the entire image is typically used as input to the image detection model. Deep convolutional neural networks (CNNs) or vision transformers are used to learn and extract image-level semantic features and global statistical patterns to classify real and fake images. While these methods achieve high accuracy on certain datasets, they heavily rely on the global semantic layout and style features (e.g., specific lighting distributions, object structure preferences, or global texture patterns) generated by specific generative models in the training data. This makes the image detection model prone to overfitting to these "generator fingerprints," failing to learn the essential forgery artifacts across different generative models. Therefore, when faced with new generative models not present in the training data (i.e., "unknown generators"), its detection performance drops drastically, exhibiting extremely poor cross-model generalization ability. This phenomenon is known as "generalization deception." Furthermore, if the image undergoes common post-processing operations during propagation (e.g., JPEG compression, Gaussian blur, scaling, etc.), the discriminative global statistical features may be weakened or destroyed first, further exacerbating the performance degradation of methods based on global image features.

[0005] To overcome the limitations of global methods, methods based on local image patch features have emerged. The core idea of ​​methods based on local image patch features is that artifacts left over from the generation process may be more evenly distributed in local areas of the image, and by analyzing these local areas, dependence on global semantics can be avoided. However, related methods based on local image patch features still have significant drawbacks: (1) In some related technologies, complex multi-stage architectures or self-attention mechanisms are used to establish the association between blocks, but in essence, the interference of global context information is not completely removed, and the semantic overfitting problem is not thoroughly solved; (2) In other related technologies, although the image is divided into image patches, inference often involves simple processing of the image patches and then splicing them together, and the authenticity is judged based on the spliced ​​image. Therefore, the lack of a systematic and adaptive aggregation mechanism based on local image patches makes it impossible to stably and comprehensively capture local artifacts scattered throughout the image. The detection results are easily affected by individual "difficult sample patches" or sampling randomness, resulting in insufficient stability and interpretability.

[0006] In summary, existing technologies struggle to achieve an effective balance between avoiding semantic overfitting to improve generalization and achieving stable and comprehensive aggregation of local evidence to ensure robustness. Therefore, there is an urgent need for a technique that forces image detection models to learn locally generalized generative artifact features, as well as an efficient dynamic aggregation framework, to improve the generalization, robustness, and interpretability of image detection using generative artificial intelligence techniques. Summary of the Invention

[0007] One or more exemplary embodiments of this disclosure provide a method and apparatus for detecting forged images, which can aggregate forgery probability evidence from multiple local image blocks and form a final authenticity judgment result through spatial consensus, thereby achieving excellent generalization ability and robustness against disturbances while maintaining high accuracy.

[0008] According to one or more exemplary embodiments of this disclosure, a method for detecting forged images is provided, comprising: acquiring an input image; extracting local image patches from the input image using an image detection model to obtain at least some local image patches of the input image; determining a forgery probability score for each local image patch in the at least some local image patches using the image detection model; obtaining a forgery probability of the input image by aggregating the forgery probability scores of each local image patch in the at least some local image patches; and determining the input image as a forged image in response to the forgery probability of the input image being greater than a preset probability threshold.

[0009] Optionally, the step of extracting local image patches from the input image using an image detection model to obtain at least some local image patches of the input image may include: extracting local image patches from the input image using the image detection model based on a sliding window of a predetermined size and a predetermined step size to obtain multiple local image patches of the input image, wherein when the sliding window extends beyond the boundary of one edge of the input image, pixels from the opposite edge of the input image are used to fill the portion of the sliding window that extends beyond the boundary, wherein the multiple local image patches of the input image cover all areas of the input image; and determining at least some local image patches of the input image based on the multiple local image patches of the input image.

[0010] Optionally, the step of determining at least a portion of local image blocks of the input image based on a plurality of local image blocks may include: determining whether the number of the plurality of local image blocks is greater than a preset block number threshold; when the number of the plurality of local image blocks is greater than the preset block number threshold, selecting a portion of local image blocks from the plurality of local image blocks as at least a portion of local image blocks of the input image, wherein the portion of local image blocks are representative local image blocks of the input image, and the number of the portion of local image blocks meets a predetermined requirement; when the number of the plurality of local image blocks is less than or equal to the preset block number threshold, using the plurality of local image blocks as at least a portion of local image blocks of the input image.

[0011] Optionally, the step of determining the forgery probability score of each local image patch in the at least some local image patches through the image detection model may include: extracting features from each local image patch in the at least some local image patches using the feature extraction network in the image detection model to obtain the features of each local image patch in the at least some local image patches; inputting the features of each local image patch in the at least some local image patches into the classifier in the image detection model, and determining the forgery probability score of each local image patch in the at least some local image patches through the classifier in the image detection model.

[0012] Optionally, the step of obtaining the forgery probability of the input image by aggregating the forgery probability scores of each local image block in the at least some local image blocks may include: removing forgery probability scores that do not meet a predetermined condition from all forgery probability scores of the at least some local image blocks to obtain the remaining forgery probability scores of the at least some local image blocks, wherein the predetermined condition is the forgery probability score in a predetermined sorting segment of the sorting result of all forgery probability scores of the at least some local image blocks sorted by size; and obtaining the forgery probability of the input image by performing an arithmetic mean operation on the remaining forgery probability scores of the at least some local image blocks.

[0013] Optionally, the method may further include: generating a forgery probability heatmap of the input image based on the forgery probability score of each local image block in the at least some local image blocks.

[0014] Optionally, the image detection model can be trained by the following operations: acquiring multiple training images, wherein the multiple training images include real images and images generated by at least one image generation model; extracting local image patches from the multiple training images using the image detection model to obtain at least a portion of local image patches in each of the multiple training images, and determining a forgery probability score for each local image patch in the at least a portion of local image patches in each of the multiple training images; determining a forgery judgment loss for each local image patch in the at least a portion of local image patches in each of the multiple training images based on the real / fake labels of each training image and the forgery probability score of each local image patch in the at least a portion of local image patches in each training image; determining a training loss for the multiple training images based on the average of the forgery judgment losses of all local image patches in the multiple training images; and updating the parameters of the image detection model based on the training loss.

[0015] Optionally, the step of extracting local image patches from the plurality of training images using the image detection model to obtain at least a portion of the local image patches of each of the plurality of training images may include: applying a spatial offset to the plurality of training images to obtain a plurality of spatially offset training images; and extracting local image patches from the spatially offset plurality of training images using the image detection model to obtain at least a portion of the local image patches of each of the spatially offset plurality of training images.

[0016] Optionally, the step of determining the forgery probability score of each local image patch in at least a portion of local image patches of each training image for each of the plurality of training images may include: extracting features from each local image patch in at least a portion of local image patches of each training image using the feature extraction network in the image detection model to obtain the features of each local image patch in at least a portion of local image patches; inputting the features of each local image patch in at least a portion of local image patches into the classifier in the image detection model, and determining the forgery probability score of each local image patch in at least a portion of local image patches through the classifier in the image detection model.

[0017] According to one or more exemplary embodiments of this disclosure, a forged image detection apparatus is provided, comprising: an image acquisition unit configured to acquire an input image; an image block extraction unit configured to extract local image blocks from the input image using an image detection model to obtain at least some local image blocks of the input image; a block forgery probability determination unit configured to determine a forgery probability score for each local image block among the at least some local image blocks using the image detection model; an image forgery probability determination unit configured to obtain a forgery probability of the input image by performing an aggregation operation on the forgery probability scores of each local image block among the at least some local image blocks; and a forged image determination unit configured to determine the input image as a forged image in response to the forgery probability of the input image being greater than a preset probability threshold.

[0018] Optionally, the image patch extraction unit may be configured to: extract local image patches from the input image using the image detection model, based on a sliding window of a predetermined size and a predetermined step size, to obtain multiple local image patches of the input image, wherein when the sliding window extends beyond the boundary of one edge of the input image, pixels from the opposite edge of the input image are used to fill the portion of the sliding window that extends beyond the boundary, wherein the multiple local image patches of the input image cover all areas of the input image; and determine at least some local image patches of the input image based on the multiple local image patches of the input image.

[0019] Optionally, the image patch extraction unit may be configured to: determine whether the number of the plurality of local image patches is greater than a preset patch count threshold; when the number of the plurality of local image patches is greater than the preset patch count threshold, select a portion of the local image patches from the plurality of local image patches as at least a portion of the local image patches of the input image, wherein the portion of the local image patches are representative local image patches of the input image, and the number of the portion of the local image patches meets a predetermined requirement; when the number of the plurality of local image patches is less than or equal to the preset patch count threshold, use the plurality of local image patches as at least a portion of the local image patches of the input image.

[0020] Optionally, the block forgery probability determination unit can be configured to: extract features from each local image block in the at least some local image blocks using the feature extraction network in the image detection model to obtain features of each local image block in the at least some local image blocks; input the features of each local image block in the at least some local image blocks into the classifier in the image detection model, and determine the forgery probability score of each local image block in the at least some local image blocks through the classifier in the image detection model.

[0021] Optionally, the image forgery probability determination unit may be configured to: remove forgery probability scores that do not meet predetermined conditions from all forgery probability scores of the at least partial local image blocks to obtain the remaining forgery probability scores of the at least partial local image blocks, wherein the predetermined conditions are forgery probability scores in a predetermined sorting segment of the sorting result of all forgery probability scores of the at least partial local image blocks sorted by size; and obtain the forgery probability of the input image by performing an arithmetic average operation on the remaining forgery probability scores of the at least partial local image blocks.

[0022] Optionally, the apparatus may further include: a forgery image generation unit configured to generate a forgery probability heatmap of the input image based on the forgery probability score of each local image block in the at least some local image blocks.

[0023] Optionally, the image detection model can be trained by the following operations: acquiring multiple training images, wherein the multiple training images include real images and images generated by at least one image generation model; extracting local image patches from the multiple training images using the image detection model to obtain at least a portion of local image patches in each of the multiple training images, and determining a forgery probability score for each local image patch in the at least a portion of local image patches in each of the multiple training images; determining a forgery judgment loss for each local image patch in the at least a portion of local image patches in each of the multiple training images based on the real / fake labels of each training image and the forgery probability score of each local image patch in the at least a portion of local image patches in each training image; determining a training loss for the multiple training images based on the average of the forgery judgment losses of all local image patches in the multiple training images; and updating the parameters of the image detection model based on the training loss.

[0024] Optionally, the step of extracting local image patches from the plurality of training images using the image detection model to obtain at least a portion of the local image patches of each of the plurality of training images may include: applying a spatial offset to the plurality of training images to obtain a plurality of spatially offset training images; and extracting local image patches from the spatially offset plurality of training images using the image detection model to obtain at least a portion of the local image patches of each of the spatially offset plurality of training images.

[0025] Optionally, the step of determining the forgery probability score of each local image patch in at least a portion of local image patches of each training image for each of the plurality of training images may include: extracting features from each local image patch in at least a portion of local image patches of each training image using the feature extraction network in the image detection model to obtain the features of each local image patch in at least a portion of local image patches; inputting the features of each local image patch in at least a portion of local image patches into the classifier in the image detection model, and determining the forgery probability score of each local image patch in at least a portion of local image patches through the classifier in the image detection model.

[0026] According to one or more example embodiments, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements a forged image detection method according to one or more example embodiments.

[0027] According to one or more example embodiments, a computing device is provided, comprising: a processor; and a memory storing a computer program that, when executed by the processor, implements a forged image detection method according to one or more example embodiments.

[0028] According to one or more example embodiments, a computer program product is provided, wherein the instructions in the computer program product are executable by a processor of a computer device to perform a forged image detection method according to one or more example embodiments.

[0029] According to the embodiments of the present disclosure, the forgery detection method and apparatus, computing device, storage medium and computer program product determine the forgery probability score of each local image block in at least some local image blocks of the input image during the model inference stage, and perform an aggregation operation on the forgery probability score of each local image block in at least some local image blocks to obtain the forgery probability of the input image. It can aggregate the forgery probabilities of multiple local image blocks and form a final authenticity judgment result through spatial consensus, thereby achieving excellent generalization ability and anti-disturbance robustness while maintaining high accuracy.

[0030] Further aspects and / or advantages of the general concept of this disclosure will be set forth in part in the description which follows, and in part will be clear from the description or may be learned by practice of the general concept of this disclosure. Attached Figure Description

[0031] The above and other objects and features of one or more exemplary embodiments will become clearer from the following description taken in conjunction with the accompanying drawings, which exemplarily illustrate the embodiments.

[0032] Figure 1 A flowchart illustrating a method for detecting fake images according to one or more example embodiments is shown.

[0033] Figure 2 A schematic diagram illustrating the results of forged image detection according to one or more example embodiments.

[0034] Figure 3 A schematic diagram illustrating the training and detection phases of a forged image detection technique according to an embodiment of the present disclosure is shown.

[0035] Figure 4 A schematic diagram illustrating the training phase of a forged image detection technique according to an embodiment of the present disclosure is shown.

[0036] Figure 5 A schematic diagram illustrating the detection phase of a forged image detection technique according to an embodiment of the present disclosure is shown.

[0037] Figure 6A block diagram of a forged image detection apparatus according to one or more example embodiments is shown.

[0038] Figure 7 A schematic diagram of a computing device 700 according to one or more example embodiments is shown. Detailed Implementation

[0039] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0040] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following examples do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0041] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel scenarios: "any one of the several items," "a combination of any number of the several items," and "all of the several items." For example, "including at least one of A and B" includes the following three parallel scenarios: (1) including A; (2) including B; (3) including A and B. Similarly, "performing at least one of step one and step two" indicates the following three parallel scenarios: (1) performing step one; (2) performing step two; (3) performing both steps one and step two. It should be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.

[0042] Currently, AI-generated image detection technology faces the core challenge of "generalization deception": the model is prone to overfitting to the global semantic features of a specific generation model in the training data, leading to a sharp decline in detection performance against unknown generation techniques. To address this fundamental technical bottleneck, this disclosure proposes a method for detecting forged images.

[0043] The following reference Figures 1 to 7 A detailed description of a forged image detection method and apparatus according to embodiments of the present disclosure is provided.

[0044] Figure 1 A flowchart illustrating a method for detecting fake images according to one or more example embodiments is shown.

[0045] Reference Figure 1In step S101, an input image is acquired. Here, the input image can be an image input by the user to be detected for authenticity. The input image can be, for example, but not limited to, at least one of an image generated by at least one image generation model, a real image, etc. A real image can include, for example, an image not generated by an image generation model. The image generation model can be, for example, but not limited to, a diffusion model, a generative adversarial network model, etc., used to generate fake images. Furthermore, the image generation model can be any model in the art that can be used to generate fake images, and this disclosure does not limit it.

[0046] In step S102, local image patches are extracted from the input image using an image detection model to obtain at least some local image patches of the input image.

[0047] In one or more example embodiments, the step of extracting local image patches from an input image using an image detection model to obtain at least some local image patches of the input image may include: extracting local image patches from the input image using an image detection model based on a sliding window of a predetermined size and a predetermined step size to obtain multiple local image patches of the input image, wherein when the sliding window extends beyond the boundary of one edge of the input image, pixels from the opposite edge of the input image are used to fill the portion of the sliding window that extends beyond the boundary, wherein the multiple local image patches of the input image cover all regions of the input image; and determining at least some local image patches of the input image based on the multiple local image patches of the input image.

[0048] For example, the structured local patch sampler (PatchSampler) in an image detection model can be used to densely sample the input image to be processed. The structured local patch sampler employs a sliding window strategy and introduces cyclic wrap-around padding to ensure unbiased coverage of images of any size, ultimately outputting a set of local image patches covering each region of the image. In the cyclic wrap-around padding strategy, when the sliding window exceeds the image boundary, pixels from the opposite edge of the image are used to fill the portion of the sliding window that exceeds the image boundary, thereby maintaining the continuity of the image manifold and avoiding artifacts introduced by zero-padding at the boundaries.

[0049] As an example, for an input image The structured local image patch sampler uses a sliding window strategy for sampling. The sliding window size is set to... (For example, Set the predetermined step size to ( (e.g., 32), thereby extracting a set of local image patches. These blocks can overlap in space.

[0050] In one or more example embodiments, the step of determining at least some local image blocks of an input image based on multiple local image blocks of an input image may include: determining whether the number of blocks of the multiple local image blocks is greater than a preset block number threshold; when the number of blocks of the multiple local image blocks is greater than the preset block number threshold, selecting some local image blocks from the multiple local image blocks as at least some local image blocks of the input image, wherein the partial local image blocks are representative local image blocks of the input image, and the number of partial local image blocks meets a predetermined requirement; when the number of blocks of the multiple local image blocks is less than or equal to the preset block number threshold, using the multiple local image blocks as at least some local image blocks of the input image.

[0051] Here, a representative local image patch of the input image means that these local image patches of the input image can include all the key features of the input image. Therefore, when using partial local image patches as at least partial local image patches of the input image, no key features of the input image are missed, thereby reducing the computational cost when using at least partial local image patches of the input image for subsequent calculations and encouraging feature diversity.

[0052] For example, the structured local block sampler can also integrate dynamic regularization techniques of random reservoir sampling to improve generalization ability. By using dynamic regularization techniques of random reservoir sampling, when the number of multiple local image blocks extracted from the input image exceeds a preset upper limit, a fixed-size, representative subset of local image blocks is extracted from the multiple local image blocks of the input image as at least a portion of the local image blocks of the input image, in order to control computational overhead and encourage diversity.

[0053] As an example, when the number of blocks of multiple local image patches extracted from the input image... Exceeding the preset limit When the random reservoir sampling algorithm is used, a subset of local image blocks of fixed size G and representativeness is extracted from multiple local image blocks of the input image as at least a partial set of local image blocks of the input image.

[0054] In step S103, the forgery probability score of each local image block in at least some local image blocks is determined by the image detection model.

[0055] In one or more example embodiments, the step of determining the forgery probability score of each local image patch in at least a portion of local image patches using an image detection model may include: extracting features from each local image patch in at least a portion of local image patches using a feature extraction network in the image detection model to obtain features of each local image patch in at least a portion of local image patches; inputting the features of each local image patch in at least a portion of local image patches into a classifier in the image detection model, and determining the forgery probability score of each local image patch in at least a portion of local image patches using the classifier in the image detection model. Here, the feature extraction network can be any network used in the art for feature extraction, and this disclosure does not limit it. For example, the feature extraction network can be a convolutional neural network, a visual transformer architecture network, or a backbone feature extraction network (such as ResNet, Vision Transformer, etc.). Here, the forgery probability score of each local image patch in at least a portion of local image patches is determined independently by the classifier in the image detection model.

[0056] As an example, the local image patch obtained in step S102 is input into a shared feature extraction network (e.g., a backbone feature extraction network) in the image detection model. By feature extraction network Feature extraction is performed on each local image patch to obtain the features (e.g., high-level feature representation) of each patch. The features of each local image patch are then input into the classifier of the image detection model. Through the classifier in the image detection model Determine the forgery probability score for each local image patch. .For example, .here, σ It is the Sigmoid function. It is a local image patch.

[0057] In step S104, the forgery probability of the input image is obtained by aggregating the forgery probability scores of each local image block in at least some local image blocks.

[0058] In one or more example embodiments, the step of obtaining the forgery probability of an input image by aggregating the forgery probability scores of each local image block in at least a portion of the local image blocks may include: removing forgery probability scores that do not meet predetermined conditions from all forgery probability scores of at least a portion of the local image blocks to obtain the remaining forgery probability scores of at least a portion of the local image blocks, wherein the predetermined conditions are the forgery probability scores in a predetermined sorting segment of the sorting result of all forgery probability scores of at least a portion of the local image blocks sorted by size; and obtaining the forgery probability of the input image by performing an arithmetic mean operation on the remaining forgery probability scores of at least a portion of the local image blocks.

[0059] As an example, the step of obtaining the forgery probability of the input image by aggregating the forgery probability scores of each local image patch in at least some local image patches may include: aggregating all block-level scores in at least some local image patches using a block-level training and consensus inference module in an image detection model. Applying aggregate functions To obtain the global image-level forgery probability For example, Here, aggregate functions This could be, for example, but not limited to, the trimmed average aggregation function. When using the trimmed average aggregation function, After sorting by size, remove the highest and lowest values. (For example, but not limited to, The score is calculated by taking the arithmetic mean of the remaining scores. By using the trimmed average aggregation function, interference from individual abnormal local image patches can be effectively resisted, thus improving the stability of forged image detection.

[0060] In step S105, in response to the fact that the probability of the input image being forged is greater than a preset probability threshold, the input image is determined to be a forged image.

[0061] Related technologies rely on end-to-end global image classification, with an opaque decision-making process that makes it difficult to locate forgery traces. In one or more example embodiments, the forgery image detection method may further include: generating a forgery probability heatmap of the input image based on the forgery probability score of each local image patch in at least some local image patches.

[0062] As an example, the step of generating a forgery probability heatmap of an input image based on the forgery probability score of each local image patch in at least some local image patches may include: assigning a forgery probability score to each local image patch according to its spatial location in the input image. A mapping process is performed, and a forgery probability heatmap of the input image is generated using an interpolation algorithm. Furthermore, the resolution of the forgery probability heatmap can be the same as the resolution of the input image. The forgery probability heatmap of the input image can visually reveal the spatial distribution of suspected forgery traces within the input image, providing pixel-level interpretation for determining the authenticity of the input image.

[0063] For example, Figure 2 A schematic diagram illustrating the results of forged image detection according to one or more example embodiments. Figure 2 As shown, the forged image detection results include a forged probability heatmap. Figure 2 The image shows the detection results for input images 1-6, including the forgery probability heatmap. Figure 2 As shown, the average forgery probability of input image 1 is 0.7712, that of input image 2 is 0.6758, that of input image 3 is 0.7362, that of input image 4 is 0.1774, that of input image 5 is 0.0124, and that of input image 6 is 0.1449. Input images 1-3 are identified as forged images, and images 4-6 are identified as genuine images. Figure 2 This displays a forgery probability heatmap with the same resolution as the input image. Alternatively, the forgery probability heatmap can also have a different resolution than the input image.

[0064] In one or more example embodiments, an image detection model can be trained by: acquiring a plurality of training images, wherein the plurality of training images include real images and images generated by at least one image generation model; extracting local image patches from the plurality of training images using the image detection model to obtain at least a portion of local image patches in each of the plurality of training images, and determining a forgery probability score for each local image patch in the at least a portion of local image patches of each training image for each of the plurality of training images; determining a forgery judgment loss for each local image patch in the at least a portion of local image patches of each training image for each of the plurality of training images based on the real / fake label of each training image and the forgery probability score for each local image patch in the at least a portion of local image patches of each training image; determining a training loss for the plurality of training images based on the average of the forgery judgment losses of all local image patches in the plurality of training images; and updating the parameters of the image detection model based on the training loss.

[0065] Here, real images can include, for example, images not generated by an image generation model. Image generation models can be, for example, but not limited to, diffusion models, generative adversarial networks, etc., models used to generate fake images. Furthermore, the image generation model can be any model in the art that can be used to generate fake images, and this disclosure does not limit it. Additionally, the multiple training images can be images from any large-scale dataset in the art (e.g., GenImage, AIGCDetectBenchmark, etc.), and this disclosure does not limit it. Here, for each local image patch, the probability of authenticity of each local image patch, or the probability of authenticity of the training image (e.g., the original image to which each local image patch belongs), is independently predicted using a shared classifier. Crucially, the model's loss function is calculated independently based on the fake probability score of each local image patch and the authenticity labels of the training image to obtain each block-level loss, and the block-level losses are summed, rather than aggregating the features of multiple local image patches to calculate a global loss. This block-level supervision approach forces the image detection model to learn discriminative features from each local image patch.

[0066] As an example, when training an image detection model, a batch of local image patches are obtained from the training images by the structured local block sampler in the image detection model. , local image patch The shared feature extraction network input into the image detection model In feature extraction networks In this process, each local image patch undergoes independent forward propagation to obtain its feature representation. Subsequently, the feature representation is passed through a shared classifier in the image detection model. The features of each local image patch are mapped to a scalar logical value. That is, for each sampled local image patch... Each is based on the image-level label of its training image (i.e., the original image). (0 for real, 1 for generated) Calculate the loss. For example, the FocalLoss function can be used to calculate the loss for each local image patch. The forgery judgment loss is used to handle potential imbalance problems. As an example, each local image patch... Forged judgment loss It could be: .here, σ It's the Sigmoid function. Finally, it can be used to extract a batch of local image patches. The average of the total forgery detection loss is used as the training loss for the training images. For example, the training loss for the training images could be... .

[0067] Through this fine-grained, block-based supervision signal, the feature extraction network The training method forces participants to examine each local region and search for microscopic statistical patterns that indicate the authenticity of an image, rather than relying on the overall semantic layout of the image. This training method directly leads to a phenomenon where the accuracy curves of the model on the training and validation sets closely match, a phenomenon known as "synchronous convergence." This indicates that the training method learns essential features with strong generalization capabilities, rather than semantic shortcuts specific to the dataset.

[0068] Furthermore, before extracting local image patches from multiple training images using the image detection model, each training image can undergo data preprocessing. Data preprocessing can include enhancement techniques such as normalization and random cropping to improve the robustness of the trained image detection model.

[0069] In one or more example embodiments, the step of extracting local image patches from multiple training images using an image detection model to obtain at least a portion of local image patches for each training image includes: extracting local image patches from each training image using an image detection model, based on a sliding window of a predetermined size and a predetermined step size, to obtain multiple local image patches for each training image, wherein when the sliding window extends beyond the boundary of one edge of each training image, pixels from the opposite edge of each training image are used to fill the portion of the sliding window that extends beyond the boundary, wherein the multiple local image patches of each training image cover all regions of each training image; and determining, for each training image, ... Determine whether the number of multiple local image blocks in each training image is greater than a preset block number threshold; for each training image among the multiple training images, when the number of multiple local image blocks in each training image is greater than the preset block number threshold, select a portion of local image blocks from the multiple local image blocks of each training image, and use the selected portion of local image blocks as at least a portion of local image blocks of each training image, wherein the selected portion of local image blocks are representative local image blocks of each training image and have a predetermined number; for each training image among the multiple training images, when the number of multiple local image blocks in each training image is less than or equal to the preset block number threshold, use the multiple local image blocks of each training image as at least a portion of local image blocks of each training image.

[0070] For example, dense sampling of each of multiple training images can be performed using a structured local block sampler in an image detection model.

[0071] In one or more example embodiments, the step of extracting local image patches from multiple training images using an image detection model to obtain at least a portion of the local image patches of each training image may include: applying a spatial offset to the multiple training images to obtain multiple spatially offset training images; and extracting local image patches from the multiple spatially offset training images using an image detection model to obtain at least a portion of the local image patches of each training image.

[0072] For example, the structured local block sampler can also integrate random reservoir sampling and translation dithering dynamic regularization techniques to improve generalization ability. By using random reservoir sampling dynamic regularization, when the number of local image patches extracted from the input image exceeds a preset limit, a fixed-size, representative subset of local image patches is extracted from the multiple local image patches of the input image as at least a portion of the local image patches, thus controlling computational overhead and encouraging diversity. By using translation dithering dynamic regularization, a random spatial offset is applied to the entire sampling grid in each training epoch. This mechanism forces the image detection model to learn translation-invariant features, preventing it from overfitting to fixed spatial patterns in the input image.

[0073] In one or more example embodiments, the step of determining the forgery probability score of each local image patch in at least a portion of local image patches of each training image for each of a plurality of training images may include: extracting features from each local image patch in at least a portion of local image patches of each training image using a feature extraction network in an image detection model to obtain features of each local image patch in at least a portion of local image patches; inputting the features of each local image patch in at least a portion of local image patches into a classifier in an image detection model, and determining the forgery probability score of each local image patch in at least a portion of local image patches using the classifier in the image detection model. Here, for the features of each local image patch, the authenticity probability of the training image (e.g., the original image to which it belongs) of each local image patch is independently predicted using a shared classifier.

[0074] In one or more example embodiments, the step of updating the parameters of the image detection model based on the training loss may include: updating the parameters of the feature extraction network and the classifier in the image detection model based on the training loss.

[0075] Figure 3 A schematic diagram illustrating the training and detection phases of a forged image detection technique according to an embodiment of the present disclosure is shown. Figure 4A schematic diagram illustrating the training phase of a forged image detection technique according to an embodiment of the present disclosure is shown. Figure 5 A schematic diagram illustrating the detection phase of a forged image detection technique according to embodiments of the present disclosure is shown. Figure 3 and Figure 4 As shown, in the training phase of the forged image detection technology disclosed herein, in step S401, a training dataset is acquired, and multiple local image patches are extracted from each training image using a structured block sampler; in step S402, the multiple local image patches are input into a shared feature extraction network to obtain the feature representation of each local image patch; in step S403, based on the feature representation of each local image patch, the forgery probability score of each local image patch is determined; in step S404, based on the forgery probability score of each local image patch and the overall authenticity label of its image, the block-level loss of each local image patch is calculated independently, and the average of the block-level losses of all local image patches is used as the total loss to update the parameters of the feature extraction network and classifier of the image detection model, thus completing the block-level supervised training.

[0076] like Figure 3 and Figure 5 As shown, in step S501, an input image is acquired, and local image patches are extracted from the input image using an image detection model to obtain at least some local image patches of the input image; in step S502, the features of each local image patch in the at least some local image patches are determined using an image detection model; in step S503, based on the features of each local image patch in the at least some local image patches, a forgery probability score of each local image patch in the at least some local image patches is determined; in step S504, the forgery probability of the input image is obtained by aggregating the forgery probability scores of each local image patch in the at least some local image patches, and in response to the forgery probability of the input image being greater than a preset probability threshold, the input image is determined to be a forged image.

[0077] In summary, the forged image detection technology according to embodiments of this disclosure combines a block-level fine-grained supervised training paradigm with a multi-block spatial consensus inference paradigm. During model training, block-level fine-grained supervision forces the feature extraction network to learn general generated artifact features independent of the overall image semantics from each local image patch. This forces the image detection model to learn based on a large number of randomly sampled local image patches, decoupling it from its dependence on the global semantic context and thus decoupling it from the global context that could lead to overfitting. The model then focuses on mining essential local micro-statistical features across models. During model inference, multi-block spatial consensus inference is employed, aggregating multiple forgery probabilities from different regions of the image to form a stable final decision. This collaborative design of "decoupling semantics and aggregating evidence" enables this disclosure to achieve excellent cross-model generalization ability and robustness against perturbations while maintaining high accuracy. Furthermore, the forged image detection technology according to embodiments of this disclosure can also generate interpretable forgery localization heatmaps, thereby improving inherent interpretability.

[0078] It is understood that the structured local block sampler, feature extraction network, classifier, block-level training and consensus inference module, and other modules described in one or more example embodiments of this disclosure can be either software algorithm modules executed on a general-purpose processor or designed as dedicated hardware acceleration modules. The above module division is for illustrative purposes only; in actual products, the functions of these modules can be further split or merged, and any technical solutions involving further splitting or merging of the functions of these modules fall within the protection scope of this invention.

[0079] The above has been combined Figures 1 to 5 A method for detecting forged images according to one or more example embodiments has been described. Hereinafter, reference will be made to... Figure 6 A forged image detection apparatus and its units according to one or more example embodiments are described.

[0080] Figure 6 A block diagram of a forged image detection apparatus according to one or more example embodiments is shown.

[0081] Reference Figure 6 The forged image detection device includes an image acquisition unit 610, an image block extraction unit 620, a block forgery probability determination unit 630, an image forgery probability determination unit 640, and a forged image determination unit 650. The image acquisition unit 610 is configured to acquire an input image.

[0082] The image patch extraction unit 620 is configured to extract local image patches from the input image using an image detection model to obtain at least some local image patches of the input image.

[0083] In one or more example embodiments, the image patch extraction unit 620 may be configured to: extract local image patches from an input image using an image detection model, based on a sliding window of a predetermined size and a predetermined step size, to obtain a plurality of local image patches of the input image, wherein when the sliding window extends beyond the boundary of one edge of the input image, pixels of the opposite edge of the input image are used to fill the portion of the sliding window that extends beyond the boundary, wherein the plurality of local image patches of the input image cover all regions of the input image; and determine at least some local image patches of the input image based on the plurality of local image patches of the input image.

[0084] In one or more example embodiments, the image patch extraction unit 620 may be configured to: determine whether the number of patches of a plurality of local image patches is greater than a preset patch number threshold; when the number of patches of a plurality of local image patches is greater than the preset patch number threshold, select a portion of local image patches from the plurality of local image patches as at least a portion of local image patches of the input image, wherein the portion of local image patches are representative local image patches of the input image, and the number of the portion of local image patches meets a predetermined requirement; when the number of patches of a plurality of local image patches is less than or equal to the preset patch number threshold, use the plurality of local image patches as at least a portion of local image patches of the input image.

[0085] The block forgery probability determination unit 630 is configured to determine the forgery probability score of each local image block in at least a portion of the local image blocks using an image detection model.

[0086] In one or more example embodiments, the block forgery probability determination unit 630 may be configured to: extract features from each local image block in at least a portion of the local image blocks using a feature extraction network in an image detection model to obtain features of each local image block in at least a portion of the local image blocks; input the features of each local image block in at least a portion of the local image blocks into a classifier in an image detection model to determine a forgery probability score of each local image block in at least a portion of the local image blocks using the classifier in the image detection model.

[0087] The image forgery probability determination unit 640 is configured to obtain the forgery probability of the input image by performing an aggregation operation on the forgery probability scores of each local image block in at least some local image blocks.

[0088] In one or more example embodiments, the image forgery probability determination unit 640 may be configured to: remove forgery probability scores that do not meet predetermined conditions from all forgery probability scores of at least a portion of local image blocks to obtain the remaining forgery probability scores of at least a portion of local image blocks, wherein the predetermined conditions are forgery probability scores in a predetermined sorting segment of a sorting result in which all forgery probability scores of at least a portion of local image blocks are sorted by size; and obtain the forgery probability of the input image by performing an arithmetic mean operation on the remaining forgery probability scores of at least a portion of local image blocks.

[0089] The forged image determination unit 650 is configured to determine the input image as a forged image in response to the forgery probability of the input image being greater than a preset probability threshold.

[0090] In one or more example embodiments, the forgery image detection apparatus may further include: a forgery map generation unit (not shown), configured to generate a forgery probability heatmap of the input image based on the forgery probability score of each local image block in at least some local image blocks.

[0091] Furthermore, according to one or more example embodiments, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed, implements the forged image detection method according to one or more example embodiments.

[0092] In one or more example embodiments, a computer-readable storage medium may carry one or more computer programs that, when executed, perform the following steps: acquiring an input image; extracting local image patches from the input image using an image detection model to obtain at least some local image patches of the input image; determining a forgery probability score for each local image patch in the at least some local image patches using the image detection model; obtaining a forgery probability of the input image by aggregating the forgery probability scores of each local image patch in the at least some local image patches; and determining the input image as a forgery image in response to the forgery probability of the input image being greater than a preset probability threshold.

[0093] Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In embodiments of this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a computer program that can be used by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof. A computer-readable storage medium can be included in any apparatus; it can also exist independently without being assembled into that apparatus.

[0094] Furthermore, according to one or more example embodiments, a computer program product is also provided, wherein the instructions in the computer program product are executable by a processor of a computer device to perform a method for detecting forged images according to one or more example embodiments.

[0095] The above has been combined Figure 6 A forged image detection apparatus according to one or more example embodiments has been described. Next, in conjunction with… Figure 7 A computing device according to one or more example embodiments is described.

[0096] Figure 7 A schematic diagram of a computing device 700 according to one or more example embodiments is shown.

[0097] Reference Figure 7 A computing device 700 according to one or more example embodiments includes a memory 710 and a processor 720, wherein the memory 710 stores a computer program that, when executed by the processor 720, implements a forged image detection method according to one or more example embodiments.

[0098] As an example, computing device 700 may be a computer, smartphone, tablet, personal digital assistant, or other electronic terminal capable of executing the aforementioned computer programs. In computing device 700, processor 720 may include a central processing unit (CPU), graphics processing unit (GPU), programmable logic device, dedicated processor system, microcontroller, or microprocessor. As an example, and not a limitation, processor may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, etc. Processor 720 may execute instructions or code stored in memory 710, which may also store data. Instructions and data may also be sent and received via a network through a network interface device, which may employ any known transmission protocol. Memory 710 may be integrated with processor 720, for example, by arranging RAM or flash memory within an integrated circuit microprocessor. Furthermore, memory 710 may include separate devices, such as external disk drives, storage arrays, or other storage devices usable by any database system. The memory 710 and the processor 720 may be operationally coupled, or may communicate with each other, for example, through I / O ports, network connections, etc., so that the processor 720 can read files stored in the memory.

[0099] In addition, the computing device 700 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, touch input device, etc.). All components of the computing device 700 can be interconnected via a bus and / or a network.

[0100] The above has been referred to Figures 1 to 7 A method and apparatus for detecting forged images according to one or more example embodiments have been described. However, it should be understood that: Figure 6 The forged image detection device and its units shown can be configured as software, hardware, firmware, or any combination thereof to perform specific functions. Figure 7 The computing device shown is not limited to the components shown above, but some components may be added or removed as needed, and the above components may also be combined.

[0101] According to the embodiments of the present disclosure, the forgery detection method and apparatus, computing device, storage medium and computer program product determine the forgery probability score of each local image block in at least some local image blocks of the input image during the model inference stage, and perform an aggregation operation on the forgery probability score of each local image block in at least some local image blocks to obtain the forgery probability of the input image. It can aggregate the forgery probabilities of multiple local image blocks and form the final authenticity judgment result through spatial consensus, thereby achieving excellent generalization ability and anti-disturbance robustness while maintaining high accuracy.

[0102] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0103] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A method for detecting forged images, characterized in that, The method includes: Obtain the input image; The input image is processed by an image detection model to extract local image patches, thereby obtaining at least some local image patches of the input image; The forgery probability score of each local image block in the at least partial local image blocks is determined by the image detection model; The forgery probability of the input image is obtained by aggregating the forgery probability scores of each local image block in the at least some local image blocks; If the probability of forgery of the input image is greater than a preset probability threshold, the input image is determined to be a forged image.

2. The method for detecting forged images according to claim 1, characterized in that, The step of extracting local image patches from the input image using an image detection model to obtain at least some local image patches of the input image includes: Using the image detection model, based on a sliding window of a predetermined size and a predetermined step size, local image patches are extracted from the input image to obtain multiple local image patches of the input image. When the sliding window exceeds the boundary of one edge of the input image, the pixels of the opposite edge of the input image are used to fill the part of the sliding window that exceeds the boundary. The multiple local image patches of the input image cover all areas of the input image. Based on multiple local image patches of the input image, at least some local image patches of the input image are determined.

3. The forged image detection method according to claim 2, characterized in that, The step of determining at least some local image patches of the input image based on multiple local image patches of the input image includes: Determine whether the number of the plurality of local image blocks is greater than a preset block number threshold; When the number of the plurality of local image blocks is greater than the preset block number threshold, a portion of the local image blocks are selected from the plurality of local image blocks as at least a portion of the local image blocks of the input image, wherein the portion of the local image blocks are representative local image blocks of the input image, and the number of the portion of the local image blocks meets a predetermined requirement; When the number of the plurality of local image blocks is less than or equal to the preset block number threshold, the plurality of local image blocks are used as at least a portion of the local image blocks of the input image.

4. The forged image detection method according to claim 1, characterized in that, The step of determining the forgery probability score of each local image patch in the at least partial local image patches using the image detection model includes: The feature extraction network in the image detection model is used to extract features from each local image block in the at least partial local image blocks, thereby obtaining the features of each local image block in the at least partial local image blocks; The features of each local image patch in the at least partial local image patch are respectively input into the classifier in the image detection model, and the forgery probability score of each local image patch in the at least partial local image patch is determined by the classifier in the image detection model.

5. The method for detecting forged images according to claim 1, characterized in that, The step of obtaining the forgery probability of the input image by aggregating the forgery probability scores of each local image patch in at least some of the local image patches includes: Remove the forgery probability scores that do not meet the predetermined conditions from all the forgery probability scores of the at least partial local image block to obtain the remaining forgery probability scores of the at least partial local image block, wherein the predetermined conditions are the forgery probability scores in a predetermined sorting segment of the sorting result of all the forgery probability scores of the at least partial local image block sorted by size. The forgery probability of the input image is obtained by performing an arithmetic average of the remaining forgery probability scores of at least some local image patches.

6. The method according to claim 1, characterized in that, The method further includes: A forgery probability heatmap of the input image is generated based on the forgery probability score of each local image patch in the at least some local image patches.

7. The forged image detection method as described in claim 1, characterized in that, The image detection model is trained using the following steps: Acquire multiple training images, wherein the multiple training images include real images and images generated by at least one image generation model; The image detection model extracts local image patches from the plurality of training images to obtain at least a portion of local image patches in each of the plurality of training images. For each of the plurality of training images, the forgery probability score of each local image patch in the at least a portion of local image patches in each of the plurality of training images is determined. For each of the plurality of training images, based on the true / false labels of each training image and the forgery probability score of each local image block in at least some local image blocks of each training image, the forgery judgment loss of each local image block in at least some local image blocks of each training image is determined. The training loss of the multiple training images is determined based on the average value of the forgery detection loss of all local image patches of the multiple training images. The parameters of the image detection model are updated based on the training loss.

8. The method for detecting forged images according to claim 7, characterized in that, The step of extracting local image patches from the plurality of training images using the image detection model to obtain at least a portion of the local image patches of each of the plurality of training images includes: A spatial offset is applied to the plurality of training images to obtain a plurality of spatially offset training images; The image detection model is used to extract local image patches from the multiple training images of the spatial offset, thereby obtaining at least a portion of the local image patches of each training image in the multiple training images of the spatial offset.

9. The method for detecting forged images according to claim 7, characterized in that, For each of the plurality of training images, the step of determining the forgery probability score of each local image patch in at least a subset of local image patches of each training image includes: For at least a portion of local image patches in each training image, feature extraction is performed on each local image patch in the at least a portion of local image patches using the feature extraction network in the image detection model to obtain the features of each local image patch in the at least a portion of local image patches. The features of each local image patch in the at least partial local image patch are respectively input into the classifier in the image detection model, and the forgery probability score of each local image patch in the at least partial local image patch is determined by the classifier in the image detection model.

10. A forged image detection device, characterized in that, The device includes: The image acquisition unit is configured to acquire the input image; The image patch extraction unit is configured to extract local image patches from the input image using an image detection model to obtain at least some local image patches of the input image; A block forgery probability determination unit is configured to determine a forgery probability score for each local image block in the at least some local image blocks using the image detection model; The image forgery probability determination unit is configured to obtain the forgery probability of the input image by performing an aggregation operation on the forgery probability scores of each local image block in the at least some local image blocks; The forged image determination unit is configured to determine the input image as a forged image in response to the forgery probability of the input image being greater than a preset probability threshold.

11. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the forged image detection method according to any one of claims 1 to 9.

12. A computing device, characterized in that, The computing device includes: processor; Memory, which stores computer programs When the computer program is executed by the processor, it implements the forged image detection method according to any one of claims 1 to 9.