Image sample antagonism elimination method based on GAN and feature difference matrix

By using the method based on GAN and feature difference matrix, a mixed adversarial sample set and a clean image set are constructed, the loss function is designed, and the GAN is trained to maximize feature difference, which solves the problem of poor adversarial sample defense in the existing technology, and achieves high efficiency. Images with strong generalization ability are eliminated against sample.

CN118941893APending Publication Date: 2024-11-12THE QUARTERMASTER RES INST OF THE GENERAL LOGISTICS DEPT OF THE CPLA

Patent Information

Application Number
CN202410996150.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively defend against multiple adversarial sample attacks, model-based defense calculation costs are high, data-based defense is difficult to fully cover the potential space, and the defense effect of unknown attacks is poor, and it is difficult to achieve general and effective defense with a single feature difference.

Method used

Based on the GAN and feature difference matrix, a mixed adversarial sample set and a clean image set are constructed, the generator loss function is designed, and the GAN is trained to maximize the feature difference between adversarial samples and clean images, and to achieve targeted feature extraction and adversarial elimination, which is suitable for multiple A type of attack method and unknown attack scenario.

Benefits of technology

An image adversarial sample elimination method with efficient, strong generalization ability and short training time is realized, which can significantly improve classification accuracy under multiple attacks, reduce training costs, and provide better universal defense effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118941893A_ABST
    Figure CN118941893A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of artificial intelligence security, and particularly relates to an image sample antagonism elimination method based on a GAN and a feature difference matrix, and the method comprises the steps: dynamically constructing a mixed adversarial sample set for common attacks according to a defense scene, and enabling the mixed adversarial sample set and a clean image sample set corresponding to an adversarial sample to jointly form a training data set; designing a generator loss function; designing the architecture and the training mode of the GAN, and balancing the training cost and the defense effect; training the GAN in an adversarial environment; a GAN generator serves as a main tool for implementing antagonism elimination, the classification accuracy of image samples processed by different training rounds of generators on a classification model is compared, and the generator with the highest classification accuracy is selected as a purifier. The defense effect is high, the generalization ability is high, the training time is short, the adversarial disturbance of the input image adversarial sample is eliminated or reduced before the input image adversarial sample enters the deep neural network model, and the aim of defending the adversarial sample attack is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence security technology, and specifically relates to an image sample adversarial elimination method based on GAN and feature difference matrix. Background Art

[0002] Image adversarial samples are samples that can induce deep neural networks to make incorrect predictions after attackers add tiny perturbations to image samples that are difficult for humans to detect. Adversarial sample attacks are an important security issue facing deep neural networks. In the field of images, only small modifications to the original image that are difficult for humans to perceive can cause the model to produce incorrect outputs. In order to defend against adversarial sample attacks, defenders have proposed a variety of defense strategies and continuously improved them against new attack methods. At the same time, attackers continue to design more complex and difficult-to-detect adversarial samples to attack the improved models. There is an ongoing game relationship between adversarial sample attack and defense.

[0003] Existing adversarial sample attack and defense methods are usually targeted at specific models and data sets. Defense methods are usually designed for existing attack methods, and can be roughly divided into model-based defense and data-based defense. Model-based defense is applied to a specific model, so it is usually more effective in defending against a specified range of attack methods on a specific range of data sets, but performs poorly in the face of new, unknown adversarial samples. This type of defense method integrates the defense mechanism into the model during the training phase of the model, without adding additional computational burden in the prediction phase, but may incur high computational costs in the training phase. For example, adversarial training is one of the more effective defense technologies currently available.

[0004] However, its computational cost is high. Many improvements are being made to reduce its computational cost, or to balance model accuracy and robustness, or to improve model generalization. In contrast, data-based defense does not require changing the original model structure or training process, is easier to implement, and is easier to combine with other defense strategies to further improve the overall defense capabilities of the model.

