A training-free image detection system, method, device and medium

Through a generated image detection system without training, the features are extracted using Gaussian noise and pre-trained models, and the KL divergence and gradient norm are calculated, the problems of insufficient generalization, high calculation cost and weak anti-distortion ability in the prior art are solved, and efficient and robust generated image detection is achieved.

CN119785123AInactive Publication Date: 2025-04-08ZHONGKE XINGTU DIGITAL EARTH HEFEI CO LTD

Patent Information

Application Number
CN202510280276.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-04-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing generative image detection methods have problems such as insufficient generalization, high computing cost, and weak anti-distortion ability, making it difficult to adapt to the rapidly changing generative AI technology.

Method used

Using a generated image detection system without training, the detection of the generated image is achieved by adding Gaussian noise, using a pre-trained self-supervised learning model to extract image features, and calculating the KL divergence loss and gradient norms between images.

Benefits of technology

The system can be applied to different types of generation technologies, improves detection robustness and computational efficiency, and reduces sensitivity to image noise and compression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119785123A_ABST
    Figure CN119785123A_ABST
Patent Text Reader

Abstract

The present invention discloses a generated image detection system, method, device and medium that do not require training, and relates to the field of generated image detection technology. The system includes a picture input module, a noise disturbance module, a feature acquisition module, a feature comparison module, a gradient norm calculation module and a classification decision module. The present invention generates a perturbed image by adding Gaussian noise to an input image; extracts image features by inputting a pre-trained self-supervised learning model; calculates the KL divergence loss between the images based on the image features of the input image and the perturbed image, and performs back propagation on the KL divergence loss to obtain the gradient norm; and determines whether the input image is a generated image through classification decision based on the gradient norm calculation result. The system and method of the present invention can be applied to different types of generation technologies, have a detection framework that is independent of the generation model, and can detect images generated by any generation model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of generated image detection technology, and in particular to a generated image detection system, method, device and medium that do not require training. Background Art

[0002] In recent years, with the rapid development of generative AI, the technology of generating images and videos has made significant progress and has been able to create visual content that is indistinguishable from the real thing. The maturity of generative models (such as GAN, DDPM, and StableDiffusion) makes it easy for anyone to create highly realistic images. The popularity of this technology has not only promoted the development of the creative industry, but also aroused social concerns about potential abuses such as deep fakes.

[0003] At present, the detection methods of generated images can be divided into two categories: one is the detection method based on supervised learning: this method requires training of large-scale data sets for specific generative models, and distinguishing between real images and generated images by building classifiers. Although this type of method performs well on known models, it faces the following challenges: (1) Insufficient generalization: the generative model is constantly updated, and the existing detection model often needs to be retrained for the new model, which makes it difficult to adapt to different generation technologies. (2) High computational cost: training large-scale deep neural networks requires a lot of computing resources and high deployment costs. (3) Sensitivity to image distortion: in real scenes, images are often distorted due to compression, noise and other problems, which can significantly reduce detection accuracy.

[0004] The second is the untrained detection method. Compared with the supervised learning method, the untrained detection method has higher flexibility and adaptability. For example, the RIGID framework realizes untrained generated image detection by calculating the cosine similarity of image features. However, this type of method has limited sensitivity to feature perturbations, resulting in insufficient detection performance in complex scenarios.

[0005] In addition, the research on out-of-distribution data detection (OOD Detection) shows that the gradient norm, as a feature sensitivity indicator, can effectively distinguish normal data from abnormal data (such as the GradNorm method). Although this method has shown strong robustness in out-of-distribution detection, it has not yet been widely used in the field of generated image detection.

[0006] For example, the invention application with application number 202311864932.6 discloses a generated image detection method, device, electronic device and storage medium. The method and device disclosed in the application scheme improve the accuracy of generated image detection in cross-generator and cross-scene scenarios. However, it also has the following problems: insufficient generalization and poor detection performance in complex scenes.

[0007] Therefore, the existing technology has problems such as insufficient generalization, high computational cost, and weak anti-distortion ability. There is an urgent need for an efficient, robust and untrained generative image detection method to adapt to the rapidly changing generative AI technology. Summary of the invention

[0008] In view of the above-mentioned problems, the purpose of the present invention is to provide a training-free generated image detection system, method, device and medium, which can adapt to different types of generation technologies, abandon the training process, and improve the robustness of the detection system.

[0009] Embodiments of the present invention provide a system, method, device and medium for generating image detection without training.

