Method and device for detecting ai-generated images, electronic equipment and storage medium

By performing block-based filtering and resampling on AI-generated images, combined with cross-artifact alignment and gated fusion techniques, the problems of missed detections and false judgments in image authenticity assessment in existing technologies have been solved, achieving higher detection accuracy and reliability.

CN122156176APending Publication Date: 2026-06-05INST 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-19
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, relying solely on high-level semantic information to determine the authenticity of images can easily lead to missed detections or misjudgments when faced with generated images that have highly reasonable semantic logic and extremely realistic visual perception.

Method used

The image is segmented and filtered by the artifact attention focusing unit. Combined with the resampling process of the preprocessing unit, low-level features and semantic features are extracted. Feature fusion is performed in the artifact fusion module. Dynamic weighted summation is performed using the cross-artifact alignment unit and the gated fusion unit to generate the final image detection result.

Benefits of technology

It improves the accuracy and reliability of AI-generated image detection, can accurately locate key areas, achieve multi-dimensional feature fusion at different levels of abstraction, and reduce missed detections and false judgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122156176A_ABST
    Figure CN122156176A_ABST
Patent Text Reader

Abstract

The application provides an AI-generated image detection method and device, electronic equipment and storage medium, belonging to the field of artificial intelligence technology, comprising: inputting a to-be-detected image into an image detection model to obtain an image detection result output by the image detection model; an artifact attention focusing unit performs block screening on the to-be-detected image to generate a target image block; a preprocessing unit performs resampling processing on the input target image block to generate bottom-level features and semantic features; an artifact fusion module performs feature fusion based on the input bottom-level features and semantic features to generate fusion features; and an image detection result is generated based on the fusion features. The application accurately locates the key area by performing block screening on the image through the artifact attention focusing unit, synchronously extracts bottom-level features and semantic features by combining the resampling processing of the preprocessing unit, and then realizes multi-dimensional feature fusion at different abstraction levels, thereby improving the accuracy and reliability of AI-generated image detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, electronic device, and storage medium for detecting AI-generated images. Background Technology

[0002] The detection of images generated by artificial intelligence (AI) refers to determining whether an image was created by humans or generated by an AI model. It is an important part of image authenticity verification and public opinion management.

[0003] Currently, the authenticity of an image is usually determined from the perspectives of semantic consistency, common sense violation, or semantic structural anomalies. However, this method relies solely on high-level semantic information, which makes it prone to missed detections or misjudgments when faced with generated images that have highly reasonable semantic logic and extremely realistic visual perception. Summary of the Invention

[0004] This invention provides a method, apparatus, electronic device, and storage medium for detecting AI-generated images, which addresses the shortcomings of existing technologies that rely solely on high-level semantic information to determine image authenticity. This leads to missed detections or misjudgments when faced with generated images that have highly reasonable semantic logic and extremely realistic visual perception. The invention achieves complete acquisition of discrimination information at different levels of abstraction in the generated images, thereby improving the accuracy and reliability of AI-generated image detection.

[0005] This invention provides a method for detecting AI-generated images, comprising the following steps: The image to be detected is input into the image detection model, and the image detection result output by the image detection model is obtained. The image detection model includes an artifact focusing module, an artifact fusion module, and an output module; the artifact focusing module includes an artifact attention focusing unit and a preprocessing unit. The artifact attention focusing unit divides the input image to be detected into blocks and filters them to generate target image blocks; the preprocessing unit resamples the input target image blocks to generate low-level features and semantic features; the artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features; and the output module generates the image detection result based on the fused features.

[0006] According to the AI-generated image detection method provided by the present invention, the artifact fusion module includes a feature extraction unit, a cross-artifact alignment unit, and a gated fusion unit; The feature extraction unit includes a first feature extraction subunit, a second feature extraction subunit, and a third feature extraction subunit.

[0007] According to a method for detecting AI-generated images provided by the present invention, the artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features, including: The first feature extraction subunit extracts features from the input low-level features to generate low-level prior features; the second feature extraction subunit extracts features from the input semantic features to generate semantic prior features; and the third feature extraction subunit extracts features from the input semantic features to generate a basic vector. The cross-artifact alignment unit performs cross-attention calculation on the underlying prior features and the semantic prior features to generate alignment features; The gated fusion unit performs self-attention calculation on the alignment features to generate self-attention features; calculates the difference between the self-attention features and the alignment features to obtain residual features; and uses learnable gating parameters to perform weighted summation of the residual features and the base vector to generate the fused features.

[0008] According to a detection method for AI-generated images provided by the present invention, the preprocessing unit includes a low-level branch subunit and a semantic branch subunit; the preprocessing unit performs resampling processing on the input target image patch to generate low-level features and semantic features, including: The bottom-level branch subunit performs nearest-neighbor resampling on the input target image block and performs a first convolution operation on the image block after nearest-neighbor resampling to generate the bottom-level features. The semantic branch subunit performs bilinear resampling on the input target image block and performs a second convolution operation on the bilinearly resampled image block to generate the semantic features.

[0009] According to a method for detecting AI-generated images provided by the present invention, the artifact attention focusing unit performs block filtering on the input image to be detected to generate target image blocks, including: The input image to be detected is divided into multiple initial image blocks; Calculate the texture complexity and frequency energy of each of the initial image blocks; Based on the texture complexity and the frequency energy, the saliency score of each initial image patch is calculated; According to the saliency score in descending order, a preset number of initial image blocks are selected from multiple initial image blocks, and the preset number of initial image blocks are determined as the target image blocks.

[0010] According to the present invention, an AI-generated image detection method is provided, wherein the image detection model is trained based on the following steps: Collect image training samples, which include real image samples and AI-generated image samples; Generate real-world labels corresponding to the image training samples; The training process is executed iteratively until the preset termination condition is met. The training process includes: The image training samples are input into the image detection model to be trained, and the prediction results output by the image detection model to be trained are obtained. Calculate the target loss between the prediction result and the real label; The network parameters of the image detection model to be trained are updated based on the target loss.

