An active face defense method for portrait protection

By setting the perturbation generation paths of multiple defense deep forgery models in parallel, generating cross-model adversarial perturbations and embedding them into portrait images, we solve the problem that existing technology cannot prevent portrait images from being maliciously forged, and achieve the goal of protecting multiple deep forgery models. Effective defense improves the defensiveness and response speed of user privacy and security.

CN118262401BActive Publication Date: 2024-08-27NANJING UNIV OF INFORMATION SCI & TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410686793.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-08-27
Estimated Expiration
2044-05-30

AI Technical Summary

Technical Problem

Existing technology cannot effectively prevent user portrait images from being maliciously forged. Existing passive defense technology can only detect after the fact, and active defense technology cannot resist attacks from multiple deep forgery models at the same time, resulting in high cost and low efficiency.

Method used

The perturbation generation paths of multiple defense deep forgery models are set up in parallel, cross-model adversarial perturbations are generated through hybrid attack methods and saliency bias fusion methods, and they are embedded in portrait images uploaded by users to generate the best general defense perturbations. .

Benefits of technology

It achieves universal defense capabilities against a variety of deep forgery models, can identify the authenticity of images within the human eye, greatly prevents the malicious synthesis of deep forgery models, improves the defense of user privacy and security, and has fast response speed and resistance capabilities. Close to saturation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118262401B
    Figure CN118262401B
Patent Text Reader

Abstract

The present invention discloses a human face active defense method for portrait protection. The present invention generates a cross-model universal adversarial perturbation based on a generative adversarial network, including: uploading a human face portrait image; adding a Lab domain noise enhancement data set and adding an initial perturbation and an initial step size; multiple models generate adversarial perturbations in parallel, and after multiple rounds of significant bias fusion and iteration, the final universal perturbation is obtained and embedded in the portrait image; wherein, the multi-model parallel adversarial uses a PGD gradient attack to update each round of adversarial perturbations, and after fusion, the temporary perturbation of the current round is obtained, and the next round of perturbation step size is generated by TPE parameter optimization until the final perturbation is generated, embedded in the portrait image and output. The present invention has universal defense capabilities against a variety of deep fake models, and has extremely high defense and security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an active face defense method for portrait protection, belonging to the technical field of artificial intelligence. Background Art

[0002] The current mainstream passive defense technology can only verify authenticity after the fact, and the existing active defense technology has a single defense type, and neither can effectively prevent user portrait images from being maliciously forged.

[0003] Furthermore, fake facial images with targeted attributes could potentially undermine the security and user privacy of the stolen portraits by passing biometric authentication for commercial applications or simply deceiving others.

[0004] However, current research focuses on passive defense. Existing passive defense technologies detect modified content by training deepfake detectors. However, they can only verify whether a specific image has traces of deepfakes after the fact, and cannot prevent the portrait image itself from being maliciously forged in advance. They only have the effect of making up for the loss. They have low timeliness, poor generalization, and are prone to errors and omissions. At the same time, passive defense faces the constantly updated and iterated deepfake models, and requires continuous updating and training of defense models, which puts huge cost pressure. Existing active defense technologies can only generate adversarial perturbations specific to images and models, that is, embedded perturbations can only protect a facial image from attacks by a specific deepfake model, and cannot simultaneously defend against attacks by multiple different models. Summary of the invention

