CN114463796A - Face counterfeit identification model training method, device, storage medium and apparatus - Google Patents
Face counterfeit identification model training method, device, storage medium and apparatus Download PDFInfo
- Publication number
- CN114463796A CN114463796A CN202011142845.6A CN202011142845A CN114463796A CN 114463796 A CN114463796 A CN 114463796A CN 202011142845 A CN202011142845 A CN 202011142845A CN 114463796 A CN114463796 A CN 114463796A
- Authority
- CN
- China
- Prior art keywords
- model
- face
- preset
- student
- training
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T9/00—Image coding
- G06T9/001—Model-based coding, e.g. wire frame
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
- Collating Specific Patterns (AREA)
Abstract
The invention discloses a face counterfeit identification model training method, device, storage medium and apparatus, and relates to the technical field of biological recognition. When the human face pseudonym is trained, the training process of the student model is supervised by the teacher model, so that transfer learning is realized, and the human face pseudonym is obtained after the student model is converged. The teacher model has higher detection precision than the student model, so that the detection precision of the student model is improved. Meanwhile, the advantage of high speed of the student model is kept, so that the final face identification model can take speed and precision into consideration. The human face fake identifying mold has high fake identifying speed and accuracy when identifying fake of human face image.
Description
Technical Field
The invention relates to the technical field of biological recognition, in particular to a face counterfeit identification model training method, device, storage medium and device.
Background
With the development of face recognition technology, face recognition functions are beginning to be applied in more and more scenes. In order to improve the safety of face recognition, face authentication is added in the face recognition to prevent attacks based on synthetic faces and the like, such as entrance guard, mobile phone payment and the like, which need to ensure the safety of face recognition.
Generally, the calculation power of the entrance guard, the mobile phone or other detection devices is limited, and when the face counterfeit identification function is executed, the speed is often low, which brings great inconvenience. Therefore, how to increase the face authentication speed on the terminal under the condition of limited equipment computing power is a technical problem to be solved urgently.
The above is only for the purpose of assisting understanding of the technical solution of the present invention, and does not represent an admission that the above is the prior art.
Disclosure of Invention
The invention mainly aims to provide a face counterfeit identification model training method, device, storage medium and device, aiming at improving the accuracy and speed of face counterfeit identification on a terminal.
In order to achieve the above object, the present invention provides a training method for a face counterfeit identification model, which comprises the following steps:
identifying the face sample image through a preset student detection model to obtain a first predicted value;
identifying the face sample image through a preset teacher detection model to obtain a second predicted value;
calculating a loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function;
and updating the parameters to be trained in the preset student detection model according to the loss parameters so as to train the student detection model and obtain the face counterfeit identification model.
Optionally, the calculating a loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function includes:
selecting a first output characteristic diagram corresponding to the first predicted value from the output characteristic diagrams of the preset student detection model;
selecting a second output characteristic diagram corresponding to the second predicted value from the output characteristic diagrams of the preset teacher detection model;
calculating a difference matrix between the first output characteristic diagram and the second output characteristic diagram according to a preset distillation loss function;
and determining a loss parameter according to the difference matrix.
Optionally, the determining the loss parameter according to the difference matrix includes:
acquiring a real mark value of the face sample image;
calculating a first true difference between the true tag value and the first predicted value;
and determining a loss parameter according to the first real difference value and the difference value matrix.
Optionally, the determining a loss parameter according to the first true difference and the difference matrix includes:
selecting a corresponding distillation correction coefficient from a first preset coefficient table according to the first real difference value;
correcting the difference matrix according to the distillation correction coefficient to obtain a correction matrix;
and determining a loss parameter according to the correction matrix and the first real difference value.
Optionally, before the calculating the difference matrix between the first output characteristic diagram and the second output characteristic diagram according to the preset distillation loss function, the method further includes:
selecting a corresponding distillation temperature coefficient from a second preset coefficient table according to the first real difference value;
and constructing a preset distillation loss function according to the preset difference function and the distillation temperature coefficient.
Optionally, the selecting a first output feature map corresponding to the first predicted value from the output feature maps of the preset student detection model includes:
acquiring output characteristic graphs of output layers in the preset student detection model, and determining the characteristic quantity of the output characteristic graphs of students;
and selecting the student output characteristic diagram with the largest characteristic quantity as a first output characteristic diagram corresponding to the first predicted value.
Optionally, the selecting a second output feature map corresponding to the second predicted value from the output feature maps of the preset teacher detection model includes:
acquiring output characteristic graphs of all output layers in the preset teacher detection model, and determining the characteristic quantity of all teacher output characteristic graphs;
acquiring the feature quantity of the first output feature map;
and selecting the teacher output feature map with the same feature quantity as the first output feature map as a second output feature map corresponding to the second predicted value.
Optionally, before calculating the loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function, the method further includes:
calculating a prediction difference between the first prediction value and the second prediction value;
and when the prediction difference is larger than a preset difference threshold value, executing the step of calculating a loss parameter between the first prediction value and the second prediction value according to a preset distillation loss function.
Optionally, after the calculating the prediction difference between the first prediction value and the second prediction value, the method further includes:
when the prediction difference is smaller than or equal to a preset difference threshold value, acquiring a real mark value of the face sample image;
calculating a second true difference between the true tag value and the first predicted value;
and updating the parameters to be trained in the preset student detection model according to the second real difference value so as to train the student detection model and obtain the face counterfeit identification model.
Optionally, the identifying the face sample image through the preset student detection model further includes, before obtaining the first predicted value:
acquiring a first target detection network and a second target detection network; wherein the parameter quantity of the first target detection network is smaller than the parameter quantity of the second target detection network;
acquiring a face image training set, and respectively training the first target detection network and the second target detection network through the face image training set to obtain a trained first target detection network and a trained second target detection network;
when the trained first target detection network meets a first preset convergence condition, taking the trained first target detection network as a preset student detection model;
and when the second target detection network after training meets a second preset convergence condition, taking the second target detection network after training as a preset teacher detection model.
Optionally, the updating, according to the loss parameter, a parameter to be trained in the preset student detection model to train the student detection model to obtain a face counterfeit detection model includes:
updating the parameters to be trained in the preset student detection model according to the loss parameters to obtain an adjusted student detection model;
obtaining loss parameters corresponding to the adjusted student detection model;
and when the loss parameter corresponding to the adjusted student detection model is in a preset range, taking the adjusted student detection model as a face counterfeit identification model.
Optionally, the updating, according to the loss parameter, a parameter to be trained in the preset student detection model to train the student detection model, and after obtaining the face authentication model, further includes:
acquiring a face image to be detected, and detecting the face image to be detected through the face authentication model to obtain a detection result;
and when the detection result is the synthesized face, marking the face image to be detected and carrying out early warning.
In addition, in order to achieve the above object, the present invention further provides a face counterfeit detection model training device, including:
the prediction module is used for identifying the face sample image through a preset student detection model to obtain a first prediction value;
the prediction module is further used for identifying the face sample image through a preset teacher detection model to obtain a second prediction value;
the loss calculation module is used for calculating a loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function;
and the parameter adjusting module is used for updating the parameters to be trained in the preset student detection model according to the loss parameters so as to train the student detection model and obtain the face counterfeit identification model.
Optionally, the loss calculation module is further configured to select a first output feature map corresponding to the first predicted value from output feature maps of the preset student detection model;
the loss calculation module is further configured to select a second output feature map corresponding to the second predicted value from the output feature maps of the preset teacher detection model;
the loss calculation module is further used for calculating a difference matrix between the first output characteristic diagram and the second output characteristic diagram according to a preset distillation loss function;
and the loss calculation module is also used for determining a loss parameter according to the difference matrix.
Optionally, the loss calculating module is further configured to obtain a true mark value of the face sample image;
the loss calculation module is further configured to calculate a first true difference between the true tag value and the first predicted value;
the loss calculation module is further configured to determine a loss parameter according to the first true difference and the difference matrix.
Optionally, the loss calculation module is further configured to obtain an output feature map of each output layer in the preset student detection model, and determine a feature quantity of each student output feature map;
the loss calculation module is further configured to select a student output feature map with the largest feature quantity as a first output feature map corresponding to the first predicted value.
Optionally, the human face counterfeit identification model training device further comprises a pre-training module;
the pre-training module is used for acquiring a first target detection network and a second target detection network; wherein the parameter quantity of the first target detection network is smaller than the parameter quantity of the second target detection network;
the pre-training module is further configured to acquire a face image training set, and train the first target detection network and the second target detection network through the face image training set, respectively, to obtain a trained first target detection network and a trained second target detection network;
the pre-training module is further configured to use the trained first target detection network as a preset student detection model when the trained first target detection network meets a first preset convergence condition;
the pre-training module is further configured to use the trained second target detection network as a preset teacher detection model when the trained second target detection network meets a second preset convergence condition.
Optionally, the human face counterfeit detection model training device further comprises a detection module;
the detection module is used for acquiring a face image to be detected and detecting the face image to be detected through the face counterfeit identification model to obtain a detection result;
and the detection module is also used for marking the face image to be detected and carrying out early warning when the detection result is the synthesized face.
In addition, in order to achieve the above object, the present invention further provides a face authentication model training device, including: the face identification model training program is stored on the memory and can run on the processor, and when being executed by the processor, the face identification model training program realizes the steps of the face identification model training method.
In addition, to achieve the above object, the present invention further provides a storage medium, wherein the storage medium stores a face authentication model training program, and the face authentication model training program, when executed by a processor, implements the steps of the face authentication model training method as described above.
In the invention, when the face pseudonym is trained, the teacher model supervises the training process of the student model to realize transfer learning, and the face pseudonym is obtained after the student model converges. The teacher model has higher detection precision than the student model, so that the detection precision of the student model is improved. Meanwhile, the advantage of high speed of the student model is kept, so that the final face identification model can take speed and precision into consideration. The human face fake identifying mold has high fake identifying speed and accuracy when identifying fake of human face image.
Drawings
FIG. 1 is a schematic structural diagram of a human face authentication model training device in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a training method for a face authentication model according to a first embodiment of the present invention;
FIG. 3 is a schematic flow chart of a training method for a face authentication model according to a second embodiment of the present invention;
FIG. 4 is a schematic flowchart illustrating a training method for a face authentication model according to a third embodiment of the present invention;
FIG. 5 is a block diagram of a first embodiment of a face authentication model training device according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a face authentication model training device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the face authentication model training apparatus may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), and the optional user interface 1003 may further include a standard wired interface and a wireless interface, and the wired interface for the user interface 1003 may be a USB interface in the present invention. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory or a Non-volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in FIG. 1 does not constitute a limitation of the face authentication model training device, and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
As shown in FIG. 1, a memory 1005, identified as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a face authentication model training program.
In the training device for the face authentication model shown in fig. 1, the network interface 1004 is mainly used for connecting a background server and performing data communication with the background server; the user interface 1003 is mainly used for connecting user equipment; the face authentication model training device calls a face authentication model training program stored in the memory 1005 through the processor 1001 and executes the face authentication model training method provided by the embodiment of the invention.
Based on the hardware structure, the embodiment of the face counterfeit identification model training method is provided.
Referring to fig. 2, fig. 2 is a schematic flow chart of a training method of a face authentication model according to a first embodiment of the present invention, which is proposed.
In a first embodiment, the method for training the face authentication model includes the following steps:
step S10: and identifying the face sample image through a preset student detection model to obtain a first predicted value.
It should be understood that the execution subject of this embodiment is the face authentication model training device, which has functions of image processing, data communication, and program execution, and the face authentication model training device may be a computer device such as a tablet, a computer, or a server, and of course, other devices with similar functions may also be used, and this embodiment is not limited thereto.
It can be understood that, for improving the user experience, the terminal needs to be able to respond in time when the user interacts with the terminal, such as an access controller, a mobile phone, and the like. Therefore, to avoid network delays, the corresponding calculations are performed on the side. Generally, to ensure the identification accuracy of face counterfeit identification, an identification model with a large parameter quantity is often required. However, the larger the model, the more calculation power is required, which results in slow operation speed of the terminal. In order to increase the speed, a model with a small amount of parameters can be used, but the recognition accuracy is poor.
In the implementation, the preset student detection model can be a lightweight neural network with smaller parameter number, so that the converged face counterfeit identification model can have higher operation speed on a terminal, and meanwhile, the identification precision is improved through the supervision and training of the teacher detection model.
It should be noted that the face sample image may be a picture containing a face, and may also contain a picture synthesizing the face. The process of recognizing the face sample image by the preset student detection model can comprise the processes of feature extraction, classification and the like of the vehicle image. The first predicted value can be a result of a preset student detection model after recognizing the face sample image and is judged to be a real face or a synthesized face; the probability value of the face sample image belonging to a real face or a synthesized face can also be taken.
Step S20: and identifying the face sample image through a preset teacher detection model to obtain a second predicted value.
It can be understood that, in order to ensure the supervised training effect of the preset teacher detection model on the preset student detection model, the preset teacher detection model may have a higher precision, for example, 95% accuracy or the like. Meanwhile, the preset teacher detection model has more parameter quantity. When the supervision training of the preset student detection model is carried out, the parameters of the teacher detection model are kept fixed.
The process of recognizing the face sample image by the preset teacher detection model can also comprise the processes of feature extraction, classification and the like of the vehicle image. The second predicted value can also be a result of the preset student detection model after the face sample image is identified, and is judged to be a real face or a synthesized face; the probability value of the face sample image belonging to a real face or a synthesized face can also be taken.
It should be noted that, in order to increase the training speed, the preset student detection model and the preset teacher detection model may be preliminarily converged models, and both models may be preliminarily trained. In specific implementation, a first target detection network and a second target detection network are obtained; wherein the parameter quantity of the first target detection network is smaller than the parameter quantity of the second target detection network; acquiring a face image training set, and respectively training the first target detection network and the second target detection network through the face image training set to obtain a trained first target detection network and a trained second target detection network; when the trained first target detection network meets a first preset convergence condition, taking the trained first target detection network as a preset student detection model; and when the second target detection network after training meets a second preset convergence condition, taking the second target detection network after training as a preset teacher detection model.
It should be noted that the preset student detection model and the preset teacher detection model may adopt an anchor free (target detection) series detection model. In specific implementation, the preset student detection model can adopt a MobileNet-V2 network, and the preset teacher detection model can adopt a ResNet152 network. Of course, other networks may be used, and this embodiment is not limited thereto.
It can be understood that, in order to ensure the effect of the subsequent supervised training of the preset teacher detection model on the preset student detection model, the prediction accuracy of the preset teacher detection model can be made greater than that of the preset student detection model. For example, the prediction accuracy of the teacher test model is set to 95%, and the prediction accuracy of the student test model is set to 70%. The first and second preset convergence conditions may be prediction accuracy or the number of iterations. Of course, the preset convergence condition may be freely set according to the user requirement, and this embodiment is not limited thereto.
Step S30: calculating a loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function.
It should be noted that, the difference between the first predicted value and the second predicted value may be calculated, and the difference may be used as the loss parameter. For example, the loss parameter is obtained by subtracting the eigenvalue matrix corresponding to the first predicted value from the eigenvalue matrix corresponding to the first predicted value. However, the present embodiment is not limited to this embodiment.
It will be appreciated that the distillation operation may also be required to be performed on the first predicted value and/or the second predicted value before the difference between the first predicted value and the second predicted value is calculated. The distillation operation refers to adjusting the entropy of the characteristic distribution by presetting a distillation temperature coefficient. The specific adjustment effect is related to the selected distillation temperature coefficient.
Step S40: and updating the parameters to be trained in the preset student detection model according to the loss parameters so as to train the student detection model and obtain the face counterfeit identification model.
It can be understood that the loss function may reflect a difference between a predicted result and an actual result of the model, so as to adjust a parameter to be trained in the model according to the difference; wherein, the parameter to be trained can be weight, etc.
It should be noted that after the parameters to be trained in the preset student detection model are updated, the training is repeatedly performed according to the above-mentioned manner, and the parameters to be trained are continuously updated, so that the preset student detection model is converged, and the face authentication model is obtained. During specific implementation, parameters to be trained in the preset student detection model can be updated according to the loss parameters, and an adjusted student detection model is obtained; obtaining loss parameters corresponding to the adjusted student detection model; and when the loss parameter corresponding to the adjusted student detection model is in a preset range, taking the adjusted student detection model as a face counterfeit identification model. Of course, the convergence condition can also be set as the iteration times, and the face counterfeit identification model is obtained when the iteration times are reached.
It can be understood that after obtaining the face authentication model, the terminal device may implement a face authentication function through the face authentication model. During specific implementation, a face image to be detected is obtained, and the face image to be detected is detected through the face counterfeit identification model to obtain a detection result; and when the detection result is the synthesized face, marking the face image to be detected and carrying out early warning.
In the first embodiment, when the face pseudonym is trained, the teacher model supervises the training process of the student model to realize transfer learning, and after the student model converges, the face pseudonym is obtained. The teacher model has higher detection precision than the student model, so that the detection precision of the student model is improved. Meanwhile, the advantage of high speed of the student model is kept, so that the final face identification model can take speed and precision into consideration. The human face fake identifying module of the embodiment has higher fake identifying speed and precision when identifying fake to a human face image.
Referring to fig. 3, fig. 3 is a schematic flow chart of a training method for a face authentication model according to a second embodiment of the present invention, which is based on the first embodiment.
In the second embodiment, step S30 includes:
step S301: and selecting a first output characteristic diagram corresponding to the first predicted value from the output characteristic diagrams of the preset student detection model.
It can be understood that the neural network has a plurality of output layers, each output layer has a corresponding output feature map, and the preset student detection model classifies the feature map output by the last output layer to obtain a final recognition result. The calculation of the loss parameter in this embodiment is specifically directed to the loss parameter between the feature maps output by the preset student detection model and the preset teacher detection model.
In order to enable the loss parameters calculated according to the feature maps to more accurately reflect the difference between the preset student detection model and the preset teacher detection model, the student output feature map with the largest feature quantity is selected as the feature map to be calculated in the embodiment. During specific implementation, acquiring output characteristic diagrams of all output layers in the preset student detection model, and determining the characteristic quantity of the output characteristic diagrams of all students; and selecting the student output characteristic diagram with the largest characteristic quantity as a first output characteristic diagram corresponding to the first predicted value.
Step S302: and selecting a second output characteristic diagram corresponding to the second predicted value from the output characteristic diagrams of the preset teacher detection model.
It can be understood that, in order to calculate the feature maps more accurately, when the output feature map of the preset teacher detection model is selected, the output feature map needs to be matched with the student output feature map. During specific implementation, acquiring output characteristic diagrams of all output layers in the preset teacher detection model, and determining the characteristic quantity of all teacher output characteristic diagrams; acquiring the feature quantity of the first output feature map; and selecting the teacher output feature map with the same feature quantity as the first output feature map as a second output feature map corresponding to the second predicted value.
Step S303: and calculating a difference matrix between the first output characteristic diagram and the second output characteristic diagram according to a preset distillation loss function.
It will be appreciated that the output signature is typically represented in a matrix, when the output signature is 128-dimensional. When calculating the difference matrix between the first output feature map and the second output feature map, the 128-dimensional parameter matrix corresponding to the first output feature map may be subtracted from the 128-dimensional parameter matrix corresponding to the second output feature map to obtain the difference matrix.
Step S304: and determining a loss parameter according to the difference matrix.
It should be noted that the loss parameter may be the difference matrix itself, or the difference matrix is corrected, and the corrected difference matrix is used as the loss parameter.
It can be understood that, since the preset teacher detection model itself is not absolutely accurate, the difference matrix reflects only the difference between the preset teacher detection model and the preset student detection model. When a teacher detects that the model is wrong, the difference matrix cannot play a correct guiding effect on model training. The embodiment introduces real loss to prevent correction when the teacher detects that the model has errors.
During specific implementation, acquiring a real mark value of the face sample image; calculating a first true difference between the true tag value and the first predicted value; and determining a loss parameter according to the first real difference value and the difference value matrix.
The real mark value can be that the face sample image belongs to a real face or a synthesized face. Calculating a first real difference between the real mark value and the first predicted value, wherein the first predicted value and the real mark value are compared, if the first predicted value and the real mark value are the same, the first real difference is 0, and if the first predicted value and the real mark value are different, the first real difference is 1; the difference between the predicted probability of the first predicted value and the real probability of the real mark value can be judged according to the predicted probability of the first predicted value. If the face sample image belongs to a real face, the real mark value is 1, and if the prediction probability of the first prediction value is 80%, the first real difference value is 0.2. Of course, the above is only an example, and the present embodiment is not limited thereto.
It should be noted that, in order to make the monitoring effect of the preset teacher network better, the embodiment determines the distillation correction coefficient corresponding to the difference matrix according to the first real difference. In specific implementation, selecting a corresponding distillation correction coefficient from a first preset coefficient table according to the first real difference value; correcting the difference matrix according to the distillation correction coefficient to obtain a correction matrix; and determining a loss parameter according to the correction matrix and the first real difference value. The following formula can be specifically referred to:
L=Lsoftmax+αLmes
wherein L is a loss parameter,Lsoftmaxis the first true difference, LmesAnd alpha is a distillation correction coefficient. The larger the first real difference value is, the larger the distillation correction coefficient can be set, and the specific corresponding relationship can be freely set according to the user requirement, which is not limited in this embodiment. In addition, in order to further prevent the teacher from detecting the model as an error, a maximum of 0.5 of the distillation correction coefficient may be set.
It should be noted that, in order to accelerate the convergence speed and accuracy of the preset student detection model. When the distillation function is constructed, the size of the real loss parameter is considered, and a proper distillation coefficient is selected. In specific implementation, selecting a corresponding distillation temperature coefficient from a second preset coefficient table according to the first real difference value; and constructing a preset distillation loss function according to the preset difference function and the distillation temperature coefficient.
It should be noted that the larger the real loss parameter, the larger the distillation temperature coefficient may be. The distillation temperature coefficient can be freely set according to the requirements of users, such as 0.005, 1 or 20. Of course, other values are also possible, and this embodiment is not limited thereto.
In the second embodiment, a difference matrix between output characteristic maps of a preset student detection model and a preset teacher detection model is calculated, thereby determining a loss parameter. Meanwhile, in order to prevent the teacher from detecting the error of the model and influencing the training guidance effect, real loss is introduced, so that the accuracy of the converged human face counterfeit identification model is further improved.
Referring to fig. 4, fig. 4 is a schematic flow chart of a training method for a face authentication model according to a third embodiment of the present invention, which is proposed based on the first and second embodiments. The present embodiment is explained based on the first embodiment.
In the third embodiment, before step S30, the method further includes:
step S211: a prediction difference between the first prediction value and the second prediction value is calculated.
It can be understood that the recognition accuracy of the preset student detection model is often poor relative to the preset teacher detection model. For example, for the same face sample image, the probability that the detection result of the student detection model belongs to the real face is preset to be 65%, and the probability that the detection result of the teacher detection model belongs to the real face is preset to be 80%. The difference is mainly caused by the complexity of the face sample, for example, the face sample image contains more noise or contains more other features. However, since the number of sample images is often large, and there are samples with low complexity, for these samples, the recognition accuracy of the predetermined student detection model can usually reach a higher accuracy. Therefore, for samples with lower complexity, the guidance training effect of the preset teacher detection model is lower.
In this embodiment, in order to further improve the training speed of the face authentication model, the samples with low complexity may not be guided by a teacher network. Of course, the preset student detection model may also have higher recognition accuracy for face samples with higher complexity. Therefore, the present embodiment determines whether to perform the instructional training using the teacher network by determining the prediction difference between the first prediction value and the second prediction value.
Step S212: and when the prediction difference is larger than a preset difference threshold value, executing the step of calculating a loss parameter between the first prediction value and the second prediction value according to a preset distillation loss function.
It should be noted that, taking the probability as an example, the preset difference threshold may be set to 5%, and may also be other values, which is not limited in this embodiment. When the prediction difference is larger than the preset difference threshold, it is indicated that for the sample, the difference between the recognition accuracy of the preset student detection model and the recognition accuracy of the preset teacher detection model is larger than that of the preset teacher detection model, and the preset teacher detection model is required to guide training.
In this embodiment, if the prediction difference is smaller than or equal to a preset difference threshold, obtaining a true mark value of the face sample image; calculating a second true difference between the true tag value and the first predicted value; and updating the parameters to be trained in the preset student detection model according to the second real difference value so as to train the preset student detection model and obtain the face counterfeit identification model.
It can be understood that when the prediction difference is smaller than or equal to the preset difference threshold, it indicates that for the sample, the recognition accuracy of the preset student detection model is not much different from that of the preset teacher detection model, and the preset teacher detection model is not needed to conduct training, so that the training speed of the preset student detection model is increased. The specific implementation of updating the parameter to be trained in the preset student detection model according to the second real difference value may refer to the first embodiment.
In this embodiment, before the preset teacher detection model is used for performing guidance training on the preset student detection model, the difference between the recognition accuracy of the preset teacher detection model and that of the preset student detection model for the same sample is judged, and when the difference between the two is large, guidance training is performed; when the difference is small, the guiding training is not executed, so that the training speed of the preset student detection model is increased.
In addition, an embodiment of the present invention further provides a storage medium, where a face authentication model training program is stored on the storage medium, and when executed by a processor, the face authentication model training program implements the steps of the face authentication model training method as described above.
Since the storage medium adopts all technical solutions of all the embodiments, at least all the beneficial effects brought by the technical solutions of the embodiments are achieved, and no further description is given here.
In addition, an embodiment of the present invention further provides a training device for a human face counterfeit detection model, and referring to fig. 5, fig. 5 is a block diagram of a first embodiment of the training device for a human face counterfeit detection model according to the present invention.
In this embodiment, the face authentication model training device includes:
the prediction module 10 is configured to identify a face sample image through a preset student detection model to obtain a first prediction value;
the prediction module 10 is further configured to identify the face sample image through a preset teacher detection model to obtain a second prediction value;
a loss calculation module 20, configured to calculate a loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function;
and the parameter adjusting module 30 is configured to update the parameter to be trained in the preset student detection model according to the loss parameter, so as to train the student detection model to obtain a face authentication model.
In this embodiment, when the face pseudonym is trained, the teacher model supervises the training process of the student model to realize transfer learning, and after the student model converges, the face pseudonym is obtained. The teacher model has higher detection precision than the student model, so that the detection precision of the student model is improved. Meanwhile, the advantage of high speed of the student model is kept, so that the final face identification model can take speed and precision into consideration. The human face fake identifying module of the embodiment has higher fake identifying speed and precision when identifying fake to a human face image.
In an embodiment, the loss calculating module 20 is further configured to select a first output feature map corresponding to the first predicted value from the output feature maps of the preset student detection model; selecting a second output characteristic diagram corresponding to the second predicted value from the output characteristic diagrams of the preset teacher detection model; calculating a difference matrix between the first output characteristic diagram and the second output characteristic diagram according to a preset distillation loss function; and determining a loss parameter according to the difference matrix.
In an embodiment, the loss calculating module 20 is further configured to obtain a true mark value of the face sample image; calculating a first true difference between the true tag value and the first predicted value; and determining a loss parameter according to the first real difference value and the difference value matrix.
In an embodiment, the loss calculating module 20 is further configured to select a corresponding distillation correction coefficient from a first preset coefficient table according to the first real difference; correcting the difference matrix according to the distillation correction coefficient to obtain a correction matrix; and determining a loss parameter according to the correction matrix and the first real difference value.
In an embodiment, the loss calculating module 20 is further configured to select a corresponding distillation temperature coefficient from a second preset coefficient table according to the first real difference; and constructing a preset distillation loss function according to the preset difference function and the distillation temperature coefficient.
In an embodiment, the loss calculating module 20 is further configured to obtain an output feature map of each output layer in the preset student detection model, and determine a feature quantity of each student output feature map; and selecting the student output characteristic diagram with the largest characteristic quantity as a first output characteristic diagram corresponding to the first predicted value.
In an embodiment, the loss calculating module 20 is further configured to obtain an output feature map of each output layer in the preset teacher detection model, and determine a feature quantity of each teacher output feature map; acquiring the feature quantity of the first output feature map; and selecting the teacher output feature map with the same feature quantity as the first output feature map as a second output feature map corresponding to the second predicted value.
In one embodiment, the human face counterfeit identification model training device further comprises a difference detection module; a difference detection module for calculating a prediction difference between the first prediction value and the second prediction value; and when the prediction difference is larger than a preset difference threshold value, executing the step of calculating a loss parameter between the first prediction value and the second prediction value according to a preset distillation loss function.
In an embodiment, the difference detection module is further configured to obtain a true mark value of the face sample image when the prediction difference is smaller than or equal to a preset difference threshold; calculating a second true difference between the true tag value and the first predicted value; and updating the parameters to be trained in the preset student detection model according to the second real difference value so as to train the student detection model and obtain the face counterfeit identification model.
In an embodiment, the face counterfeit identification model training device further comprises a pre-training module, wherein the pre-training module is used for acquiring a first target detection network and a second target detection network; wherein the parameter quantity of the first target detection network is smaller than the parameter quantity of the second target detection network; acquiring a face image training set, and respectively training the first target detection network and the second target detection network through the face image training set to obtain a trained first target detection network and a trained second target detection network; when the trained first target detection network meets a first preset convergence condition, taking the trained first target detection network as a preset student detection model; and when the second target detection network after training meets a second preset convergence condition, taking the second target detection network after training as a preset teacher detection model.
In an embodiment, the parameter adjusting module 30 is further configured to update a parameter to be trained in the preset student detection model according to the loss parameter, so as to obtain an adjusted student detection model;
obtaining loss parameters corresponding to the adjusted student detection model;
and when the loss parameter corresponding to the adjusted student detection model is in a preset range, taking the adjusted student detection model as a face counterfeit identification model.
In an embodiment, the human face counterfeit detection model training device further comprises a detection module, wherein the detection module is used for acquiring a human face image to be detected and detecting the human face image to be detected through the human face counterfeit detection model to obtain a detection result; and when the detection result is the synthesized face, marking the face image to be detected and carrying out early warning.
Other embodiments or specific implementation manners of the human face counterfeit identification model training device of the present invention may refer to the above method embodiments, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order, but rather the words first, second, third, etc. are to be interpreted as names.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (e.g., a Read Only Memory (ROM)/Random Access Memory (RAM), a magnetic disk, an optical disk), and includes several instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
The invention discloses a1 face counterfeit identification model training method, which comprises the following steps:
identifying the face sample image through a preset student detection model to obtain a first predicted value;
identifying the face sample image through a preset teacher detection model to obtain a second predicted value;
calculating a loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function;
and updating the parameters to be trained in the preset student detection model according to the loss parameters so as to train the student detection model and obtain the face authenticity identification model.
A2, the method for training the face authentication model according to A1, wherein the calculating the loss parameter between the first predicted value and the second predicted value according to the preset distillation loss function comprises:
selecting a first output characteristic diagram corresponding to the first predicted value from the output characteristic diagrams of the preset student detection model;
selecting a second output characteristic diagram corresponding to the second predicted value from the output characteristic diagrams of the preset teacher detection model;
calculating a difference matrix between the first output characteristic diagram and the second output characteristic diagram according to a preset distillation loss function;
and determining a loss parameter according to the difference matrix.
A3, the method for training the face counterfeit identification model according to A2, wherein the determining the loss parameter according to the difference matrix comprises:
acquiring a real mark value of the face sample image;
calculating a first true difference between the true tag value and the first predicted value;
and determining a loss parameter according to the first real difference value and the difference value matrix.
A4, the method for training the face counterfeit identification model according to A3, wherein the determining the loss parameter according to the first real difference and the difference matrix comprises:
selecting a corresponding distillation correction coefficient from a first preset coefficient table according to the first real difference value;
correcting the difference matrix according to the distillation correction coefficient to obtain a correction matrix;
and determining a loss parameter according to the correction matrix and the first real difference value.
A5, the method for training a human face counterfeit identification model according to A3, wherein before the calculating a difference matrix between the first output feature map and the second output feature map according to a predetermined distillation loss function, the method further comprises:
selecting a corresponding distillation temperature coefficient from a second preset coefficient table according to the first real difference value;
and constructing a preset distillation loss function according to the preset difference function and the distillation temperature coefficient.
A6, the method for training a human face counterfeit discrimination model according to a2, wherein the selecting a first output feature map corresponding to the first predicted value from the output feature maps of the preset student detection model includes:
acquiring output characteristic diagrams of all output layers in the preset student detection model, and determining the characteristic quantity of the output characteristic diagrams of all students;
and selecting the student output characteristic graph with the maximum characteristic quantity as a first output characteristic graph corresponding to the first predicted value.
A7, in the method for training a human face counterfeit discrimination model according to a6, the selecting a second output feature map corresponding to the second predicted value from the output feature maps of the preset teacher detection model includes:
acquiring output characteristic graphs of all output layers in the preset teacher detection model, and determining the characteristic quantity of all teacher output characteristic graphs;
acquiring the feature quantity of the first output feature map;
and selecting the teacher output feature map with the same feature quantity as the first output feature map as a second output feature map corresponding to the second predicted value.
A8, the method for training the face counterfeit discrimination model according to any one of A1-A7, before the step of calculating the loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function, further comprising:
calculating a prediction difference between the first prediction value and the second prediction value;
and when the prediction difference is larger than a preset difference threshold value, executing the step of calculating a loss parameter between the first prediction value and the second prediction value according to a preset distillation loss function.
A9, the method for training the face counterfeit detection model according to A8, further comprising, after calculating the prediction difference between the first prediction value and the second prediction value:
when the prediction difference is smaller than or equal to a preset difference threshold value, acquiring a real mark value of the face sample image;
calculating a second true difference between the true tag value and the first predicted value;
and updating the parameters to be trained in the preset student detection model according to the second real difference value so as to train the student detection model and obtain the face authenticity identification model.
The method for training the face counterfeit discrimination model according to any one of a1-a7, as mentioned in a10, before the step of recognizing the face sample image through the preset student detection model and obtaining the first predicted value, further includes:
acquiring a first target detection network and a second target detection network; wherein the parameter quantity of the first target detection network is smaller than the parameter quantity of the second target detection network;
acquiring a face image training set, and respectively training the first target detection network and the second target detection network through the face image training set to obtain a trained first target detection network and a trained second target detection network;
when the trained first target detection network meets a first preset convergence condition, taking the trained first target detection network as a preset student detection model;
and when the second target detection network after training meets a second preset convergence condition, taking the second target detection network after training as a preset teacher detection model.
The method for training the face counterfeit discrimination model according to any one of a1-a7 and a11, wherein the updating the parameters to be trained in the preset student detection model according to the loss parameters to train the student detection model to obtain the face counterfeit discrimination model includes:
updating the parameters to be trained in the preset student detection model according to the loss parameters to obtain an adjusted student detection model;
obtaining loss parameters corresponding to the adjusted student detection model;
and when the loss parameter corresponding to the adjusted student detection model is in a preset range, taking the adjusted student detection model as a face counterfeit identification model.
The method for training the face authentication model according to any one of a1-a7 as described in a12, wherein the updating the parameters to be trained in the preset student detection model according to the loss parameters to train the student detection model, and after obtaining the face authentication model, the method further includes:
acquiring a face image to be detected, and detecting the face image to be detected through the face authentication model to obtain a detection result;
and when the detection result is the synthesized face, marking the face image to be detected and carrying out early warning.
The invention also discloses B13 and a face counterfeit identification model training device, which comprises:
the prediction module is used for identifying the face sample image through a preset student detection model to obtain a first prediction value;
the prediction module is further used for identifying the face sample image through a preset teacher detection model to obtain a second prediction value;
the loss calculation module is used for calculating a loss parameter between the first predicted value and the second predicted value according to a preset distillation loss function;
and the parameter adjusting module is used for updating the parameters to be trained in the preset student detection model according to the loss parameters so as to train the student detection model and obtain the face counterfeit identification model.
B14, the training device for a human face counterfeit discrimination model according to B13, wherein the loss calculation module is further configured to select a first output feature map corresponding to the first predicted value from the output feature maps of the preset student detection model;
the loss calculation module is further configured to select a second output feature map corresponding to the second predicted value from the output feature maps of the preset teacher detection model;
the loss calculation module is further used for calculating a difference matrix between the first output characteristic diagram and the second output characteristic diagram according to a preset distillation loss function;
and the loss calculation module is also used for determining a loss parameter according to the difference matrix.
B15, the training device for human face counterfeit discrimination model as described in B14, wherein the loss calculation module is further configured to obtain a true mark value of the human face sample image;
the loss calculation module is further configured to calculate a first true difference between the true tag value and the first predicted value;
the loss calculation module is further configured to determine a loss parameter according to the first true difference and the difference matrix.
B16, the face counterfeit discrimination model training device according to B14, wherein the loss calculation module is further configured to obtain output feature maps of output layers in the preset student detection model, and determine the feature quantity of the output feature maps of students;
the loss calculation module is further configured to select a student output feature map with the largest feature quantity as a first output feature map corresponding to the first predicted value.
B17, the face authentication model training device as described in any one of B13-B16, the face authentication model training device further comprises a pre-training module;
the pre-training module is used for acquiring a first target detection network and a second target detection network; wherein the parameter quantity of the first target detection network is smaller than the parameter quantity of the second target detection network;
the pre-training module is further configured to acquire a face image training set, and train the first target detection network and the second target detection network through the face image training set, respectively, to obtain a trained first target detection network and a trained second target detection network;
the pre-training module is further configured to use the trained first target detection network as a preset student detection model when the trained first target detection network meets a first preset convergence condition;
the pre-training module is further configured to use the trained second target detection network as a preset teacher detection model when the trained second target detection network meets a second preset convergence condition.
B18, the face authentication model training device as described in any one of B13-B16, the face authentication model training device further comprises a detection module;
the detection module is used for acquiring a face image to be detected and detecting the face image to be detected through the face counterfeit identification model to obtain a detection result;
and the detection module is also used for marking the face image to be detected and carrying out early warning when the detection result is the synthesized face.
The invention also discloses C19, a face counterfeit identification model training device, comprising: the face identification model training program is stored on the memory and can run on the processor, and when being executed by the processor, the face identification model training program realizes the steps of the face identification model training method.
The invention also discloses D20 and a storage medium, wherein the storage medium is stored with a human face counterfeit identification model training program, and the human face counterfeit identification model training program realizes the steps of the human face counterfeit identification model training method when being executed by a processor.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011142845.6A CN114463796A (en) | 2020-10-22 | 2020-10-22 | Face counterfeit identification model training method, device, storage medium and apparatus |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011142845.6A CN114463796A (en) | 2020-10-22 | 2020-10-22 | Face counterfeit identification model training method, device, storage medium and apparatus |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN114463796A true CN114463796A (en) | 2022-05-10 |
Family
ID=81403900
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202011142845.6A Pending CN114463796A (en) | 2020-10-22 | 2020-10-22 | Face counterfeit identification model training method, device, storage medium and apparatus |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114463796A (en) |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170011738A1 (en) * | 2015-07-09 | 2017-01-12 | Google Inc. | Generating acoustic models |
| JP2020113059A (en) * | 2019-01-11 | 2020-07-27 | 株式会社Preferred Networks | Training device, training method, and program |
| WO2020161797A1 (en) * | 2019-02-05 | 2020-08-13 | 日本電気株式会社 | Learning device, learning method, and program |
| CN111639744A (en) * | 2020-04-15 | 2020-09-08 | 北京迈格威科技有限公司 | Student model training method and device and electronic equipment |
| CN111709409A (en) * | 2020-08-20 | 2020-09-25 | 腾讯科技(深圳)有限公司 | Face living body detection method, device, equipment and medium |
-
2020
- 2020-10-22 CN CN202011142845.6A patent/CN114463796A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170011738A1 (en) * | 2015-07-09 | 2017-01-12 | Google Inc. | Generating acoustic models |
| JP2020113059A (en) * | 2019-01-11 | 2020-07-27 | 株式会社Preferred Networks | Training device, training method, and program |
| WO2020161797A1 (en) * | 2019-02-05 | 2020-08-13 | 日本電気株式会社 | Learning device, learning method, and program |
| WO2020161935A1 (en) * | 2019-02-05 | 2020-08-13 | 日本電気株式会社 | Learning device, learning method, and program |
| CN111639744A (en) * | 2020-04-15 | 2020-09-08 | 北京迈格威科技有限公司 | Student model training method and device and electronic equipment |
| CN111709409A (en) * | 2020-08-20 | 2020-09-25 | 腾讯科技(深圳)有限公司 | Face living body detection method, device, equipment and medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111709409B (en) | Face living body detection method, device, equipment and medium | |
| US12217139B2 (en) | Transforming a trained artificial intelligence model into a trustworthy artificial intelligence model | |
| US20190102603A1 (en) | Method and apparatus for determining image quality | |
| EP3745309A1 (en) | Training a generative adversarial network | |
| CN114463798A (en) | Training method, device and equipment of face recognition model and storage medium | |
| WO2021232670A1 (en) | Pcb component identification method and device | |
| CN110705531B (en) | Missing character detection and missing character detection model establishing method and device | |
| CN113705092B (en) | Disease prediction methods and devices based on machine learning | |
| CN112529888A (en) | Face image evaluation method, device, equipment and medium based on deep learning | |
| JP7059695B2 (en) | Learning method and learning device | |
| CN116861014A (en) | Image information extraction method and device based on pre-training language model | |
| US20240020531A1 (en) | System and Method for Transforming a Trained Artificial Intelligence Model Into a Trustworthy Artificial Intelligence Model | |
| CN110969200A (en) | Image target detection model training method and device based on consistency negative sample | |
| CN110619528A (en) | Behavior verification data processing method, behavior verification data processing device, behavior verification equipment and storage medium | |
| CN113515771A (en) | Data sensitivity determination method, electronic device and computer-readable storage medium | |
| CN117349899A (en) | Sensitive data processing method, system and storage medium based on forgetting model | |
| CN111967383A (en) | Age estimation method, and training method and device of age estimation model | |
| CN111694954B (en) | Image classification method, device and electronic device | |
| CN113283388A (en) | Training method, device and equipment of living human face detection model and storage medium | |
| CN110941824B (en) | Method and system for enhancing anti-attack capability of model based on confrontation sample | |
| CN114463656A (en) | Detection model training method, device, equipment and storage medium | |
| CN116071612A (en) | Training method of wildfire smoke detection model and recognition method of wildfire smoke | |
| CN114463796A (en) | Face counterfeit identification model training method, device, storage medium and apparatus | |
| CN112465805A (en) | Neural network training method for quality detection of steel bar stamping and bending | |
| CN114970732B (en) | Posterior calibration method, device, computer equipment and medium for classification model |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information |
Country or region after: China Address after: 100020 1765, 15th floor, 17th floor, building 3, No.10, Jiuxianqiao Road, Chaoyang District, Beijing Applicant after: Beijing 360 Zhiling Technology Co.,Ltd. Address before: 100020 1765, 15th floor, 17th floor, building 3, No.10, Jiuxianqiao Road, Chaoyang District, Beijing Applicant before: Beijing Hongxiang Technical Service Co.,Ltd. Country or region before: China |
|
| CB02 | Change of applicant information |