A method for constructing a cross-generator generated image detection model and an image detection method

By constructing a cross-generator image detection model and utilizing global embedding vectors and adversarial training, the detection challenge between different generator architectures is solved, achieving high-precision and robust image detection that can adapt to future technological evolution.

CN119445328BActive Publication Date: 2025-12-19HARBIN ENG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411489414.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-12-19
Estimated Expiration
2044-10-24

AI Technical Summary

Technical Problem

Existing generated image detectors struggle to bridge the technological gap between different generator architectures, resulting in low detection accuracy and a lack of robustness, making them unable to cope with the continuous evolution of generator technology.

Method used

A cross-generator image detection model is constructed. An initial image feature extractor is built to obtain global embedding vectors and perform pre-training. Adversarial training is combined between the generator and the feature extractor. A classifier is designed for final training. The model is optimized using triplet loss function and adversarial loss function.

Benefits of technology

It significantly improves detection accuracy and model robustness, enabling it to flexibly adapt to future changes in generator technology and ensuring the forward-looking and adaptable nature of the detection system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119445328B_ABST
    Figure CN119445328B_ABST
Patent Text Reader

Abstract

The application discloses a kind of construction methods and image detection methods of cross generator generation image detection model, the construction method of generation image detection model includes: constructing initial image feature extractor;Global embedding vector is obtained, the initial image feature extractor is trained using the global embedding vector, and pre-training feature extractor is obtained;Based on the pre-training feature extractor, generator is designed and is trained with it in opposition;Based on the result of confrontation, using the feature extractor after confrontation, and combining the designed classifier is trained, to obtain the final generation image detection model.The application not only significantly improves the detection accuracy, but also greatly enhances the robustness of the model, enabling it to flexibly cope with the continuous evolution and change of future generator technology, ensuring the foresight and adaptability of the detection system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of artificial intelligence, and particularly relates to a construction method of a cross-generator generated image detection model and an image detection method. BACKGROUND

[0002] With the rapid advancement of deep learning technology, generative adversarial networks (GANs) have shown amazing capabilities in creating visual content. Even those without artistic or design backgrounds can quickly create lifelike images that closely match the intended mood of the text by simply inputting a few descriptive words using advanced image generation models. This unprecedented convenience has greatly enriched the boundaries of creative expression, but it has also quietly opened the floodgates of image proliferation. Currently, AI-generated images are so detailed that they can confuse visual perception, making it difficult to distinguish between true and false. However, this technology hides a crisis that cannot be ignored, as malicious users can use these tools to create false information and manipulate social sentiment, posing a serious threat to political stability, financial markets, and public trust. For example, false natural disaster images circulating on social media, although meticulously fabricated by AI, can be believed by authoritative media, leading to global panic and economic losses.

[0003] With the steady development of infrastructure, artificial intelligence has entered a period of prosperity, with a plethora of generative models generating images that exhibit diverse styles and rich content. Researchers are working to develop a universal generated image detector that can accurately identify various types of generator products, especially when faced with emerging unknown technologies. Existing research shows that there are significant differences in pixel-level features and statistical rules between generated images and natural images, and a clear boundary can be established through model training to distinguish between the two. However, due to the significant differences in image characteristics under different generator architectures, this boundary is highly dynamic and changes with the evolution of generator technology. Therefore, developing a universal generated image detector that can cross technological gaps and has broad applicability is a complex and challenging research task. SUMMARY

[0004] To solve the above technical problems, the present application proposes a construction method of a cross-generator generated image detection model and an image detection method. This method not only significantly improves detection accuracy but also greatly enhances the robustness of the model, enabling it to flexibly respond to the continuous evolution and changes of future generator technology, ensuring the forward-looking and adaptability of the detection system.

[0005] To achieve the above purpose, the present application provides a construction method of a cross-generator generated image detection model, comprising:

[0006] constructing an initial image feature extractor;

[0007] obtaining a global embedding vector, training the initial image feature extractor using the global embedding vector to obtain a pre-trained image feature extractor;

[0008] based on the pre-trained image feature extractor, designing a generator and performing adversarial training on the generator and the pre-trained image feature extractor;