[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and propose an active face defense method for portrait protection. By setting up multiple perturbation generation paths for defending deep fake models in parallel, the optimal universal defense perturbation is obtained and embedded into the portrait image uploaded by the user.

[0006] To achieve the above object, the present invention is implemented by adopting the following technical solutions:

[0007] The present invention provides a human face active defense method for portrait protection, the method comprising the following steps:

[0008] Obtain a training set; the training set includes a plurality of portrait images;

[0009] Performing data enhancement on the training set to obtain a data enhanced image;

[0010] Generate initial perturbation and initial step size;

[0011] The data-augmented image, the initial perturbation and the initial step size are input into a deep fake network, adversarial perturbation is generated by a hybrid attack method and a saliency bias fusion method, and the final adversarial perturbation is obtained by iteration; the deep fake network includes a plurality of parallel perturbation generation branches, each of which is provided with a deep fake model;

[0012] A facial portrait image to be protected is obtained, and the final adversarial perturbation is embedded into the facial portrait image to be protected to obtain an output image.

[0013] Furthermore, data enhancement is performed on the training set, including:

[0014] Convert the portrait images in the training set from RGB mode to Lab space domain to obtain images in Lab space domain;

[0015] Perform data enhancement on the image in the Lab space domain to obtain an enhanced image in the Lab space domain;

[0016] The enhanced Lab spatial domain image is subjected to random jumping parameter processing to obtain a noise image;

[0017] Convert the noise image from the Lab space domain back to the RGB mode to obtain a noise image in the RGB mode;

[0018] Add RGB mode noise images to the training set to obtain data augmented images.

[0019] Furthermore, the initial disturbance and the initial step length are both randomly generated;

[0020] The deep fake model includes 4 parallel perturbation generation paths; in one round, the four paths generate a total of four different adversarial results; the initial step length is 4, including s1, s2, s3, and s4;

[0021] A deep fake model is set on each perturbation generation path. The input of each perturbation generation path is an adversarial sample, and the output is the branch perturbation generated by the deep fake model in each path.

[0022] Furthermore, the data-augmented image, the initial perturbation and the initial step size are input into the deep forgery network, adversarial perturbation is generated by a hybrid attack method and a saliency bias fusion method, and the final adversarial perturbation is iteratively obtained, including:

[0023] Step A: adding an initial perturbation to the data augmented image to obtain an adversarial sample; using the initial step length as the step length of the deep fake model in each path;

[0024] Step B: inputting the data augmented image and the adversarial sample of this round into all perturbation generation branches of the deep fake network in parallel, respectively, to obtain the forged results of the deep fake model of each branch for the data augmented image and the forged results for the adversarial sample at this time;

[0025] Step C: Calculate the gradient value of the loss function of each branch according to the forged result of the deep forgery model of each branch for the data augmented image and the forged result of the adversarial sample at this time, and generate the branch perturbation of each branch according to the gradient value and step size of the loss function of each branch;

[0026] Step D: horizontally merge the branch disturbances of each branch to obtain the temporary disturbance of this round;

[0027] Step E: Through TPE parameter optimization, the step size of the deep fake model in each path of the next round is selected based on the historical best measurement value;

[0028] Step F: After each round of horizontal fusion generates temporary perturbations, they are vertically fused with all the previous rounds of temporary perturbations to update and form vertical perturbations, and the vertical perturbations are combined with the data augmented images as the starting perturbations of the next round to update and form the adversarial samples of the next round;

[0029] Step G: Repeat Step B-Step F until the best adversarial perturbation is generated.

[0030] Further, step B: respectively inputting the data augmented image and the adversarial sample of this round into all perturbation generation branches of the deep forgery network in parallel, and obtaining the forgery results of the deep forgery model of each branch for the data augmented image and the forgery results for the adversarial sample at this time, including:

[0031] Generate fake results as follows:

[0032] Add a perturbation:

[0033] Implementing forgery:

[0034] in, represents a data augmented image, and the superscript L represents a data augmented image. represents the adversarial sample of the rth round, the superscript P represents the adversarial sample obtained by attacking the input layer, and W r represents the starting disturbance added in round r;

[0035] In parallel branching, represents the forged result after the deep forgery model of the i-th branch attacks the adversarial sample in the r-th iteration, i represents the branch number, i=1,2,...,m, m represents the total number of branches of the deep forgery network;

[0036] represents the deep fake model of tampered face portrait of the i-th branch, which is used to attack the input portrait image,

[0037] G i () represents the forged result of the deep forgery model of the i-th branch, C i Deep fake model corresponding to the i-th branch The attack attribute used indicates the type or direction of forgery on the target image.

[0038] Further, step C: according to the forged result of the deep forgery model of each branch for the data augmented image and the forged result of the adversarial sample at this time, the gradient value of the loss function of each branch is calculated, and according to the gradient value and step size of the loss function of each branch, the branch perturbation of each branch is generated, including:

[0039] Use the projected gradient descent method PGD as the input layer attack method, and calculate the gradient value of the loss function of each branch based on the forged results of the deep forgery model of each branch for the data augmented image and the forged results of the adversarial sample at this time. ;

[0040] According to the following formula, the branch adversarial sample variation of each branch is generated according to the gradient value and step size of the loss function of each branch:

[0041]

[0042] Among them, T i represents the change in the adversarial sample after the update perturbation of the i-th branch, s i represents the attack step length of the i-th branch, represents the data augmented image, W r represents the starting disturbance added in round r, Represents the current gradient value of the loss function, It represents the forgery result of the deep forgery model of the i-th branch for the adversarial sample at this time, represents the forgery result of the deep forgery model of the i-th branch for the data augmented image;

[0043] Loss() represents the attack loss function, using the root mean square error RMSE method;

[0044] Sign() represents the sign function, which is used to ensure the update direction is correct;

[0045] According to the change of branch adversarial samples of each branch, the branch adversarial samples of each branch are updated according to the following formula:

[0046]

[0047] Among them, X i P represents the branch adversarial sample of the i-th branch, Indicates that the operation guarantees that the range is constrained within The clip operation between ɛ represents the threshold value, and X represents the data-enhanced image or the original image without adding disturbance;

[0048] The branch adversarial sample of the i-th branch is decomposed as follows:

[0049]

[0050] in, is the temporary branch perturbation of the ith branch in the ith round;

[0051] Bring the branch adversarial samples and data augmented images of each branch into the loss function to calculate the loss function:

[0052]

[0053] in, Represents the L2 norm of the temporary branch perturbation of this round;

[0054] If the temporary branch disturbance of this round The loss function value calculated by is greater than the branch perturbation W at this time i The corresponding loss function value, and the temporary branch perturbation of this round Satisfy its L2 norm is less than the threshold , then the branch perturbation W i Updated to this round's temporary branch disturbance , otherwise it will not be updated.

[0055] Further, step C: calculating the gradient value of the loss function of each branch according to the forged result of the deep forgery model of each branch for the data augmented image and the forged result of the adversarial sample at this time, and generating the branch perturbation of each branch according to the gradient value and step size of the loss function of each branch, further comprising:

[0056] After obtaining the updated branch adversarial samples of each branch Finally, use the ILA method to perform a middle-layer attack on it:

[0057] The results of the middle layer branches of each branch are confronted Initialized as data augmented image :

[0058]

[0059] in, is the adversarial sample of the middle layer branch of the i-th branch;

[0060] Calculate the intermediate layer attack adversarial samples of each branch separately And the input layer of each branch attacks the adversarial sample Respectively with data augmented images Differences in the output of the middle layer:

[0061]

[0062]

[0063]

[0064]

[0065] in, is the output function of the intermediate layer. is the initial adversarial sample for the i-th branch The middle layer output is For the i-th branch to the new adversarial sample The new intermediate layer output is is the difference between the intermediate layer outputs of the i-th branch and the initial adversarial sample, is the difference in the new intermediate layer output of the i-th branch regarding the new adversarial sample;

[0066] Update the intermediate layer branch adversarial samples of each branch by the following formula:

[0067]

[0068] Among them, lr represents the learning rate, which is used to control the amplitude of the anti-disturbance update during the optimization process, and sign() represents the sign function, which is used to ensure the correct update direction. Indication command exist The maximum loss function of the projection direction is defined as: ;

[0069] Represents the gradient value of the current loss function; clip() represents the clip operation, which is used to ensure that the range constraint is within between; represents the threshold, X represents the data-enhanced image or the original image without adding disturbance;

[0070] The adversarial sample of the intermediate layer branch of the i-th branch is decomposed as follows:

[0071]

[0072] in, is the temporary branch disturbance of the i-th branch in this round;

[0073] Bring the branch adversarial samples and data augmented images of each branch into the loss function to calculate the loss function:

[0074]

[0075] If the temporary branch disturbance of this round The loss function value calculated by is greater than the branch perturbation W at this time i The corresponding loss function value, and the temporary branch perturbation of this round Satisfy its L2 norm is less than the threshold , then the branch perturbation W i Updated to this round's temporary branch disturbance , otherwise it will not be updated.

[0076] Furthermore, step D: horizontally fusing the branch disturbances of the branches to obtain the temporary disturbance of this round, including:

[0077] The loss function Loss value of the branch perturbation of each branch is less than the set threshold For the part, it is considered that the difference between the forged result of the image and the forged result of the adversarial sample is too small. This part of the perturbation is subjected to XOR operation round by round, and the final fused temporary perturbation result of this round is updated according to the following formula:

[0078]

[0079] in, represents the result of the r-th round of lateral significant bias fusion, that is, the r-th round of temporary disturbance; R(W i ) represents the process of horizontal fusion of the r-th round of disturbance, R() represents the horizontal fusion function, W r Indicates the starting perturbation added in the rth round; i indicates the branch number generated by each perturbation, i=1,2,...,m, m indicates the total number of branches of the deep fake network, and j indicates that the loss function Loss value of the branch perturbation is less than the set threshold The branch number of the part, , represents the forged result of the deep forgery model of the j-th branch, represents the branch adversarial sample of the j-th branch, and arg() represents the arg function.

[0080] Furthermore, step F: after each round of horizontal fusion generates temporary disturbances, they are vertically fused with all previous rounds of temporary disturbances to update the longitudinal disturbances, including:

[0081] The longitudinal disturbance is updated as follows:

[0082]

[0083] in, is the weight coefficient, set to 0.8, is the temporary disturbance obtained after the rth round of horizontal fusion represents the starting disturbance added in round r; It represents the longitudinal disturbance after longitudinal fusion after the rth round of weighted fusion.

[0084] Further, step G: repeating steps B to F until the best adversarial perturbation is generated, including:

[0085] Iterate step B to step F, and each time get the longitudinal disturbance after the current round of longitudinal fusion , calculate the value of its loss function RMSE:

[0086]

[0087] Where i represents the branch number, i=1,2,...,m, and m represents the total number of branches of the deep fake network.

[0088] If the longitudinal disturbance after this round of longitudinal fusion The loss function value calculated by is greater than the loss function value corresponding to the best adversarial perturbation at this time, and the longitudinal perturbation obtained after this round of longitudinal fusion is To satisfy the L2 norm is less than the threshold , then the best adversarial perception disturbance is updated to the longitudinal disturbance after this round of longitudinal fusion , otherwise it will not be updated;

[0089] The longitudinal disturbance after longitudinal fusion of this round As the starting perturbation W of the next round r+1 Continue to iterate step B-step F until the set number of iterations is met or the best adversarial perturbation does not change after a preset number of times, and output the best adversarial perturbation at this time.

[0090] Compared with the prior art, the present invention has the following beneficial effects:

[0091] 1. The present invention generates a cross-model adversarial perturbation through a parallel architecture. The invisible perturbation is embedded into the portrait image uploaded by the user to distort the deep fake result of the image. The authenticity of the image can be distinguished within the range of the human eye, and active defense is performed to prevent face tampering.

[0092] 2. The present invention has a universal defense capability against a variety of deep fake models. Users can perform perturbation embedding before applying their personal portraits, which can greatly prevent malicious synthesis of deep fake models and prevent forged portrait images from passing liveness detection. The system has extremely high defense and security, effectively protecting the privacy and security of users.

[0093] 3. The present invention proposes an active face defense method for portrait protection. By setting multiple perturbation generation paths for defending deep fake models in parallel, the iterative perturbation is continuously optimized and the attack step size of each round is updated to obtain the optimal universal defense perturbation and embed it into the portrait image uploaded by the user.

[0094] 4. After testing, the method is close to saturation in its ability to resist common counterfeit attacks, and its response speed reaches the millisecond level. At the same time, it can resist attacks from a variety of deep counterfeit models, effectively meeting user needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0095] Figure 1 It is a schematic diagram of the generation process of the active face defense disturbance for portrait protection of the present invention;

