A selective attack method and device based on associative learning

By optimizing the coupling relationship between spatial attention and global perturbation, generating associative attention and conducting selective attacks, it solves the problem of key areas where adversarial attacks are difficult to implement in the existing technology, and improves the robustness and performance of the model.

CN114492832BActive Publication Date: 2024-10-01BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111599832.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2024-10-01
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

It is difficult for existing technologies to achieve selective attacks on key areas of input images in adversarial attacks. Traditional adversarial training methods will affect the performance of clean images, and their potential has not been fully studied in other tasks.

Method used

Through the method based on associative learning, the coupling relationship between spatial attention and global perturbation is optimized, associative attention is generated, and selective perturbation is generated based on associative attention and global perturbation to perform selective attacks to target key areas of the input image. to attack.

Benefits of technology

It improves the attack capability on key areas of the input image and enhances the adversarial robustness of the deep neural network model, while maintaining good performance on clean images without affecting the performance of other tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492832B_ABST
    Figure CN114492832B_ABST
Patent Text Reader

Abstract

The present invention provides a selective attack method and device based on associative learning, the method comprising: optimizing the spatial attention according to the coupling relationship between the global perturbation and the spatial attention of the input image to generate associative attention; generating a selective perturbation according to the associative attention and the global perturbation, so as to selectively attack the input image according to the selective perturbation. The selective attack method and device based on associative learning provided by the present invention optimize the spatial attention to generate associative attention based on the coupling relationship between the global perturbation and the spatial attention, and based on the associative attention, attacks on key areas of the input image can be better achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a selective attack method and device based on associative learning. Background Art

[0002] Adversarial attacks on image recognition systems add slight perturbations to clean images. A slight perturbation of a benign input can drastically change the performance of a deep neural network (DNN) model. This change indicates that the DNN model has not learned basic visual concepts and is less robust to adversarial attacks. Many methods have also been proposed to defend against these attacks. Adversarial training is considered one of the most effective defenses. By adding adversarial samples to the input image for retraining, the model is made more capable of defending against attacks. Goodfellow proposed the Fast Gradient Sign Method (FGSM) in 2014 to generate adversarial samples, Kurakin proposed the Basic Iterative Method (BIM) in 2016, which requires multiple FGSM steps to improve the FGSM; Madry proposed the Projected Gradient Descent (PGD) in 2017 to perform adversarial attacks, which is a variant of BIM with uniform random noise as initialization. However, these methods usually add global perturbations to the input image samples. However, global attacks in adversarial training affect the key areas and data distribution of the image.

[0003] Although traditional adversarial training strategies can improve recognition performance on attacked images, their performance on clean images suffers. Moreover, their potential in other challenging tasks such as few-shot learning and object detection has not been thoroughly investigated. This is partly because traditional adversarial training methods add unselected adversarial attacks to the entire input image without a region selection process.

[0004] Although spatial attention has been introduced to achieve region selection of input images. However, spatial attention can only capture regions on the input image that are directly related to the task goal. When the input image is attacked, unimportant regions may be given too much attention, so the key regions may be ignored by attention due to the presence of perturbations.

[0005] Therefore, attention needs to be improved to better enable attacks on critical regions of the input image. Summary of the invention

[0006] The present invention provides a selective attack method based on associative learning, which is used to solve the defect in the prior art that it is difficult to attack the key area of ​​an input image.

[0007] In a first aspect, the present invention provides a selective attack method based on associative learning, comprising: optimizing the spatial attention according to the coupling relationship between the global perturbation and spatial attention of the input image to generate associative attention; generating selective perturbation according to the associative attention and the global perturbation to selectively attack the input image according to the selective perturbation.

[0008] According to a selective attack method based on associative learning provided by the present invention, before optimizing the spatial attention according to the coupling relationship between the global perturbation of the input image and the spatial attention, the global perturbation of the input image is obtained; the expression of the global perturbation is:

[0009]

[0010] Among them, δ is the global perturbation, x∈R H×H Indicates that the size of the input image x is H×H; G(W,x) is the cross entropy loss function, W is the weight of the deep neural network model; ∈ is the perturbation boundary, represents the gradient of the cross entropy loss function with respect to x, and sign() is the sign function.

