Black box attack-oriented face recognition confrontation sample generation method and device

By employing an iterative training method that integrates multi-model transfer attacks, momentum-optimized gradients, and step label function activation, efficient adversarial examples for black-box face recognition are generated. This addresses the issues of poor black-box attack performance and slow convergence speed in existing technologies, achieving efficient adversarial example generation.

CN119027754APending Publication Date: 2024-11-26XINGTANG TELECOMM TECH CO LTD +2
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202310607172.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-26
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

In existing technologies, deep learning-based face recognition algorithms are vulnerable to adversarial example attacks, especially black-box attacks, which are not very effective. Furthermore, existing algorithms have slow convergence speeds, leaving room for improvement in their attack effectiveness.

Method used

An iterative training method is adopted, which combines multi-model ensemble transfer attack, momentum-optimized gradient and step label function activation. Adversarial examples are generated through multi-model ensemble transfer attack, and efficient adversarial examples are generated by using momentum term gradient accumulation and step label function optimized gradient activation, combined with mask region limitation attack.

Benefits of technology

It significantly improves the attack success rate and robustness of the black-box face recognition adversarial example generation algorithm, reduces the number of training convergence rounds and computing power costs, and enhances attack effectiveness and generalization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119027754A_ABST
    Figure CN119027754A_ABST
Patent Text Reader

Abstract

The invention discloses a black box attack-oriented face recognition confrontation sample generation method and device, and belongs to the field of face recognition, and the method comprises the steps: carrying out the copy initialization of an attack region, and obtaining an initialized confrontation sample face; carrying out iterative training based on an initialization result, and carrying out multi-model integrated migration attack based on an adversarial sample face image and an attack target face image obtained by the last iterative training to obtain an adversarial sample face multi-model joint gradient; based on the adversarial sample multi-model joint gradient set, calculating a momentum item accumulation gradient to obtain an accumulation gradient after momentum optimization; on the basis of the accumulated gradient after momentum optimization, gradient activation of a step tag StepSign function is carried out, and face disturbance information is obtained; and based on the face disturbance information and the attack area mask, carrying out mask area limitation attack, and obtaining an adversarial sample face image after adversarial training when the number of iterations is reached. An effective face recognition confrontation sample is generated, high-precision attack of a black box face recognition model is realized, and the method is used for finding security vulnerabilities of a face recognition algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of deep adversarial attack and defense, information security, face forgery, face recognition and deep learning technology, and specifically relates to a method and device for generating face recognition adversarial samples for black box attacks. Background Art

[0002] In recent years, with the development of deep learning technology, face recognition algorithms based on deep learning technology have achieved unprecedented development and application, bringing great convenience to people's daily production and life. However, deep learning algorithms are vulnerable to adversarial samples, especially adversarial samples generated by deep learning technology, which poses a huge challenge to the security application of face recognition. Therefore, face recognition model security has also become a research hotspot in the field of face recognition algorithms.

[0003] The field of face recognition model security can be simply divided into adversarial attacks and adversarial defenses. Face recognition adversarial attacks are used to discover potential vulnerabilities and risks of face recognition algorithms and to verify the security of face recognition models; while face recognition adversarial defenses are generally used to defend against potential vulnerabilities and risks of face recognition algorithms. The adversarial enhancement of the two jointly promotes the development of face recognition model security and face recognition applications. Among them, face recognition adversarial attack algorithms can be divided into two categories according to whether the face recognition model parameters are known. The unknown model parameters are black-box face recognition adversarial attacks, and the opposite is true for white-box face recognition adversarial attacks. Attacks in real application scenarios are generally black-box attacks. The present invention also discloses a face recognition adversarial sample generation algorithm for black-box attacks.

[0004] Face algorithms belong to the field of image recognition algorithms, and black-box face recognition model attacks belong to the field of black-box image recognition adversarial attacks. Therefore, ordinary image recognition adversarial attack algorithms can also be applied to face recognition adversarial attacks after certain modifications and adaptations. Here, we introduce the background of research in the field of ordinary image recognition adversarial attacks, which has been studied more. For image recognition adversarial attacks, academia and industry have successively introduced various algorithms, mainly attack algorithms based on gradient optimization. Representative algorithms include FGSM (Fast Gradient Sign Method, an adversarial sample generation algorithm based on gradient), I-FGSM (Iterative Fast Gradient Sign Method, an adversarial sample generation algorithm based on gradient generation), MI-FGSM (Momentum Iterative Fast Gradient Sign Method, an adversarial attack algorithm, an improvement and extension of the original FGSM algorithm), PGD (Projected Gradient Descent, an iterative optimization algorithm for generating adversarial samples), etc. Although these methods have good effects, they still have certain problems: (1) These methods all use sign functions to activate the gradient values ​​on the adversarial sample images to form image perturbations, but the sign function fails to fully consider the differences between the gradient values. The adversarial sample generation algorithms generally converge slowly and there is still room for optimization in the attack effect; (2) These algorithms are mainly aimed at white-box models, but have poor effects on black-box models; (3) These algorithms are mainly aimed at attacks on ordinary image classification models, but cannot be directly used for adversarial sample generation methods for more complex face recognition models. Summary of the invention