[0009] based on the adversarial result, using the adversarially trained feature extractor and combining a designed classifier to perform training, thereby obtaining a final generated image detection model.

[0010] Optionally, obtaining the pre-trained model comprises:

[0011] obtaining a global embedding vector;

[0012] based on the global embedding vector, training the detection model in combination with a triplet loss function.

[0013] Optionally, obtaining the global embedding vector comprises:

[0014] obtaining an initial image, performing scaling processing on the initial image, normalizing the scaled initial image according to the mean and variance of image pixels, and obtaining a normalized image.

[0015] Optionally, the initial image comprises a generated image and a real image.

[0016] Optionally, the triplet loss function comprises:

[0017] L pretrain (I r ,I f )=max(0,α-d(I r ,I r )+d(I r ,I f ))+max(0,α-d(I f ,I f )+d(I f ,I r ))

[0018] wherein I r , I f represent a real image and a generated image respectively, α is a margin, d(x,y) = | |f(x)-f(y) | |2, f(x) represents an embedding vector obtained by the image x through the feature extractor, and d(x,y) represents the distance between two samples x and y.

[0019] Optionally, the adversarial training on the generator and the feature extractor comprises:

[0020] S1, training the generator by using a first loss function, and during the training of the generator, the parameters of the feature extractor remain unchanged;

[0021] S2, training the feature extractor by using a second loss function, and during the training of the feature extractor, the parameters of the generator remain unchanged;

[0022] S3, repeating the S1 and S2 until a preset condition is reached, and ending the confrontation.

[0023] Optionally, the first loss function is:

[0024] L G =||E(G(I f ))-E(I r )||2

[0025] Wherein, E is a feature extractor, G is a generator, I f represents a generated image, I r is a real image;

[0026] The second loss function is:

[0027] L E = max(0, α-d(y r ,y r )+d(y r ,y f ))+max(0, α-d(y f ,y f )+d(y f ,y r ))

[0028] Wherein, α is a margin, d(x,y) is the Euclidean distance between two vectors, y r is the embedding vector of the real image after the feature extractor, and y f is the embedding vector of the generated image after the generator and the feature extractor.

[0029] Optionally, the design classifier training includes:

[0030] Removing the generator, keeping the parameters of the feature extractor unchanged, and training the classifier by using a third loss function.

[0031] Optionally, the third loss function is:

[0032] L cls = softmax(-||z-a|| 2 ,-||z-b|| 2 )

[0033] Wherein, a, b are learnable vectors, and z is a global embedding vector of the image.

[0034] The application further provides a cross-generator generated image detection method, comprising:

[0035] Obtaining a to-be-detected image;

[0036] Inputting the to-be-detected image into a detection model to obtain a detected image.

[0037] Compared with the prior art, the application has the following advantages and technical effects:

[0038] The technology according to the application can improve the accuracy of cross-generator generated image detection and reduce the error degree of model detection. BRIEF DESCRIPTION OF DRAWINGS

[0039] The accompanying drawings, which form a part of the present application, are included to provide a further understanding of the application and are incorporated herein for explanation by reference. The illustrative embodiments of the present application, and their implementation, are provided to explain the present application and are not intended to limit the present application. In the drawings:

[0040] Figure 1 is a construction method flowchart of a cross-generator generated image detection model according to an embodiment of the application;

[0041] Figure 2 is a cross-generator generated image detection method schematic diagram according to an embodiment of the application;

[0042] Figure 3 is a generated image and real image data schematic diagram used in the training process according to an embodiment of the application. DETAILED DESCRIPTION

[0043] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0044] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.

[0045] The present application proposes a construction method of a cross-generator generated image detection model, as shown in Figure 1 The specific steps include the following steps:

[0046] Constructing an initial image feature extractor;

[0047] obtaining a global embedding vector, training an initial image feature extractor using the global embedding vector, and obtaining a pre-trained feature extractor;

[0048] based on the pre-trained feature extractor, designing a generator and performing adversarial training on the generator;

[0049] based on the adversarial result, using the adversarial feature extractor and combining a designed classifier for training, thereby obtaining a final generated image detection model.