[0096] Figure 2 It is a schematic diagram of the flow of generating training set data in the face active defense disturbance method for portrait protection of the present invention;

[0097] Figure 3 A schematic diagram of generating adversarial perturbations by attacking multiple forgery models in parallel in the active face defense method for portrait protection of the present invention;

[0098] Figure 4 It is a schematic diagram of the detection process of the active defense disturbance detection module in the active face defense system for portrait protection of the present invention;

[0099] Figure 5 It is a schematic diagram of the comparison of facial images after deep forgery attack on the target image before and after the perturbation is embedded in the active face defense method for portrait protection of the present invention;

[0100] Figure 6 It is a flow chart of adding a "middle layer attack" (ILA) in the present invention to generate adversarial perturbations through parallel attacks of multiple forgery models;

[0101] Figure 7 The present invention is a block diagram of the structure of an active face defense method for portrait protection. DETAILED DESCRIPTION

[0102] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0103] Embodiment 1:

[0104] This embodiment provides a face active defense method for portrait protection. Figure 1 As shown, the following steps are included:

[0105] Step 1. Prepare a face image training set and perform some initialization operations on the training set.

[0106] Add Lab domain noise to the image to get a noisy image.

[0107] Perform some perspective transformation on the image. Because most of the images in the training set are frontal photos, perspective transformation can change the angle of the person / portrait / other subject in the image, which can better simulate the images in real life.

[0108] Specifically, if Figure 2 As shown in the figure, the method randomly extracts a total of 10,000 images from the CelebA and CASIA-WebFace datasets, 7,000 of which are used for training images to generate adversarial perturbations, and 3,000 for random testing. CelebA contains nearly 20,000 face portrait images, covering face recognition of most races and regions, and CASIA-WebFace contains 500,000 face portrait images from public Internet websites. CelebA contains 40 different attribute value annotations such as: Bald, Bangs, Eyeglasses, Male, Smiling, Young, etc.; CASIA-WebFace contains 500,000 face portrait images from public Internet websites.

[0109] Step 2. Input the training set images into the trained neural network and output the final adversarial perturbation.

[0110] The following processes are all performed in four parallel branches, but the operations are the same, except that some parameter values ​​are different and the adversarial deep fake models are also different:

[0111] Add initial perturbation w0 and initial step size s1-s4 to the training image. These are randomly added in the initialization and will be gradually optimized in the subsequent loop iterations. The image with perturbation is called an adversarial sample.

[0112] Each branch uses the PGD gradient attack method to pit the adversarial sample against the deep fake model of the branch to obtain the adversarial result of the branch in the current round. This round of four paths generates four different adversarial results.

[0113] The four adversarial results generated in the previous step are horizontally fused with significant biases to obtain the temporary perturbation of the current round, which will be input into the next round as the starting perturbation of the next round. At the end of a round, the TPE parameter optimization method is used to automatically generate the step size of the next round and input it into the next round together with the perturbation.

[0114] After the temporary disturbance is generated by the first round of horizontal fusion, the temporary disturbance generated by the second round is vertically fused with the first round to obtain the longitudinal disturbance. In the subsequent N rounds, each time a temporary disturbance is generated, it is vertically fused with the total longitudinal disturbance of the previous N-1 rounds to update and form a new longitudinal disturbance.

[0115] The above process is repeated continuously until the final adversarial perturbation is generated and the training is completed.

[0116] This method selects four deep fake models, StarGAN, AGGAN, AttGAN, and HiSD, for attack. AGGAN and StarGAN are trained with five attributes on the dataset: black hair, blond hair, brown hair, changing gender, and adding age; AttGAN is trained with fourteen attributes on the training set. In addition to the above five attributes, other attributes include: bald hair, adding bangs, thickening eyebrows, slightly opening mouth, adding beard, removing beard, whitening skin, wearing glasses, becoming younger, etc.; HiSD can add glasses to portrait images.

[0117] This method sets up four attack paths for deep fake models in parallel. For each attack path, a hybrid attack method combining PGD input layer attack and ILA middle layer attack is adopted, which has faster training speed and higher defense success rate. Training images are randomly selected from the data set during training.

[0118] First, the image is converted from RGB space to Lab domain for data enhancement. An enhancement method is randomly selected from the geometric enhancement set and the visual enhancement set, and then the image is converted back to RGB space. Subsequently, random initial perturbations and initial step sizes are added to the training images. The images with initial perturbations are compared with the original images in the four parallel attack models, and their mean square error is calculated. Next, for the path branches of each parallel model, the PGD input layer attack is used to generate a new initial perturbation for the current path, and the ILA intermediate layer attack is used to further adjust the size and direction of the new perturbation to generate a single perturbation for a specific model. Finally, through the horizontal and vertical fusion of two significant biases, the perturbations generated by the parallel paths are fused together and iterated continuously until the set threshold is reached, and a cross-model universal adversarial perturbation is obtained. The initial perturbation sets the attack intensity to 0.05, the initial step size to 0.01, and the number of iterations to 10. The weight factors of the four models are set to: att_factor=2, Attention_factor=0.3, Star_factor=0.3, and HiSD_factor=1.