[0005] In view of the above analysis, the embodiments of the present invention aim to provide a method and device for generating face recognition adversarial samples for black-box attacks, which are used to improve the convergence speed of the face recognition adversarial sample generation algorithm in the prior art and improve the robustness of face recognition adversarial sample attacks.

[0006] In order to solve the above technical problems, the main technical solutions adopted by the present invention include:

[0007] This specification provides a method for generating adversarial samples for face recognition against black box attacks, characterized in that, based on iterative training, when a maximum number of iterative training times is reached, an adversarial sample face image after adversarial training is output; wherein each iterative training process includes:

[0008] Based on the adversarial sample face image and the target face image obtained from the last iterative training, a multi-model integrated transfer attack is performed to obtain the multi-model joint gradient of the adversarial sample face;

[0009] Based on the adversarial sample multi-model joint gradient set, calculating the momentum-optimized accumulated gradient;

[0010] Based on the accumulated gradient after the momentum optimization, obtaining face disturbance information;

[0011] Based on the face disturbance information and the attack area mask, a mask area limited attack is performed to obtain an adversarial sample face image for this adversarial training.

[0012] Optionally, before the iterative training, the attack area copy initialization is also included to output an initialization adversarial sample face image; the attack area copy initialization includes:

[0013] The attack area mask and the adversarial sample face are demasked to obtain the adversarial sample face mask background;

[0014] The attack area mask and the attack target face are masked to obtain a target sample face mask foreground;

[0015] The adversarial sample face mask background and the target sample face mask foreground are added together to obtain an initialized adversarial sample face image.

[0016] Optionally, the multi-model integrated migration attack includes:

[0017] Select multiple face recognition models for multi-model integration, and calculate the set of embedded feature vectors corresponding to the attack target face image and the set of embedded feature vectors corresponding to the adversarial sample face image;

[0018] Calculate the loss of the embedded feature vector set corresponding to the attack target face image and the embedded feature vector set corresponding to the adversarial sample face image to obtain an optimized target loss set;

[0019] Based on the optimization target loss set, the multi-model joint gradient of the adversarial sample face is calculated.

[0020] Optionally, based on the attack target face image, a set of embedded feature vectors corresponding to the attack target face image is calculated, and the formula is:

[0021]

[0022] in, is the set of embedded feature vectors corresponding to the target face image, M n (Y) is the embedded feature vector of the target face image in the nth face recognition model, N M is the number of face recognition models used for ensemble training;

[0023] Based on the adversarial sample face image, the embedded feature vector corresponding to the adversarial sample face image is calculated, and the formula is:

[0024]

[0025] in, is the set of embedded feature vectors corresponding to the adversarial sample face image, is the embedded feature vector of the adversarial sample face image in the nth face recognition model, t is the number of iterations, and t = 0 Initialize the adversarial sample face image X * .

[0026] Optionally, the loss of the embedded feature vector set corresponding to the attack target face image and the embedded feature vector set corresponding to the adversarial sample face image is calculated to obtain the adversarial sample optimization target loss set, and the formula is:

[0027]

[0028] Among them, L is the loss function of the adversarial attack algorithm, L nt Optimize the target loss set for training, The set of embedded feature vectors corresponding to the target face image, is the set of embedded feature vectors corresponding to the adversarial sample face image, N M is the number of face models used for ensemble training, and t is the number of iterations.

[0029] Optionally, based on the adversarial sample optimization target loss set, the adversarial sample face multi-model joint gradient is calculated, and the formula is:

[0030]

[0031] Among them, g n0 For adversarial sample faces The gradient set, g n(t+1) For t iterations The gradient set, N M is the number of face models used for ensemble training, and t is the number of iterations.

[0032] Optionally, based on the joint gradient of the multi-model of the adversarial sample face, the accumulated gradient after momentum optimization is calculated, and the formula is:

[0033]

[0034] in, represents the cumulative gradient of the adversarial face image after momentum optimization at t = 0, g t+1 is the multi-model joint gradient set, ||gt+1 ||1 represents g t+1 The l1 norm of , μ is the momentum decay factor, is the accumulated gradient after momentum optimization.

[0035] Optionally, the face disturbance information is calculated based on the accumulated gradient after the momentum optimization, and the formula is:

[0036]

[0037] in, is the perturbation information on the adversarial sample face image, α is the learning rate, is the accumulated gradient, It is the step value mapped by the StepSign activation function for different gradient value ranges, and t is the number of iterations.

[0038] Optionally, based on the face disturbance information and the attack area mask, a mask area limited attack is performed to obtain an adversarial sample face image for this adversarial training.

[0039]

[0040] Among them, a, b are the lower and upper limits of the image grayscale value, M is the predetermined value, adv is the attack area mask, To counter the perturbation information on the sample face image, is the adversarial sample face image after adversarial training, X * To initialize the adversarial sample face image, is the initialization adversarial sample face image corresponding to t=0.

[0041] This specification also provides a face recognition adversarial sample generation device based on black box attack, comprising:

[0042] Initialization module, attack area copy initialization, processing the adversarial sample face, attack area mask and attack target face to obtain the initialized adversarial sample face image;

[0043] The multi-model integrated transfer attack module performs a multi-model integrated transfer attack based on the adversarial sample face image and the attack target face image obtained from the last iterative training, and obtains the multi-model joint gradient of the adversarial sample face;

[0044] A momentum term cumulative gradient module, used to calculate the momentum-optimized cumulative gradient based on the multi-model joint gradient set of the adversarial sample;

[0045] A step label function activation module, used to obtain face disturbance information based on the accumulated gradient after momentum optimization;

[0046] A masked area limited attack module, used to perform a masked area limited attack based on the face disturbance information and the attack area mask, to obtain an adversarial sample face image for this adversarial training;

[0047] The output module is used to output the adversarial sample face image after adversarial training when the maximum number of iterative training times is reached.

[0048] Compared with the prior art, the technical solution of the present invention can achieve at least one of the following beneficial effects:

[0049] 1. A method for initializing the content copy of the attack area is proposed. The pixel values ​​of the mask area of ​​the "target face image to be attacked" are used to initialize the corresponding mask area of ​​the "adversarial sample face image". This allows the "target face image" to have certain attack properties and a certain attack success rate before adversarial training. After initialization, the "target face image" has an innate black-box attack property, making the subsequent adversarial attack training easier, significantly reducing the training convergence rounds of the face recognition adversarial sample generation algorithm, improving the attack effect, and significantly reducing the training computing cost.

[0050] 2. Adapt the algorithm to the face recognition adversarial sample generation scenario, integrate the face recognition multi-model migration attack method, implement the gradient optimization attack of the face recognition model, and improve the attack migration of face recognition adversarial samples;

[0051] 3. Incorporating the momentum term gradient accumulation method, adding momentum terms to the algorithm effectively avoids the gradient value update oscillation in iterative training and accelerates the convergence of adversarial sample generation algorithm training;

[0052] 4. A new step label function is proposed to activate the gradient of the adversarial sample face image, projecting gradient values ​​of different ranges onto different step values, fully considering the differences between gradients, optimizing the attack effect, and further reducing the number of adversarial attack training convergence rounds. At the same time, the function reserves the upper and lower limit hyperparameters when designing, and the user can adjust the upper and lower limit hyperparameters to adapt to the current training task and improve the adversarial sample generation effect;

[0053] 5. The mask area limitation attack method is integrated to limit the attack area to the set or preset mask area, which ensures the effectiveness of the adversarial face sample images generated by the face recognition adversarial sample generation algorithm for black-box attacks.

[0054] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The drawings are only for the purpose of illustrating particular embodiments and are not to be considered limiting of the present invention. Like reference symbols denote like components throughout the drawings.

[0056] Attached Figure 1 Flowchart of the method for generating adversarial samples for face recognition against black-box attacks;

[0057] Attached Figure 2 Initialize the basic flow chart for attack area content copy;

[0058] Attached Figure 3 This is the basic flow chart of iterative training for face adversarial attack;

[0059] Attached Figure 4 Sample graph for algorithm verification;

[0060] Attached Figure 5 Diagram of the device for generating adversarial samples for face recognition against black-box attacks. DETAILED DESCRIPTION

[0061] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.

[0062] The present invention proposes a face recognition adversarial sample generation method for black-box attacks, with the purpose of optimizing the convergence speed of the black-box face recognition adversarial sample generation algorithm, improving the attack success rate of the black-box face recognition adversarial sample generation algorithm, enhancing the attack generalization of the black-box face recognition adversarial sample generation algorithm, and discovering potential security vulnerabilities of the face recognition algorithm. By optimizing the face recognition adversarial sample generation algorithm, the application security of the face recognition algorithm is promoted, and the research and development of the face recognition algorithm is promoted.

[0063] Embodiment 1

[0064] The present invention provides a method for generating adversarial samples for face recognition against black-box attacks. The black-box face attack algorithm can be classified as an attack algorithm based on gradient optimization, such as Figure 1 As shown, it includes steps S1-S5, and each step is optimized and connected in sequence to form the final face recognition adversarial sample generation method for black-box attacks.

[0065] Step S1, the attack area copy is initialized, the adversarial sample face, the attack area mask and the attack target face are processed to obtain an initialized adversarial sample face image.

[0066] The basic processing flow of the attack area copy initialization step is as follows Figure 2 As shown, including:

[0067] The adversarial sample face, attack area mask and attack target face are taken as input, and the output is the initialized adversarial sample face. This initialization step is performed once in the algorithm.

[0068] In face recognition algorithms, the distance between the feature vectors extracted from the probe face image and the reference face image is mainly used to determine whether the two faces are the same person. When the two images are exactly the same, the distance between them is 0; conversely, when the two images are different, there is generally a large distance between their feature vectors. From a pixel level perspective, the reason for the large distance between the two is the difference in the grayscale values ​​of the pixels.