[0010] A first aspect: A training-free generated image detection system, comprising: An image input module is used to receive an input image to be detected; A noise disturbance module adds Gaussian noise to the input image to obtain a noise disturbance image; The feature acquisition module uses a pre-trained self-supervised learning model to extract image features of input images and perturbation images; The feature comparison module calculates the KL divergence loss between images based on the image features of the input image and the perturbation image, and quantifies the feature distribution differences between images; The gradient norm calculation module performs back propagation on the KL divergence loss to obtain the gradient norm; The classification decision module determines whether the input image is a generated image based on the gradient norm calculation result.

[0011] A second aspect: a training-free generated image detection method, comprising: S1, add Gaussian noise to the input image to generate a perturbed image; S2, standardize the original input image and the perturbation image, and input the pre-trained self-supervised learning model to extract image features; S3, based on the image features of the input image and the perturbation image, calculate the KL divergence loss between the images to quantify the feature distribution differences between the images; S4, back-propagate the KL divergence loss to obtain the gradient norm; S5. Based on the calculation result of the gradient norm, a classification decision is made to determine whether the input image is a generated image.

[0012] Optionally, the pre-trained self-supervised learning model in S2 adopts the DINOv2 model.

[0013] Optionally, the extracting of image features based on a pre-trained self-supervised learning model in S2 includes: S21. Using input image The pre-trained DINOv2 model extracts features and obtains the input image feature vector ; S22. Add Gaussian noise to the input image to generate a noise disturbance image. The formula is: ; in, Noise perturbation image, x is the input image, n Gaussian noise ; S23, perturbed image The pre-trained DINOv2 model extracts features and obtains the feature vector of the noise perturbation image. .

[0014] Optionally, the KL divergence loss between images is calculated in S3, including: S31. Convert the feature vectors of the input image and the perturbation image into probability distribution, which is expressed as:

[0015] in, Softmax() for Softmax function, p is the probability distribution of the input image, q is the probability distribution of the perturbed image; S32. Calculate the KL divergence loss of the probability distribution of the input image and the perturbation image. The formula is expressed as:

[0016] in, is the KL divergence loss, p is the probability distribution of the input image, , q is the probability distribution of the perturbed image, , i is the number of elements in the probability distribution; Optionally, obtaining the gradient norm in S4 includes: For KL divergence loss Perform back propagation and calculate the gradient norm of the parameters of the last linear layer of the model. The formula is expressed as:

[0017] in, is the gradient norm, is the KL divergence loss, , θ is the gradient indicator parameter, jTo find the number of derivatives.

[0018] Optionally, in S5, the classification decision is made to determine whether the input image is a generated image according to the gradient norm calculation result, including: Setting Thresholds , according to the threshold Gradient norm score Make a classification decision, if , the input image is judged to be a generated image; otherwise, the input image is judged to be a real image.

[0019] A third aspect: An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method provided in the second aspect when executing the program.

[0020] A fourth aspect: A non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method provided in the second aspect.

[0021] Beneficial effects of the present invention: 1. The detection system and method of the present invention can be applied to different types of generation technologies. It has a detection framework that is independent of the generation model and can detect images generated by any generation model.

[0022] 2. The detection system and method of the present invention are not easily affected by image noise, compression and other deformation sensitivity. The detection robustness is improved by gradient norm analysis of feature disturbances.

[0023] 3. The detection system and method of the present invention abandon the training process and complete the detection task based only on the pre-training model and simple gradient calculation, which improves the calculation efficiency and avoids the problem of high calculation cost using supervised learning methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 A structural schematic diagram of a training-free generated image detection method of the present invention; Figure 2 A schematic diagram of a flow chart of a training-free image detection system of the present invention; Figure 3 It is a schematic structural diagram of the electronic device of the present invention. DETAILED DESCRIPTION

[0025] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar symbols throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0026] Currently, the resolution of generated images has problems such as insufficient generalization, high computational cost, and weak anti-distortion ability.

[0027] In view of the above problems, the present invention provides a training-free generated image detection system. Figure 1 A schematic diagram of the structure of a detection system provided in an embodiment of the present invention includes: The image input module is used to receive an input image to be detected. The input image can be any generated image or real image.

[0028] The image input module loads image data from the storage data and performs necessary preprocessing, such as adjusting image size and standardization, and transmits the preprocessed image data to the feature extraction module for further analysis.

[0029] Noise perturbation module,The noise perturbation module is used to add Gaussian noise to the input image to obtain a noise perturbation image.

[0030] The process of adding Gaussian noise helps to enhance the sensitivity of image features and ensure that small differences between the generated image and the real image can be detected. The noise perturbation module generates Gaussian noise with a preset standard deviation and adds the noise to the input image to generate a noise perturbation image.

[0031] Feature Acquisition Module,The feature acquisition module uses a pre-trained self-supervised learning model (e.g., DINOv2) to extract high-dimensional image features of the input image and the perturbation image.