[0119] The training process of this method includes:

[0120] 1. Perform data augmentation on training images to change the visual effects of images from multiple angles to simulate real face images in real situations.

[0121] 2. Set appropriate weight factors and input the training data set into the constructed active defense model for training;

[0122] 3. In each training round, find the difference between the perturbed image and the original image, calculate their mean square error, and use this to calculate the size of the initial perturbation of the path, and then use the ILA attack method to further refine the perturbation;

[0123] 4. Perform horizontal saliency bias fusion on the perturbations of different paths to generate the temporary perturbation of this round; then, perform vertical saliency bias fusion on the temporary perturbations between the previous and next rounds until the final cross-model universal perturbation is obtained;

[0124] 5. Compare the differences before and after adjusting the weight factors of each parallel path, select one factor with the best current effect, and start testing.

[0125] Step 3: Embed the adversarial perturbation into the portrait image uploaded by the user to obtain an actively defended portrait image.

[0126] Overall concept of the invention:

[0127] This paper is based on the Generative Adversarial Network (GAN), and generates a universal adversarial perturbation through multiple rounds of adversarial and iterative processes. The perturbation generation process mainly includes the following aspects:

[0128] like Figure 2 As shown in the figure, data enhancement is to convert the images in the training set from RGB mode to Lab space domain, add noise, perform random parameter jumps, etc., simulate the lighting adjustment and angle change in real scenes, obtain a noisy image, and then convert it back to RGB mode and add it to the training set;

[0129] Initialize the step size and perturbation. Add initial perturbation and initial step size to the images in the training set to obtain adversarial samples. The step size is an important factor that determines the perturbation effect and will be continuously updated in each round of iteration.

[0130] like Figure 3 As shown in the figure, multiple branches generate a single adversarial perturbation image in parallel. The PGD gradient attack method is used in four parallel branches. The small-step multi-walk strategy is adopted to perform forward and backward propagation in sequence. The current perturbation is calculated according to the gradient, and it is respectively confronted with the deep fake models of each current branch. After the fake image for the specific model is obtained, the horizontal significance bias fusion is performed, and the four fake images of this round are fused to generate the temporary perturbation of this round, so that the specific attack attributes of each fake image are biased towards their common attributes, and at the same time, the attention of the image with poor perturbation effect in the next round is increased;

[0131] TPE parameter optimization, based on historical measurements, sequentially builds the performance of the model's approximate hyperparameters, each time selecting new hyperparameters for testing based on the model, optimizing the expected value through search iterations, improving the method to find a better step size, and then inputting the updated step size into the next round of loop iterations;

[0132] Multi-round temporary perturbation fusion: Perform fusion between vertical rounds to fuse the temporary perturbation results of multiple rounds together to enhance the robustness and generalization of the perturbation, obtain the final adversarial perturbation that is universal across models, and embed it into the original image for output.

[0133]

[0134] where

[0135] in, represents the result of the r-th round of lateral significant bias fusion, that is, the r-th round of temporary disturbance; R(W i ) represents the process of lateral fusion of the r-th round of disturbances, represents the horizontal fusion function, represents the starting perturbation added in the rth round; i represents the sequence number of each perturbation generation path, i represents the branch number, i=1,2,...,m, m represents the total number of branches of the deep fake network, and j represents the loss function Loss value of the branch perturbation is less than the set threshold The branch number of the part, , G j () represents the forged result of the deep forgery model of the j-th branch, Represents the branch adversarial sample after PGD attack on the j-th branch.

[0136] The core of this application is to find a set of adversarial samples in the sample space that maximize the Loss, and obtain W that maximizes the following formula as the adversarial result of the branch in the current round:

[0137]

[0138] in, The value is the set threshold, which is a hyperparameter used to control the strength of the adversarial sample, to prevent the perturbation from being too obvious after embedding into the original image and interfering with the use of the original image, and to prevent the perturbation from being too poorly concealed and being recognized by the deep fake model, thus losing its defensiveness; Represents the disturbance added to the image, which is initially a random value and then gradually updated by calculating the gradient And calculate the loss function RMSE at this time until the loss function is maximized within the limited threshold. , the goal is to generate a distorted output that is as different from the original output as possible.

[0139] In general, the present invention generates a cross-model adversarial perturbation. The invisible perturbation is embedded into the portrait image uploaded by the user to distort the deep fake result of the image, and the authenticity of the image can be distinguished within the range of human eyes. The present invention has a general defense capability against a variety of deep fake models. Users can embed perturbations before applying personal portraits, which can greatly prevent malicious synthesis of deep fake models and prevent forged portrait images from passing liveness detection. The system has extremely high defense and security, and effectively protects the privacy and security of users.

[0140] Glossary:

[0141] Deep fake model: A model used to attack and tamper with facial portrait images. If the attack is successful, a fake image with the original image’s face and the target attack attributes will be displayed based on its attack attributes. The goal is to make people believe the authenticity of the fake result.

[0142] Attack attributes: different directions of attack and tampering by deep fake models, such as: modifying the skin color of the portrait, modifying the hair color of the portrait, adding a beard to the portrait, changing the gender of the portrait, etc.

[0143] Adversarial perturbation: A perturbation used to disrupt the deepfake model attack process. After being embedded in the image, it will make the malicious tampering operation fail. At the same time, it will produce more obvious artifacts in the forged image, allowing users to judge that the image is fake at a glance;

[0144] Saliency bias horizontal fusion: within a horizontal round, the adversarial perturbation images generated by the parallel deep fake model attack perturbation images are fused to generate temporary perturbations;

[0145] Saliency bias vertical fusion: In multiple vertical rounds, the temporary perturbations of each round are fused until the set threshold is met to obtain the final universal adversarial perturbation to improve the generalization and robustness of the perturbation;

[0146] Original images: pure images randomly extracted from the CelebA and CASIA-WebFace datasets without any perturbations or noise;

[0147] Data-augmented image / enhanced image: The original image is converted to the Lab domain, and then subjected to image enhancement operations such as random parameter jumps and random transformation methods, including changing the portrait angle and adjusting the light environment, to simulate the real scene of the image;

[0148] Adversarial samples: image samples that have had initial perturbations and initial step sizes added to data-augmented images but have not yet been attacked by a deep fake model;

[0149] Forged image: For the processed adversarial sample, the image result is obtained after the deep forgery model fights against the perturbation in the sample;

[0150] Adversarial perturbation image: For the forged images after the parallel branches are attacked, the fusion results are obtained by performing significant bias fusion on them.

[0151] Embodiment 2:

[0152] This embodiment provides a face active defense method for portrait protection. Figure 6 , Figure 7 As shown, the steps include:

[0153] Step 1: Obtain a training data set; the training data set includes a plurality of portrait images;

[0154] Step 2: Perform data enhancement on the training data set to obtain a data enhanced image;

[0155] Step 3: Initialize the parameters of the enhanced image and add random initial perturbations to obtain adversarial samples;