[0050] Specifically, the present application incorporates the core concept of generative adversarial networks (GANs), effectively alleviating the detection difficulties caused by the differences between different generator architectures through the strategy of dynamically expanding the sample space during the training process. This method not only significantly improves the detection accuracy, but also greatly enhances the robustness of the model, enabling it to flexibly cope with the continuous evolution and changes of future generator technology, ensuring the forward-looking and adaptability of the detection system.

[0051] Further, obtaining the pre-trained feature extractor comprises:

[0052] obtaining a global embedding vector;

[0053] based on the global embedding vector, training the feature extractor combined with a triplet loss function.

[0054] Further, obtaining the global embedding vector comprises:

[0055] obtaining an initial image, performing scaling processing on the initial image, and normalizing the scaled initial image according to the mean and variance of the image pixels;

[0056] based on the normalized initial image, obtaining the global embedding vector.

[0057] Specifically, in this embodiment, before the image is input into the feature extractor, all images are scaled to the same size, and then the pixels of the scaled images are standardized according to their mean and variance, obtaining the scaled and standardized images.

[0058] scaling the input image to 224x224 pixels;

[0059] normalizing the image according to the mean and variance of the image pixels, and the normalization method is shown in the following formula:

[0060]

[0061] wherein x is the pixel value of the image, μ is the mean of the image pixels, and σ is the variance of the image pixels.

[0062] inputting the normalized image into the feature extractor to obtain the global embedding vector of the image, as shown in the following formula:

[0063]

[0064] Among them, I r I f Let x represent the real image and the generated image, respectively. r x f This represents the global embedding vector of the image after it has passed through the feature extractor. It is represented as a D-dimensional vector, and E(x) is the feature extractor.

[0065] Furthermore, the initial image includes: a generated image and a real image;

[0066] Specifically, such as Figure 3 As shown, the dataset consists of generated images and real images, ensuring that the number of generated images and real images in the input data remains equal. The dataset comprises images generated by multiple generators and real images, with the set corresponding to each generator called a subset. There is no overlap between subsets. During training, following the default settings of the public dataset, one subset is selected for training.

[0067] Furthermore, the triplet loss function includes:

[0068] L pretrin (I r ,I f )=max(0,α-d(I r ,I r )+d(I r ,I f ))+max(0,α-d(I f ,I f )+d(I f ,I r ))

[0069] Among them, I r I f Let f(x) and f(y) represent the real image and the generated image, respectively. Let α be the margin. Let d(x,y) = |f(x) - f(y)| |2, where f(x) represents the embedding vector obtained by the feature extractor after the image x is processed, and d(x,y) represents the distance between the two samples x and y.

[0070] Furthermore, designing the generator and feature extraction for adversarial training includes:

[0071] S1. Using the first loss function, train the generator, and during generator training, the parameters θ of the feature extractor E are... E Keep it unchanged, that is, do not perform gradient updates, to ensure that the generated image after the generator gets closer and closer to the real image without the generator;

[0072] S2, training the feature extractor using a second loss function, and the parameters of the generator remain unchanged when training the feature extractor;

[0073] S3, repeating S1 and S2 until a preset condition is reached, and ending the confrontation.

[0074] Specifically, the generator can be a fully connected network or other neural network. Only using generated images to participate in the training of the generator ensures that more samples are provided and the sample space is expanded;

[0075] Training the feature extractor can maximize the adaptation of multiple generators, thereby enhancing the robustness of the network.

[0076] The number of rounds of alternating training depends on the complexity of the network, the size of the data set, and the sensitivity of the loss function.

[0077] Specifically, according to experimental experience, a maximum training round is set, and training is stopped after exceeding this round. Usually, this round depends on the complexity of the model, the size of the data set, etc. The output of the generator can also be evaluated regularly to monitor the loss or the quality of the generated data. If the generation effect does not further improve for several consecutive rounds, training can be stopped.

[0078] Further, the first loss function is the loss when training the generator:

[0079] L G =||E(G(I f ))-E(I r )||2

