A target detection attack method and device

Through the GAN-based target detection attack method, combined with confidence loss and regression loss, smooth adversarial noise is generated and optimized, which solves the problems of long target detection adversarial sample generation time and white-box attack limitations in the existing technology, and achieves efficient Adversarial sample generation and attack effects.

CN114330652BActive Publication Date: 2024-10-15HANGZHOU NORMAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111580489.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2024-10-15
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

Existing adversarial sample generation methods for target detection have problems such as long generation time, mainly white-box attacks, and inability to effectively target black-box models, making it difficult to effectively deceive the target detector in actual attacks.

Method used

A GAN-based target detection attack method is used to generate smooth adversarial noise through alternating training of the generator and the discriminator, combined with confidence loss and regression loss, and optimize the noise through two-dimensional convolution kernel Gaussian filtering to make it effective for target detection. Model effective attack.

Benefits of technology

The speed of generating adversarial samples is significantly improved. The generated adversarial samples can effectively deceive the target detection model, and the noise is smoother and difficult to detect by the human eye. The attack effect is better than traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114330652B_ABST
    Figure CN114330652B_ABST
Patent Text Reader

Abstract

The present invention proposes a target detection attack method and device. By converting adversarial samples from traditional optimization mechanisms to generation mechanisms, the time required to generate adversarial samples is greatly shortened. At the same time, after the GAN network is trained, it is no longer necessary to access the inside of the model, and black box attacks can be effectively performed. The proposed method can effectively use the classification and position regression losses output by the target model to effectively guide the training of the network. At the same time, the introduction of feature layer losses can effectively capture the features of the image in high-dimensional space that are more sensitive to the network, and perturbing them can further improve the success rate of the attack. In addition, the added Gaussian filtering module can remove the high-dimensional perturbation of the adversarial sample, leaving the low-dimensional perturbation, and improve the image quality of the generated adversarial sample, and further enhance its attack success rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of deep learning counterattack, and specifically relates to a target detection attack method and device. Background Art

[0002] With the development of software and hardware technology, deep learning technology represented by convolutional neural networks has been widely used in many computer vision tasks, such as image classification, object detection, semantic segmentation, scene text recognition, etc. Although deep learning has achieved great success in these tasks, recent studies have shown that neural networks are vulnerable to adversarial samples. Szegedy et al. first discovered that by adding tiny perturbations that are difficult for humans to perceive to the original samples, the resulting images will make it impossible for neural networks to correctly classify these images. He called these images with specific perturbations "adversarial samples". Adversarial samples involve the issue of deep learning security and have attracted the attention of many scholars at home and abroad. Many adversarial attack methods for image classification have been proposed, such as FGSM, Deepfool, C&W, MI-FGSM, etc. Nowadays, adversarial samples not only appear in image classification tasks, but also some other visual tasks have begun to be attacked by adversarial samples, and object detection is one of them.

[0003] As one of the most core tasks in the field of computer vision, object detection is closely related to many other tasks. For example, object tracking, semantic segmentation and other tasks are all based on object detection technology. At the same time, object detection is widely used in safety-critical scenarios such as industrial control and aerospace, so research on the security of object detection is particularly important. In 2017, Lu et al. first added perturbations to "stop" signs and face images to mislead the Faster R-CNN detector and successfully deceived the detector. Since then, a series of studies have been carried out in the field of object detection. Xie et al. proposed the DAG method to attack Faster R-CNN. They assigned an incorrect label to all the recommended regions extracted by the detector, and then used the gradient optimization strategy to make the detector misclassify these regions. Although attacks on object detection are emerging in an endless stream, most methods inevitably have the following problems: 1) It takes a lot of time to generate adversarial samples. For example, the generation of DPatch requires tens of thousands or even hundreds of thousands of iterations to generate a valid Patch. The method proposed by Darren [here is a document] takes hundreds of seconds of inference time to generate an adversarial sample. 2) Most of them are white-box attacks, which require knowing the parameters of the model. Existing attack methods are often based on gradient optimization strategies. When generating adversarial samples, it is necessary to obtain the parameters of the actual model and optimize the noise through back propagation to obtain adversarial samples. However, in actual attacks, attackers often face black-box models of unknown types and know nothing about their internal parameters. Therefore, it is particularly important to develop a black-box attack method. Summary of the invention

[0004] An object of the present invention is to provide a target detection attack method to address the deficiencies of the prior art.

[0005] The specific steps of the present invention are as follows:

[0006] Step 1: Preprocess the clean original image x;

