A method for generating adversarial patches

By generating adversarial patches to reduce the confidence of the target detector, the problem of the target detector being vulnerable to attacks is solved, the effect of camouflaging large targets in the real world is achieved, and the aircraft detection is successfully attacked without affecting other categories of detection. processor, optimizing the size of the adversarial patch to improve attack performance.

CN113792806BActive Publication Date: 2024-08-23CENT SOUTH UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111090742.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-17
Publication Date
2024-08-23
Estimated Expiration
2041-09-17

AI Technical Summary

Technical Problem

Existing target detectors are vulnerable to adversarial sample attacks in remote sensing images, resulting in performance degradation and difficulty in effectively camouflaging large targets such as aircraft and ships. Traditional camouflage nets are inconvenient to produce, and early adversarial sample attack methods are difficult to migrate to the real world.

Method used

Propose a method to generate adversarial patches by reducing the boundingbox confidence in the target detector so that it cannot detect specific targets. The cross-entropy loss function is used to optimize the adversarial patches to adapt to target size changes at different distances and perform directional attacks during directional attacks. It does not affect other categories of detection and uses the patch_noobj method to attack the aircraft detector.

Benefits of technology

It is possible to effectively camouflage important targets without using large camouflage nets. The attack effect is transferable and can successfully prevent target detectors from detecting aircraft. The size of the countermeasure patch has an optimal limit to ensure attack performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113792806B
    Figure CN113792806B
Patent Text Reader

Abstract

The present invention discloses an adversarial patch generation method, which includes the following steps: obtaining a picture with a disguised target from a data set, and randomly initializing the patch; defining a target real frame to which the patch is pasted and other real frames to which the patch is not pasted; scaling the patch at a certain ratio according to targets of different sizes; adding an anchor frame constructed by the patch according to the target real frame to the disguised target; inputting the picture with the adversarial patch pasted into a detection network, calculating the loss and iteratively updating the adversarial patch until the disguised target is not detected by the detection network. The present invention realizes the camouflage of important ground objects, and the adversarial patch makes the entire target undetectable as long as it covers a small part of the directional target; placing the adversarial patch at the center of the directional target, hiding the decision features of the directional target in the target detector, so that the confidence of the predicted frame in the detector is lower than the threshold, thereby misleading the detection result of the detector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of machine learning, and in particular relates to a method for generating adversarial patches. Background Art

[0002] In recent years, deep learning-based target detector technology has played an important role in target detection tasks in remote sensing images. However, although deep learning-based target detector technology has good performance in target detection tasks, studies have found that these target detectors are very sensitive to inputs with a small perturbation added, and are easily disturbed by these perturbations, thereby producing erroneous outputs. These samples with specific perturbations added are called adversarial samples.

[0003] The existence of adversarial samples in target detectors poses a certain threat to the performance of detectors, but it also provides us with a new idea to disguise some important ground objects and evade detection by target detectors, that is, to deceive target detectors and guide them to make wrong decisions, thereby hiding important ground objects.

[0004] In the field of natural images, there have been many studies on attacks on object detectors, and the attack methods are varied, including attacks that generate global perturbations that are invisible to human vision and attacks that generate visually visible adversarial patches.

[0005] Deep learning has achieved great success in the field of computer vision. End-to-end convolutional neural networks, driven by data, have played an important role in various computer vision tasks and improved the results of these tasks. In recent years, with the development of deep learning, deep learning technology in computer vision tasks has been widely used in the field of remote sensing, such as change detection, object classification, and target recognition of remote sensing images, which has greatly improved the processing capabilities of remote sensing images. Among these technologies, the target identifier is an application technology that cannot be ignored in the field of remote sensing. It is widely used in building detection, aircraft detection, ship detection, etc., replacing traditional manual detection and improving the performance of detection. However, the basic module of the target detector is the convolutional neural network. While the convolutional neural network has high expressive power, it also has certain fragility. It is easily attacked by adversarial samples, thereby generating erroneous outputs. This fragility of the convolutional neural network brings certain hidden dangers to the performance of the target detector, making the target detector also vulnerable to adversarial samples.