[0032] The feature acquisition module performs deep feature extraction on the input image and the perturbation image, converts them into high-dimensional image feature vectors, and stores the extracted feature vectors for subsequent processing. This module provides basic feature support for subsequent gradient calculations.

[0033] Feature comparison module,The feature comparison module calculates the KL divergence loss between images based on the image features of the input image and the perturbation image, and quantifies the feature distribution differences between the images.

[0034] The feature comparison module is responsible for calculating the difference in feature distribution between the original input image and the noise perturbation image, and obtaining the KL divergence loss between the two. By calculating the KL divergence loss, the feature comparison module can quantify the difference between the features of the two images as a basis for distinguishing the generated image from the real image.

[0035] The feature comparison module performs Softmax transformation on the image feature vector to obtain the probability distribution, and calculates the KL divergence loss between the original input image and the perturbed image feature distribution for subsequent gradient calculation. This module is a key link in generating image detection and can provide necessary information for subsequent gradient norm calculation.

[0036] Gradient norm calculation module,The gradient norm calculation module back-propagates the KL divergence loss to obtain the gradient norm.

[0037] The gradient norm calculation module performs back propagation of the KL divergence loss, calculates the gradient, and uses the L1 norm or L2 norm to calculate the gradient norm of the image feature based on the calculated gradient value. This module uses the gradient norm as the main indicator for generated image detection, and a high gradient norm usually indicates that the image is a generated image.

[0038] The classification decision module determines whether the input image is a generated image based on the gradient norm calculation result.

[0039] The classification decision module classifies the input image according to the set threshold and the set gradient norm threshold, determines the image as a generated image or a real image, and returns the classification result to the user interface or the subsequent application module. This module is the final output layer of the present invention and determines the classification result of the image.

[0040] Based on the above detection system, the present invention also discloses a method for generating image detection without training, such as Figure 2 As shown, the steps include: S1. Add Gaussian noise to the input image to generate a perturbed image, represented as the input image and the perturbed image .

[0041] S2. Standardize the original input image and the perturbation image, and input them into the pre-trained self-supervised learning model to extract image features.

[0042] The pre-trained self-supervised learning model can use the DINOv2 model. The process includes: S21. Using input image The pre-trained DINOv2 model extracts features and obtains the input image feature vector ; S22. Add Gaussian noise to the input image to generate a noise disturbance image. The formula is: ; in, Noise perturbation image, x is the input image, n Gaussian noise ; S23, perturbed image The pre-trained DINOv2 model extracts features and obtains the feature vector of the noise perturbation image. .

[0043] S3. Based on the image features of the input image and the perturbation image, the KL divergence loss between the images is calculated to quantify the feature distribution difference between the images. The calculation of the KL divergence loss between the images includes the following steps: S31. Convert the feature vectors of the input image and the perturbation image into probability distribution, which is expressed as:

[0044] in, Softmax() for Softmax function, p is the probability distribution of the input image, q is the probability distribution of the perturbed image; S32. Calculate the KL divergence loss of the probability distribution of the input image and the perturbation image. The formula is expressed as:

[0045] in, is the KL divergence loss, p is the probability distribution of the input image, , q is the probability distribution of the perturbed image, , i is the number of elements in the probability distribution.

[0046] S4, back-propagate the KL divergence loss to obtain the gradient norm; Get the gradient norm, including the KL divergence loss Perform back propagation and calculate the gradient norm of the parameters of the last linear layer of the model. The formula is expressed as:

[0047] in, is the gradient norm, is the KL divergence loss, , θ is the gradient indicator parameter, j To find the number of derivatives.

[0048] S5. Based on the calculation result of the gradient norm, a classification decision is made to determine whether the input image is a generated image, including: Setting Thresholds , according to the threshold Gradient norm score Make a classification decision, if , the input image is judged to be a generated image; otherwise, the input image is judged to be a real image.

[0049] The detection system of the present invention generates a perturbation image by adding Gaussian noise to the input image, and then inputs the input image and the perturbation image together into a pre-trained self-supervised learning model (such as DINOv2) after standardization adjustment to extract features.

[0050] The KL (Kullback-Leibler) divergence of the input image and the perturbation image features is calculated as a quantitative indicator of the difference in feature distribution. The KL divergence loss is back-propagated to calculate the gradient norm of the last layer of the pre-trained model as the image detection score. Based on the threshold of the gradient norm score, the image is classified as a real image or a generated image.