[0011] According to the AI-generated image detection method provided by the present invention, the prediction result includes a low-level prediction result, a semantic prediction result, and a fusion prediction result; the target loss is calculated based on the following loss function: ; in, For the target loss, The cross-entropy loss is the difference between the semantic prediction result and the real label. The cross-entropy loss is the difference between the underlying prediction result and the true label. The cross-entropy loss is the difference between the fused prediction result and the true label. , and These are the preset weighting coefficients.

[0012] The present invention also provides a detection device for AI-generated images, comprising: An image input unit is used to input the image to be detected into the image detection model; The detection result output unit is used to obtain the image detection result output by the image detection model; The image detection model includes an artifact focusing module, an artifact fusion module, and an output module; the artifact focusing module includes an artifact attention focusing unit and a preprocessing unit. The artifact attention focusing unit divides the input image to be detected into blocks and filters them to generate target image blocks; the preprocessing unit resamples the input target image blocks to generate low-level features and semantic features; the artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features; and the output module generates the image detection result based on the fused features.

[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the detection method for AI-generated images as described above.

[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the detection method for AI-generated images as described above.

[0015] The AI-generated image detection method, apparatus, electronic device, and storage medium provided by this invention use an artifact attention focusing unit to segment and filter images to accurately locate key regions, and combine the resampling processing of the preprocessing unit to simultaneously extract low-level features and semantic features, thereby achieving multi-dimensional feature fusion at different levels of abstraction, which can improve the accuracy and reliability of AI-generated image detection. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating the detection method for AI-generated images provided by the present invention.

[0018] Figure 2 This is a schematic diagram of the feature fusion process based on underlying features and semantic features provided by the present invention.

[0019] Figure 3 This is a schematic diagram of the process for generating underlying features and semantic features provided by the present invention.

[0020] Figure 4 This is a schematic diagram of the process for generating target image blocks provided by the present invention.

[0021] Figure 5 This is a schematic diagram of the training image detection model provided by the present invention.

[0022] Figure 6 This is a schematic diagram of the image detection model provided by the present invention.

[0023] Figure 7 This is a schematic diagram of the structure of the AI-generated image detection device provided by the present invention.

[0024] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this 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 this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0026] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0027] The terms "first," "second," etc., used in this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more.

[0028] To facilitate a full understanding of the technical solution of this application, the following content is hereby introduced: With the rapid development of Generative Adversarial Networks (GANs) and diffusion models, AI-Generated Images (AIGIs) have become highly similar to real images in terms of resolution, detail consistency, and semantic plausibility, posing serious challenges to image authenticity verification, public opinion management, content security, and forensic evidence collection. Existing AI-Generated Image Detection methods mainly focus on artifacts and can be broadly categorized into three types: (1) Low-level artifact modeling methods: High-frequency anomalies and statistical biases introduced by the generative model at the pixel level are captured through frequency domain analysis, pixel correlation modeling, or upsampling anomaly detection. For example, detection methods based on spectral distribution, residual filtering, or gradient response.

[0029] (2) Semantic artifact modeling method: Using large-scale pre-trained models, such as Contrastive Language-Image Pre-training (CLIP) model, VisionTransformer (ViT), etc., to judge whether the image is real from the perspective of high-level semantic consistency, common sense violation or semantic structure abnormality.

[0030] (3) Artifact fusion method: By using a multi-branch network or feature splicing method, the underlying artifacts and semantic artifacts are jointly modeled in order to obtain more comprehensive discrimination information.

[0031] While the above methods have achieved certain results in specific scenarios, they still have the following key shortcomings in practical applications: First, there is the problem of distribution mismatch. Low-level artifacts are usually distributed locally and unstructured, while semantic artifacts are concentrated in salient semantic regions. The two have natural differences in spatial distribution and scale level, and direct unified modeling can easily lead to feature imbalance. Second, there is the problem of vulnerability difference. Low-level artifacts are highly sensitive to pixel-level perturbations such as compression and scaling, while semantic artifacts are more susceptible to structural perturbations such as cropping and blurring. Unified preprocessing often weakens both types of information at the same time. Third, there is the problem of information conflict. Low-level artifacts and semantic features are at different levels of abstraction, and their feature spaces are significantly different. Simple splicing or weighted fusion can easily produce negative transfer between features.

[0032] Therefore, there is an urgent need for an AI-generated image detection method that can customize the preservation, alignment, and fusion of different features.

[0033] The following is combined with Figures 1-8 This invention describes the detection method, apparatus, electronic device, and storage medium for AI-generated images provided by the present invention.

[0034] Figure 1 This is a flowchart illustrating the detection method for AI-generated images provided by the present invention, as shown below. Figure 1 As shown, the execution subject of the AI-generated image detection method provided by the present invention can be a server, a cloud computing platform, or a computer capable of executing the method of the present invention, etc. Unless otherwise specified, the following embodiments will be described using a server as an example.

[0035] As an optional embodiment, the detection method for AI-generated images mainly includes, but is not limited to, the following steps: Step 110: Input the image to be detected into the image detection model.

[0036] The image to be detected refers to an image that needs to be verified for authenticity, source determination, or content security review. For example, the image to be detected may be an unverified picture uploaded by a user on a social network platform, or a high-definition picture with extremely high visual realism generated by an unknown artificial intelligence diffusion model.

[0037] The image detection model includes an artifact focusing module, an artifact fusion module, and an output module; the artifact focusing module includes an artifact attention focusing unit and a preprocessing unit.

[0038] The artifact focusing module is used to locate artifact-exposed areas in an image and apply preprocessing strategies to maintain the integrity of artifact information. For example, the artifact attention focusing unit can segment the input image to be detected into blocks to generate target image patches, and the preprocessing unit can resample the input target image patches to extract low-level features that preserve pixel details and semantic features that ensure smooth spatial structure.