[0007] Step 2: Input the preprocessed image into the generator G to obtain the adversarial noise G(x); smooth the adversarial noise G(x) through a two-dimensional convolution kernel Gaussian filter, and convert the smoothed adversarial noise x adv Add to the original image x before preprocessing to form an adversarial image

[0008] Step 3: The adversarial image Input into the discriminator D and calculate the GAN loss;

[0009] The GAN loss is as follows:

[0010]

[0011] Where D(x) represents the discrimination result of the original image x; Pictures of confrontation The judgment result of E x Represents the mathematical distribution expectation of x.

[0012] Step 4: The adversarial image Input to the target network to be attacked and calculate the adversarial loss L adv ;

[0013] The adversarial loss includes confidence loss and regression loss;

[0014] Confidence loss is used to classify the region of interest in the image as background; the confidence loss function is as follows:

[0015]

[0016] Where M represents the total number of suggested boxes of the target network to be attacked, l BCE represents the binary cross entropy loss, C i Represents the confidence score of the i-th suggestion box;

[0017] The regression loss is used to interfere with the detected object, making the position of the detection box deviate from the true value. The specific method is to specify a fixed position coefficient (Δx j , Δy j , Δw j , Δh j ), and then calculate the distance between the proposed box position coefficient output by the target network and the manually set target position coefficient. The regression loss function is as follows:

[0018]

[0019] where z j ∈{0,1}, indicating the existence of the object in the jth suggested box, Indicates the position coefficient threshold of the artificially set target; (Δx j , Δy j , Δw j , Δh j ) represents the position coefficient of the j-th suggestion box, where (Δx j , Δy j ) represents the coordinates of the center point of the j-th suggestion box, Δw j , Δh j Indicates the width and height of the jth suggestion box;

[0020] Therefore, the adversarial loss is as follows:

[0021] Ladv =L confidence +μ·L regression (4)

[0022] Where μ is a hyperparameter that balances the confidence loss and the position regression loss.

[0023] Step 5: Calculate the Euclidean distance between the generated adversarial image and the original image to obtain the perturbation loss L perturb ; At the same time, the adversarial image is input into the feature extraction network of the target network to be attacked, and the feature layer loss L is calculated feature .

[0024] Step 6: Calculate the total loss based on the losses obtained in steps 3, 4, and 5, then minimize the total loss through back propagation, update the parameters of the generator and discriminator, and obtain the training weights;

[0025] L all =α / L feature +L GAN +β·L adv +γ·L perturb (5)

[0026] In the formula, α, β, γ are L feature , L adv , L perturb The weight coefficient of .

[0027] Step 7: The generator loads the training weights obtained in step 6 and generates the corresponding adversarial image from the input original image.

[0028] As a preference, the disturbance loss L perturb It is used to limit the size of the noise generated by the generator. The calculation method is as follows:

[0029] L perturb =E x (||G(x)|| 2 ) (6)

[0030] In the formula ||·|| 2 For L 2 Norm, used to limit the size of generated noise.

[0031] Preferably, the characteristic layer loss L feature It means that the generated adversarial image and the original image are sent to the feature extractor, the features of each layer are extracted, and the distance between the two is calculated. The loss function is maximized during training to make the features of the generated adversarial image far away from the features of the original image, thereby further attacking. The feature layer loss function is expressed as formula (7):

[0032]

[0033] Where F represents the total number of feature layers in the feature extractor, f represents the f-th feature layer of the set, and T(L(x,f)) represents the strong normalization of the f-th layer feature map extracted from the original image x.

[0034] Preferably, the generator G comprises seven convolution blocks, a convolution layer and a Tanh activation function in sequence, wherein each convolution block comprises a convolution layer and a LeakyReLU activation function in sequence.

[0035] Preferably, the discriminator comprises a convolution layer, a LeakyReLU activation function, three convolution blocks, a convolution layer and a Sigmoid layer in sequence, wherein each convolution block comprises a convolution layer, a BN layer and a LeakyReLU activation function in sequence.

[0036] Preferably, during the training process, the generator and the discriminator are trained alternately: the discriminator is first trained once and its parameters are updated, and then the generator is trained multiple times to finally update the parameters of the generator.

[0037] Preferably, the two-dimensional convolution kernel Gaussian filtering operation is as shown in formula (9):

[0038] x adv =τ k *G(x) (9)

[0039] In the formula, τ k represents a Gaussian kernel with a kernel size of k; x adv It represents the noise after smoothing by convolving the generated noise with a k*k Gaussian kernel.

[0040] Preferably, the feature extraction network is a backbone network of the target network to be attacked.

[0041] Another object of the present invention is to provide a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the above method is implemented.

