A method and device for countering target detection by combining low-frequency information and features
By combining low-frequency information and features, using gradients and Fourier transforms to optimize adversarial samples, the problem of poor transferability of target detection adversarial attack methods in the existing technology is solved, and high attack success rates and good performance on multiple target detection models are achieved. Mobility.
Patent Information
- Application Number
- CN202210579459.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-25
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-05-25
AI Technical Summary
Existing target detection adversarial attack methods have shortcomings in mobility and are difficult to produce high attack success rates for multiple target detection models, resulting in poor or ineffective attack effects.
Combining low-frequency information and features, generate adversarial samples through gradient-based methods, and use two-dimensional discrete Fourier transform to extract low-frequency information, introduce low-frequency adversarial losses, and combine MI-FGSM and Grad-CAM technology to optimize perturbations and improve the migration of adversarial samples. sex.
It improves the transferability and attack performance of adversarial samples, can show high attack success rate and good white-box attack performance on a variety of target detection models, and shows better transferability than other methods.
Smart Images

Figure CN114926708B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of deep learning anti-attack, and specifically relates to a target detection anti-attack method and device combining low-frequency information and features. Background Art
[0002] Target detection is one of the research hotspots in the field of computer vision. It aims to detect and classify targets. Specifically, in a given specific environment, such as a static image or a dynamic video data set, the specific location information of the object of interest in the image or video is extracted under different backgrounds and annotated with a rectangular box, and the category of the object is given. As one of the three major tasks of computer vision, target detection completes the classification and positioning of images. It is the underlying technical support for many other tasks and is directly related to the reasoning performance of other tasks. With the rise of deep learning, due to the strong learning ability and fast reasoning speed of deep learning, the new generation of target detection technology represented by deep learning has overcome the shortcomings of traditional target detection methods such as poor real-time performance, low accuracy, and time-consuming calculation, and has gradually replaced traditional technologies and begun to play an increasingly important role in all walks of life. Nowadays, target detection technology is widely used in industry, military, aerospace, medical and other related scenarios, such as helmet detection systems and circuit defect detection at construction sites in industry; drone reconnaissance and missile guidance in the military. With the widespread application of target detection technology, especially in some safety-critical places, the security of target detection technology becomes extremely important, especially the research on the robustness of target detection technology, which is related to people’s life and property and whether humans can use these technologies with more confidence.
[0003] Despite the rapid development of target detection, recent studies have shown that target detection has security flaws and is easily deceived by adversarial samples. When the detection image is perturbed and then detected again, not only can the objects in the image not be detected correctly, but also objects that do not exist are detected, and the detection results are completely wrong. Imagine how tragic the consequences would be if autonomous driving technology was attacked by adversarial samples. Therefore, it is of great value to study the security and robustness of target detection related models. Research on adversarial samples and adversarial attack methods helps to analyze the potential threats and security vulnerabilities of target detection technology, thereby providing reference for designing safer and more robust target detection models and providing safer protection for the practical application of target detection. Therefore, it is of great significance to study adversarial attack algorithms for target detection. However, in the existing research methods for target detection attacks, due to the wide variety of target detection models and different detection mechanisms and principles of different types, most of the existing adversarial attack methods for target detection have a problem - poor transferability. When adversarial samples generated by attack methods designed for one type of detector attack other types of target detection models, the attack effect often deteriorates, or even loses its aggressiveness, and cannot attack the target detector. Therefore, a new attack method is designed to generally achieve a high attack success rate on a variety of target detectors and achieve high transferability. Summary of the invention
[0004] An object of the present invention is to address the deficiencies of the prior art and provide a target detection counterattack method that combines low-frequency information and features.
[0005] The specific steps of the present invention are as follows:
[0006] Step 1: Generate the initial adversarial sample x for the clean image x through a gradient-based method adv ;
[0007] Step 2: Compare the clean image x and the adversarial sample x adv The low-frequency information is extracted by two-dimensional discrete Fourier transform and converted into a spatial domain image, and then the low-frequency image x separated from the original image is obtained by two-dimensional discrete Fourier inverse transform. low , low frequency images separated by adversarial samples
[0008] Step 3: x low , Input into the target detection model f to be attacked to calculate the clean image and the current adversarial sample x respectively adv The adversarial loss L adv (x,x adv ) and the adversarial loss between the low-frequency information corresponding to the clean image and the low-frequency information corresponding to the current adversarial sample
[0009] Step 4: Add the two adversarial losses obtained in step 3 as the comprehensive loss function, and perform gradient descent through the MI-FGSM method to obtain the corresponding adversarial sample x′ adv ;
[0010] Step 5: For the clean image x, extract the feature area of the image through the gradient-weighted class activation mapping method (Grad-CAM) and generate the attention weight matrix Mask, and then multiply it with the adversarial sample obtained in step 4 to optimize the generated perturbation and obtain a new adversarial sample. The formula is as follows:
[0011]
[0012] Step 6: Use the adversarial sample obtained in step 5 as the new adversarial sample in step 2, and iterate step 2 to step 5 repeatedly. The condition for stopping the iteration is that the number of iterations reaches the threshold T or the infinite norm distance between the generated adversarial sample and the original sample is greater than the set threshold ε. After the iteration stops, the final adversarial sample is output;
[0013] Preferably, the two-dimensional discrete Fourier transform in step 2 is used to extract low-frequency information and convert it into a spatial domain image. The operation process is as follows:
[0014] The operation of performing a two-dimensional Fourier transform on the input image x is recorded as F(x), and the corresponding spectrum graph z is obtained; in the spectrum graph z, the points in the middle are low-frequency, and the points far from the center of the image are high-frequency; set the threshold function as shown in formula (2), draw a circle with r as the hyperparameter radius, and the points inside the circle are divided into low-frequency components z low , the points outside the circle are divided into high-frequency components z high ;
[0015]
[0016] Where d(·) is the distance function, o(i o ,j o ) indicates that the coordinate is i o ,j o The center of the circle, z(i,j) represents the component with coordinates i,j;
[0017] The above operation of separating high and low frequencies on the spectrum z with radius r is simplified to Q(z; r); for the low frequency information z low Perform inverse Fourier transform F -1 (z low ) to obtain the corresponding spatial domain image, which is convenient for the subsequent forward propagation of the neural network;
[0018] As a preferred embodiment, the step 3 of the anti-loss L adv (x,x adv ), The target detection model to be attacked is input as x,x adv or x low , The total loss L adv ;
[0019] The total loss L adv Including confidence loss and feature loss;
[0020] The confidence loss is used to mislead the network into classifying the foreground of the image as the background; the confidence loss function is as shown in formula (3):
[0021]
[0022] In formula (3), M represents the number of qualified suggestion boxes obtained by the Region Proposal Network (RPN). In order to save training time, the IOU of these screened suggestion boxes is greater than 0.5; BCE is the binary cross entropy loss; C i represents the confidence score of the i-th suggestion box, C i ∈[0,1],C i The closer the score is to 0, the more likely it is the background, and vice versa, the more likely it is the foreground area containing the target;
[0023] The feature loss attacks several intermediate feature layers extracted by the feature extraction network G of the target detection model to be attacked, and the operation is as follows:
[0024]
[0025] In the formula, N represents the number of selected intermediate feature layers, f i represents the i-th feature layer of G output with a clean image as input, f i ′ represents the i-th feature layer output by G with the adversarial sample as input; the value range of cosine similarity is [-1,1], the closer to 1, the closer the two compared objects are, and the closer to -1, the less similar the two compared objects are;
[0026] Therefore, the total loss function is shown in formula (5):
[0027] L adv =L confidence +β·L feature (5)
[0028] In the formula, β is the weight coefficient;
[0029] Preferably, the MI-FGSM method described in step 4 is as follows:
[0030]
[0031] x i+1 =x i -α·sign(g i+1 )
[0032] In the formula, g i+1 represents the accumulated gradient momentum after i iterations, μ is the attenuation coefficient, α is the learning rate, It means to take the derivative of the original image x, L(x i ,θ) represents the calculation input of the current adversarial sample x i The loss obtained by entering the model with parameter θ, x i represents the adversarial sample of the current iteration, sign(g i+1 ) represents the gradient momentum g i+1 Take the sign function;
[0033] Each time the gradient is accumulated, the currently calculated gradient is usually normalized and then added to the gradient momentum of this iteration; when generating the adversarial sample of the current stage in each iteration, the clip function needs to be used to clip the pixels;
[0034] Preferably, the process of generating the attention weight matrix of the clean image using Grad-CAM in step 5 mainly includes four steps:
[0035] (1) Use the target detection model to detect the clean image x and obtain the detection result;
[0036] (2) Back-propagate the classification score of each object in the detection results obtained in (1) in turn, calculate the feature map of the RPN network corresponding to the object, and generate a heat map based on the feature map;
[0037] (3) To obtain a heat map with the same shape as x, resample all the heat maps obtained in (2) and then add them together to obtain the complete heat map;
[0038] (4) Normalize the complete heat map obtained in (3) to obtain the attention weight matrix;
[0039] Preferably, the target detection counterattack method combining low-frequency information and key features of an image is characterized in that the target detection model to be attacked is selected as FasterR-CNN, and the feature extraction network G of the target detection model to be attacked is VGG16.
[0040] 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.
[0041] Another object of the present invention is to provide a storage medium storing a target detection counter-attack program combining image low-frequency information and key features, wherein the target detection counter-attack program based on combining image low-frequency information and key features, when executed by a processor, implements the steps of the target detection counter-attack method combining image low-frequency information and key features.
[0042] The present invention has the following beneficial effects:
[0043] 1. This invention proposes a method for target detection adversarial attack that combines low-frequency information and features. In the gradient-based adversarial attack method, the mobility of adversarial samples is enhanced by adding feature map adversarial loss. At the same time, the image information is converted from the spatial domain to the frequency domain through a two-dimensional discrete Fourier transform, low-frequency information is extracted, and low-frequency adversarial loss is introduced to control the perturbation direction of the low-frequency perturbation, thereby further improving the mobility of adversarial samples.
[0044] 2. The method proposed in the present invention obtains the attention weight matrix containing the key features of the image by using the gradient-based class activation mapping technology, and performs dot multiplication with the perturbation matrix obtained by back propagation after optimizing the loss in (1), so as to constrain the range of the perturbation and reduce the generation of redundant perturbations, thereby improving the attack performance of adversarial samples.
[0045] 3. The method proposed in the present invention not only demonstrates good white-box attack performance on Faster R-CNN, but also demonstrates better transferability compared to other attack methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a flow chart of the method of the present invention.
[0047] Figure 2 Fourier transform extracts low frequency information
[0048] Figure 3 It is the attention weight generation flowchart.
[0049] Figure 4 It is a comparison chart of the results of the method proposed by the present invention and other methods. DETAILED DESCRIPTION
[0050] The present invention is further analyzed below in conjunction with specific embodiments.
[0051] like Figure 1 A target detection attack method comprises the following steps:
[0052] Step 1. The picture set used by the present invention to test the performance is all 4952 pictures of the train+val of the public data set VOC2007. The target detection model used to generate is the Faster R-CNN model, which is trained to a good weight that can be used to detect objects, and participates in the later training and testing, and uses the feature extraction network VGG16 of Faster R-CNN as a feature extractor. The models used to test the migration effect are YOLOv3-Darknet53 (denoted as YOLOv3-D), YOLOv3-Mobile-NetV1 (denoted as YOLOv3-M), SSD-300 and SSD512. The input size of Faster R-CNN is 600*600, the input size of YOLOv3-D and YOLOv3-M is 416*416, the input size of SSD300 is 300*300, and the input size of SSD512 is 512*512.
[0053] Step 2: Generate the initial adversarial sample x for the clean image x through a gradient-based method adv ;
[0054] Step 3: Compare the clean image x and the adversarial sample x adv The low-frequency information is extracted by two-dimensional discrete Fourier transform and converted into a spatial domain image, and then the low-frequency image x separated from the original image is obtained by two-dimensional discrete Fourier inverse transform. low , low frequency images separated by adversarial samples The two-dimensional discrete Fourier transform extracts low-frequency information and converts it into a spatial domain image operation process as follows: Figure 2 :
[0055] The operation of performing a two-dimensional Fourier transform on the input image x is recorded as F(x), and the corresponding spectrum graph z is obtained; in the spectrum graph z, the points in the middle are low-frequency, and the points far from the center of the image are high-frequency; set the threshold function as shown in formula (2), draw a circle with r as the hyperparameter radius, and the points inside the circle are divided into low-frequency components z low , the points outside the circle are divided into high-frequency components z high ;
[0056]
[0057]
[0058] Where d(·) is the distance function, o(i o ,j o ) indicates that the coordinate is i o ,j o The center of the circle, z(i,j) represents the component with coordinates i,j;
[0059] The above operation of separating high and low frequencies on the spectrum z with radius r is simplified to Q(z; r); for low frequency information z low Perform inverse Fourier transform F -1 (z low ) to obtain the corresponding spatial domain image, which is convenient for the subsequent forward propagation of the neural network;
[0060] Step 4: x low , Input into the target detection model f to be attacked to calculate the clean image and the current adversarial sample x respectively adv The adversarial loss L adv (x,x adv ) and the adversarial loss between the low-frequency information corresponding to the clean image and the low-frequency information corresponding to the current adversarial sample
[0061] Adversarial loss L adv (x,x adv ), The target detection model to be attacked is input as x,x adv or x low , The total loss L adv ;
[0062] The total loss L adv Including confidence loss and feature loss;
[0063] The confidence loss is used to mislead the network into classifying the foreground of the image as the background; the confidence loss function is as shown in formula (3):
[0064]
[0065] In formula (3), M represents the number of qualified suggestion boxes obtained by the Region Proposal Network (RPN). In order to save training time, the IOU of these screened suggestion boxes is greater than 0.5; lBCE is the binary cross entropy loss; Ci represents the confidence score of the i-th suggestion box, and C i ∈[0,1], the closer the Ci score is to 0, the more likely it is the background, otherwise it is more likely to be the foreground area containing the target;
[0066] The feature loss attacks several intermediate feature layers extracted by the feature extraction network G of the target detection model to be attacked, and the operation is as follows:
[0067]
[0068] In the formula, N represents the number of selected intermediate feature layers, fi represents the i-th feature layer of G output with a clean image as input, f i ′ represents the i-th feature layer output by G with the adversarial sample as input; the value range of cosine similarity is [-1,1]. The closer to 1, the closer the two comparison objects are, and the closer to -1, the less similar the two comparison objects are. In this example, the feature map selects two feature layers of VGG16, namely Cov3-3 and Cov4-3.
[0069] Therefore, the total loss function is shown in formula (5):
[0070] L adv =L confidence +β·L feature (5)
[0071] Where β is the weight coefficient, and in this example β = 10.
[0072] Step 5: Add the two adversarial losses obtained in step 4 as the comprehensive loss function, and perform gradient descent through the MI-FGSM method to obtain the corresponding adversarial sample x′ adv ;
[0073] MI-FGSM method, the formula is as follows:
[0074]
[0075] x i+1 =x i -α·sign(g i+1 )
[0076] In the formula, g i+1 represents the accumulated gradient momentum after i iterations, μ is the attenuation coefficient, α is the learning rate, It means to take the derivative of the original image x, L(x i ,θ) represents the calculation input of the current adversarial sample x i The loss obtained by entering the model with parameter θ, x i represents the adversarial sample of the current iteration, sign(g i+1 ) represents the gradient momentum g i+1 Take the sign function. In this example, the decay coefficient μ = 0.9 and the learning rate α = 0.05.
[0077] Each time the gradient is accumulated, the currently calculated gradient is usually normalized and then added to the gradient momentum of this iteration; when generating the adversarial sample of the current stage in each iteration, the clip function needs to be used to clip the pixels;
[0078] Step 6: Figure 3The clean image x is extracted through the gradient-weighted class activation mapping method (Grad-CAM) to generate the attention weight matrix Mask, which is then multiplied by the adversarial sample obtained in step 4 to optimize the generated perturbation and obtain a new adversarial sample. The formula is as follows:
[0079]
[0080] Grad-CAM generates the attention weight matrix for clean images in four steps:
[0081] (1) Use the target detection model to detect the clean image x and obtain the detection result;
[0082] (2) Back-propagate the classification score of each object in the detection results obtained in (1) in turn, calculate the feature map of the RPN network corresponding to the object, and generate a heat map based on the feature map;
[0083] (3) To obtain a heat map with the same shape as x, resample all the heat maps obtained in (2) and then add them together to obtain the complete heat map;
[0084] (4) Normalize the complete heat map obtained in (3) to obtain the attention weight matrix;
[0085] Step 7: Use the adversarial sample obtained in step 5 as the new adversarial sample in step 2, and iterate step 2 to step 5 repeatedly. The iteration stops when the number of iterations reaches 15 or the infinite norm distance between the generated adversarial sample and the original sample is greater than the set threshold of 25. After the iteration stops, the final adversarial sample is output;
[0086] To verify the effectiveness of the present invention, a variety of existing adversarial attack methods for target detection models, such as DAG, RAP, UEA and TOG, are compared in experiments. The data set used in the experiment is the PASCAL VOC 2007 data set, and the training set used includes 5011 images in 20 categories, and the test set is 4952 images.
[0087] In order to verify the effectiveness of the attack method proposed in this paper, mAP is used as the performance evaluation standard for measuring the target detection model, the attack success rate ASR is used as the evaluation index for measuring the attack method, and the transfer rate (TransferRate, TR) is introduced as the evaluation standard for measuring the transferability of the model, as shown in formula (11):
[0088]
[0089] The calculation of ASR is shown in formula (12):
[0090]
[0091] 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.
[0092] The ratio of the attack success rate of the attack method on the black box model and the white box model is used to measure the transferability of different methods.
[0093] The experimental results are shown in Table 1 and Figure 4 As shown. The attack migration rate of the method of the present invention on each model is the highest compared with other methods. From the two evaluation criteria of ASR and TR, the methods proposed in the present invention are the best. In addition, it can be seen that the black-box attack performance of the three methods DAG, RAP, and TOG is poor, and they are basically unable to attack single-stage detectors across models. Due to the feature loss used by UEA, the generated adversarial samples can attack other models to a certain extent, but the attack success rate is still poor, basically not exceeding 50%, and its white-box attack success rate is only 87.68, which is lower than other attack methods. When the method proposed in the present invention attacks other models, ASR even exceeds 60%. In summary, the method proposed in this chapter has great advantages in improving the transferability of adversarial samples.
[0094] Table 1 Comparison of aggressiveness and migration performance of different methods
[0095]
Claims
1. The target detection counterattack method combining low-frequency information and key features of the image is characterized by The method comprises the following steps: Step 1: Generate the initial adversarial sample x for the clean image x through a gradient-based method adv ; Step 2: Compare the clean image x and the adversarial sample x adv The low-frequency information is extracted by two-dimensional discrete Fourier transform and converted into a spatial domain image, and then the low-frequency image x separated from the original image is obtained by two-dimensional discrete Fourier inverse transform. low , low frequency images separated by adversarial samples Step 3: x low , Input into the target detection model f to be attacked to calculate the clean image and the current adversarial sample x respectively adv The adversarial loss L adv (x,x adv ) and the adversarial loss between the low-frequency information corresponding to the clean image and the low-frequency information corresponding to the current adversarial sample Step 4: Add the two adversarial losses obtained in step 3 as the comprehensive loss function, and perform gradient descent through the MI-FGSM method to obtain the corresponding adversarial sample x′ adv ; Step 5: For the clean image x, use the gradient-based class activation mapping method Grad-CAM to extract the feature area of the image and generate the attention weight matrix Mask. Then, multiply the attention weight matrix Mask with the adversarial sample obtained in step 4 to optimize the generated perturbation and obtain a new adversarial sample. Step 6: Take the adversarial sample obtained in step 5 As the adversarial sample in step 2, repeat steps 2 to 5. The condition for stopping the iteration is that the number of iterations reaches the threshold T or the infinite norm distance between the generated adversarial sample and the original sample is greater than the set threshold ε. After the iteration stops, the final adversarial sample is output.
2. The method for object detection counterattack combining low-frequency information and key features of an image according to claim 1, characterized in that: The two-dimensional discrete Fourier transform described in step 2 extracts low-frequency information and converts it into a spatial domain image. The operation process is as follows: The operation of performing a two-dimensional Fourier transform on the input image x is recorded as F(x), and the corresponding spectrum graph z is obtained; in the spectrum graph z, the points in the middle are low-frequency, and the points far from the center of the image are high-frequency; set the threshold function as shown in formula (2), draw a circle with r as the hyperparameter radius, and the points inside the circle are divided into low-frequency components z low , the points outside the circle are divided into high-frequency components z high ; Where d(·) is the distance function, o(i o ,j o ) indicates that the coordinate is i o ,j o The center of the circle, z(i,j) represents the component with coordinates i,j; The above operation of separating high and low frequencies on the spectrum z with radius r is simplified to Q(z; r); for the low frequency information z low Perform inverse Fourier transform F -1 (z low ) to obtain the corresponding spatial domain image, which is convenient for the subsequent forward propagation of the neural network.
3. The method for object detection counterattack combining low-frequency information and key features of an image according to claim 1, characterized in that: Step 3: Fight against loss L adv (x,x adv ), The target detection model to be attacked is input as x,x adv or x low , The total loss L adv ; The total loss L adv Including confidence loss and feature loss; The confidence loss is used to mislead the network into classifying the foreground of the image as the background; the confidence loss function is as shown in formula (3): In formula (3), M represents the number of qualified proposal boxes obtained by the region proposal network RPN; l BCE is the binary cross entropy loss; C i Represents the confidence score of the i-th suggestion box; The feature loss attacks several intermediate feature layers extracted by the feature extraction network G of the target detection model to be attacked, and the operation is as follows: In the formula, N represents the number of selected intermediate feature layers, f i represents the i-th feature layer of G output with a clean image as input, f i ′ represents the i-th feature layer output by G with the adversarial sample as input; Therefore, the total loss function is as shown in formula (5): L adv =L confidence +β·L feature (5) In the formula, β is the weight coefficient.
4. The method for object detection counterattack combining low-frequency information and key features of an image according to claim 1, characterized in that: The MI-FGSM method described in step 4 has the following formula: In the formula, g i+1 represents the accumulated gradient momentum after i iterations, μ is the attenuation coefficient, α is the learning rate, It means to take the derivative of the original image x, L(x i ,θ) represents the calculation input of the current adversarial sample x i The loss obtained by entering the model with parameter θ, x i represents the adversarial sample of the current iteration, sign(g i+1 ) represents the gradient momentum g i+1 Take the sign function; Each time the gradient is accumulated, the currently calculated gradient is usually normalized and then added to the gradient momentum of this iteration; when each round of iteration generates the adversarial sample of the current stage, the clip function needs to be used to clip the pixels.
5. The method for object detection counterattack combining low-frequency information and key features of an image according to claim 1, characterized in that: Step 5: The process of generating the attention weight matrix for clean images using Grad-CAM mainly includes four steps: (1) Use the target detection model to detect the clean image x and obtain the detection result; (2) Back-propagate the classification score of each object in the detection results obtained in (1) in turn, calculate the feature map of the RPN network corresponding to the object, and generate a heat map based on the feature map; (3) To obtain a heat map with the same shape as x, resample all the heat maps obtained in (2) and then add them together to obtain the complete heat map; (4) Normalize the complete heat map obtained in (3) to obtain the attention weight matrix.
6. The method for object detection counterattack combining low-frequency information and key features of an image according to claim 3, characterized in that: The target detection model to be attacked is Faster R-CNN, and the feature extraction network G of the target detection model to be attacked is VGG16.
7. 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 6 is implemented.
