Transferable anti-attack method and device

Through the combination of noise generator and multi-visual model feature extractor, adversarial samples with strong generalization are generated, and robustness is improved through cropping and scaling, which solves the waste of computing resources and visual model attacks in adversarial sample generation between different tasks. difficult problem, achieving high attack success rate and strong migration capability.

CN118865026APending Publication Date: 2024-10-29FUDAN UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411028443.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

Existing migration adversarial attack methods need to regenerate adversarial samples between different tasks, resulting in a waste of computing resources and making it difficult to effectively attack different visual models.

Method used

Generate random noise and add it to the image through the noise generator, use multiple feature extractors to extract features from different visual models, calculate the loss function and update the noise generator, generate adversarial samples that can be generalized, and crop and scale them to Improve robustness.

Benefits of technology

It achieves a high attack success rate and strong transfer ability for any visual model, reduces the need for repeated training of adversarial samples, and improves the attack success rate and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865026A_ABST
    Figure CN118865026A_ABST
Patent Text Reader

Abstract

The invention provides a transferable attack resisting method and device, and the method is characterized in that the method comprises the following steps: S1, generating random noise; s2, obtaining an adversarial sample according to the random noise and the picture; s3, respectively inputting the picture and the corresponding adversarial sample into each feature extractor to respectively obtain a picture feature corresponding to the picture and an adversarial sample feature corresponding to the adversarial sample; s4, calculating a loss function value according to the picture features and the corresponding adversarial sample features; s5, updating a noise generator according to the average value of all the loss function values; s6, repeatedly executing the steps S1 to S5 until a preset termination condition is met, and obtaining an updated noise generator; and S7, generating a final confrontation sample according to the updated noise generator. In a word, the method can generate an adversarial sample with high attack success rate and strong migration capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence security, and in particular to a transferable anti-attack method and device. Background Art

[0002] In recent years, due to the great progress made in deep learning, a large number of deep learning models have been widely used in various industries. Among them, deep vision models are applied to various tasks such as image classification, object detection, instance segmentation, and pose estimation.

[0003] However, deep neural networks (DNNs), including convolutional neural networks (CNNs) and the latest visual self-attention models (ViTs), are vulnerable to adversarial examples. Adversarial examples refer to slightly perturbing the test input through some adversarial attack method, thereby tricking the DNN into making incorrect predictions. Existing adversarial attack methods can be roughly divided into two categories, namely white-box attacks and black-box attacks. The difference is that in the white-box attack setting, the attacker can obtain all the information of the victim model, including model structure, parameters, and gradient information. Black-box attacks can only estimate adversarial gradients by querying the target model, or use alternative models to generate transferable adversarial examples. Query-based attacks usually require a large number of queries on the target model. Compared with them, migration attacks can be said to be easier and cheaper to attack commercial application programming interfaces in the real world.

[0004] The core idea of ​​transfer attack is to use a substitute model to replace the black-box model to be attacked. The attacker has full access to the substitute model, so the attacker uses a white-box attack on the substitute model to generate adversarial samples, and then uses this adversarial sample to attack the black-box model. Classic methods of transfer attack include: Momentum Iterative (MI) method, Diverse Inputs (DI) method and model integration method.

[0005] The above classic methods all enhance the transfer aggressiveness of adversarial samples from different perspectives. However, the existing technologies only solve the migration problem between different models under the same task. For different tasks, the above methods still need to generate adversarial samples again, and this process consumes a lot of computing resources. Summary of the invention

[0006] The present invention is made to solve the above-mentioned problem, and its purpose is to provide a method and device for migrating anti-attack.

[0007] The present invention provides a transferable adversarial attack method for generating a final adversarial sample corresponding to a picture, which has the following characteristics: step S1, generating random noise corresponding to a picture by a noise generator; step S2, adding the corresponding random noise to the picture to obtain a corresponding adversarial sample; step S3, inputting the picture and the corresponding adversarial sample into respective feature extractors, respectively obtaining picture features corresponding to the picture and adversarial sample features corresponding to the adversarial sample, respectively; step S4, for each picture feature, calculating a loss function according to the picture feature and the corresponding adversarial sample feature, to obtain a corresponding loss function value; step S5, updating the noise generator according to the average value of all loss function values; step S6, repeatedly executing steps S1 to S5 until a preset termination condition is reached, thereby obtaining an updated noise generator; step S7, generating random noise corresponding to the picture according to the updated noise generator, and adding the random noise to the picture to obtain a final adversarial sample corresponding to the picture.

[0008] The transferable anti-attack method provided by the present invention may also have the following feature: the random noise has the same size as the corresponding image.