[0011] According to a selective attack method based on associative learning provided by the present invention, the spatial attention is optimized according to the coupling relationship between the global perturbation of the input image and the spatial attention to generate associative attention, including:

[0012] Setting an objective function for optimizing the spatial attention;

[0013] Based on the objective function, determining an update strategy for the spatial attention;

[0014] Updating the spatial attention based on the update strategy to generate the associative attention;

[0015] The expression of the objective function is:

[0016]

[0017] The expression of the update strategy is:

[0018]

[0019] Wherein, Φ{W,M,δ} is a deep neural network model; M is the spatial attention; y is the label of the input image x; M a is the associative attention; ξ1 is the first learning rate, ξ2 is the second learning rate; Tr() represents the trace of the matrix.

[0020] According to a selective attack method based on associative learning provided by the present invention, the updating of the spatial attention based on the updating strategy to generate associative attention includes:

[0021] set up δ=[δ1,…,δ H ],M=[M1,…,M H ] T ;

[0022] The update strategy is transformed into a projection function to Conduct backtracking;

[0023]

[0024] Among them, ξ2γ is the step size of backtracking; γ is The linear kernel function of ; P() is the projection function; is a column vector; δ1,…,δ H is a column vector; M1,…,M H is a row vector; ° is the Hadamard product operator; Representation Matrix The nth column vector of .

[0025] According to a selective attack method based on associative learning provided by the present invention, the update strategy is converted into a projection function to After backtracking, set the triggering conditions for backtracking;

[0026] The expression of the trigger condition is:

[0027]

[0028] in, express Ranking; ζ is the preset backtracking threshold M n,m Represents the matrix element of the nth row and mth column of the M matrix; express The matrix element at the nth row and mth column of the matrix; Indicates M a The matrix element at the nth row and mth column of the matrix; δ n,m Represents the matrix element at the nth row and mth column of the δ matrix.

[0029] According to a selective attack method based on associative learning provided by the present invention, the selective perturbation is generated according to the associative attention and the global perturbation, and the calculation formula is:

[0030]

[0031] Among them, η is the selective perturbation; k() is the kernel function.

[0032] According to a selective attack method based on associative learning provided by the present invention, the input image is selectively attacked according to the selective perturbation, including: determining the key area for selective attack on the input image through the type of kernel function corresponding to the selective perturbation to generate adversarial samples; and using the adversarial samples to perform adversarial training on the deep neural network model.

[0033] In a second aspect, the present invention further provides a selective attack device based on associative learning, comprising:

[0034] An associative attention generation module, configured to optimize the spatial attention according to the coupling relationship between the global perturbation of the input image and the spatial attention, so as to generate associative attention;

[0035] A selective attack module is used to generate a selective perturbation according to the associative attention and the global perturbation, so as to selectively attack the input image according to the selective perturbation.

[0036] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-described selective attack methods based on associative learning are implemented.

[0037] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described selective attack methods based on associative learning.

[0038] The selective attack method and device based on associative learning provided by the present invention optimize the spatial attention to generate associative attention based on the coupling relationship between global perturbation and spatial attention, and can better implement the attack on the key area of ​​the input image based on the associative attention. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 It is a flow chart of the selective attack method based on associative learning provided by the present invention;

[0041] Figure 2 It is a schematic diagram of the associative adversarial learning framework provided by the present invention;

[0042] Figure 3 This is one of the comparison diagrams of adversarial training results provided by the present invention;

[0043] Figure 4 This is the second comparison chart of adversarial training results provided by the present invention;

[0044] Figure 5 It is a structural schematic diagram of a selective attack device based on associative learning provided by the present invention;

[0045] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] It should be noted that in the description of the embodiments of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. The orientation or position relationship indicated by the terms "upper", "lower" and the like is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. Unless otherwise clearly specified and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, or it can be a connection between two elements. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0048] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0049] Combine the following Figure 1-Figure 6 The selective attack method and device based on associative learning provided by the embodiments of the present invention are described.

[0050] Figure 1 It is a flow chart of the selective attack method based on associative learning provided by the present invention, such as Figure 1 As shown, including but not limited to the following steps:

[0051] Step 101: According to the coupling relationship between the global perturbation of the input image and the spatial attention, the spatial attention is optimized to generate associative attention.