[0006] The attack of adversarial samples on target detectors exposes the defects of target detectors in model robustness and poses a threat to their application in the field of remote sensing. However, although the existence of adversarial samples in target detectors poses a certain threat, it also provides us with an idea to disguise some important ground objects, that is, to deceive target detectors and guide them to make wrong decisions, thereby hiding these important ground objects.

[0007] The traditional method of camouflaging important ground objects is to hide the objects by placing camouflage nets. This method is indeed effective for small objects, but for large objects (such as aircraft, ships, etc.), camouflaging these objects requires large camouflage nets, which brings certain limitations to the production of camouflage nets. Therefore, in such scenarios, the method of placing camouflage nets is not suitable for use. Therefore, we can start from the target detector itself, take advantage of the defects of the target detector, attack the target detector, and achieve the camouflage of such large targets. In order to use the phenomenon of adversarial samples in the target detector to camouflage important targets, we must first solve how to effectively attack the target detector so that important targets can be successfully camouflaged without using large camouflage nets.

[0008] Many early adversarial attack methods mainly focus on generating a global and human-visually invisible perturbation, and interfere with the prediction results of deep convolutional neural networks by adding this perturbation to normal samples. Although such attack methods can have strong attack capabilities, it is difficult to migrate to the real world for use. Therefore, Brown et al. proposed an adversarial patch method. This type of method replaces the previous method of generating global invisible perturbations, but generates a local, visually visible patch to interfere with the decision of the model. This method can not only achieve effective attack effects in digital space, but also can be well migrated from digital space to the real world. Therefore, in order to enable the attack method of the target detector to be applied to the real world in future work, the present invention mainly studies the attack on remote sensing image target detectors by generating adversarial patches, and replaces the camouflage net with adversarial patches to achieve the camouflage of important targets.

[0009] The adversarial sample phenomenon was first discovered in image classification tasks. Among the current adversarial sample attack methods, the most straightforward attack method is to add a global tiny perturbation that is imperceptible to humans to the image, thereby deceiving the deep neural network and causing it to make incorrect predictions.

[0010] For the attack method of adding global perturbations, they can indeed achieve good attack effects in the digital space. However, for the physical world, such an attack method is unlikely to be realized because we cannot add the generated global adversarial perturbations to the images of the physical world. If we want to deploy adversarial samples in the real world, we can only print the adversarial samples generated in the digital space to deceive the deep neural network model deployed in the real world. Therefore, in order to flexibly deploy adversarial sample attacks in the physical world, some researchers have explored an attack method that generates relatively small and human-visible local adversarial patches. This method only changes some pixels in the image, and can place the generated adversarial patches anywhere in the image, and can have good robustness. Early adversarial sample research mainly focused on adversarial samples of image classifiers in the digital domain. Compared with classifiers, target detectors are more difficult to attack. The recognition process of target detectors is more complicated. In the process of identifying targets, the image information around the target is referenced. In addition, the algorithm usually has multi-scale change operations such as pooling or feature mapping, which is not limited to generating a single prediction, and has stronger adversarial interference capabilities. Attacks on target detectors require not only misleading label predictions, but also misleading target existence predictions. Regarding the adversarial patch attack method on the target detection task, Liu et al. designed the DPatch attack specifically for the target detector. This method mainly adds a patch to the image so that all the real detection boxes in the image are transferred to the patch position, thereby attacking the target detector and making it impossible for the target detector to detect the real target. The adversarial patch generated by DPatch can effectively attack the YOLO and Faster-RCNN detectors. However, DPatch does not restrict the pixel values ​​of the generated patches, and it is possible that the pixel values ​​exceed the valid pixel value range of the image. Thys et al. applied the adversarial patch attack to the target detection task of the human category, made a new design of the loss function, and proposed an adversarial patch generation method for the human category attack. This method uses the maximum confidence value in the bounding box of the target detector as the loss function, and by continuously reducing the confidence value, the confidence value of the human category is finally lower than the threshold, thereby realizing the human category attack. In this method, the patch pasting is different from DPatch. The patch is not placed in the upper left corner, but directly on the target. Summary of the invention

