An adversarial sample generation method based on decoder self-integration
By using a decoder-integrated adversarial example generation method, which utilizes the latent information of the self-attention architecture model, the attack success rate and transferability of adversarial examples are improved, thus solving the problem of low attack success rate of existing methods against self-attention architecture target detection models.
Patent Information
- Application Number
- CN202410200163.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-23
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2044-02-23
AI Technical Summary
Existing adversarial attack methods have a low success rate against self-attention architecture target detection models, making it difficult to effectively attack and test their robustness.
We design an adversarial example generation method based on decoder self-integration. By aggregating the outputs of all decoders in a self-attention architecture target detection model, we generate adversarial examples and utilize the model's latent information to improve attack success rate and transferability.
It improves the attack success rate and transferability of self-attention architecture target detection models, reduces the model's recognition accuracy, and effectively reduces the cost of black-box attacks.
Smart Images

Figure QLYQS_3 
Figure QLYQS_5 
Figure QLYQS_7
Abstract
Description
Technical Field
[0001] This invention belongs to the field of adversarial machine learning technology in computer vision, specifically involving a method for generating adversarial examples based on decoder self-integration. Background Technology
[0002] In recent years, with the continuous advancement of deep learning technology and hardware computing power, computer vision has made groundbreaking progress, demonstrating near-human or even surpassing performance in many tasks. Object detection, as one of the tasks in computer vision, has been widely applied in autonomous driving, intelligent monitoring, and medical diagnosis. However, the field of object detection still faces many unresolved problems and security vulnerabilities, the most prominent of which is the adversarial example problem. Adversarial examples are security vulnerabilities in deep learning models. Attackers can add subtle noise to the model's input, causing it to produce incorrect inputs. Furthermore, adversarial examples are highly covert, making them difficult for humans to detect. Mainstream object detection models are divided into two types: those based on convolutional neural networks and those based on self-attention networks. Extensive research has been conducted to address the attack and defense issues of these models, promoting the development of security and reliability in object detection.
[0003] Current research on adversarial attacks against self-attention architecture object detection models is limited, with existing studies primarily targeting convolutional architecture models. Because self-attention networks and convolutional neural networks are significantly different heterogeneous networks, current adversarial methods have low success rates against self-attention architecture object detection models. For example, the MI-FGSM attack on convolutional architecture object detection models can achieve a success rate exceeding 95%, but its success rate against self-attention architecture models is less than 40%. Therefore, designing adversarial attack methods for self-attention architecture object detection models based on their structure is a pressing issue that needs to be addressed.
[0004] Given the technical deficiencies of existing technologies, it is necessary to design an adversarial example generation method based on a self-attention architecture target detection model. This method should be able to effectively attack the self-attention architecture-based target detection model, improve the attack success rate, and thus test the robustness of the self-attention architecture-based target detection. Summary of the Invention
[0005] The technical problem this invention aims to solve is how to design an adversarial attack method for self-attention architecture target detection models to improve the success rate and transferability of adversarial examples.
[0006] An adversarial example generation method based on decoder self-integration includes the following steps:
[0007] Step 1: Using a self-attention architecture object detection model as the source model F, input sample images. Use a feature extraction network f to extract features from the input image. The output of the model in the first iteration is shown below:
[0008]
[0009] Step 2: Make L ∞ The perturbation threshold of the norm is defined by the loss function used for backpropagation. The loss function is as follows:
[0010] Step 3: Obtain the output I of each decoder n+i+1 =d i (I n+i );
[0011] Step 4: Input the output of each decoder into the feedforward network to obtain... Its source model F can be expressed as:
[0012] Step 5: Calculate the samples and parameters for the next iteration;
[0013] Step 6: Analyze the adversarial examples from this iteration. and gradient value g t+1 As input for the next iteration;
[0014] Step 7: Repeat steps 1 to 6, and obtain adversarial examples after T iterations.
[0015] Preferably, the specific steps for calculating the samples and parameters for the next iteration in step five are as follows:
[0016] Step 5.1: Obtain the gradient value Where ||·||1 represents the L1 norm, and μ is the attenuation factor. This represents the gradient value during backpropagation;
[0017] Step 5.2: Obtain adversarial examples Where α represents the step size for each update, Clip x,∈ The function truncates pixels in the adversarial sample that exceed the threshold ∈, where sign represents the sign function.
[0018] Compared with the prior art, the present invention has the following advantages:
[0019] 1. Regarding the attack success rate, the DSEA method proposed in this invention can be applied to both white-box and black-box attacks on target detection models based on self-attention architecture. It can effectively improve the attack success rate of existing methods and reduce the mAP of the attacked model.
[0020] 2. In terms of transferability, the DSEA method generates adversarial examples on a single self-attention architecture model. By making full use of the potential information of the self-attention architecture model, it improves the attack success rate and transferability of adversarial examples. For target detection models based on self-attention architecture, it can reduce their recognition accuracy and effectively reduce the cost of black-box attacks. Detailed Implementation
[0021] The technical solutions in the embodiments of the present invention are clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0022] The innovation of this invention lies in generating adversarial examples by aggregating the outputs of all decoders within the self-attention architecture target detection model. This fully utilizes the potential information in the self-attention architecture target detection model, thereby improving the success rate and transferability of adversarial example attacks on models based on self-attention architecture target detection.
[0023] An adversarial example generation method based on decoder self-integration includes the following steps:
[0024] Step 1: Using a self-attention architecture object detection model as the source model F, input sample images. Use a feature extraction network f to extract features from the input image. The output of the model in the first iteration is shown below:
[0025]
[0026] Step 2: Make L ∞ The perturbation threshold of the norm is defined, and a loss function is defined and backpropagated. The loss function is as follows:
[0027] Step 3: Obtain the output I of each decoder n+i+1 =d i (I n+i );
[0028] Step 4: Input the output of each decoder into the feedforward network to obtain... Its source model F can be expressed as:
[0029] Step 5: Calculate the samples and parameters for the next iteration;
[0030] Step 6: Analyze the adversarial examples from this iteration. and gradient value g t+1 As input for the next iteration;
[0031] Step 7: Repeat steps 1 to 6, and obtain adversarial examples after T iterations.
[0032] Preferably, the specific steps for calculating the samples and parameters for the next iteration in step five are as follows:
[0033] Step 5.1: Obtain the gradient value Where ||·||1 represents the L1 norm, and μ is the attenuation factor. This represents the gradient value during backpropagation;
[0034] Step 5.2: Obtain adversarial examples Where α represents the step size for each update, Clip x,∈ The function truncates pixels in the adversarial sample that exceed the threshold ∈, where sign represents the sign function.
[0035] Existing adversarial attack methods typically calculate the loss function directly using the model's final output. However, this only utilizes the last encoder d. n The discriminative path to the feedforward network l does not fully utilize the model's latent information. Specifically, assuming six decoders, we first modify the DETR model structure. During the testing phase, we input the outputs of different individual decoders into the feedforward network, calculate mAP based on the classification and coordinates of the predicted boxes, and analyze the information contained in each decoder. We find that the mAP values of the first five decoders are very close to the mAP value of the last decoder, indicating that the outputs of the first five decoders are also meaningful. Based on this, this invention proposes a Decoder Self-Ensemble Attack (DSEA), which integrates the outputs of each decoder d. i The output of is input into the feedforward network l, and its average value is calculated as the loss function to improve the success rate of attacking models based on self-attention architecture for object detection.
[0036] The following examples illustrate the technical solution of this invention in detail. It should be noted that the scope of this invention is not limited to the examples below. The encoder layer and decoder layer can be n. The following examples are merely for illustrative purposes and are detailed below:
[0037] Parameter settings: A model with 6 encoder layers and 6 decoder layers; input image size adjusted to 800×800; pixel values normalized. All attack methods use L... ∞The norm is constrained, the threshold ∈ = 16 / 255, the maximum number of iterations T = 50, and the attack step size α = ∈ / (T / 2). The target model is a self-attention architecture target detection model. BIM, MI-FGSM, DI-FGSM, and TI-FGSM are selected as baseline attack methods. These methods are combined with the adversarial attack method based on decoder self-integration proposed in this technical solution, and the attack effects are compared. The specific process is as follows:
[0038] S1: Using a self-attention architecture object detection model (DETR) as the source model F, input sample images. Use a feature extraction network f to extract features from the input image.
[0039] S2: Using L ∞ The perturbation threshold of the norm ∈ defines a loss function and uses this loss function for backpropagation; the loss function is specifically:
[0040] S3: Obtain the output I of each decoder i+7 =d i (I 6+i );
[0041] S4: Input the output of each decoder into the feedforward network to obtain... Its source model F can be expressed as:
[0042] S5: Calculate the samples and parameters for the next iteration;
[0043] S5.1: Obtain the gradient value Where ||·||1 represents the L1 norm, and μ is the attenuation factor. This represents the gradient value during backpropagation;
[0044] S5.2: Obtain adversarial examples Where α represents the step size for each update, Clip x,∈ The function truncates pixels in adversarial samples that exceed the threshold ∈, where sign represents the sign function;
[0045] S6: Present the adversarial examples from this iteration. and gradient value g t+1 As input for the next iteration.
[0046] Among the four methods for white-box attacking the DETR-R50 model, combining the DSEA method can reduce mAP by an average of 8.93% and increase the attack success rate by an average of 21.23%. Similarly, among the four methods for white-box attacking the DETR-R101 model, combining the DSEA method can also reduce mAP by an average of 8.88% and increase the attack success rate by an average of 20.43%.
[0047] By plotting clean samples, adversarial samples generated by four attack methods, and adversarial samples generated by combining the DSEA method, the detection results on DETR-R50 and the gradient heatmap on the feature extraction layer of DETR-R50 are compared. Under the same confidence threshold setting, the adversarial samples generated by existing methods combined with DSEA can hide more objects, making them unrecognizable by the DETR-R50 model. For adversarial samples generated by MI-FGSM, DETR-R50 can recognize objects such as tables, cups, forks, and pizzas. However, for adversarial samples generated by DSEA combined with MI-FGSM, DETR-R50 can only recognize one object, the cup. This shows that the DSEA method can effectively reduce the confidence of objects, making them unrecognizable by the object detection model.
[0048] By comparison, the adversarial examples generated by existing methods show that the red areas of their gradient heatmaps are mainly concentrated on the objects, indicating that the model still focuses on the main objects in the image. However, the adversarial examples generated by the DSEA method show that the red areas of their gradient heatmaps are more dispersed and more concentrated in the background area, indicating that the model is no longer able to focus on the correct object regions, is affected by the noise of the adversarial examples, and is unable to capture the features of the objects.
[0049] The adversarial examples generated by MI-FGSM show that the red areas of the gradient heatmap are concentrated on the pizza portion, indicating that the model focuses more on the pizza and resulting in multiple pizza prediction boxes in the recognition results. The adversarial examples generated by the DSEA method combined with MI-FGSM show that the red areas of the gradient heatmap are scattered throughout the image, indicating that the model focuses more on the background and therefore only recognizes the cup. This demonstrates that the DSEA method can effectively interfere with the feature extraction layer of the DETR model, preventing it from correctly extracting image features and thus reducing recognition accuracy.
[0050] The test results above show that the decoder self-integration adversarial sample generation method designed for self-attention architecture target detection models in this invention can effectively attack self-attention architecture-based target detection models, improve the attack success rate, and has better attack performance than existing methods. The generated adversarial samples have higher transferability.
[0051] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for generating adversarial examples based on decoder self-integration, which is used for robustness testing of target detection models under legal conditions, characterized in that: The adversarial example generation method includes the following steps: Step 1: Using a self-attention architecture object detection model as the source model F, input sample images. The feature extraction network f is used to extract features from the input image. The output of the model in the first iteration is shown below: ; Step 2: Make The perturbation threshold of the norm is defined by the loss function used for backpropagation. The loss function is as follows: ; Step 3: Obtain the output of each decoder ; Step 4: Input the output of each decoder into the feedforward network to obtain... Its source model F is represented as: , ; Step 5: Calculate the samples and parameters for the next iteration; Step 6: Iterate the adversarial examples and gradient value As input for the next iteration; Step 7: Repeat steps 1 to 6, and obtain adversarial examples after T iterations. .
2. The adversarial example generation method based on decoder self-integration as described in claim 1, characterized in that: The specific steps for calculating the samples and parameters for the next iteration in step 5 are as follows: Step 5.1: Obtain the gradient value ,in represent Norm, μ is the attenuation factor, This represents the gradient value during backpropagation; Step 5.2: Obtain adversarial examples Where α represents the step size for each update, The function truncates pixels in the adversarial sample that exceed the threshold ∈, where sign represents the sign function.