[0039] The artifact fusion module is used to reduce spatial and scale differences between features at different levels of abstraction and to enhance the discriminative complementarity between different features. For example, the artifact fusion module can perform cross-artifact feature alignment and joint modeling based on the input low-level features and semantic features, thereby generating fused features that combine low-level and semantic features into a unified representation space.

[0040] The output module is used to generate the final classification and discrimination results based on the fused unified representation space.

[0041] The artifact attention focusing unit divides the input image to be detected into blocks and generates target image blocks; the preprocessing unit resamples the input target image blocks to generate low-level features and semantic features; the artifact fusion module fuses features based on the input low-level features and semantic features to generate fused features; and the output module generates image detection results based on the fused features.

[0042] Block filtering refers to the process of locating and extracting potential artifact-exposed areas in an image. For example, block filtering can be achieved by introducing a lightweight attention module, calculating a saliency score based on the texture complexity and frequency energy of the image blocks, and selecting them in descending order of score.

[0043] The target image patch refers to the local image region that has been filtered and retained and contains rich discriminative information and significant artifacts. For example, the target image patch can be the top few basic image patches with the highest saliency scores. These image patches can accurately locate the high-frequency and low-texture artifact exposure areas, thereby avoiding blindly learning the semantic bias of the dataset.

[0044] Resampling refers to the operation of adjusting the resolution of image patches or the arrangement of pixels to preserve specific information in a customized manner based on the characteristics of different dimensions. For example, nearest neighbor resampling can be used to amplify pixel details and maintain local correlation, or bilinear resampling can be used to adjust the resolution to ensure smooth spatial structure.

[0045] Low-level features and semantic features refer to the representation of an image at the pixel detail statistical level and the high-level global structure level, respectively. For example, low-level features can be pixel-level features that reflect high-frequency anomalies, local unstructured distributions, and sensitivity to perturbations such as compression and scaling. Semantic features can be high-dimensional abstract features that reflect the spatial structure, global coherence, and susceptibility to structural perturbations such as cropping and blurring.

[0046] Fusion features refer to the joint features that align low-level features and semantic features that are at different levels of abstraction and have natural differences in scale, and map them to a unified representation space.

[0047] Step 120: Obtain the image detection results output by the image detection model.

[0048] Image detection results refer to the final judgment on the authenticity or source of the image to be detected after multi-dimensional feature extraction, alignment and fusion processing within the image detection model. For example, image detection results can be binary labels used to indicate whether the image to be detected was taken and created by a real human or generated by artificial intelligence.

[0049] The AI-generated image detection method provided by this invention uses an artifact attention focusing unit to segment and filter images to accurately locate key regions, and combines the resampling process of the preprocessing unit to extract low-level features and semantic features simultaneously, thereby achieving multi-dimensional feature fusion at different levels of abstraction, which can improve the accuracy and reliability of AI-generated image detection.

[0050] In another embodiment provided by the present invention, the artifact fusion module includes a feature extraction unit, a cross-artifact alignment unit, and a gated fusion unit; the feature extraction unit includes a first feature extraction subunit, a second feature extraction subunit, and a third feature extraction subunit.

[0051] The feature extraction unit is used to perform deep feature mining and prior knowledge extraction on different levels of preprocessed features using multiple visual network branches. For example, the feature extraction unit can process low-level features and semantic features through different neural network backbone models to provide low-level prior features, semantic prior features and generate basic vectors, thereby providing a computational basis for subsequent cross-dimensional feature interactions.

[0052] Cross-artifact alignment units are used to enable models to capture the fine-grained interaction relationships between artifacts at different levels of abstraction. For example, cross-artifact alignment units can align features that have natural differences in space and scale to the same representation dimension and generate aligned features by computing the cross attention between low-level prior features and semantic prior features, so as to solve the problem of information conflict caused by significant differences in feature space.

[0053] The gated fusion unit is used to integrate aligned multi-source features into a final unified representation space through a two-stage residual and gating mechanism. For example, the gated fusion unit can first perform self-attention calculation on the aligned features to obtain self-attention features, calculate the difference between the self-attention features and the aligned features to obtain residual features, and then use learnable gating parameters to perform weighted summation on the residual features and the basic vectors, thereby dynamically adjusting the fusion ratio of multimodal information and generating the final fused features.

[0054] The first feature extraction subunit refers to a visual branch network that is specifically designed to extract prior features from low-level local details and high-frequency anomalies. For example, the first feature extraction subunit can be a residual network model such as ResNet-50, or it can be replaced with other lightweight mobile networks according to actual computing resource requirements. Its main purpose is to extract features from the input low-level features and generate low-level prior features.

[0055] The second feature extraction subunit refers to a network model that provides semantic prior knowledge from the perspective of high-level global consistency or structural anomalies. For example, the second feature extraction subunit can be a large-scale visual transformer pre-trained model in a parameter-frozen state, such as the CLIP-ViT model, which is mainly used to extract features from the input semantic features and generate semantic prior features to ensure the complete preservation of the original high-level semantic information.

[0056] The third feature extraction subunit refers to a network branch used to fine-tune the input features to generate a feature vector containing global basic representation information. For example, the third feature extraction subunit can be a visual transformer model fine-tuned by low-rank adaptation (LoRA) technology, which is mainly used to extract features from the semantic features of the input and generate a basic vector for subsequent gated weighted fusion.

[0057] As an optional embodiment, this invention offers high architectural flexibility in feature extraction. While ResNet-50 and CLIP-ViT models can be used as the backbone network in specific implementations, depending on actual computational resource requirements, this backbone network can be completely replaced with ConvNeXt, Swing Transformer, or a lighter mobile network, and these replacements will not affect the overall logic of cross-feature alignment and fusion in the image detection model of this invention.

