A method, device, electronic device and storage medium for generating image detection
The generated image detection model that combines the frequency branch network and the spatial branch network solves the problem of low detection accuracy across generators and cross-scenarios, achieves high-accuracy detection of generated images, and enhances the robustness and robustness of the network. Detection capabilities.
Patent Information
- Application Number
- CN202311864932.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-12-29
AI Technical Summary
The existing technology has a reduced accuracy in generating image detection under cross-generator and cross-scenario scenarios, making it difficult to effectively detect forged images.
A generated image detection model that combines frequency branch networks and spatial branch networks is used to extract and purify forged features through splitting and combining spectral components, orthogonal decomposition of spatial features, and mutual information supervised learning to improve detection accuracy.
It significantly improves the accuracy of generated image detection in cross-generator and cross-scenario scenarios, reduces the algorithm's dependence on specific forgery patterns, enhances the detection ability of unknown forgery features in the full frequency band, and improves the robustness and robustness of the network. Detection capabilities.
Smart Images

Figure CN117934922B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a method, device, electronic device and storage medium for generating image detection. Background Art
[0002] With the rapid development of artificial intelligence content generation (AIGC) technology, the quality of AI-generated images has been rapidly improved. From the perspective of human perception, the quality of images generated by some image generation algorithms is approaching that of real images. While these AI-generated images bring convenience and fun to people's daily lives, society is also facing risks such as the spread of false information, privacy leakage, and copyright infringement.
[0003] Related technologies use a pre-trained diffusion generation model to detect AI-generated images to determine whether they are fake images. However, this method will experience varying degrees of decline in detection accuracy when faced with cross-generator and cross-scene detection that is not visible in the training set, and may even be completely undetectable.
[0004] Therefore, how to improve the accuracy of generated image detection in cross-generator and cross-scenario scenarios has become a technical problem that needs to be urgently solved in the industry. Summary of the invention
[0005] The present application provides a generated image detection method, device, electronic device and storage medium, which are used to solve the technical problem of how to improve the accuracy of generated image detection in cross-generator and cross-scene scenarios.
[0006] The present application provides a method for generating image detection, comprising:
[0007] Acquire the image to be detected;
[0008] Inputting the image to be detected into a generated image detection model to obtain a generated image detection result of the image to be detected output by the generated image detection model;
[0009] Wherein, the generated image detection model includes a frequency branch network, a space branch network and a classification detection network;
[0010] The frequency branch network is used to determine the suspicious frequency band corresponding to the spectrum graph of the image to be detected, split and combine the spectrum components of the spectrum graph corresponding to the suspicious frequency band, and obtain the first forgery related feature of the image to be detected;
[0011] The spatial branch network is used to perform orthogonal decomposition on the spatial features of the image to be detected to obtain a second forgery-related feature of the image to be detected;
[0012] The classification detection network is used to perform classification prediction on the image to be detected based on the first forgery-related feature and the second forgery-related feature to obtain the generated image detection result.
[0013] In some embodiments, the frequency branching network is used to:
[0014] Performing frequency domain transformation on the image to be detected to obtain a frequency spectrum of the image to be detected;
[0015] Proposing suspicious frequency bands for the spectrum graph of the image to be detected, and obtaining suspicious frequency bands corresponding to the spectrum graph of the image to be detected;
[0016] Determining a spectrum mask corresponding to the suspicious frequency band based on a starting frequency and an ending frequency of the suspicious frequency band in the spectrum diagram of the image to be detected;
[0017] Based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is split and combined with spectrum components to obtain a forgery feature-related image corresponding to the image to be detected;
[0018] Based on the forgery feature related image, a first forgery related feature of the image to be detected is determined.
[0019] In some embodiments, the performing of a suspicious frequency band proposal on the frequency spectrum of the image to be detected to obtain a suspicious frequency band corresponding to the frequency spectrum of the image to be detected includes:
[0020] Inputting the spectrum graph of the image to be detected into a frequency band proposal network to obtain a plurality of suspicious frequency bands output by the frequency band proposal network;
[0021] Inputting the spectrum graph of the image to be detected into a band proposal network, obtaining a plurality of suspicious frequency bands output by the band proposal network at a given frequency band priori position, wherein the output result includes a start frequency and an end frequency of each suspicious frequency band;
[0022] The a priori position of the frequency band is determined based on the frequency equal division points of the spectrum graph.
[0023] In some embodiments, the splitting and combining of spectrum components of the spectrum graph of the image to be detected based on the spectrum mask corresponding to the suspicious frequency band to obtain the forgery feature-related image corresponding to the image to be detected includes:
[0024] Based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is split into spectrum components to obtain a forged feature-related spectrum corresponding to the spectrum graph of the image to be detected; the forged feature-related spectrum includes a forged feature-related amplitude spectrum and a forged feature-related phase spectrum;
[0025] The forged feature-related amplitude spectrum and the forged feature-related phase spectrum are combined to determine a forged feature-related image corresponding to the image to be detected.
[0026] In some embodiments, the spatial branch network is used to:
[0027] Extracting the spatial features of the image to be detected to obtain the spatial features of the image to be detected;
[0028] Performing orthogonal decomposition on the spatial feature based on the first vector basis and the second vector basis to obtain a second forgery-related feature of the image to be detected;
[0029] Among them, the basis vectors in the first vector basis are perpendicular to the basis vectors in the second vector basis; the basis vectors in the first vector basis are used to represent the forgery-related features in the image to be detected; and the basis vectors in the second vector basis are used to represent the forgery-irrelevant features in the image to be detected.
[0030] In some embodiments, the loss function of generating the image detection model includes a first loss function and a second loss function;
[0031] The first loss function is determined based on a cross entropy classification loss function, a frequency band validity loss function, a vector basis orthogonality loss function, a feature alignment loss function, and a mutual information upper bound minimization loss function;
[0032] The second loss function is determined based on the loss function of the mutual information upper bound estimator;
[0033] The mutual information upper bound minimization loss function is determined based on the mutual information upper bound estimator.
[0034] In some embodiments, the generated image detection model is trained based on the following steps:
[0035] Train the initial model based on the training sample set, and determine the function value of the first loss function in the current iterative training process;
[0036] When the function value of the first loss function does not satisfy a preset convergence condition, adjusting the parameters of the initial model in a reverse direction based on the gradient of the first loss function;
[0037] Determine the function value of the second loss function in the current iterative training process;
[0038] Adjusting the parameters of the mutual information upper bound estimator in the first loss function based on the reverse direction of the gradient of the second loss function;
[0039] The next iterative training is performed on the initial model after parameter adjustment based on the training sample set until the function value of the first loss function meets a preset convergence condition.
[0040] The present application provides a device for generating image detection, comprising:
[0041] An acquisition unit, used for acquiring an image to be detected;
[0042] A detection unit, used for inputting the image to be detected into a generated image detection model to obtain a generated image detection result of the image to be detected output by the generated image detection model;
[0043] Wherein, the generated image detection model includes a frequency branch network, a space branch network and a classification detection network;
[0044] The frequency branch network is used to determine the suspicious frequency band corresponding to the spectrum graph of the image to be detected, split and combine the spectrum components of the spectrum graph corresponding to the suspicious frequency band, and obtain the first forgery related feature of the image to be detected;
[0045] The spatial branch network is used to perform orthogonal decomposition on the spatial features of the image to be detected to obtain a second forgery-related feature of the image to be detected;
[0046] The classification detection network is used to perform classification prediction on the image to be detected based on the first forgery-related feature and the second forgery-related feature to obtain the generated image detection result.
[0047] The present application provides 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 method for generating image detection when executing the computer program.
[0048] The present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for generating image detection is implemented.
[0049] The image detection generation method, device, electronic device and storage medium provided by the present application have the following beneficial effects:
[0050] (1) A method for proposing, separating and analyzing suspicious frequency bands is proposed to flexibly deal with the rich and diverse counterfeit features in the spectrum. Compared with the existing technical solution of directly extracting counterfeit features from the spectrum of the image, this method can analyze and compare the frequency bands containing suspicious counterfeit clues together, and make decisions in the fusion stage after feature extraction, effectively alleviating the risk of the algorithm overfitting to a specific counterfeit pattern; compared with the existing technical solution of dividing the spectrum by learning division points and then extracting features within a fixed frequency range, this method does not limit the search for suspicious counterfeit clues to a certain frequency range, but sets it on the entire frequency range, and can adaptively narrow the frequency range according to different counterfeit clues, effectively enhancing the algorithm's ability to deal with unknown counterfeit features in the full frequency band range;
[0051] (2) A learnable orthogonal decomposition method of spatial features is proposed to flexibly cope with the rich and diverse content information in the image. Different images contain different content information. Existing methods that directly extract forged features from images can easily cause forged features to couple with irrelevant image content features, resulting in a decrease in the network's cross-domain detection capabilities. This method adopts a scheme of first extracting features as a whole and then performing learnable feature decomposition. With the help of frequency domain branch features and mutual information supervised learning strategies, it can find the optimal forged feature decomposition method, thereby separating forged features from other features and improving the network's robustness to image content.
[0052] (3) A forged feature purification training strategy based on mutual information is proposed to flexibly deal with forged features of varying quality separated from images and their spectra. Due to the high coupling between forged features and image content, the forged features separated from the spatial domain and the frequency domain still contain information irrelevant to the forged features, while features irrelevant to the forged features still contain a small amount of information related to the forged features. Therefore, during the training process, the algorithm is supervised from the perspective of information theory to separate the forged clue information from other irrelevant information, thereby achieving further purification of the forged features and further improving the detection capability of the algorithm. However, no similar technical solution has been introduced in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0054] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0055] Figure 1 It is one of the flow charts of the method for generating image detection provided by the present application;
[0056] Figure 2 This is the second flow chart of the method for generating image detection provided by the present application;
[0057] Figure 3 It is a structural schematic diagram of the image generation detection device provided by the present application;
[0058] Figure 4 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION
[0059] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0060] It should be noted that the terms "first", "second" etc. in the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable in appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units or modules need not be limited to those steps or units or modules clearly listed, but may include other steps or units or modules that are not clearly listed or inherent to these processes, methods, products or equipment.
[0061] Figure 1 This is one of the flow charts of the method for generating image detection provided by this application, such as Figure 1 As shown, the method includes step 110 and step 120.
[0062] Step 110: Acquire an image to be detected.
[0063] Specifically, the execution subject of the generated image detection method provided in the embodiment of the present application is a generated image detection device. The device can be embodied in the form of hardware, such as a computer or a server, etc.; it can also be embodied in the form of software, such as a software program running on a computer or a server to execute the generated image detection method.
[0064] Generated images are images generated using artificial intelligence technology. Real images are images obtained by image sensors capturing the real world. Compared with real images, although the image quality of some generated images is not much different from that of real images from the perspective of human perception, the image information in the generated images is the computer's simulation of the real world, not an objective and true reflection of the real world. Therefore, generated images are also called forged images.
[0065] In related technologies, some special neural network models are usually used to obtain generated images, such as Generative Adversarial Network (GAN) and Variational AutoEncoder (VAE).
[0066] The image to be detected is an image that needs to be detected by the generated image. The image to be detected may be a generated image or a real image.
[0067] Step 120: input the image to be detected into the generated image detection model to obtain a generated image detection result of the image to be detected output by the generated image detection model.
[0068] Among them, the generated image detection model includes a frequency branch network, a space branch network and a classification detection network; the frequency branch network is used to determine the suspicious frequency band corresponding to the spectrum graph of the image to be detected, and to split and combine the spectrum components of the spectrum graph corresponding to the suspicious frequency band to obtain the first forgery-related feature of the image to be detected; the space branch network is used to perform orthogonal decomposition of the spatial features of the image to be detected to obtain the second forgery-related feature of the image to be detected; the classification detection network is used to classify and predict the image to be detected based on the first forgery-related feature and the second forgery-related feature to obtain the generated image detection result.
[0069] Specifically, the neural network model can be used to detect whether the image to be detected belongs to the generated image, and the generated image detection result of the image to be detected can be obtained. The generated image detection result can be limited according to the model output result. For example, the generated image detection result can be a generated image or a real image, or it can be the probability that the image to be detected belongs to the generated image, etc.
[0070] A neural network model can be used as the initial model, and a large number of sample detection images can be collected to train the initial model. The training loss is determined based on the difference between the predicted value (generated image detection result) output by the initial model and the true value (label of the sample detection image). The model parameters of the initial model are adjusted according to the training loss until the training loss is less than a preset threshold, thereby obtaining a generated image detection model that can be used to detect generated images.
[0071] The generated image detection model provided by the embodiment of the present application may structurally include a frequency branch network, a space branch network and a classification detection network, wherein the output of the frequency branch network is connected to the input of the classification detection network, and the output of the space branch network is connected to the input of the classification detection network.
[0072] The frequency branch network is mainly used to process the image to be detected from the frequency perspective. The image to be detected can be input into the frequency branch network, which extracts the frequency map of the image to be detected, determines the suspicious frequency band, splits and combines the spectrum components of the spectrum map corresponding to the suspicious frequency band, and obtains the first forgery-related feature of the image to be detected. The first forgery-related feature refers to the feature related to forged information extracted from the image to be detected from the frequency perspective. Forged information refers to image information generated by artificial intelligence technology. This image information is not an objective reflection of the real world, but a computer simulation of the real world.
[0073] In signal processing, images can also be regarded as a kind of signal, so they can also be described using frequency. Image frequency is an important parameter that describes the speed and direction of color changes in an image. The frequency of an image is divided into horizontal frequency and vertical frequency. For example, the horizontal frequency indicates the speed of color changes in the horizontal direction of the image, usually expressed in the number of pixels / lines; the vertical frequency indicates the speed of color changes in the vertical direction of the image, also expressed in the number of pixels / lines.
[0074] The suspicious frequency band refers to the frequency range in the spectrum graph corresponding to the image to be detected that may contain forged information.
[0075] The spatial branch network is mainly used to process the image to be detected from a spatial perspective. The image to be detected can be input into the spatial branch network, and the spatial branch network performs orthogonal decomposition on the spatial features of the image to be detected to obtain the second forgery-related features of the image to be detected. The spatial features of an image refer to some features and attributes of the image in the spatial domain, mainly including pixel distribution, edge information, texture features, etc. The second forgery-related features refer to features related to forgery information extracted from the image to be detected from a spatial perspective.
[0076] After determining the first forgery-related feature and the second forgery-related feature, the first forgery-related feature and the second forgery-related feature may be combined and input into a classification detection network, and the classification prediction network outputs a generated image detection result of the image to be detected.
[0077] The generated image detection method provided by the embodiment of the present application inputs the image to be detected into the generated image detection model to obtain the generated image detection result of the image to be detected output by the generated image detection model; wherein the generated image detection model includes a frequency branch network, a space branch network and a classification detection network; the frequency branch network is used to determine the suspicious frequency band corresponding to the frequency spectrum of the image to be detected, and the frequency spectrum corresponding to the suspicious frequency band is split and combined to obtain the first forgery related feature of the image to be detected; the space branch network is used to perform orthogonal decomposition of the spatial features of the image to be detected to obtain the second forgery related feature of the image to be detected; the classification detection network is used to classify and predict the image to be detected based on the first forgery related feature and the second forgery related feature to obtain the generated image detection result; because the generated image detection model extracts the forgery related features in the image from the perspectives of frequency and space respectively through the frequency branch network and the space branch network, and performs image detection according to the extracted forgery related features, the generated image detection model can effectively detect images of different generators or different application scenarios, and can maintain good detection accuracy for different images, thereby improving the accuracy of generated image detection in scenarios across generators and across scenarios.
[0078] It should be noted that each implementation method of the present application can be freely combined, the order can be changed, or it can be executed separately, and does not need to rely on or depend on a fixed execution order.
[0079] In some embodiments, the frequency branching network is used to:
[0080] Perform frequency domain transformation on the image to be detected to obtain a frequency spectrum of the image to be detected;
[0081] Propose suspicious frequency bands for the spectrum of the image to be detected, and obtain suspicious frequency bands corresponding to the spectrum of the image to be detected;
[0082] Determine a spectrum mask corresponding to the suspicious frequency band based on a start frequency and an end frequency of the suspicious frequency band in the spectrum diagram of the image to be detected;
[0083] Based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is split and combined to obtain the forgery feature-related image corresponding to the image to be detected;
[0084] Based on the forgery feature related image, a first forgery related feature of the image to be detected is determined.
[0085] Specifically, the frequency branch network is used to perform frequency domain transformation on the image to be detected, propose suspicious frequency bands, split and reorganize spectral components, and extract forgery-related features.
[0086] The image to be detected can be an RGB (Red / Green / Blue) three-channel image, which can be used Indicates that is a real number space, M is the number of pixels in the length direction of the image, and N is the number of pixels in the width direction of the image. M and N can be any positive integers, for example, M = 224, N = 224.
[0087] The frequency branch network first performs frequency domain transformation on the image to be detected. For each channel image of the image to be detected I The two-dimensional discrete Fourier transform can be used to obtain the two-dimensional discrete Fourier transform result corresponding to the channel image. It can be expressed as:
[0088]
[0089] Among them, x is the pixel coordinate of the channel image in the long direction, y is the pixel coordinate of the channel image in the wide direction, u is the frequency coordinate of the channel image in the long direction, v is the frequency coordinate of the channel image in the wide direction, e is the natural base, and j is the imaginary unit.
[0090] According to the two-dimensional discrete Fourier transform results, the spectrum corresponding to the channel image can be obtained, including the amplitude spectrum A c and phase spectrum P c , expressed as:
[0091]
[0092]
[0093] in, Represents the result of two-dimensional discrete Fourier transform The real part of Represents the result of two-dimensional discrete Fourier transform The imaginary part of , arctan is the inverse tangent function.
[0094] Secondly, the frequency branch network proposes suspicious frequency bands for the image to be detected. Suspicious frequency band proposal refers to predicting or suggesting the frequency range that may contain forged information in the spectrum graph, and determining the suspicious frequency band corresponding to the forged information. The method for proposing suspicious frequency bands can adopt a neural network model prediction method. By training the neural network, the trained neural network can predict the suspicious frequency band corresponding to the spectrum graph of the image to be detected based on the input spectrum graph. For example, the amplitude spectrum A can be obtained based on c The K suspicious frequency bands along the u-axis are expressed as Get the amplitude spectrum A c The K suspicious frequency bands along the v-axis are expressed as Similarly, the phase spectrum P can be obtained c The K suspicious frequency bands along the u-axis are expressed as Get the phase spectrum P c The K suspicious frequency bands along the v-axis are expressed as
[0095] For each suspicious frequency band, it has a corresponding start frequency and end frequency. c The i-th suspicious band among the K suspicious band proposals along the u-axis direction The starting frequency can be expressed as The stop frequency can be expressed as
[0096] If the suspicious frequency band is obtained is the normalized result, then we need to restore the normalized result to the corresponding frequency band range, then we have:
[0097]
[0098]
[0099] in, is the i-th suspicious frequency band The starting frequency in the amplitude spectrum of the image to be detected; is the i-th suspicious frequency band The ending frequency in the amplitude spectrum of the image to be detected, int is the rounding operator.
[0100] Similarly, for the i-th suspicious frequency band PPS Ac,v , then:
[0101]
[0102]
[0103] in, is the i-th suspicious frequency band The starting frequency in the amplitude spectrum of the image to be detected; is the i-th suspicious frequency band The stop frequency in the magnitude spectrum of the image to be detected.
[0104] For the i-th suspicious frequency band Then we have:
[0105]
[0106]
[0107] in, is the i-th suspicious frequency band The starting frequency in the phase spectrum of the image to be detected; is the i-th suspicious frequency band The end frequency in the phase spectrum of the image to be detected.
[0108] For the i-th suspicious frequency band Then we have:
[0109]
[0110]
[0111] in, is the i-th suspicious frequency band The starting frequency in the phase spectrum of the image to be detected; is the i-th suspicious frequency band The end frequency in the phase spectrum of the image to be detected.
[0112] According to the starting frequency and ending frequency of the suspicious frequency band in the spectrum diagram of the image to be detected, the spectrum mask corresponding to the suspicious frequency band is determined, which can be expressed as:
[0113]
[0114]
[0115] in, Represents the spectrum mask of the i-th suspicious frequency band in the amplitude spectrum of the image to be detected; Represents the spectrum mask of the i-th suspicious frequency band in the phase spectrum of the image to be detected.
[0116] Thirdly, the frequency branch network splits and reassembles the spectral components of the image to be detected. According to the spectral mask corresponding to the suspicious frequency band, the spectral component of the spectrum of the image to be detected is split and combined to obtain the forgery feature-related image corresponding to the image to be detected. Spectral component splitting refers to the spectrum mask of each suspicious frequency band in the amplitude spectrum and phase spectrum of the image to be detected, respectively, and the amplitude spectrum A of the image to be detected is reconstructed. c and phase spectrum P c Perform mask operation and transform the amplitude spectrum A of the image to be detected c Split into two parts, one part is the forged feature correlation amplitude spectrum The other part is the forged feature-independent amplitude spectrum Similarly, the phase spectrum P of the image to be detected is c Split into two parts, one part is the forged characteristic correlation phase spectrum The other part is the forged feature-independent phase spectrum
[0117] The combination of spectral components refers to combining the forged feature-related amplitude spectrum and phase spectrum, and combining the forged feature-independent amplitude spectrum and phase spectrum. After combining the forged feature-related amplitude spectrum and phase spectrum, a two-dimensional inverse Fourier transform is performed to obtain the forged feature-related image. After combining the forged feature-independent amplitude spectrum and phase spectrum and performing a two-dimensional inverse Fourier transform, the forged feature-independent image can be obtained.
[0118] Finally, the frequency branch network extracts forgery-related features from the image to be detected. r By performing feature extraction, the first forgery-related features of the image to be detected can be obtained. Similarly, we can also forge feature-independent images I ir By performing feature extraction, the first forgery-independent feature of the image to be detected can be obtained.
[0119] For example, a backbone network can be used and Extract I r and I ir The eigenvector of and and Any image feature extraction backbone network can be used, such as ResNet-18 (Residual Network).
[0120] Here, For the first forged related feature The initial eigenvector of For the first fake irrelevant feature The initial eigenvector of , C is the eigenvector dimension, which can be determined according to actual conditions, for example, C = 512.
[0121] Considering that the amount of forged information contained in each suspicious frequency band may be different, the attention mechanism can be used to calculate the confidence of each suspicious frequency band, and the initial feature vector of the first forgery-related feature can be adjusted according to the confidence. Perform weighted processing to obtain the first forgery related feature It can be expressed as:
[0122]
[0123] in, is the initial feature vector of the first forged correlation feature The component corresponding to the i-th suspicious frequency band in; score[i] is The confidence level,
[0124] The attention mechanism can adopt attention models such as Transformer encoder.
[0125] For the first forgery irrelevant feature The initial eigenvector of Then we can average along the first dimension, that is, average the components corresponding to each suspicious frequency band, and get the first forgery-irrelevant feature, which can be expressed as:
[0126]
[0127] in, is the initial feature vector of the first forged irrelevant feature The component corresponding to the i-th suspicious frequency band in .
[0128] In the embodiments of the present application, is the first forged correlation feature finally output by the frequency branch network, It is the first forged irrelevant feature of the final output of the frequency branch network.
[0129] The generated image detection method provided in the embodiment of the present application performs frequency domain transformation, suspicious frequency band proposal, spectrum component splitting and reorganization, and forgery related feature extraction on the image to be detected through a frequency branch network, thereby adaptively providing some frequency band ranges that may contain forgery feature clues based on the spectrum diagram of the input image, and then separating and recombining these suspicious frequency bands from the original spectrum components and performing further analysis to provide feature vectors containing forgery clues and their confidence levels, thereby improving the accuracy of the first forgery related feature extraction and improving the accuracy of generated image detection in cross-generator and cross-scenario scenarios.
[0130] In some embodiments, performing a suspicious frequency band proposal on the frequency spectrum of the image to be detected to obtain a suspicious frequency band corresponding to the frequency spectrum of the image to be detected includes:
[0131] The spectrum of the image to be detected is input into the band proposal network to obtain multiple suspicious frequency bands output by the band proposal network at the given frequency band prior position. The output result includes the starting frequency and the ending frequency of each suspicious frequency band.
[0132] The a priori position of the frequency band is determined based on the frequency equal division points of the spectrum graph.
[0133] Specifically, a frequency band proposal network may be constructed to process the frequency spectrum of the image to be detected, and obtain a plurality of suspicious frequency bands corresponding to the frequency spectrum of the image to be detected.
[0134] From the perspective of network structure, the band proposal network can include a band proposal backbone network connected in sequence Convolution layer Conv u , fully connected layer FC, activation function layer Sigmoid.
[0135] Frequency band proposal backbone network Perform feature extraction on the amplitude spectrum A c to obtain an abstract feature map After the subsequent network processes the abstract feature map, the amplitude spectrum A can be obtained c K suspicious frequency bands along the u-axis direction can be expressed as:
[0136]
[0137] Here, since the activation function layer is adopted, the output suspicious frequency bands are normalized.
[0138] Similarly, the frequency band proposal network can also process the phase spectrum P c and the backbone network can adopt
[0139] and Any image feature extraction backbone network can be adopted, such as ResNet-18 (Residual Network), etc.
[0140] In order for the suspicious frequency bands of the frequency band proposal network to cover the full frequency band range, add frequency band prior position information. The frequency band prior position is determined based on the frequency equal division points of the spectrogram. For example, each suspicious frequency band can be normalized so that the frequency range of each suspicious frequency band is [0,1]. prior i is the i-th frequency equal division point on the normalized result [0,1] of the full frequency band range, and can be used to represent the frequency band prior position information of the i-th suspicious frequency band.
[0141] The i-th suspicious frequency band proposal starting frequency and ending frequency are:
[0142]
[0143]
[0144] where 0 ≤ i < K, [·] is the matrix value-taking operation. Similarly, using a convolution layer Conv with a convolution kernel size of (M×3) and a padding size of (0×1) v , with other network structures unchanged, the amplitude spectrum A can be obtained cSuspected band proposal along the v-axis
[0145] The generated image detection method provided in the embodiment of the present application processes the spectrum diagram of the image to be detected through a frequency band proposal network to obtain multiple suspicious frequency bands. In addition, frequency band prior position information is added to the multiple suspicious frequency band proposals, so that the suspicious frequency band can cover the entire frequency band range while also paying attention to the frequencies at different positions, thereby improving the breadth of the first forgery related feature extraction and improving the accuracy of generated image detection in cross-generator and cross-scenario scenarios.
[0146] In some embodiments, based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is split and combined into spectrum components to obtain a forgery feature-related image corresponding to the image to be detected, including:
[0147] Based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is decomposed into spectrum components to obtain the forged feature-related spectrum corresponding to the spectrum graph of the image to be detected; the forged feature-related spectrum includes a forged feature-related amplitude spectrum and a forged feature-related phase spectrum;
[0148] The forged feature-related amplitude spectrum and the forged feature-related phase spectrum are combined to determine a forged feature-related image corresponding to the image to be detected.
[0149] Specifically, the spectrum mask corresponding to each suspicious frequency band may be used to decompose the spectrum components of the spectrum graph of the image to be detected, so as to obtain the forgery feature-related spectrum corresponding to the spectrum graph of the image to be detected.
[0150] The spectrum mask corresponding to the i-th suspicious frequency band includes the spectrum mask in the amplitude spectrum Spectral masks in the phase spectrum
[0151] The spectrum of the image to be detected is split into spectral components. Spectral component splitting refers to the spectrum mask of each suspicious frequency band in the amplitude spectrum and phase spectrum of the image to be detected, and the amplitude spectrum A of the image to be detected is respectively c and phase spectrum P c Perform mask operation and transform the amplitude spectrum A of the image to be detected c Split into two parts, one part is the forged feature correlation amplitude spectrum The other part is the forged feature-independent amplitude spectrum Similarly, the phase spectrum P of the image to be detected is c Split into two parts, one part is the forged characteristic correlation phase spectrum The other part is the forged feature-independent phase spectrum
[0152] It can be expressed as:
[0153]
[0154]
[0155]
[0156]
[0157] Among them, the multiplication in the above formula is element-wise multiplication.
[0158] For the amplitude spectrum related to the forgery feature and the phase spectrum related to the forgery feature Combining them and using the two-dimensional inverse Fourier transform iDFT to transform them back to the spatial domain, the forgery feature related image corresponding to the c-th channel image in the i-th suspicious frequency band can be obtained It can be expressed as:
[0159]
[0160] Among them, sin is the sine function and cos is the cosine function.
[0161] For the amplitude spectrum unrelated to the forgery feature and the phase spectrum unrelated to the forgery feature Combining them and using the two-dimensional inverse Fourier transform iDFT to transform them back to the spatial domain, the forgery feature unrelated image corresponding to the c-th channel image in the i-th suspicious frequency band can be obtained It can be expressed as:
[0162]
[0163] For and (c = R, G, B, 0 ≤ i < K), concatenation is performed respectively in the channel dimension and the batch dimension to obtain the forgery feature related image and the forgery feature unrelated image
[0164] The image generation detection method provided by the embodiments of the present application, through spectrum component splitting and combination of the spectrogram of the image to be detected, obtains the forgery feature related image corresponding to the image to be detected. The obtained forgery feature related image contains a large amount of forgery related information, and improves the accuracy of image generation detection in the scenarios of cross-generator and cross-scene.
[0165] In some embodiments, the spatial branch network is used to:
[0166] Extract the spatial features of the image to be detected to obtain the spatial features of the image to be detected;
[0167] Performing orthogonal decomposition on the spatial feature based on the first vector basis and the second vector basis to obtain a second forgery-related feature of the image to be detected;
[0168] Among them, the basis vectors in the first vector basis are perpendicular to the basis vectors in the second vector basis; the basis vectors in the first vector basis are used to represent the forgery-related features in the image to be detected; and the basis vectors in the second vector basis are used to represent the forgery-irrelevant features in the image to be detected.
[0169] Specifically, from a structural point of view, the spatial branch network can include a spatial branch backbone network and an orthogonal decomposition network.
[0170] Space branch backbone network bb can be used s Extract the spatial features of the image to be detected and obtain the spatial features of the image to be detected I Here, C is the feature vector dimension, which can be determined according to actual conditions, for example, C = 512. Spatial branch backbone network bb s Any image feature extraction backbone network can be used, such as Swin network and Transformer-Tiny network.
[0171] The orthogonal decomposition network uses two sets of learnable and mutually orthogonal first vector bases. and the second vector basis f s Orthogonal decomposition can be expressed as:
[0172]
[0173]
[0174] in, is the second forgery-related feature, is the second forgery irrelevant feature, m r is the basis vector in the first vector basis The number of ir is the basis vector in the second vector basis , j is the number of basis vectors, and T is the transposition operator symbol.
[0175]
[0176] Generally, Used for Round up; Used for Round down.
[0177] The generated image detection method provided in the embodiment of the present application includes orthogonal decomposition of spatial features, learning two sets of mutually orthogonal vector bases in the feature space, and orthogonal decomposition of the features extracted from the spatial image to obtain a feature vector containing forged features. The obtained feature vector contains a large amount of forgery-related information, which improves the accuracy of generated image detection in cross-generator and cross-scene scenarios.
[0178] In some embodiments, the classification detection network is used to aggregate the output feature vectors of the frequency branch network and the spatial branch network, which can be expressed as:
[0179]
[0180]
[0181] in, is the first forgery-related feature, is the second forgery-related feature; r To forge relevant aggregate features; is the first forged irrelevant feature, is the second forgery irrelevant feature; ir To forge irrelevant aggregate features.
[0182] The classification detection network uses a classifier σ to classify f r Classify and output the predicted probability of whether the input image to be detected is a forged image (Generate image detection results) The classifier σ can be any classifier, for example, including 3 fully connected layers and 1 Sigmoid activation function layer.
[0183] In some embodiments, the loss function for generating the image detection model includes a first loss function and a second loss function;
[0184] The first loss function is determined based on the cross entropy classification loss function, the band validity loss function, the vector basis orthogonality loss function, the feature alignment loss function and the mutual information upper bound minimization loss function;
[0185] The second loss function is determined based on the loss function of the mutual information upper bound estimator;
[0186] Among them, the mutual information upper bound minimization loss function is determined based on the mutual information upper bound estimator.
[0187] Specifically, the size of the mutual information indicates the degree of correlation or dependence between two random variables. When the mutual information is larger, it means that the correlation between the two variables is stronger and the amount of information they share is more. The mutual information upper bound estimator is a method for estimating the mutual information between two random variables. Mutual information is a measure that describes the correlation between two random variables and can be used to measure their mutual dependence and information transfer efficiency.
[0188] In the process of training the generated image detection model, an algorithm training strategy based on mutual information can be adopted. First, the upper bound of mutual information between the forged related features and the forged irrelevant features separated from the spectral branch network and the spatial branch network is estimated, and then this upper bound of mutual information is minimized and optimized to achieve the purification of the implicit information of the forged features. That is, in the training process, a mutual information upper bound estimator is introduced.
[0189] The smaller the upper bound of the mutual information is, the smaller the correlation between the forged relevant features and the forged irrelevant features is, the less noise is contained in the forged relevant features, the more informative and discriminative they are, which helps to improve model performance and reduce the risk of overfitting.
[0190] Therefore, the loss function of generating the image detection model includes a first loss function and a second loss function.
[0191] The first loss function is used to calculate the training loss of the generated image detection model during the training process; the second loss function calculates the loss of the mutual information upper bound estimator during the training process.
[0192] The first loss function Can include cross entropy classification loss function Band validity loss function Vector Basis Orthogonality Loss Function Feature Alignment Loss Function and mutual information upper bound minimizes the loss function It can be expressed as:
[0193]
[0194] Cross Entropy Classification Loss Function It can be expressed as:
[0195]
[0196] in, is the training sample set, I is the sample image to be detected, y is the sample label (true value) of the sample image to be detected, is the prediction result (prediction value) of the sample image to be detected, and log is the logarithmic function.
[0197] Band validity loss function It can be expressed as:
[0198]
[0199] Where c is the image channel, c∈{R,G,B}; D is the set of amplitude spectrum A and phase spectrum P, D∈{A,P}; a is the set of frequency coordinates u and frequency coordinates v, a∈{u,v}; ε is the minimum interval of frequency band proposals, which can be any value in [0,1], for example, ε=0.1; K is the number of suspicious frequency band proposals, which can be any positive integer, for example, K=15; max is the maximum value function; i1 represents the sign of the starting frequency, and i2 represents the sign of the ending frequency.
[0200] Vector Basis Orthogonality Loss Function It can be expressed as:
[0201]
[0202] Feature Alignment Loss Function It can be expressed as:
[0203]
[0204] The mutual information upper bound minimizes the loss function It can be expressed as:
[0205]
[0206] Among them, f r′ f r Different expressions in Eq.
[0207] The second loss function It can be expressed as:
[0208]
[0209] Among them, q θ is a mutual information upper bound estimator, which can be any neural network with a C-dimensional feature vector as input and a C-dimensional feature vector as output, for example, it can include three fully connected layers.
[0210] The generated image detection method provided in the embodiment of the present application, the loss function of the generated image detection model includes a first loss function and a second loss function, the first loss function is used to calculate the training loss of the model, and the second loss function is used to calculate the loss of the mutual information upper bound estimator, so that the implicit information of the forged features is purified, and the accuracy of generated image detection is improved in the scenario of cross-generator and cross-scene.
[0211] In some embodiments, the generated image detection model is trained based on the following steps:
[0212] Train the initial model based on the training sample set, and determine the function value of the first loss function in the current iterative training process;
[0213] When the function value of the first loss function does not satisfy the preset convergence condition, adjusting the parameters of the initial model in the reverse direction based on the gradient of the first loss function;
[0214] Determine the function value of the second loss function in the current iteration training process;
[0215] Adjusting the parameters of the mutual information upper bound estimator in the first loss function based on the reverse direction of the gradient of the second loss function;
[0216] The next iterative training is performed on the initial model after parameter adjustment based on the training sample set until the function value of the first loss function meets the preset convergence condition.
[0217] Specifically, a large number of sample images to be detected may be collected, and these sample images to be detected may be annotated to obtain sample labels corresponding to the sample images to be detected.
[0218] The initial model is trained multiple times using the training sample set. After the current iterative training process is completed, the function value of the first loss function is determined. The preset convergence condition can be set as needed, for example, the function value of the first loss function is less than a preset threshold.
[0219] If the function value of the first loss function does not meet the preset convergence condition, the parameters of the initial model are adjusted according to the reverse direction of the gradient of the first loss function. At the same time, the function value of the second loss function corresponding to the mutual information upper bound estimator is also determined. According to the reverse direction of the gradient of the second loss function, the parameters of the mutual information upper bound estimator in the first loss function are adjusted.
[0220] After the parameters of the model and the parameters of the mutual information upper bound estimator are adjusted, the next iteration training is continued until the function value of the first loss function meets the preset convergence condition. The model obtained at this time is the generated image detection model.
[0221] The generated image detection method provided in the embodiment of the present application first estimates the upper bound of the mutual information between the forged features and the forged irrelevant features separated from the spectrum graph and the spatial graph, and then minimizes and optimizes this mutual information upper bound, thereby achieving the purification of the implicit information of the forged features, and improving the accuracy of generated image detection in cross-generator and cross-scenario scenarios.
[0222] Figure 2This is the second flow chart of the method for generating image detection provided by this application, such as Figure 2 As shown, the method includes an inference phase and a training phase, wherein the dashed line portion is only retained in the training phase.
[0223] The process of the inference phase includes:
[0224] Step 1: Input a three-channel image I to be detected into the generated image detection model;
[0225] Step 2: Input I into two branch networks (frequency branch network and spatial feature network). The frequency branch network performs frequency domain transformation, suspicious frequency band proposal, component splitting and reorganization, and frequency domain feature extraction on the image to obtain the first forgery related feature Features not related to the first forgery The spatial branch network extracts spatial features and decomposes features orthogonally to obtain the second forgery related features. and the second forgery-irrelevant feature
[0226] Step 3: Forge the first related feature and the second forgery-related feature Input the classification detection network to obtain the predicted probability of whether the input image is a forged synthetic image.
[0227] The training phase process includes:
[0228] Step 1: Perform current iteration training on the model based on the training sample set;
[0229] Step 2: Calculate the function value of the first loss function in the current iterative training process;
[0230] Step 3: When the preset convergence conditions are not met, the gradient back propagation algorithm is used to update the parameters of the model;
[0231] Step 4: Calculate the second loss function corresponding to the mutual information upper bound estimator;
[0232] Step 5: Use the gradient back propagation algorithm to update the parameters of the mutual information upper bound estimator;
[0233] Step 6: Iterate steps 1 to 5 until the function value of the first loss function meets the preset convergence condition.
[0234] The image generation detection method provided in the embodiment of the present application has three characteristics:
[0235] Feature (1) includes suspicious frequency band proposal and component reorganization and analysis. According to the spectrum of the input image, some frequency band ranges that may contain forgery feature clues are adaptively given. These suspicious frequency bands are then separated from the original spectrum components, recombined and further analyzed to give feature vectors containing forgery clues and their confidence levels.
[0236] Feature (2) includes orthogonal decomposition of spatial features, learning two sets of mutually orthogonal vector bases in the feature space, and performing orthogonal decomposition on the features extracted from the spatial image to obtain a feature vector containing the forged features.
[0237] Feature (3) includes an algorithm training strategy based on mutual information. First, the upper bound of the mutual information between the forged features and the forged irrelevant features separated from the spectrum graph and the spatial graph is estimated, and then this upper bound of the mutual information is minimized and optimized to achieve the purification of the implicit information of the forged features.
[0238] Table 1 shows the accuracy comparison results (unit: %) of the generated image detection method provided in the embodiment of the present application with other methods on two different scene datasets, GenImage and DiffusionForensics, which contain images generated by multiple generators. The results show that the method has better cross-generator and cross-scene generated image detection capabilities.
[0239] Table 1 Detection accuracy of generated images of different models
[0240]
[0241] Table 2 shows the contribution of features (1)-(3) to the detection accuracy (unit: %) in the cross-generator detection task through ablation experiments.
[0242] Table 2 Detection accuracy of ablation experiments on the GenImage dataset
[0243] Ablation characteristics Mean none 80.4 Features(1) 77.1 (down 3.3) Features(2) 77.8 (down 2.6) Features(3) 75.3 (down 5.1)
[0244] The device provided in the embodiment of the present application is described below. The device described below and the method described above can be referenced to each other.
[0245] Figure 3 is a schematic diagram of the structure of the image detection device provided by the present application, such as Figure 3 As shown, the device comprises:
[0246] An acquisition unit 310 is used to acquire an image to be detected;
[0247] A detection unit 320, configured to input the image to be detected into the generated image detection model, and obtain a generated image detection result of the image to be detected output by the generated image detection model;
[0248] Among them, the generated image detection model includes a frequency branch network, a space branch network and a classification detection network; the frequency branch network is used to determine the suspicious frequency band corresponding to the spectrum graph of the image to be detected, and to split and combine the spectrum components of the spectrum graph corresponding to the suspicious frequency band to obtain the first forgery-related feature of the image to be detected; the space branch network is used to perform orthogonal decomposition of the spatial features of the image to be detected to obtain the second forgery-related feature of the image to be detected; the classification detection network is used to classify and predict the image to be detected based on the first forgery-related feature and the second forgery-related feature to obtain the generated image detection result.
[0249] The generated image detection device provided by the embodiment of the present application inputs the image to be detected into the generated image detection model to obtain the generated image detection result of the image to be detected output by the generated image detection model; wherein the generated image detection model includes a frequency branch network, a space branch network and a classification detection network; the frequency branch network is used to determine the suspicious frequency band corresponding to the frequency spectrum of the image to be detected, and to split and combine the frequency spectrum corresponding to the suspicious frequency band to obtain the first forgery related feature of the image to be detected; the space branch network is used to perform orthogonal decomposition of the spatial features of the image to be detected to obtain the second forgery related feature of the image to be detected; the classification detection network is used to classify and predict the image to be detected based on the first forgery related feature and the second forgery related feature to obtain the generated image detection result; because the generated image detection model extracts the forgery related features in the image from the perspectives of frequency and space respectively through the frequency branch network and the space branch network, and performs image detection according to the extracted forgery related features, the generated image detection model can effectively detect images of different generators or different application scenarios, and can maintain good detection accuracy for different images, thereby improving the accuracy of generated image detection in scenarios across generators and across scenarios.
[0250] In some embodiments, the frequency branching network is used to:
[0251] Perform frequency domain transformation on the image to be detected to obtain a frequency spectrum of the image to be detected;
[0252] Propose suspicious frequency bands for the spectrum of the image to be detected, and obtain suspicious frequency bands corresponding to the spectrum of the image to be detected;
[0253] Determine a spectrum mask corresponding to the suspicious frequency band based on a start frequency and an end frequency of the suspicious frequency band in the spectrum diagram of the image to be detected;
[0254] Based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is split and combined to obtain the forgery feature-related image corresponding to the image to be detected;
[0255] Based on the forgery feature related image, a first forgery related feature of the image to be detected is determined.
[0256] In some embodiments, the frequency branching network is used to:
[0257] The spectrum graph of the image to be detected is input into the band proposal network to obtain multiple suspicious frequency bands output by the band proposal network;
[0258] It is proposed to add frequency band priori position information for multiple suspicious frequency bands to obtain the starting frequency and ending frequency of each suspicious frequency band in the spectrum diagram of the image to be detected;
[0259] The frequency band priori position information is determined based on the positional relationship of each suspicious frequency band.
[0260] In some embodiments, the frequency branching network is used to:
[0261] Based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is decomposed into spectrum components to obtain the forged feature-related spectrum corresponding to the spectrum graph of the image to be detected; the forged feature-related spectrum includes a forged feature-related amplitude spectrum and a forged feature-related phase spectrum;
[0262] The forged feature-related amplitude spectrum and the forged feature-related phase spectrum are combined to determine a forged feature-related image corresponding to the image to be detected.
[0263] In some embodiments, the spatial branching network is used to:
[0264] Extract the spatial features of the image to be detected to obtain the spatial features of the image to be detected;
[0265] Performing orthogonal decomposition on the spatial feature based on the first vector basis and the second vector basis to obtain a second forgery-related feature of the image to be detected;
[0266] Among them, the basis vectors in the first vector basis are perpendicular to the basis vectors in the second vector basis; the basis vectors in the first vector basis are used to represent the forgery-related features in the image to be detected; and the basis vectors in the second vector basis are used to represent the forgery-irrelevant features in the image to be detected.
[0267] In some embodiments, the loss function for generating the image detection model includes a first loss function and a second loss function;
[0268] The first loss function is determined based on the cross entropy classification loss function, the band validity loss function, the vector basis orthogonality loss function, the feature alignment loss function and the mutual information upper bound minimization loss function;
[0269] The second loss function is determined based on the loss function of the mutual information upper bound estimator;
[0270] Among them, the mutual information upper bound minimization loss function is determined based on the mutual information upper bound estimator.
[0271] In some embodiments, it also includes:
[0272] A training unit, used to train the initial model based on the training sample set and determine the function value of the first loss function in the current iterative training process;
[0273] When the function value of the first loss function does not satisfy the preset convergence condition, adjusting the parameters of the initial model in the reverse direction based on the gradient of the first loss function;
[0274] Determine the function value of the second loss function in the current iteration training process;
[0275] Adjusting the parameters of the mutual information upper bound estimator in the first loss function based on the reverse direction of the gradient of the second loss function;
[0276] The next iterative training is performed on the initial model after parameter adjustment based on the training sample set until the function value of the first loss function meets the preset convergence condition.
[0277] Figure 4 is a schematic diagram of the structure of the electronic device provided by this application, such as Figure 4 As shown, the electronic device may include: a processor (Processor) 410, a communication interface (CommunicationsInterface) 420, a memory (Memory) 430 and a communication bus (CommunicationsBus) 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic command in the memory 430 to execute the method described in the above embodiment, for example:
[0278] Obtain an image to be detected; input the image to be detected into a generated image detection model to obtain a generated image detection result of the image to be detected output by the generated image detection model;
[0279] Among them, the generated image detection model includes a frequency branch network, a space branch network and a classification detection network; the frequency branch network is used to determine the suspicious frequency band corresponding to the spectrum graph of the image to be detected, and to split and combine the spectrum components of the spectrum graph corresponding to the suspicious frequency band to obtain the first forgery-related feature of the image to be detected; the space branch network is used to perform orthogonal decomposition of the spatial features of the image to be detected to obtain the second forgery-related feature of the image to be detected; the classification detection network is used to classify and predict the image to be detected based on the first forgery-related feature and the second forgery-related feature to obtain the generated image detection result.
[0280] In addition, the logic commands 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 application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several commands to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0281] The processor in the electronic device provided in the embodiment of the present application can call the logic instructions in the memory to implement the above method. Its specific implementation method is consistent with the implementation method of the aforementioned method and can achieve the same beneficial effects, which will not be repeated here.
[0282] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the methods provided in the above embodiments are implemented.
[0283] Its specific implementation is consistent with the aforementioned method implementation and can achieve the same beneficial effects, so it will not be repeated here.
[0284] An embodiment of the present application provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0285] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed 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 scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0286] 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, it 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.
[0287] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application 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 application.
Claims
1. A method for generating image detection, characterized in that: include: Acquire the image to be detected; Inputting the image to be detected into a generated image detection model to obtain a generated image detection result of the image to be detected output by the generated image detection model; Wherein, the generated image detection model includes a frequency branch network, a space branch network and a classification detection network; The frequency branch network is used to determine the suspicious frequency band corresponding to the spectrum graph of the image to be detected, split and combine the spectrum components of the spectrum graph corresponding to the suspicious frequency band, and obtain the first forgery related feature of the image to be detected; The spatial branch network is used to perform orthogonal decomposition on the spatial features of the image to be detected to obtain a second forgery-related feature of the image to be detected; The classification detection network is used to perform classification prediction on the image to be detected based on the first forgery-related feature and the second forgery-related feature to obtain the generated image detection result.
2. The generated image detection method according to claim 1, characterized in that: The frequency branching network is used for: Performing frequency domain transformation on the image to be detected to obtain a frequency spectrum of the image to be detected; Proposing suspicious frequency bands for the spectrum graph of the image to be detected, and obtaining suspicious frequency bands corresponding to the spectrum graph of the image to be detected; Determining a spectrum mask corresponding to the suspicious frequency band based on a starting frequency and an ending frequency of the suspicious frequency band in the spectrum diagram of the image to be detected; Based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is split and combined with spectrum components to obtain a forgery feature-related image corresponding to the image to be detected; Based on the forgery feature related image, a first forgery related feature of the image to be detected is determined.
3. The generated image detection method according to claim 2, characterized in that: Proposing suspicious frequency bands for the spectrum graph of the image to be detected to obtain suspicious frequency bands corresponding to the spectrum graph of the image to be detected includes: Inputting the spectrum graph of the image to be detected into a band proposal network, obtaining a plurality of suspicious frequency bands output by the band proposal network at a given frequency band priori position, wherein the output result includes a start frequency and an end frequency of each suspicious frequency band; The a priori position of the frequency band is determined based on the frequency equal division points of the spectrum graph.
4. The generated image detection method according to claim 2, characterized in that: The step of splitting and combining the spectrum components of the spectrum graph of the image to be detected based on the spectrum mask corresponding to the suspicious frequency band to obtain the forgery feature-related image corresponding to the image to be detected includes: Based on the spectrum mask corresponding to the suspicious frequency band, the spectrum graph of the image to be detected is split into spectrum components to obtain a forged feature-related spectrum corresponding to the spectrum graph of the image to be detected; the forged feature-related spectrum includes a forged feature-related amplitude spectrum and a forged feature-related phase spectrum; The forged feature-related amplitude spectrum and the forged feature-related phase spectrum are combined to determine a forged feature-related image corresponding to the image to be detected.
5. The generated image detection method according to claim 1, characterized in that: The spatial branch network is used for: Extracting the spatial features of the image to be detected to obtain the spatial features of the image to be detected; Performing orthogonal decomposition on the spatial feature based on the first vector basis and the second vector basis to obtain a second forgery-related feature of the image to be detected; Wherein, the basis vectors in the first vector basis and the basis vectors in the second vector basis are perpendicular to each other; the basis vectors in the first vector basis are used to represent the forgery-related features in the image to be detected; The basis vectors in the second vector basis are used to represent the forgery-irrelevant features in the image to be detected.
6. The generated image detection method according to claim 1, characterized in that: The loss function of the generated image detection model includes a first loss function and a second loss function; The first loss function is determined based on a cross entropy classification loss function, a frequency band validity loss function, a vector basis orthogonality loss function, a feature alignment loss function, and a mutual information upper bound minimization loss function; The second loss function is determined based on the loss function of the mutual information upper bound estimator; The mutual information upper bound minimization loss function is determined based on the mutual information upper bound estimator.
7. The generated image detection method according to claim 6, characterized in that: The generated image detection model is trained based on the following steps: Train the initial model based on the training sample set, and determine the function value of the first loss function in the current iterative training process; When the function value of the first loss function does not satisfy a preset convergence condition, adjusting the parameters of the initial model in a reverse direction based on the gradient of the first loss function; Determine the function value of the second loss function in the current iterative training process; Adjusting the parameters of the mutual information upper bound estimator in the first loss function based on the reverse direction of the gradient of the second loss function; The next iterative training is performed on the initial model after parameter adjustment based on the training sample set until the function value of the first loss function meets a preset convergence condition.
8. A device for generating image detection, characterized in that: include: An acquisition unit, used for acquiring an image to be detected; A detection unit, used for inputting the image to be detected into a generated image detection model to obtain a generated image detection result of the image to be detected output by the generated image detection model; Wherein, the generated image detection model includes a frequency branch network, a space branch network and a classification detection network; The frequency branch network is used to determine the suspicious frequency band corresponding to the spectrum graph of the image to be detected, split and combine the spectrum components of the spectrum graph corresponding to the suspicious frequency band, and obtain the first forgery related feature of the image to be detected; The spatial branch network is used to perform orthogonal decomposition on the spatial features of the image to be detected to obtain a second forgery-related feature of the image to be detected; The classification detection network is used to perform classification prediction on the image to be detected based on the first forgery-related feature and the second forgery-related feature to obtain the generated image detection result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for generating image detection according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating image detection according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
A training-free image detection system, method, device and medium
CN119785123A