[0042] The present invention has the following beneficial effects:

[0043] 1. This paper proposes a GAN-based target detection adversarial attack, which transforms the traditional gradient-based iterative optimization attack method into a generation mechanism to increase the generation speed of adversarial samples and greatly save the computational cost.

[0044] 2. The method proposed in the present invention introduces the confidence loss and position loss of target detection to train the generator, so that the generated adversarial samples can effectively deceive the target detection model; at the same time, in order to solve the shortcoming that the noise of the GAN network training is too obvious, a Gaussian filter is connected to the output end of the generator to filter out the noise with excessive disturbance, so that the generated noise is smoother and not easily perceived by the human eye.

[0045] 3. The method proposed in the present invention is not only much faster than the traditional gradient-based target detection attack method in terms of generation speed, but also has better attack effect on the detector than some traditional methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is a flow chart of the method of the present invention.

[0047] Figure 2 It is the attack effect of the adversarial sample generated in the present invention.

[0048] Figure 3 It is a comparison chart of the results of the method proposed by the present invention and other methods. DETAILED DESCRIPTION

[0049] The present invention is further analyzed below in conjunction with specific embodiments.

[0050] like Figure 1 A target detection attack method comprises the following steps:

[0051] Step 1. The image x used for training in the present invention is all the images of train+val of the public data set VOC2007. Before inputting the image into the generator, the image is first resized to 300*300, and the corresponding label position and size are modified. In addition, the target network FasterR-CNN is trained to a good weight that can be used to detect objects, and participates in the later training and testing, and the feature extraction network VGG16 of Faster R-CNN is used as the feature extractor.

[0052] Step 2: Input the preprocessed image into the generator G to obtain the adversarial noise G(x); smooth the adversarial noise G(x) through a two-dimensional convolution kernel Gaussian filter, and convert the smoothed adversarial noise x adv Add to the original image x before preprocessing to form an adversarial image

[0053] Step 3: The adversarial image Input into the discriminator D and calculate the GAN loss;

[0054] The GAN loss is as shown in formula (10):

[0055]

[0056] Where D(x) represents the discrimination result of the original image x; Pictures of confrontation The judgment result of E x Represents the mathematical distribution expectation of x. For the real sample (i.e. the original image x), we hope that the discriminator’s discriminant result is as close to 1 as possible, so its loss function is logD(x); for the generated adversarial image, we hope that the discriminator’s discriminant result is The closer to 0, the better, so its loss function is

[0057] Step 4: The adversarial image Input it into the target network FasterR-CNN to be attacked and calculate the adversarial loss L adv ;

[0058] The adversarial loss includes confidence loss and regression loss;

[0059] Confidence loss is used to classify the region of interest in the image as background; the confidence loss function is as follows:

[0060]

[0061] Where M represents the total number of suggestion boxes detected by the RPN network. These filtered suggestion boxes are often considered to contain objects. BCE represents the binary cross entropy loss, C i Represents the confidence score of the i-th suggestion box;

[0062] The regression loss is used to interfere with the detected object, so that the position of the detection box deviates from the true value. The specific method is to specify a fixed position coefficient for the suggestion box detected by the target network to be attacked, and then calculate the distance between the suggestion box position coefficient output by the target network and the fixed position coefficient. The regression loss function is as follows:

[0063]

[0064] where z j ∈{0,1},z j =1 means that the jth suggestion box contains an object, otherwise it does not contain an object. Indicates the position coefficient threshold of the artificially set target; (Δx j , Δy j , Δw j , Δh j ) represents the position coefficient of the j-th suggestion box, where (Δx j , Δy j) represents the coordinates of the center point of the j-th suggestion box, Δw j , Δh j Indicates the width and height of the jth suggestion box;

[0065] Therefore, the overall formula of adversarial loss contains two kinds of losses, as shown in formula (13):

[0066] L adv =L confidence +μ·L regression (13)

[0067] Where μ is a hyperparameter that balances the confidence loss and position regression loss, and is empirically set to 0.4.

[0068] Step 5: Calculate the Euclidean distance between the generated adversarial image and the original image to obtain the perturbation loss L perturb ; At the same time, the adversarial image is input into the feature extraction network of the target network to be attacked, and the feature layer loss L is calculated feature .

[0069] Step 6: The losses obtained in steps 3, 4, and 5 are calculated according to formula (14) to obtain the total loss. The total loss is minimized through back propagation, and the parameters of the generator and discriminator are updated to obtain the training weights.

[0070] L all =α / L feature +L GAN +β·L adv +γ·L perturb (14)