[0005] Data-based defense techniques can be summarized as adversarial sample checking and adversarial elimination. When designing relevant strategies, the ideal situation is to cover all possible perturbations, but the potential space of adversarial samples is very large and difficult to cover comprehensively. In addition, the detection method may mistakenly identify some normal samples as adversarial samples. For methods involving training detectors or purifiers, training these detection or purification modules requires a large number of labeled adversarial samples, which is also costly. Adversarial sample defense technology is often designed for a specific type of attack method, does not have the ability to defend against a wide range of attacks, and is often quickly broken by new attack methods.

[0006] Adversarial elimination is a type of pre-processing defense scheme that aims to eliminate adversarial perturbations before adversarial samples enter the model. It is usually achieved through filtering denoising, feature compression, purification and reconstruction based on generative models, etc. This type of method focuses on the data itself and does not modify the classifier. Therefore, it has a wider range of applicability and can be used in combination with other adversarial sample defense methods to provide multi-level defense to deal with various types of attacks. However, the reason for the existence of adversarial samples is still unclear. Adversarial samples generated by different attack methods and different models show different adversarial characteristics in deep neural network classification models. It is difficult to achieve universal and effective defense by only focusing on feature differences at a single level such as pixel or spectrum differences, and the defense effect against unknown attacks is poor. At present, adversarial elimination methods based on generative models usually use the powerful learning and expression capabilities of generative models such as generative adversarial networks or diffusion models to generate new clean images, which usually requires expensive training costs.

[0007] Generative Adversarial Nets (GAN) is a deep neural network framework that estimates generative models through an adversarial process. It consists of a generator G (Generator, G) and a discriminator D (Discriminator, D). When training GAN, the two models are trained at the same time. The training goal of the generator G is to generate data similar to the distribution of real data, and the training goal of the discriminator D is to distinguish whether the input data is real or fake data generated by the generator.

[0008] In general, the generator G samples from the latent space, uses a random noise z vector as input, and the output is the generated data; the input of the discriminator D is the real data or the data generated by the generator G, and the output is a single prediction, indicating the probability that the input is the real data or the data generated by the generator G. When the parameters of the generator G are fixed, the labels are marked for the real data and the generated data, and then the discriminator D is trained for classification; when the parameters of the discriminator D are fixed, random noise is used to generate fake data, hoping that the discriminator D will judge it as real data, and update the parameters of the generator G through back propagation; the above two steps are performed alternately until the termination condition is met. Summary of the invention

[0009] In order to solve the technical problems existing in the prior art, the present invention proposes an image sample adversarial elimination method based on GAN and feature difference matrix, comprising the following steps:

[0010] Step 1: According to the defense scenario, a mixed adversarial sample set is dynamically constructed for common attacks, and the clean image sample set corresponding to the adversarial sample together constitutes the training data set;

[0011] Step 2: Based on the defense scenario and the adversarial sample feature difference matrix, perform feature difference analysis on the adversarial samples generated by common attacks in the defense scenario and the corresponding clean images, select features and feature difference measurement methods that can maximize the difference between adversarial samples and clean images, and design the generator loss function based on the features and feature difference measurement methods;

[0012] Step 3: Design the architecture and training method of GAN based on the size of common data sets in defense scenarios, and balance the training cost and defense effect;

[0013] Step 4: Train the GAN in an adversarial environment, set the training rounds, and save the generator state of the GAN in each training round;

[0014] Step 5: After GAN training is completed, the GAN generator is used as the main tool for implementing adversarial elimination. Under various attack methods, the defense effects of the generators of different training rounds are comprehensively tested and saved. The classification accuracy of the image samples processed by the generators of different training rounds on the classification model is compared, and the generator with the highest classification accuracy is selected as the purifier.

[0015] Furthermore, in step one, a clean image sample set is constructed in an application scenario. When the attack scenario is known or a common attack method is known in the application scenario, a high-frequency attack method is used to attack and an adversarial sample set corresponding to the clean image samples is generated. The training data set is the clean samples and their corresponding adversarial samples, where the adversarial samples are adversarial samples generated by one attack method or a random mixture of adversarial samples generated by multiple attack methods in equal proportions, so that the GAN learns how to generate clean samples from adversarial samples.

[0016] Furthermore, in step one, when no attack information is available, representative attack methods are selected to construct an adversarial sample set.