[0009] The transferable anti-attack method provided by the present invention may also have the following features: wherein each feature extractor is loaded on a different graphics card, and each feature extractor is extracted from a different visual model.

[0010] The transferable adversarial attack method provided by the present invention may also have the following feature: wherein, in step S3, each adversarial sample is randomly cropped and scaled to a specified size, and then input into a corresponding feature extractor.

[0011] The transferable anti-attack method provided by the present invention may also have the following characteristics: wherein, in step S4, the expression of the loss function is: In the formula is the loss function value, f clean is the image feature, f adv To counter the sample feature, aegmin δ CosSimilarity(f clean ,f adv ) is to minimize the cosine similarity between the image features and the adversarial sample features.

[0012] The present invention also provides a transferable anti-attack device, which is used to generate a final adversarial sample corresponding to a picture, and has the following characteristics: a noise generation module, including a noise generator, which is used to generate random noise corresponding to the picture; an adversarial sample generation module, which is used to add the corresponding random noise to the picture to obtain the corresponding adversarial sample; a feature extraction module, including multiple feature extractors, which are used to input the picture and the corresponding adversarial sample into each feature extractor respectively, and respectively obtain the picture features corresponding to the picture and the adversarial sample features corresponding to the adversarial sample; a loss function calculation module, which is used to calculate the loss function for each picture feature according to the picture features and the corresponding adversarial sample features, and obtain the corresponding loss function value; an update module, which is used to update the noise generator according to the average value of all loss function values; a judgment module, which stores a preset termination condition, which is used to judge whether the preset termination condition is met, if so, an updated noise generator is obtained, if not, the noise generation module is controlled to run; a general control module, which is used to control the noise generation module to generate random noise corresponding to the picture according to the updated noise generator, and control the adversarial sample generation module to add the random noise to the picture to obtain the final adversarial sample corresponding to the picture.

[0013] Functions and Effects of the Invention

[0014] According to the transferable adversarial attack method and device involved in the present invention, first, feature extraction is performed through feature extractors derived from different visual models of different tasks, which increases the generalization of adversarial noise and helps migration; second, the loss function is calculated based on the extracted features, so that the final adversarial sample obtained by training can conduct adversarial attacks on any visual model, without the need to repeatedly train adversarial samples based on specific visual models; third, by cropping and scaling the adversarial sample, the final adversarial sample has a certain robustness against the scaling defense of the visual model, further improving the attack success rate. Therefore, the transferable adversarial attack method and device of the present invention can generate adversarial samples with high attack success rate and strong migration ability. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 is a schematic diagram of the principle of a migratable anti-attack device in an embodiment of the present invention;

[0016] Figure 2 is a block diagram of a migratable anti-attack device in an embodiment of the present invention;

[0017] Figure 3 It is a flowchart of a method for migrating against attacks in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the following embodiments and the accompanying drawings specifically illustrate the transferable anti-attack method and device of the present invention.

[0019] This embodiment provides a transferable adversarial attack device for generating a final adversarial sample corresponding to a picture.

[0020] Figure 1 It is a schematic diagram of the principle of a migratable anti-attack device in an embodiment of the present invention.

[0021] like Figure 1 As shown, the transferable adversarial attack device adds adversarial noise to the clean sample, i.e., the image, to generate the corresponding adversarial sample, and then inputs the adversarial sample into n feature extractors, i.e., card 1: model 1 to card n: model n, in parallel to obtain the corresponding n feature representations, and then optimizes the adversarial noise through gradient aggregation and iteration according to all feature representations until the optimized adversarial noise is obtained. The adversarial sample obtained by combining the adversarial noise with the corresponding clean sample, i.e., the final adversarial sample, can be used to attack different types of models, such as models for image classification, models for target detection, etc.

[0022] Figure 2 It is a block diagram of a migratable anti-attack device in an embodiment of the present invention.

[0023] like Figure 2 As shown, the transferable anti-attack device 100 includes a noise generation module 10, an adversarial sample generation module 20, a feature extraction module 30, a loss function calculation module 40, an update module 50, a judgment module 60 and a general control module 70 for controlling the operation of the above modules.

[0024] The noise generating module 10 comprises a noise generator for generating random noise corresponding to the picture.

[0025] The random noise has the same size as the corresponding image.

[0026] The adversarial sample generation module 20 is used to add corresponding random noise to the image to obtain the corresponding adversarial sample.

[0027] The feature extraction module 30 includes a plurality of feature extractors, which are used to input the image and the corresponding adversarial sample into each feature extractor respectively, and obtain the image features corresponding to the image and the adversarial sample features corresponding to the adversarial sample respectively.