[0011] In the present invention, in order to enable adversarial samples to be actually applied in the physical world, the present invention mainly studies the attack method of generating adversarial patches to attack target detectors, so that target detectors cannot detect specific targets, and realize the attack on target detectors in the remote sensing field. The present invention proposes an attack method patch_noobj for generating a general patch. This method is similar to the Adversarial Patches To Attack Person Detection (yolov2 patch) method. By reducing the confidence of the bounding box in the target detector, the confidence is reduced to zero as much as possible, so that the bounding box containing the target to be attacked is filtered out during detection because the confidence is lower than the threshold. However, the difference is that the yolov2patch method uses the maximum confidence as the objective function for optimization when optimizing the generated patch, while the present invention optimizes all confidences of the targets of the category to be attacked, and optimizes by using cross entropy as the objective function, so that patch_noobj can attack targets of a specific category without affecting the detection of targets of other categories. In addition, because there will be a distance difference when shooting remote sensing images, the targets shot at different distances will have different sizes. Therefore, in order to adapt to the difference in shooting distances, the present invention adjusts the size of the patch according to the size of the target when placing the patch. In the present invention, patch_noobj is mainly used to attack aircraft detectors.

[0012] Specifically, the adversarial patch generation method disclosed in the present invention comprises the following steps:

[0013] Obtain a picture with a disguised target from a data set, and randomly initialize an adversarial patch, wherein the adversarial patch is used to interfere with the disguised target so that the disguised target cannot be detected;

[0014] Define a target real box where the adversarial patch is pasted and other real boxes where the adversarial patch is not pasted in the picture, wherein the target real box is used to construct an anchor box, which locates the pasting position of the adversarial patch in the picture, and the other real boxes are used to calculate the loss and optimize the adversarial patch;

[0015] According to the targets of different sizes, the adversarial patches are scaled in a certain ratio;

[0016] The anchor frame constructed by the adversarial patch based on the target real frame is added to the disguised target in the picture. The adversarial patch is pasted as shown in the following formula:

[0017] x adv =(1-m)⊙x+m⊙p

[0018] Where m represents the location of the constructed anchor box where the adversarial patch is placed, and p represents the adversarial patch;

[0019] The image with the adversarial patch is input into the detection network, and the loss is calculated according to the following formula. The adversarial patch is iteratively updated through the loss calculation until the disguised target in the image is not detected by the detection network:

[0020] Loss = βLoss tv +Loss noobj

[0021] Among them, Loss tv is the total change of the generated adversarial patch, Loss noobj is the loss of the bounding box that does not contain the object, and β is a hyperparameter.

[0022] Furthermore, Loss tv The calculation method is as follows:

[0023]

[0024] Among them, p i,j is the adversarial patch at row i and column j, p i+1,j is the adversarial patch at row i+1 and column j, p i,j+1 is the adversarial patch at the i-th row and j+1-th column.

[0025] Furthermore, Loss noobj The calculation method is as follows:

[0026]

[0027] in, Indicates that if there is no target in the box at i, j, then Otherwise, it is 0, C i is the probability score of the target object in the prediction box, is the true value, λ noobj is the weight value, which indicates the proportion of the confidence error in the loss function when the prediction box does not predict the target.

[0028] Furthermore, when pasting the adversarial patch, all the targets that want to be attacked in an image are pasted with the adversarial patch.

[0029] Furthermore, the width and height of the scaled adversarial patch are calculated as follows:

[0030]

[0031]

[0032] Where patch_size is a predefined reference value, α is the scaling factor, w is the width of the target, and h is the height of the target.

[0033] Furthermore, MAP and recall are used to evaluate the effectiveness of the attack method.

[0034] In order to evaluate the attack method proposed in the present invention, a series of experiments were constructed to evaluate the effectiveness of attacking the yolov3 target detector. The experimental results show that the attack method proposed in the present invention can effectively prevent yolov3 from detecting an aircraft, and the AP of yolov3 when detecting an aircraft is reduced from 0.938 to 0.4431, a decrease of 0.4949. Moreover, in order to better exert the performance of the attack method of the present invention, the size of the adversarial patch is explored, and the size of the adversarial patch with the best attack effect is found. In addition, with the help of visualization, it is explored why the generated adversarial patch can attack the yolov3 target detector to detect an aircraft.

