Adversarial defense method and related device for image classification network
By extracting high-order features and gradient regularization of deep neural networks, an adversarial defense denoiser is generated to denoise adversarial attack samples and regularize the loss function, which solves the problem of deep neural networks being vulnerable to adversarial sample attacks and improves improve its defense capabilities and classification accuracy.
Patent Information
- Application Number
- CN201910879339.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-18
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2039-09-18
AI Technical Summary
Deep neural networks are vulnerable to adversarial sample attacks, leading to classification errors, and it is difficult for existing technologies to effectively improve their defense capabilities.
By inputting the original image samples and adversarial attack samples into the deep neural network, extracting the input features of the target layer higher than the predetermined number of layers, generating a loss function as an adversarial defense denoiser, denoising the adversarial attack samples, and improving the depth of the deep neural network. The loss function is regularized to form a regularized network to improve defense capabilities.
It effectively improves the defense capabilities of deep neural networks, enhances the robustness and classification accuracy of adversarial attacks, and can better adapt to different types of adversarial attacks.
Smart Images

Figure CN110717522B
Abstract
Description
Background Art
[0002] With the in-depth application in the fields of images, voice and video, the requirements for information security of deep neural networks are getting higher and higher. Although deep neural networks can have very high accuracy in the process of image classification, adding slight noise disturbance to the samples will often cause classification errors of the neural network. Due to its vulnerability to adversarial sample attacks, deep neural networks are required to improve their defense capabilities and reduce the possibility of adversarial samples deceiving the network.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The purpose of this application is to provide an adversarial defense solution for image classification networks, thereby improving the defense capabilities of image classification deep neural networks at least to a certain extent.
[0005] According to one aspect of the present application, a method for adversarial defense of an image classification network is provided, comprising:
[0006] Inputting the original image sample and the adversarial attack sample into a deep neural network to extract input features of a target layer of the deep neural network that is higher than a predetermined number of layers;
[0007] Generating a loss function of the deep neural network based on the input features as an adversarial defense denoiser;
[0008] De-noising the adversarial attack sample using the adversarial defense denoiser to obtain a denoised adversarial attack sample;
[0009] Regularizing the loss function of the deep neural network to obtain a regularized deep neural network;
[0010] The original image sample and the denoised adversarial attack sample are input into the regularized deep neural network to obtain a classification result of the original image.
[0011] In one implementation of this example, the anti-attack sample includes:
[0012] When an original image sample is received, noise is applied to the original image sample to obtain an adversarial attack sample corresponding to the original image sample.
[0013] In one implementation of this example, the anti-attack sample includes:
[0014] When receiving an original image sample, adding noise to the original image sample using noise adding means corresponding to a plurality of deep neural networks to obtain a plurality of adversarial attack samples;
[0015] The step of inputting the original image sample and the adversarial attack sample into the deep neural network to extract input features of a target layer of the deep neural network higher than a predetermined number of layers comprises:
[0016] Inputting the original image sample and each of the adversarial attack samples into a deep neural network respectively, and extracting sub-input features of a target layer of the deep neural network higher than a predetermined number of layers respectively;
[0017] Get a set of all sub-input features as the input feature.
[0018] In one implementation of this example, inputting the original image sample and the adversarial attack sample into the deep neural network includes:
[0019] Adjusting the network parameters of the original image sample and the adversarial attack sample to be consistent;
[0020] The original image sample and the adversarial attack sample whose network parameters are adjusted to be consistent are input into the deep neural network.
[0021] In one implementation of this example, generating the loss function of the deep neural network according to the input features as an adversarial defense denoiser includes:
[0022] According to the formula L=||f l (x')-f l (x)||Generate the loss function of the deep neural network as an adversarial defense denoiser, where the f l (x') is the network feature of the predetermined layer of the deep neural network input by the adversarial attack sample extracted from the input feature, l (x) is the network feature of the predetermined layer of the deep neural network inputted by the original image sample extracted from the input feature, L=||f l (x')-f l (x)|| represents the loss value of the original image sample network features relative to the adversarial attack sample network features.
[0023] In one implementation of this example, regularizing the loss function of the deep neural network to obtain a regularized deep neural network includes:
[0024] According to the formula L(ω,b)=R(ω,b)+λ||ω|| 2The loss function of the deep neural network is regularized to obtain a regularized deep neural network, where L(ω, b) is the loss function after regularization, R(ω, b) is the loss function before regularization, and λ||ω|| 2 is the regularization term, and λ is the regularization coefficient.
[0025] In one implementation of this example, the step of inputting the original image sample and the adversarial attack sample into a deep neural network to extract input features of a target layer higher than a predetermined layer of the deep neural network includes:
[0026] Input the original image sample into the deep neural network, and extract the first network feature of the target layer of the original image sample input into the deep neural network;
[0027] Inputting the adversarial attack sample into the deep neural network, and extracting a second network feature of a target layer of the adversarial attack sample input into the deep neural network;
[0028] The input feature is generated according to the first network feature and the second network feature.
[0029] According to one aspect of the present application, a confrontation defense device for an image classification network is provided, comprising:
[0030] An extraction module, used to input the original image sample and the adversarial attack sample into the deep neural network to extract input features of a target layer of the deep neural network higher than a predetermined number of layers;
[0031] A generation module, for generating a loss function of the deep neural network according to the input features as an adversarial defense denoiser;
[0032] A denoising module, used to denoise the adversarial attack sample using the adversarial defense denoiser to obtain a denoised adversarial attack sample;
[0033] A regularization module, used to regularize the loss function of the deep neural network to obtain a regularized deep neural network;
[0034] The classification module inputs the original image sample and the denoised adversarial attack sample into the regularized deep neural network to obtain the classification result of the original image.
[0035] According to one aspect of the present application, a computer-readable storage medium is provided, on which an adversarial defense program for an image classification network is stored, and when the adversarial defense program for the image classification network is executed by a processor, any of the methods described above is implemented.
[0036] According to one aspect of the present application, an electronic device is provided, including:
[0037] Processor; and
[0038] A memory for storing an adversarial defense program for an image classification network of the processor; wherein the processor is configured to execute any of the above-mentioned methods by executing the adversarial defense program for the image classification network.
[0039] The present application discloses an adversarial defense method and device for an image classification network. First, the original image sample and the adversarial attack sample are input into a deep neural network to extract the input features of the target layer of the deep neural network higher than a predetermined number of layers; in this way, the high-order neural network features with sufficiently high order and obvious differences can be extracted. Then, the loss function of the deep neural network is generated according to the input features as an adversarial defense denoiser; in this way, the loss function can be generated based on the input features with obvious differences, which can effectively ensure the effect of the neural network model and the optimization goal. Secondly, the adversarial attack sample is denoised by the adversarial defense denoiser to obtain the denoised adversarial attack sample; in this way, the defense means of the deep neural network can be realized by denoising the adversarial attack sample based on the features of the adversarial attack sample and the original image sample, so that the adversarial attack sample can be linked to the defense. Then, the loss function of the deep neural network is regularized to obtain the regularized deep neural network; the parameters are optimized by regularizing the loss function to further ensure the effect of the deep learning model. Finally, the original image sample and the denoised adversarial attack sample are input into the regularized deep neural network to obtain the classification result of the original image. Combining high-order features and gradient regularization, the image obtained by denoising the attack sample with high-order feature loss is input into the original neural network after gradient regularization, which can better improve the defense capability of deep neural networks.
[0040] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0042] Figure 1 A flowchart of an adversarial defense method for an image classification network is schematically shown.
[0043] Figure 2A diagram schematically illustrates an example application scenario of an adversarial defense method for an image classification network.
[0044] Figure 3 A flow chart of a sample input method is schematically shown.
[0045] Figure 4 A block diagram of an adversarial defense device for an image classification network is schematically shown.
[0046] Figure 5 An example block diagram of an electronic device for implementing the adversarial defense method of the above-mentioned image classification network is schematically shown.
[0047] Figure 6 A computer-readable storage medium for implementing the adversarial defense method of the above-mentioned image classification network is schematically shown. DETAILED DESCRIPTION
[0048] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present application will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical solutions of the present application may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present application.
[0049] In addition, the accompanying drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0050] In this exemplary embodiment, a method for defending against an image classification network is first provided. The method for defending against an image classification network can be run on a server, a server cluster, a cloud server, etc. Of course, those skilled in the art can also run the method of the present invention on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1As shown, the adversarial defense method of the image classification network may include the following steps:
[0051] Step S110, inputting the original image sample and the adversarial attack sample into a deep neural network to extract input features of a target layer of the deep neural network that is higher than a predetermined number of layers;
[0052] Step S120, generating a loss function of the deep neural network according to the input features as an adversarial defense denoiser;
[0053] Step S130, denoising the adversarial attack sample using the adversarial defense denoiser to obtain a denoised adversarial attack sample;
[0054] Step S140, regularizing the loss function of the deep neural network to obtain a regularized deep neural network;
[0055] Step S150, inputting the original image sample and the denoised adversarial attack sample into the regularized deep neural network to obtain a classification result of the original image.
[0056] In the above-mentioned adversarial defense method of the image classification network, first, the original image sample and the adversarial attack sample are input into the deep neural network to extract the input features of the target layer of the deep neural network higher than the predetermined number of layers; in this way, the high-order neural network features with sufficiently high order and obvious differences can be extracted. Then, the loss function of the deep neural network is generated according to the input features as an adversarial defense denoiser; in this way, the loss function can be generated based on the input features with obvious differences, which can effectively ensure the effect of the neural network model and the optimization goal. Secondly, the adversarial attack sample is denoised by using the adversarial defense denoiser to obtain the denoised adversarial attack sample; in this way, the defense means of the deep neural network can be realized by denoising the adversarial attack sample based on the denoiser generated by the features of the adversarial attack sample and the original image sample, so that the adversarial attack sample is linked to each other. Then, the loss function of the deep neural network is regularized to obtain the regularized deep neural network; the parameters are optimized by regularizing the loss function to further ensure the effect of the deep learning model. Finally, the original image sample and the denoised adversarial attack sample are input into the regularized deep neural network to obtain the classification result of the original image. Combining high-order features and gradient regularization, the image obtained by denoising the attack sample with high-order feature loss is input into the original neural network after gradient regularization, which can better improve the defense capability of deep neural networks.
[0057] Below, each step in the adversarial defense method of the above-mentioned image classification network in this example implementation will be explained and illustrated in detail with reference to the accompanying drawings.
[0058] In step S110, the original image samples and the adversarial attack samples are input into a deep neural network to extract input features of a target layer of the deep neural network that is higher than a predetermined number of layers.
[0059] In the implementation of this example, reference Figure 2 As shown, after server 201 crawls the original image samples and adversarial attack samples from server 202, it inputs the deep neural network deployed on server 201, and extracts the input features of the target layer of the deep neural network that is higher than the predetermined number of layers. In this way, in the subsequent steps, server 201 can generate the loss function of the deep neural network according to the input features as an adversarial defense denoiser. It can be understood that in the subsequent steps, if conditions permit, server 202 can also directly obtain the original image samples and adversarial attack samples from its own storage space. Among them, server 201 and server 202 can be any device with processing capabilities, such as computers, cloud servers, microprocessors, etc., and are not specifically limited here.
[0060] The input features of the target layer higher than the predetermined layer of the deep neural network, that is, the input features of the target layer higher than the predetermined layer in each layer of the deep neural network from low to high when classifying the image sample. For example, the high-order features of the high-order convolution layer of the convolutional neural network. The determination of the predetermined layer can be set according to the requirements, such as 3 layers, 4 layers, etc.
[0061] The difference between the adversarial attack sample and the original image at the image level is small, but the difference is obvious in the high-order features of the convolutional neural network, for example. By extracting the high-order features of the neural network of the original image sample and the adversarial attack sample and comparing and analyzing the differences between the two, we can have stronger robustness in dealing with different adversarial attacks.
[0062] In one embodiment, the anti-attack sample includes:
[0063] When an original image sample is received, noise is applied to the original image sample to obtain an adversarial attack sample corresponding to the original image sample.
[0064] The adversarial attack methods are mainly white-box and black-box attacks based on FGSM and I-FGSM. FGSM mainly attacks by adding incremental noise or single-pixel modification in the gradient direction, thereby inducing the network to misclassify the generated image adversarial samples. Compared with white-box attacks, black-box attacks do not need to know the specific information of the attacked model, are applicable to different network models, and have better attack transferability.
[0065] Therefore, adding noise to the original image sample is to add noise through an adversarial attack method to obtain an adversarial attack sample corresponding to the original image sample, so as to ensure the correspondence between the original image and the adversarial attack sample.
[0066] In one embodiment, the anti-attack sample includes:
[0067] When receiving an original image sample, adding noise to the original image sample using noise adding means corresponding to a plurality of deep neural networks to obtain a plurality of adversarial attack samples;
[0068] The step of inputting the original image sample and the adversarial attack sample into the deep neural network to extract input features of a target layer of the deep neural network higher than a predetermined number of layers comprises:
[0069] Inputting the original image sample and each of the adversarial attack samples into a deep neural network respectively, and extracting sub-input features of a target layer of the deep neural network higher than a predetermined number of layers respectively;
[0070] Get a set of all sub-input features as the input feature.
[0071] The noise adding methods of various deep neural networks are various adversarial attack methods. By adding noise to the original image samples in turn through various adversarial attack methods, multiple adversarial attack samples can be obtained. In this way, the attack methods of multiple networks (resnet, Inception, nasnet and other networks) can be combined to obtain multiple adversarial images of the original image. Then, the original image sample and each adversarial attack sample are respectively input into the deep neural network, and after extracting the sub-input features of the target layer of the deep neural network higher than the predetermined number of layers, a set of sub-input features is obtained as the input feature. Extracting a high-order feature set to determine the loss function setting of the deep neural network in subsequent steps can ensure that the defense model has better generalization ability. At the same time, the neural network applicable to the denoising method of the adversarial defense denoiser obtained based on the difference in high-order features is not limited to the current network, and has a wide range of resistance to similar attacks.
[0072] In one embodiment, the anti-attack sample includes:
[0073] When receiving an original image sample, adding noise to the original image sample by combining noise adding means of multiple deep neural networks to obtain an adversarial attack sample;
[0074] The step of inputting the original image sample and the adversarial attack sample into the deep neural network to extract input features of a target layer of the deep neural network higher than a predetermined number of layers comprises:
[0075] The original image sample and the adversarial attack sample are input into a deep neural network, and input features of a target layer of the deep neural network that is higher than a predetermined number of layers are extracted.
[0076] In this way, after obtaining the adversarial image of the original image by combining the attack methods of multiple networks (resnet, Inception, nasnet and other networks), the sum of the high-order features of the target layer of the deep neural network that is higher than the predetermined number of layers can be extracted to determine the loss function setting of the deep neural network in the subsequent steps. This can further ensure that the defense model has better generalization ability. At the same time, the denoising method of the adversarial defense denoiser obtained based on the difference in high-order features is applicable to neural networks that are not limited to the current network, and has a wider resistance to similar attacks.
[0077] In one embodiment, reference Figure 3 As shown, inputting the original image sample and the adversarial attack sample into the deep neural network includes:
[0078] Step S310, adjusting the network parameters of the original image sample and the anti-attack sample to be consistent;
[0079] Step S320, inputting the original image sample and the adversarial attack sample with the network parameters adjusted to be consistent into a deep neural network.
[0080] The network parameters are the number of samples, sample length, sample width, sample depth (corresponding to the number of image channels), etc. By adjusting the network parameters of the original image sample and the adversarial attack sample to be consistent, the comparability of the two samples input into the deep neural network can be ensured.
[0081] In one embodiment, inputting the original image sample and the adversarial attack sample into a deep neural network to extract input features of a target layer higher than a predetermined layer of the deep neural network includes:
[0082] Input the original image sample into the deep neural network, and extract the first network feature of the target layer of the original image sample input into the deep neural network;
[0083] Inputting the adversarial attack sample into the deep neural network, and extracting a second network feature of a target layer of the adversarial attack sample input into the deep neural network;
[0084] The input feature is generated according to the first network feature and the second network feature.
[0085] In step S120, a loss function of the deep neural network is generated according to the input features as an adversarial defense denoiser.
[0086] In the implementation of this example, the effect of the neural network model and the optimization target are defined by a loss function. According to the input features of the target layer of the deep neural network higher than the predetermined layer obtained in the above steps, the loss function of the deep learning network is generated by utilizing the obvious difference characteristics of the high-order input features (input features of the target layer higher than the predetermined layer), which can make the effect of the neural network model corresponding to the loss function and the optimization target more significant. Among them, the loss function of the deep learning network can be generated by generating a mean absolute error loss function or a cross entropy loss function based on the adversarial features of the adversarial attack samples extracted from the input features and input into the predetermined layer of the deep neural network and the original features of the original image samples input into the predetermined layer of the deep neural network.
[0087] In one embodiment, generating a loss function of the deep neural network according to the input features as an adversarial defense denoiser includes:
[0088] According to the formula L=||f l (x')-f l (x)||Generate the loss function of the deep neural network as an adversarial defense denoiser, where the f l (x') is the network feature of the predetermined layer of the deep neural network input by the adversarial attack sample extracted from the input feature, l (x) is the network feature of the predetermined layer of the deep neural network inputted by the original image sample extracted from the input feature, L=||f l (x')-f l (x)|| represents the loss value of the original image sample network features relative to the adversarial attack sample network features.
[0089] This can force the deep neural network to classify without deviating from the network features f of the original image samples. l (x) and the adversarial features f of the adversarial attack sample l The difference between (x') forms an effective constraint on the deep learning network, effectively ensuring the effect of the neural network model and the optimization goal.
[0090] In step S130, the adversarial attack sample is denoised using the adversarial defense denoiser to obtain a denoised adversarial attack sample.
[0091] In the implementation of this example, the use of the above-mentioned adversarial defense denoiser to denoise the adversarial attack samples is, for example, to assign the average value of a pixel and all pixels in its neighborhood to the corresponding pixel in the output image through the neighborhood averaging method, so that the samples input into the deep learning network are smoother and the attacks on the image samples are defended. It can be understood that the denoising method can also be denoising according to the median filtering method. Since the above-mentioned adversarial defense denoiser is obtained based on the difference between the adversarial features of the adversarial attack samples extracted from the input features and the original features of the original image samples input into the predetermined layer of the deep neural network, that is, it is obtained based on the difference in high-order features, the adversarial defense denoiser is used to denoise the adversarial attack samples, and the denoised adversarial attack samples can make the adversarial attack and defense means mutually connected, increase the correlation between the two, and thus cause the defense means to be well adapted to the new attack method.
[0092] In step S140, the loss function of the deep neural network is regularized to obtain a regularized deep neural network.
[0093] In the implementation of this example, regularization is to limit the parameters of the loss function. Since the effect of the neural network model and the optimization goal are defined by the loss function, regularization can make the weights as small as possible during the fitting process of the loss function, and finally construct a network model with relatively small parameters. Models with small parameter values are relatively simple, can adapt to different data sets, and avoid overfitting to a certain extent. The process of regularization through the loss function corresponding to the extracted high-order input features forms a gradient regularization process, thereby effectively ensuring the classification accuracy of the deep learning network. The regularization method can be, for example, L1 regularization or L2 regularization.
[0094] In one embodiment, regularizing the loss function of the deep neural network to obtain a regularized deep neural network includes:
[0095] According to the formula L(ω,b)=R(ω,b)+λ||ω|| 2 The loss function of the deep neural network is regularized to obtain a regularized deep neural network, where L(ω, b) is the loss function after regularization, R(ω, b) is the loss function before regularization, and λ||ω|| 2 is the regularization term, and λ is the regularization coefficient.
[0096] The regularization coefficient is less than 1, and then through λ||ω|| 2 The regularization term can constrain the parameter ω of the loss function.
[0097] In step S150, the original image sample and the denoised adversarial attack sample are input into the regularized deep neural network to obtain a classification result of the original image.
[0098] The embodiments of the present application combine high-order input feature extraction and gradient regularization, and input the adversarial attack samples obtained by denoising the attack samples through high-order feature loss and the original image samples into the original neural network after gradient regularization to complete the classification of the original image, which can better enhance the defense capability of the deep neural network.
[0099] Among the related methods, adversarial attack methods are mainly white-box attacks and black-box attacks based on FGSM and I-FGSM. FGSM mainly adds incremental noise in the gradient direction to induce the network to misclassify the generated image adversarial samples. Compared with white-box attacks, black-box attacks do not need to know the specific information of the attacked model, are applicable to different network models, and have better attack transferability. However, current adversarial attacks and defense methods are often independent of each other and lack certain correlations, which leads to the defense methods not being able to adapt well to new attack methods and causing classification errors.
[0100] The embodiment of the present application is based on the fact that the difference between the adversarial attack sample and the original image at the image layer is small, but the difference in the high-order features of the convolutional neural network is obvious. This method compares the difference between the high-order features of the neural network of the adversarial attack sample and the original image, so that it has stronger robustness in dealing with different adversarial attacks;
[0101] The denoising method using high-order feature differences is applicable to neural networks not limited to current networks, and has wider application significance in dealing with similar attacks;
[0102] Combining high-order features and gradient regularization, the image obtained by denoising the attack sample with high-order feature loss is input into the original neural network after gradient regularization to better improve the defense capability.
[0103] The present application also provides an adversarial defense device for an image classification network. Figure 4 As shown, the adversarial defense device of the image classification network may include a subscription module 410, a distribution module 420, a receiving module 430 and a push module 450. Among them:
[0104] The extraction module 410 is used to input the original image sample and the adversarial attack sample into the deep neural network to extract the input features of the target layer of the deep neural network higher than the predetermined number of layers;
[0105] The generation module 420 is used to generate a loss function of the deep neural network according to the input features as an adversarial defense denoiser;
[0106] The denoising module 430 is used to denoise the adversarial attack sample using the adversarial defense denoiser to obtain a denoised adversarial attack sample;
[0107] The regularization module 440 is used to regularize the loss function of the deep neural network to obtain a regularized deep neural network;
[0108] The classification module 450 inputs the original image sample and the denoised adversarial attack sample into the regularized deep neural network to obtain a classification result of the original image.
[0109] The specific details of each module in the above-mentioned adversarial defense device for the image classification network have been described in detail in the corresponding adversarial defense method for the image classification network, so they will not be repeated here.
[0110] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0111] In addition, although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0112] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0113] In an exemplary embodiment of the present application, an electronic device capable of implementing the above method is also provided.
[0114] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0115] Refer to the following Figure 5 The electronic device 500 according to this embodiment of the present invention is described. Figure 5 The electronic device 500 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0116] like Figure 5 As shown, the electronic device 500 is in the form of a general computing device. The components of the electronic device 500 may include but are not limited to: at least one processing unit 510, at least one storage unit 520, and a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510).
[0117] The storage unit stores program codes, which can be executed by the processing unit 510, so that the processing unit 510 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 510 can perform the following steps: Figure 1 Step S110 shown in: inputting the original image sample and the adversarial attack sample into the deep neural network to extract the input features of the target layer of the deep neural network higher than the predetermined number of layers; S120: generating the loss function of the deep neural network according to the input features as an adversarial defense denoiser; step S130: denoising the adversarial attack sample using the adversarial defense denoiser to obtain the denoised adversarial attack sample; step S140: regularizing the loss function of the deep neural network to obtain the regularized deep neural network; step S150: inputting the original image sample and the denoised adversarial attack sample into the regularized deep neural network to obtain the classification result of the original image.
[0118] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 5201 and / or a cache storage unit 5202 , and may further include a read-only storage unit (ROM) 5203 .
[0119] The storage unit 520 may also include a program / utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0120] Bus 530 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0121] The electronic device 500 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a client to interact with the electronic device 500, and / or may communicate with any device that enables the electronic device 500 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 550. Furthermore, the electronic device 500 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 560. As shown, the network adapter 560 communicates with other modules of the electronic device 500 via a bus 530. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0122] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0123] In an exemplary embodiment of the present application, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary implementations of the present invention described in the above "Exemplary Method" section of the present specification.
[0124] refer to Figure 6 As shown, a program product 600 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0125] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0126] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0127] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0128] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the client computing device, partially on the client device, as a separate software package, partially on the client computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the client computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0129] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0130] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the present application are indicated by the claims.
Claims
1. An adversarial defense method for an image classification network, characterized in that: include: Adjust the network parameters of the original image sample and the adversarial attack sample to be consistent; Inputting the original image sample and the adversarial attack sample whose network parameters are adjusted to be consistent into a deep neural network to extract input features of a target layer of the deep neural network that is higher than a predetermined number of layers; Generating a loss function of the deep neural network based on the input features as an adversarial defense denoiser; De-noising the adversarial attack sample using the adversarial defense denoiser to obtain a denoised adversarial attack sample; Regularizing the loss function of the deep neural network to obtain a regularized deep neural network; The original image sample and the denoised adversarial attack sample are input into the regularized deep neural network to obtain a classification result of the original image.
2. The method according to claim 1, characterized in that The adversarial attack samples include: When an original image sample is received, noise is applied to the original image sample to obtain an adversarial attack sample corresponding to the original image sample.
3. The method according to claim 1, characterized in that The adversarial attack samples include: When receiving an original image sample, adding noise to the original image sample using noise adding means corresponding to a plurality of deep neural networks to obtain a plurality of adversarial attack samples; Inputting the original image sample and the adversarial attack sample whose network parameters are adjusted to be consistent into a deep neural network to extract input features of a target layer of the deep neural network higher than a predetermined number of layers, including: Inputting the original image sample and each of the adversarial attack samples into a deep neural network respectively, and extracting sub-input features of a target layer of the deep neural network higher than a predetermined number of layers respectively; Get a set of all sub-input features as the input feature.
4. The method according to claim 1, characterized in that: The generating the loss function of the deep neural network according to the input feature as an adversarial defense denoiser comprises: According to the formula Generate a loss function of the deep neural network as an adversarial defense denoiser, wherein the The adversarial attack sample extracted from the input feature is input into the network feature of a predetermined layer of the deep neural network, Inputting the original image sample extracted from the input feature into the network feature of a predetermined layer of the deep neural network, Represents the loss value of the original image sample network features relative to the adversarial attack sample network features.
5. The method according to claim 1, characterized in that Regularizing the loss function of the deep neural network to obtain a regularized deep neural network includes: According to the formula Regularizing the loss function of the deep neural network to obtain a regularized deep neural network, where is the loss function after regularization, is the loss function before regularization, is the regularization term, is the regularization coefficient.
6. The method according to claim 1, characterized in that The step of inputting the original image sample and the adversarial attack sample with the network parameters adjusted to be consistent into a deep neural network to extract input features of a target layer of the deep neural network having a layer number higher than a predetermined number includes: Input the original image sample into the deep neural network, and extract the first network feature of the target layer of the original image sample input into the deep neural network; Inputting the adversarial attack sample into the deep neural network, and extracting a second network feature of a target layer of the adversarial attack sample input into the deep neural network; The input feature is generated according to the first network feature and the second network feature.
7. An adversarial defense device for an image classification network, characterized in that: include: An adjustment module is used to adjust the network parameters of the original image sample and the adversarial attack sample to be consistent; An extraction module, used for inputting the original image sample and the adversarial attack sample whose network parameters are adjusted to be consistent into a deep neural network, so as to extract input features of a target layer of the deep neural network higher than a predetermined number of layers; A generation module, for generating a loss function of the deep neural network according to the input features as an adversarial defense denoiser; A denoising module, used to denoise the adversarial attack sample using the adversarial defense denoiser to obtain a denoised adversarial attack sample; A regularization module, used to regularize the loss function of the deep neural network to obtain a regularized deep neural network; The classification module is used to input the original image sample and the denoised adversarial attack sample into the regularized deep neural network to obtain the classification result of the original image.
8. A computer-readable storage medium having stored thereon an adversarial defense program for an image classification network, characterized in that: When the adversarial defense program of the image classification network is executed by a processor, the method described in any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: include: processor; as well as A memory for storing an adversarial defense program of an image classification network of the processor; wherein the processor is configured to execute the method of any one of claims 1-6 by executing the adversarial defense program of the image classification network.