[0017] Furthermore, in step one, FGSM attack, PGD attack and DeepFool attack are selected to construct a mixed adversarial sample set for testing.

[0018] Furthermore, in step 2, the adversarial sample feature difference matrix includes four dimensions: data set type, attack method, difference measurement method and feature attribute.

[0019] Furthermore, in step 3, a dataset for training GAN is first constructed. The data in the dataset consists of a mixture of clean images X and adversarial samples generated by various types of attack methods to form an adversarial version X. adv It consists of two parts, with N training data X k ,k=1,…,N, and its adversarial version Use θ GRepresents the parameters of the generator that need to be optimized, It is used to optimize θ G The loss function of , the problem to be solved is expressed as:

[0020]

[0021] The goal of the discriminator is to distinguish the image G(X adv ) and the original clean sample X, θ D is the parameter of the discriminator, θ D and θ G They are optimized simultaneously during the training process, and are considered as a solution to the zero-sum game problem:

[0022]

[0023] x~p data (x) means x is from the real data distribution p data The samples obtained by sampling in (x), X adv ~p G (X adv ) indicates X adv is a sample sampled from the image generated by the generator. During the game, θ D is continuously optimized to improve the discriminator to distinguish the generator generated image G(X adv ) and the original clean image X, while θ G It is also continuously optimized to generate images that are highly similar to X in the extracted feature dimensions.

[0024] In terms of artificial intelligence security, the present invention aims at the problem of adversarial sample attacks and realizes a method for eliminating image adversarial samples with high defense effect, strong generalization ability and short training time. Specifically, based on the generative adversarial network, under the guidance of the adversarial sample feature difference matrix, targeted feature extraction is performed to eliminate the difference between image adversarial samples and clean samples at the feature level, and the adversarial perturbation of the input image adversarial samples is eliminated or reduced before entering the deep neural network model, thereby achieving the purpose of defending against adversarial sample attacks.

[0025] Existing adversarial elimination methods for image samples based on generative models implement adversarial elimination at the pixel level or single feature level, which makes it difficult to achieve targeted defense. Under the guidance of the dynamic adversarial sample feature difference matrix, the present invention designs a feature extraction method to implement targeted defense by targeting the feature dimensions that maximize the difference between adversarial samples and benign samples in specific scenarios.

[0026] Existing adversarial elimination methods for image samples based on generative models utilize the expressive power of the generative model itself or are trained in an adversarial environment constructed by adversarial samples generated by a single attack method. Utilizing the expressive power of the generative model itself has the problem of high training cost. The present invention improves the adversarial training environment, and can use adversarial samples generated by multiple types of attack methods to construct a mixed adversarial sample set, which is then used together with the corresponding clean images to construct a training data set.

[0027] The existing methods of capturing adversarial features at the pixel level or the single feature level to implement adversarial elimination have poor universality and poor defense effect against unknown attacks. Under the guidance of the adversarial sample feature difference matrix constructed by the present invention, a loss function is designed to maximize the feature difference between the generated image and the clean image, thereby achieving a more effective and universal defense effect against unknown attacks.

[0028] The existing generative model-based image sample adversarial elimination method uses a fixed generative model architecture, which has limited performance in scenarios where the image samples are complex and contain a lot of information, and wastes resources in scenarios where the image samples contain simple information. The generative model architecture and training mechanism used in the present invention can be adjusted according to specific scenarios, and a trade-off can be made between defense performance and training cost as needed. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 is a flow chart of the method of the present invention;

[0030] Figure 2 This is the overall framework diagram of the adversarial elimination method;

[0031] Figure 3 Dynamically build module diagrams for training datasets;

[0032] Figure 4 Schematic diagram of the generator status effect for testing and selecting different training rounds;

[0033] Figure 5 It is the element graph of each dimension of the feature difference matrix;

[0034] Figure 6 Screenshot of the running time cost of the present invention;

[0035] Figure 7 This is a screenshot of the same type of representative defense method using 1 / 20 of the training time on a simpler dataset under the same experimental environment. DETAILED DESCRIPTION