[0058] The AI-generated image detection method provided by this invention introduces a feature extraction unit containing three feature extraction subunits, a cross-artifact alignment unit, and a gated fusion unit into the artifact fusion module. This effectively reduces the spatial and scale differences between features at different abstraction levels, deeply captures the fine interaction between low-level details and high-level semantics, and enhances the complementarity of discriminative information.

[0059] Figure 2 This is a schematic diagram of the feature fusion process based on low-level features and semantic features provided by the present invention, such as... Figure 2 As shown, as another optional embodiment provided by the present invention, the artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features, including but not limited to the following steps: Step 210: The first feature extraction subunit extracts features from the input low-level features to generate low-level prior features; the second feature extraction subunit extracts features from the input semantic features to generate semantic prior features; the third feature extraction subunit extracts features from the input semantic features to generate basic vectors.

[0060] Low-level prior features refer to the representation information obtained after in-depth mining of information such as low-level pixel details, high-frequency anomalies, and local unstructured distributions of an image. For example, low-level prior features can be vectors containing local fluctuations and artifact exposure details extracted from the input low-level features using residual network models such as ResNet-50.

[0061] Semantic prior features refer to representational information extracted from a high-level abstraction level that reflects the global structural coherence, common sense logic, and semantic consistency of an image. For example, semantic prior features can be high-dimensional vectors output after encoding the input semantic features using a large-scale pre-trained model such as the visual transformer CLIP-ViT model, which is in a parameter-frozen state.

[0062] The base vector refers to the global feature representation used as a baseline representation in the subsequent fusion stage to guide the dynamic combination of multi-source information. For example, the base vector can be a task-specific base feature vector generated by using a visual transformer model with low-rank adaptive fine-tuning to specifically fine-tune the semantic features of the input.

[0063] Step 220: The cross-artifact alignment unit performs cross-attention calculation on the underlying prior features and semantic prior features to generate alignment features.

[0064] Cross-attention computation refers to a computational mechanism that enables information interaction and mapping between two feature sequences from different levels of abstraction or different sources to discover potential connections between them. For example, by taking semantic prior features as query input and low-level prior features as key and value input, the correlation weight between the two can be calculated, so that the model can capture the subtle interaction between the low-level details and the high-level semantics.

[0065] Alignment features refer to joint features that eliminate natural spatial and scale differences and are mapped to a unified dimension after cross-dimensional information interaction. For example, alignment features can be a comprehensive feature tensor that integrates local high-frequency pixel anomaly information and global structural anomaly information.

[0066] Step 230: The gated fusion unit performs self-attention calculation on the alignment features to generate self-attention features; calculates the difference between the self-attention features and the alignment features to obtain residual features; and uses learnable gating parameters to perform weighted summation of the residual features and the basic vectors to generate fused features.

[0067] Self-attention computation refers to a mechanism that calculates the degree of correlation between elements within the same feature sequence to extract global contextual dependencies. For example, it can be achieved by mapping the alignment feature itself to query, key, and value simultaneously and performing dot product attention operations to discover structural connections within the alignment feature.

[0068] Self-attention features refer to enhanced representations obtained after modeling internal global dependencies. For example, self-attention features can be weighted feature maps that highlight key discriminative regions in alignment features and suppress redundant background noise.

[0069] Residual features refer to the difference information between self-attention features and original alignment features. They are used to capture the significant interactive changes that are added after self-attention enhancement computation. For example, residual features can be obtained by directly calculating the difference between self-attention features and alignment features in the corresponding dimensions through matrix subtraction operations.

[0070] Learnable gating parameters refer to weight coefficients that can be continuously optimized and updated through backpropagation during the training of the model network. They are used to dynamically control the fusion ratio of different features in the final result. For example, a learnable gating parameter can be a scalar or vector parameter called alpha that can be adaptively adjusted according to gradient descent.

[0071] Specifically, the feature alignment and integration process in this invention essentially constitutes a two-stage gating fusion mechanism. For example, in the first stage, the residual between the self-attention feature and the aligned feature after cross-attention is obtained by subtraction calculation. In the second stage, the weighting ratio of the residual feature and the generated base vector is adjusted by a learnable gating parameter, so as to fuse the underlying and semantic features into a unified representation.

[0072] Considering that the underlying artifacts and semantic features are at different levels of abstraction and have significant differences in feature space, simple splicing or static weighted fusion is very likely to produce negative transfer phenomenon and information conflict where one plus one is less than two. Therefore, this invention achieves cross-artifact alignment through a cross-attention mechanism and introduces residual gating for dynamic weight combination, thereby reducing feature differences between different levels of abstraction and greatly enhancing the complementarity between multimodal artifact information, providing an accurate and comprehensive unified representation space for the final true and false classification.

[0073] The AI-generated image detection method provided by this invention extracts low-level prior features, semantic prior features, and basic vectors during feature fusion. It utilizes cross-attention calculation to achieve precise cross-level alignment between low-level and semantic information. Furthermore, it combines self-attention residual calculation with learnable gating parameters for dynamic weighted summation. This enables the model to accurately capture the subtle interactive relationships between artifacts at different abstraction levels, effectively overcoming the negative transfer and information conflict phenomena caused by significant differences between the low-level and semantic feature spaces. Thus, by adaptively adjusting the fusion ratio of multi-source features, it constructs a unified feature representation space with stronger complementarity and discriminative power.

[0074] Figure 3 This is a schematic diagram of the process for generating low-level features and semantic features provided by the present invention, such as... Figure 3 As shown, in another optional embodiment provided by the present invention, the preprocessing unit includes a low-level branch subunit and a semantic branch subunit; the preprocessing unit performs resampling processing on the input target image patch to generate low-level features and semantic features, including but not limited to the following steps: Step 310: The bottom branch sub-unit performs nearest neighbor resampling on the input target image block and performs the first convolution operation on the image block after nearest neighbor resampling to generate bottom-level features.

[0075] The low-level branch subunit is used to extract and amplify pixel-level high-frequency anomalies and local correlation information in the image. For example, the low-level branch subunit can take the target image patch selected by the focusing module as input and capture the statistical bias introduced by the generation model at the pixel level through a customized resampling branch.

