Image black box countermeasure attack method based on Fourier frequency domain analysis
By performing Fourier analysis in the frequency domain sensitive area of the neural network, the frequency domain distribution of adversarial samples is optimized, and combined with the characteristics of the human visual system, invisible and transferable adversarial samples are generated, which solves the problem of insufficient privacy protection in the existing technology. , achieving high-quality privacy protection and maintaining user experience.
Patent Information
- Application Number
- CN202411010840.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-10-29
AI Technical Summary
Existing technologies are difficult to effectively protect user privacy without affecting user experience, especially on social media platforms. They cannot provide sufficient protection in the face of advanced attacks, and traditional privacy protection methods are difficult to use on high-quality transferable adversarial samples. The portability and visual fidelity requirements are not high.
The image black box adversarial attack method based on Fourier frequency domain analysis is adopted. By establishing a common sensitive area in the frequency domain sensitive area of the neural network, the frequency domain area with the highest attack value is found, and the frequency domain image is enhanced and gradient calculated to generate an unknown frequency domain image. Visible and transferable adversarial samples combine the frequency domain robustness of the neural network and the frequency domain characteristics of the human visual system to optimize the perturbation direction and frequency domain distribution.
It improves the invisibility and portability of adversarial attacks, can hide sensitive information while maintaining image quality, and improves the level of user privacy protection on social media platforms. It is suitable for social media and other scenarios. Compared with existing methods, it has better portability and portability. Significant improvement in visibility.
Smart Images

