Construction method of cross-generator generation image detection model and image detection method

By building a cross-generator-generated image detection model, using the combination of adversarial training and classifiers, the problem of difficulty in building a general-purpose image detector in the existing technology is solved, and high-precision and robust detection effects are achieved, which can adapt to the future Changes in generator technology.

CN119445328AActive Publication Date: 2025-02-14HARBIN ENG UNIV
View PDF 7 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The prior art is difficult to build a general-purpose image detector that can cross the technological gap between different generator architectures and has wide applicability, especially when facing emerging unknown technologies.

Method used

By constructing a method of generating image detection models across generators, it includes building an initial image feature extractor, obtaining global embed vectors for pre-training, designing generators and feature extractors for adversarial training, and training in combination with classifiers to obtain the final generation Image detection model.

Benefits of technology

It significantly improves detection accuracy, enhances the robustness of the model, enables it to flexibly cope with the continuous evolution and changes of future generator technology, and ensures the forward-looking and adaptable nature of the detection system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119445328A_ABST
    Figure CN119445328A_ABST
Patent Text Reader

Abstract

The invention discloses a construction method of a cross-generator generated image detection model and an image detection method. The construction method of the generated image detection model comprises the following steps: constructing an initial image feature extractor; obtaining a global embedding vector, and training the initial image feature extractor by using the global embedding vector to obtain a pre-trained feature extractor; based on the pre-training feature extractor, designing a generator to perform confrontation training with the pre-training feature extractor; and based on the confrontation result, using the confronted feature extractor and combining the designed classifier for training, thereby obtaining a final generated image detection model. According to the method, the detection precision is remarkably improved, and the robustness of the model is greatly enhanced, so that the method can flexibly cope with continuous evolution and transformation of a future generator technology, and the perspectiveness and adaptability of a detection system are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a method for constructing a cross-generator generated image detection model and an image detection method. Background Art

[0002] With the rapid advancement of deep learning technology, generative adversarial networks (GANs) have demonstrated amazing capabilities in creating visual content. Even people without an art or design background can quickly create lifelike images that are highly consistent with the text by simply inputting a few descriptive words and 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. At present, images drawn by AI are detailed enough to confuse the boundaries of visual perception, making it difficult to distinguish between true and false. However, there is a crisis behind this technology that cannot be ignored, because malicious users can use these tools to create false information and manipulate social emotions, posing a serious threat to political stability, financial markets and even public trust. For example, the false natural disaster images circulating on social media, although carefully forged by AI, are enough to make authoritative media believe them to be true, thereby causing panic and economic losses around the world.

[0003] As infrastructure has steadily developed and the field of artificial intelligence has entered its heyday, generative models have emerged one after another, and the generated images show diverse styles and rich content. Researchers are working on developing a universal generated image detector with the goal of accurately identifying the products of various generators, especially when faced with emerging unknown technologies. Existing studies have shown that there are significant differences in pixel-level features and statistical laws between generated images and natural images, and a clear boundary can be established through model training to distinguish the two. However, given the significant differences in image characteristics under different generator architectures, this boundary is highly dynamic and changes with the changes in generator technology. Therefore, building a universal generated image detector that can cross the technological gap and has wide applicability has become a complex and challenging research task at present. Summary of the invention

[0004] To solve the above technical problems, the present invention proposes a method for constructing a cross-generator image detection model and an image detection method. This method not only significantly improves the 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, thereby ensuring the foresight and adaptability of the detection system.

[0005] To achieve the above object, the present invention provides a method for constructing a cross-generator generated image detection model, comprising:

[0006] Build an initial image feature extractor;

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

[0008] Based on the pre-trained image feature extractor, a generator is designed to perform adversarial training with the pre-trained image feature extractor;

[0009] Based on the adversarial results, the adversarial feature extractor is used and combined with the designed classifier for training to obtain the final generated image detection model.

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

[0011] Get the global embedding vector;

[0012] The detection model is trained based on the global embedding vector and combined with a triplet loss function.

[0013] Optionally, before obtaining the global embedding vector, the process includes:

[0014] 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.

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

[0016] Optionally, the triple loss function includes:

[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] Among them, I r , I f Represent the real image and the generated image respectively, α is the margin, d(x,y)=||f(x)-f(y)||2, f(x) represents the embedding vector obtained after the image x passes through the feature extractor, and d(x,y) represents the distance between samples x and y.

[0019] Optionally, designing the generator and feature extractor for adversarial training includes:

[0020] S1. Using a first loss function, training the generator, and when training the generator, the parameters of the feature extractor remain unchanged;

[0021] S2. Training the feature extractor using a second loss function, and keeping parameters of the generator unchanged when training the feature extractor;

[0022] S3, looping S1 and S2 until the preset condition is met, and then ending the confrontation.

[0023] Optionally, the first loss function is:

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

[0025] Among them, E is the feature extractor, G is the generator, and I f represents the 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] Among them, α is the margin, d(x,y) is the Euclidean distance between two vectors, and y r is the embedding vector of the real image after passing through the feature extractor, y f It is the embedding vector of the generated image after passing through the generator and feature extractor.

[0029] Optionally, design classifier training including:

[0030] The generator is removed, the parameters of the feature extractor are kept unchanged, and the classifier is trained using the third loss function.

[0031] Optionally, the third loss function is:

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

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

[0034] The present invention also provides a cross-generator generated image detection method, comprising:

[0035] Acquire the image to be detected;

[0036] The image to be detected is input into the detection model to obtain a detection image.

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

[0038] The technology according to the present invention can improve the accuracy of image detection generated across generators and reduce the degree of error in model detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0040] Figure 1 It is a flow chart of a method for constructing a cross-generator image detection model according to an embodiment of the present invention;

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

[0042] Figure 3 Schematic diagram of generated image and real image data used in the training process of an embodiment of the present invention. DETAILED DESCRIPTION

[0043] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. 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 flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0045] The present invention proposes a method for constructing a cross-generator generated image detection model, such as Figure 1 As shown, the specific steps include:

[0046] Build an initial image feature extractor;

[0047] Obtain a global embedding vector, and use the global embedding vector to train an initial image feature extractor to obtain a pre-trained feature extractor;

[0048] Based on the pre-trained feature extractor, a generator is designed to perform adversarial training with it;

[0049] Based on the adversarial results, the adversarial feature extractor is used and combined with the designed classifier for training to obtain the final generated image detection model.

[0050] Specifically, the present invention incorporates the core concept of generative adversarial networks (GANs) and effectively alleviates the detection difficulties caused by 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 respond to the continuous evolution and changes of future generator technology, ensuring the foresight and adaptability of the detection system.

[0051] Further, obtaining a pre-trained feature extractor includes:

[0052] Get the global embedding vector;

[0053] Based on the global embedding vector, the feature extractor is trained in combination with the triplet loss function.

[0054] Furthermore, before obtaining the global embedding vector, the following steps are included:

[0055] Acquire an initial image, scale the initial image, and standardize the scaled initial image according to the mean and variance of the image pixels;

[0056] Based on the normalized initial image, obtain the global embedding vector.

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

[0058] Resize the input image to 224×224 pixels;

[0059] The image is standardized according to the image pixel mean and variance. The standardization method is shown in the formula below:

[0060]

[0061] Among them, x is the image pixel value, μ is the image pixel mean, and σ is the image pixel variance.

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

[0063]

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

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

[0066] Specifically, Figure 3 As shown in the figure, the dataset consists of generated images and real images. The number of generated images and real images in the input data must be equal. The dataset is composed of images generated by multiple generators and real images. The set corresponding to each generator is called a subset. There is no intersection between the images of the subsets. During training, according to the default settings of the public dataset, one of the subsets 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 Represent the real image and the generated image respectively, α is the margin, d(x,y)=||f(x)-f(y)||2, f(x) represents the embedding vector obtained after the image x passes through the feature extractor, and d(x,y) represents the distance between samples x and y.

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