[0035] The beneficial effects of the present invention are as follows:

[0036] 1. Taking advantage of the fact that target detectors are vulnerable to adversarial samples, we propose to replace the traditional camouflage net with adversarial patches to achieve the camouflage of important ground objects. The adversarial patch only needs to cover a small part of the directional target to make the entire target undetectable.

[0037] 2. A new attack method for generating adversarial patches to attack target detectors is proposed. This method places the adversarial patch at the center of the directional target, hiding the decision features of the directional target in the target detector, making the confidence of the bounding box in the detector lower than the threshold, thereby misleading the detection results of the detector.

[0038] 3. The attack effect of the anti-patch of the present invention has the transferability of the detector, can successfully attack the yolov3 target detector, and can target a specific category without affecting the detection of other categories.

[0039] 4. The adversarial patch interferes with the decision features of the target detector, shields important decision features, and causes the detector to focus on a large number of non-decision features, resulting in wrong decisions.

[0040] 5. The present invention reveals that when attacking a target detector, the larger the size of the adversarial patch, the better the attack performance. The size of the adversarial patch has a certain limit. When this limit is exceeded, the larger the size, the weaker the attack performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a framework diagram of the adversarial patch generation method of the present invention;

[0042] Figure 2 Comparison of PR curves of patches generated by the present invention, randomly initialized patches (random), and clean images (clean);

[0043] Figure 3 Comparison of PR curves of OBJ, OBJ-CLS, and CLS in the present invention and adversarial yolov2;

[0044] Figure 4 Comparison of attack performance of adversarial patches of different sizes;

[0045] Figure 5 To visualize the feature extraction of YOLOV3 detector in normal samples;

[0046] Figure 6 Visual analysis of feature extraction of YOLOV3 detector on adversarial samples with adversarial patches attached;

[0047] Figure 7 To visualize the feature extraction of YOLOV3 detector in normal samples using Grad-CAM;

[0048] Figure 8 Visual analysis of feature extraction of the YOLOV3 detector on adversarial samples with adversarial patches attached using Grad-CAM. DETAILED DESCRIPTION

[0049] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. All features disclosed in this specification, or steps in all methods or processes disclosed, except for mutually exclusive features and / or steps, can be combined in any manner.

[0050] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the method of the present invention is further described in detail below in conjunction with actual examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0051] Example

[0052] The present invention is similar to the method of Thys et al. in that the confidence of a specific category is optimized to generate a patch. However, the difference is that the method of Thys et al. uses the maximum confidence of all bounding boxes as the objective function when optimizing the generation of patches. Such an optimization strategy can hardly ensure that the maximum target confidence obtained is the confidence of the category to be targeted. Therefore, in the optimization process, it is possible to optimize the confidence of the bounding box of other categories of targets, thereby affecting the detection results of other categories. The present invention optimizes the confidence of all bounding boxes of the category to be targeted, and optimizes by using cross entropy as the objective function. This ensures that patch_noobj does not affect the detection of other categories of targets while attacking specific categories of targets.

[0053] Yolov3 is a one-stage detection algorithm that reconstructs target detection into a single regression problem, and directly obtains the bounding box coordinates and category probability of the target in one step. It mainly divides the input image into S*S grids, and detects the target in these grids. Each grid is responsible for predicting B bounding boxes and giving the objectness score and class probability of these B bounding boxes. The bounding box is used to indicate where the detected target is. The obj score indicates whether the bbox contains the target. The class prob indicates the probability that the target belongs to each category under the condition that the target exists in the bbox. During the training process of YOLOv3, the objscore of the background class is made zero as much as possible, and the obj score of the real target is made close to 1. During the reasoning process of yolov3, the obj score and classprob are multiplied to get the final score of each bounding box.

[0054] Patch_noobj

[0055] In order to attack the target detector and achieve the camouflage of a specific target, the present invention reduces the obj score of the boxes in the grid containing the real target to make it as close to 0 as possible, thereby filtering the boxes containing the real target to achieve the purpose of attacking the detector and camouflaging the target.