[0069] In contrast, for face algorithm attacks, if it is assumed that the attack area of ​​the adversarial face sample is the entire image, then when the content of the adversarial sample attack area is exactly the same as the target face image, that is, when the adversarial sample is the target sample, an optimal attack effect is achieved, and the attack is universal. At this time, the optimal attack sample obtained can achieve the optimal attack on any model; on the contrary, if the area of ​​the attack area is 0, the model cannot be attacked. If the area of ​​the undetermined attack area is r, and the grayscale value of the attack area is set to the grayscale value of the same area of ​​the target sample, then the larger the area of ​​the attack area r, the better the attack effect is generally. Because the grayscale value of the attack area is set from a copy of the same area of ​​the target sample image rather than adversarial learning for a certain model, the attack is also universal.

[0070] For the adversarial attack algorithm, the initial grayscale value of the adversarial attack area affects the speed of attack training and the final attack effect.

[0071] In combination with the above analysis, the present invention proposes an attack area content copy initialization algorithm, which obtains the grayscale values ​​of the attack area of ​​the attack sample face and the target sample face through the attack area mask, and modifies the pixel value of the attack area in the attack sample to the grayscale value of the corresponding area of ​​the target sample to achieve the initialization of the attack sample. It initializes the attack sample to a better result, and has a certain attack success rate after initialization, which can accelerate the training speed of the attack and affect the attack effect after training.

[0072] like Figure 2 As shown, the input is the adversarial sample face, the target face and the attack area mask;

[0073] The attack area mask and the adversarial sample face are demasked to obtain the adversarial sample face mask background; the attack area mask and the attack target face are masked to obtain the target sample face mask foreground; then the adversarial sample face mask background and the target sample face mask foreground are added to obtain the initialized adversarial sample face for output.

[0074] The attack mask area image is denoted as M adv , the adversarial sample face image is X, the target face image is Y, and the initialized adversarial sample face image is X * , then X * It can be expressed by formula (1):

[0075] X * =X·(IM adv )+Y·M adv Formula (1)

[0076] Among them, the matrix I represents a constant matrix with all values ​​1. The size of the matrix is ​​consistent with the size of the face image. The “·” symbol represents the multiplication of the two matrices by element position. X·(IM adv ) is the face mask background of the adversarial sample, Y·M adv is the target sample face mask foreground, X * To initialize the adversarial sample face image.

[0077] Steps S2-S5 are connected in sequence to form an example of an iterative attack training process in the face recognition adversarial sample generation algorithm for black-box attacks. Good adversarial sample generation generally requires multiple cycles of iterative attack training of steps S2-S5. According to the attack training goal, the number of iterations t is set, and the maximum number of iterations is set to T. The basic flow chart of iterative attack training composed of steps S2-S5 is as follows: Figure 3 As shown in Figure 1, when the maximum number of iterations T is reached, the adversarial sample face image after adversarial training is output.

[0078] Step S2, face recognition multi-model integrated transfer attack step, during the first training, initialize the adversarial sample face image as the input of the multi-model, and each subsequent iteration continues the result of the previous iteration training (recorded as the adversarial sample face image) and the attack target face image, trains and adversarially learns on the multi-model to obtain the adversarial sample face multi-model joint gradient.

[0079] The most effective way to deal with black-box attacks on unknown model structures, model weights, and training data sets is to integrate multiple face recognition models trained with different structures or different data sets and perform multi-model integrated migration attacks. The same is true for attacks on face recognition algorithms.

[0080] This paper proposes a multi-model integrated migration attack algorithm for face recognition, which realizes the black-box attack characteristics of the attack algorithm through multi-model integrated training. The specific algorithm ideas are as follows:

[0081] Step S21: select multiple face recognition models for multi-model integrated adversarial attack training.

[0082] Based on the adversarial sample faces and the target faces obtained in the last iterative training, select enough face recognition models to perform face recognition multi-model ensemble transfer attacks. During the initial training, the adversarial sample faces are the initialized adversarial sample face images obtained in step S1.

[0083] The manifestation of the black-box attack feature is that the adversarial samples generated by adversarial training have sufficient transferability, or generalization, that is, one training can achieve effective attacks on multiple different models. Conversely, to achieve the black-box feature of adversarial samples, multiple different models can be used for training, so that adversarial samples are generated through adversarial learning on multiple models, thereby ensuring that adversarial samples can learn different feature outputs and distributions of multiple models under the same input.

[0084] Therefore, in order to collect enough existing face recognition models, we need to know the model structure, model parameters, model training data sources, etc. Different face models must ensure the diversity of model structure and model training data sources. Among them, the more face recognition models, the more model structures, and the more training data sources of the models, the stronger the black box attack of the adversarial face samples trained. The specific number of face models can be set according to the number of face recognition models collected and the computing power of the training.

[0085] Select a suitable face recognition model according to the purpose of face recognition.

[0086] The nth face recognition model used for multi-model ensemble training is M n , the number of face models trained in ensemble is N M , since the algorithm is a "multi-model" integrated attack, then N M Generally, it is subject to the following constraints, which are greater than or equal to 2, as shown in formula (2):

[0087] N M ≥2 Formula (2)