Figure CN118862062A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of artificial intelligence image security, and in particular to an image black box counterattack method based on Fourier frequency domain analysis. Background Art
[0002] With the increasing application of neural networks in high-risk fields, the security requirements for deep learning models have also increased dramatically. Adversarial attacks can mislead image classification models into making wrong decisions by making small perturbations to the input data, revealing the potential vulnerability of neural networks.
[0003] Black-box adversarial attacks construct transferable adversarial samples on alternative models without knowing relevant information about the target model, so that it can attack the unknown target model. In-depth research on black-box adversarial attacks can reveal the vulnerability of neural network models and explore improved algorithms to improve the model's defense capabilities against these attacks. This not only helps to protect the application security of neural network models in areas such as image classification, but also provides the necessary technical guarantee for the realization of trusted AI.
[0004] It is not only a test of the security of existing AI systems, but also plays an important role in real-world application scenarios, especially in terms of privacy protection. In a big data environment, people's personal information and private data may be subject to various forms of attacks and infringements. The use of adversarial samples can help protect users' private data from unauthorized use and make it more difficult for unknown models to identify and exploit personal information.
[0005] In big data environments such as social media, traditional privacy protection methods often rely on simple processing methods such as pixelation and blurring, which may affect user experience or fail to provide adequate protection in the face of advanced attacks. High-quality and transferable adversarial samples play an important role in real-world application scenarios. The use of adversarial samples can help protect users' private data from unauthorized use. Users upload and share adversarial samples of their photos instead of clean photos, which makes it more difficult for models to identify and exploit personal information without affecting their photo sharing experience, thereby effectively improving the level of privacy protection for users on social media platforms. These scenarios place higher requirements on the transferability and visual fidelity of adversarial samples. Therefore, it is of great significance to develop an invisible and transferable black-box adversarial attack method.
[0006] How to address the security issues of deep neural networks and implement black-box adversarial attacks that make image adversarial samples invisible and transferable has become a technical problem that needs to be solved. Summary of the invention
[0007] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide an image black box counterattack method based on Fourier frequency domain analysis.
[0008] The purpose of the present invention can be achieved by the following technical solutions:
[0009] According to one aspect of the present invention, a method for image black box counterattack based on Fourier frequency domain analysis is provided, the method comprising:
[0010] Step S1, in the stage of establishing the frequency domain sensitive area of the neural network, firstly construct the common sensitive area of the frequency domain of multiple neural networks, and then find the frequency domain area with the highest attack value;
[0011] Step S2, in the frequency domain adversarial attack stage, the image to be shared is transformed from the spatial domain to the frequency domain to obtain a frequency domain image, and then the frequency domain image is enhanced in the frequency domain. Then, the frequency domain with the highest attack value in step S1 is used for gradient calculation and iteration, and the frequency domain image is updated to finally obtain an adversarial sample of the image to be shared.
[0012] Preferably, in step S1, based on the Fourier heat maps of multiple neural networks, the most sensitive frequency domain region of each neural network is extracted as a mask, and isolated points where only one model exists are removed and normalized to construct a common sensitive region in the frequency domain of the multiple neural networks.
[0013] Preferably, cluster analysis is used to find the frequency domain area with the highest attack value, specifically:
[0014] All points in the vulnerable common area of Fourier frequency domain are taken as samples and clustered by the unsupervised learning K-means algorithm. The K-means algorithm summarizes the samples belonging to each cluster based on the distance between the sample and the center point. Its objective function is as follows:
[0015]
[0016] Among them, h is the heat value, which represents the probability that the perturbation causes the target model to misclassify; τ represents the invisibility of the perturbation, τ = dist(u, v) represents the distance from the coordinate (u, v) to the midpoint of the image; H and W are the height and width of the image respectively; and the values of h and τ are normalized.
[0017] Preferably, the frequency domain enhancement is specifically:
[0018] The input spatial domain image x is transformed into the frequency domain through Fourier transform, and x is used f express;
[0019] Frequency Domain Enhancementx aug The formula is as follows:
[0020] x aug =ifft[(x f ⊙μ+ξ)⊙(E+β·ω)]
[0021] ξ=fft(G⊙ω)
[0022] μ~U(1-ρ,1+ρ)
[0023] Among them, E is an all-one matrix; β is a hyperparameter; ⊙ represents the Hadamard product; ω is a mask used to filter and retain only the sensitive frequency domain; the multiplicative noise μ is a random variable sampled from the uniform distribution U(1-ρ,1+ρ); the additive noise ξ is a random variable obtained by sampling the Gaussian distribution and then performing a Fourier transform; G is a random Gaussian noise.
[0024] Preferably, the gradient calculation includes two parts, adversarial loss gradient calculation and frequency domain loss gradient calculation.
[0025]
[0026] in, To combat the loss gradient, is the loss gradient in frequency domain.
[0027] More preferably, a ternary loss is used as the adversarial loss of the attack, which is divided into two situations: a target attack scenario and a non-target attack scenario;
[0028] In the target attack scenario, the generation of adversarial samples is divided into two goals: to stay away from the original class and to get close to other classes. Therefore, the loss function is correspondingly divided into and
[0029]
[0030] Among them, Z(x) is the target label y selected by the adversarial attack t A probability distribution where each element represents the probability that the image belongs to the corresponding category; and They represent the loss functions for classifying samples into original labels and those other than original labels, θ is the neural network model parameter, and y is the label output by the model;
[0031] In non-target attack scenarios, The value of sets the confidence level for classifying the sample into the original label. The value of is set to the maximum confidence of all labels except the original label.
[0032] More preferably, the ratio of the disturbance intensity in the frequency domain is used as the frequency domain loss, specifically:
[0033]
[0034] d low ,d high and d other Respectively represent the disturbance intensity in the low-medium frequency region, high-frequency region and non-sensitive frequency domain region, x′ f is the image frequency domain information that is iterated during the attack process, Ω is the frequency mask set {ω low ,ω high ,ω other};
[0035] The frequency domain distribution of the disturbance is concentrated to the frequency domain area with the highest value of the counterattack through frequency domain loss.
[0036] More preferably, in the target attack scenario, the adversarial perturbation δ directed to the target label decision boundary is divided into two directions, as shown in the following formula:
[0037]
[0038] Among them, δ ori is the perturbation away from the original label decision boundary, δ target is the perturbation toward the target label decision boundary, and Respectively represent the loss functions for classifying samples into original labels and excluding original labels;
[0039] In the non-target scenario, the optimization process of the loss function is to move the adversarial sample away from the decision boundary of the original label and find other label decision boundaries in the process, as shown in the following formula:
[0040]
[0041] where y s is the original label of the sample, and Z(x) is the original label y selected by the adversarial attack. s The probability distribution of , sign(*) is the sign function; α is the control disturbance intensity.
[0042] Preferably, the common sensitive area in the frequency domain is divided into two parts: a sensitive area and a non-sensitive area, wherein the sensitive area includes ω low and ω high , non-sensitive areaω other =E-ω low -ω high , where E is a matrix of all 1s;
[0043]
[0044] Among them, x′ fis the image frequency domain information that is iterated during the attack process, x f is the spatial domain image, d low d high and d other They represent the disturbance intensity in the low-medium frequency region, high-frequency region and non-sensitive frequency domain region respectively, ⊙ represents the Hadamard product;
[0045] The optimization objective of the adversarial attack in the frequency domain is as follows:
[0046]
[0047] Among them, x′ f is the image frequency domain information that is iterated during the attack process, x f is the spatial domain image, d low d high and d other They represent the disturbance intensity in the low-medium frequency area, high frequency area and non-sensitive frequency domain area respectively.
[0048] Preferably, the process of calculating and iterating the gradient and updating the frequency domain image to finally obtain the adversarial sample of the image to be shared includes: performing multiple noise initializations during the frequency domain enhancement process, averaging the gradients obtained from multiple enhancements during the iteration process, updating the frequency domain image based on the average gradient, converting the updated frequency domain image back to the spatial domain, limiting the maximum disturbance amplitude and normalizing the pixel values.
[0049] Compared with the prior art, the present invention has the following beneficial effects:
[0050] 1) The present invention combines the frequency domain robustness of neural networks with the frequency domain characteristics of the human visual system, and designs adversarial attacks from the perspective of frequency domain. First, the common sensitive areas of multiple neural network frequency domains are constructed through Fourier heat maps to find the frequency domain areas with the highest attack value. Then, the input image to be shared is enhanced in the frequency domain, and gradient calculation and iteration are performed based on the frequency domain characteristics to obtain adversarial samples of the input image to be shared. The adversarial samples are shared, which improves the invisibility and mobility of the adversarial attacks on the image to be shared. It can effectively hide sensitive information while maintaining the quality of images and videos, and has a wide range of application scenarios in social media scenarios.
[0051] 2) The present invention uses ternary loss to optimize the perturbation direction, integrates the characteristics of the human visual system and the frequency domain robustness of the neural network, quantifies the contribution of each frequency component in the perturbation, and applies K-means clustering to weigh the transferability and invisibility of adversarial samples, thereby obtaining a set of candidate frequency domain components with the highest value that are more sensitive to the frequency perturbation of the neural network and difficult for the human eye to detect the change of the frequency information. Finally, the gradient is calculated from the frequency domain and the perturbation is superimposed, and a new adversarial attack optimization target is proposed. During the attack process, the joint loss function composed of the adversarial loss and the frequency domain loss is optimized, the frequency distribution of the perturbation is concentrated to the sensitive candidate frequency domain, and the non-sensitive area is constrained, thereby improving the transferability and invisibility compared to the existing adversarial attacks. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a Fourier heat map diagram of different neural network models in the present invention;
[0053] Figure 2 A schematic diagram of a common frequency domain where the neural network frequency domain is vulnerable in the present invention;
[0054] Figure 3 Schematic diagram of the optimal embedding area in the present invention;
[0055] Figure 4 It is a flowchart of the anti-attack method in the present invention. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments 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 should fall within the scope of protection of the present invention.
[0057] This embodiment relates to an image black box anti-attack method based on Fourier frequency domain analysis, which is as follows:
[0058] The frequency of the adversarial perturbation will affect its attack effect. That is, the neural network on the same data set is more sensitive to noise of certain specific frequencies in the Fourier frequency domain, and the human visual system is less sensitive to changes in high-frequency image signals. Therefore, the frequency domain robustness of the neural network can be combined with the frequency domain characteristics of the human visual system to design adversarial attacks from the frequency domain perspective.
[0059] The essence of adversarial attacks is to cause misjudgment by superimposing disturbances during the decision-making process of the neural network model, so in order to improve the transferability of samples, it is necessary to find the common decision boundary of the neural network through the inherent laws between different neural network models. The frequency principle discovered the common characteristics of neural networks in frequency domain behavior. On the same data set, different models are more sensitive to noise of certain specific frequencies in the Fourier frequency domain. Figure 1 As shown in the figure, this robustness in the frequency domain is an inherent property of neural networks, just like the generalization ability of neural networks. Designing perturbations based on this property can improve the transferability of adversarial samples.
[0060] In addition, the human visual system can be understood as a frequency decomposition system, which decomposes the spatial information of the input image into different frequency components and has different sensitivities to different components of spatial frequency. The contrast sensitivity function is an indicator specifically used to evaluate the response of the human visual system to visual stimuli of different frequencies. The relationship between contrast sensitivity function (CSF) and spatial frequency is:
[0061]
[0062] in, is the spatial frequency, f x and f y are the spatial frequencies in the horizontal and vertical directions, respectively, peak It is the best frequency for human eye CSF and is in the high frequency region.
[0063] According to the relationship between contrast sensitivity and spatial frequency, for the medium and high frequency information of the image, the sensitivity of the human eye is roughly inversely proportional to the frequency, that is, the invisibility of the disturbance is positively correlated with its frequency, and the sensitivity of visual perception decreases significantly in the high-frequency area. Combining the frequency domain common sensitivity of the neural network with the frequency domain characteristics of the human visual system, by constraining the disturbance to a higher frequency component, it is possible to improve its invisibility while satisfying the transferability of adversarial samples.
[0064] Based on the above analysis of the frequency domain characteristics of adversarial attacks, the present invention combines the frequency domain robustness of neural networks with the frequency domain characteristics of the human visual system, and proposes a black-box adversarial attack method that designs perturbations from the frequency domain.
[0065] Design counterattacks from the frequency domain, and consider the frequency domain characteristics of counterattacks during the attack process, and make targeted adjustments. The detailed technical solution is as follows:
[0066] (1) The process of gradient calculation and iterative update is completed in the frequency domain.
[0067] When designing adversarial attacks from the Fourier frequency domain, the modification of each pixel value of the image by the perturbation is converted into the modification of each frequency information of the image. Therefore, the gradient information should also reflect how the change of each frequency information in the model input affects the output and loss function of the model. First, the input spatial domain image x is converted to the frequency domain using Fourier transform, as shown in formula (2):
[0068] x f =fft(x) (2)
[0069] Put it into the neural network to calculate the loss function: The neural network is usually composed of a series of continuously variable activation functions and linear operations, so the entire network can be regarded as a composite function whose output is differentiable with respect to each weight and bias. Since both Fourier transform and inverse Fourier transform are differentiable, according to the chain rule, they can be added to the back propagation process to convert the gradient of the loss function with respect to the input into the gradient with respect to the frequency domain information. In back propagation, the gradient information is shown in formula (3):
[0070]
[0071] in is the loss function, θ is the neural network model parameter, and y is the label output by the model.
[0072] Then use the gradient information to update the frequency domain image x f , and finally obtain the adversarial sample after inverse Fourier transform.
[0073] (2) A frequency domain model enhancement strategy is proposed
[0074] The present invention proposes an enhancement method based on the frequency domain sensitivity characteristics of neural networks, namely: transforming the information of the model input in the fragile frequency domain of the neural network so that the frequency domain information against disturbance can match the common sensitivity characteristics of the neural network. Figure 2 As shown, the frequency domain fragile characteristics of multiple models are integrated to obtain the common area (common sensitive area) of the neural network frequency domain vulnerability. Through matrix transformation operations, the Fourier heat map of the alternative model can simulate the frequency domain fragile characteristics of any model.
[0075] Using multiple neural network models with different structures as surrogate models, adding different Fourier basis noises to the test set, establishing the function between the classification error rate of the surrogate model on the noisy test set and the frequency domain information of the noise, and visualizing it as a Fourier heat map. Extract the most sensitive frequency domain region of each neural network as a mask, integrate the masks, remove the isolated points where only one model exists, and then normalize them to construct the common region where multiple neural networks are vulnerable in the frequency domain.
[0076] like Figure 1, which are Fourier heat maps of different neural network models. The heat value of each pixel represents the average test error of the model under the corresponding frequency domain component noise. The red area in the figure is the area with the largest test error, which also means that the model is most sensitive to the information changes of these frequency domain components and is fragile at this frequency. Obviously, the fragile areas of different models overlap.
[0077] like Figure 2 Different deep neural networks (DNNs) have obvious common vulnerable areas in the frequency domain. Attacking these frequency domains can effectively improve the effectiveness of adversarial attacks.
[0078] The input spatial domain image x is transformed into the frequency domain through Fourier transform, and x is used f express.
[0079] Frequency Domain Enhancementx aug As shown in formula (4):
[0080] x aug =ifft[(x f ⊙μ+ξ)⊙(E+β·ω)] (4)
[0081] Where E is a matrix of all 1s; the hyperparameter β controls the enhancement of sensitive frequency domain information and is set to 0.1 here; x f = fft(x); ⊙ represents the Hadamard product; the multiplicative noise μ is a random variable sampled from a uniform distribution; the additive noise ξ is a random variable obtained by sampling a Gaussian distribution and then performing a Fourier transform; the mask ω is used to filter it, retaining only the sensitive frequency domain part, as shown in formulas (5) and (6):
[0082] ξ=fft(G⊙ω) (5)
[0083] μ~U(1-ρ,1+ρ) (6)
[0084] Where G is random Gaussian noise and U(1-ρ,1+ρ) is uniform distribution.
[0085] For x f Targeted noise processing can interfere with the fitting of the adversarial perturbation to the substitute model, so that the substitute model can approximately simulate the output of a new model. In addition, the transformation of the input image information reduces the correlation between the perturbation and the input sample, making the frequency domain information of the perturbation more biased towards the frequency domain characteristics of the neural network. Then, the perturbation information in the sensitive area is further enhanced, so that the gradient information is shifted to the common area in the frequency domain on the spectrum, as shown in formulas (7) and (8):
[0086]
[0087] δ=α·sign[ifft(fft(g)⊙(b·ω+E)) (8)
[0088] Among them, x aug is the frequency domain enhanced image; s is the original label of the image; sign(*) is the sign function; α is the control perturbation intensity, which is set to 2.0; b is the control of the enhancement of the gradient information of the sensitive frequency band, which is set to 0.1; δ is the adversarial perturbation.
[0089] In the model input, the enhancement of sensitive frequency band information makes the adversarial perturbation δ pay more attention to the sensitive area in the frequency domain, and by further enhancing the perturbation in the frequency domain, the adversarial sample is more misleading in the frequency domain, and the noise is randomly initialized N times, and the gradient g obtained by multiple enhancements is n Averaging is performed to make the direction of the gradient g' more stable.
[0090] (3) Design ternary loss
[0091] The present invention decomposes the adversarial perturbation into two parts and uses the gradient information transmitted back by the model to weigh the two directions. It can dynamically optimize the direction of the adversarial perturbation in the iterative process, so that the adversarial attack is more clearly directed to the decision boundary of the model, thereby allowing the adversarial sample to cross the common decision boundary of the neural network and achieve stronger transferability.
[0092] In the target attack scenario, the generation of adversarial samples is divided into two goals, namely, moving away from the original class and approaching other classes. Based on this, the loss function can be divided into As shown in formulas (9) and (10):
[0093]
[0094] Where Z(x) is the target label y selected by the adversarial attack t A probability distribution where each element represents the probability that the image belongs to the corresponding category. and Using different y t They represent the loss functions of the model classifying samples into original labels and those excluding the original labels respectively.
[0095] The optimization process of these two loss functions is the process of moving the adversarial sample toward the target label decision boundary and getting rid of being captured by other label decision boundaries. According to the parallelogram rule, any non-zero vector can be decomposed into the synthesis of two vectors.
[0096] Therefore, in the target attack scenario, the adversarial perturbation δ pointing to the target label decision boundary can be divided into two directions, as shown in formula (11):
[0097]
[0098] Among them, δ ori is the perturbation away from the original label decision boundary, δ target is a perturbation to the decision boundary of the target label. Similarly, in the non-target scenario, The value of is set to the confidence level that the model classifies the sample into the original label. The value of is set to the maximum confidence of the model for all labels except the original label.
[0099] In non-target scenarios: The optimization process of the loss function is to move the adversarial sample away from the decision boundary of the original label and find other label decision boundaries in the process, as shown in the formula:
[0100]
[0101] where y s is the original label of the sample.
[0102] (4) Frequency domain loss design: Introducing frequency domain loss constraints to counteract the frequency domain distribution of disturbances
[0103] First, cluster analysis is performed to find the candidate frequency domain with the highest value.
[0104] The heat value h in the Fourier heat map reflects the sensitivity of the neural network to the perturbation of the frequency domain component. The higher the heat value h, the greater the probability that the perturbation of the frequency component will cause the target model to misclassify. At the same time, the invisibility of the perturbation to the human visual system is positively correlated with its frequency. For perturbations of the same intensity, the higher the frequency, the better the invisibility. That is, in the Fourier frequency domain, the distance from the pixel to the zero-frequency component (after centering the frequency domain) represents the invisibility of the frequency perturbation.
[0105] The heat value h in the Fourier heat map and the frequency of the perturbation correspond to the requirements of adversarial sample transferability and visual fidelity. These two characteristics are shown in the formulas:
[0106] h=heat(u,v) (14)
[0107]
[0108] The heat value h represents the probability that the perturbation causes the target model to misclassify, and the frequency τ represents the invisibility of the perturbation. dist(u,v) represents the distance from the coordinate (u,v) to the midpoint of the image; and heat(u,v) is the corresponding heat value in the Fourier heat map. H and W are the height and width of the input image, respectively.
[0109] The frequency domain characteristics (u, v) of the perturbation and the function of the heat value h and frequency τ quantify the value of perturbations of different frequency domain components for the transferability and visual fidelity of adversarial samples. Based on the above function, the improvement of the visual fidelity of transferable adversarial samples can be converted into the screening of each element in the Fourier matrix in the two-dimensional space composed of heat value h and frequency τ.
[0110] like Figure 3 As shown, the present invention uses a clustering algorithm to weigh the common vulnerable areas in the Fourier frequency domain, obtains the optimal embedding area that is invisible to the adversarial attack, and comprehensively analyzes the frequency domain characteristics of the human visual system and the frequency domain robustness of the neural network to obtain the area with the highest value for the adversarial attack in the Fourier matrix as the optimization target of the adversarial attack in the Fourier frequency domain.
[0111] All points in the sensitive area in the Fourier domain are taken as samples and clustered by the unsupervised learning K-means algorithm. The K-means algorithm summarizes the samples belonging to each cluster based on the distance between the sample and the center point. Its objective function is shown in formula (16):
[0112]
[0113] The values of h and τ are normalized. In the clustering process, K cluster centers are first initialized, and K is set to 2. Then, the distance to the cluster center is calculated for each sample and then classified, and the cluster center position is recalculated until all samples are classified.
[0114] Cluster analysis finds the frequency domain area with the highest value for adversarial attacks, and then uses this to optimize the perturbation frequency domain distribution from a frequency domain perspective, thereby improving the efficiency of adversarial attacks.
[0115] The present invention uses the ternary loss as the adversarial loss, formulates the frequency domain optimization objective as the frequency domain loss, and optimizes the joint loss function.
[0116] The common sensitive area in the Fourier frequency domain has been divided into two parts, that is, the Fourier matrix of the image is generally divided into: sensitive area ω low ,ω high And non-sensitive areasω other =E-ω low -ω high , where E is a matrix of all 1s and Ω is represented by the frequency mask set Ω{ω low ,ω high ,ω other}.
[0117] For the overall disturbance, the insensitive region ω otherThe perturbation on ω is of the lowest value for adversarial samples, so it is constrained. Furthermore, in sensitive areas, the perturbation is further optimized based on the characteristics of the human visual system. The human visual system is sensitive to ω. high The visual redundancy is greater, and the disturbance should be more concentrated on ω high superior.
[0118] Here low ,d high ,d other They represent the disturbance intensity in the low-medium frequency area, high frequency area and non-sensitive frequency domain area respectively. In these three frequency domain areas, the formula is as shown:
[0119]
[0120] where x′ f It is the image frequency domain information that is iterated during the adversarial attack process. Based on the above analysis, the optimization goal of the adversarial attack in the frequency domain is as follows:
[0121]
[0122] To adjust the frequency domain distribution of the disturbance, the simplest method is to directly use the magnitude of the disturbance intensity in each frequency domain region as the frequency domain loss. However, this method will lead to the problem of overfitting. If the intensity of a certain frequency domain disturbance is too large, it will mask the adversarial loss during the back propagation process, and the intensity of the disturbance will change greatly during the iteration process. Simple superposition will lead to unstable gradients.
[0123] Therefore, the ratio of the perturbation intensity in the frequency domain is used as the loss function, and the frequency domain loss is set to:
[0124]
[0125] During the optimization process, the intensity of the disturbance may be zero, so a small coefficient σ=1e-3 is added to the denominator to avoid the situation where the denominator is zero. low With d other As molecules, d high As the denominator, the frequency domain loss is formed, and the frequency domain loss is set to a negative value to avoid increasing the gradient. In this way, the frequency domain loss can be increased by minimizing the fraction. high In exchange for other With d low , thereby adjusting the frequency domain distribution of the disturbance.
[0126] This embodiment also relates to an image black box counterattack method based on Fourier frequency domain analysis, and the process of the method includes the following steps:
[0127] 1) Initialization parameters: E∈R H×W , spatial domain image x'0 = x, image label y = y s or t ;
[0128] 2) Multiple noise initializations: Get the photos and / or videos to be shared, perform Fourier frequency domain enhancement on them, calculate the gradient and iteratively update; multiple iterations: gradient averaging, frequency domain image update and then convert it back to the spatial domain, limit the maximum disturbance amplitude, and normalize;
[0129] for i=0→T-1do / / T is the number of iterations
[0130] for n=0→N-1do / / N is the number of noise initializations
[0131] Input image to the model (input photo and / or video to be processed) x i ′Do Fourier transform and change to the frequency domain, x i f =fft(x i ′)
[0132] Randomly initialize the additive noise ξ and multiplicative noise μ
[0133] Fourier frequency domain enhancement: x aug =ifft[(x i f ⊙μ+ξ)⊙(E+β·ω)]
[0134] Back propagation calculates the gradient, which is equal to the gradient superposition of adversarial loss and frequency domain loss:
[0135]
[0136] end for / / Noise initialization loop ends
[0137] Average the gradients obtained from multiple enhancements:
[0138] Update the samples from the frequency domain: x i+1 f =x i f +α·g′
[0139] Convert the samples back to the spatial domain: x' i+1 =ifft(x i+1 f )
[0140] Limit the maximum disturbance amplitude: x' i+1 =clip X, ∈(x' i+1) / / The Clip(.) function is to ensure that the value of the generated adversarial sample is within a reasonable range and does not exceed the image size.
[0141] Normalize pixel values: x' i+1 =clip(x' i+1 ,0,1)
[0142] end for / / end of iteration
[0143] 3) After the iteration, the adversarial sample x'=x' of the photo or / and video to be shared is obtained T .
[0144] The adversarial samples obtained can effectively hide sensitive information such as personal identity information, such as facial recognition, geographic location or other personal identifiers, while maintaining the visual quality of photos or videos. Uploading adversarial samples to social media platforms for sharing and publicizing can hide user privacy without affecting user experience, and can resist advanced attacks, which has a wide range of application scenarios in social media scenarios.
[0145] The present invention has good transferability and invisibility, and can meet the requirements of high-quality adversarial samples in social media scenarios such as privacy protection. Previous adversarial attack methods often focus on constructing adversarial samples in the spatial domain, but often ignore their frequency domain characteristics, and have certain limitations in transferability and visual fidelity. The replacement model is enhanced by random loss-preserving transformation, which lacks a theoretical basis and has poor transferability in target attack scenarios. In addition, due to the design of the gradient update method, the perturbation intensity can only be limited by the Lp norm, but it cannot be adjusted according to the image content, which will introduce obvious artifacts in the generated samples.
[0146] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for image black box counterattack based on Fourier frequency domain analysis, characterized in that: The method includes: Step S1, in the stage of establishing the frequency domain sensitive area of the neural network, firstly construct the common sensitive area of the frequency domain of multiple neural networks, and then find the frequency domain area with the highest attack value; Step S2, in the frequency domain adversarial attack stage, the image to be shared is transformed from the spatial domain to the frequency domain to obtain a frequency domain image, and then the frequency domain image is enhanced in the frequency domain. Then, the frequency domain with the highest attack value in step S1 is used for gradient calculation and iteration, and the frequency domain image is updated to finally obtain an adversarial sample of the image to be shared.
2. According to the method of claim 1, the image black box counterattack method based on Fourier frequency domain analysis is characterized in that: In step S1, based on the Fourier heat maps of multiple neural networks, the most sensitive frequency domain area of each neural network is extracted as a mask, and the isolated points where only one model exists are removed and normalized to construct the common sensitive area of the frequency domain of the multiple neural networks.
3. The method for image black box counterattack based on Fourier frequency domain analysis according to claim 1, characterized in that: Cluster analysis is used to find the frequency domain area with the highest attack value, specifically: All points in the vulnerable common area of Fourier frequency domain are taken as samples and clustered by the unsupervised learning K-means algorithm. The K-means algorithm summarizes the samples belonging to each cluster based on the distance between the sample and the center point. Its objective function is as follows: Among them, h is the heat value, which represents the probability that the perturbation causes the target model to misclassify; τ represents the invisibility of the perturbation, τ = dist(u, v) represents the distance from the coordinate (u, v) to the midpoint of the image; H and W are the height and width of the image respectively; and the values of h and τ are normalized.
4. The method for image black box counterattack based on Fourier frequency domain analysis according to claim 1, characterized in that: The frequency domain enhancement is specifically as follows: The input spatial domain image x is transformed into the frequency domain through Fourier transform, and x is used f express; Frequency Domain Enhancementx aug The formula is as follows: x aug =ifft[(x f ⊙μ+ξ)⊙(E+β·ω)] ξ=fft(G⊙ω) μ~U(1-ρ,1+ρ) Among them, E is an all-one matrix; β is a hyperparameter; ⊙ represents the Hadamard product; ω is a mask used to filter and retain only the sensitive frequency domain; the multiplicative noise μ is a random variable sampled from the uniform distribution U(1-ρ,1+ρ); the additive noise ξ is a random variable obtained by sampling the Gaussian distribution and then performing a Fourier transform; G is a random Gaussian noise.
5. The method for image black box counterattack based on Fourier frequency domain analysis according to claim 1, characterized in that: The gradient calculation includes two parts, adversarial loss gradient calculation and frequency domain loss gradient calculation. in, To combat the loss gradient, is the loss gradient in frequency domain.
6. The method for image black box counterattack based on Fourier frequency domain analysis according to claim 5, characterized in that: Using ternary loss as the adversarial loss for attack, divided into two scenarios: target attack scenario and non-target attack scenario; In the target attack scenario, the generation of adversarial samples is divided into two goals: to stay away from the original class and to get close to other classes. Therefore, the loss function is correspondingly divided into and Among them, Z(x) is the target label y selected by the adversarial attack t A probability distribution where each element represents the probability that the image belongs to the corresponding category; and They represent the loss functions for classifying samples into original labels and those other than original labels, θ is the neural network model parameter, and y is the label output by the model; In non-target attack scenarios, The value of sets the confidence level for classifying the sample into the original label. The value of is set to the maximum confidence of all labels except the original label.
7. The method for image black box counterattack based on Fourier frequency domain analysis according to claim 5 is characterized in that: The ratio of the frequency domain regional disturbance intensity is used as the frequency domain loss, specifically: d low ,d high and d other Respectively represent the disturbance intensity in the low-medium frequency region, high-frequency region and non-sensitive frequency domain region, x′ f is the image frequency domain information that is iterated during the attack process, Ω is the frequency mask set {ω low ,ω high ,ω other }; The frequency domain distribution of the disturbance is concentrated to the frequency domain area with the highest value of the counterattack through frequency domain loss.
8. The method for image black box counterattack based on Fourier frequency domain analysis according to claim 6 is characterized in that: In the target attack scenario, the adversarial perturbation δ pointing to the target label decision boundary is divided into two directions, as shown in the following formula: Among them, δ ori is the perturbation away from the original label decision boundary, δ target is the perturbation toward the target label decision boundary, and Respectively represent the loss functions for classifying samples into original labels and excluding original labels; In the non-target scenario, the optimization process of the loss function is to move the adversarial sample away from the decision boundary of the original label and find other label decision boundaries in the process, as shown in the following formula: where y s is the original label of the sample, and Z(x) is the original label y selected by the adversarial attack. s The probability distribution of , sign(*) is the sign function; α is the control disturbance intensity.
9. The method for image black box counterattack based on Fourier frequency domain analysis according to claim 1, characterized in that: The common sensitive area in the frequency domain is divided into two parts: sensitive area and non-sensitive area, where the sensitive area includes ω low and ω high , non-sensitive areaω other =E-ω low -ω high , where E is a matrix of all 1s; Among them, x′ f is the image frequency domain information that is iterated during the attack process, x f is the spatial domain image, d low ,d high and d other They represent the disturbance intensity in the low-medium frequency region, high-frequency region and non-sensitive frequency domain region respectively, ⊙ represents the Hadamard product; The optimization objective of the adversarial attack in the frequency domain is as follows: Among them, x′ f is the image frequency domain information that is iterated during the attack process, x f is the spatial domain image, d low ,d high and d other They represent the disturbance intensity in the low-medium frequency area, high frequency area and non-sensitive frequency domain area respectively.
10. The method for image black box counterattack based on Fourier frequency domain analysis according to claim 1, characterized in that: The process of calculating and iterating the gradient and updating the frequency domain image to finally obtain the adversarial sample of the image to be shared includes: performing multiple noise initializations during the frequency domain enhancement process, averaging the gradients obtained from multiple enhancements during the iteration process, updating the frequency domain image based on the average gradient, converting the updated frequency domain image back to the spatial domain, limiting the maximum disturbance amplitude, and normalizing the pixel values.
Citation Information
Cited By
Action recognition defense method, device and equipment based on spatial domain and frequency domain flow multi-source adversarial training and storage medium
CN120260138A
Adversarial sample generation method and system based on multi-scale frequency domain decomposition
CN122023969A
Adversarial Example Generation Method and System Based on Multi-Scale Frequency Domain Decomposition
CN122023969B