[0052] For a global adversarial sample (image), its typical input expression is: x′=x+δ.

[0053] Where x∈R H×H represents an input image of size H×H; the input image is a clean image without added perturbations, δ is the global perturbation added to the clean image, and x′ is the global adversarial image.

[0054] The expression of global perturbation can be:

[0055]

[0056] Among them, δ is the global perturbation, x∈R H×H Indicates that the size of the input image x is H×H; G(W,x) is the cross entropy loss function, W is the weight of the deep neural network model; ∈ is the perturbation boundary, represents the gradient of the cross entropy loss function with respect to x, and sign() is the sign function.

[0057] Alternatively, spatial attention of clean images can be obtained based on the spatial attention mechanism. The attention mechanism can be applied to localization and understanding in images, image segmentation, image captioning, and lip reading. However, spatial attention can only capture areas on clean images that are directly related to the task goal. When the clean image is attacked, unimportant areas may be given too much attention, so the key areas may be ignored by the attention due to the presence of perturbations.

[0058] Spatial attention and global perturbations are traditionally considered independent of each other, however, they are coupled. For example, spatial attention can identify key regions in an input image, but when the input image is attacked, if the prediction model predicts incorrectly, the spatial attention may be mistakenly directed to a more valuable region of the wrong class.

[0059] Associative learning can imitate the human cognitive process, that is, building new knowledge by associating previously learned similar or related knowledge features. When humans see a perturbed image region, they can recall a related clean image and correct the region affected by the perturbation. Inspired by this, the present invention introduces associative attention, which associates adversarial images and clean images by utilizing the coupling information between spatial attention and global perturbations, and selects key image regions for attack.

[0060] Step 102: Generate a selective perturbation according to the associative attention and the global perturbation to selectively attack the input image according to the selective perturbation.

[0061] Optionally, a selective perturbation can be generated based on the kernelized associative attention and the global perturbation, and the selective perturbation is added to the input image to achieve a selective attack on the input image.

[0062] The present invention provides a selective attack method based on associative learning. Based on the coupling relationship between global perturbation and spatial attention, spatial attention is optimized to generate associative attention, and based on the associative attention, the attack on the key area of ​​the input image can be better achieved.

[0063] Optionally, in order to calculate the associative attention, three different associative attention variables M, and M a Where M is the original spatial attention of the clean image obtained by the attention mechanism CBAM; when the traditional attack method is used to calculate the local perturbation, M is also updated by gradient descent to based on The coupling relationship with the global disturbance δ is: is further traced back to obtain the final associative attention M a .

[0064] The objective function for optimizing the initial spatial attention M is defined as:

[0065]

[0066] Wherein, Φ{W,M,δ} is a deep neural network model; M is the spatial attention; y is the label of the input image x; M a is the associative attention; G is the cross entropy loss function.

[0067] Traditional adversarial learning methods solve appropriate perturbations and attention independently by minimizing the objective function. However, the present invention considers the coupling information between M and δ and calculates M based on gradient descent. a , and defined a new chain-rule based spatial attention update strategy.

[0068]

[0069] Wherein, ξ1 is the first learning rate, ξ2 is the second learning rate; Tr() represents the trace of the matrix. The present invention further defines:

[0070]

[0071] in, is defined by considering the coupled optimization problem as in formula (2), then:

[0072]

[0073] Definition of the invention δ=[δ1,…,δ H ],M=[M1,…,M H ] T .

[0074] It should be noted that in the following formulas, variables with subscripts are vectors if they have only one subscript, and matrix elements if they have two subscripts. For example, express The nth column vector of m represents the mth column vector of δ, M 1,m Represents the matrix element in the 1st row and the mth column of the M matrix, M H,m represents the matrix element at the Hth row and mth column of the M matrix, M n,m is the matrix element at row n and column m.

[0075] in, is a column vector, δ1,…,δ H is the column vector of δ, M1,…,M His the row vector of M; assuming that the matrix elements in δ and M are independent when they are in different columns, then:

[0076]

[0077]

[0078] Combining Formula 6 and Formula 7, we can get:

[0079]

[0080] Therefore, formula (5) can be expressed as:

[0081]

[0082] Furthermore, define for:

[0083]

[0084] Combining formulas (3), (9) and (10), we can get the method of backtracking, then M a The calculation formula is:

[0085]

[0086] Among them, ξ2γ is the step size of backtracking; γ is The linear kernel function of ; P() is the projection function. In order to simplify the calculation, Can be used Approximately, it represents the change of δ relative to M. Formula (11) shows that the present invention is actually based on a projection function to solve the coupled optimization problem.

[0087] In order to better associate clean images with adversarial images, M a Attention to severely disturbed areas needs to be compensated during the updating process.

[0088] To this end, the present invention introduces the triggering condition of backtracking, which is defined as:

[0089]

[0090] Among them, δ n,m represents the element of the perturbation matrix, and P() represents the projection function, as shown in Formula 11, Will produce m×n elements, express That is to say If the ranking is greater than the preset backtracking threshold ζ, the backtracking condition is triggered, M n,m Represents the matrix element of the nth row and mth column of the M matrix; express The matrix element at the nth row and mth column of the matrix; Indicates M a The matrix element at the nth row and mth column of the matrix; δ n,m Represents the matrix element at the nth row and mth column of the δ matrix.

[0091] This paper introduces the coupling relationship between spatial attention and global perturbation, and explains that spatial attention will mislead the learning of key areas to a certain extent; further, this paper provides a method of attention backtracking to obtain robust associative attention consistent with the human associative mechanism, and further explains how associative attention is calculated:

[0092] The present invention formulates the intrinsic relationship between spatial attention and global perturbation as a coupled optimization problem to improve their interaction. In particular, the global perturbation of traditional adversarial attacks is used for attention regression, and the improved associative attention is used to locate the key areas for selective attack.

[0093] A selective perturbation is generated according to the associative attention and the global perturbation, and the calculation formula is:

[0094]

[0095] Among them, η is the selective perturbation; k() is the kernel function, M a ∈R H×H It is associative attention. Denotes the Hadamard product.

[0096] The present invention provides a method for selecting key areas to apply perturbations using associative attention, which has the advantage that it can handle different tasks, including adversarial training, target detection, and few-shot learning. The difference in each task is the selection of key areas for attack. For example, attacks on the image background can enhance the feature extraction ability of deep neural network models, while attacks on the foreground can improve the generalization ability and robustness of deep neural network models in adversarial training and target detection. To this end, the present invention introduces a kernelized version of associative attention for different tasks to select background or foreground for selective attack.

[0097] For example, when k(M a )=M a or When , the key area for selective attack on the input image is the foreground; when When , the key area for selective attack on the input image is often the background.

[0098] The target adversarial samples for selective attack are obtained in the following way:

[0099]

[0100] In the above way, more target adversarial samples can be obtained to perform adversarial training on deep neural network models.

[0101] Figure 2 Schematic diagram of the associative adversarial learning framework provided by the present invention, such as Figure 2 As shown, the present invention optimizes the spatial attention to generate associative attention based on the coupling information between collaborative perturbation and spatial attention, and finally guides the attack on the clean image through the kernelized associative attention, and finally generates adversarial images to train the deep neural network model to improve the robustness of the adversary.

[0102] In order to verify the effectiveness of associative adversarial learning (AAL), the present invention conducted the following tests on the adversarial training task:

[0103] CIFAR10 is a popular image recognition dataset that contains 60K images, of which 50K images are training sets and the remaining 10K images are test sets. These images include 10 different categories with a resolution of 32 × 32. ImageNet ILSVRC2012 is a commonly used large-scale image recognition dataset that contains 1,000 categories, 1.2 million training images, and 50K validation images.

[0104] The present invention has been experimented in both CIFAR10 and ImageNet datasets. First, ResNet-18 or WRN-34-10 is used to test CIFAR10, while ResNet-50 is used to test ImageNet. The present invention uses the FGSM adversarial training method on CIFAR10 and ImageNet, with a perturbation boundary of 8 / 255 and a step size of 2 / 255. And PGD is used on CIFAR10, with a perturbation boundary of 8 / 255, a step size of 2 / 255, and 10 iterations. The present invention uses an SGD optimizer with a momentum of 0.9 and a weight decay of 5*10^{-4}. The initial learning rate of CIFAR10 is set to 0.1, and the initial learning rate of ImageNet is set to 0.2.

