Multi-view adaptive weight balancing adversarial attack method for pedestrian targets
Through the multi-view adaptive weight balance counterattack method, combined with YOLOv5 and Model Shake Drop module, the view channel weight is optimized, which solves the problem of poor single-view attack effect in the existing technology and achieves a robust and efficient attack effect under multiple views. .
Patent Information
- Application Number
- CN202410845651.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-06-27
AI Technical Summary
Existing black-box adversarial attack methods mainly consider a single perspective, resulting in poor target attack effects under different perspectives, and cannot effectively improve the security of target detection applications.
A multi-view adaptive weight balance adversarial attack method for pedestrian targets is adopted. By dividing the human target image data set according to front, oblique and side views, the YOLOv5 model and Model Shake Drop module are used to optimize the target detection model, and combined with the patch cut out algorithm Process adversarial patches, build an adaptive balancing strategy to dynamically adjust the weight of the view channel, and generate more robust adversarial samples.
The robustness and generalization ability of the adversarial attack method are improved, so that it can maintain good attack effects under multiple perspectives, and the perspective robustness and attack success rate of the adversarial attack method are enhanced.
Smart Images

Figure CN118397431B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a multi-view adaptive weight balancing counterattack method for pedestrian targets. Background Art
[0002] The superior performance of deep neural networks has promoted the rapid development of the industrial Internet of Things and has achieved great success in the fields of target detection, image classification, semantic segmentation and autonomous driving. Among them, target detection has always received great attention from academia and industry. Its task is to extract the region of interest from a given image and mark the category and location. In recent years, many studies have shown that adversarial samples can successfully interfere with target detection models in the digital and physical fields, posing a huge threat to the application of target detection models. Pedestrian targets are one of the main research objects of target detection and have rich intra-class differences. In the autonomous driving scenario, if the autonomous driving system is attacked by adversarial samples, it may mistakenly identify actual pedestrians as other targets such as road backgrounds, resulting in the system being unable to accurately identify and avoid them in a timely manner, resulting in traffic accidents. Therefore, it is necessary to conduct in-depth research on adversarial attack methods for target detection to improve the security level of target detection applications.
[0003] Since Lu et al. proposed adversarial attack methods in the field of target detection, researchers have proposed a series of adversarial attack methods for target detection. In actual scenarios, it is usually difficult for attackers to obtain detailed information of the attack model, so black-box attacks have attracted widespread attention in academia and industry. Black-box adversarial attacks can be divided into two categories, namely query-based and transfer-based black-box adversarial attacks. For the former, adversarial perturbations are usually pre-trained on the white-box model, and then the target black-box model is continuously accessed and fine-tuned based on the information obtained, but frequent queries may expose the attack intention and weaken the concealment of the attack. Transfer-based black-box attacks use the model transferability of adversarial samples to directly attack the target model without querying and ensuring the concealment of the attack. In the existing research on black-box attack methods, most studies only consider the case of a single perspective, ignoring the impact of different perspectives on the attack effect. Therefore, these attack methods have poor effects on target attacks under different perspectives. Summary of the invention
[0004] The purpose of the present invention is to provide a multi-perspective adaptive weighted balance counterattack method for pedestrian targets, which solves the problem in the prior art that only a single perspective is considered, resulting in poor attack effects on the target under different perspectives.
[0005] The technical solution adopted by the present invention is a multi-view adaptive weight balancing counterattack method for pedestrian targets, which specifically includes the following steps:
[0006] Step 1: Select a human target image dataset and divide the images in the dataset into three perspectives: front, oblique, and side.
[0007] Step 2: Input the human target images from different perspectives into the target detection model, determine the attack position through center positioning, and randomly generate an adversarial patch;
[0008] Step 3: Optimize the target detection model;
[0009] Step 4: Process the adversarial patch through the patch cut out algorithm and cover the attack position of the human target image;
[0010] Step 5: Input the human target image obtained in step 4 into the optimized target detection model for training; during the training process, construct an adaptive balance strategy to dynamically adjust the loss value weight of each viewing channel;
[0011] Step 6: Repeat steps 4-5 until the overall loss function converges to obtain the final adversarial sample.
[0012] The present invention is also characterized in that:
[0013] In step 2, the target detection model uses YOLOv5. In step 3, the target detection model is optimized by replacing the convolution modules in the 5th, 7th, and 9th layers of the YOLOv5 backbone network with Model Shake Drop modules. The Model Shake Drop module includes three 1×1 convolutional layers, a Shake Drop module, and a Sequential module.
[0014] The Model Shake Drop module is an improved module based on the model shake drop algorithm. The model shakedrop algorithm:
[0015] During the forward propagation process, the model shake drop mechanism randomly perturbs the model parameters. The process is defined as:
[0016] (1)
[0017] In the formula, For input data, Processing for the model residual module; is the jitter factor, which obeys the uniform distribution between [-1,1];
[0018] The random dropout mechanism in the forward propagation process sets the output of the neuron to zero with a certain probability. The process is:
[0019] (2)
[0020] In the formula, The probability of performing a discard operation follows a uniform distribution between [0,1];
[0021] The entire model shake drop algorithm integrates the shake mechanism and the random drop mechanism. The integration process of the shake mechanism and the random drop mechanism in the forward propagation is defined as:
[0022] (3)
[0023] In the formula, is the final output of the residual module;
[0024] During the back-propagation process, it is defined as:
[0025] (4)
[0026] In the formula, is the loss function.
[0027] The process of processing the adversarial patch through the patch cut out algorithm in step 4 is as follows:
[0028] Step 4.1: Generate a binary mask M , randomly select a rectangular area in the adversarial patch and set the pixel values in the area to zero. The process is defined as:
[0029] (5)
[0030] In the formula, is a binary mask used for occlusion, (i, j) represents the pixel coordinates of the adversarial patch, and R represents a randomly selected rectangular area;
[0031] Step 4.2: Use the resulting binary mask for occlusion The adversarial patch is processed to obtain the final adversarial patch for training. The process is defined as:
[0032] (6)
[0033] In the formula, is the output after the patch cut out algorithm. is the original input before the patch cutout algorithm. Represents the intersection operation.
[0034] Step 5 The training process is defined as:
[0035] (7)
[0036] In the formula, Indicates the total number of viewing angles, represents the number of samples, Indicates the training process The weight of the perspective, represents the distance loss function that measures the quality of the attack method, represents the optimized model, express From the perspective The true labels of the sample images, Indicates that after the anti-patch attack From the perspective images, Represents a random cropping method in the patch cut out algorithm. represents the adversarial loss function, Represents the image pixel range.
[0037] The distance loss function that measures the quality of the attack method includes three loss functions, model detection loss function , printable loss function And texture loss function ;
[0038] Distance loss function to measure the quality of attack methods for:
[0039] (8)
[0040] Model detection loss function is defined as:
[0041] (9)
[0042] Printable loss function is defined as:
[0043] (10)
[0044] In the formula, Indicates the attack method to generate adversarial patches A pixel of Represents a set of printable colors a color;
[0045] Texture loss function is defined as:
[0046] (11)
[0047] In the formula, is the adversarial sample image at coordinates The pixels below is the adversarial sample image at coordinates The pixels below is the adversarial sample image at coordinates The pixels below.
[0048] Adversarial Loss Function is defined as:
[0049] (12)
[0050] In the formula, yes for The probability output of the category, yes for The probability output of the category, and , Indicates the adversarial category, in order to distinguish it from category, randomly select a different Category against category.
[0051] Step 5: During the training process, an adaptive balancing strategy is constructed to dynamically adjust the loss value weight of each visual channel, including the following steps:
[0052] Calculate the loss value of each viewing angle channel;
[0053] The loss function of a single viewing channel is:
[0054] (13)
[0055] In the formula, Indicates The loss value from each perspective is represents the distance loss function that measures the quality of the attack method, represents the optimized model, represents the true label of the sample image, represents the image after the adversarial patch attack, Represents a random cropping method in the patch cut out algorithm. Represents resistance to loss, Indicates the image pixel range;
[0056] The weights of the calculated loss values of different viewing angle channels are adjusted: the weight values of the viewing angle channels with larger loss values are increased, and the loss values of each viewing angle channel are normalized as a whole to obtain the weight value of each viewing angle channel;
[0057] The process of normalizing the loss values of each viewing channel and calculating the viewing channel weight is as follows:
[0058] (14)
[0059] In the formula, Indicates the training process The weight of the perspective, Indicates the total number of viewing angles, Indicates The loss value from each perspective.
[0060] The overall loss function in step 6 is defined as:
[0061] (15).
[0062] The beneficial effects of the present invention are:
[0063] The multi-view adaptive weight balancing adversarial attack method for pedestrian targets of the present invention constructs a multi-view channel for training and comprehensively considers the characteristics of the target under different viewpoints; then combines the self-integrated algorithm model shake drop and patch cut out to optimize the model and enhance the generalization ability of the attack method; finally, an adaptive balancing strategy is constructed to dynamically adjust the weights of different viewpoints during the training process, so as to obtain adversarial patches with better viewpoint robustness. This strategy helps to improve the robustness of the adversarial attack method and maintain good attack effects under multiple viewpoints. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is a framework diagram of the multi-view adaptive weight balancing counterattack method for pedestrian targets of the present invention;
[0065] Figure 2 It is a diagram of the execution process of the modelshake drop algorithm in the multi-view adaptive weight balance counterattack method for pedestrian targets of the present invention;
[0066] Figure 3 are adversarial patch images made by different methods;
[0067] Figure 4 It is the attack effect of the multi-view adaptive weight balance counterattack method for pedestrian targets on YOLOv5 of the present invention;
[0068] Figure 5 This is a comparison chart of average accuracy data of the multi-view adaptive weighted balance counterattack method for pedestrian targets of the present invention and the comparison method on different target detection models;
[0069] Figure 6It is a comparison chart of attack success rate data of the multi-view adaptive weighted balance counterattack method for pedestrian targets of the present invention and the comparative method on different target detection models;
[0070] Figure 7 It is a curve diagram of the decrease in training loss of the multi-view adaptive weight balance counterattack method for pedestrian targets of the present invention;
[0071] Figure 8 It is a curve diagram of attack success rates of the multi-view adaptive weighted balance counterattack method for pedestrian targets of the present invention and the comparison method at different view angles. DETAILED DESCRIPTION
[0072] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0073] Multi-view adaptive weight balancing adversarial attack method for pedestrian targets, such as Figure 1 As shown, the specific steps include:
[0074] Step 1: Select a human target image dataset and divide the images in the dataset into three perspectives: front, oblique, and side.
[0075] The dataset can use the PKU-Reid dataset, which has a total of 1,824 images. Each captured pedestrian contains images from 8 different angles; the three viewing angles are frontal (0°, 180°), oblique (45°, 135°, 225°, 315°), and side (90°, 270°).
[0076] Step 2: Input the human target images from different perspectives into the target detection model, determine the attack position through center positioning, and randomly generate an adversarial patch;
[0077] In the optimization training of multi-view channels, the present invention adopts the YOLOv5 model, which is optimized by the Adam algorithm, with the learning rate set to 0.01, the exponential decay rate of the first-order moment estimation to 0.9, and the exponential decay rate of the second-order moment estimation to 0.999.
[0078] Step 3: Optimize the target detection model;
[0079] To optimize the target detection model, the convolution modules in the 5th, 7th, and 9th layers of the YOLOv5 backbone network are replaced with ModelShake Drop modules. The Model Shake Drop module includes three 1×1 convolutional layers, a Shake Drop module, and a Sequential module, which introduces channel feature transformation, attention mechanism, and randomness into the model.
[0080] The Model Shake Drop module is an improved module based on the model shake drop algorithm.
[0081] Model Shake Drop is a self-integrated algorithm for regularization of deep neural networks. It aims to enhance the generalization ability of the model. The core idea is to increase the diversity of the model by introducing random jitter and random drop mechanisms, thereby reducing the risk of overfitting. In the model used in training, the Model Shake Drop algorithm is combined for optimization. By randomly jittering model parameters and dropping neurons, the diversity of the model is increased, overfitting is prevented, and the generated adversarial patches can be generalized to other models. In each forward propagation, Model Shake Drop introduces a random jitter factor in the channel dimension to fuse the feature maps of the two branches. The introduction of this jitter operation makes the structure of the network change slightly in each iteration, thereby improving the robustness of the model. The execution process of the Model Shake Drop algorithm in forward propagation and back propagation is as follows. Figure 2 shown.
[0082] During the forward propagation of the entire training process, the model shake drop mechanism randomly perturbs the model parameters. The process is defined as:
[0083] (1)
[0084] In the formula, For input data, Processing for the model residual module; is the jitter factor, which obeys the uniform distribution between [-1,1];
[0085] The random dropout mechanism in the forward propagation process sets the output of the neuron to zero with a certain probability. The process is:
[0086] (2)
[0087] In the formula, The probability of performing a discard operation follows a uniform distribution between [0,1];
[0088] The entire model shake drop integrates the shake mechanism and the random drop mechanism. The integration process of the shake mechanism and the random drop mechanism in the forward propagation is defined as:
[0089] (3)
[0090] in is the final output of the residual module, is the input of the residual module, is the probability of performing a discard operation, is the jitter factor, Processing for the model residual module.
[0091] In the back propagation process, in order to calculate the gradient of the loss function to the parameters and update the parameters, the back propagation process of the optimized model combined with model shake drop is defined as:
[0092] (4)
[0093] in is the loss function.
[0094] Step 4: Process the adversarial patch through the patch cut out algorithm and cover the attack position of the human target image;
[0095] The design of Dropout is to randomly discard neural units and their connections, effectively preventing overfitting of the model. Combining the idea of Dropout, a patch cut out algorithm is introduced to randomly cover an area of the adversarial patch to reduce the complexity of the patch during the training phase, thereby preventing overfitting of specific models and data. Patch cut out can also prevent the adversarial patch from being too dependent on the pattern of a specific area.
[0096] The process of processing the adversarial patch through the patch cut out algorithm is as follows:
[0097] Step 4.1: Generate a binary mask M , randomly select a rectangular area in the adversarial patch and set the pixel values in the area to zero. The process is defined as:
[0098] (5)
[0099] In the formula, is a binary mask used for occlusion, (i, j) represents the pixel coordinates of the adversarial patch, and R represents a randomly selected rectangular area;
[0100] Step 4.2: Use the resulting binary mask for occlusion The adversarial patch is processed to obtain the final adversarial patch for training. The process is defined as:
[0101] (6)
[0102] In the formula, is the output after the patch cut out algorithm. is the original input before the patch cutout algorithm. Represents the intersection operation.
[0103] When the present invention is combined with patch cut out for optimization, the ratio of covering the antagonistic patch is set to 0.25, that is, one quarter of the area of the entire antagonistic patch will be covered, and the filling value of the covered area is set to 0.5, that is, gray is used for filling.
[0104] Step 5: Input the human target image covered by the adversarial patch into the optimized target detection model for training; during the training process, construct an adaptive balancing strategy to dynamically adjust the loss value weight of each viewing channel;
[0105] The whole process is divided into three perspectives: front, side and oblique, for parallel training. The optimization training process is defined as:
[0106] (7)
[0107] In the formula, Indicates the total number of viewing angles, represents the number of samples, Indicates the training process The weight of the perspective, represents the distance loss function that measures the quality of the attack method, represents the optimized model, express From the perspective The true labels of the sample images, Indicates that after the anti-patch attack From the perspective images, Represents a random cropping method in the patch cut out algorithm. represents the adversarial loss function, Represents the image pixel range.
[0108] Distance loss function to measure the quality of attack methods It consists of three loss functions: model detection loss , Printable loss and texture loss . The model detection loss Used to measure the attack effect of the attack method on the model, and print the loss To ensure that the adversarial patches generated by the attack method can be applied to real scenes, texture loss It is used to limit the generation of overly subtle textures, making the generated textures simpler and smoother.
[0109] Distance loss function to measure the quality of attack methods for:
[0110] (8)
[0111] In order to ensure the effectiveness of the attack method, the difference between the result of the adversarial sample image after the attack model and the true label is used as the model detection loss. The effectiveness of the attack method is ensured by maximizing the loss. The model detection loss function is defined as:
[0112] (9)
[0113] In order to ensure that the adversarial patch generated by the attack method can be applied in real scenarios, the color set that can be printed by the printer is used as the color limit of the adversarial patch pixels. By narrowing the gap between the adversarial patch color and the printable color, the generated adversarial patch can be displayed by the printer. The printable loss function is defined as:
[0114] (10)
[0115] In the formula, Indicates the attack method to generate adversarial patches A pixel of Represents a set of printable colors a color;
[0116] In order to limit the generation of overly subtle textures, the generated textures are simpler and smoother, and the texture loss function is defined as:
[0117] (11)
[0118] in is the adversarial sample image at coordinates The pixels below is the adversarial sample image at coordinates The pixels below is the adversarial sample image at coordinates The pixels below.
[0119] In order to further enhance the texture richness of the adversarial patch, the adversarial loss function is defined as:
[0120] (12)
[0121] In the formula, yes for The probability output of the category, yes for The probability output of the category, and , Indicates the adversarial category, in order to distinguish it from category, randomly select a different Category against category.
[0122] In order to adaptively adjust the preference for different perspectives during training, a weight balancing strategy is constructed by dynamically adjusting the weights of each perspective channel. The core idea of this weight balancing is to optimize the weights of different perspective channels during training so that they pay more attention to the target information under different perspectives, thereby enhancing the perspective robustness of the generated adversarial patch.
[0123] The loss function of a single viewing channel is:
[0124] (13)
[0125] In the formula, Indicates The loss value from each perspective is represents the distance loss function that measures the quality of the attack method, represents the optimized model, represents the true label of the sample image, represents the image after the adversarial patch attack, Represents a random cropping method in the patch cut out algorithm. Represents resistance to loss, Indicates the image pixel range;
[0126] Adjust the weights of the calculated loss values of different perspective channels: If the loss of this channel is large, it means that the attack effect under this perspective channel is poor, and it is necessary to focus on optimizing this perspective channel, so the weight value of this channel should be increased. After normalizing the loss values of each perspective channel as a whole, the weight value of each perspective channel can be obtained. By dynamically adjusting the weights of different perspectives during the training process, an adversarial patch with better perspective robustness can be obtained. The process of normalizing the loss values of each perspective channel and calculating the perspective channel weight is as follows:
[0127] (14)
[0128] In the formula, Indicates the training process The weight of the perspective, Indicates the total number of viewing angles, Indicates The loss value from each perspective.
[0129] The adaptive weight balancing strategy ensures that the adversarial attack method is not limited to the target information at a specific perspective by integrating the losses involved in different perspectives during the training process. The key to this strategy is to dynamically adjust the loss weights of different perspectives so that the generated adversarial patches have better perspective robustness. This strategy helps to improve the robustness of the adversarial attack method and maintain good attack effects at multiple perspectives.
[0130] Step 6: Repeat steps 4-5 until the overall loss function converges to obtain the final adversarial sample.
[0131] The overall loss function of the training process can be defined as:
[0132] (15)
[0133] The adversarial samples finally generated can cause black box models YOLOv2, YOLOv3, YOLOv4 and Faster R-CNN target detectors to make errors in detection.
[0134] Simulation experiment:
[0135] The PKU-Reid dataset is used to train the adversarial patch and test the attack effect. The dataset has a total of 1,824 images, and each captured pedestrian contains images from 8 different angles, providing sufficient perspective coverage for the experiment.
[0136] In order to verify the effectiveness of the adversarial sample generation method in this paper, the adversarial patches made by Hu et al., Hao et al. and Thys et al. using different methods are used for comparison and named TC-EGA, T-SEA and AdvYOLO respectively. The effects of each adversarial patch are shown in the figure. Figure 3 shown.
[0137] Experimental results:
[0138] The attack effect of the anti-attack method proposed in this invention on YOLOv5 is as follows: Figure 4 As shown in the figure, the upper and lower parts represent the results of normal samples and adversarial samples after YOLOv5 detection, respectively. The pedestrian targets in the normal samples in the upper part can be detected correctly, while the pedestrian targets in the adversarial samples in the lower part cannot be detected correctly, resulting in two situations: YOLOv5 fails to detect the target and predicts the bounding box incorrectly.
[0139] Figure 5The table shows the average accuracy of the present invention and the comparison method on multiple target detection models. Five models are covered. The data on the diagonal of the table reflect the average accuracy of generating adversarial patches by using the model as a white-box model for training, while the other data in the row represent the average accuracy of generating adversarial patches by white-box model training on black-box models. Figure 5 It can be seen that compared with other comparison methods, the method of the present invention performs better in reducing the average accuracy of the white-box model, and has a better effect on reducing the average accuracy of the black-box model. Taking the YOLOv5 model as an example, the average accuracy of the method of the present invention on the white-box model can be reduced to 0.16, which is 2.18 lower than the optimal comparison method T-SEA. When verifying other black-box models, the use of YOLOv5 as a white-box model for training to generate adversarial patches has a significant attack effect, which can reduce the comprehensive average accuracy of the black-box model to 12.60, which is 11.12 lower than the optimal comparison method.
[0140] Through the above experimental analysis, it can be seen that different adversarial attack methods can reduce the average accuracy of the target detection model under white-box and black-box conditions, but the method of the present invention has a better ability to reduce the average accuracy of the target detection model. The method of the present invention integrates the self-integrated algorithm model shake drop and patch cutout in the white-box training process to improve the generalization ability of the attack method. Model shake drop avoids the excessive reliance of the attack method on a single model by introducing random model jitter, and effectively enhances the generalization ability of the adversarial patch. Patch cut out introduces local occlusion in the input image, forcing the model to learn robustness training for the lack of some information, thereby enhancing the robustness of the adversarial patch. In addition, the method of the present invention also combines the multi-view channel training method and the weight balancing strategy to further improve the performance of the attack method. The multi-view channel training method enables the model to comprehensively learn the input data from multiple perspectives, increases the method's learning of the characteristics of each angle of the input data, and helps to better cope with different perspectives of the target. The weight balancing strategy ensures that the method pays more attention to key information by adjusting the weight distribution during the training process, improves the robustness of the method, and makes the generated adversarial patch have a better attack effect.
[0141] Figure 6 The table shows the attack success rates of the present invention and the comparative method on multiple target detection models. Five models are covered. The data on the diagonal in the table reflect the attack success rate of using the model as a white-box model to train and generate adversarial patches, while the other data in the row represent the attack success rate of testing the adversarial patches generated by the white-box model training on the black-box model. Figure 6It can be seen that compared with other comparison methods, the attack success rate of the method of the present invention is better, and it also maintains a good attack effect on the black box model. Taking the YOLOv5 model as an example, the attack success rate of the method of the present invention on the white box model can reach 98.45%, which is 3.78% higher than the best comparison method T-SEA. When verifying other black box models, the attack effect of using YOLOv5 as a white box model for training to generate adversarial patches is significant, and the average attack success rate on the black box model can reach 76.91%, which is 19.26% higher than the best comparison method T-SEA.
[0142] Depend on Figure 7 It can be seen that the loss value fluctuations of the present invention decrease throughout the training process until it converges in the end. The sharp drop in loss in the initial stage reflects the ability of the multi-view channel training method to accelerate the capture of complex data features. The integration of the adaptive balancing strategy further stabilizes the loss decline curve and improves the balanced processing capability in the face of multi-view data feature bias. In the middle to late stages of training, model shake drop adds regularization to the model, effectively suppresses overfitting, and promotes a gradual and steady decrease in the loss value. Finally, patch cut out enhances the robustness of the adversarial attack method, allowing the loss curve to exhibit a stable convergence pattern in the final stage of training.
[0143] Depend on Figure 8 It can be seen that the present invention maintains a high and relatively stable attack success rate under almost all viewing angles, especially under side viewing angles, where its robustness shows significant advantages. Compared with other methods, the present invention method shows stronger consistency and stability in the face of viewing angle changes. The present invention method adopts a multi-view channel training method and a weight balancing strategy, so that features can be learned from multiple viewing angles in a more balanced manner during the entire training process, avoiding the problem of overfitting to a specific viewing angle.
[0144] Embodiment 1:
[0145] The multi-view adaptive weight balancing adversarial attack method for pedestrian targets specifically includes the following steps:
[0146] Step 1: Use the PKU-Reid dataset, which has a total of 1,824 images. Each captured pedestrian contains images from eight different angles. The images are divided into three perspectives: front, oblique, and side.
[0147] Step 2: Input the human target images from different perspectives into the target detection model YOLOv5, determine the attack position through center positioning, and randomly generate an adversarial patch;
[0148] Step 3: Optimize the target detection model;
[0149] The convolution modules in the 5th, 7th, and 9th layers of the YOLOv5 backbone network are replaced with Model Shake Drop modules, which include three 1×1 convolutional layers, Shake Drop modules, and Sequential modules.
[0150] Step 4: Process the adversarial patch through the patch cut out algorithm and cover the attack position of the human target image;
[0151] The process of processing the adversarial patch through the patch cut out algorithm is as follows:
[0152] Step 4.1: Generate a binary mask M , randomly select a rectangular area in the adversarial patch and set the pixel values in the area to zero. The process is defined as:
[0153] (5)
[0154] In the formula, is a binary mask used for occlusion, (i, j) represents the pixel coordinates of the adversarial patch, and R represents a randomly selected rectangular area;
[0155] Step 4.2: Use the resulting binary mask for occlusion The adversarial patch is processed to obtain the final adversarial patch for training. The process is defined as:
[0156] (6)
[0157] In the formula, is the output after the patch cut out algorithm. is the original input before the patch cutout algorithm. Represents the intersection operation.
[0158] Set the masking ratio of the adversarial patch to 0.25, that is, one quarter of the area of the entire adversarial patch will be masked, and set the fill value of the masked area to 0.5, that is, gray is used for filling.
[0159] Step 5: Input the human target image covered by the adversarial patch into the optimized target detection model for training; during the training process, construct an adaptive balancing strategy to dynamically adjust the loss value weight of each viewing channel;
[0160] The whole process is divided into three perspectives: front, side and oblique, for parallel training. The optimization training process is defined as:
[0161] (7)
[0162] In the formula, Indicates the total number of viewing angles, represents the number of samples, Indicates the training process The weight of the perspective, represents the distance loss function that measures the quality of the attack method, represents the optimized model, express From the perspective The true labels of the sample images, Indicates that after the anti-patch attack From the perspective images, Represents a random cropping method in the patch cut out algorithm. represents the adversarial loss function, Represents the image pixel range.
[0163] Construct an adaptive balancing strategy to dynamically adjust the loss value weight of each visual channel, including the following steps:
[0164] Calculate the loss value of each viewing angle channel;
[0165] The loss function of a single viewing channel is:
[0166] (13)
[0167] In the formula, Indicates The loss value from each perspective is represents the distance loss function that measures the quality of the attack method, represents the optimized model, represents the true label of the sample image, represents the image after the adversarial patch attack, Represents a random cropping method in the patch cut out algorithm. Represents resistance to loss, Indicates the image pixel range;
[0168] The weights of the calculated loss values of different viewing angle channels are adjusted: the weight values of the viewing angle channels with larger loss values are increased, and the loss values of each viewing angle channel are normalized as a whole to obtain the weight value of each viewing angle channel;
[0169] The process of normalizing the loss values of each viewing channel and calculating the viewing channel weight is as follows:
[0170] (14)
[0171] In the formula, Indicates the training process The weight of the perspective, Indicates the total number of viewing angles, Indicates The loss value from each perspective.
[0172] Step 6: Repeat steps 4-5 until the overall loss function converges to obtain the final adversarial sample.
[0173] The overall loss function is defined as:
[0174] (15).
[0175] Embodiment 2:
[0176] The multi-view adaptive weight balancing adversarial attack method for pedestrian targets specifically includes the following steps:
[0177] Step 1: Use the PKU-Reid dataset, which has a total of 1,824 images. Each captured pedestrian contains images from eight different angles. The images are divided into three perspectives: front, oblique, and side.
[0178] Step 2: Input the human target images from different perspectives into the target detection model YOLOv5, determine the attack position through center positioning, and randomly generate an adversarial patch;
[0179] Step 3: Optimize the target detection model;
[0180] The convolution modules in the 5th, 7th, and 9th layers of the YOLOv5 backbone network are replaced with Model Shake Drop modules, which include three 1×1 convolutional layers, Shake Drop modules, and Sequential modules.
[0181] The Model Shake Drop module is an improved module based on the model shake drop algorithm. The model shakedrop algorithm:
[0182] During the forward propagation process, the model shake drop mechanism randomly perturbs the model parameters. The process is defined as:
[0183] (1)
[0184] In the formula, For input data, Processing for the model residual module; is the jitter factor, which obeys the uniform distribution between [-1,1];
[0185] The random dropout mechanism in the forward propagation process sets the output of the neuron to zero with a certain probability. The process is:
[0186] (2)
[0187] In the formula, The probability of performing a discard operation follows a uniform distribution between [0,1];
[0188] The entire model shake drop algorithm integrates the shake mechanism and the random drop mechanism. The integration process of the shake mechanism and the random drop mechanism in the forward propagation is defined as:
[0189] (3)
[0190] In the formula, is the final output of the residual module;
[0191] During the back-propagation process, it is defined as:
[0192] (4)
[0193] In the formula, is the loss function.
[0194] Step 4: Process the adversarial patch through the patch cut out algorithm and cover the attack position of the human target image;
[0195] The process of processing the adversarial patch through the patch cut out algorithm is as follows:
[0196] Step 4.1: Generate a binary mask M , randomly select a rectangular area in the adversarial patch and set the pixel values in the area to zero. The process is defined as:
[0197] (5)
[0198] In the formula, is a binary mask used for occlusion, (i, j) represents the pixel coordinates of the adversarial patch, and R represents a randomly selected rectangular area;
[0199] Step 4.2: Use the resulting binary mask for occlusion The adversarial patch is processed to obtain the final adversarial patch for training. The process is defined as:
[0200] (6)
[0201] In the formula, is the output after the patch cut out algorithm. is the original input before the patch cutout algorithm. Represents the intersection operation.
[0202] Set the masking ratio of the adversarial patch to 0.25, that is, one quarter of the area of the entire adversarial patch will be masked, and set the fill value of the masked area to 0.5, that is, gray is used for filling.
[0203] Step 5: Input the human target image covered by the adversarial patch into the optimized target detection model for training; during the training process, construct an adaptive balancing strategy to dynamically adjust the loss value weight of each viewing channel;
[0204] The whole process is divided into three perspectives: front, side and oblique, for parallel training. The optimization training process is defined as:
[0205] (7)
[0206] In the formula, Indicates the total number of viewing angles, represents the number of samples, Indicates the training process The weight of the perspective, represents the distance loss function that measures the quality of the attack method, represents the optimized model, express From the perspective The true labels of the sample images, Indicates that after the anti-patch attack From the perspective images, Represents a random cropping method in the patch cut out algorithm. represents the adversarial loss function, Represents the image pixel range.
[0207] The adaptive balancing strategy constructed dynamically adjusts the loss value weight of each visual channel, including the following steps:
[0208] Calculate the loss value of each viewing angle channel;
[0209] The loss function of a single viewing channel is:
[0210] (13)
[0211] In the formula, Indicates The loss value from each perspective is represents the distance loss function that measures the quality of the attack method, represents the optimized model, represents the true label of the sample image, represents the image after the adversarial patch attack, Represents a random cropping method in the patch cut out algorithm. Represents resistance to loss, Indicates the image pixel range;
[0212] The weights of the calculated loss values of different viewing angle channels are adjusted: the weight values of the viewing angle channels with larger loss values are increased, and the loss values of each viewing angle channel are normalized as a whole to obtain the weight value of each viewing angle channel;
[0213] The process of normalizing the loss values of each viewing channel and calculating the viewing channel weight is as follows:
[0214] (14)
[0215] In the formula, Indicates the training process The weight of the perspective, Indicates the total number of viewing angles, Indicates The loss value from each perspective.
[0216] Step 6: Repeat steps 4-5 until the overall loss function converges to obtain the final adversarial sample.
[0217] The overall loss function is defined as:
[0218] (15).
[0219] Embodiment 3:
[0220] The multi-view adaptive weight balancing adversarial attack method for pedestrian targets specifically includes the following steps:
[0221] Step 1: Use the PKU-Reid dataset, which has a total of 1,824 images. Each captured pedestrian contains images from eight different angles. The images are divided into three perspectives: front, oblique, and side.
[0222] Step 2: Input the human target images from different perspectives into the target detection model YOLOv5, determine the attack position through center positioning, and randomly generate an adversarial patch;
[0223] Step 3: Optimize the target detection model;
[0224] The convolution modules in the 5th, 7th, and 9th layers of the YOLOv5 backbone network are replaced with Model Shake Drop modules, which include three 1×1 convolutional layers, Shake Drop modules, and Sequential modules.
[0225] The Model Shake Drop module is an improved module based on the model shake drop algorithm.
[0226] Step 4: Process the adversarial patch through the patch cut out algorithm and cover the attack position of the human target image;
[0227] The process of processing the adversarial patch through the patch cut out algorithm is as follows:
[0228] Step 4.1: Generate a binary mask M , randomly select a rectangular area in the adversarial patch and set the pixel values in the area to zero. The process is defined as:
[0229] (5)
[0230] In the formula, is a binary mask used for occlusion, (i, j) represents the pixel coordinates of the adversarial patch, and R represents a randomly selected rectangular area;
[0231] Step 4.2: Use the resulting binary mask for occlusion The adversarial patch is processed to obtain the final adversarial patch for training. The process is defined as:
[0232] (6)
[0233] In the formula, is the output after the patch cut out algorithm. is the original input before the patch cutout algorithm. Represents the intersection operation.
[0234] Set the masking ratio of the adversarial patch to 0.25, that is, one quarter of the area of the entire adversarial patch will be masked, and set the fill value of the masked area to 0.5, that is, gray is used for filling.
[0235] Step 5: Input the human target image covered by the adversarial patch into the optimized target detection model for training; during the training process, construct an adaptive balancing strategy to dynamically adjust the loss value weight of each viewing channel;
[0236] The whole process is divided into three perspectives: front, side and oblique, for parallel training. The optimization training process is defined as:
[0237] (7)
[0238] In the formula, Indicates the total number of viewing angles, represents the number of samples, Indicates the training process The weight of the perspective, represents the distance loss function that measures the quality of the attack method, represents the optimized model, express From the perspective The true labels of the sample images, Indicates that after the anti-patch attack From the perspective images, Represents a random cropping method in the patch cut out algorithm. represents the adversarial loss function, Represents the image pixel range.
[0239] The distance loss function that measures the quality of the attack method includes three loss functions, model detection loss function , printable loss function And texture loss function ;
[0240] Distance loss function to measure the quality of attack methods for:
[0241] (8)
[0242] Model detection loss function is defined as:
[0243] (9)
[0244] Printable loss function is defined as:
[0245] (10)
[0246] In the formula, Indicates the attack method to generate adversarial patches A pixel of Represents a set of printable colors a color;
[0247] Texture loss function is defined as:
[0248] (11)
[0249] In the formula, is the adversarial sample image at coordinates The pixels below is the adversarial sample image at coordinates The pixels below is the adversarial sample image at coordinates The pixels below.
[0250] Adversarial Loss Function is defined as:
[0251] (12)
[0252] In the formula, yes for The probability output of the category, yes for The probability output of the category, and , Indicates the adversarial category, in order to distinguish it from category, randomly select a different Category against category.
[0253] Construct an adaptive balancing strategy to dynamically adjust the loss value weight of each visual channel, including the following steps: calculate the loss value of each visual channel;
[0254] The loss function of a single viewing channel is:
[0255] (13)
[0256] In the formula, Indicates The loss value from each perspective is represents the distance loss function that measures the quality of the attack method, represents the optimized model, represents the true label of the sample image, represents the image after the adversarial patch attack, Represents a random cropping method in the patch cut out algorithm. Represents resistance to loss, Indicates the image pixel range;
[0257] The weights of the calculated loss values of different viewing angle channels are adjusted: the weight values of the viewing angle channels with larger loss values are increased, and the loss values of each viewing angle channel are normalized as a whole to obtain the weight value of each viewing angle channel;
[0258] The process of normalizing the loss values of each viewing channel and calculating the viewing channel weight is as follows:
[0259] (14)
[0260] In the formula, Indicates the training process The weight of the perspective, Indicates the total number of viewing angles, Indicates The loss value from each perspective.
[0261] Step 6: Repeat steps 4-5 until the overall loss function converges to obtain the final adversarial sample.
[0262] The overall loss function is defined as:
[0263] (15).
Claims
1. A multi-view adaptive weighted balance adversarial attack method for pedestrian targets, characterized by: The specific steps include: Step 1: Select a human target image dataset and divide the images in the dataset into three perspectives: front, oblique, and side. Step 2: Input the human target images from different perspectives into the target detection model respectively, determine the attack position by center positioning, and randomly generate an adversarial patch; the target detection model adopts YOLOv5; Step 3: Optimize the target detection model; The optimized target detection model replaces the convolution modules in the 5th, 7th and 9th layers in the YOLOv5 backbone network with ModelShake Drop modules, wherein the Model Shake Drop module includes three 1×1 convolution layers, a Shake Drop module and a Sequential module; The Model Shake Drop module is an improved module based on the model shake drop algorithm. The model shake drop algorithm: During the forward propagation process, the shaking mechanism of the model shake drop algorithm randomly perturbs the model parameters. The process is defined as: (1) In the formula, For input data, Processing for the model residual module; is the jitter factor, which obeys the uniform distribution between [-1,1]; The random dropout mechanism in the forward propagation process sets the output of the neuron to zero with a certain probability. The process is: (2) In the formula, The probability of performing a discard operation follows a uniform distribution between [0,1]; The entire model shake drop algorithm integrates the shake mechanism and the random drop mechanism. The integration process of the shake mechanism and the random drop mechanism in the forward propagation is defined as: (3) In the formula, is the final output of the residual module; During the back-propagation process, it is defined as: (4) In the formula, is the loss function; Step 4: Process the adversarial patch through the patch cut out algorithm and cover the attack position of the human target image; The process of processing the adversarial patch through the patch cut out algorithm is as follows: Step 4.1: Generate a binary mask M, randomly select a rectangular area in the adversarial patch, and set the pixel values in the area to zero. The process is defined as: (5) In the formula, is a binary mask used for occlusion, (i, j) represents the pixel coordinates of the adversarial patch, and R represents a randomly selected rectangular area; Step 4.2: Use the resulting binary mask for occlusion The adversarial patch is processed to obtain the final adversarial patch for training. The process is defined as: (6) In the formula, is the output after the patch cut out algorithm. is the original input before the patch cut out algorithm. Indicates the intersection operation; Step 5: Input the human target image obtained in step 4 into the optimized target detection model for training; during the training process, construct an adaptive balance strategy to dynamically adjust the loss value weight of each viewing channel; During the training process, an adaptive balancing strategy is constructed to dynamically adjust the loss value weight of each visual channel, including the following steps: Calculate the loss value of each viewing angle channel; The loss function of a single viewing channel is: (13) In the formula, Indicates The loss value from each perspective is represents the distance loss function that measures the quality of the attack method, represents the optimized model, represents the true label of the sample image, represents the image after the adversarial patch attack, Represents a random cropping method in the patch cut out algorithm. Represents resistance to loss, Indicates the image pixel range; The weights of the calculated loss values of different viewing angle channels are adjusted: the weight values of the viewing angle channels with larger loss values are increased, and the loss values of each viewing angle channel are normalized as a whole to obtain the weight value of each viewing angle channel; The process of normalizing the loss values of each viewing channel and calculating the viewing channel weight is as follows: (14) In the formula, Indicates the training process The weight of the perspective, Indicates the total number of viewing angles, Indicates The loss value from each perspective; Step 6: Repeat steps 4-5 until the overall loss function converges to obtain the final adversarial sample.
2. The multi-view adaptive weight balancing counterattack method for pedestrian targets according to claim 1 is characterized in that: The training process described in step 5 is defined as: (7) In the formula, Indicates the total number of viewing angles, represents the number of samples, Indicates the training process The weight of the perspective, represents the distance loss function that measures the quality of the attack method, represents the optimized model, express From the perspective The true labels of the sample images, Indicates that after the anti-patch attack From the perspective images, Represents a random cropping method in the patch cut out algorithm. represents the adversarial loss function, Represents the image pixel range.
3. The multi-view adaptive weight balancing counterattack method for pedestrian targets according to claim 2 is characterized in that: The distance loss function for measuring the quality of the attack method includes three loss functions: model detection loss function , printable loss function And texture loss function ; Distance loss function to measure the quality of attack methods for: (8) Model detection loss function is defined as: (9) Printable loss function is defined as: (10) In the formula, Indicates the attack method to generate adversarial patches A pixel of Represents a set of printable colors a color; Texture loss function is defined as: (11) In the formula, is the adversarial sample image at coordinates The pixels below is the adversarial sample image at coordinates The pixels below is the adversarial sample image at coordinates The pixels below.
4. The multi-view adaptive weight balancing counterattack method for pedestrian targets according to claim 3 is characterized in that: Adversarial Loss Function is defined as: (12) In the formula, yes for The probability output of the category, yes for The probability output of the category, and , Indicates the adversarial category, in order to distinguish it from category, randomly select a different Category against category.
5. The multi-view adaptive weighted balance counterattack method for pedestrian targets according to claim 1, characterized in that: The overall loss function in step 6 is defined as: (15)。