[0056] In yolov3, the obj score reflecting whether a box contains a real target is determined by the optimization of loss_obj. Loss_obj mainly consists of two parts, as shown in formula (1), one part is the loss of the bounding box containing the target (obj), and the other part is the loss of the bounding box that does not contain the target (noobj). Therefore, in our attack method, in order to reduce the obj score and achieve the camouflage of a specific target, the present invention only considers the use of the loss of loss_obj to optimize the generated patch in the process of generating the adversarial patch. In addition, the purpose of the present invention is to camouflage a specific target while not affecting the detection of other categories of targets, so there is no need for the complete loss_obj as an optimization function, and only the loss of the noobj part is used. By reducing the loss of this part, the objscore of the target to be camouflaged can be reduced. At the same time, in order to ensure that the optimizer is more inclined to generate adversarial patches with smooth color transitions and prevent the generation of noisy images, the present invention calculates the total change loss_tv of the generated adversarial patches. The calculation of loss_tv is shown in formula (3), where P represents the adversarial patch. In summary, the optimization objective of the present invention includes two parts, one is loss_noobj and the other is loss_tv. These two parts are combined to form the overall loss function of our attack method, as shown in formula (4), where β is a hyperparameter coefficient.

[0057]

[0058]

[0059]

[0060] Loss = βLoss tv +Loss noobj (4)

[0061] x adv =(1-m)⊙x+m⊙p (5)

[0062] The framework structure of the present invention is as follows Figure 1As shown. First, before the image is input to the detector, we randomly initialize an adversarial patch (patch), and define the target_groundtruth (target real box) of the target to which the patch needs to be pasted and the other_groundtruth (other real box) of the target to which the patch does not need to be pasted. The target_groundtruth is used to construct a mask (anchor box) to locate the pasting position of the patch, and the other_groundtruth is used to calculate the loss and optimize the patch. These two ground truths are similar to the groundtruth (correct annotation) of the boundingbox in the target detector, both in the form of [x, y, w, h], where x and y represent the center coordinates of the target box, and w and h represent the width and height of the target box, respectively. Then, the mask constructed by the patch according to the target_groundtruth is added to the target in the picture that is to be disguised. The patch is pasted as shown in formula (5), where m represents the constructed positions where the patch mask needs to be placed, and p represents the patch. Then the picture with the patch is input to the detection network, and finally the loss is calculated according to formula (4), and the patch is iteratively updated through the loss.

[0063] In the field of remote sensing, both aerial images and satellite images have certain differences from natural images, such as spatial resolution. Therefore, in our attack framework, in order to improve the robustness of the attack, when pasting patches, we do not paste only one patch like some attack methods under natural images to achieve a directional target attack, but instead paste patches on all targets that we want to attack in an image.

[0064] Different sized targets use different sized patches

[0065] The size of the patch is also an important factor in the camouflage of the target. If the patch is too small, it may not be able to achieve the camouflage effect for some large targets. If the patch is too large, for those small targets, the patch may have completely covered the target. In this case, the target can no longer be seen by human vision, and we cannot judge whether the patch has an attack effect. Therefore, in order to make the patch have a substantial attack effect, when pasting the patch, we scale the patch at a certain ratio according to targets of different sizes, so that large targets have large patches and small targets have small patches, while ensuring that the patch does not cover the entire target.

[0066] For patch scaling, we first define a benchmark patch size, such as 30-30, 40-40, and then calculate the ratio of target_groundtruth to the patch of each target to be disguised, and scale the benchmark patch according to this ratio. The width and height of the scaled patch are calculated as shown in equations (6) and (7), where α is a scaling factor.

[0067]

[0068]

[0069] Experimental Results

[0070] Datasets and evaluation metrics

[0071] In the present invention, our experiments are carried out on the DOTA dataset, which contains 2806 aerial images taken from Google Earth and some specific satellites, each of which is about 4000*4000 in size, and contains targets of various scales, directions and shapes. This dataset contains 15 common target categories, such as airplanes, ships, seaports, bridges, etc. In our experiments, because the original images in the DOTA dataset are of different sizes and large in size, they are not suitable for training the yolov3 target detector, so we cut the original images in the dataset, cutting each original image into multiple images of 1024*1024 size, so that all data remain in the same format. After we cut, the original training set changed from 1411 to 8666, and the verification set changed from 459 to 2774. In the present invention, the target category we attack is airplanes, and among the 8666 images of the DOTA data set after we cut them, not every image contains targets of the airplane category, so we select the images containing targets of the airplane category from the 8666 images, and a total of 1718 images are selected. The experiments of the present invention will be based on these 1718 images.

