An attack-proof high-precision face recognition model training method, system, terminal and medium

By using data augmentation and loss function adjustment, a high-precision face recognition model resistant to attacks is formed, which solves the problem of misidentification caused by mask attacks in existing technologies and improves the attack resistance and accuracy of the recognition system.

CN117173771BActive Publication Date: 2026-04-07SHENZHEN SMART-CORE LINK TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing facial recognition systems are difficult to prevent attacks while wearing masks because they are sensitive to certain facial features, leading to false recognition.

Method used

By employing data augmentation and loss function adjustments during training, including reconstructing facial data, calculating cosine similarity, and determining thresholds, a high-precision, attack-resistant facial recognition model is formed.

Benefits of technology

It improves the anti-attack capability and recognition accuracy of facial recognition, and reduces the false recognition rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure GDA0005630507630000011
    Figure GDA0005630507630000011
Patent Text Reader

Abstract

The application discloses a kind of attack prevention high-precision face recognition model training method, system, terminal and medium, the method includes the following steps: S1: input n original face data and obtain loss function L1 for training;S2: collect m face data, based on m original face data, reorganization obtains m / 2 reorganization face data;S3: the cosine similarity of reorganization face data and its corresponding two original face data before reorganization is calculated, and the average of the two cosine similarities obtained is obtained, obtains m / 2 average, S4: whether m / 2 average value corresponds to meet threshold value, if yes, corresponding average value is counted as loss value, if no, corresponding loss value is 0;S5: calculate loss value total value L and L2=L / m / 2;S6: loss function L1 and L2 are superposed to obtain the final loss function L 总 .
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to an attack-proof high-precision face recognition model training method, system, terminal and medium. BACKGROUND

[0002] The recognition model function used in the current face recognition system is generally obtained by training original face data, and it is generally difficult to prevent the case of half-mask attack recognition, because face recognition is very sensitive to certain features, such as the eye and nose regions of a person, and once these regions reach a sufficient similarity in comparison, they will be recognized as the same person by face recognition. SUMMARY

[0003] In order to overcome the defects in the prior art, the application provides an attack-proof high-precision face recognition model training method, and the specific technical scheme is as follows:

[0004] An attack-proof high-precision face recognition model training method comprises the following steps:

[0005] S1: inputting n original face data for training to obtain a loss function L1: arcface;

[0006] S2: collecting m face data, and recombining the m original face data to obtain m / 2 recombined face data;

[0007] S3: performing cosine similarity calculation on the recombined face data and its corresponding two original face data, and averaging the two cosine similarities obtained, to obtain m / 2 average values, wherein the cosine similarity calculation formula is:

[0008]

[0009] S4: judging whether the m / 2 average values meet a threshold value, if yes, counting the corresponding average value as a loss value, and if not, counting the loss value as 0;

[0010] S5: calculating a total loss value L and L2=L / (m / 2);

[0011] S6: superimposing the loss functions L1 and L2 to obtain a final loss function L 总 .

[0012] In S2, the following steps are included:

[0013] S21: randomly pairing the m original face data two by two to form m / 2 pairs of face data;

[0014] S22: When processing each pair of face data, the H channel and S channel mean values of the two face data are calculated after the rgb image is converted to HSV representation, wherein the H channel mean value in one face data is H1, the S channel mean value is S1, the H channel mean value in the other face data is H2, and the S channel mean value is S2;

[0015] S23: Calculate |(H1-H2) / H1| | 、 | (S1-S2) / S1 | ;

[0016] S24: If |(H1-H2) / H1|>0.2, then H1=H1(+ / -)0.2(H1-H2), wherein H1-H2>0, then "+" is selected, H1-H2<0, then "-" is selected, if |(S1-S2) / S1|>0.2, then S1=S1(+ / -)0.2(S1-S2), wherein S1-S2>0, then "+" is selected, S1-S2<0, then "-" is selected, repeat the step until |(H1-H2) / H1|<0.2 and |(S1-S2) / S1|<0.2.

