Feature extraction antagonistic attack defense method based on channel-level activation suppression
By activating the suppression feature extraction method at the channel level, vulnerable features are extracted and suppressed, which solves the problem of deep learning models being vulnerable to adversarial attacks, and achieves efficient defense effects and classification accuracy improvements.
Patent Information
- Application Number
- CN202411158575.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-12-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Deep learning models are susceptible to adversarial attacks, resulting in mispredictions in fields such as autonomous driving and medical diagnosis. The existing defense methods are time-consuming and reduce the accuracy of normal sample classification.
A feature extraction method based on channel-level activation suppression is adopted. By generating adversarial samples, training feature separators and channel-level activation suppression classifiers, vulnerable features are extracted and their impacts are suppressed, so as to achieve adversarial attack defense and avoid adversarial training.
Accurate defense of adversarial attacks is realized, classification robustness is improved, and the time cost of the defense process and its impact on normal sample classification accuracy is reduced.
Smart Images

Figure CN119091207A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of security technology, and in particular to a feature extraction adversarial attack defense method based on channel-level activation suppression. Background Art
[0002] The development of deep learning has enabled various complex problems to be effectively solved and applied to increasingly important aspects of human life, such as autonomous driving, medical diagnosis, and smart homes. However, researchers have found that the neural networks used in deep learning are very vulnerable to adversarial attacks. Attackers can easily deceive deep learning models by adding specific noise to benign samples, and this is usually not discovered. Attackers use disturbances that are imperceptible to human vision / hearing to make the normally trained model output highly confident erroneous predictions. Such attacks are extremely destructive in areas such as autonomous driving, medical diagnosis, and privacy protection, so research on defense against such attacks is of great significance, especially now that AI has entered the homes of ordinary people.
[0003] Nowadays, the most effective way to defend against adversarial attacks is to conduct adversarial training, that is, to generate adversarial samples first, then add these samples to the training samples, and train the classifier to correctly classify these samples. However, this method faces two major drawbacks: 1. It is time-consuming, and 2. It reduces the classification accuracy of normal samples. To address these two major problems, we propose a decoupled adversarial attack defense method based on channel-level feature extraction for feature extraction and precise defense. By extracting features that are vulnerable to adversarial attacks and performing dimensionality reduction operations on the data, the time-consuming problem can be effectively solved. Secondly, inspired by predecessors, features that are vulnerable to adversarial attacks are also features related to classification (class essential). After extracting the analogy essential features, we suppress channel activation for them, which can effectively solve the problem of low classification accuracy of normal samples. Summary of the invention
[0004] The main purpose of the present invention is to propose a feature extraction adversarial attack defense method based on channel-level activation suppression. Normal samples are used for training in the training phase to directly extract the connection between the normal sample features and the classification algorithm, thereby directly suppressing the disturbance caused by the adversarial attack. Adversarial attack defense can be completed without adversarial training, achieving the effect of precise defense and solving the problems raised by the above technical background.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] A feature extraction adversarial attack defense method based on channel-level activation suppression comprises the following steps:
[0007] S1: Generate adversarial examples;
[0008] S2: Train a feature separator that extracts features that are vulnerable to adversarial attacks;
[0009] S3: Train a channel-level activation suppression classifier that identifies the importance of each channel to a specific class, thereby suppressing the features affected by adversarial attacks from acting on the neural network;
[0010] S4: The input image is decoded by the trained decoder to obtain the potential distribution space;
[0011] S5: Reconstruction is performed through the trained encoder and connected to the auxiliary classifier;
[0012] S6: By calculating the reconstruction loss and classification loss, the features of the image are separated to obtain fragile features and robust features;
[0013] S7: The vulnerable features are classified through training. During the classification process, the features that can suppress the influence of adversarial attacks act on the neural network to achieve the purpose of adversarial attack defense.
[0014] As a preferred solution of the feature extraction adversarial attack defense method based on channel-level activation suppression described in the present invention, wherein: in step S1, the projected gradient descent method PGD is used to generate adversarial samples, and the formula is as follows:
[0015]
[0016] Among them, x is a normal sample, x′ is an adversarial sample, is the spherical projection of x′ and x in the p-norm distance not exceeding ∈, α is the iteration step length, is the gradient direction, [y] is the label corresponding to the normal sample, For the classifier.
[0017] As a preferred solution of the feature extraction adversarial attack defense method based on channel-level activation suppression described in the present invention, wherein: in the step S2, a variable autoencoder VAE and an auxiliary classifier resnet18 are used as a feature extractor G(·), the input X is first decoded by the decoder of the variable autoencoder to obtain the potential distribution space Z of the feature, and then X is reconstructed by the encoder. At this time, the auxiliary classifier is connected, and the auxiliary classifier and the encoder compete for information on X, so that the necessary features of the class flow into the auxiliary classifier, and the redundant features of the class flow into the encoder for X reconstruction. First, use the normal sample x to train G(·) through the following objective function, combined with the target loss L of β-VAE G (φ, θ) and the cross entropy loss L for classification D(ω), the two can effectively compete with each other on the input pixels of x, thereby preventing redundant information from being sent to each other. From the perspective of the information bottleneck, each sets an IB constraint for the information flowing to the other bottleneck, as follows:
[0018]
[0019] in, is a prior on z that facilitates the separation of x, D KL (·||·) measures the posterior q φ (z|x) and the prior q φ The Kullback-Leibler divergence of (z|x) reflects the similarity between the two distributions. G The first term in (φ, θ) is the marginal similarity of the VAE-generated latent distribution space Z, which aims to reconstruct x under the IB constraint based on the Kullback-Leibler divergence. D In (ω), D(xG(x);ω)[y] is the predicted probability of the ground truth class y, β and γ are two hyperparameters. β controls the strength of the representation-disentanglement inside the β-VAE, while γ controls the trade-off between the reconstruction task (via G(x)) and the classification task (via D(xG(x))).
[0020] As a preferred solution of the feature extraction adversarial attack defense method based on channel-level activation suppression described in the present invention, wherein: in the step S3, since the adversarial attack will activate the channels more evenly, a channel activation suppression module CAS is inserted to identify the importance of each channel to a specific class, and a low weight is given to unimportant channels to achieve the effect of suppressing the activation channels caused by the adversarial attack;
[0021] Specifically, first, the output of the last activation layer of an auxiliary classifier Where H, W, and K represent the image height, width, and number of channels, respectively. A global average pooling operation is added after it, as shown in formula (1), to obtain the channel-level activation vector Then the channel-level activation vector It is passed to a fully connected layer FC of an auxiliary classifier for multi-class classification. For class C, the parameters of the auxiliary classifier are
[0022] It is used to identify the importance of each channel to a specific class. By training normal samples, the parameter M is obtained and the original output f l Multiplying with the parameter matrix M, we can obtain the weighted input with channel-level category importance In the training phase, the ground truth label y is used as an indicator to determine the importance of the channel, and the parameter matrix is expressed as In the test phase, since the ground truth labels are not available, we take the predicted class The relevant weight As the channel importance parameter matrix, apply the calculated channel importance matrix to convert the original activation output f l Reweighted to As shown in formula (2):
[0023]
[0024] in, Represents channel-level multiplication, adjusted Will be passed to the next layer through forward propagation;
[0025] The loss function of the channel-level activation suppression classifier is defined as shown in formula (3):
[0026]
[0027]
[0028] Where C is the number of classes, is the predicted score of the classifier in the CAS module, x is the normal sample used for training, is the cross entropy loss defined on the classifier, and β is an adjustable parameter to balance the CAS strength.
[0029] As a preferred solution of the feature extraction adversarial attack defense method based on channel-level activation suppression described in the present invention, wherein: in step S4, the adversarial attack input image x′ obtained by step S1 is decoded by the trained G(·) decoder to obtain the potential distribution space Z.
[0030] As a preferred solution of the feature extraction adversarial attack defense method based on channel-level activation suppression described in the present invention, wherein: in the step S5, the potential distribution space Z is X-reconstructed by the trained G(·) encoder, and the auxiliary classifier D(·) is connected at the same time.
[0031] As a preferred solution of the feature extraction adversarial attack defense method based on channel-level activation suppression described in the present invention, wherein: in step S6, the feature separation of x′ is completed by calculating the reconstruction loss and the classification loss to obtain R(x′) and G(x′).
[0032] As a preferred solution of the feature extraction adversarial attack defense method based on channel-level activation suppression described in the present invention, wherein: in step S7, R(x′) is classified by the trained C(·), and during the classification process, C(·) can suppress the features affected by the adversarial attack from acting on the neural network, thereby achieving the purpose of adversarial attack defense.
[0033] The beneficial effects of the present invention are as follows:
[0034] It consists of a feature extractor and a channel-level activation suppression classifier. The input data X passes through a trained feature extractor G(·), which can decompose the input image x into a part R(X) that only retains the basic information of the classification (i.e., class necessity) and a part that covers all the remaining redundant information (i.e., class redundancy) to G(X). Then a trained channel-level activation suppression classifier is applied to the class necessary information R(X) to suppress channel activation against adversarial attacks during classification. The defense against adversarial attacks is achieved through two steps: feature separation and suppression of channel activation of features vulnerable to adversarial attacks, ultimately improving the classification robustness.
[0035] This feature extraction adversarial attack defense method based on channel-level activation suppression uses normal samples for training in the training phase, directly extracts the connection between normal sample features and classification algorithms, and thus directly suppresses the disturbance caused by adversarial attacks. It can complete adversarial attack defense without adversarial training, achieving the effect of precise defense. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0037] Figure 1 It is a schematic diagram of the process of the present invention;
[0038] Figure 2 It is a schematic diagram of the framework of the present invention.
[0039] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] The present invention provides a feature extraction adversarial attack defense method based on channel-level activation suppression. In the training phase, normal samples are used for training, and the connection between normal sample features and classification algorithms is directly extracted, so that the disturbance caused by adversarial attacks is directly suppressed. The adversarial attack defense can be completed without adversarial training, thereby achieving the effect of precise defense.
[0042] In the present invention, G(·): a feature extractor for feature separation;
[0043] C(·): Auxiliary classifier for suppressing channel activation of features vulnerable to adversarial attacks;
[0044] R(X): the feature information related to classification obtained after the input image x is processed by G(·), that is, the feature information that is vulnerable to adversarial attacks, which can be called vulnerable features;
[0045] G(X): The feature information obtained after the input image x is processed by G(·) and used to reconstruct X (quasi-redundant), that is, the feature information that is not vulnerable to adversarial attacks, which can be called robust features;
[0046] X:X=R(X)+G(X), input image x.
[0047] See also Figure 1-Figure 2 , a feature extraction adversarial attack defense method based on channel-level activation suppression, comprising the following steps:
[0048] S1: Generate adversarial examples;
[0049] We take the projected gradient descent method (PGD), one of the most commonly used adversarial sample generation methods, as an example to generate adversarial samples. Its generation formula is as follows
[0050]
[0051] Among them, x is a normal sample, x′ is an adversarial sample, is the spherical projection of x′ and x in the p-norm distance not exceeding ∈, α is the iteration step length, is the gradient direction, [y] is the label corresponding to the normal sample, For the classifier.
[0052] S2: Train a feature separator G(·) that can extract features that are vulnerable to adversarial attacks;
[0053] We use a variable autoencoder (VAE) with an auxiliary classifier (such as resnet18) as a feature extractor G(·). The input X is first decoded by the VAE decoder to obtain the latent distribution space Z of the features. Then X is reconstructed by the encoder, and the auxiliary classifier is connected at this time. The auxiliary classifier and the encoder compete for information on X so that the necessary features of the class flow into the auxiliary classifier and the redundant features of the class flow into the encoder to reconstruct X. We first use normal samples x to train G(·) with the following objective function, which combines the target loss L of β-VAE G (φ, θ) and the cross entropy loss L for classification D (ω). The two effectively compete with each other on the input pixels of x, thus preventing them from sending redundant information to each other. From the perspective of an information bottleneck, each of them sets an IB constraint on the information flowing to the other bottleneck.
[0054]
[0055] in, is a prior on z that facilitates the separation of x, D KL (·||·) measures the posterior q φ (z|x) and the prior q φ The Kullback-Leibler divergence of (z|x) reflects the similarity between the two distributions. G The first term in (φ, θ) is the marginal similarity of the VAE-generated latent distribution space Z, which aims to reconstruct x under the IB constraint based on the Kullback-Leibler divergence. D (ω), D(xG(x);ω)[y] is the predicted probability of the ground truth class y. β and γ are two hyperparameters, β controls the strength of the representation-disentanglement inside the β-VAE, while γ controls the trade-off between the reconstruction task (via G(x)) and the classification task (via D(xG(x))).
[0056] S3: Train a channel-level activation suppression classifier C(·) that can identify the importance of each channel to a specific class, thereby suppressing the features affected by adversarial attacks from acting on the neural network;
[0057] Research has found that adversarial attacks will activate channels more evenly, so we insert a channel activation suppression module (CAS) to identify the importance of each channel to a specific class and assign low weights to unimportant channels to suppress the activation of channels caused by adversarial attacks.
[0058] Specifically, we first take the output of the last activation layer of a classifier (such as resnet18) (where H, W, and K represent the image height, width, and number of channels, respectively) and then add a global average pooling operation, as shown in Formula 1, to obtain the channel-level activation vector Then the channel-level activation vector Passed to an auxiliary classifier (fully connected layer FC) for multi-class classification. For class C, the parameters of the auxiliary classifier are It is used to identify the importance of each channel to a specific class. By training normal samples, we can obtain the parameter M and convert the original output f l Multiplying with the parameter matrix M, we can obtain the weighted input with channel-level category importance In the training phase, the ground truth label y is used as an indicator to determine the importance of the channel, and the parameter matrix is expressed as In the test phase, since the ground truth labels are not available, we take the predicted class The relevant weight As the channel importance parameter matrix. Apply the calculated channel importance matrix to convert the original activation output f l Reweighted to As shown in Formula 2.
[0059]
[0060] in, Represents channel-level multiplication. The adjusted It will be passed to the next layer through forward propagation.
[0061] We define the loss function of the channel-level activation suppression classifier as shown in Formula 3, where C is the number of classes, is the predicted score of the classifier in the CAS module, and x is the normal sample used for training. Note that is the cross entropy loss defined on the classifier, and β is an adjustable parameter to balance the CAS strength.
[0062]
[0063] S4: The input image x is decoded by the trained decoder of G(·) to obtain the potential distribution space Z;
[0064] The adversarial attack input image x′ obtained by S1 is decoded by the trained decoder of G(·) to obtain the potential distribution space Z.
[0065] S5: Z reconstructs X through the trained encoder of G(·), and connects to the auxiliary classifier D(·);
[0066] S6: By calculating the reconstruction loss and classification loss, the feature separation of x is completed to obtain R(X) and G(X);
[0067] By calculating the reconstruction loss and classification loss, the feature separation of x′ is completed and R(x′) and G(x′) are obtained.
[0068] S7: R(X) is classified by trained C(·). During the classification process, C(·) can suppress the features affected by adversarial attacks from acting on the neural network, thus achieving the purpose of adversarial attack defense.
[0069] R(x′) is classified by the trained C(·). During the classification process, C(·) can suppress the features affected by adversarial attacks from acting on the neural network, thus achieving the purpose of adversarial attack defense.
[0070] The present invention designs a two-stage adversarial attack defense method, which first uses a feature separator to extract features susceptible to adversarial attacks, and then suppresses channel activation of these features, thereby suppressing the effects of adversarial attacks and achieving a precise defense effect.
[0071] The present invention uses normal samples for training in the training stage, with the aim of directly extracting the connection between the normal sample features and the classification algorithm, thereby directly suppressing the disturbance caused by the adversarial attack. The adversarial attack defense can be completed without adversarial training, which is different from the traditional idea.
[0072] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the inventive concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. A feature extraction adversarial attack defense method based on channel-level activation suppression, characterized in that: The steps include: S1: Generate adversarial examples; S2: Train a feature separator that extracts features that are vulnerable to adversarial attacks; S3: Train a channel-level activation suppression classifier that identifies the importance of each channel to a specific class, thereby suppressing the features affected by adversarial attacks from acting on the neural network; S4: The input image is decoded by the trained decoder to obtain the potential distribution space; S5: Reconstruction is performed through the trained encoder and connected to the auxiliary classifier; S6: By calculating the reconstruction loss and classification loss, the features of the image are separated to obtain fragile features and robust features; S7: The vulnerable features are classified through training. During the classification process, the features that can suppress the influence of adversarial attacks act on the neural network to achieve the purpose of adversarial attack defense.
2. The method for defending against adversarial attacks based on feature extraction of channel-level activation suppression according to claim 1, characterized in that: In step S1, the projected gradient descent method PGD is used to generate adversarial samples, and the formula is as follows: Among them, x is a normal sample, x′ is an adversarial sample, is the spherical projection of x′ with a distance no greater than ∈ under the p-norm, α is the iteration step, is the gradient direction, [y] is the label corresponding to the normal sample, For the classifier.
3. The feature extraction adversarial attack defense method based on channel-level activation suppression according to claim 1, characterized in that: In step S2, a variable autoencoder VAE and an auxiliary classifier resnet18 are used as a feature extractor G(·). The input X is first decoded by the decoder of the variable autoencoder to obtain the potential distribution space Z of the feature, and then X is reconstructed by the encoder. At this time, the auxiliary classifier is connected. The auxiliary classifier and the encoder compete for information on X, so that the necessary features of the class flow into the auxiliary classifier, and the redundant features of the class flow into the encoder to reconstruct X. First, G(·) is trained using the normal sample x through the following objective function, combined with the objective of β-VAE Loss L G (φ, θ) and the cross entropy loss L for classification D (ω), the two can effectively compete with each other on the input pixels of x, thereby preventing redundant information from being sent to each other. From the perspective of the information bottleneck, each sets an IB constraint for the information flowing to the other bottleneck, as follows: L D (ω)=-log D(xG(x);ω)[y] in, is a prior on z that facilitates the separation of x, D KL (·||·) measures the posterior q φ (z|x) and the prior q φ The Kullback-Leibler divergence of (z|x) reflects the similarity between the two distributions. G The first term in (φ, θ) is the marginal similarity of the VAE-generated latent distribution space Z, which aims to reconstruct x under the IB constraint based on the Kullback-Leibler divergence. D In (ω), D(xG(x);ω)[y] is the predicted probability of the ground truth class y, β and γ are two hyperparameters. β controls the strength of the representation-disentanglement inside the β-VAE, while γ controls the trade-off between the reconstruction task (via G(x)) and the classification task (via D(xG(x))).
4. The feature extraction adversarial attack defense method based on channel-level activation suppression according to claim 1, characterized in that: In step S3, since adversarial attacks will activate channels more evenly, a channel activation suppression module CAS is inserted to identify the importance of each channel to a specific class, and low weights are assigned to unimportant channels to suppress the activation of channels caused by adversarial attacks; Specifically, first, the output of the last activation layer of an auxiliary classifier Where H, W, and K represent the image height, width, and number of channels, respectively. A global average pooling operation is added after it, as shown in formula (1), to obtain the channel-level activation vector Then the channel-level activation vector It is passed to a fully connected layer FC of an auxiliary classifier for multi-class classification. For class C, the parameters of the auxiliary classifier are It is used to identify the importance of each channel to a specific class. By training normal samples, the parameter M is obtained and the original output f l Multiplying with the parameter matrix M, we can obtain the weighted input with channel-level category importance In the training phase, the ground truth label y is used as an indicator to determine the importance of the channel, and the parameter matrix is expressed as In the test phase, since the ground truth labels are not available, we take the predicted class The relevant weight As the channel importance parameter matrix, apply the calculated channel importance matrix to convert the original activation output f l Reweighted to As shown in formula (2): in, Represents channel-level multiplication, adjusted Will be passed to the next layer through forward propagation; The loss function of the channel-level activation suppression classifier is defined as shown in formula (3): Where C is the number of classes, is the predicted score of the classifier in the CAS module, x is the normal sample used for training, is the cross entropy loss defined on the classifier, and β is an adjustable parameter to balance the CAS strength.
5. The method for defending against adversarial attacks based on feature extraction of channel-level activation suppression according to claim 1, characterized in that: In step S4, the adversarial attack input image x′ obtained in step S1 is decoded by the trained decoder of G(·) to obtain the potential distribution space Z.
6. The feature extraction adversarial attack defense method based on channel-level activation suppression according to claim 1, characterized in that: In step S5, the potential distribution space Z is reconstructed by X through the trained encoder of G(·), and the auxiliary classifier D(·) is connected at the same time.
7. The method for defending against adversarial attacks based on feature extraction of channel-level activation suppression according to claim 1, characterized in that: In step S6, the feature separation of x′ is completed by calculating the reconstruction loss and the classification loss to obtain R(x′) and G(x′).
8. The method for defending against adversarial attacks based on feature extraction of channel-level activation suppression according to claim 1, characterized in that: In step S7, R(x′) is classified by the trained C(·). During the classification process, C(·) can suppress the features affected by adversarial attacks from acting on the neural network, thereby achieving the purpose of defending against adversarial attacks.
