A method for generating adversarial samples based on a two-layer generative adversarial network

Through the two-layer generation of adversarial networks, and the category labels and hidden layer features are used to generate adversarial samples, the problem of insufficient adversarial sample generation of deep neural network models is solved, and the effectiveness and efficiency of adversarial training and attack tasks are improved.

CN114120028BActive Publication Date: 2024-11-29THE 54TH RESEARCH INSTITUTE OF CHINA ELECTRONICS TECHNOLOGY GROUP CORPORATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111249871.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-26
Publication Date
2024-11-29
Estimated Expiration
2041-10-26

AI Technical Summary

Technical Problem

Deep neural network models are not robust enough when facing adversarial samples, and prior art is difficult to generate enough adversarial samples to achieve adversarial training and attack tasks, especially when generating images of specific categories.

Method used

A two-layer generative adversarial network is adopted. The first layer conditional generative adversarial network generates specific category images through category tag guidance. The second layer generative adversarial network uses hidden layer features to generate adversarial perturbations, and combines the generation of adversarial samples to improve the attack success rate.

Benefits of technology

It significantly improves the attack success rate and efficiency of adversarial training of adversarial samples, can generate specific categories of adversarial samples, and enhances the robustness and generalization capabilities of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114120028B_ABST
    Figure CN114120028B_ABST
Patent Text Reader

Abstract

The present invention proposes an adversarial sample generation method based on a two-layer generative adversarial network, which relates to the field of artificial intelligence security. The method adopts a first-layer conditional generative adversarial network, a feature extractor, a second-layer generative adversarial network and a target network; the conditional generative adversarial network is used to generate new samples, and its discriminator not only distinguishes the authenticity of the generated samples, but also determines their categories; the feature extractor is used to extract the hidden layer features of the original samples and generate disturbances with adversarial priors; the second-layer generative adversarial network is used to generate adversarial disturbances, and the discriminator analyzes the authenticity of the adversarial samples and their similarity with the samples generated by the conditional generative adversarial network; the target network is used to verify the attack success rate of the adversarial samples. The present invention uses two layers of neural networks to generate samples and adversarial disturbances of specific categories respectively, which can achieve the purpose of using adversarial samples of specific categories for attack and adversarial training, and effectively improve the success rate of attacks and the efficiency of adversarial training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence security, and in particular to a method for generating adversarial samples based on a double-layer generative adversarial network. Background Art

[0002] With the rapid development of artificial intelligence technology, especially deep learning, major breakthroughs have been made in image recognition, image classification, natural language processing and other fields. At present, these new technologies have been applied in many engineering fields. While deep learning brings convenience to people, its model algorithm also has huge security risks. Scholars have proposed that experiments have proved that deep convolutional neural networks lack robustness, and attackers can design attack methods based on the characteristics of different models to affect the performance of the model.

[0003] At present, the main attack method faced by deep neural networks is adversarial samples. Adversarial samples refer to perturbed samples obtained by adding perturbations that are imperceptible to the naked eye to the clean input data. The samples will cause the model to output an erroneous result with a high degree of confidence. At present, researchers have proposed a variety of solutions to the vulnerability of deep models. Among them, adversarial training refers to artificially adding adversarial samples during the training phase of the model, allowing the model to learn the characteristics of adversarial samples, thereby improving its robustness and generalization ability. Therefore, it is necessary to generate a large number of adversarial samples according to the training needs of the deep neural network model, and because of the differences between training tasks and attack tasks, generating specific adversarial samples to achieve adversarial training or attack tasks has become a problem that needs to be solved urgently. Summary of the invention

[0004] In order to make up for the shortage of adversarial samples during adversarial training and solve the problem that the generative model cannot generate images of specific categories, the present invention provides an adversarial sample generation method based on a double-layer generative adversarial network. The method generates adversarial samples through a double-layer generative adversarial network. On the one hand, the adversarial prior of the disturbance is improved. On the other hand, the generation of images of specific categories is controlled by a conditional generative network, and then the disturbance generated based on the hidden layer features is added to the image to obtain the adversarial sample.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is:

[0006] A method for generating adversarial samples based on a two-layer generative adversarial network, wherein the two-layer generative adversarial network includes a conditional generative adversarial network of the first layer, a generative adversarial network of the second layer, a feature extractor F and a target network C, wherein the conditional generative adversarial network of the first layer includes a generator G 1 , Discriminator D 1 , the second layer of the generative adversarial network includes the generator G 2 , Discriminator D 2 , where both the generator and the discriminator are MLP multi-layer perceptrons;

[0007] The method comprises the following steps:

[0008] (1) Input the original sample x, random noise z and category label c into the generator G 1 , generator G 1 Fit the random noise z into a new image sample x according to the original sample and category label c ;

[0009] (2) Sample x c Input to the discriminator D 1 , identify its authenticity and category;

[0010] (3) Extract the hidden layer features F(x) of the original sample through the feature extractor F;

[0011] (4) Input the hidden layer features F(x) into the generator G 2 , generate adversarial perturbations G with adversarial priors 2 (F(x));

[0012] (5) Combine the sample xc with the adversarial perturbation G 2 (F(x)) fusion, get the adversarial sample

[0013] (6) Input the adversarial sample into the discriminator D 2 , to identify its authenticity and c similarity;

[0014] (7) Input the adversarial samples into the target network C for classification, verify its attack success rate, and save the adversarial samples with successful attacks.

[0015] Furthermore, the feature extractor F is a VGG model, and the target network C is a ResNet model.

[0016] Furthermore, the loss function of the first layer of the conditional generative adversarial network is:

[0017] L 1 =Ε x logD 1 (x|c)+Ε z log(1-D 1 (G 1 (z|c)))

[0018] Among them, x|c,z|c represents joint input, that is, c is input together with x or z, c is the specified generated category information; E represents data distribution.

[0019] Furthermore, the loss function of the second-layer generative adversarial network is:

[0020]

[0021] in, To ensure that the sample x c With adversarial examples Similarity of L C =Ε x l c (x c +G 2 (F(x)),t) is the loss of the attack target category, where t is the specified attack category, l c is the cross entropy function, which is used to ensure the success rate of adversarial sample attacks; E represents data distribution.

[0022] Compared with the prior art, the present invention has the following beneficial effects:

[0023] 1. The present invention guides the model to generate specific category images through the category c of the conditional generative adversarial network, and then adds disturbances to achieve the attack of specific adversarial samples on the target model.

[0024] 2. The present invention inputs the hidden layer features of the sample when generating perturbations. The hidden layer features obtained by the feature extractor can better characterize the characteristics of the sample. The perturbations generated based on the hidden layer features can increase the adversarial prior, making the classifier more sensitive to such perturbations, so that the adversarial samples with such perturbations added can significantly improve the attack success rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 Flow chart of the adversarial sample generation method in an embodiment of the present invention. DETAILED DESCRIPTION

[0026] The present invention will be further described below in conjunction with the accompanying drawings.

[0027] A method for generating adversarial samples based on a two-layer generative adversarial network. The method uses two generative adversarial networks to generate samples of specific categories and adversarial perturbations respectively. Specifically, the conditional generative adversarial network is used to generate images of specific categories. The traditional generative adversarial network cannot control the generated data. When the input is more than two categories, the generator of the generative adversarial network cannot specify the generation of specific images, and the discriminator only distinguishes the authenticity of the generated images, but does not classify them. This method controls the model to generate specific image categories through a conditional generative adversarial network. By inputting auxiliary information c into the generator, c is the generated category label, which guides the data generation of the generator. The loss function of the conditional generative adversarial network is as follows:

[0028] L 1 =Ε xlogD 1 (x|c)+Ε z log(1-D 1 (G 1 (z|c)))

[0029] Where x is the input sample, c is the category label, and z is the input random noise. 1 When , it is required not only to generate real data, but also to meet the category specified by c, training the generator G 1 When , the guidance of the category label is also needed to generate the specified image.