[0036] In order to better understand the purpose, technical solution and function of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings, but the present invention can be implemented in a variety of different ways as defined and covered by the claims. The accompanying drawings constituting a part of this application are used to provide a further understanding of the present invention, and the exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention.

[0037] like Figure 1 As shown, the present invention is a GAN-based image sample adversarial elimination method, in which adversarial samples and their corresponding clean samples are used to train GAN in an adversarial environment, wherein the adversarial environment can be constructed by mixing adversarial samples generated by multiple types of attack methods and corresponding clean images, so that GAN can learn adversarial features covering more types of adversarial samples during training. The architecture and training method of GAN can be adjusted according to the complexity of the data set. The feature difference matrix is ​​used to manage and analyze the feature differences between adversarial samples generated by different types of attack methods and corresponding clean images under different feature dimensions and different difference measurement methods, and is used to guide the design of the generator loss function. The generator loss function is composed of two weighted parts, one of which is the adversarial loss of the generative adversarial network, and the other part is under the guidance of the adversarial sample feature difference matrix, dynamically extracting the features of the GAN generated image and the clean image sample, and designing the corresponding loss function based on the measurement method that can maximize the feature of this dimension.

[0038] According to known or unknown specific defense scenarios, the specific training application method of the present invention is set. Under the condition of known defense scenarios (known models and attack methods for a specific range, etc.), a training data set can be specifically constructed, and the feature difference matrix is ​​used to perform feature difference analysis on the specific generated adversarial sample set and the clean sample set, and the feature dimensions used to perform adversarial elimination are compared to train the generative adversarial network, record the training state of the generative adversarial network generator, test the adversarial elimination effect of the generator under each state node, and select the generator with the best effect as the purifier for performing adversarial elimination of image adversarial samples in this application scenario. Under the condition of unknown defense scenarios, using a generative adversarial network trained with a common data set in other similar scenarios can also eliminate or reduce adversarial disturbances.

[0039] Step 1: According to the defense scenario, a mixed adversarial sample set is dynamically constructed for common attacks, and the clean image sample set corresponding to the adversarial sample together constitutes the training data set;

[0040] Step 2: The adversarial sample feature difference matrix contains two main dimensions. One is the features of the adversarial sample and its corresponding clean image in multiple dimensions such as the original input space, feature space, frequency domain angle and distribution statistics. The other is the measurement of feature differences under different distance metrics. According to the defense scenario, relying on the adversarial sample feature difference matrix (based on the data set constructed in the defense scenario and constructed on the designed matrix architecture), the feature difference analysis of the adversarial samples generated by common attacks in the defense scenario and the corresponding clean images is performed. The features and feature difference measurement methods that can maximize the difference between the adversarial sample and the clean image are selected, and the generator loss function is designed based on the features and feature difference measurement methods.

[0041] Step 3: Design the architecture and training method of the Generative Adversarial Network (GAN) based on the size of common data sets in defense scenarios, and balance the training cost and defense effect;

[0042] Step 4: Train the GAN in an adversarial environment, set the training epochs, and save the generator state of the GAN in each training epoch;

[0043] Step 5: GAN training is completed. The generator G of GAN is the main tool for implementing adversarial elimination. Under various attack methods, the defense effects of the generators of different training rounds are comprehensively tested, and the classification accuracy of the image samples processed by the generators of different training rounds on the classification model is compared. The generator with the highest classification accuracy is selected as the purifier.

[0044] As attached Figure 2 As shown, in step 3, the ultimate goal of the present invention is to train a generator G to generate adversarial samples X for a given input adv Estimate its corresponding clean sample X. To achieve this goal, it is necessary to train a complete Generative Adversarial Nets (GAN). First, a dataset for training GAN is constructed. The data in the dataset consists of clean images X and mixed adversarial versions X generated by various types of attack methods. adv Specifically, suppose there are N training data X k ,k=1,…,N and its adversarial version The adversarial version is composed of various types of adversarial samples. G Represents the parameters of the generator that need to be optimized, It is used to optimize θ G The loss function of , the problem to be solved can be expressed as:

[0045]