[0072] In order to evaluate the effectiveness of our attack method, we use MAP and recall rate to evaluate it, consistent with the evaluation indicators of attack methods under natural images. At the same time, in order to better illustrate the impact of the attack method on the accuracy and recall of the target detector, we use the PR curve for visualization analysis. The PR curve can better reflect the relationship between accuracy and recall. When the PR curve of a target detector is more convex to the upper right, it means that the effect of this target detector is better. Conversely, for the attack method of the target detector, the more it can make the PR curve of the attacked target detector move to the lower left, it means that this attack method is more effective.

[0073] Experimental setup

[0074] This section first trains the YOLOV3 target detection model on the DOTA dataset cut into a size of 1024*1024. The average map of the model on the 15 categories of the cut DOTA dataset is 0.639. For the category of target aircraft attacked by our invention, the map of the model is 0.919. After that, we applied our attack method patch_noobj and adversarial yolov2 attack method on the trained yolov3 target detector respectively, and compared the attack effects of the two. In order to show the transferability of the patch_noobj attack method, we conducted an exploratory experiment on the transferability of the attack effect. Then, we conducted an exploratory experiment on the attack effects of patches of different sizes. Finally, we explored the reasons why adversarial patches can attack target detectors.

[0075] Fighting against patch attacks

[0076] In this part of the experiment, we first use our attack method patch_noobj to attack the yolov3 target detector and evaluate the performance of this attack method. We use patch_noobj to generate an adversarial patch of size 30*30, paste this adversarial patch on 1718 images and input it into the yolov3 target detector to evaluate the effect of the target detector in detecting aircraft. As a control, we also randomly initialize a patch of the same size to attack the yolov3 target detector. The experimental results are shown in Figure 2 As shown. Figure 2 It can be seen that our method has a good attack effect, both in terms of the position of the PR curve and the value of AP. The PR curve of the adversarial patch generated by our attack method patch_noobj is more biased to the lower left than the PR curve of the clean image, and the adversarial patch generated by patch_noobj can reduce the AP of the yolov3 target detector to detect the aircraft from the best AP (93.8%) on the clean image to 44.3%, a total reduction of 49.5%; while for the randomly initialized noise patch, it can only reduce the detector's AP to 81.2%, a total reduction of 12.6%.

[0077] In addition, the attack method of the present invention has certain similarities with the method of adversarial yolov2 in the optimization strategy of adversarial patches, so we compared the two. In adversarial yolov2, there are three optimization strategies, namely OBJ, OBJ-CLS, and CLS. The goal of OBJ-CLS is to minimize the product of target confidence and category confidence, the goal of OBJ is to minimize target confidence, and in CLS, only category confidence is minimized. We compared the attack effects with these three optimization strategies. Figure 3 The comparison results are shown. Figure 3 It can be seen that among the three methods of adversarial yolov2, OBJ has the best attack effect, which can reduce the AP of yolov3 target detector to 65.1% for detecting aircraft. However, compared with our method, our method has a better attack effect, which can reduce the AP to 44.3%.

[0078] For example, the OBJ method with the best attack performance in adversarial yolov2 optimizes the maximum target confidence in the image during targeted attacks. Such an optimization strategy can hardly ensure that the maximum target confidence obtained is the confidence of the category to be targeted. Therefore, during the optimization process, it is possible to optimize the target confidence of other categories, thereby affecting the detection results of other categories. However, during the optimization process, our method only optimizes the target confidence of the category of targeted attacks, which theoretically should not affect the detection results of other categories. Therefore, in order to explore the impact of our attack method on the detection results of other categories, we conducted a statistical analysis on the detection results of targets of other categories.