[0071] S1. Use the first loss function to train the generator, and when training the generator, the parameter θ of the feature extractor E E Keep it unchanged, that is, do not update the gradient, to ensure that the generated image after the generator is closer and closer to the real image without passing through the generator;

[0072] S2. Using the second loss function, the feature extractor is trained, and when training the feature extractor, the parameters of the generator remain unchanged;

[0073] S3: loop S1 and S2 until the preset conditions are met and the confrontation ends.

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

[0075] Training the feature extractor can maximize the adaptation of multiple generators and thus enhance the robustness of the network.

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

[0077] Specifically, a maximum number of training rounds is set based on experimental experience, and training is stopped after this number of rounds is exceeded. Usually this number of rounds depends on the complexity of the model, the size of the dataset, etc. You can also regularly evaluate the output of the generator to monitor the loss or the quality of the generated data. If the generation effect does not improve further after several consecutive rounds, you can consider stopping training.

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

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

[0080] Among them, E is the feature extractor, G is the generator, and I f To generate an image, I r is a real image;

[0081] The second loss function is the loss of 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] Among them, α is the margin, d(x,y) is the Euclidean distance between two vectors, and y r is the embedding vector of the real image after passing through the feature extractor, y f is the embedding vector of the generated image after passing through the generator and feature extractor. E represents the feature extractor, G represents the generator, and I r , I f Represent the pixel values ​​of the real image and the generated image respectively.

[0085] Furthermore, designing classifier training includes:

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

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

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

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

[0090] The present invention also provides a cross-generator generated image detection method, such as Figure 2 As shown, it specifically includes: 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 only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for constructing a cross-generator image detection model, characterized in that: include: Build an initial image feature extractor; Obtaining a global embedding vector, and using the global embedding vector to train an initial image feature extractor to obtain a pre-trained image feature extractor; Based on the pre-trained image feature extractor, a generator is designed to perform adversarial training with the pre-trained image feature extractor; Based on the adversarial results, the adversarial feature extractor is used and combined with the designed classifier for training 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: Get the pre-trained image feature extractor: Get the global embedding vector; The image feature extractor is trained based on the global embedding vector in combination with a 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 3, characterized in that: The initial image includes: a generated image and a real image.

5. The method for constructing a cross-generator generated image detection model according to claim 2, characterized in that: The triplet loss function includes: L pretran (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 )) Among them, I r , I f Represent the real image and the generated image respectively, α is the 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.

6. The method for constructing a cross-generator generated image detection model according to claim 1, characterized in that: Designing the generator and feature extractor for adversarial training includes: S1. Using a first loss function, training the generator, and when training the generator, the parameters of the feature extractor remain unchanged; S2. Training the feature extractor using a second loss function, and keeping parameters of the generator unchanged when training the feature extractor; S3, looping S1 and S2 until the preset condition is met, and then ending the confrontation.

7. The method for constructing a cross-generator generated image detection model according to claim 6, characterized in that: The first loss function is: L G =||E(G(I f ))-E(I r )||2 Among them, E is the feature extractor, G is the generator, and I f represents the generated image, I r is a real image; The second loss function is: 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 )) Among them, α is the margin, d(x,y) is the Euclidean distance between two vectors, and y r is the embedding vector of the real image after passing through the feature extractor, y f It is the embedding vector of the generated image after passing through the generator and feature extractor.

8. The method for constructing a cross-generator generated image detection model according to claim 1, characterized in that: Designing classifier training includes: The generator is removed, the parameters of the feature extractor are kept unchanged, and the classifier is trained using the third loss function.

9. The method for constructing a cross-generator generated image detection model according to claim 8, characterized in that: The third loss function is: L cls =softmax(-||z-a|| 2 ,-||z-b|| 2 ) Among them, a, b are learnable vectors, and z is the global embedding vector of the image.

10. 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 to 9 to obtain a detection image.

Citation Information

Patent Citations

  • Image authenticity detection method and device

    CN111709408A

  • Image sharpening processing method for target detection

    CN114998124A

  • Training method of image detection model, image detection method and electronic equipment

    CN116070695A

  • 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