[0017] S25: When processing each pair of face data, the model of the two face data is divided into an n*n square grid with equal length; the multiple square grids at the corresponding positions of the two face data models are exchanged to form reorganized face data.

[0018] Wherein, the part of the two face data exchanged only includes the facial feature part.

[0019] In S4, the threshold value is 0.5, and if it is greater than 0.5, it meets the requirement.

[0020] In S6, the processing formula is: L 总 = alpha L1+ beta L2, wherein alpha and beta are the coefficients of the two functions, alpha=0.9, and beta=0.1.

[0021] An anti-attack high-precision face recognition model training system, comprising:

[0022] A loss function acquisition module for inputting n original face data for training to obtain a loss function L1: arcface;

[0023] A reorganized face data acquisition module for collecting m face data, reorganizing based on m original face data to obtain m / 2 reorganized face data;

[0024] A cosine similarity value calculation module is configured to calculate the cosine similarity of the recombined face data and the two original face data corresponding to the recombined face data, and average the two cosine similarity values to obtain m / 2 average values.

[0025] A judgment module is configured to judge whether the m / 2 average values satisfy a threshold value, and if yes, count the corresponding average value as a loss value, and if not, count the loss value as 0.

[0026] A loss value calculation module is configured to calculate a total loss value L and L2=L / (m / 2).

[0027] A final loss function acquisition module is configured to superimpose the loss functions L1 and L2 to obtain a final loss function L. 总 .

[0028] The application further provides a terminal comprising a processor and a memory, wherein the memory stores program instructions, and the processor executes the program instructions to implement the steps in the method described above.

[0029] The application further provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the steps in the method described above.

[0030] The application has the following advantages:

[0031] In the application, the training method and the data enhancement method are adjusted, and the global features of the face are comprehensively considered, so that the face recognition model has better effects in preventing such attacks and improving recognition accuracy. DETAILED DESCRIPTION

[0032] The technical solutions in the embodiments of the application will be described clearly and completely below. Obviously, the described embodiments are only some of the embodiments of the application, but not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the application.

[0033] An attack-resistant high-precision face recognition method comprises the following steps:

[0034] S1: input n original face data to obtain a main recognition model function L1 through training;

[0035] S2: collect m face data, and recombine the m original face data to obtain m / 2 recombined face data;

[0036] In S2, the following steps are included:

[0037] S21: m original face data are randomly paired with each other to form m / 2 pairs of face data;

[0038] S22: when processing each pair of face data, the H channel and S channel averages of the two face data are calculated after the rgb image is converted to HSV representation, wherein the average in the H channel of one face data is H1, the average in the S channel is S1, the average in the H channel of the other face data is H2, and the average in the S channel is S2;

[0039] S23: |(H1-H2) / H1 | 、 | (S1-S2) / S1 | ;

[0040] S24: if |(H1-H2) / H1|>0.2, then H1=H1(+ / -)0.2(H1-H2), wherein H1-H2>0, then "+" is selected, H1-H2<0, then "-" is selected, if |(S1-S2) / S1|>0.2, then S1=S1(+ / -)0.2(S1-S2), wherein S1-S2>0, then "+" is selected, S1-S2<0, then "-" is selected, repeat the step until |(H1-H2) / H1|<0.2 and |(S1-S2) / S1|<0.2.