[0156] Step 4: After adding the initial step size to the adversarial sample, input it into each parallel deep fake model to generate adversarial perturbations. Use a hybrid attack method in each model adversarial path to make the adversarial sample and the deep fake model generate adversarial perturbations of the branch. Use horizontal significant bias fusion to fuse each branch perturbation into a temporary perturbation. Then, use the tree Parzen automatic optimization method (TPE parameter optimization) to select the step size of the next round based on the historical best measurement value. Use the vertical significant bias fusion method to fuse the temporary perturbation of the next round with the temporary perturbation of the current round. Repeat steps 3-4 until the perturbation reaches the set threshold, stop iteration, and obtain the best perturbation, which is the final adversarial perturbation.

[0157] Step 5: Obtain a facial portrait image to be protected, embed the adversarial perturbation into the facial portrait image to be protected, and obtain an output image.

[0158] Specifically, the method comprises the following specific steps:

[0159] 1) Upload a face portrait image and perform data enhancement: Randomly select various enhancement operations in the Lab domain to increase the complexity of the image data:

[0160] 1-1) Prepare a certain number of portrait pictures;

[0161] 1-2) Operate the Lab color space for data enhancement, convert the image from the RGB space to the Lab space, randomly change the color channel values, and then randomly select other enhancement methods from the two set basic enhancement methods, such as lighting environment change, image angle change, etc., to obtain the enhanced image to simulate real scenes in real life.

[0162] Before converting RGB to Lab, you need to convert RGB to XYZ: First, use gamma transformation to normalize r, g, and b respectively. Take the r channel as an example: , so that the value range of the color channel is controlled within [0,1], while improving the image contrast; and then use the linear transformation matrix M to convert the space into XYZ:

[0163]

[0164] [ X Y Z ] = M * [ R G B ]

[0165] Among them, the gamma function can perform nonlinear tonal editing on the image to improve the image contrast, highlight more meaningful facial information, and enhance the data; in the linear transformation, M is based on standard observation conditions, that is, M= [ 0 . 4124 , 0 . 3576 , 0 . 1805 0 . 2126 , 0 . 7152 , 0 . 0722 0 . 0193 , 0 . 1192 , 0 . 9505 ] , by multiplying the two matrices, we get the following result: , thus obtaining the values ​​of X, Y, and Z;

[0166] Then transfer from XYZ to LAB domain, according to the pre-set reference white point and intermediate variable function conversion:

[0167] L * = 116 f ( Y / Y ) − 16 a * = 500 [ f ( X / Xn ) − f ( Y / Y )] b * = 200 [ f ( Y / Y ) − f ( Z / Zn )]

[0168]

[0169] Among them, L*, a*, and b* refer to the values ​​of the three channels of the Lab color space after the final conversion; , , are the XYZ values ​​of the D65 standard reference white point, and their values ​​are =95.047, =100.0, =108.883, used to define neutral colors and adjust Lab color coordinates; It is an intermediate variable function used to map XYZ to the Lab domain; X, Y, and Z refer to the values ​​calculated after converting RGB to XYZ in the previous step.

[0170] The difference from Example 1 is that after the method of this embodiment is transferred to the Lab domain, the values ​​of color channels a and b are randomly changed, and then other enhancement methods are randomly selected from the two set basic enhancement methods:

[0171] Algorithm 1.Lab data enhancement algorithm

[0172] Input: n batches of face images to be trained , the batch size is m, and the method for randomly jumping the values ​​of channels a and b in the Lab domain is , the method of randomly selecting basic image enhancement is F( ), and the basic image enhancement sets of image operation parameters that control the random transformation method are , .

[0173] Output: batches of images after data augmentation .

[0174] Among them, for each image in each batch, it is first converted from RGB space to Lab domain, and the random jump method T is used to perform random value transformation on a and b channels. Then, the function F is used to randomly select a method from the choice1 set and the choice2 set for image enhancement, and then the image is converted from Lab domain back to RGB space, and finally the enhanced image is returned: that is, the following processing is performed on each image in turn:

[0175]

[0176] In The option means to perform a random lighting transformation on the image, increasing or decreasing the brightness of the image based on its original lighting intensity. The specific steps are:

[0177] First, the image is converted from the Lab domain to the HSV space, the brightness component of the HSV image is extracted, and it is normalized to the range of [0, 1]; then, the normalized brightness is Gamma transformed, the brightness value of each pixel is exponentially calculated with the Gamma value as the exponent, and then the brightness value after Gamma transformation is rescaled to the range of [0, 255]; then, the pixel values ​​that exceed the legal range are truncated so that they do not exceed the range, and the values ​​greater than 255 are truncated to 255, and the values ​​less than 0 are truncated to 0; finally, the HSV image after the light intensity transformation is converted back to the Lab image:

[0178]

[0179] in, represents the pixel value of the input image, represents the pixel value of the output image, Represents the selected Gamma value. When , the brightness of the darker areas in the image will be enhanced, while the brightness of the brighter areas will be reduced, making the image darker and the contrast higher; when When the brightness of the brighter areas in the image is enhanced and the brightness of the darker areas is reduced, the overall image becomes brighter and the contrast is enhanced. Initially, the Gamma value range is set between [0.5, 2]. When using the enhancement method, a Gamma value is randomly selected from this interval.

[0180] 2) Initialize the parameters of the enhanced image data:

[0181] 2-1) Add initial random perturbations to the enhanced image Get adversarial examples;

[0182] 2-2) Add the adversarial examples and each initial step sequence to the parallel deep fake model path at the same time;

[0183] 3) Start generating adversarial perturbations against multiple deepfake models in parallel:

[0184] 3-1) Multi-model generation: The adversarial sample with the initial step length is input into each parallel deep fake model. Multiple deep fake models are sequentially attacked by PGD input layer and ILA middle layer in parallel to generate adversarial perturbations, including:

[0185] Add a perturbation:

[0186] Implementing forgery:

[0187] in, represents a data augmented image, and the superscript L represents a data augmented image. represents the adversarial sample of the rth round, and the superscript P represents the adversarial sample obtained by attacking the input layer. represents the starting disturbance added in round r;

[0188] In parallel branching, represents the forged result after the deep forgery model of the i-th branch attacks the adversarial sample in the r-th iteration, i represents the branch number, i=1,2,...,m, m represents the total number of branches of the deep forgery network;

[0189] represents the deep fake model of tampered face portrait of the i-th branch, which is used to attack the input portrait image, G i () represents the forged result of the deep forgery model of the i-th branch, Deep fake model corresponding to the i-th branch The attack attribute used indicates the type or direction of forgery on the target image.

[0190] Input a batch of images enhanced by Lab data Enter the Deep Fake Model The original output result is obtained After that, the initial disturbance and Input into the deep fake model together The initial distorted output result is obtained , using the root mean square error RMSE (Root Mean Square Error) method to measure the difference and The difference between them is to find a set of adversarial samples in the sample space that maximizes the Loss, that is, the largest 𝑊 in the following formula:

[0191]