[0088] Among them, N M The number of face models trained for the multi-model ensemble attack.

[0089] In adversarial attack training, the collected parameters of the trained deep learning model are constants, and the corresponding grayscale values ​​of the face image to be attacked are the actual training parameters, which is exactly the opposite of ordinary deep learning recognition training.

[0090] Therefore, the models used for multi-model ensemble training are all set to inference mode, and the adversarial sample face images are set to a differentiable state, that is, the models for multi-model ensemble training are set to a non-training state that is only used for constant inference calculations, and the grayscale values ​​of the adversarial sample face images are set to a training state as training parameters, thereby ensuring that the face recognition model parameters are not modified during the adversarial training process, and the adversarial sample face images can update their grayscale values ​​according to the gradient feedback brought by the loss.

[0091] Step S22: Based on the attack target face image, calculate the set of embedded feature vectors corresponding to the attack target face image.

[0092] In face recognition algorithms, whether two face images are identified as the same person is determined by comparing the distance between the embedded feature vectors corresponding to the two face images. The goal of the face adversarial attack algorithm is to modify the adversarial sample face image so that the distance between its embedded feature vector and the target face image becomes close enough, thereby deceiving the face recognition model or system.

[0093] Therefore, if you want to obtain the distance between the adversarial sample face image and the target face image, you need to first obtain the corresponding set of embedded feature vectors.

[0094] In the present invention, the attack target face image Y is input into the multi-model integrated training model, and then the embedded feature vector set corresponding to the attack target face image can be obtained. but It can be expressed by formula (3):

[0095]

[0096] in, is the set of embedded feature vectors corresponding to the target face image, M n (Y) is the embedded feature vector of the target face image in the nth face recognition model, N M is the number of face recognition models used for ensemble training, 0≤n≤N M -1.

[0097] Step S23: Based on the adversarial sample face image, calculate the set of embedded feature vectors of the adversarial sample face image.

[0098] Similar to step S22, to obtain the embedded feature vector of the adversarial sample face image, the adversarial sample face image after the tth iteration can be By inputting the multi-model ensemble training model, we can obtain the set of embedded feature vectors corresponding to the adversarial sample faces. Where t is the number of loop iterations, which is a predetermined value. You can set the upper limit value T by yourself. It can be expressed by formula (4):

[0099]

[0100] in, is the set of embedded feature vectors corresponding to the adversarial sample face image, is the embedded feature vector of the adversarial sample face image in the nth face recognition model, N M is the number of face models used for ensemble training, t is the number of iterations, the maximum value is set to T, and when t = 0 Initialized adversarial sample face image X output by the attack region copy initialization step * .

[0101] Step S24, calculating the loss of the set of embedded feature vectors corresponding to the target face image and the set of embedded feature vectors of the adversarial sample face image.

[0102] The negative cosine distance is used as the loss function of the adversarial attack algorithm to calculate the loss between the embedded feature vector corresponding to the target face image and the embedded feature vector of the adversarial sample face image. The loss function is a guide for training in deep learning algorithms. It is used to guide algorithm training and determine the effectiveness of algorithm training. Therefore, loss function design is an extremely critical step in deep learning algorithms, and the same is true for face adversarial attack algorithms.

[0103] In face recognition algorithms, cosine distance is generally used to calculate the distance between feature vectors to determine face recognition results. The optimization direction of face adversarial attack algorithms is exactly opposite to that of face recognition algorithms. Therefore, negative cosine distance is designed as the loss function L of the adversarial attack algorithm. If the input embedded feature vector e a With e b , a and b are only the distinguishing marks of two embedded feature vectors and have no special numerical meaning, then L can be expressed as formula (5):

[0104] L(e a , e b )=-(1-cos(e a , e b ))=cos(e a , e b )-1 Formula (5)

[0105] Among them, L is the loss function of the adversarial attack algorithm, e a 、e b represents the embedded feature vector.

[0106] The output of the nth face model and The two combinations are used as the input of the loss function L to calculate the attack target face image Y and the adversarial sample face image X * t The training optimization target loss set L between nt , then L nt It can be expressed by formula (6):

[0107]

[0108] Among them, L is the loss function of the adversarial attack algorithm, L nt The target face image Y and the adversarial sample face image X * t The training optimization target loss set between The set of embedded feature vectors corresponding to the target face image, is the set of embedded feature vectors corresponding to the adversarial sample face image, N M is the number of face models used for ensemble training, t is the number of iterations, the maximum value is set to T, 0≤t<T.

[0109] Step S25: Calculate the attack sample face gradient set based on the optimized target loss set.

[0110] After calculating the loss set, it is necessary to obtain the gradient square of the adversarial sample face image. The grayscale value of the initialized adversarial sample face image can be updated. Back propagation calculation is performed here. Back propagation calculation is an existing technology, such as Figure 3 As shown, the long dashed line is the back propagation calculation and gradient processing. Through the back propagation calculation and gradient processing, as shown in Figure 3 In the direction of ①②, we can get The gradient set g n(t+1) , g n(t+1) It can be expressed by formula (7):

[0111]