[0071] In the formula, α, β, γ are L feature , L adv , L perturb The weight coefficient of .

[0072] Step 7: The generator loads the training weights and generates the corresponding adversarial image from the input original image.

[0073] The disturbance loss L perturb It is used to limit the size of the noise generated by the generator, which is the L of the noise 2 Distance calculation, the calculation method is as follows (15):

[0074] L perturb =E x (||G(x)|| 2 ) (15)

[0075] In the formula ||·|| 2 For L 2 Norm, used to limit the size of generated noise;

[0076] The feature layer loss L feature It means that the generated adversarial image and the original image are sent to the feature extractor, the features of each layer are extracted, and the distance between the two is calculated. The loss function is maximized during training to make the features of the generated adversarial image far away from the features of the original image, thereby further attacking. The feature layer loss function is expressed as formula (16):

[0077]

[0078] Where F represents the total number of feature layers in the feature extractor. In this example, all layers of target feature extraction are selected, f represents the f-th feature layer of the set, and T(L(x,f)) represents the strong normalization of the f-th layer feature map extracted from the original image x.

[0079] The generator G comprises seven convolution blocks, a convolution layer and a Tanh activation function in sequence, wherein each convolution block comprises a convolution layer and a LeakyReLU activation function in sequence.

[0080] The discriminator includes a convolution layer, a LeakyReLU activation function, three convolution blocks, a convolution layer and a Sigmoid layer in sequence. Each convolution block includes a convolution layer, a BN layer and a LeakyReLU activation function in sequence.

[0081] During the training process, the generator and discriminator are trained alternately: the discriminator is first trained once and its parameters are updated, and then the generator is trained multiple times to finally update the generator's parameters.

[0082] The two-dimensional convolution kernel Gaussian filter uses a Gaussian kernel of a certain size to convolve the generated noise to remove high-frequency information. This has two advantages: 1) The generated noise can be smoothed by the Gaussian filter operation, filtering out some protruding noise. The processed noise is then added to the original image x to form an adversarial image It looks much better than the unprocessed one; 2) By removing the high-frequency disturbance and leaving the low-frequency disturbance, the attack performance can be more effectively improved. The Gaussian filter operation is shown in formula (17):

[0083] x adv =τ k *G(x) (17)

[0084] In the formula, τ k represents a Gaussian kernel with a kernel size of k, in this case k is chosen to be 5; x adv It represents the noise after smoothing by convolving the generated noise with a k*k Gaussian kernel.

[0085] The feature extraction network is the backbone network VGG16 of Faster R-CNN, and the weights used by VGG16 are shared with the backbone network of Faster R-CNN. Figure 2 It is the attack effect of the adversarial sample generated in the present invention.

[0086] In order to verify the effectiveness of the present invention, a comparative experiment is conducted on various existing adversarial attack methods for target detection models: DAG, RAP, UEA, etc. The data set used in the experiment is PASCAL VOC 2007. The PASCAL VOC 2007 data set is divided into four major categories: vehicle, household, animal, and person, which can be further divided into 20 small categories on this basis, with a total of 9963 pictures. Each picture has a corresponding XML file, which contains the location and category of the object in the picture. The entire data set consists of three parts: train / val / test. The experiment selects the train+val parts as the training set of GAN, with a total of 5011 pictures, and selects the test part of VOC 2007 as the test set.

[0087] In order to verify the effectiveness of the attack method proposed in this paper, the attack success rate (ASR) is selected as the evaluation index, which represents the change of mAP (meanAverage Presion) before and after the attack. mAP represents the mean of the average precision of all categories and is the most important indicator for measuring the detection effect of the target detector. The ASR calculation method is as shown in formula (18):

[0088]

[0089] In the formula, mAP clean represents the mAP of the target detector before attack, mAP attack is the mAP of the target detector after the attack. The higher the ASR, the stronger the attack.

[0090] In order to measure the time cost of generating adversarial samples by the attack method proposed in the present invention, the entire test set is selected to generate adversarial samples, and the average value is taken as the time cost evaluation index for measuring the attack method.

[0091] In order to measure the noise size of the adversarial samples generated by the attack method proposed in this invention, L 2 Distance is used as an evaluation indicator.

[0092] The experimental results are shown in Table 1. The method of the present invention has the highest attack success rate, reaching 97.8%, which is 10% higher than the attack success rate of the UEA model and 5.75% higher than the second highest DAG model. In terms of generation speed, the method proposed in the present invention and the UEA method based on GAN are both 0.06s, which is much faster than other methods. In terms of generated perturbations, the method proposed in the present invention has a higher L2 distance index of noise than DAG and RAP, because in actual generation, back propagation is not "specially" generated for each image, but the adversarial samples generated by the method of the present invention are lower than UEA in terms of L2 distance index. Figure 3 As shown, the method of the present invention can generate better quality pictures than UEA. In general, the method proposed by the present invention is superior to the existing methods and can effectively attack the target detection task.