[0030] The deep neural network classification model includes an input layer, a hidden layer, and an output layer. After the sample is input through the input layer, the feature is extracted through the hidden layer. Different hidden layer neurons correspond to different input layer neurons with different weights and biases. The weights will affect the sensitivity of the neural unit to the input information. For example, the neural unit of the hidden layer forms a recognition pattern bias by controlling the weights. The neural unit of the output layer adjusts the weights of the neural unit of the hidden layer to form a bias in the output result. The output layer outputs the result according to different hidden layer weights and its own bias. The judgment result of the classifier depends on its analysis of the image features, and finally makes a classification decision based on the hidden layer vector. Therefore, when generating adversarial perturbations through generative adversarial networks, it is easier to generate adversarial priors by inputting hidden layer vectors instead of the image itself.

[0031] Input the original sample x into the feature extractor F to obtain the hidden layer feature F(x). Input F(x) into the generator G 2 Generate adversarial perturbations G 2 (F(x)). The generated sample x c Combined with the adversarial perturbation G(F(x)) to obtain the adversarial sample

[0032] After obtaining the adversarial samples, we need to input the adversarial samples into the discriminator D respectively. 2 In order to improve the effectiveness of adversarial samples in the target network C, the entire training process needs to be constrained by a loss function. For the attacker, the adversarial samples need to meet the following requirements: (1) have a high attack success rate after being input into the target network; (2) the perturbations added by the adversarial samples cannot be recognized by the human eye; (3) the similarity between the samples before and after the perturbations is added should be as high as possible.

[0033] In view of the above requirements, this method designs the following loss function:

[0034]

[0035] in, This loss function is the loss function of the second layer of the generative adversarial network, and the generator G is trained by this loss function 2 and the discriminator D 2 , ensuring the effectiveness of generating adversarial samples. To ensure that the sample x c With adversarial examples Similarity of L C =Ε x l c (x c +G 2 (F(x)),t) is the loss of the attack target category, which is used to ensure the success rate of adversarial sample attacks, where l c is the cross entropy, t is the attack category to be specified, if the attack result is t, then the penalty is reduced, otherwise the penalty is increased.

[0036] This method aims to solve the problem of needing specific samples to attack the target network or provide adversarial training. It can generate images of specific categories by adding category restrictions to the conditional generative adversarial network. In addition, when generating adversarial perturbations, in order to increase the classification prior, the hidden layer features of the original samples are extracted through the feature extractor F, and then the hidden layer features are input into the generative adversarial network to generate adversarial perturbations. The adversarial samples generated by the perturbations can better mislead the target classifier and achieve the purpose of attack or adversarial training. Finally, corresponding loss functions are proposed for the attack success rate, the similarity between the adversarial samples and the original samples, and the performance of the constrained two-layer generative adversarial network, to ensure the effectiveness and authenticity of the adversarial samples.

[0037] Here is a more specific example:

[0038] A method for generating adversarial samples based on a two-layer generative adversarial network, such as Figure 1 As shown, the generator G including the first layer of conditional generative adversarial network 1 and the discriminator D 1 , feature extractor F, generator G of the second layer of generative adversarial network 2 and the discriminator D 2 and a target network C. The method comprises the following steps:

[0039] (1) The conditional adversarial generation network generates a specific category sample x based on the category label c c ;

[0040] (2) Sample x c Input to the discriminator D 1 , identify its authenticity and category;

[0041] (3) The feature extractor F extracts the hidden layer features F(x) of the original sample;

[0042] (4) Input the hidden layer features F(x) into the generator G 2 Generate adversarial perturbation G 2 (F(x));

[0043] (5) Sample x c With the adversarial perturbation G 2 (F(x)) is fused to obtain adversarial samples

[0044] (6) Input the adversarial samples into the discriminator D 2 , to identify its authenticity and c similarity;

[0045] (7) Input the adversarial samples into the target network C for classification, verify its attack success rate, and save the adversarial samples with successful attacks.

[0046] In this method, conditional generative adversarial networks are used to generate new samples. Traditional generative adversarial networks can completely approximate real data by sampling data distribution, but this method is too free, so conditional variables are added to constrain it. This method introduces category labels to guide the generative adversarial network to generate images of specific categories. Generator G 1 The input includes the original sample x, noise z and category label c, the generator G 1 According to the original sample and category label, the noise z is gradually fitted to generate a new image sample, the discriminator D 1 Not only to distinguish the generated sample x c The authenticity of the generated sample x also needs to be determined. c Whether it belongs to category c.