[0192] in, The value is the set threshold to avoid adding too large a disturbance 𝑊, to prevent the disturbance from being too obvious after embedding into the original image, thus interfering with the use of the original image and causing poor perturbation concealment.

[0193] 3-2) Each path uses a hybrid attack method to generate perturbations. First, the PGD gradient attack is used to perform forward and backward propagation in sequence using a small step and multiple walk strategy. The current perturbation is updated according to the gradient to obtain the adversarial perception perturbation of a single image for the current specific deep fake model, including:

[0194]

[0195]

[0196] in, Indicates that the maximum disturbance is added adversarial sample, s is the basic attack step sequence, Loss is the loss function, here is the root mean square error (RMSE), represents a deep fake model (r=1,2,3,4) that tampered with the face portrait, and the clip operation ensures The range constraint is [ X − ε , X + ε ] between.

[0197] Obtain the final calculated initial perturbation adversarial sample after PGD attack Afterwards, the branch perturbation is obtained by taking the difference between it and the data augmented image.

[0198] Different from Example 1, the method in this embodiment adds an "intermediate layer attack" (ILA), which attacks the intermediate layer of the neural network. The intermediate layer attack is performed on the basis of the input attack to enhance the migration of the disturbance, that is, it can effectively defend against unknown black box models.

[0199] Then, after the PGD input layer attack calculates the initial perturbation of the branch, the ILA intermediate layer attack is further used to fine-tune the new perturbation to project the maximum value in the direction of the initial perturbation. The processing process is shown in Algorithm 2:

[0200] Algorithm 2. ILA middle layer attack algorithm

[0201] Input: Initial perturbation adversarial sample after PGD attack , calculate the output function of the intermediate layer , learning rate size , number of iterations , loss function .

[0202] Output: Perturbed adversarial sample after ILA attack .

[0203] Among them, before the middle layer attack begins, Initialized to the initial perturbation adversarial sample after PGD attack : Initial perturbation adversarial sample after PGD attack , in each round of iteration, the perturbation of PGD attack is calculated in turn as well as The difference between the intermediate output layer and the original image is then calculated The direction vector that should be taken is used to indicate the update direction that the new perturbation should take:

[0204]

[0205]

[0206]

[0207]

[0208] Finally, the updated adversarial sample is restricted to avoid distortion of the protected image caused by perturbation, and the final calculated perturbed adversarial sample after ILA attack is output. .

[0209] Obtain the final calculated perturbation adversarial sample after ILA attack Afterwards, the branch perturbation is obtained by taking the difference between it and the data augmented image.

[0210] The core idea of ​​the ILA attack is to find a , so that the new intermediate layer output difference Match as much as possible direction, and maximize the perturbation constraint in that direction, that is, exist The projection in the direction is the largest. After ignoring the constant, the loss function L of this target can be defined as: .

[0211] 3-3) Significant bias fusion, generating temporary perturbations round by round. In horizontal fusion, for the part where the loss function Loss value is less than the set threshold, it is considered that the difference between the forged result of the original image and the forged result of the adversarial sample is too small, and an XOR operation is performed round by round to obtain the temporary perturbation result of the final fusion of this round:

[0212]

[0213] where

[0214] in, represents the result of the r-th round of lateral significant bias fusion, that is, the r-th round of temporary disturbance; R(W i ) represents the process of lateral fusion of the r-th round of disturbances, represents the horizontal fusion function, represents the starting perturbation added in the rth round; i represents the sequence number of each perturbation generation path, i represents the branch number, i=1,2,...,m, m represents the total number of branches of the deep fake network, and j represents the loss function Loss value of the branch perturbation is less than the set threshold The branch number of the part, , G j () represents the forged result of the deep forgery model of the j-th branch, represents the branch adversarial sample of the j-th branch.

[0215] In vertical fusion, after obtaining the adversarial perturbation result of this round, it is necessary to fuse the adversarial perturbation images of different rounds to obtain the final perturbation result after each round of fusion superposition. The formula is as follows:

[0216]

[0217] in, is the weight coefficient, set to 0.8, is the temporary disturbance obtained after the rth round of horizontal fusion represents the starting disturbance added in round r; It represents the longitudinal disturbance after longitudinal fusion after the rth round of weighted fusion.

[0218] Use it as the next round of perturbation and continue iterating until the required .

[0219] Iterate the above steps 3-2)-3-3) to obtain the longitudinal disturbance after longitudinal fusion each time. , calculate the value of its loss function RMSE:

[0220]

[0221] Where i represents the branch number, i=1,2,...,m, and m represents the total number of branches in the deep fake network.

[0222] If the longitudinal disturbance after this round of longitudinal fusion The loss function value calculated by is greater than the loss function value corresponding to the best adversarial perturbation at this time, and the longitudinal perturbation obtained after this round of longitudinal fusion is To satisfy the L2 norm is less than the threshold , then the best adversarial perception disturbance is updated to the longitudinal disturbance after this round of longitudinal fusion , otherwise it will not be updated;

[0223] The longitudinal disturbance after longitudinal fusion of this round As the start perturbation W of the next round r+1 Continue to iterate step B-step F until the set number of iterations is met or the best adversarial perturbation does not change after a preset number of times, and output the best adversarial perturbation at this time.

[0224] 3-4) Use the tree structure Parzen Estimator algorithm (TPE parameter optimization method) to automatically find the attack step size suitable for different models and input it into the next iteration. Since the basic attack method PGD belongs to the FGSM family, the gradient is the signed function normalized, that is:

[0225]

[0226] In the actual calculation process, The value of will almost never reach 0, so for any gradient is fixed, and the perturbation of the iterative or updated symbol-based attack method It is expressed as:

[0227]

[0228] That is, during the attack process, only the step length s affects the update frequency, and the choice of s has a great impact on the attack performance.

[0229] ,so It can be approximately expressed as , that is, during the attack process, only the step length s affects the update frequency.

[0230] The perturbations after each round of update in the attack iteration across models Multiple models Combination of:

[0231]

[0232] Among them, 𝑚 is the number of models, and the weight parameter is the initial constant, symbol for Therefore, the overall optimization direction is affected by the step size domination.

[0233] 3-5) Use the TPE parameter optimization method to automatically find the most suitable step sequence. Since the basic attack method PGD belongs to the FGSM family, the gradient is the signed function normalized, that is:

[0234]

[0235] In the actual calculation process, the difference between the result of attacking the adversarial sample and the result of attacking the original image should be as large as possible, so The value of will almost never reach 0, for any gradient is fixed, so the perturbation of the iterative or updated perturbation based on the symbolic attack method It can be expressed as , that is, during the attack process, only the s step sequence affects the size of the gradient update, and the choice of s has a great impact on the attack performance. At the same time, for multi-model attacks, each round of perturbation after the update in the iteration Multiple models Combination of:

[0236]

[0237] Among them, 𝑚 is the number of models, and the weight parameter is the initial constant, symbol is the optimization direction of the perturbation. Therefore, the overall optimization direction is affected by the step size domination.