[0093] Table 1 Attack results of different methods on FasterR-CNN

[0094]

Claims

1. A target detection attack method, characterized in that The method comprises the following steps: Step 1: Preprocess the clean original image x; Step 2: Input the preprocessed image into the generator G to obtain the adversarial noise G(x); smooth the adversarial noise G(x) through a two-dimensional convolution kernel Gaussian filter, and convert the smoothed adversarial noise x adv Add to the original image x before preprocessing to form an adversarial image Step 3: The adversarial image Input into the discriminator D and calculate the GAN loss; The GAN loss is as follows: Where D(x) represents the discrimination result of the original image x; Pictures of confrontation The judgment result of E x represents the mathematical distribution expectation of x; Step 4: The adversarial image Input to the target network to be attacked and calculate the adversarial loss L adv ; The adversarial loss includes confidence loss and regression loss; The confidence loss is used to classify the region of interest in the image as background; the confidence loss function is as shown in formula (2): Where M represents the total number of suggested boxes of the target network to be attacked, l BCE represents the binary cross entropy loss, C i Represents the confidence score of the i-th suggestion box; The regression loss is used to interfere with the detected object, so that the position of the detection frame deviates from the true value; the regression loss function is as shown in formula (3): where z j ∈{0,1} indicates the existence of the object in the jth proposed box, Indicates the position coefficient threshold of the target; (Δx j , Δy j , Δw j , Δh j ) represents the position coefficient of the j-th suggestion box, where (Δx j , Δy j ) represents the coordinates of the center point of the j-th suggestion box, Δw j , Δh j Indicates the width and height of the jth suggestion box; So the adversarial loss is as follows: L adv =L confidence +μ·L regression (4) Where μ is a hyperparameter that balances confidence loss and position regression loss; Step 5: Calculate the Euclidean distance between the generated adversarial image and the original image to obtain the perturbation loss L perturb ; At the same time, the adversarial image is input into the feature extraction network of the target network to be attacked, and the feature layer loss L is calculated feature ; The disturbance loss L perturb Used to limit the size of the noise generated by the generator, the L2 distance calculation of the noise is: L perturb =E x (||G(x)||2) (5) Where ||·||2 is the L2 norm, which is used to limit the size of the generated noise; The feature layer loss L feature The calculation of is as follows: Where F represents the total number of feature layers in the feature extractor, f represents the f-th feature layer in the set, and T(L(x,f)) represents the strong normalization of the f-th feature map extracted from the original image x; Step 6: Calculate the total loss based on the losses obtained in steps 3, 4, and 5, then minimize the total loss through back propagation, update the parameters of the generator and discriminator, and obtain the training weights; L all =α / L feature +L GAN +β·L adv +γ·L perturb (7) Where α, β, and γ are L feature , L adv , L perturb The weight coefficient of Step 7: The generator loads the training weights obtained in step 6 and generates the corresponding adversarial image from the original image.

2. A target detection attack method according to claim 1, characterized in that: The generator G comprises seven convolution blocks, a convolution layer and a Tanh activation function in sequence, wherein each convolution block comprises a convolution layer and a LeakyReLU activation function.

3. A target detection attack method according to claim 1 or 2, characterized in that: The discriminator includes a convolution layer, a LeakyReLU activation function, three convolution blocks, a convolution layer and a Sigmoid layer in sequence; each convolution block includes a convolution layer, a BN layer and a LeakyReLU activation function in sequence.

4. A target detection attack method according to claim 1, characterized in that: During the training process, the generator and discriminator are trained alternately: the discriminator is first trained once and its parameters are updated, and then the generator is trained multiple times to finally update the generator's parameters.

5. The target detection attack method according to claim 1, characterized in that: The two-dimensional convolution kernel Gaussian filtering operation described in step 2 is shown in formula (9): x adv =t k *G(x) (9) where τ k represents a Gaussian kernel with a kernel size of k; x adv It represents the noise after smoothing by convolving the generated noise with a k*k Gaussian kernel.

6. A target detection attack method according to claim 1, characterized in that: The feature extraction network is the backbone network of the target network to be attacked.

7. A target detection attack method according to claim 6, characterized in that: The target network to be attacked is FasterR-CNN, and the feature extraction network is VGG16.

8. A computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.