[0079] In this part of the experiment, because the number of targets in some other categories is very small among the 1718 images containing the aircraft category, the AP value in the detection results of the yolov3 target detector is very low, so we screened other categories except aircraft and only selected those categories with AP not less than 30% to explore the impact of adversarial patches on them. The experimental results are shown in Table 1. As can be seen from Table 1, the adversarial patches generated by our attack method have the least impact on the detection results of other categories. Under the attack of our method, the YOLOV3 detector can achieve 58.8% AP on other categories, which is only 0.003% lower than the AP under clean images, and only 0.001% lower than the AP under random noise patches, and is better than the AP under the OBJ method, which is 0.003% higher than it.

[0080] Table 1

[0081]

[0082] From the above experiments, we can see that randomly generating a noise patch will also have a certain impact on the detector. Therefore, in order to evaluate our attack method more comprehensively, we explored the attack performance of the adversarial patch generated by our attack method on the black box model. We used the adversarial patch trained on the YOLOV3 detector to attack the two models of yolov5 and faster rcnn to evaluate their detection effects. The experimental results are shown in Table 2. As can be seen from the table, the adversarial patch we trained on yolov3 can attack the black box models yolov5 and faster rcnn, reducing the AP of these two models on the aircraft category to 73.7% and 61.0%, respectively, compared with the clean image, which is 23.5% and 20.5% lower, and compared with the noise patch obtained by random initialization, our adversarial patch is more aggressive to the two black box models.

[0083] Table 2

[0084]

[0085] Attack performance of adversarial patches of different sizes

[0086] The size of the adversarial patch affects the attack performance of target detection. Adversarial patches of different sizes may have different attack performances. Small-sized adversarial patches may have poor attack performance, while large-sized adversarial patches may have good attack performance. However, we do not know what size of adversarial patch can have the best attack performance. Therefore, in this part of the experiment, we explored the impact of adversarial patches of different sizes on the attack performance of the present invention and found the size of the adversarial patch that can have the best attack performance. We explored the attack performance of five different sizes of adversarial patches, and the experimental results are as follows: Figure 4 As shown in Table 3. From the experimental results, we can see that in the overall trend, when the size of the adversarial patch is small, the attack performance is poor, and when the size of the adversarial patch is large, the attack performance is strong. However, by dividing the experimental results in detail, we can see that the adversarial patch has the best attack performance when the size reaches 30*30. When the size is less than 30*30, the attack performance gradually increases with the increase of the size. When the size is greater than 30*30, the attack performance gradually weakens with the increase of the size. This shows that the larger the size of the adversarial patch, the better the attack performance. The size has a certain limit. When the size exceeds this limit, the attack performance will begin to weaken.

[0087] Table 3

[0088]

[0089] How adversarial patches work

[0090] From the above experiments, we can see that the adversarial patches generated by our attack method can effectively attack the YOlov3 detector by reducing the target confidence of the targeted attack category. However, we do not know how the adversarial patches interfere with the YOlov3 detector and reduce the target confidence of the targeted attack category. Therefore, in this experiment, we explored the cause.

[0091] The object detection task is to extract features and scene information about the input image through convolutional neural networks, so as to fuse and reprocess the information between these objects and scenes, and finally achieve the effect of accurate detection of the target. Therefore, we speculate that the adversarial patch can attack the detector and reduce the target confidence of the targeted attack category because it interferes with the feature extraction of the detector and affects the context information in the detector. To verify this conjecture, we use the interpretable algorithm Grad-CAM in the image classification task to perform visual analysis.

[0092] Grad-CAM mainly calculates the importance weights of the features of each channel of the last convolutional layer for the target under the condition of identifying a certain type of target, and then performs weighted summation of the feature map of the last convolutional layer according to the calculated importance weights to obtain a heat map of the activation response value, and then restores this heat map to the original image size through upsampling and merges it with the original image. The calculation formula of the importance weight of Grad-CAM is shown in formula (8). In the formula, Z represents the number of pixels in the feature map, and y c represents the score of the cth category, Represents the activation value at position (i, j) in the kth feature map.

[0093]