[0105] In the present invention, the parameters of associative attention can be set as follows: ξ2 = 0.1, ζ = 0.1, The present invention trains 250 rounds on CIFAR10 and 250 rounds on ImageNet; and evaluates the AAL method under clean image datasets, FGSM attacks, and PGD-10 attacks.

[0106] Figure 3 is one of the comparison diagrams of adversarial training results provided by the present invention, such as Figure 3 As shown, Figure 3 The results of AAL and other different adversarial training on CIFAR10 are compared. Comparing AAL+FGSM training and clean training, it is worth noting that although the verification accuracy of clean training is slightly better than AAL+FGSM (95.46% vs 95.40%) on the clean image dataset, AAL+FGSM significantly improves the adversarial robustness of the model (20.18% vs 83.85%).

[0107] In addition, after integrating AAL into FGSM (AAL+FGSM), the validation accuracy of the FGSM baseline increased by 2.85% (from 92.55% to 95.40%), 1.45% (from 82.40% to 83.85%), and 1.25% (from 41.64% to 42.89%) on the clean image dataset, FGSM adversarial dataset, and PGD adversarial dataset, respectively. Similarly, compared with the PGD baseline, the accuracy of AAL+PGD training increased by 2.82% (from 86.88% to 89.70%), 6.1% (from 62.68% to 68.78%), and 13.19% (from 47.69% to 60.88%) on the three validation datasets, respectively.

[0108] Figure 4 This is the second comparison chart of the adversarial training results provided by the present invention. Figure 4 As shown, Figure 4 The comparison results on ImageNet are shown. AAL improves the verification accuracy of the FGSM method on the clean image dataset and the FGSM adversarial dataset by 13.99% (from 58.74 to 72.73%) and 8.32% (from 52.64% to 60.96%), respectively, and the verification accuracy on the clean image dataset (72.73%) is almost equivalent to the accuracy of clean training (73.80%).

[0109] The results show that AAL can indeed enhance the robustness of deep neural network models to perturbations without losing their generalization ability to call information from clean images, thereby effectively promoting performance improvements.

[0110] Figure 5 It is a structural schematic diagram of the selective attack device based on associative learning provided by the present invention, comprising: an associative attention generation module 501; and a selective attack module 502.

[0111] The associative attention generation module 501 is used to optimize the spatial attention according to the coupling relationship between the global perturbation of the input image and the spatial attention to generate the associative attention;

[0112] The selective attack module 502 is used to generate a selective perturbation according to the associative attention and the global perturbation, so as to selectively attack the input image according to the selective perturbation.

[0113] The present invention provides a selective attack device based on associative learning. Based on the coupling relationship between global perturbation and spatial attention, spatial attention is optimized to generate associative attention, and based on the associative attention, attacks on key areas of an input image can be better achieved.

[0114] It should be noted that the selective attack device based on associative learning provided in the embodiment of the present invention can execute the selective attack method based on associative learning described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.

[0115] Figure 6 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute a selective attack method based on associative learning, the method comprising: optimizing the spatial attention according to the coupling relationship between the global perturbation and the spatial attention of the input image to generate associative attention; generating a selective perturbation according to the associative attention and the global perturbation to selectively attack the input image according to the selective perturbation.

[0116] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0117] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the selective attack method based on associative learning provided by the above-mentioned methods, and the method includes: according to the coupling relationship between the global perturbation and spatial attention of the input image, optimizing the spatial attention to generate associative attention; generating selective perturbation according to the associative attention and the global perturbation to selectively attack the input image according to the selective perturbation.

[0118] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the selective attack method based on associative learning provided in the above-mentioned embodiments, the method comprising: optimizing the spatial attention according to the coupling relationship between the global perturbation and the spatial attention of the input image to generate associative attention; generating a selective perturbation according to the associative attention and the global perturbation to selectively attack the input image according to the selective perturbation.

