A GAN image detector avoidance method based on information decoupling and reconstruction
By using a method based on information decoupling and reconstruction, residual images are generated to avoid the detection of GAN image detectors, which solves the vulnerability problem of existing GAN image detectors, improves the security of the detector and the evasion success rate, and has extensive research and application value.
Patent Information
- Application Number
- CN202210267218.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-18
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-03-18
AI Technical Summary
Existing GAN image detectors are susceptible to adversarial perturbation attacks, resulting in detection vulnerability and inability to effectively avoid GAN-generated images, posing security risks.
A GAN image detector avoidance method based on information decoupling and reconstruction is used to generate residual images through frequency filtering and feature extractor training to avoid the detection of the GAN image detector and improve the security of the detector.
It effectively circumvents various types of GAN image detectors, improves the evasion success rate, and enhances the research value and application prospects of computer vision security tasks.
Smart Images

Figure FHA0000005956000000011 
Figure FHA0000005956000000013 
Figure FHA0000005956000000022
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of artificial intelligence systems, and in particular to a GAN image detector avoidance method based on information decoupling and reconstruction. Background Art
[0002] In recent years, the main way to generate fake images is to use generative adversarial networks (GANs), which can generate images that are good enough to fool human eyes. These GAN images can easily cause harm to society, such as damaging reputations and falsifying criminal evidence. Although most GAN-generated outputs can be easily detected by training neural network classifiers, this detection method is easily vulnerable to adversarial perturbations. Therefore, it is very important to study the vulnerability of GAN image detectors, which can promote the emergence of more advanced detection methods and reduce the harm caused by detection errors. Summary of the invention
[0003] The purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art, and proposes a GAN image detector avoidance method based on information decoupling and reconstruction. This method can be used to reprocess the images generated by GAN to obtain avoidance images, which can be used to test the performance of the GAN image detector, facilitate the experiments of relevant scientific researchers, and thus improve the security of the artificial intelligence system.
[0004] To achieve the above object, the technical solution provided by the present invention is: a GAN image detector avoidance method based on information decoupling and reconstruction, comprising the following steps:
[0005] 1) Prepare a picture set X' consisting of N real pictures r Divide into multiple batches, each batch X r There are n images. Similarly, a picture set X' consisting of N images generated by GAN g Divide into multiple batches, each batch X g There are n sheets, X' r and X' g The image size specifications in both are the same; then X' g The pictures in the image set are processed by frequency filtering to obtain the picture set It has multiple batches, each batch Own and X g The corresponding n pictures;
[0006] 2) The first stage of model training: a batch X r , X g The images in the image are input into the label-related feature extractor E R , get the corresponding features related to the label Calculate the classification loss L of the label-related featurescls , use L cls To update E R Parameters, The mean μ r and variance σ r , The mean μ g and variance σ g ; Then use the above method to train other batches of pictures;
[0007] 3) Perform the second stage of model training: X r Input the label-related feature extractor E respectively R , label-independent feature extractor E U Get features associated with the label and features not related to labels Similarly, X g Enter E R 、E U Get Features and Using feature discriminator D L The output of , calculates the adversarial loss of the label-irrelevant branch Then and Input AdaIN layer, then use generator G to generate residual image, add the residual image to Get the target image Calculate the image difference L rec ; then Enter E R Get features associated with the label and Calculate the consistency loss L R ; Then use the output of the overall discriminator D to calculate the overall adversarial loss L D ,L G ; Update G and E using the loss of this step R 、E U , D L , the parameters of D; then use the above method to train other batches of pictures;
[0008] 4) Prepare the attack image set T to be processed g , after the same frequency filtering process as in step 1), we get the picture set Load the trained model and convert T g Input the model to obtain the avoidance picture set The images can be used to evade detection by GAN image detectors.
[0009] Further, in step 1), X r , Xg and The composition is expressed as:
[0010]
[0011] In the formula, refers to the i-th image in the real image batch, refers to the i-th image in the batch of images generated by the GAN, It refers to the i-th image in the batch of images after frequency filtering, and n is the total number of images in the batch of images;
[0012] The frequency filtering process is as follows: each picture in the picture set is divided into 8×8 blocks, and then the pixel values of each RGB channel in each block are discrete cosine transformed (DCT) to obtain the frequency coefficient matrix of each channel, whose size is also 8×8. The values in each frequency coefficient matrix are divided by the same 8×8 matrix whose element values increase from the upper left corner to the lower right corner to obtain the filtered frequency coefficient matrix. Finally, the inverse discrete cosine transform (IDCT) and the processed frequency coefficient matrix are used to obtain the picture after frequency filtering.
[0013] Further, in step 2), the label-related features refer to the features that are easy for the GAN image detector to distinguish whether they belong to the real image r category or the GAN image g category;
[0014] Use E R extract The process is described as:
[0015]
[0016] In the formula, The features extracted from the i-th real picture in this batch, The features extracted from the i-th GAN image in this batch;
[0017] Loss function L cls is defined as:
[0018]
[0019] Where y represents the category, that is, y = {r, g}, diff() represents a function that returns -1 if the inputs are of the same category, and outputs +1 otherwise; μ r and σ r represents the mean and covariance of class r in the feature space, μ g and σ g represents the mean and covariance of class g in the feature space, p(r) represents the prior probability of class r, and p(g) represents the prior probability of class g; Represents the i-th feature of the batch under class y; It means The probability density function under class r is consistent with the mean μ r , the variance is σ r The probability density function of the normal distribution is, It means The probability density function under class g is consistent with the mean μ g , the variance is σ g The normal distribution probability density function of ;
[0020] According to the Adam optimization algorithm, minimize the loss L cls To update E R Network weight parameters and updates and the means and variances of the two distributions;
[0021] In step 3), the label-irrelevant features refer to the features that are not easily distinguished by the GAN detector and contain the content structure information of the image;
[0022] Use E R extract The process is the same as above, using E U extract The process is described as:
[0023]
[0024] In the formula, The features extracted from the i-th real picture in this batch, The features extracted from the i-th GAN image in this batch;
[0025] In obtaining Afterwards, calculate the loss The definition is as follows:
[0026]
[0027] In the formula, for each D L The output of is a real value between 0 and 1, indicating the confidence in its decision, where 0 and 1 represent the real image class r and the GAN image class g respectively; || || 1 represents the 1-norm;
[0028] use The AdaIN layer and the generator G generate a residual image, and then obtain the target image, which is expressed as:
[0029]
[0030] In the formula, For the i-th image in the target image set of this batch, the AdaIN layer is a style transfer component used to convert feature distribution; then the difference between the images before and after processing is calculated
[0031] Use E again R ,Will Enter E R ,get The composition is: In the formula, Calculate the consistency loss of the features extracted from the i-th target image in this batch
[0032] Calculate the overall adversarial loss L D ,L G , defined as follows:
[0033]
[0034] Finally, the Adam optimization algorithm is used to minimize the loss and update the parameters of each component to minimize in The loss calculation result is used to update G and E R The parameter λ rec , G , R L rec , L G , L R The weight of in is the loss calculation result, which is used to update E U Parameters, for weights; respectively minimize L D and To update D and D L .
[0035] Further, in step 4), the attack image set T g Refers to the set of pictures that the attacker wants the GAN picture detector to detect incorrectly, which is the original GAN picture that implements the evasion, and consists of m pictures that do not belong to X g GAN generated pictures: In the formula, Refers to the attack image set T g The i-th picture in ;
[0036] Filter by frequency P filter Get the image collection The method is the same as step 1), and its composition is: In the formula, Refers to the picture set The i-th picture in ;
[0037] Avoid Image Gallery Refers to the set of pictures processed by our trained model, which consists of: In the formula, Refers to the circumvention image set The i-th picture in ;
[0038] Load the model trained by steps 2) and 3) and convert T g The picture input model in gets The processing process is as follows:
[0039]
[0040] In the formula, μ r The final real image category label related features obtained after training The mean of .
[0041] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0042] 1. This paper uses the information decoupling method to separate label-related and irrelevant features for the first time in the field of GAN image security, avoiding detection by various types of GAN image detectors and confirming the shortcomings of current detectors.
[0043] 2. Compared with other GAN image detector avoidance methods in scenarios with zero detector information, the present invention improves the avoidance success rate.
[0044] 3. The method of the present invention has extensive research value in computer vision security tasks, strong adaptability, and broad application prospects. DETAILED DESCRIPTION
[0045] The present invention is further described in detail below in conjunction with examples, but the embodiments of the present invention are not limited thereto.
[0046] This embodiment discloses a method for avoiding a GAN image detector based on information decoupling and reconstruction, the details of which are as follows:
[0047] 1) Prepare a picture set X' consisting of N real pictures r Divide into multiple batches, each batch X r There are n images. Similarly, a picture set X' consisting of N images generated by GAN g Divide into multiple batches, each batch X g There are n sheets, X' r and X' gThe image size specifications in both are the same; then X' g The pictures in the image set are processed by frequency filtering to obtain the picture set It has multiple batches, each batch Own and X g The corresponding n pictures;
[0048] 2) The first stage of model training: a batch X r , X g The images in the image are input into the label-related feature extractor E R , get the corresponding features related to the label Calculate the classification loss L of the label-related features cls , use L cls To update E R Parameters, The mean μ r and variance σ r , The mean μ g and variance σ g ; Then use the above method to train other batches of pictures;
[0049] 3) Perform the second stage of model training: X r Input the label-related feature extractor E respectively R , label-independent feature extractor E U Get features associated with the label and features not related to labels Similarly, X g Enter E R 、E U Get Features and Using feature discriminator D L The output of , calculates the adversarial loss of the label-irrelevant branch Then and Input AdaIN layer, then use generator G to generate residual image, add the residual image to Get the target image Calculate the image difference L rec ; then Enter E R Get features associated with the label and Calculate the consistency loss L R ; Then use the output of the overall discriminator D to calculate the overall adversarial loss L D ,L G ; Update G and E using the loss of this step R 、EU , D L , the parameters of D; then use the above method to train other batches of pictures;
[0050] 4) Prepare the attack image set T to be processed g , after the same frequency filtering process as in step 1), we get the picture set Load the trained model and convert T g Input the model to obtain the avoidance picture set The images can be used to evade detection by GAN image detectors.
[0051] In step 1), X r , X g and The composition is expressed as:
[0052]
[0053] In the formula, refers to the i-th image in the real image batch, refers to the i-th image in the batch of images generated by the GAN, It refers to the i-th image in the batch of images after frequency filtering, and n is the total number of images in the batch of images;
[0054] The frequency filtering process is as follows: each picture in the picture set is divided into 8×8 blocks, and then the pixel values of each RGB channel in each block are discrete cosine transformed (DCT) to obtain the frequency coefficient matrix of each channel, whose size is also 8×8. The values in each frequency coefficient matrix are divided by the same 8×8 matrix whose element values increase from the upper left corner to the lower right corner to obtain the filtered frequency coefficient matrix. Finally, the inverse discrete cosine transform (IDCT) and the processed frequency coefficient matrix are used to obtain the picture after frequency filtering.
[0055] For example, the frequency filtering operation is: each picture in the picture set is divided into 8×8 blocks, for example, the pixel values of each channel of a block are:
[0056] R: G: B:
[0057] Then perform discrete cosine transform (DCT) on the pixel value of each RGB channel to obtain the frequency coefficient matrix of each channel:
[0058] R: G: B:
[0059] Divide the values in each frequency coefficient matrix by a filter matrix:
[0060]
[0061] The obtained results are subjected to the inverse discrete cosine transform (IDCT), and then the frequency-filtered blocks are pieced together into the entire image.
[0062] In step 2), the label-related features refer to the features that are easy for the GAN image detector to distinguish whether they belong to the real image r category or the GAN image g category;
[0063] Use E R extract The process is described as:
[0064]
[0065] In the formula, The features extracted from the i-th real picture in this batch, The features extracted from the i-th GAN image in this batch;
[0066] For example, the tag-related extractor E R , which consists of 4 convolutional neural networks and 2 fully connected layers, and outputs a tensor of size 64. R extract The example process is described as follows: Random initialization The mean μ r and variance σ r , The mean μ g and variance σ g n = 16, that is, a batch of 16 pictures consisting of a real picture set X r , GAN image set X consisting of 16 GAN images g The images in the image are input into the label-related feature extractor E R , respectively obtain the corresponding label-related features
[0067] Loss function L cls is defined as:
[0068]
[0069] Where y represents the category, that is, y = {r, g}, diff() represents a function that returns -1 if the inputs are of the same category, and outputs +1 otherwise; μ r and σ r represents the mean and covariance of class r in the feature space, μ g and σ grepresents the mean and covariance of class g in the feature space, p(r) represents the prior probability of class r, and p(g) represents the prior probability of class g; Represents the i-th feature of the batch under class y; It means The probability density function under class r is consistent with the mean σ r , the variance is σ r The probability density function of the normal distribution is, It means The probability density function under class g is consistent with the mean μ g , the variance is σ g The normal distribution probability density function of ;
[0070] According to the Adam optimization algorithm, minimize the loss L cls To update E R Network weight parameters and updates and the means and variances of the two distributions;
[0071] Then, the training of other batches of images is completed in the same manner as above, and step 2) is repeated e1 times, for example, e1=10.
[0072] In step 3), the label-irrelevant features refer to the features that are not easily distinguished by the GAN detector and contain the content structure information of the image;
[0073] Use E R extract The process is the same as above, using E U extract The process is described as:
[0074]
[0075] In the formula, The features extracted from the i-th real picture in this batch, The features extracted from the i-th GAN image in this batch;
[0076] For example, the label-independent extractor E U , which consists of 5 convolutional neural network layers and outputs a tensor of size [64,64,64]. U extract For example, the process is: n = 16, that is, a batch of 16 pictures consisting of a real picture set X r , GAN image set X consisting of 16 GAN images g The images in the image are input into the feature extractor E with irrelevant labels. U , respectively obtain the corresponding features that are not related to the label
[0077] In obtaining Afterwards, calculate the loss The definition is as follows:
[0078]
[0079] In the formula, for each D L The output of is a real value between 0 and 1, indicating the confidence in its decision, where 0 and 1 represent the real image class r and the GAN image class g respectively; ||||1 represents the 1-norm;
[0080] For example, D L It consists of 2 convolutional layers and 1 fully connected layer, and outputs a tensor of size 1. G consists of 2 convolutional layers, 1 upsampling layer, and 2 convolutional layers, and outputs a tensor of size [3, 128, 128]. D consists of 5 convolutional layers and outputs a tensor of size 1.
[0081] use The AdaIN layer and the generator G generate a residual image, and then obtain the target image, which is expressed as:
[0082]
[0083] In the formula, For the i-th image in the target image set of this batch, the AdaIN layer is a style transfer component used to convert feature distribution; then the difference between the images before and after processing is calculated
[0084] Use E again R ,Will Enter E R ,get The composition is: In the formula, Calculate the consistency loss of the features extracted from the i-th target image in this batch
[0085] Calculate the overall adversarial loss L D ,L G , defined as follows:
[0086]
[0087] Finally, the Adam optimization algorithm is used to minimize the loss and update the parameters of each component to minimize in The loss calculation result is used to update G and E R The parameter λrec , G , R L rec , L G , L R The weight of in is the loss calculation result, which is used to update E U Parameters, for weights; respectively minimize L D and To update D and D L For example, setting λ rec =1000,λ G =1,λ R =1, set
[0088] Then, train other batches of images in the same manner as above. Repeat step 3) e1 times, for example, e1=40.
[0089] In step 4), the attack image set T g Refers to the set of pictures that the attacker wants the GAN picture detector to detect incorrectly, which is the original GAN picture that implements the evasion, and consists of m pictures that do not belong to X g GAN generated pictures: In the formula, Refers to the attack image set T g The i-th picture in .
[0090] Filter by frequency P filter Get the image collection The method is the same as step 1), and its composition is: In the formula, Refers to the picture set The i-th picture in .
[0091] Avoid Image Gallery Refers to the set of pictures processed by our trained model, which consists of: In the formula, Refers to the picture set The i-th picture in .
[0092] Load the model trained by steps 2) and 3) and convert T g The picture input model in gets The processing process is as follows:
[0093]
[0094] In the formula, μ rThe final real image category label related features obtained after training The mean of .
[0095] For example, n = 10, that is, prepare 10 attack images generated by GAN and filter them by frequency. filter Get the corresponding 10 frequency-filtered images; load the trained model, input the attack images into the model in sequence, obtain 10 residual images, add these 10 residual images to the frequency-filtered images in sequence, and obtain 10 avoidance images.
[0096] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A GAN image detector avoidance method based on information decoupling and reconstruction, characterized in that: The following steps are involved: 1) Prepare a picture set X' consisting of N real pictures r Divide into multiple batches, each batch X r There are n images. Similarly, a picture set X' consisting of N images generated by GAN g Divide into multiple batches, each batch X g There are n sheets, X' r and X' g The image size specifications in both are the same; then X' g The pictures in the image set are processed by frequency filtering to obtain the picture set It has multiple batches, each batch Own and X g The corresponding n pictures; X r , X g and The composition is expressed as: In the formula, refers to the i-th image in the real image batch, refers to the i-th image in the batch of images generated by GAN, It refers to the i-th image in the batch after frequency filtering, and n is the total number of images in the batch; The frequency filtering process is as follows: each picture in the picture set is cut into 8×8 blocks, and then the pixel values of each RGB channel in each block are subjected to discrete cosine transform DCT to obtain the frequency coefficient matrix of each channel, which is also 8×8 in size. The values in each frequency coefficient matrix are divided by the same 8×8 matrix whose element values increase from the upper left corner to the lower right corner to obtain the filtered frequency coefficient matrix. Finally, the inverse discrete cosine transform IDCT and the processed frequency coefficient matrix are used to obtain the picture after frequency filtering. 2) The first stage of model training: a batch X r , X g The images in the image are input into the label-related feature extractor E R , get the corresponding features related to the label Calculate the classification loss L of the label-related features cls , use L cls To update E R Parameters, The mean μ r and variance σ r , The mean μ g and variance σ g ; Then use the same method to train other batches of pictures; Label-related features refer to features that are easy for the GAN image detector to distinguish whether they belong to the real image r category or the GAN image g category; Use E R extract The process is described as: In the formula, The features extracted from the i-th real picture in this batch, The features extracted from the i-th GAN image in this batch; Loss function L cls is defined as: Where y represents the category, that is, y = {r, g}, diff() represents a function that returns -1 if the inputs are of the same category, and outputs +1 otherwise; μ r and σ r represents the mean and covariance of class r in the feature space, μ g and σ g represents the mean and covariance of class g in the feature space, p(r) represents the prior probability of class r, and p(g) represents the prior probability of class g; Represents the i-th feature of the batch under class y; It means The probability density function under class r is consistent with the mean μ r , the variance is σ r The probability density function of the normal distribution is, It means The probability density function under class g is consistent with the mean μ g , the variance is σ g The normal distribution probability density function of ; According to the Adam optimization algorithm, minimize the loss L cls To update E R Network weight parameters and updates and the means and variances of the two distributions; 3) Perform the second stage of model training: X r Input the label-related feature extractor E respectively R , label-independent feature extractor E U Get features associated with the label and features not related to labels Similarly, X g Enter E R 、E U Get Features and Using feature discriminator D L The output of , calculates the adversarial loss of the label-irrelevant branch Then and Input AdaIN layer, then use generator G to generate residual image, add the residual image to Get the target image Calculate the image difference L rec ; then Enter E R Get features associated with the label and Calculate the consistency loss L R ; Then use the output of the overall discriminator D to calculate the overall adversarial loss L D ,L G ; Update G and E using the loss obtained R 、E U , D L , and the parameters of D; then the same method is used to train other batches of images; Label-irrelevant features refer to features that are not easily distinguished by the GAN detector and contain information about the content structure of the image; Use E R extract The process is the same as above, using E U extract The process is described as: In the formula, The features extracted from the i-th real picture in this batch, The features extracted from the i-th GAN image in this batch; In obtaining Afterwards, calculate the loss The definition is as follows: In the formula, for each D L The output of is a real value between 0 and 1, indicating the confidence in its decision, where 0 and 1 represent the real image class r and the GAN image class g respectively; || || 1 represents the 1-norm; use The AdaIN layer and the generator G generate a residual image, and then obtain the target image, which is expressed as: In the formula, For the i-th image in the target image set of this batch, the AdaIN layer is a style transfer component used to convert feature distribution; then the difference between the images before and after processing is calculated Use E again R ,Will Enter E R ,get The composition is: In the formula, Calculate the consistency loss of the features extracted from the i-th target image in this batch Calculate the overall adversarial loss L D ,L G , defined as follows: Finally, the Adam optimization algorithm is used to minimize the loss and update the parameters of each component to minimize in The loss calculation result is used to update G and E R The parameter λ rec , G , R L rec , L G , L R The weight of in is the loss calculation result, which is used to update E U Parameters, for weights; respectively minimize L D and To update D and D L ; 4) Prepare the attack image set T to be processed g , after the same frequency filtering process as in step 1), we get the picture set Load the trained model and convert T g Input the model to obtain the avoidance picture set The images can be used to evade detection by GAN image detectors; Attack Picture Gallery T g Refers to the set of pictures that the attacker wants the GAN picture detector to detect incorrectly, which is the original GAN picture that implements the evasion, and consists of m pictures that do not belong to X g GAN generated pictures: In the formula, Refers to the attack image set T g The i-th picture in ; Filter by frequency P filter Get the image collection The method is the same as step 1), and its composition is: In the formula, Refers to the picture set The i-th picture in ; Avoid Image Gallery Refers to the set of pictures processed by our trained model, which consists of: In the formula, Refers to the circumvention image set The i-th picture in ; Load the model trained by steps 2) and 3) and convert T g The picture input model in gets The processing process is as follows: In the formula, μ r The final real image category label related features obtained after training The mean of .
Citation Information
Patent Citations
System and method for machine learning architecture for partially-observed multimodal data
CA3081168A1
Attack defense training method based on generative adversarial network
CN111310802A