[0076] Nearest neighbor resampling refers to an interpolation method that directly assigns the target pixel value to the corresponding value of the nearest original pixel when scaling or transforming the image. For example, the pixel value can be directly copied by calculating the nearest coordinate position of the target pixel in the original image, thereby amplifying pixel details and maintaining the local correlation of the original image region.

[0077] The first convolution operation refers to the linear operation process of extracting local features in the resampled image space using a convolution kernel of a specific size. For example, the low-level texture features of the processed image patch can be extracted by setting a two-dimensional convolutional layer with a specific number of channels and stride, and the required feature representation can be generated by combining a specific network structure when necessary.

[0078] Low-level features refer to pixel-level representation vectors that fully preserve the details of generated artifacts. For example, low-level features can be local unstructured feature tensors that reflect pixel-level perturbation sensitivity such as compression and scaling and are not destroyed by smoothing operations.

[0079] Step 320: The semantic branch subunit performs bilinear resampling on the input target image patch and performs a second convolution operation on the bilinear resampling image patch to generate semantic features.

[0080] Semantic branch subunits are used to extract representational information that maintains the coherence of the global structure of the image and the high-level abstract logic. For example, semantic branch subunits can adjust the size of the target image patch through independent preprocessing links to adapt to the resolution input requirements of subsequent large-scale pre-trained models.

[0081] Bilinear resampling refers to a smooth scaling method that performs linear interpolation in two directions to calculate the target pixel value. For example, the image resolution can be adjusted by weighting the values ​​of the four neighboring pixels around the target pixel, thereby ensuring a smooth transition of the image block in the transformed spatial structure.

[0082] The second convolution operation refers to the mapping process of further extracting high-dimensional features prepared by semantic priors in the smoothed image space. For example, features of smooth image patches can be encoded by convolutional layers with specific network parameters to provide a feature base with a smooth transition for extracting high-level consistency information.

[0083] Semantic features refer to abstract representations that remove local high-frequency noise interference and highlight the overall layout and structural logic of an image. For example, semantic features can be high-dimensional feature maps that are susceptible to structural perturbations such as cropping and blurring, and that centrally reflect the consistency of significant semantic regions.

[0084] Specifically, the dual-branch preprocessing for information preservation in this invention can perform parallel and differentiated feature preservation for input data of different frequency bands or abstraction levels. For example, the bottom-level branch sub-unit can add the residual of the result after nearest neighbor resampling to the result after the first convolution operation to obtain the bottom-level features, while the semantic branch sub-unit can add the residual of the result after bilinear resampling to the result after the second convolution operation to obtain the semantic features.

[0085] It should be noted that the preprocessing and residual summation calculation process for the bottom-level branch sub-units can be represented by the following formula: ; in, Represents underlying features. This represents the input target image patch. This indicates nearest neighbor resampling. This indicates the first convolution operation.

[0086] The calculation process of semantic branch subunits can be represented by the following formula: ; in, Represents semantic features, This indicates bilinear resampling. This indicates the second convolution operation.

[0087] Considering that low-level artifacts are highly sensitive to pixel-level perturbations and exhibit an unstructured distribution, while semantic artifacts are more susceptible to structural perturbations and concentrated in significant semantic regions, unified preprocessing often weakens both types of key discriminative information. Therefore, this invention constructs a dual-branch parallel preprocessing structure that includes nearest neighbor and bilinear resampling, and applies differentiated preprocessing strategies. This allows for customized information preservation for different artifact characteristics, effectively preventing the mutual weakening of artifact features of two different attributes during unified preprocessing. This provides a complete input basis for subsequent accurate alignment and joint modeling of multi-dimensional features.

[0088] The AI-generated image detection method provided by this invention constructs a dual-branch structure containing low-level branch sub-units and semantic branch sub-units in the preprocessing unit. This enables customized information preservation strategies to address the vulnerability differences of low-level artifacts and high-level semantic features to different pixel-level or structural-level perturbations. Nearest neighbor resampling is used to effectively amplify pixel details and maintain local correlations. At the same time, bilinear resampling is used to ensure the smoothness of spatial structure when adjusting resolution. This effectively avoids the defect that traditional unified preprocessing often weakens the information of two types of key artifacts at the same time, thus maximizing the integrity and originality of the discrimination information required for subsequent multi-dimensional feature fusion.

[0089] Figure 4 This is a schematic diagram of the process for generating target image patches provided by the present invention, such as... Figure 4 As shown, as another optional embodiment provided by the present invention, the artifact attention focusing unit performs block filtering on the input image to be detected to generate target image blocks, including but not limited to the following steps: Step 410: Divide the input image to be detected into multiple initial image blocks.

[0090] Specifically, the complete image to be detected can be divided into several fixed-size, non-overlapping local image regions by grid partitioning. For example, an image to be detected at its original resolution can be evenly divided into multiple initial image blocks of equal pixel size to facilitate subsequent fine-grained local feature analysis.

[0091] Step 420: Calculate the texture complexity and frequency energy of each initial image patch.

[0092] The texture complexity and frequency energy of the initial image patch refer to the degree of drastic change in pixel grayscale within a local region of the image and the intensity of high-frequency signals in the local spatial frequency distribution, respectively. For example, texture complexity can be a representation value calculated using local variance or information entropy, and frequency energy can be the sum of high-frequency components extracted after converting the image patch to the frequency domain using discrete cosine transform or Fourier transform. Together, they reflect the abnormal fluctuation characteristics that the generative model is prone to introduce at the pixel level.

[0093] As an optional embodiment, in addition to introducing texture complexity and frequency energy indicators, the present invention can also introduce local contrast distribution, color difference consistency or local noise variance as input descriptors to replace or combine the above indicators in the calculation of saliency score, so as to further refine the accuracy of capturing underlying artifacts.