[0094] We use Grad-CAM to visualize the feature extraction of the YOLOV3 detector on normal samples and adversarial samples with adversarial patches attached. The experimental results are shown in the figure. Figure 5-Figure 8 As shown in the figure, for clean images, when the detector detects the aircraft, the feature areas it focuses on are basically on the aircraft, and the degree of focus is very high. When the adversarial patch is pasted on the aircraft, for those aircraft that are successfully attacked, some of the feature areas that the detector focuses on are transferred from the aircraft to other locations, and some are still on the aircraft, but the degree of focus is significantly reduced. The experimental results show that the reason why the adversarial patch can attack the detector is that it affects the detector's capture of the aircraft's features, causing the detector to lose the contextual information of the aircraft and eventually be deceived.

[0095] The beneficial effects of the present invention are as follows:

[0096] 1. Taking advantage of the fact that target detectors are vulnerable to adversarial samples, we propose to replace the traditional camouflage net with adversarial patches to achieve the camouflage of important ground objects. The adversarial patch only needs to cover a small part of the directional target to make the entire target undetectable.

[0097] 2. A new attack method for generating adversarial patches to attack target detectors is proposed. This method places the adversarial patch at the center of the directional target, hiding the decision features of the directional target in the target detector, making the confidence of the bounding box in the detector lower than the threshold, thereby misleading the detection results of the detector.

[0098] 3. The attack effect of the anti-patch of the present invention has the transferability of the detector, can successfully attack the yolov3 target detector, and can target a specific category without affecting the detection of other categories.

[0099] 4. The adversarial patch interferes with the decision features of the target detector, shields important decision features, and causes the detector to focus on a large number of non-decision features, resulting in wrong decisions.

[0100] 5. The present invention reveals that when attacking a target detector, the larger the size of the adversarial patch, the better the attack performance. The size of the adversarial patch has a certain limit. When this limit is exceeded, the larger the size, the weaker the attack performance.

[0101] The above-mentioned embodiments only express the specific implementation of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A method for generating an adversarial patch, characterized in that , the method comprises the following steps: Obtaining pictures with disguised targets from a data set, and randomly initializing adversarial patches, wherein the adversarial patches are used to interfere with the disguised targets so that the disguised targets cannot be detected; Define a target real frame where the adversarial patch is pasted and other real frames where the adversarial patch is not pasted in the picture, wherein the target real frame is used to construct an anchor frame, which locates the pasting position of the adversarial patch in the picture, and the other real frames are used to calculate the loss and optimize the adversarial patch; According to the targets of different sizes, the adversarial patches are scaled in a certain ratio; The adversarial patch is added to the camouflaged target in the image based on the anchor frame constructed by the target real frame. The adversarial patch is pasted as shown in the following formula: x adv =(1-m)⊙x+m⊙p Where m represents the location of the constructed anchor box where the adversarial patch is placed, and p represents the adversarial patch; The image with the adversarial patch is input into the detection network, and the loss is calculated according to the following formula. The adversarial patch is iteratively updated through the loss calculation until the disguised target in the image is not detected by the detection network: Loss=γLoss tv +Loss noobj Among them, Loss tv is the total change of the generated adversarial patch, Loss noobj is the loss of the bounding box that does not contain the target, and γ is a hyperparameter; loss tv The calculation method is as follows: Among them, p i,j is the adversarial patch at row i and column j, p i+1,j is the adversarial patch at row i+1 and column j, p i,j+1 is the adversarial patch at row i and column j+1; Loss noobj The calculation method is as follows: in, Indicates that if there is no target in the box at i, j, then Otherwise, 0, C i is the probability score of the target object in the prediction box, is the true value, λ noobj is the weight value, which indicates the proportion of the confidence error in the loss function when the prediction box does not predict the target.

2. The method for generating an adversarial patch according to claim 1, characterized in that ,When pasting adversarial patches, all targets that we want to attack in an image are pasted with adversarial patches.

3. The method for generating an adversarial patch according to claim 1, characterized in that ,The width and height of the scaled adversarial patch are calculated as follows: Where patch_size is a predefined reference value, α is the scaling factor, w is the width of the target, and h is the height of the target.

4. The method for generating an adversarial patch according to claim 1, characterized in that ,MAP and recall are used to evaluate the effectiveness of the attack method.