[0046] The goal of the discriminator D is to distinguish the image G(X adv ) and the original clean sample X, θ D is the parameter of the discriminator, parameter θ D and θ G They are optimized simultaneously during the training process, and the overall problem can be considered as solving the zero-sum game problem:

[0047]

[0048] x~p data (x) means x is from the real data distribution p data The samples obtained by sampling in (x), X adv ~p G (X adv ) indicates X adv is a sample sampled from the image generated by the generator. During the game, θ D The discriminator D is continuously optimized to distinguish the image G(X) generated by the generator G adv ) and the original clean image X, while θ G Being continuously optimized, in X adv Based on this, an image is generated that is highly similar to X (making D indistinguishable) in the extracted feature dimension.

[0049] like Figure 3 As shown, in step one, the training data set consists of two parts: an adversarial sample set and a clean image sample set corresponding to the adversarial sample. The purpose of dynamically constructing a training data set is to implement targeted defense in a known attack scenario. First, a clean image sample set in an application scenario is constructed. When the attack scenario is known or a common attack method is known in the application scenario, a high-frequency attack method is used to attack and generate an adversarial sample set corresponding to the clean image sample. The training data set is a clean sample and its corresponding adversarial sample, wherein the adversarial sample can be an adversarial sample generated by an attack method, or an equal-proportion random mixture of adversarial samples generated by multiple attack methods, so that GAN learns how to generate clean samples from adversarial samples. Different from the method of reconstructing a clean image from random noise using only the expressive power of a generative model, the present invention directly learns to establish a mapping from adversarial samples to clean samples, which greatly reduces the training cost. On the CIFAR-10 data set, only a few dozen epochs are trained to achieve a relatively ideal defense effect.

[0050] like Figure 4As shown, in step 1, when no attack information can be obtained, a representative attack method can be selected to construct an adversarial sample set. The present invention selects Fast Gradient Sign Method (FGSM) attack, Project Gradient Descent (PGD) attack and DeepFool attack to construct a mixed adversarial sample set for testing. The experimental results show that using different attack mechanisms to construct a mixed adversarial sample set can obtain better defense effects than a single type of adversarial sample. In Table 1, the single adversarial sample training set is a training data set constructed using only FGSM attack and clean images, and the mixed adversarial sample training set is a training data set constructed by selecting FGSM attack, PGD attack and DeepFool attack to construct a mixed adversarial sample set and a clean image.

[0051] Table 1 Comparison of defense effects between single adversarial sample set and mixed adversarial sample set

[0052] Attack Methods Sample classification accuracy after attack Single adversarial sample training set Mixed adversarial sample training set FGSM Attack 31.18% 55.52% 62.39% EOT+PGD attack 11.52% 56.15% 63.69% DeepFool Attack 1.06% 57.54% 69.04% C&W Attack 0.00% 57.88% 69.08%

[0053] The effectiveness of attack methods usually varies depending on the model and data. Adversarial samples generated by different types of attack methods often show different characteristics. It is also difficult for attackers and model designers to explain why the model is subject to a certain type of attack, which also makes it difficult for defenders to design a universal and effective defense strategy. Therefore, breaking through the limitation that the reasons for the existence of adversarial samples are difficult to explain and directly focusing on the feature differences between adversarial samples and benign samples will be the key to solving the universality and effectiveness of adversarial elimination methods. Therefore, the present invention designs an expandable adversarial sample feature difference matrix to achieve dynamic management of feature differences of different types of adversarial samples, analyze the feature differences between adversarial samples and benign samples generated by different types of attack methods from multiple dimensions, study the manifestation of adversarial features of image samples, and guide feature extraction for adversarial elimination according to actual application scenarios.

[0054] like Figure 5 As shown, in step 2, the present invention designs an adversarial sample feature difference matrix, which has agility and scalability, and provides a feature analysis and management tool for guiding the feature extraction of adversarial elimination methods. The matrix contains four dimensions: data set type, attack method, difference measurement method, and feature attribute. The matrix data is managed using a data management tool. The present invention tests the use of DataFrame based on the Pandas library to manage data, which is convenient for integration with feature analysis methods.