[0119] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0120] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0121] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A selective attack method based on associative learning, characterized in that: include: According to the coupling relationship between the global perturbation of the input image and the spatial attention, the spatial attention is optimized to generate associative attention; generating a selective perturbation according to the associative attention and the global perturbation to selectively attack the input image according to the selective perturbation; Before optimizing the spatial attention according to the coupling relationship between the global perturbation of the input image and the spatial attention, obtaining the global perturbation of the input image; The expression of the global perturbation is: Among them, δ is the global perturbation, x∈R H×H Indicates that the size of the input image x is H×H; G(W,x) is the cross entropy loss function, W is the weight of the deep neural network model; ∈ is the perturbation boundary, represents the gradient of the cross entropy loss function with respect to x, and sign() is the sign function; The step of optimizing the spatial attention according to the coupling relationship between the global perturbation of the input image and the spatial attention to generate associative attention includes: Setting an objective function for optimizing the spatial attention; Based on the objective function, determining an update strategy for the spatial attention; Updating the spatial attention based on the update strategy to generate the associative attention; The expression of the objective function is: The expression of the update strategy is: Wherein, Φ{W,M,δ} is a deep neural network model; M is the spatial attention; y is the label of the input image x; M a is the associative attention; ξ1 is the first learning rate, ξ2 is the second learning rate; Tr() represents the trace of the matrix.

2. The selective attack method based on associative learning according to claim 1, characterized in that: The updating of the spatial attention based on the updating strategy to generate the associative attention includes: set up δ=[δ1,…,δ H ],M=[M1,…,M H ] T ; The update strategy is transformed into a projection function to Conduct backtracking; Among them, ξ2γ is the step size of backtracking; γ is The linear kernel function of ; P() is the projection function; is a column vector; δ1,…,δ H is a column vector; M1,…,M H is a row vector; ° is the Hadamard product operator; Representation Matrix The nth column vector of .

3. The selective attack method based on associative learning according to claim 2, characterized in that: In converting the update strategy into a projection function, After backtracking, set the triggering conditions for backtracking; The expression of the trigger condition is: in, express ζ is the preset backtracking threshold, M n,m Represents the matrix element of the nth row and mth column of the M matrix; express The matrix element at the nth row and mth column of the matrix; Indicates M a The matrix element at the nth row and mth column of the matrix; δ n,m Represents the matrix element at the nth row and mth column of the δ matrix.

4. The selective attack method based on associative learning according to claim 3 is characterized in that: The selective disturbance is generated according to the associative attention and the global disturbance, and the calculation formula is: Where η is the selective perturbation; k(M a ) is M a The kernel function of .

5. The selective attack method based on associative learning according to claim 4, characterized in that: Performing a selective attack on the input image according to the selective perturbation includes: Determining a key area for selectively attacking the input image by using a type of kernel function corresponding to the selective perturbation to generate a target adversarial sample; The deep neural network model is subjected to adversarial training based on the target adversarial sample.

6. A selective attack device based on associative learning, characterized in that: include: An associative attention generation module, configured to optimize the spatial attention according to the coupling relationship between the global perturbation of the input image and the spatial attention, so as to generate associative attention; Before optimizing the spatial attention according to the coupling relationship between the global perturbation of the input image and the spatial attention, obtaining the global perturbation of the input image; The expression of the global perturbation is: Among them, δ is the global perturbation, x∈R H×H Indicates that the size of the input image x is H×H; G(W,x) is the cross entropy loss function, W is the weight of the deep neural network model; ∈ is the perturbation boundary, represents the gradient of the cross entropy loss function with respect to x, and sign() is the sign function; The step of optimizing the spatial attention according to the coupling relationship between the global perturbation of the input image and the spatial attention to generate associative attention includes: Setting an objective function for optimizing the spatial attention; Based on the objective function, determining an update strategy for the spatial attention; Updating the spatial attention based on the update strategy to generate the associative attention; The expression of the objective function is: The expression of the update strategy is: Wherein, Φ{W,M,δ} is a deep neural network model; M is the spatial attention; y is the label of the input image x; M a is the associative attention; ξ1 is the first learning rate, ξ2 is the second learning rate; Tr() represents the trace of the matrix; A selective attack module is used to generate a selective perturbation according to the associative attention and the global perturbation, so as to selectively attack the input image according to the selective perturbation.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the selective attack method based on associative learning as claimed in any one of claims 1 to 5 are implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the selective attack method based on associative learning as claimed in any one of claims 1 to 5 are implemented.