[0094] Step 430: Calculate the saliency score for each initial image patch based on texture complexity and frequency energy.

[0095] The saliency score is a quantitative evaluation metric used to measure the probability of AI-generated artifacts in each initial image patch. For example, this score can be obtained by introducing a lightweight attention module to comprehensively evaluate the calculated texture complexity and frequency energy and perform feature mapping.

[0096] Specifically, the model can adaptively learn the non-linear weighting relationship between texture features and frequency features to output the final evaluation value. For example, the texture complexity and frequency energy of each initial image patch can be used as input variables, and a specific value can be calculated by a neural network structure or a multilayer perceptron as the saliency score of that image patch.

[0097] Step 440: Select a preset number of initial image blocks from multiple initial image blocks in descending order of saliency score, and determine the preset number of initial image blocks as target image blocks.

[0098] Specifically, the system sorts all calculated scores in descending order globally and extracts a specific number of image patches from the top of the sorted list as input for subsequent low-level feature extraction branches. For example, the top-scoring initial image patches can be selected as target image patches to remove irrelevant smooth background regions.

[0099] Considering that low-level artifacts are usually distributed locally and unstructured, blindly learning across the entire image is easily affected by the semantic bias of the dataset itself and wastes computational resources. Therefore, this invention introduces a saliency evaluation mechanism that combines texture complexity and frequency energy to locate artifact exposure areas. This enables precise identification of high-frequency and low-texture local anomaly locations, significantly improving the reliability and interpretability of local low-level artifact detection while eliminating redundant background interference.

[0100] The AI-generated image detection method provided by this invention divides the image to be detected into multiple initial image blocks, calculates the saliency score of each initial image block based on texture complexity and frequency energy, and then selects a preset number of initial image blocks as target image blocks in descending order of scores. This method can accurately lock the local artifact exposure areas of high frequency and low texture, effectively avoids the model blindly learning the global semantic bias of the dataset, and significantly improves the reliability and algorithm interpretability of local low-level artifact detection while eliminating redundant background interference.

[0101] Figure 5 This is a flowchart illustrating the training image detection model provided by the present invention, as shown below. Figure 5 As shown, as another optional embodiment provided by the present invention, the image detection model is trained based on the following steps: Step 510: Collect image training samples, which include real image samples and AI-generated image samples.

[0102] Image training samples can be constructed by acquiring them from publicly available open-source datasets and by using various existing artificial intelligence generation algorithms. For example, high-resolution landscape images and portraits taken by real cameras can be collected as real image samples, and single or multiple generator engines such as different versions of diffusion models and generative adversarial networks can be used to generate fake images that approximate reality in resolution and semantics in batches as AI-generated image samples, thus forming a large-scale mixed data foundation for model learning.

[0103] Step 520: Generate the realism labels corresponding to the image training samples.

[0104] The authenticity label corresponding to the image training sample refers to the category identifier used to provide the standard answer for the model during supervised learning. For example, the authenticity label corresponding to the real image sample can be the value 0 to represent the real category created by humans, while the authenticity label corresponding to the AI-generated image sample can be the value 1 to represent the fake category generated by artificial intelligence.

[0105] Step 530: Iteratively execute the training process until the preset termination condition is met.

[0106] Preset termination conditions refer to the triggering criteria used to determine whether the model has reached the ideal convergence state and to stop updating the network parameters. For example, a preset termination condition may be that the total number of training iterations has reached a preset maximum threshold, or that the loss value calculated by the model on the validation set no longer shows a significant decrease for several consecutive iterations.

[0107] The training process includes: inputting image training samples into the image detection model to be trained, obtaining the prediction results output by the image detection model to be trained; calculating the target loss between the prediction results and the real labels; and updating the network parameters of the image detection model to be trained based on the target loss.

[0108] Specifically, in each iteration, the model calculates the predicted probability of the input sample through forward propagation, then evaluates the difference between this probability and the standard answer based on a preset loss function, and finally uses the optimizer to calculate the gradient and backpropagate to adjust the model weights. For example, the overall target loss can be obtained by calculating the multi-task cross-entropy loss between the underlying prediction results, semantic prediction results, and the fused prediction results and the real labels. The adaptive moment estimation optimization algorithm is then used to update the network parameters of each convolutional layer, attention module, and fully connected layer inside the image detection model based on the target loss, thereby gradually improving the model's generalization detection accuracy for various unknown generators.

[0109] The AI-generated image detection method provided by this invention collects training data containing real image samples and AI-generated image samples and generates corresponding authenticity labels. Then, iteratively executes a complete supervised learning process that includes obtaining prediction results, calculating target loss, and continuously updating the network parameters of the model to be trained based on the target loss. This effectively drives the image detection model to learn autonomously and continuously optimizes the extraction and fusion mechanism of artifact features at different levels of abstraction, establishing a precise mapping relationship between multi-dimensional feature representation and image authenticity attributes.

[0110] In another embodiment provided by the present invention, the prediction result includes a low-level prediction result, a semantic prediction result, and a fused prediction result; the target loss is calculated based on the following loss function: ; in, Loss to the target The cross-entropy loss is the difference between the semantic prediction result and the real label. The cross-entropy loss is the difference between the underlying prediction results and the true labels. To integrate the cross-entropy loss between the prediction results and the true labels, , and These are the preset weighting coefficients.

[0111] The underlying prediction result, semantic prediction result, and fusion prediction result refer to the independent classification probabilities given by each independent visual feature extraction branch and the final joint representation space of the image detection model for the authenticity attribute of the image to be detected. For example, the underlying prediction result may be the discrimination result of the underlying branch network based solely on pixel details and high-frequency anomaly outputs, the semantic prediction result may be the discrimination result of the semantic branch network based solely on the output of the high-level global structure, and the fusion prediction result is the final comprehensive discrimination result output by the gated fusion unit after combining two types of aligned features.