[0047] The feature extractor F is used to extract the hidden layer features of the original sample. F uses a convolutional neural network, so each hidden layer network is a layer of image features. As the number of layers increases, the receptive field of the deep convolution kernel will become larger and larger, and it will pay more attention to the global abstract features. These features can help with image classification. Therefore, the hidden layer features can be used to increase the adversarial prior of the disturbance.

[0048] The second layer of the generative adversarial network is used to generate adversarial perturbations, and the hidden layer features extracted by the feature extractor F are input into the generator G. 2 , we can get the adversarial perturbation G with adversarial prior 2 (F(x)), then with G 1 The generated sample x c Fusion to obtain adversarial samples Discriminator D 2 Analyzing adversarial examples The authenticity of and its relationship with x csimilarity.

[0049] The target network is the network attacked by adversarial samples, by Input to the target network so that the target network misclassifies it as class t.

[0050] In summary, the present invention adopts a first-layer conditional generative adversarial network, a feature extractor, a second-layer generative adversarial network and a target network; the conditional generative adversarial network is used to generate new samples, and its discriminator not only distinguishes the authenticity of the generated samples, but also determines their categories; the feature extractor is used to extract the hidden layer features of the original samples and generate disturbances with adversarial priors; the second-layer generative adversarial network is used to generate adversarial disturbances, and the discriminator analyzes the authenticity of the adversarial samples and their similarity with the samples generated by the conditional generative adversarial network; the target network is used to verify the attack success rate of the adversarial samples. The present invention uses two layers of neural networks to generate samples and adversarial disturbances of specific categories respectively, which can achieve the purpose of using adversarial samples of specific categories for attack and adversarial training, effectively improve the success rate of attacks and the efficiency of adversarial training, and has broad application prospects.

Claims

1. A method for generating adversarial samples based on a two-layer generative adversarial network, characterized in that: The two-layer generative adversarial network includes a conditional generative adversarial network of the first layer, a generative adversarial network of the second layer, a feature extractor F and a target network C. The conditional generative adversarial network of the first layer includes a generator G1 and a discriminator D1, and the generative adversarial network of the second layer includes a generator G2 and a discriminator D2, wherein both the generator and the discriminator are MLP multi-layer perceptrons; the feature extractor F is a VGG model, and the target network C is a ResNet model; The loss function of the first layer of the conditional generative adversarial network is: L1=E x log D1(x|c)+E z log(1-D1(G1(z|c))) Among them, x|c, z|c represents joint input, that is, c is inputted together with x or z, c is the category information specified for generation; E represents data distribution; The loss function of the second layer of the generative adversarial network is: in, To ensure that the sample x c With adversarial examples Similarity of L C =E x l c (x c +G2(F(x)), t) is the loss of the attack target category, where t is the specified attack category, l c is the cross entropy function, which is used to ensure the success rate of adversarial sample attacks; E represents data distribution; The method comprises the following steps: (1) The original sample x, random noise z and category label c are input into the generator G1. The generator G1 fits the random noise z into a new image sample x according to the original sample and category label. c ; (2) Sample x c Input to discriminator D1 to identify its authenticity and category; (3) Extract the hidden layer features F(x) of the original sample through the feature extractor F; (4) Input the hidden layer feature F(x) into the generator G2 to generate the adversarial perturbation G2(F(x)) with adversarial prior; (5) Sample x c Fusion with adversarial perturbation G2Fx to obtain adversarial samples (6) Input the adversarial sample into the discriminator D2 to distinguish its authenticity and its similarity to x c similarity; (7) Input the adversarial samples into the target network C for classification, verify its attack success rate, and save the adversarial samples with successful attacks.

Citation Information

Patent Citations

  • A method for human motion recognition base on a generated antagonism network

    CN109190524A

  • Network intrusion detection method and system based on generative adversarial network

    CN113114673A