[0080] Where E is the feature extractor, G is the generator, I f is the generated image, and I r is the real image;

[0081] The second loss function is the loss for training the feature extractor:

[0082] y f =E(G(I f )), y r =E(I r )

[0083] L E =max(0,α-d(y r ,y r )+d(y r ,y f ))+max(0,α-d(y f ,y f )+d(y f ,y r ))

[0084] Where α is the margin, d(x,y) is the Euclidean distance between the two vectors, and y r y is the embedding vector of the real image after passing through the feature extractor. f This generates the embedding vector of the image after passing through the generator and feature extractor. E represents the feature extractor, G represents the generator, and I represents the feature extractor. r I f These represent the pixel values ​​of the real image and the generated image, respectively.

[0085] Furthermore, the design of classifier training includes:

[0086] Remove the generator, keep the parameters of the feature extractor unchanged, and train the classifier using the third loss function.

[0087] Furthermore, the third loss function is the loss for training the classifier:

[0088] L cls =softmax(-||za||) 2 ,-||zb|| 2 )

[0089] Where a and b are learnable vectors, and z is the global embedding vector of the image.

[0090] This invention also provides a method for detecting cross-generator generated images, such as... Figure 2 As shown, the specific steps include: scaling the image to be detected and inputting it into the model to obtain an embedding vector; inputting the embedding vector into the classifier; and selecting the label corresponding to the largest element in the result probability distribution, which is the detection result.

[0091] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for constructing a cross-generator generated image detection model, characterized in that, include: Construct an initial image feature extractor; The initial image includes: a generated image and a real image; Obtain the global embedding vector, and use the global embedding vector to train the initial image feature extractor to obtain the pre-trained image feature extractor; Based on the pre-trained image feature extractor, a generator is designed to be trained adversarially against it. Designing generators and feature extractors for adversarial training includes: S1. The generator is trained using the first loss function, and the parameters of the feature extractor remain unchanged during the training of the generator. S2. The feature extractor is trained using the second loss function, and the parameters of the generator remain unchanged during the training of the feature extractor; S3. Repeat S1 and S2 until the preset condition is met, and the confrontation ends. The first loss function is: Where E is the feature extractor and G is the generator. Indicates the generation of an image. It is a real image; The second loss function is: in, For margin, To calculate the Euclidean distance between two vectors, This is the embedding vector of the real image after passing through the feature extractor. To generate the embedding vector of the image after passing through the generator and feature extractor; Based on the adversarial results, the adversarial feature extractor is used and trained in conjunction with the designed classifier to obtain the final generated image detection model.

2. The method for constructing a cross-generator generated image detection model according to claim 1, characterized in that, Obtain the pre-trained image feature extractor: Get the global embedding vector; The image feature extractor is trained based on the global embedding vector and the triplet loss function.

3. The method for constructing a cross-generator generated image detection model according to claim 2, characterized in that, Before obtaining the global embedding vector, the following steps are included: An initial image is obtained, the initial image is scaled, and the scaled initial image is standardized according to the mean and variance of the image pixels to obtain a standardized image.

4. The method for constructing a cross-generator generated image detection model according to claim 2, characterized in that, The triplet loss function includes: in, , These represent the real image and the generated image, respectively. For margin, f(x) represents the embedding vector obtained after the image x passes through the feature extractor, and d(x,y) represents the distance between the two samples x and y.

5. The method for constructing a cross-generator generated image detection model according to claim 1, characterized in that, The design of classifier training includes: Remove the generator, keep the parameters of the feature extractor unchanged, and train the classifier using the third loss function.

6. The method for constructing a cross-generator generated image detection model according to claim 5, characterized in that, The third loss function is: Where a and b are learnable vectors, and z is the global embedding vector of the image.

7. A method for detecting cross-generator generated images, characterized in that, include: Acquire the image to be detected; The image to be detected is input into the image detection model constructed according to any one of claims 1-6 to obtain the detected image.

Citation Information

Patent Citations

  • Method, electronic device and computer program product for generating segmentation image

    CN118365871A

  • Deep counterfeit image detection method and device based on artifact domain adversarial learning

    CN118469968A