[0055] The adversarial sample feature difference matrix can perform a variety of query and analysis tasks and display the query results in a two-dimensional table. It has basic statistical functions, such as finding the extreme value of feature difference, and can also be grouped by attack type, difference measurement method or feature attribute for aggregate analysis and comparison. By comparing feature differences in multiple dimensions, it evaluates which difference measurement and which feature attribute can best highlight the feature difference of adversarial samples, guides the training of GAN, and assists in dynamically selecting the best feature extraction method to achieve the best defense effect.

[0056] The present invention provides a defense method for eliminating adversarial image samples. GANs with different architectures have different learning and expression capabilities. Complex model architectures and training methods bring better defense effects but also increase training costs. Different GAN architectures and training methods can be designed according to the image size and complexity of different data sets in specific application scenarios, and a direct trade-off between training costs and defense effects can be made.

[0057] The defense effects of the present invention and the representative adversarial elimination defense methods are compared under the same equipment and threat scenarios. The CIFAR-10 dataset is selected as the data set. The comparison index is the classification accuracy of adversarial samples generated by various attacks. The open source attack platform torchattack is used to perform the attack. The various attack parameters are shown in Table 2:

[0058] Table 2 Test environment attack parameter table of the present invention

[0059]

[0060] The method proposed in the present invention uses adversarial samples constructed by adding only Gaussian noise to construct a training data set to simulate an attack environment where all types of adversarial sample attacks are unknown, and introduces residual modules and attention mechanisms when training GAN. The first three convolutional blocks of the VGG16 model pre-trained by torchvision are used to extract features, and the Manhattan distance is used to measure feature differences. The test results are shown in Table 3:

[0061] Table 3 Comparison of the defensive effects of the present invention and other representative adversarial elimination methods

[0062] Defense methods FGSM EOT+PGD DeepFool C&W JPEG compression 76.68% 76.86% 80.03% 77.40% Spatial Smoothing 65.94% 59.02% 78.39% 68.36% APE-GAN 60.12% 59.14% 61.36% 60.17% The present invention proposes a method 77.38% 77.73% 82.37% 79.65%

[0063] Adversarial training is a widely recognized defense method. Adversarial samples are added to the training data of the model to achieve a defensive effect. The method proposed in the present invention is compared with the most advanced adversarial training method on the adversarial sample robustness benchmark test platform RobustBench. The attack method adopts a powerful adaptive attack AutoAttack to demonstrate the universality of the present invention.

[0064] The RobustBench, a benchmark platform for adversarial sample robustness, provides two lists of adversarial sample attack defenses on the CIFAR-10 dataset, one for AutoAttack (l ∞ =8 / 255) attack and AutoAttack (l2 = 0.5) attack, and provided a WRN-28-10 classification model with a standard training accuracy of 94.78%. The three WRN-28-10 adversarial training models with the best defense performance on each list were selected and loaded into the same experimental environment for testing. The comparison indicators were the classification accuracy of adversarial samples generated by various attacks. The results are shown in Table 4:

[0065] Table 4 Comparison of the defensive effects of the present invention and the most advanced adversarial training method on the open source benchmark test platform

[0066]

[0067] Adversarial training defense methods usually have better defense effects than adversarial elimination defense methods. Test results show that even compared with the most advanced adversarial training methods, the method proposed in this invention still has certain advantages.

[0068] The test results in Table 3 and Table 4 show that the present invention has shown good defense effects in different attack scenarios and has certain universal defense capabilities. During the test, a strict unknown attack scenario was set, and only samples with Gaussian noise added and benign samples were used to train GAN. Compared with other preprocessing-based defense technologies, it has shown significant advantages in a variety of attack scenarios. In addition, in the scenario of known attack scenarios and data sets, a more targeted adversarial elimination strategy can be implemented based on the feature differences between adversarial samples and benign samples to further improve the defense effect.

[0069] The present invention can train a generator with relatively ideal defense effect in fewer training rounds, with low training cost, solving the problem of high training cost of the current method of eliminating adversarial image samples based on generative models. Figure 7 shown.

[0070] The matrix designed by the present invention can perform a variety of query and analysis tasks, and intuitively present the quantitative differences between adversarial samples and benign samples in multiple dimensions.