[0112] Cross-entropy loss is a cost evaluation function used to measure the degree of difference between the predicted probability distribution of the model output and the actual data distribution. For example, the error of model classification can be quantified by calculating the product and summing the logarithm of the probability that each branch predicts a sample as an AI-generated image and the actual real label, thus providing an optimized gradient direction for multi-task supervision.

[0113] The weighting coefficients can be statically set according to the importance of different branches in the overall detection task, or dynamically and adaptively adjusted using network learning strategies. For example, the weighting coefficient corresponding to the cross-entropy loss of the fused prediction results can be set to the maximum weight value, while the underlying prediction results and semantic prediction results are given relatively small weight values. This is to ensure the effectiveness of feature extraction by each sub-branch, while focusing on strengthening the model's main task discrimination ability to perform multi-dimensional feature fusion in a unified representation space.

[0114] The AI-generated image detection method provided by this invention subdivides the prediction results into low-level prediction results, semantic prediction results, and fusion prediction results, and uses a weighted combination of cross-entropy losses of the low-level, semantic, and fusion branches as the target loss function to update network parameters. This enables multi-task joint supervision during the model training phase, which not only enables the low-level and semantic branches to learn independent and discriminative artifact features, but also guides the fusion branch to achieve complementary advantages of information at different levels of abstraction in a unified representation space. This effectively improves the model's generalization ability and final detection accuracy when dealing with unknown generators and complex pixel perturbation scenarios.

[0115] It should be noted that the image detection framework proposed in this application achieves a significant performance leap in the field of AI-generated image detection. Its core value lies in successfully resolving the information conflict between the underlying layer and semantic artifacts. In cross-generator generalization experiments, even when trained on only a single generator, the model still achieves an average detection accuracy of 96.83% to 97.55% for 16 unknown generators, significantly outperforming existing state-of-the-art methods. In particular, in the evaluation of highly challenging AI-generated images (AIGI) designed for extreme challenges, it demonstrates strong resilience in high-definition images and single-class weak artifact scenarios, with a performance increase of up to 29.9%. In terms of robustness, due to the implementation of a customized information preservation strategy, the model can still maintain an accuracy of over 84% when faced with severe JPEG compression (e.g., quality reduced to 60), and even maintain an accuracy of over 96% when subjected to severe center cropping, demonstrating its extremely high practicality and reliability in complex real-world environments.

[0116] Figure 6 This is a schematic diagram of the image detection model provided by the present invention, as shown below. Figure 6 As shown, the image detection model is mainly composed of a cascaded artifact focusing module, an artifact fusion module, and an output module. The artifact focusing module includes a sequentially connected artifact attention focusing unit and a preprocessing unit. The artifact attention focusing unit is used to locate and segment the input image to be detected, selecting the most salient region based on the image's texture complexity and frequency energy to generate the target image patch. The preprocessing unit receives the target image patch output by the artifact attention focusing unit and applies a differentiated dual-branch resampling strategy to maintain the integrity of artifact information in a customized manner, thereby generating low-level features that preserve local pixel details and semantic features that ensure smooth spatial structure.

[0117] The low-level features and semantic features obtained after preprocessing are then input in parallel into the artifact fusion module. The artifact fusion module internally includes a feature extraction unit, a cross-artifact alignment unit, and a gated fusion unit. The feature extraction unit utilizes multiple visual network backbone branches to perform deep mining and prior knowledge extraction on the input low-level and semantic features, outputting low-level prior features, semantic prior features, and basic vectors. The cross-artifact alignment unit receives the prior features output by the feature extraction unit and uses a cross-attention mechanism to perform cross-level alignment calculations on the low-level and semantic prior features to capture the subtle interaction relationships between artifacts at different abstraction levels and with spatial scale differences.

[0118] Subsequently, the aligned features are further transmitted to the gated fusion unit, which dynamically combines multi-source features into fused features in a unified representation space through two-stage self-attention residual calculation and learnable gating parameter adjustment.

[0119] Finally, the artifact fusion module passes the generated fusion features to the output module, which performs a comprehensive evaluation based on the fusion features with strong discriminative complementarity, generates and outputs the final image detection result indicating the authenticity attributes of the image to be detected, thus fully realizing customized preservation, accurate alignment and unified joint modeling for different artifact characteristics.

[0120] It should be noted that, at the application level, the unified fusion features extracted by this invention are not limited to binary classification detection tasks. The output cross-alignment feature map can be directly extended to artifact region localization tasks, thus providing pixel-level reference for image tampering detection. Furthermore, the two-stage gating fusion mechanism in this scheme is also applicable to multimodal artifact recognition, such as combining audio artifacts for comprehensive identification of deepfake videos. Regarding data training strategies, the framework provided by this invention is compatible with large-scale pre-training paradigms and can serve as the foundation for future general visual anti-counterfeiting models, achieving incremental learning through continuous integration of new generator data.

[0121] Figure 7 This is a schematic diagram of the structure of the AI-generated image detection device provided by the present invention, as shown below. Figure 7 As shown, it mainly includes, but is not limited to: The image input unit 710 is used to input the image to be detected into the image detection model.

[0122] The detection result output unit 720 is used to obtain the image detection results output by the image detection model.

[0123] The image detection model includes an artifact focusing module, an artifact fusion module, and an output module. The artifact focusing module includes an artifact attention focusing unit and a preprocessing unit. The artifact attention focusing unit divides the input image to be detected into blocks and filters them to generate target image blocks. The preprocessing unit resamples the input target image blocks to generate low-level features and semantic features. The artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features. The output module generates the image detection result based on the fused features.

[0124] It should be noted that the AI-generated image detection device provided by the present invention can execute the AI-generated image detection method described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.

[0125] The AI-generated image detection device provided by this invention uses an artifact attention focusing unit to segment and filter images to accurately locate key regions, and combines the resampling processing of the preprocessing unit to simultaneously extract low-level features and semantic features, thereby achieving multi-dimensional feature fusion at different levels of abstraction, which can improve the accuracy and reliability of AI-generated image detection.