[0238] Using the TPE parameter optimization method, we build models sequentially based on historical parameter measurements to approximate the performance of hyperparameters, then select new hyperparameters for testing, and continuously look for better step sizes by optimizing the expected improvement method in each search iteration. , and input it into the training network again for the next round of perturbation. The uniform consideration is the hyperparameter x, and the attack success rate is set to the associated quality score y of TPE.

[0239] TPE is defined using two density functions: :

[0240]

[0241] Among them, y* is determined by the best historical measurement value, that is, the threshold, and the density function From the observation space Establish, corresponding is less than y*, The density formed by the remaining observations. TPE uses the expected EI as the acquisition function in each search iteration. The improved method continuously searches for a better step size. The formula for the expected EI is as follows:

[0242]

[0243] right is defined as:

[0244]

[0245] Among them, TPE constructs different distributions for observation points x on both sides of the threshold. By setting a hyperparameter as the quantile of y such that , which indicates the proportion of the best observations to construct a good distribution to the total observations, and is mainly used to divide and .

[0246] Then Substituting into formula (17) can simplify the expectation to:

[0247]

[0248] Thus we get ,when Once determined, the size of the denominator depends only on the ratio of the probabilities at both ends. , which means that the target x at each iteration is to make The x with the largest ratio.

[0249] 3-5) Embed the perturbation results into the portrait image to generate the final active defense image.

[0250] The detection method of this method is as follows:

[0251] Testing and implementation environment

[0252] Operating system: Windows 10 and above

[0253] Database: MySQL 8.0.23

[0254] JavaScript library: jQuery 3.6.0

[0255] Backend language: Java 11

[0256] Neural network framework: PyTorch 1.9.0

[0257] Integrated development environment: IntelliJ IDEA 2021.1.1

[0258] Version control tool: Git 2.32.0

[0259] Automated testing tool: Selenium WebDriver 4.0.0-beta.2

[0260] Defect management tool: Jira 8.15.0

[0261] Logging tool: Log4j 2.14.1

[0262] Load testing tool: Apache JMeter 5.4.1

[0263] Unit testing framework: JUnit 5.8.0

[0264] Integration testing framework: TestNG 7.4.0

[0265] Code analysis tool: SonarQube 9.2

[0266] Code coverage tool: JaCoCo 0.8.7

[0267] The environment includes various development and testing tools, as well as the operating systems, databases, JavaScript libraries, backend languages, neural network frameworks, and other environments that need to be tested. It also includes some commonly used testing tools, such as automated testing tools, defect management tools, logging tools, load testing tools, unit testing frameworks, integrated testing frameworks, code analysis tools, code coverage tools, etc. The integrated development environment uses IntelliJ IDEA.

[0268] The testing process in this embodiment is as follows Figure 4 The test results are shown in Figure 5 shown.

[0269] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0270] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0271] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0272] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0273] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A face active defense method for portrait protection, characterized in that: The method comprises the following steps: Obtain a training set; the training set includes a plurality of portrait images; Performing data enhancement on the training set to obtain a data enhanced image; Generate initial perturbation and initial step size; The data-augmented image, the initial perturbation and the initial step size are input into a deep fake network, adversarial perturbation is generated by a hybrid attack method and a saliency bias fusion method, and the final adversarial perturbation is obtained by iteration; the deep fake network includes a plurality of parallel perturbation generation branches, each of which is provided with a deep fake model; Acquire a facial portrait image to be protected, embed the final adversarial perturbation into the facial portrait image to be protected, and obtain an output image; The data augmented image, initial perturbation and initial step size are input into the deep fake network, adversarial perturbation is generated through a hybrid attack method and a saliency bias fusion method, and the final adversarial perturbation is iteratively obtained, including: Step A: adding an initial perturbation to the data augmented image to obtain an adversarial sample; using the initial step length as the step length of the deep fake model in each path; Step B: inputting the data augmented image and the adversarial sample of this round into all perturbation generation branches of the deep fake network in parallel, respectively, to obtain the forged results of the deep fake model of each branch for the data augmented image and the forged results for the adversarial sample at this time; Step C: Calculate the gradient value of the loss function of each branch according to the forged result of the deep forgery model of each branch for the data augmented image and the forged result of the adversarial sample at this time, and generate the branch perturbation of each branch according to the gradient value and step size of the loss function of each branch; Step D: horizontally merge the branch disturbances of each branch to obtain the temporary disturbance of this round; Step E: Through TPE parameter optimization, the step size of the deep fake model in each path of the next round is selected based on the historical best measurement value; Step F: After each round of horizontal fusion generates temporary perturbations, they are vertically fused with all the previous rounds of temporary perturbations to update and form vertical perturbations, and the vertical perturbations are combined with the data augmented images as the starting perturbations of the next round to update and form the adversarial samples of the next round; Step G: Repeat Step B-Step F until the best adversarial perturbation is generated.

2. The active face protection method for portrait protection according to claim 1, characterized in that: The training set is subjected to data enhancement, including: Convert the portrait images in the training set from RGB mode to Lab space domain to obtain images in Lab space domain; Perform data enhancement on the image in the Lab space domain to obtain an enhanced image in the Lab space domain; The enhanced Lab spatial domain image is subjected to random jumping parameter processing to obtain a noise image; Convert the noise image from the Lab space domain back to the RGB mode to obtain a noise image in the RGB mode; Add RGB mode noise images to the training set to obtain data augmented images.

3. The active face protection method for portrait protection according to claim 1, characterized in that: The initial disturbance and initial step length are both randomly generated; The deep fake network includes 4 parallel perturbation generation paths; in one round, the four paths generate a total of four different adversarial results; the initial step length is 4, including s1, s2, s3, and s4; A deep fake model is set on each perturbation generation path. The input of each perturbation generation path is an adversarial sample, and the output is the branch perturbation generated by the deep fake model in each path.

4. The active face protection method for portrait protection according to claim 1, characterized in that: Step B: respectively inputting the data augmented image and the adversarial sample of this round into all perturbation generation branches of the deep forgery network in parallel, and obtaining the forgery results of the deep forgery model of each branch for the data augmented image and the forgery results for the adversarial sample at this time, including: Generate fake results as follows: Add a perturbation: ; Implementing forgery: ; in, represents a data augmented image, and the superscript L represents a data augmented image. represents the adversarial sample of the rth round, the superscript P represents the adversarial sample obtained by attacking the input layer, and W r represents the starting disturbance added in round r; In parallel branching, represents the forged result after the deep forgery model of the i-th branch attacks the adversarial sample in the r-th iteration, i represents the branch number, i=1,2,...,m, m represents the total number of branches of the deep forgery network; represents the deep fake model of tampered face portrait of the i-th branch, which is used to attack the input portrait image, G i () represents the forged result of the deep forgery model of the i-th branch, C i Deep fake model corresponding to the i-th branch The attack attribute used indicates the type or direction of forgery on the target image.

