Freezing ViT feature fusion network-based AI generated image detection method
By freezing the ViT feature fusion network and combining the shallow and deep features extracted by CLIP-ViT, the problem of insufficient generalization of the AI-generated image detection model is solved, the accuracy and robustness of the detection are improved, and the AI-generated image is supported. Authentication and information security.
Patent Information
- Application Number
- CN202410724476.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-08-30
AI Technical Summary
Existing AI-generated image detection models perform well on specific training sets, but their detection accuracy drops significantly when faced with new data sets, resulting in insufficient generalization and limiting their practical application value.
A method based on frozen ViT feature fusion network is used to establish a multi-level feature fusion network by obtaining the images and data sets to be identified, using frozen CLIP-ViT to extract shallow and deep features, and perform feature fusion, combined with average pooling and full connection layer, channel attention mechanism and non-linear activation layer for image identification.
It improves the generalization and accuracy of AI-generated image detection, enables a more comprehensive analysis of image authenticity, enhances the accuracy and robustness of forgery detection, effectively responds to the problem of AI-generated image dissemination, and supports digital identity and information security.
Smart Images

Figure CN118570599A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of AI generated image identification, and in particular to an AI generated image detection method based on a frozen ViT feature fusion network. Background Art
[0002] With the rapid progress of Generative Adversarial Networks (GANs) and diffusion models, the quality of computer-generated images and videos has reached unprecedented heights, sometimes even reaching a level of realism that is difficult for the human eye to distinguish. Especially with the widespread application of large models (such as Sora, etc.), technicians in this field can easily use text as a guide to generate realistic false images or videos. These technologies have not only brought revolutionary changes to artistic creation and the entertainment industry, but also provided new ways for the spread of false information. Carefully crafted false images and videos, especially those used to create misleading news, may mislead the public's judgment and undermine social trust. Therefore, how to effectively detect and identify these AI-generated images and videos has become an urgent problem to be solved in the field of computer vision.
[0003] At present, the generalization of AI-generated image detection is generally poor. The AI-generated image detection model performs well on a specific training set, but once faced with a new, unseen data set, its detection accuracy often drops significantly. This is because the model relies too much on the feature distribution of the training set data during the training process, making it difficult to adapt to complex and changing image scenes. This lack of generalization greatly limits the practical application value of AI-generated image detection technology. Summary of the invention
[0004] In order to solve the above technical problems, the purpose of the present invention is to provide an AI generated image detection method based on a frozen ViT feature fusion network. The technical solution adopted is as follows:
[0005] The present invention provides an AI generated image detection method based on a frozen ViT feature fusion network, the method comprising the following steps:
[0006] Obtain an image to be identified and a data set consisting of sample images, wherein the data set includes real images and artificial intelligence-generated fake images;
[0007] Establishing a multi-level feature fusion network based on frozen CLIP-ViT, and training the multi-level feature fusion network using the data set to obtain a trained multi-level feature fusion network;
[0008] The image to be identified is input into the trained multi-level feature fusion network to obtain the identification result of the image to be identified.
[0009] Preferably, the step of obtaining the image to be identified and the data set consisting of sample images includes:
[0010] Collecting an image to be evaluated, and preprocessing the image to be evaluated to obtain an image to be identified;
[0011] Obtain the image datasets progan-train and progan-val as the training dataset and validation dataset in the model training process; use the image dataset CNN_synth_testset as the test dataset in the multi-level feature fusion network testing process;
[0012] Among them, progan-train, progan-val and CNN_synth_testset all contain real images and AI-generated images;
[0013] All images in the image dataset are preprocessed to obtain sample images, and all sample images constitute the dataset.
[0014] Preferably, the image preprocessing includes:
[0015] The image is randomly cropped and randomly flipped, and the cropped and flipped image is standardized to obtain a standardized image.
[0016] Preferably, the using the data set to train the multi-level feature fusion network includes:
[0017] The images in the dataset are input into the multi-level feature fusion network one by one in batch order. The cls returned by the first 12 stages of the frozen CLIP-ViT feature extraction are processed to obtain the shallow features of the input image; the cls returned by the last 12 stages of the frozen CLIP-ViT feature extraction are processed to obtain the deep features of the input image.
[0018] Map shallow features and deep features separately and fuse them to obtain the image features before final classification;
[0019] An identification result is determined based on the image features before the final classification, wherein the identification result is a real image or a false image generated by AI.
[0020] Preferably, the feature selection module of the multi-level feature fusion network includes an average pooling layer, a fully connected layer, a channel attention mechanism, a nonlinear activation layer, and weight selection.
[0021] Preferably, when training the multi-level feature fusion network, it also includes:
[0022] Set the number of iterations, batch size, learning rate, and loss function; process the training data set in batches and input them into the multi-level feature fusion network model for iterative training;
[0023] After each round of training, the multi-level feature fusion network model in the training process is verified using the validation data set to obtain the model fitting and save the model parameters of the multi-level feature fusion network model in the training process.
[0024] A set of parameters with the best performance is selected from the saved model parameters as the parameters of the finally trained multi-level feature fusion network model.
[0025] Preferably, the loss function is a binary cross entropy loss function, and the calculation formula of the cross entropy loss function is:
[0026] LOSS=-(y×log(p(x))+(1-y)×log(1-p(x)))
[0027] Among them, LOSS is the loss value, p(x) is the model output, y is the true label, log is the logarithmic function, and the value of the true label is 0 or 1.
[0028] Preferably, after training the multi-level feature fusion network, the method further includes:
[0029] The order of images in the test data set is randomly shuffled, and the shuffled images are input into the trained multi-level feature fusion network model to obtain the prediction results of the trained frozen CLIP-ViT multi-level feature fusion network model on the test data set;
[0030] According to the prediction results, the performance of the trained frozen CLIP-ViT based multi-level feature fusion network model was evaluated using the two evaluation indicators ACC and AP.
[0031] The present invention has at least the following beneficial effects:
[0032] The present invention adopts deep learning technology, and fuses the shallow features and deep features extracted by frozen CLIP-ViT to identify the authenticity of the image. The fused features can more accurately reflect the characteristics of the image. The present invention adopts a feature method based on CLIP-ViT, and uses the powerful feature extraction ability of pre-trained CLIP-ViT to enable the system to extract key information of the image, effectively deal with various AI generation technologies, and by freezing the feature extraction network layer, the model is not affected by the training data set when extracting image features, enhancing the generalization and accuracy of forgery detection; by comprehensively considering the shallow features and deep features of the image, the authenticity of the image can be analyzed more comprehensively, and the accuracy of AI-generated image identification and detection results is improved. The AI-generated image detection method provided by the present invention combines the cutting-edge technology of deep learning and feature selection fusion, bringing new breakthroughs to the field of AI-generated image detection. The method can effectively deal with the problem of AI-generated image dissemination, and also provides strong technical support for solving the digital identity and information security problems facing the current society. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 A flowchart of an AI generated image detection method based on a frozen ViT feature fusion network provided by an embodiment of the present invention;
[0035] Figure 2 A schematic diagram of a data set partitioning result provided by an embodiment of the present invention;
[0036] Figure 3 A structural diagram of a frozen CLIP-ViT multi-level feature fusion network provided in an embodiment of the present invention;
[0037] Figure 4 This is a structural diagram of the feature selection module provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the following is a detailed description of an AI generated image detection method based on a frozen ViT feature fusion network proposed in accordance with the present invention in combination with the accompanying drawings and preferred embodiments.
[0039] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0040] The following is a specific solution of an AI generated image detection method based on a frozen ViT feature fusion network provided by the present invention, which is described in detail with reference to the accompanying drawings.
[0041] Embodiment of AI generated image detection method based on frozen ViT feature fusion network:
[0042] This embodiment proposes an AI generated image detection method based on a frozen ViT feature fusion network, such as Figure 1 As shown, the AI generated image detection method based on the frozen ViT feature fusion network of this embodiment includes the following steps:
[0043] Step S1, obtaining an image to be identified and a data set consisting of sample images, wherein the data set includes real images and false images generated by AI.
[0044] In this embodiment, we first obtain the public ProGAN and generate training data sets, and download the public image data set progan-train (the training data set given by Detecting CNN-Generated Images). This image data set contains a large number of ProGAN-generated images, including 20 image categories in total, such as airplanes, birds, cars, etc. Each category has 18,003 corresponding real images and 18,003 AI-generated images.
[0045] Then obtain the public ProGAN and generate verification datasets, and download the public image dataset progan_val (the verification dataset given by Detecting CNN-Generated Images). Like the training dataset, this image dataset also contains a large number of ProGAN-generated images, including 20 image categories (such as airplanes, birds, cars, etc.), each category has 200 corresponding real images and 200 AI-generated images.
[0046] Next, obtain the ProGAN real and generated verification test set and download the public image dataset CNN_synth_testset (the test dataset given by Detecting CNN-Generated Images). This image dataset contains 8 types of GAN-generated images, such as BigGAN and CycleGAN. Each category has a varying number of corresponding real images and AI-generated images.
[0047] The image datasets progan-train and progan-val are used as the training dataset and validation dataset in the model training process; the image dataset CNN_synth_testset is used as the test dataset in the multi-level feature fusion network testing process, such as Figure 2 As shown in the figure, this figure is a schematic diagram of the data set division results.
[0048] At the same time, collect images to be evaluated. Preprocess each image in the data set and the image to be evaluated respectively, record the preprocessed image to be evaluated as the image to be identified, and preprocess all the images in the image data set respectively, record the preprocessed image as the sample image, and all the sample images constitute the data set. It should be noted that the images mentioned later are recorded as preprocessed images. Among them, the image preprocessing includes: randomly cropping the image of the preset size to ensure the consistency of the model input and perform data enhancement to improve the generalization of the model; in order to meet the model input requirements and ensure the consistency of the model input, the size of the cropped image is adjusted to 224×224, and the cropped image is standardized to obtain standardized data. The preset size can be set to 224, and the implementer can adjust the preset size of the image according to the specific actual situation. Randomly flip the image of the preset size, perform data enhancement, and improve the generalization of the model. In order to use the pre-trained CLIP-ViT and improve the stability of the subsequent model, the image of the preset size is standardized using the mean and standard deviation, specifically: each channel of the tensorized image is subtracted from the mean and divided by the standard deviation, and the pixel value of the standardized image has a value range of [-1, 1]. As other embodiments, other methods can also be used to implement the normalization operation of pixel values. The normalization operation is a prior art and will not be described in detail here.
[0049] So far, this embodiment has obtained a training data set, a validation data set, and a test data set based on the frozen CLIP-ViT multi-level feature fusion network model.
[0050] Step S2, establishing a multi-level feature fusion network based on the frozen CLIP-ViT, and training the multi-level feature fusion network using the data set to obtain a trained multi-level feature fusion network.
[0051] This embodiment uses frozen CLIP-ViT to extract features based on the frozen CLIP-ViT multi-level feature fusion network model, and uses the shallow features and deep features of the extracted features to perform image detection.
[0052] The images in the dataset are input into the multi-level feature fusion network one by one in batch order. The cls returned by the first 12 stages of the frozen CLIP-ViT feature extraction are processed to obtain the shallow features of the input image; the cls returned by the last 12 stages of the frozen CLIP-ViT feature extraction are processed to obtain the deep features of the input image. The shallow features and deep features are mapped separately and spliced at the channel level to obtain the fused feature representation before the final classification.
[0053] In this embodiment, in order to make up for the insufficient features obtained by freezing CLIP-ViT, only high-level semantic features are considered, ignoring the shallow image features most needed in AI-generated image detection. The shallow features and deep features of the image are independent of each other, that is, the shallow features of the image extract low-level, local features in the image, such as edges, corners, textures, etc.; the deep features of the image extract more abstract and advanced features in the image, such as shape, object parts, semantics, etc.
[0054] After obtaining shallow features and deep features, the two features are selected and merged into a unified fusion feature representation through the selection and fusion mechanism. The fusion feature has rich information and contains key features from the shallow and deep layers of the image. Finally, the fusion feature representation is input into the classifier for AI-generated image detection tasks.
[0055] It should be noted that the multi-level selective fusion structure can enable the model to better capture the details and global features of the image, improve the performance of AI-generated image detection, and especially improve the accuracy of forgery detection when processing different categories of generated images in real environments. Figure 3 As shown in the figure, this is a structural diagram of the multi-level feature fusion network based on frozen CLIP-ViT.
[0056] Specifically, in the first step, the shallow and deep feature information of the image is extracted through frozen CLIP-ViT.
[0057] In the first sub-step, the frozen CLIP-ViT is used to perform preliminary feature extraction of the image.
[0058] In this embodiment, the image encoder (CLIP-ViT) of CLIP (Contrastive Language-Image Pre-training, openAI open source model) is used to obtain preliminary features of the image; the pre-trained ViT-L / 14 model weights are imported, and the entire network layer is frozen to ensure that the encoder does not participate in the learning process during training; the powerful feature extraction capability of pre-trained CLIP-ViT is used to help extract richer and more discriminative information from the image. When using ViT-L / 14 for preliminary feature extraction, the image is divided into N patches, and then each patch is encoded and attached with a CLS tag to extract image features, and its specific expression is:
[0059] N=H×W / P 2 ; Where N is the number of patches, H and W are the width and height of the image, and P is the side length of the patch.
[0060] Z = [cls; x 1 E1;x 2 E2;……;x n E n ]+E pos ; where Z is the data before entering CLIP-ViT, cls is a special mark, and x 1 ~x n For patch mapping, E1~E n is the patch information, E pos Represents the image position encoding.
[0061] The implementation process of the above operation is prior art and will not be elaborated here.
[0062] In the second sub-step, the extracted image shallow feature information and deep feature information are respectively input into the feature selection module to obtain the key image shallow features and deep features.
[0063] In this embodiment, when ViT-L / 14 is used for preliminary feature extraction, the cls output by each stage represents the image features extracted at the current stage. The cls of the first 12 stages are spliced along the channel direction to obtain the preliminary shallow feature information of the image, and the cls of the last 12 stages are spliced along the channel direction to obtain the preliminary deep feature information of the image, which can be specifically expressed as:
[0064] S=[cls1;cls2;…;cls 12 ],D=[cls 13 ;cls 14 ;……;cls 24]; where S represents the preliminary shallow features, D represents the preliminary deep features, cls i Represents the image features extracted by the i-th stage.
[0065] It should be noted that this embodiment only obtains the cls output of each stage. The reason is that after multi-head attention processing at each stage, cls can capture the information of each patch of the image and can reflect the essential characteristics of the image more comprehensively and accurately.
[0066] Then, the extracted shallow feature information and deep feature information are respectively input into the feature selection module to obtain highly concentrated shallow features and deep features of the key image.
[0067] Each feature selection module consists of a series of components, including average pooling layer, fully connected layer, channel attention mechanism, non-linear activation layer and weight selection. The non-linear activation layer can use ReLu or Swish activation function.
[0068] Among them, the input feature information is first added to obtain a comprehensive feature representation, which helps to better capture the global features of the image; average pooling layer: the average pooling operation is used to compress the feature space while retaining the main feature information; the first fully connected layer: the channels of the feature representation are mapped to the three channels of the RGB channel, and the linear activation layer (ReLu activation function) is used to expand the expression ability of the model, the expression is as follows: h = ReLU (W1x + b1); where x is the input feature, W1 is the weight matrix of the hidden layer, b1 is the bias vector, and ReLU represents the rectified linear unit activation function; the second fully connected layer: the channels of the feature representation are mapped to 3×12 channels, which is convenient for subsequent redivision into 12 groups of input feature representations, and then the Sigmoid function is used to generate their respective weight representations, specifically expressed as: z = σ (W2h + b2); where W2 is the weight matrix of the output layer, h is the feature representation after mapping by the first fully connected layer, b2 is the bias vector, σ represents the sigmoid activation function, and z represents the weight. Next, the weights will be selected. Specifically, the first four values with the highest weights are taken from the obtained weight representations and multiplied with their corresponding feature representations for weighted fusion to obtain a highly concentrated key feature representation of the image. Channel attention mechanism: The above operation uses the channel attention mechanism to dynamically adjust the weights of each channel by deeply understanding the intrinsic connections between different channels, thereby strengthening the key features of the task and suppressing non-key features.
[0069] It should be noted that through the combination of the above series of components, the feature selection module can more effectively obtain the key features in the input data, improve the model's ability to distinguish, and extract more abundant key shallow features and deep features of the image. The structure diagram of the feature selection module is shown in Figure 4 shown.
[0070] In the second step, the key shallow features and the key deep features are mapped to high dimensions respectively and spliced at the channel level to obtain a fused feature representation.
[0071] In this embodiment, the key shallow features and deep features are mapped to higher dimensions through the mapping layer, and then the two data streams are spliced at the channel level as the final fusion feature representation, which helps to enhance the expression ability of the model. The formula is as follows:
[0072] out s =FC(x s )=x s ×W+b;
[0073] out d =FC(x d )=x d ×W+b;
[0074] F=[out s ;out d ]
[0075] Among them, out s and out d are the shallow features and deep features of the output respectively, x s and x d They represent the shallow and deep features of the input, FC represents the fully connected layer, and W represents the size D in ×D out The weight matrix of b is D out The bias vector of , F represents the fusion feature.
[0076] The third step is to obtain the detection results of AI-generated images based on the fused feature representation.
[0077] In this embodiment, in the final stage, the final fusion features are sent to the classifier for classification. The classifier can perform binary classification on the input data, that is, whether the image is a real image or an AI-generated image.
[0078] At this point, this embodiment has obtained a constructed multi-level feature fusion network based on frozen CLIP-ViT. Next, the training data set is input into the multi-level feature fusion network based on frozen CLIP-ViT for iterative training, aiming to continuously adjust and optimize the model parameters so that the model can more accurately identify and distinguish AI-generated images from natural images, and obtain a trained multi-level feature fusion network model.
[0079] In the first step, the training data set is input into the frozen CLIP-ViT multi-level feature fusion network model in batches for iterative training, and the number of iterations, learning rate, batch size and loss function are set.
[0080] In this embodiment, the number of iterations is set to 5, the learning rate is set to 0.0001, the batch size is set to 256, the optimizer is set to Adam, and the loss function is a binary cross entropy loss function. The binary cross entropy loss function is specifically expressed as:
[0081] LOSS=-(y×log(p(x))+(1-y)×log(1-p(x)))
[0082] Among them, LOSS is the loss value, p(x) is the model output, y is the true label, log is the logarithmic function, and the value of the true label is 0 or 1.
[0083] In the second step, after each round of iteration, the multi-level feature fusion network model in the training process is verified using the verification data set, and the model parameters of the network model in the training process are saved to obtain the trained multi-level feature fusion network model.
[0084] In this embodiment, after each iteration, that is, at each stage of model training, the model parameters obtained by the current training are saved. At the same time, the network model in the training process is verified and evaluated using the verification data set. After the training is completed, the model with the best performance is selected from all the saved models as the trained multi-level feature fusion network model based on frozen CLIP-ViT.
[0085] Furthermore, in order to improve the accuracy of the network model detection results, this embodiment will use the test data set to perform performance evaluation on the multi-level feature fusion network to verify the generalization ability and accuracy of the model; based on the performance indicators, it is judged whether the obtained model can meet the actual needs.
[0086] In the first step, the order of images in the test data set is shuffled and the center is cropped. The test data set with shuffled image order is input into the multi-level feature fusion network model in batches to obtain the prediction results of the network model on the test data set.
[0087] In this embodiment, in order to ensure the objectivity and randomness of the evaluation, the images in the test data set need to be shuffled in order; then, the shuffled images are input into the multi-level feature fusion network model in batches, and the prediction results of the model on the test data set can be obtained by forward propagation of each batch of images.
[0088] In the second step, based on the prediction results, the performance of the multi-level feature fusion network model is evaluated using the two evaluation indicators ACC and AP.
[0089] This embodiment uses two evaluation indicators to measure the performance of the AI-generated image identification and detection model of the multi-level feature fusion network, namely: Accuracy (ACC) and Average Precision (AP).
[0090] ACC is an intuitive and commonly used evaluation indicator that directly reflects the proportion of samples correctly classified by the model in the entire test set. Its calculation formula is as follows:
[0091]
[0092] AP is an indicator that measures the trade-off between the precision and recall of a model on a single category. It calculates the average precision of the model at different precision levels.
[0093] The third step is to determine whether the model meets actual needs based on performance indicators.
[0094] In this embodiment, the ACC and AP of the network model on each unseen data set during the test process are obtained to verify whether the AI-generated image identification and detection model of the multi-level feature fusion network achieves the expected effect. According to the test results, the model parameters are fine-tuned to match different practical application requirements. These adjustments may involve multiple aspects such as learning rate, number of network layers, feature fusion method, etc., aiming to optimize the performance of the model so that it can better adapt to actual physical devices.
[0095] The training and parameter adjustment processes of the network model are all existing technologies and will not be described in detail here.
[0096] So far, the method provided in this embodiment has been used to complete the training and testing of the multi-level feature fusion network, and a trained multi-level feature fusion network has been obtained.
[0097] Step S3, inputting the image to be identified into the trained multi-level feature fusion network to obtain the identification result of the image to be identified.
[0098] In the above steps, this embodiment completes the training of the multi-level feature fusion network. Next, the image to be identified is input into the trained multi-level feature fusion network, and the multi-level feature fusion network outputs the category of the image to be identified, wherein the category of the image to be identified is a real image or an AI generated image.
[0099] So far, the method provided by this embodiment has been used to complete the identification and detection of images, and the accuracy of image identification and detection has been improved. This embodiment obtains a fusion feature with higher discrimination by selecting and fusing the shallow features and deep features extracted by CLIP-ViT. The fusion feature can better detect AI-generated images and has good generalization, thereby improving the accuracy and robustness of the AI-generated image detection results.
[0100] This embodiment adopts deep learning technology and fuses the shallow features extracted by frozen CLIP-ViT with deep features to identify the authenticity of the image. The fused features can more accurately reflect the characteristics of the image. This embodiment adopts a feature method based on CLIP-ViT and uses the powerful feature extraction capability of pre-trained CLIP-ViT to enable the system to extract key information of the image and effectively deal with various AI generation technologies. By freezing the feature extraction network layer, the model is not affected by the training set data when extracting image features, thereby enhancing the generalization and accuracy of forgery detection. By comprehensively considering the shallow and deep features of the image, the authenticity of the image can be analyzed more comprehensively, and the accuracy of AI-generated image identification and detection results is improved. The AI-generated image detection method provided in this embodiment combines the cutting-edge technology of deep learning and feature selection fusion, bringing new breakthroughs to the field of AI-generated image detection. This method can effectively deal with the problem of AI-generated image dissemination, and also provides strong technical support for solving the digital identity and information security problems facing the current society.
[0101] It should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An AI generated image detection method based on a frozen ViT feature fusion network, characterized in that: The method comprises the following steps: Obtain an image to be identified and a data set consisting of sample images, wherein the data set includes real images and artificial intelligence-generated fake images; Establishing a multi-level feature fusion network based on frozen CLIP-ViT, and training the multi-level feature fusion network using the data set to obtain a trained multi-level feature fusion network; The image to be identified is input into the trained multi-level feature fusion network to obtain the identification result of the image to be identified.
2. The AI generated image detection method based on frozen ViT feature fusion network according to claim 1 is characterized in that: The step of obtaining an image to be identified and a data set consisting of sample images includes: Collecting an image to be evaluated, and preprocessing the image to be evaluated to obtain an image to be identified; Obtain the image datasets progan-train and progan-val as the training dataset and validation dataset in the model training process; use the image dataset CNN_synth_testset as the test dataset in the multi-level feature fusion network testing process; Among them, progan-train, progan-val and CNN_synth_testset all contain real images and AI-generated images; All images in the image dataset are preprocessed to obtain sample images, and all sample images constitute the dataset.
3. The AI generated image detection method based on frozen ViT feature fusion network according to claim 2 is characterized in that: Image preprocessing, including: The image is randomly cropped and randomly flipped, and the cropped and flipped image is standardized to obtain a standardized image.
4. The AI generated image detection method based on frozen ViT feature fusion network according to claim 2 is characterized in that: The method of using the data set to train the multi-level feature fusion network includes: The images in the dataset are input into the multi-level feature fusion network one by one in batch order. The cls returned by the first 12 stages of the frozen CLIP-ViT feature extraction are processed to obtain the shallow features of the input image; the cls returned by the last 12 stages of the frozen CLIP-ViT feature extraction are processed to obtain the deep features of the input image. Map shallow features and deep features separately and fuse them to obtain the image features before final classification; An identification result is determined based on the image features before the final classification, wherein the identification result is a real image or a false image generated by AI.
5. The AI generated image detection method based on frozen ViT feature fusion network according to claim 1 is characterized in that: The feature selection module of the multi-level feature fusion network includes an average pooling layer, a fully connected layer, a channel attention mechanism, a nonlinear activation layer, and weight selection.
6. The AI generated image detection method based on frozen ViT feature fusion network according to claim 2 is characterized in that: When training a multi-level feature fusion network, it also includes: Set the number of iterations, batch size, learning rate, and loss function; process the training data set in batches and input them into the multi-level feature fusion network model for iterative training; After each round of training, the multi-level feature fusion network model in the training process is verified using the validation data set to obtain the model fitting and save the model parameters of the multi-level feature fusion network model in the training process. A set of parameters with the best performance is selected from the saved model parameters as the parameters of the finally trained multi-level feature fusion network model.
7. The AI generated image detection method based on frozen ViT feature fusion network according to claim 6 is characterized in that: The loss function is a binary cross entropy loss function, and the calculation formula of the cross entropy loss function is: LOSS=-(y×log(p(x))+(1-y)×log(1-p(x))) Among them, LOSS is the loss value, p(x) is the model output, y is the true label, log is the logarithmic function, and the value of the true label is 0 or 1.
8. The AI generated image detection method based on frozen ViT feature fusion network according to claim 2 is characterized in that: After training the multi-level feature fusion network, it also includes: The order of images in the test data set is randomly shuffled, and the shuffled images are input into the trained multi-level feature fusion network model to obtain the prediction results of the trained frozen CLIP-ViT multi-level feature fusion network model on the test data set; According to the prediction results, the performance of the trained frozen CLIP-ViT based multi-level feature fusion network model was evaluated using the two evaluation indicators ACC and AP.
Citation Information
Cited By
Video generation method and device, computer equipment and storage medium
CN119211665A
Artificial intelligence generated image fairness detection method and system
CN119313978A
Image authenticity detection method, system and equipment based on pre-training visual model
CN120070989A
Double-branch sensing CLIP evidence obtaining method for generalizable deep counterfeiting detection
CN120451587A
AI generated image general detection method and system based on high and low level feature fusion, and computer equipment
CN120635647A