[0051] The present invention also provides an electronic device, Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Figure 3 As shown, the electronic device may include: a processor, a communications interface, a memory, and a communications bus, wherein the processor, the communications interface, and the memory communicate with each other via the communications bus. The processor may call the logic instructions in the memory, for example, to execute the following method: S1, add Gaussian noise to the input image to generate a perturbed image; S2, standardize the original input image and the perturbation image, and input the pre-trained self-supervised learning model to extract image features; S3, based on the image features of the input image and the perturbation image, calculate the KL divergence loss between the images to quantify the feature distribution differences between the images; S4, back-propagate the KL divergence loss to obtain the gradient norm; S5. Based on the calculation result of the gradient norm, a classification decision is made to determine whether the input image is a generated image.

[0052] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0053] An embodiment of the present invention further provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method provided in each of the above embodiments is implemented, for example, including: S1, add Gaussian noise to the input image to generate a perturbed image; S2, standardize the original input image and the perturbation image, and input the pre-trained self-supervised learning model to extract image features; S3, based on the image features of the input image and the perturbation image, calculate the KL divergence loss between the images to quantify the feature distribution differences between the images; S4, back-propagate the KL divergence loss to obtain the gradient norm; S5. Based on the calculation result of the gradient norm, a classification decision is made to determine whether the input image is a generated image.

[0054] The system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0055] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0056] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A training-free generated image detection system, characterized in that: include: An image input module is used to receive an input image to be detected; A noise disturbance module adds Gaussian noise to the input image to obtain a noise disturbance image; The feature acquisition module uses a pre-trained self-supervised learning model to extract image features of input images and perturbation images; The feature comparison module calculates the KL divergence loss between images based on the image features of the input image and the perturbation image, and quantifies the feature distribution differences between images; The gradient norm calculation module performs back propagation on the KL divergence loss to obtain the gradient norm; The classification decision module determines whether the input image is a generated image based on the gradient norm calculation result.

2. The detection method based on the detection system of claim 1, characterized in that: Includes steps: S1, add Gaussian noise to the input image to generate a perturbed image; S2, standardize the original input image and the perturbation image, and input the pre-trained self-supervised learning model to extract image features; S3, based on the image features of the input image and the perturbation image, calculate the KL divergence loss between the images to quantify the feature distribution differences between the images; S4, back-propagate the KL divergence loss to obtain the gradient norm; S5. Based on the calculation result of the gradient norm, a classification decision is made to determine whether the input image is a generated image.

3. The detection method according to claim 2, characterized in that: The pre-trained self-supervised learning model in S2 adopts the DINOv2 model.

4. The detection method according to claim 3, characterized in that: The image features are extracted based on the pre-trained self-supervised learning model in S2, including: S21. Using input image The pre-trained DINOv2 model extracts features and obtains the input image feature vector ; S22. Add Gaussian noise to the input image to generate a noise disturbance image. The formula is: ; in, Noise perturbation image, x is the input image , n is Gaussian noise ; S23, perturbed image The pre-trained DINOv2 model extracts features and obtains the feature vector of the noise perturbation image. .

5. The detection method according to claim 4, characterized in that: The KL divergence loss between images is calculated in S3, including: S31. Convert the feature vectors of the input image and the perturbation image into probability distribution, which is expressed as: ; in, Softmax() for Softmax function, p is the probability distribution of the input image, q is the probability distribution of the perturbed image; S32. Calculate the KL divergence loss of the probability distribution of the input image and the perturbation image. The formula is expressed as: ; in, is the KL divergence loss, p is the probability distribution of the input image, , q is the probability distribution of the perturbed image, , i is the number of elements in the probability distribution.

6. The detection method according to claim 5, characterized in that: The step S4 of obtaining the gradient norm includes: For KL divergence loss Perform back propagation and calculate the gradient norm of the parameters of the last linear layer of the model. The formula is expressed as: ; in, is the gradient norm, is the KL divergence loss, , θ is the gradient indicator parameter, j To find the number of derivatives.

7. The detection method according to claim 6, characterized in that: In S5, according to the gradient norm calculation result, a classification decision is made to determine whether the input image is a generated image, including: Setting Thresholds , according to the threshold Gradient norm Make a classification decision, if , the input image is judged to be a generated image; otherwise, the input image is judged to be a real image.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the detection method according to any one of claims 2 to 7 are implemented.

9. 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, the steps of the detection method according to any one of claims 2 to 7 are implemented.

Citation Information

Patent Citations

  • A method, device, electronic device and storage medium for generating image detection

    CN117934922B

  • Neural network training method and device based on complex value virtual adversarial training

    CN114781613A

  • Confrontation training method and system based on disturbance diversity enhancement

    CN116227542A

  • Generative image anomaly detection method based on diffusion model and uncertainty estimation

    CN118037672A

  • Image generation method and system based on limited data set

    CN118379594A

Cited By

  • Generated image detection method without assistance of neural network

    CN120355723A