5. The active face protection method for portrait protection according to claim 4, characterized in that: Step C: Calculate the gradient value of the loss function of each branch according to the forged result of the deep forgery model of each branch for the data augmented image and the forged result of the adversarial sample at this time, and generate the branch perturbation of each branch according to the gradient value and step size of the loss function of each branch, including: Use the projected gradient descent method PGD as the input layer attack method, and calculate the gradient value of the loss function of each branch based on the forged results of the deep forgery model of each branch for the data augmented image and the forged results of the adversarial sample at this time. ; According to the following formula, the branch adversarial sample variation of each branch is generated according to the gradient value and step size of the loss function of each branch: ; Among them, T i represents the change in the adversarial sample after the update perturbation of the i-th branch, s i represents the attack step length of the i-th branch, represents the data augmented image, W r represents the starting disturbance added in round r, Represents the current gradient value of the loss function, It represents the forgery result of the deep forgery model of the i-th branch for the adversarial sample at this time, represents the forgery result of the deep forgery model of the i-th branch for the data augmented image; Loss() represents the attack loss function, using the root mean square error RMSE method; sign() represents the sign function, which is used to ensure that the update direction is correct; According to the change of branch adversarial samples of each branch, the branch adversarial samples of each branch are updated according to the following formula: ; Among them, X i P represents the branch adversarial sample of the i-th branch, Indicates that the operation guarantees that the range is constrained within The clip operation between ɛ represents the threshold value, and X represents the data-enhanced image or the original image without adding disturbance; The branch adversarial sample of the i-th branch is decomposed as follows: ; in, is the temporary branch perturbation of the i-th branch in the r-th round; Bring the branch adversarial samples and data augmented images of each branch into the loss function to calculate the loss function: ; in, Represents the L2 norm of the temporary branch perturbation of this round; If the temporary branch disturbance of this round The loss function value calculated by is greater than the branch perturbation W at this time i The corresponding loss function value, and the temporary branch perturbation of this round Satisfy its L2 norm is less than the threshold , then the branch perturbation W i Updated to this round's temporary branch disturbance , otherwise it will not be updated.

6. The active face protection method for portrait protection according to claim 5, characterized in that: Step C: Calculate the gradient value of the loss function of each branch according to the forged result of the deep forgery model of each branch for the data augmented image and the forged result of the adversarial sample at this time, and generate the branch perturbation of each branch according to the gradient value and step size of the loss function of each branch, further comprising: After obtaining the updated branch adversarial samples of each branch Finally, use the ILA method to perform a middle-layer attack on it: The results of the middle layer branches of each branch are confronted Initialized as data augmented image : ; in, is the adversarial sample of the middle layer branch of the i-th branch; Calculate the intermediate layer attack adversarial samples of each branch separately And the input layer of each branch attacks the adversarial sample Respectively with data augmented images Differences in the output of the middle layer: ; ; ; ; in, is the output function of the intermediate layer. is the i-th branch-to-branch adversarial sample The middle layer output is For the i-th branch to the new adversarial sample The new intermediate layer output is is the difference in the intermediate layer output of the i-th branch with respect to the branch adversarial sample, is the difference in the new intermediate layer output of the i-th branch regarding the new adversarial sample; Update the intermediate layer branch adversarial samples of each branch by the following formula: ; Among them, lr represents the learning rate, which is used to control the amplitude of the anti-disturbance update during the optimization process, and sign() represents the sign function, which is used to ensure the correct update direction. Indication command exist The maximum loss function of the projection direction is defined as: ; Represents the gradient value of the current loss function; clip() represents the clip operation, which is used to ensure that the range constraint is within between; represents the threshold, X represents the data-enhanced image or the original image without adding disturbance; The adversarial sample of the intermediate layer branch of the i-th branch is decomposed as follows: ; in, is the temporary branch disturbance of the i-th branch in this round; Bring the branch adversarial samples and data augmented images of each branch into the loss function to calculate the loss function: ; If the temporary branch disturbance of this round The loss function value calculated by is greater than the branch perturbation W at this time i The corresponding loss function value, and the temporary branch perturbation of this round Satisfy its L2 norm is less than the threshold , then the branch perturbation W i Updated to this round's temporary branch disturbance , otherwise it will not be updated.

7. The active face protection method for portrait protection according to claim 6, characterized in that: Step D: horizontally merge the branch disturbances of each branch to obtain the temporary disturbance of this round, including: The loss function Loss value of the branch perturbation of each branch is less than the set threshold For the part, it is considered that the difference between the forged result of the image and the forged result of the adversarial sample is too small. This part of the perturbation is subjected to XOR operation round by round, and the final fused temporary perturbation result of this round is updated according to the following formula: ; in, represents the result of the r-th round of lateral significant bias fusion, that is, the r-th round of temporary disturbance; R(W i ) represents the process of horizontal fusion of the r-th round of disturbance, R() represents the horizontal fusion function, W r Indicates the starting perturbation added in the rth round; i indicates the branch number generated by each perturbation, i=1,2,...,m, m indicates the total number of branches of the deep fake network, and j indicates that the loss function Loss value of the branch perturbation is less than the set threshold The branch number of the part, , represents the forged result of the deep forgery model of the j-th branch, Represents the exclusive OR symbol, represents the branch adversarial sample of the j-th branch, and arg() represents the arg function.

8. The active face protection method for portrait protection according to claim 4, characterized in that: Step F: After each round of horizontal fusion generates temporary disturbances, they are vertically fused with all previous rounds of temporary disturbances to update the longitudinal disturbances, including: The longitudinal disturbance is updated as follows: ; in, is the weight coefficient, set to 0.8, is the temporary disturbance obtained after the rth round of horizontal fusion, represents the starting disturbance added in round r; It represents the longitudinal disturbance after longitudinal fusion after the rth round of weighted fusion.

9. The active face protection method for portrait protection according to claim 4, characterized in that: Step G: Repeat steps B-F until the best adversarial perturbation is generated, including: Iterate step B to step F, and each time get the longitudinal disturbance after the current round of longitudinal fusion , calculate the value of its loss function RMSE: ; Where i represents the branch number, i=1,2,...,m, m represents the total number of branches of the deep fake network, and RMSE() represents the root mean square error function; It represents the forgery result of the deep forgery model of the i-th branch for the adversarial sample with the added longitudinal perturbation in this round, represents the forgery result of the deep forgery model of the i-th branch for the data augmented image; If the longitudinal disturbance after this round of longitudinal fusion The loss function value calculated by is greater than the loss function value corresponding to the best adversarial perturbation at this time, and the longitudinal perturbation obtained after this round of longitudinal fusion is Satisfy its L2 norm is less than the threshold , then the best adversarial perception disturbance is updated to the longitudinal disturbance after this round of longitudinal fusion , otherwise it will not be updated; The longitudinal disturbance after longitudinal fusion of this round As the start perturbation W of the next round r+1 Continue to iterate step B-step F until the set number of iterations is met or the best adversarial perturbation does not change after a preset number of times, and output the best adversarial perturbation at this time.

Citation Information

Patent Citations

  • Active defense method for deep face tampering

    CN112883874A

  • Image retrieval defense method and system based on noise network and image preprocessing

    CN116257648A

  • Training method for robust neural network based on feature matching

    US20230089335A1