[0071] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An image sample adversarial elimination method based on GAN and feature difference matrix, characterized in that: The steps include: Step 1: Based on the defense scenario, a mixed adversarial sample set is dynamically constructed for common attacks, and the clean image sample set corresponding to the adversarial sample together constitutes the training data set; Step 2: Based on the defense scenario and the adversarial sample feature difference matrix, perform feature difference analysis on the adversarial samples generated by common attacks in the defense scenario and the corresponding clean images, select features and feature difference measurement methods that can maximize the difference between adversarial samples and clean images, and design the generator loss function based on the features and feature difference measurement methods; Step 3: Design the architecture and training method of GAN based on the size of common data sets in defense scenarios, and balance the training cost and defense effect; Step 4: Train the GAN in an adversarial environment, set the training rounds, and save the generator state of the GAN in each training round; Step 5: After GAN training is completed, the GAN generator is used as the main tool for implementing adversarial elimination. Under various attack methods, the defense effects of the generators of different training rounds are comprehensively tested and saved. The classification accuracy of the image samples processed by the generators of different training rounds on the classification model is compared, and the generator with the highest classification accuracy is selected as the purifier.

2. The method for eliminating adversarial effects of image samples based on GAN and feature difference matrix according to claim 1, characterized in that: In step one, a clean image sample set is constructed in the application scenario. When the attack scenario is known or the common attack method is known in the application scenario, a high-frequency attack method is used to attack and generate an adversarial sample set corresponding to the clean image samples. The training data set is the clean samples and their corresponding adversarial samples, where the adversarial samples are adversarial samples generated by one attack method or a random mixture of adversarial samples generated by multiple attack methods in equal proportions, so that GAN learns how to generate clean samples from adversarial samples.

3. The method for eliminating adversarial effects of image samples based on GAN and feature difference matrix according to claim 1, characterized in that: In step one, when no attack information is available, representative attack methods are selected to construct an adversarial sample set.

4. The method for eliminating adversarial effects of image samples based on GAN and feature difference matrix according to claim 3, characterized in that: In step 1, FGSM attack, PGD attack and DeepFool attack are selected to construct a mixed adversarial sample set for testing.

5. The method for eliminating adversarial effects of image samples based on GAN and feature difference matrix according to claim 1, characterized in that: In step 2, the adversarial sample feature difference matrix includes four dimensions: data set type, attack method, difference measurement method and feature attribute.

6. The method for eliminating adversarial effects of image samples based on GAN and feature difference matrix according to claim 1, characterized in that: In step 3, we first construct a dataset for training GAN. The data in the dataset consists of a mixture of clean images X and adversarial samples generated by various types of attack methods to form an adversarial version X. adv It consists of two parts, with N training data X k ,k=1,…,N, and its adversarial version Use θ G Represents the parameters of the generator that need to be optimized, It is used to optimize θ G The loss function of , the problem to be solved is expressed as: The goal of the discriminator is to distinguish the image G(X adv ) and the original clean sample X, θ D is the parameter of the discriminator, θ D and θ G They are optimized simultaneously during the training process, and are considered as a whole to solve the zero-sum game problem: x~p data (x) means x is from the real data distribution p data The samples obtained by sampling in (x), X adv ~p G (X adv ) indicates X adv is a sample sampled from the image generated by the generator. During the game, θ D is continuously optimized to improve the discriminator to distinguish the generator generated image G(X adv ) and the original clean image X, while θ G It is also continuously optimized to generate images that are highly similar to X in the extracted feature dimensions.

Citation Information

Patent Citations

  • Method and electronic device for training generator model for eliminating countermeasure disturbance

    CN114912571A

  • Detection method for confrontation disturbance ultrasonic image

    CN115409779A

  • Hyperspectral confrontation sample defense method based on invariant feature extraction

    CN116977694A

  • Counter-defense method and device based on image intrinsic Wasserstein distance

    CN117409289A

  • Defense method of deep learning model aiming at adversarial attacks

    US11783037B1

Cited By

  • Self-adaptive confrontation image defense method based on intensity perception and related equipment

    CN121961928A