[0112] Among them, g n0 For adversarial sample faces The gradient set, g n(t+1) For t iterations The gradient set, N M is the number of face models used for ensemble training, t is the number of iterations, the maximum value is set to T, 0≤t<T.

[0113] The obtained gradient set g n(t+1) It is the gradient set obtained under multi-model ensemble training. Each gradient information in the set needs to be superimposed on the adversarial sample face image to update the adversarial sample face. Here, each gradient value in the set is added and averaged as the joint gradient g of the multi-model.t To prepare for the subsequent adversarial sample face update, multi-model joint gradient g t It can be expressed by formula (8):

[0114]

[0115] Among them, N M is the number of face models used for ensemble training, t is the number of iterations, and the maximum value is set to T, g n(t+1) For t iterations The gradient set, g t+1 N M Multi-model joint gradients of models.

[0116] Step S3: Based on the multi-model joint gradient set, the momentum term cumulative gradient is calculated to obtain the momentum optimized cumulative gradient.

[0117] The momentum method can avoid the gradient value update oscillation in iterative training, accelerate the convergence of adversarial training, and improve the attack success rate of the algorithm. Therefore, the momentum term is incorporated into the present invention for gradient accumulation update. If the momentum attenuation factor is μ, the μ value is a training hyperparameter that can be set by itself, which can be adjusted according to the specific adversarial training, and generally takes a value of 1 or near 1.

[0118] The accumulated gradient after momentum optimization is but It can be expressed by formula (9):

[0119]

[0120] in, represents the cumulative gradient of the adversarial face image after momentum optimization at t = 0, g t+1 is the multi-model joint gradient, ||g t+1 ||1 represents g t+1 The l1 norm of, μ is the momentum attenuation factor, which takes a value of 1 or near 1, is the accumulated gradient after momentum optimization.

[0121] Step S4: Based on the accumulated gradient after momentum optimization, the step label StepSign function gradient activation is performed to obtain the perturbation information on the adversarial sample face image.

[0122] In the prior art, the gradient-based attack method generally uses the sign function to activate the gradient, and then generates perturbations for iterative optimization. This method has a good attack effect, but the activation method also has certain disadvantages, because the sign function does not take into account the differences between gradients, and returns 1 as long as the gradient is greater than 1, which leads to inaccurate gradient estimates at each step.

[0123] Based on the sign function of the prior art, the present invention proposes an improved "step label" activation function, defined as StepSign, which maps the gradient value activation to different step values ​​according to different gradient value ranges, and accelerates the attack training by projecting the gradient value in multiple steps, thereby improving the attack effect. Its definition can be expressed by formula (10):

[0124]

[0125] Among them, m represents a hyperparameter whose absolute value upper limit can be freely set. If the absolute value of x is greater than or equal to m, it will be projected to ±m. If m=1, the StepSign function is equal to the sign function in the prior art.

[0126] The accumulated gradient obtained in step S3 As input, enter the StepSign function and multiply it by the learning rate α to get the perturbation information that needs to be added to the adversarial sample face image It can be expressed by formula (11):

[0127]

[0128] in, is the perturbation information on the adversarial sample face image, α is the learning rate, and is a predetermined value. is the accumulated gradient, The "step label" StepSign activation function maps the step value to different gradient value ranges, t is the number of iterations, and the maximum value is set to T.

[0129] Step S5: Based on the disturbance information and the attack area mask, a mask area limitation attack is performed to obtain an adversarial sample face image after adversarial training.

[0130] Based on the attack area mask M adv The attack area mask M is pre-set, so after obtaining the disturbance information, it is not possible to directly add face disturbance to the adversarial sample. adv For disturbance information, At the same time, the grayscale value of the image has upper and lower limits, so it is necessary to clip the perturbed attack sample to the upper and lower limits. Here, the Clip function is used for clipping. The Clip function clips the unnecessary parts to make the final image clearer. The Clip function can be expressed by formula (12). Then the final adversarial attack sample face image The updated generation formula with the number of iterations can be expressed by formula (13):

[0131]

[0132] The Clip function means that the value of the first term x in the function must be between the last two terms a and b.

[0133]

[0134] Where a is the lower limit of the image grayscale value, b is the upper limit of the image grayscale value, which is a predetermined value, a = 0, b = 1, M adv is the attack area mask, To counter the perturbation information on the sample face image, is the adversarial sample face image after adversarial training, X * To initialize the adversarial sample face image, is the adversarial sample face image corresponding to t=0.

[0135] Repeat the above steps S2-S5 to perform iterative training. When the maximum number of cyclic iterative training times is reached, terminate the training and output the adversarial sample face image after adversarial training.

[0136] The adversarial sample face image after the mask area limitation attack can be used as the initial adversarial sample face image and input into the multi-model set for the next round of iterative adversarial training, such as Figure 3 In the third direction.

[0137] When the algorithm is training, the maximum number of iterations T is set. When the number of iterations is equal to T, the training is terminated and the adversarial sample face image after adversarial training is output. Figure 3 Middle ④ direction.

[0138] like Figure 4 The algorithm verification example shown in the figure shows that the processing flow of the algorithm can be divided into two main stages:

[0139] The first stage: the mask region copy initialization stage, the input is the adversarial sample face, the attack region mask and the attack target face, and the output is the mask region copy initialized adversarial sample face image;

[0140] The second stage: adversarial training stage, the first training input is the initial adversarial sample face image output from the first stage, and each subsequent iteration inputs the output of the previous training, and the output is the adversarial sample face image optimized by adversarial training after multiple training iterations, and finally outputs the adversarial sample face image after adversarial training. Among them, the attack area mask is known.

[0141] The face recognition adversarial samples generated by this method can achieve the purpose of realizing high-precision attacks on black-box face recognition models. The business areas where this method can be applied include: discovering security vulnerabilities in face recognition models, helping face algorithm developers to discover and fix vulnerabilities. Technical developers can use this method to discover potential vulnerabilities in face recognition algorithms and assist in the secure deployment of face recognition systems.

[0142] The key point of this method is the use, combination and adaptation of the proposed multiple methods with various existing methods. The integrated optimization of multiple methods significantly improves the black box attack success rate of the face recognition adversarial sample generation algorithm, ensures the robustness of the adversarial sample generation algorithm, and significantly reduces the training rounds of adversarial sample generation. The specific key points are as follows:

[0143] (1) Initialize the attack area content copy. Use the mask area pixel values ​​of the "target face image to be attacked" to initialize the corresponding mask area of ​​the "adversarial sample face image". This allows the "target face image" to have certain attack properties and a certain attack success rate before adversarial training. After initialization, the "target face image" has an innate black-box attack property, making the subsequent adversarial sample generation training easier, significantly reducing the training convergence rounds of the adversarial sample generation algorithm, improving the attack effect, and significantly reducing the training computing cost.

[0144] (2) Face recognition multi-model ensemble transfer attack, which integrates multi-model ensemble training technology to make the face recognition adversarial sample generation algorithm have certain transferability and black-box attack characteristics;

[0145] (3) Momentum term gradient accumulation: Adding momentum term to the algorithm can avoid the gradient value update oscillation in iterative training and accelerate the convergence of adversarial sample generation method training;

[0146] (4) Step label function gradient activation. Compared with the ordinary sign label function, the step label function (StepSign) fully considers the differences between gradients and projects gradients of different ranges onto different step values, making the training effect of the adversarial sample generation method more effective and converging faster.

[0147] (5) Masked area limitation attack: Incorporating the attack area mask limitation method, the attack area is limited to a set or preset mask area, thereby ensuring that the adversarial sample generation algorithm complies with the preset attack area limitation or the specific attack area limitation.

[0148] Embodiment 2

[0149] An embodiment of the present invention discloses a device for generating face recognition adversarial samples for black box attacks. Figure 5As shown, the face recognition counterattack device for black-box attacks includes an initialization module 501, a multi-model integrated migration attack module 502, a momentum term accumulation gradient module 503, a step label function activation module 504, a mask area limitation attack module 505 and an output module 506.

[0150] Initialization module 501, initialization of attack area copy, processing of adversarial sample face, attack area mask and attack target face, obtaining an initialized adversarial sample face image, and performing iterative training;

[0151] The multi-model integrated transfer attack module 502 performs a multi-model integrated transfer attack based on the adversarial sample face image and the attack target face image obtained by the last iterative training, and obtains the multi-model joint gradient of the adversarial sample face;

[0152] A momentum term cumulative gradient module 503 calculates the momentum term cumulative gradient based on the adversarial sample multi-model joint gradient set to obtain a momentum-optimized cumulative gradient;

[0153] A step label function activation module 504 calculates the step label StepSign function gradient activation based on the accumulated gradient after the momentum optimization to obtain the face disturbance information;

[0154] The mask region limited attack module 505 performs a mask region limited attack based on the face disturbance information and the attack region mask to obtain an adversarial sample face image for this adversarial training;

[0155] The output module 506 outputs the adversarial sample face image after adversarial training based on iterative training and reaching the maximum number of iterative training times.

[0156] The contents not described in detail in the specification of the present invention belong to the well-known technologies of professionals in the field.

[0157] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0158] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.

Claims

1. A method for generating adversarial samples for face recognition against black-box attacks, characterized in that: Based on iterative training, when the maximum number of iterative training times is reached, the adversarial sample face image after adversarial training is output; wherein each iterative training process includes: Based on the adversarial sample face image and the target face image obtained from the last iterative training, a multi-model integrated transfer attack is performed to obtain the multi-model joint gradient of the adversarial sample face; Based on the adversarial sample multi-model joint gradient set, calculating the momentum-optimized accumulated gradient; Based on the accumulated gradient after the momentum optimization, obtaining face disturbance information; Based on the face disturbance information and the attack area mask, a mask area limited attack is performed to obtain an adversarial sample face image for this adversarial training.

2. The method for generating adversarial samples for face recognition according to claim 1, characterized in that: Before iterative training, the attack area copy initialization is also included to output an initialization adversarial sample face image; the attack area copy initialization includes: The attack area mask and the adversarial sample face are demasked to obtain the adversarial sample face mask background; The attack area mask and the attack target face are masked to obtain a target sample face mask foreground; The adversarial sample face mask background and the target sample face mask foreground are added together to obtain an initialized adversarial sample face image.