[0028] Among them, each feature extractor is loaded on a different graphics card, and each feature extractor extracts from a different visual model. The feature extractor set in this way can effectively enhance the scalability and provide convenient conditions for adding new visual models, that is, new feature extractors in the future.

[0029] Among them, each adversarial sample is randomly cropped and scaled to a specified size, and then input into the corresponding feature extractor. In this embodiment, the specified size is the same size as the image corresponding to the adversarial sample. By randomly cropping and scaling the adversarial sample, the adversarial sample has a certain robustness to scaling. Even if the attacked model scales the adversarial sample, the adversarial sample still has a high attack success rate.

[0030] The loss function calculation module 40 is used to calculate the loss function for each image feature according to the image feature and the corresponding adversarial sample feature to obtain the corresponding loss function value.

[0031] Among them, the expression of the loss function is:

[0032]

[0033] In the formula is the loss function value, f ckean is the image feature, f adv To counter the sample features, argmin δ CosSimilarity(f clean ,f adv ) is to minimize the cosine similarity between the image features and the adversarial sample features.

[0034] In this embodiment, the loss function is calculated using image features and adversarial sample features, that is, the cosine similarity defined in the feature layer is used as the loss function, so that the visual model of any task will be attacked by the adversarial samples generated by this embodiment, avoiding the need to set exclusive loss functions for visual models of different tasks, and thus avoiding the problem of repeated training of adversarial samples.

[0035] The updating module 50 is used to update the noise generator according to the average value of all loss function values.

[0036] In this embodiment, the average value of the loss function values ​​generated by multiple different feature extractors is used to update the noise generator. On the one hand, multiple different feature extractors are used to increase the generalization of adversarial noise, which is helpful for migration. On the other hand, the average value is processed to make the characteristics of the adversarial sample as far away as possible from the characteristics of the clean sample, that is, the image characteristics, thereby further improving the aggressiveness of the adversarial sample.

[0037] The judgment module 60 stores a preset termination condition, which is used to judge whether the preset termination condition is reached. If so, an updated noise generator is obtained, and if not, the noise generation module 10 is controlled to run. In this embodiment, the preset termination condition is the maximum attack step number, that is, the iteration is stopped when the iteration step number reaches the maximum attack step number.

[0038] The master control module 70 stores a control program for controlling the operation of each module. When an updated noise generator is obtained, the master control module 70 controls the noise generation module 10 to generate random noise corresponding to each image according to the updated noise generator, and controls the adversarial sample generation module 20 to add the random noise to the corresponding image to obtain the final adversarial sample corresponding to the image.

[0039] The following describes the process of using the migratable anti-attack device 100 to perform the migratable anti-attack method in conjunction with the accompanying drawings.

[0040] Figure 3 It is a flowchart of a method for migrating against attacks in an embodiment of the present invention.

[0041] like Figure 3 As shown, the transferable anti-attack method includes the following steps:

[0042] Step S1: Use the noise generation module 10 to generate random noise corresponding to the picture through a noise generator.

[0043] Step S2: using the adversarial sample generation module 20 to add the corresponding random noise to the image to obtain the corresponding adversarial sample.

[0044] Step S3, using the feature extraction module 30 to input the image and the corresponding adversarial sample into each feature extractor respectively, and obtain the image features corresponding to the image and the adversarial sample features corresponding to the adversarial sample respectively.

[0045] Step S4, using the loss function calculation module 40 to calculate the loss function for each image feature according to the image feature and the corresponding adversarial sample feature, to obtain the corresponding loss function value.

[0046] Step S5, using the updating module 50 to update the noise generator according to the average value of all loss function values.

[0047] Step S6, using the judgment module 60 to repeatedly execute steps S1 to S5 until a preset termination condition is reached, thereby obtaining an updated noise generator.

[0048] Step S7: The master control module 60 generates random noise corresponding to the image according to the updated noise generator, and adds the random noise to the image to obtain a final adversarial sample corresponding to the image.

[0049] In this embodiment, the existing cc3m dataset is constructed by data cleaning and screening to obtain the cc1m dataset. Then, according to the transferable adversarial attack method of this embodiment, that is, this method, the final adversarial samples corresponding to each image in the cc1m dataset are generated as the adversarial version cc1m dataset, and the adversarial version cc1m dataset is used to evaluate multiple visual models of different visual tasks. The results are shown in the following table:

[0050]

[0051]

[0052] Table 1 Robustness evaluation results of visual models for image classification tasks

[0053]

[0054] Table 2 Robustness evaluation results of visual models for instance segmentation tasks

[0055]