[0041] In one specific embodiment: 128 original face samples (from 128 different people) are collected, the selected face angle rotation should not exceed 10° up and down and left and right to ensure the relative standardization of the reorganized face. Then the 128 faces are randomly paired to generate 64 pairs. The 64 pairs are reorganized, and before face reorganization, the paired faces need to be corrected in HSV average, that is, the color style of the group of faces has higher consistency, which improves the consistency and authenticity of the reorganized face. S25: when processing each pair of face data, the models of the two face data are divided into x*x square grids of equal length; the multiple square grids of corresponding positions of the two face data models are exchanged to form reorganized face data, wherein the value of x is 5<=x<=9; for example: randomly extract each square covering the facial features with a random 50% probability of exchange, specifically, if the face is divided into 5*5 25 squares, the squares covering the facial features may have 15 in them, then each of the 15 squares has a 50% chance of being exchanged with a square from another face, and finally there may be 8 squares exchanged. To highlight the difference of the reorganized face, the exchanged squares should be at least 5, if the exchanged squares are not enough 5 in one random, continue to randomly extract until 5 are supplemented.

[0042] S3: cosine similarity calculation is performed on the recomposed face data and the two original face data corresponding thereto, and the average of the two cosine similarities obtained is taken, wherein the cosine similarity calculation formula is:

[0043]

[0044] S4: whether the m / 2 average values meet the threshold value is judged, if yes, the corresponding average value is taken as the loss value, if no, the loss value is taken as 0;

[0045] In S4, the threshold value is 0.5, and if it is greater than 0.5, it meets the requirement. Here, the threshold value is selected as 0.5, so that even if the face has completely identical features in the local part, the similarity of this part of features can be retained in the training, and the model cannot converge in the training due to the false consideration that the similarity is too high.

[0046] S5: the total loss value L and L2=L / (m / 2) are calculated;

[0047] S6: the loss function L1 and L2 are superimposed to obtain the final loss function L 总 , the processing formula is: L 总 =αL1+βL2, wherein α and β are the coefficients of the two functions, generally α=0.9 and β=0.1.

[0048] The application also provides an anti-attack high-precision face recognition model training system, comprising:

[0049] A loss function acquisition module is configured to input n original face data for training to obtain a loss function L1: arcface.

[0050] A recomposed face data acquisition module is configured to collect m face data, and recompose the m original face data to obtain m / 2 recomposed face data.

[0051] A cosine similarity value calculation module is configured to perform cosine similarity calculation on the recomposed face data and the two original face data corresponding thereto, and take the average of the two cosine similarities obtained, to obtain m / 2 average values.

[0052] A judgment module is configured to judge whether the m / 2 average values meet the threshold value, if yes, the corresponding average value is taken as the loss value, if no, the loss value is taken as 0.

[0053] A loss value calculation module is configured to calculate the total loss value L and L2=L / (m / 2).

[0054] A final loss function acquisition module is configured to superimpose the loss function L1 and L2 to obtain the final loss function L 总 .

[0055] The application also provides a terminal, comprising a processor and a memory, wherein the memory stores program instructions, and the processor executes the program instructions to implement the steps in the method described above.

[0056] The application also provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the steps in the method described above.

[0057] The application has the beneficial effect that a new sample is generated by face combination, and in this process, some technical means are used to make the generated sample look more natural.

[0058] The application proposes a method of training a model by using a generated sample, and avoids the problems that a synthetic sample may cause in training at the method level.

[0059] Although the embodiments of the application have been shown and described, it is to be understood that the application is not limited to these embodiments. It will be obvious to a person skilled in the art that various changes, modifications, replacements and variations can be made to the embodiments without departing from the principles and spirit of the application, and the scope of the application is defined by the appended claims and their equivalents.

Claims