3. The method for generating adversarial samples for face recognition according to claim 1, characterized in that: The multi-model integrated migration attack includes: Select multiple face recognition models for multi-model integration, and calculate the set of embedded feature vectors corresponding to the attack target face image and the set of embedded feature vectors corresponding to the adversarial sample face image; Calculate the loss of the embedded feature vector set corresponding to the attack target face image and the embedded feature vector set corresponding to the adversarial sample face image to obtain an optimized target loss set; Based on the optimization target loss set, the multi-model joint gradient of the adversarial sample face is calculated.

4. The method for generating adversarial samples for face recognition according to claim 3, characterized in that: Based on the attack target face image, the embedded feature vector set corresponding to the attack target face image is calculated, and the formula is: in, is the set of embedded feature vectors corresponding to the target face image, M n (Y) is the embedded feature vector of the target face image in the nth face recognition model, N M is the number of face recognition models used for ensemble training; Based on the adversarial sample face image, the embedded feature vector corresponding to the adversarial sample face image is calculated, and the formula is: in, is the set of embedded feature vectors corresponding to the adversarial sample face image, is the embedded feature vector of the adversarial sample face image in the nth face recognition model, t is the number of iterations, and t = 0 Initialize the adversarial sample face image X * .

5. The method for generating adversarial samples for face recognition according to claim 4, characterized in that: Calculate the loss of the embedded feature vector set corresponding to the target face image and the embedded feature vector set corresponding to the adversarial sample face image to obtain the adversarial sample optimization target loss set, the formula is: Among them, L is the loss function of the adversarial attack algorithm, L nt Optimize the target loss set for training, The set of embedded feature vectors corresponding to the target face image, is the set of embedded feature vectors corresponding to the adversarial sample face image, N M is the number of face models used for ensemble training, and t is the number of iterations.

6. The method for generating adversarial samples for face recognition according to claim 5, characterized in that: Based on the adversarial sample optimization target loss set, the adversarial sample face multi-model joint gradient is calculated, and the formula is: Among them, g n0 For adversarial sample faces The gradient set, g n(t+1) For t iterations The gradient set, N M is the number of face models used for ensemble training, and t is the number of iterations.

7. The method for generating adversarial samples for face recognition according to any one of claims 1 to 6, characterized in that: Based on the joint gradient of the multi-model of the adversarial sample face, the accumulated gradient after the momentum optimization is calculated, and the formula is: in, represents the cumulative gradient of the adversarial face image after momentum optimization at t = 0, g t+1 is the multi-model joint gradient set, ||g t+1 ||1 represents g t+1 The l1 norm of , μ is the momentum decay factor, is the accumulated gradient after momentum optimization.

8. The method for generating adversarial samples for face recognition according to claim 7, characterized in that: Based on the accumulated gradient after the momentum optimization, the face disturbance information is calculated, and the formula is: in, is the perturbation information on the adversarial sample face image, α is the learning rate, is the accumulated gradient, It is the step value mapped by the StepSign activation function for different gradient value ranges, and t is the number of iterations.

9. The method for generating adversarial samples for face recognition according to claim 8, characterized in that: Based on the face disturbance information and the attack area mask, a mask area limited attack is performed to obtain the adversarial sample face image of this adversarial training Among them, a, b are the lower and upper limits of the image grayscale value, M is the predetermined value, adv is the attack area mask, To counter the perturbation information on the sample face image, is the adversarial sample face image after adversarial training, X * To initialize the adversarial sample face image, is the initialization adversarial sample face image corresponding to t=0.

10. A face recognition adversarial sample generation device based on black box attack, characterized in that: include: Initialization module, attack area copy initialization, processing the adversarial sample face, attack area mask and attack target face to obtain the initialized adversarial sample face image; The multi-model integrated transfer attack module performs a multi-model integrated transfer attack based on the adversarial sample face image and the attack target face image obtained from the last iterative training, and obtains the multi-model joint gradient of the adversarial sample face; A momentum term cumulative gradient module, used to calculate the momentum-optimized cumulative gradient based on the multi-model joint gradient set of the adversarial sample; A step label function activation module, used to obtain face disturbance information based on the accumulated gradient after momentum optimization; A masked area limited attack module, used to perform a masked area limited attack based on the face disturbance information and the attack area mask, to obtain an adversarial sample face image for this adversarial training; The output module is used to output the adversarial sample face image after adversarial training when the maximum number of iterative training times is reached.

Citation Information

Cited By

  • Model training method and device and computer equipment

    CN119203043A

  • A model training method, device and computer equipment

    CN119203043B

  • Method and system for confronting attack by using momentum of self-adaptive strategy

    CN119721180A

  • Model difference-based meta-gradient weight distribution model robustness evaluation method and device, and storage medium

    CN121281123A

  • Model difference-based meta-gradient weight distribution model robustness evaluation method, device and storage medium

    CN121281123B