[0056] Table 3 Robustness evaluation results of visual models for semantic segmentation tasks In the above three tables, the first column is for each model, and the second column is for the corresponding relative robustness obtained by evaluating each model using the adversarial version of the cc1m dataset. It can be seen that the final adversarial samples generated by this method can conduct adversarial attacks on different models of different tasks and obtain discriminative relative robustness results. Therefore, this method can effectively evaluate the robustness of visual models under any task to adversarial attacks.

[0057] In this embodiment, the above-mentioned transferable adversarial attack method can be used to train multiple images at one time to obtain final adversarial samples, and these final adversarial samples can be used to conduct adversarial attacks on any visual model without the need to repeatedly train visual models for different tasks, and a higher attack success rate can be achieved. Therefore, the robustness of the visual model can be accurately evaluated based on the attack success rate, that is, the final adversarial samples generated by the transferable adversarial attack method of this embodiment can effectively evaluate the adversarial attack robustness of the visual model.

[0058] Functions and Effects of the Embodiments

[0059] According to the transferable adversarial attack method and device involved in this embodiment, first, feature extraction is performed through feature extractors derived from different visual models of different tasks, which increases the generalization of adversarial noise and helps migration; second, the loss function is calculated based on the extracted features, so that the final adversarial sample obtained by training can conduct adversarial attacks on any visual model, without the need to repeatedly train adversarial samples based on specific visual models; third, by cropping and scaling the adversarial sample, the final adversarial sample has a certain robustness against the scaling defense of the visual model, further improving the attack success rate. In short, this method can generate adversarial samples with a high attack success rate and strong migration ability.

[0060] Those skilled in the art should understand that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A transferable adversarial attack method for generating the final adversarial sample corresponding to the image, It is characterized in that The following steps are involved: Step S1, generating random noise corresponding to the image by a noise generator; Step S2, adding the corresponding random noise to the image to obtain a corresponding adversarial sample; Step S3, inputting the image and the corresponding adversarial sample into respective feature extractors, respectively obtaining image features corresponding to the image and adversarial sample features corresponding to the adversarial sample; Step S4, for each of the image features, calculating a loss function according to the image feature and the corresponding adversarial sample feature to obtain a corresponding loss function value; Step S5, updating the noise generator according to the average value of all the loss function values; Step S6, repeatedly executing steps S1 to S5 until a preset termination condition is reached, thereby obtaining the updated noise generator; Step S7, generating random noise corresponding to the image according to the updated noise generator, and adding the random noise to the image to obtain the final adversarial sample corresponding to the image.

2. The transferable anti-attack method according to claim 1, characterized in that: in, The random noise has the same size as the corresponding picture.

3. The transferable anti-attack method according to claim 1, characterized in that: in, Each of the feature extractors is loaded on a different graphics card, Each of the feature extractors is extracted from a different visual model.

4. The transferable anti-attack method according to claim 1, characterized in that: in, In step S3, each of the adversarial samples is randomly cropped and scaled to a specified size, and then input into the corresponding feature extractor.

5. The transferable anti-attack method according to claim 1, characterized in that: in, In step S4, the loss function is expressed as: In the formula is the loss function value, f clean is the image feature, f adv To counter the sample features, argmin δ CosSimilarity(f clean , f adv ) is to minimize the cosine similarity between the image features and the adversarial sample features.

6. A transferable adversarial attack device for generating a final adversarial sample corresponding to the image, It is characterized in that include: A noise generation module, comprising a noise generator, configured to generate random noise corresponding to the image; An adversarial sample generation module, used for adding the corresponding random noise to the image to obtain a corresponding adversarial sample; A feature extraction module, comprising a plurality of feature extractors, for inputting the image and the corresponding adversarial sample into each of the feature extractors, respectively, to obtain image features corresponding to the image and adversarial sample features corresponding to the adversarial sample; A loss function calculation module, used to calculate the loss function for each of the image features according to the image features and the corresponding adversarial sample features, to obtain a corresponding loss function value; An updating module, used for updating the noise generator according to an average value of all the loss function values; A judgment module, storing a preset termination condition, for judging whether the preset termination condition is reached, and if so, obtaining the updated noise generator, and if not, controlling the noise generation module to run; The general control module is used to control the noise generation module to generate random noise corresponding to the image according to the updated noise generator, and control the adversarial sample generation module to add the random noise to the image to obtain the final adversarial sample corresponding to the image.

Citation Information

Patent Citations

  • Image confrontation sample generation device and method based on mobility

    CN112215292A

  • Face verification attack method and device

    CN114626042A

  • Image generation model training method, image generation method and related device

    CN115019128A