1. A method for training a high-precision, attack-resistant face recognition model, characterized in that: Includes the following steps: S1: Input n raw face data to train and obtain the loss function L1: arcface; S2: Collect m facial data, and reconstruct m / 2 reconstructed facial data based on the m original facial data; S3: Calculate the cosine similarity between the reconstructed face data and its two corresponding original face data, and take the average of the two cosine similarities to obtain m / 2 average values; S4: Determine whether the threshold is met for each of the m / 2 average values. If yes, use the corresponding average value as the loss value; otherwise, set the loss value to 0. S5: Calculate the total loss value L and L2 = L / (m / 2); S6: Superimpose loss functions L1 and L2 to obtain the final loss function L. 总 ; S2 includes the following steps: S21: Randomly pair m original face data into two pairs to form m / 2 pairs of face data; S22: When processing each pair of face data, convert the RGB image to HSV representation and calculate the mean values ​​of the H and S channels of the two face data. In one face data, the mean value of the H channel is H1 and the mean value of the S channel is S1, and in the other face data, the mean value of the H channel is H2 and the mean value of the S channel is S2. S23: Calculate |(H1-H2) / H1| and |(S1-S2) / S1|; S24: If |(H1-H2) / H1|>0.2, then H1=H1(+ / -)0.2(H1-H2), where H1-H2>0, then choose "+", and H1-H2<0, then choose "-". If |(S1-S2) / S1|>0.2, then S1=S1(+ / -)0.2(S1-S2), where S1-S2>0, then choose "+", and S1-S2<0, then choose "-". Repeat this step until |(H1-H2) / H1|<0.2 and |(S1-S2) / S1|<0.

2. S25: When processing each pair of face data, divide the model of each face data into a square grid with a side length of n*n; swap the multiple square grids at corresponding positions of the two face data models to form recombined face data.

2. The anti-attack high-precision face recognition model training method according to claim 1, characterized in that: in, The only part of the two facial data models that are interchanged is the facial features.

3. The anti-attack high-precision face recognition model training method according to claim 1, characterized in that: In S4, the threshold is set to 0.

5. If it is greater than 0.5, the requirement is met.

4. The anti-attack high-precision face recognition model training method according to claim 1, characterized in that: In S6, the processing formula is: L 总 =αL1+βL2, where α and β are the coefficients of the two functions, α=0.9 and β=0.1 respectively.

5. A high-precision, attack-resistant face recognition model training system, characterized in that: include: The loss function acquisition module is used to train n original face data to obtain the loss function L1: arcface; The reconstructed face data acquisition module is used to collect m face data and reconstruct m / 2 reconstructed face data based on m original face data. The cosine similarity calculation module is used to calculate the cosine similarity between the reconstructed face data and its two corresponding original face data before reconstruction, and to take the average of the two cosine similarities to obtain m / 2 average values. The judgment module is used to determine whether the corresponding average values ​​of m / 2 meet the threshold. If yes, the corresponding average value is included as the loss value; otherwise, the corresponding loss value is recorded as 0. The loss value calculation module is used to calculate the total loss value L and L2 = L / (m / 2); The final loss function acquisition module is used to superimpose loss functions L1 and L2 to obtain the final loss function L. 总 ; The reconstructed face data acquisition module randomly pairs m original face data into m / 2 pairs. When processing each pair, the RGB image is converted to HSV representation, and the mean values ​​of the H and S channels of the two face data are calculated. In one face data set, the mean value of the H channel is H1 and the mean value of the S channel is S1; in the other face data set, the mean value of the H channel is H2 and the mean value of the S channel is S2. |(H1-H2) / H1| and |(S1-S2) / S1| are calculated. If |(H1-H2) / H1| > 0.2, then H1 = H1(+ / -)0.2(H1-H2), where H1 If -H2>0, select "+"; if H1-H2<0, select "-". If |(S1-S2) / S1|>0.2, then S1=S1(+ / -)0.2(S1-S2), where S1-S2>0, select "+"; S1-S2<0, select "-". Repeat this step until |(H1-H2) / H1|<0.2 and |(S1-S2) / S1|<0.

2. When processing each pair of face data, divide the model of each face data into a square grid with a side length of n*n. Interchange the multiple square grids at corresponding positions of the two face data models to form recombined face data.

6. A terminal, characterized in that, It includes a processor and a memory, the memory storing program instructions, and the processor executing the program instructions to implement the steps of the method as claimed in any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Face recognition method and model training method thereof

    CN112464916A

  • Method of face expression recognition

    US20230011635A1