[0126] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 8 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840. The processor 810, communications interface 820, and memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute an AI-generated image detection method. This method includes: inputting the image to be detected into an image detection model and obtaining the image detection result output by the image detection model; the image detection model includes an artifact focusing module, an artifact fusion module, and an output module; the artifact focusing module includes an artifact attention focusing unit and a preprocessing unit; the artifact attention focusing unit performs block filtering on the input image to be detected to generate target image blocks; the preprocessing unit performs resampling processing on the input target image blocks to generate low-level features and semantic features; the artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features; and the output module generates the image detection result based on the fused features.

[0127] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0128] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the AI-generated image detection method provided by the above methods. The method includes: inputting an image to be detected into an image detection model and obtaining an image detection result output by the image detection model; the image detection model includes an artifact focusing module, an artifact fusion module, and an output module; the artifact focusing module includes an artifact attention focusing unit and a preprocessing unit; the artifact attention focusing unit performs block filtering on the input image to be detected to generate target image blocks; the preprocessing unit performs resampling processing on the input target image blocks to generate low-level features and semantic features; the artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features; and the output module generates an image detection result based on the fused features.

[0129] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements an AI-generated image detection method provided by the above methods. This method includes: inputting an image to be detected into an image detection model, and obtaining an image detection result output by the image detection model; the image detection model includes an artifact focusing module, an artifact fusion module, and an output module; the artifact focusing module includes an artifact attention focusing unit and a preprocessing unit; the artifact attention focusing unit performs block filtering on the input image to be detected to generate target image blocks; the preprocessing unit performs resampling processing on the input target image blocks to generate low-level features and semantic features; the artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features; and the output module generates an image detection result based on the fused features.

[0130] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0131] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; 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; and these modifications or substitutions do 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 AI-generated images, characterized in that, include: The image to be detected is input into the image detection model, and the image detection result output by the image detection model is obtained. The image detection model includes an artifact focusing module, an artifact fusion module, and an output module; the artifact focusing module includes an artifact attention focusing unit and a preprocessing unit. The artifact attention focusing unit performs block filtering on the input image to be detected to generate target image blocks; The preprocessing unit resamples the input target image patch to generate low-level features and semantic features; The artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features; The output module generates the image detection result based on the fusion features.

2. The method for detecting AI-generated images according to claim 1, characterized in that, The artifact fusion module includes a feature extraction unit, a cross-artifact alignment unit, and a gated fusion unit; The feature extraction unit includes a first feature extraction subunit, a second feature extraction subunit, and a third feature extraction subunit.

3. The method for detecting AI-generated images according to claim 2, characterized in that, The artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features, including: The first feature extraction subunit extracts features from the input low-level features to generate low-level prior features; the second feature extraction subunit extracts features from the input semantic features to generate semantic prior features; and the third feature extraction subunit extracts features from the input semantic features to generate a basic vector. The cross-artifact alignment unit performs cross-attention calculation on the underlying prior features and the semantic prior features to generate alignment features; The gated fusion unit performs self-attention calculation on the alignment features to generate self-attention features; calculates the difference between the self-attention features and the alignment features to obtain residual features; and uses learnable gating parameters to perform weighted summation of the residual features and the base vector to generate the fused features.

4. The method for detecting AI-generated images according to claim 1, characterized in that, The preprocessing unit includes a low-level branch subunit and a semantic branch subunit; The preprocessing unit resamples the input target image patch to generate low-level features and semantic features, including: The bottom-level branch subunit performs nearest-neighbor resampling on the input target image block and performs a first convolution operation on the image block after nearest-neighbor resampling to generate the bottom-level features. The semantic branch subunit performs bilinear resampling on the input target image block and performs a second convolution operation on the bilinearly resampled image block to generate the semantic features.

5. The method for detecting AI-generated images according to claim 1, characterized in that, The artifact attention focusing unit performs block filtering on the input image to be detected to generate target image blocks, including: The input image to be detected is divided into multiple initial image blocks; Calculate the texture complexity and frequency energy of each of the initial image blocks; Based on the texture complexity and the frequency energy, the saliency score of each initial image patch is calculated; According to the saliency score in descending order, a preset number of initial image blocks are selected from multiple initial image blocks, and the preset number of initial image blocks are determined as the target image blocks.

6. The method for detecting AI-generated images according to claim 1, characterized in that, The image detection model is trained based on the following steps: Collect image training samples, which include real image samples and AI-generated image samples; Generate real-world labels corresponding to the image training samples; The training process is executed iteratively until the preset termination condition is met. The training process includes: The image training samples are input into the image detection model to be trained, and the prediction results output by the image detection model to be trained are obtained. Calculate the target loss between the prediction result and the real label; The network parameters of the image detection model to be trained are updated based on the target loss.

7. The method for detecting AI-generated images according to claim 6, characterized in that, The prediction results include the underlying prediction results, semantic prediction results, and fused prediction results; the target loss is calculated based on the following loss function: ; in, For the target loss, The cross-entropy loss is the difference between the semantic prediction result and the real label. The cross-entropy loss is the difference between the underlying prediction result and the true label. The cross-entropy loss is the difference between the fused prediction result and the true label. , and These are the preset weighting coefficients.

8. A detection device for AI-generated images, characterized in that, include: An image input unit is used to input the image to be detected into the image detection model; The detection result output unit is used to obtain the image detection result output by the image detection model; The image detection model includes an artifact focusing module, an artifact fusion module, and an output module; the artifact focusing module includes an artifact attention focusing unit and a preprocessing unit. The artifact attention focusing unit performs block filtering on the input image to be detected to generate target image blocks; The preprocessing unit resamples the input target image patch to generate low-level features and semantic features; The artifact fusion module performs feature fusion based on the input low-level features and semantic features to generate fused features; The output module generates the image detection result based on the fusion features.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the AI-generated image detection method as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the AI-generated image detection method as described in any one of claims 1 to 7.