Face detection model generation method and device, forged face detection method and device

By guiding the merging of constraint loss function and backbone network loss function in the face detection model, the training of shallow networks is gradually guided, which solves the problem of low-level information being ignored in the existing technology, and improves the accuracy and performance of face detection .

CN114220145BActive Publication Date: 2024-12-31XIAMEN MEIYA PICO INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111436624.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-29
Publication Date
2024-12-31
Estimated Expiration
2041-11-29

AI Technical Summary

Technical Problem

The existing face detection algorithm ignores the attention to low-level information, which includes the appearance contour information of the face or the smoothness of the image edges. These information are ignored in time due to the inadvertent backpropagation, resulting in poor detection effect.

Method used

A face detection model generation method is proposed. The residual characteristics of each layer of residual convolutional block are extracted through a multi-layer residual neural network, and a guide constraint loss function is established, and the classification results of deep convolutional blocks are used as shallow volumes The labels of the accumulated blocks gradually guide the training and parameter update of shallow networks, and merge the boot constraint loss function and the backbone network loss function to form a framework loss function, which is used to train the face detection model.

Benefits of technology

By paying attention to low-level information, the detection accuracy and performance of the face detection model are improved, ensuring that low-level information can assist in the judgment of classification results, and improving the gradient diffusion and convergence speed of the network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114220145B_ABST
    Figure CN114220145B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of forged face detection, and in particular to a method for generating a face detection model, wherein a guided constraint loss function is established for each layer of residual convolution blocks, so that the classification result of the next residual convolution block is used as the label of the previous residual convolution block, and the guided constraint loss function is combined with the backbone network loss function to obtain a framework loss function, and the classification prediction of the deep convolution block is used as the label of the shallow convolution block to gradually guide the training and parameter update of the shallow network. The present application also proposes a method for detecting forged faces, wherein the face detection model used in the method for detecting forged faces is pre-trained based on a face detection model generation method, and the accuracy of using the face detection model to detect true and false faces is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of forged face detection, and in particular to a method and device for generating a face detection model, and a method and device for detecting forged faces. Background Art

[0002] With the rapid development of Generative Adversarial Networks (GAN), GAN is increasingly used to generate realistic faces, which has led to attacks on the information security system of society. Therefore, deep fake face detection technology has emerged. The current deep fake face technology often uses the backbone network (ResNet50) to extract high-level semantic information and train a binary classifier to distinguish between real and fake faces. The current algorithm focuses more on using convolutional neural networks to obtain high-level semantic information to judge whether a face is real or fake.

[0003] However, existing face detection algorithms ignore the low-level information, which includes the appearance contour information of the face or the smoothness of the image edge. This information is often ignored due to the untimely back propagation. Summary of the invention

[0004] In view of the problem that the above-mentioned existing face detection algorithms ignore the attention to low-level information, which includes the appearance contour information of the face or the smoothness of the image edge, and this information is often ignored due to the untimely back propagation, the present application proposes a face detection model generation method and device, and a forged face detection method and device.

[0005] In a first aspect, the present application proposes a method for generating a face detection model, comprising the following steps:

[0006] Obtain training samples, input the training samples into a multi-layer residual neural network, extract residual features of each layer of residual convolution blocks in the multi-layer residual neural network, and input the residual features into a binary classifier established for the residual convolution blocks of the layer for classification, so as to obtain an initial training model;

[0007] A guided constraint loss function is established for each layer of residual convolution block, so that the classification result of the latter residual convolution block is used as the label of the previous residual convolution block. The guided constraint loss function is specifically:

[0008]

[0009] Among them, S i+1 represents the classification result of the latter residual convolution block, S i represents the classification result of the previous residual convolution block, and B represents the batch size;

[0010] Establish the classification result of the residual convolution block in the last layer and the backbone network loss function of the real label

[0011] The guided constraint loss function L G_i With the backbone network loss function Merge to obtain the framework loss function L all ;

[0012] Based on the framework loss function L all The initial training model is trained to obtain a face detection model.

[0013] By adopting the above technical solution, a guided constraint loss function is established for each layer of residual convolution block, so that the classification result of the latter residual convolution block is used as the label of the previous residual convolution block, and the classification prediction of the deep convolution block is used as the label of the shallow convolution block, gradually guiding the training and parameter update of the shallow network. Compared with directly using labels to constrain low-level feature information, using deep feature information to guide the classification of shallow feature information can achieve a step-by-step effect, guide the parameter update of the low-level convolution block of the network, so that the low-level information can assist in the judgment of the classification results.

[0014] Preferably, the binary classifier includes a BN layer, a FC layer and a Softmax layer in sequence from input to output.

[0015] By adopting the above technical solutions, the BN layer can accelerate the network convergence speed and improve the gradient diffusion. The FC layer is a fully connected layer and plays a classification role. The Softmax layer achieves binary classification results.

[0016] Preferably, the multi-layer residual neural network is a ResNet50 neural network.

[0017] By adopting the above technical solutions, the ResNet50 neural network can better solve the gradient problem. The number of ResNet50 network layers makes its expression features better, and the corresponding detection or classification performance is stronger.

[0018] Preferably, the backbone network loss function Specifically:

[0019]

[0020] Where ε∈[0,1], K is the number of face categories, and p(k) represents the probability of predicting belonging to category k.

[0021] By adopting the above technical solutions, the backbone network ResNet50 adopts the cross entropy loss function of label smoothing regularization The constraint is imposed so that the performance of the network after convergence is improved. Preferably, the guided constraint loss function L G_i With the backbone network loss function Merge to obtain the framework loss function L all Specifically include:

[0022] Each guided constraint loss function L G_i Multiply each by a hyperparameter to obtain the coefficient loss function, and convert the backbone network loss function Add the coefficient loss functions to obtain the framework loss function L all , the framework loss function L all Specifically:

[0023] Among them, λ is a hyperparameter, and λ∈[0,1].

[0024] By adopting the above technical solution, each of the guided constraint loss functions is multiplied by a hyperparameter to obtain a coefficient loss function, and the backbone network loss function is added to each of the coefficient loss functions to obtain the framework loss function, so that the framework loss function is more reasonable. By training the ResNet50 network with the framework loss function, the classification prediction of the deep convolution block can be used as the label of the shallow convolution block, gradually guiding the training and parameter update of the shallow network.

[0025] Preferably, the value of the hyperparameter is obtained by the following steps:

[0026] Set the initial value of the hyperparameter to λ 0 , and λ 0 =0, and λ 0 Increase d between 0 and 1, where d∈[0,1], to obtain multiple different hyperparameters λ 1 And determine multiple different framework loss functions L all ;

[0027] Through a plurality of different framework loss functions L all Train the initial training model to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge respectively. all The minimum value of

[0028] Compare the framework loss function L after the different face detection models converge respectively all The minimum value among the minimum values ​​of , taking the framework loss function L corresponding to the minimum value all The hyperparameter λ in 1 is the final hyperparameter λ.

[0029] By adopting the above technical solution, the hyperparameters are continuously adjusted between 0 and 1, and better detection performance is obtained after the face detection model converges.

[0030] Preferably, the value of the hyperparameter is obtained by the following steps:

[0031] Set the initial value of the hyperparameter to λ 0 , and λ 0 =0, and λ 0 Increase d1 between 0 and 1 to obtain multiple different hyperparameters λ 1 And determine multiple different framework loss functions L all ;

[0032] Through a plurality of different framework loss functions L all Train the initial models separately to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge. all The minimum value of

[0033] Compare the framework loss function L after the different face detection models converge respectively all The minimum value among the minimum values ​​of , and obtain the framework loss function L corresponding to the minimum value all The hyperparameter λ in 1 ;

[0034] In [λ 1 -t,λ 1 +t], and increase d2 successively to obtain multiple different hyperparameters λ 2 And determine a plurality of different framework loss functions L all , where t∈[0,0.1], d2∈[0,t];

[0035] By using a plurality of different hyperparameters λ 2 Determine the multiple different framework loss functions L all Train the initial training model to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge respectively. all The minimum value of

[0036] Compare the framework loss function L after the different face detection models converge respectively all The minimum value among the minimum values ​​of , taking the framework loss function L corresponding to the minimum value all The hyperparameter λ in 2 is the final hyperparameter λ.

[0037] By adopting the above technical solution, the hyperparameters are continuously adjusted between 0 and 1. 1 Then continue to narrow the range for secondary adjustment. After the secondary adjustment, the face detection model converges to obtain better detection performance.

[0038] In a second aspect, the present application also proposes a forged face detection method, comprising the following steps:

[0039] Obtain a test sample, and input the test sample into a face detection model, wherein the face detection model is pre-trained based on the method of the first aspect;

[0040] Output the classification result of the residual convolution block of the last layer of the face detection model, and use the classification result of the residual convolution block of the last layer as the basis for determining whether the face is forged.

[0041] By adopting the above technical solution, since the face detection model is pre-trained based on the method of the first aspect, the accuracy of using the face detection model to detect true and false faces is relatively high.

[0042] In a third aspect, the present application further proposes a face detection model generation device, the device comprising:

[0043] A first acquisition module, the first acquisition module is used to acquire training samples, the training samples include real samples and forged samples;

[0044] A training module, wherein the training module is used to input the training samples into an initial training model, wherein the initial training model includes a multi-layer residual neural network and a plurality of binary classifiers, wherein the plurality of binary classifiers are used to extract and classify the residual features of each layer of residual convolution blocks in the multi-layer residual neural network;

[0045] A determination module, wherein the determination module trains the initial model into a face detection model through the method of the first aspect.

[0046] In a fourth aspect, the present application further proposes a forged face detection device, the device comprising:

[0047] A second acquisition module, the second acquisition module is used to acquire a test sample acquired by an image acquisition device;

[0048] A test module, wherein the test module is used to input a test sample into a face detection model, wherein the face detection model is pre-trained based on the method described in the first aspect of the claim, and outputs a classification result of the last layer of residual convolution blocks.

[0049] In a fifth aspect, the present application further proposes a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in the first aspect or the second aspect is implemented.

[0050] The present application proposes a method for generating a face detection model, and establishes a guided constraint loss function for each layer of residual convolution blocks, so that the classification result of the latter residual convolution block is used as the label of the previous residual convolution block, and the classification prediction of the deep convolution block is used as the label of the shallow convolution block, gradually guiding the training and parameter update of the shallow network. Compared with directly using labels to constrain low-level feature information, using deep feature information to guide the classification of shallow feature information can achieve a step-by-step effect, guide the parameter update of the low-level convolution block of the network, so that the low-level information can assist in the judgment of the classification results. At the same time, the present application also proposes a method for detecting fake faces. The face detection model used in the method for detecting fake faces is pre-trained based on the method of the first aspect, and the accuracy of using the face detection model to detect true and false faces is relatively high. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated into and constitute a part of this specification. The accompanying drawings illustrate the embodiments and are used together with the description to explain the principles of the present invention. It will be easy to recognize other embodiments and many expected advantages of the embodiments because they become better understood by reference to the following detailed description. The elements of the drawings are not necessarily to scale with each other. The same reference numerals refer to corresponding similar parts.

[0052] Figure 1 It is a flowchart of a method for generating a face detection model in one embodiment of the present application.

[0053] Figure 2 It is a schematic diagram of the framework structure of a face detection model generation method in one embodiment of the present application.

[0054] Figure 3 This is a structural diagram of a ResNet residual network unit in one embodiment of the present application.

[0055] Figure 4 This is a network structure diagram of the ResNet50 residual network in one embodiment of the present application.

[0056] Figure 5 It is a flowchart of the steps for obtaining the numerical value of a hyperparameter in one embodiment of the present application.

[0057] Figure 6 It is a flowchart of the steps of obtaining the numerical value of the hyperparameter in another embodiment of the present application.

[0058] Figure 7It is a schematic diagram of the module structure of a face detection model generating device in one embodiment of the present application.

[0059] Figure 8 It is a schematic diagram of the module structure of a forged face detection device in one embodiment of the present application. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0061] The present invention will be described in detail below with reference to the accompanying drawings.

[0062] Figure 1 A flowchart of a method for generating a face detection model in one embodiment of the present application is shown. Figure 2 A schematic diagram of the framework structure of a face detection model generation method in one embodiment of the present application is shown, combined with reference Figure 1 and Figure 2 , the method comprises the following steps:

[0063] Step 101: Obtain training samples, input the training samples into a multi-layer residual neural network, extract the residual features of each layer of residual convolution blocks in the multi-layer residual neural network, and input them into a binary classifier established for the residual convolution blocks of that layer for classification, so as to obtain an initial training model.

[0064] In this embodiment, the training samples include real samples and forged samples, and the multi-layer residual neural network used is a ResNet50 neural network trained on ImageNet.

[0065] ImageNet is a large visual database used for research in visual object recognition software. Over 14 million image URLs have been manually annotated by ImageNet to indicate the objects in the picture; in at least one million images, bounding boxes are also provided. ImageNet contains over 20,000 categories, and a typical category, such as "balloon" or "strawberry", contains hundreds of images. Third-party annotated databases of image URLs can be obtained directly from ImageNet for free, however, the actual images are not part of ImageNet.

[0066] The key to the ResNet network lies in the residual unit in its structure, such as Figure 3As shown in the figure, the residual network unit includes cross-layer connections. The curve in the figure can directly transfer the input across layers, perform equal mapping, and then add it to the result of the convolution operation. Assuming that the input image is x, the output is H(x), and the output after convolution is a nonlinear function of F(x), then the final output is H(x)=F(x)+x. Such output can still be transformed nonlinearly. The residual refers to the "difference", that is, F(x), and the network is transformed into the residual function F(x)=H(x)-x. In this way, the residual function is easier to optimize than F(x)=H(x). The relu activation function plays a very important role in the learning process of the neural network model. Its role is to introduce nonlinear factors in model learning so that the neural network can fit any nonlinear function.

[0067] The network structure of ResNet50 is as follows Figure 4 As shown in the figure, the input INPUT passes through the five stages of ResNet50 (stage 0, stage 1, stage 2, stage 3, stage 4) to obtain the output OUTPUT, where stage 0 does not contain a residual block and can be regarded as a preprocessing of the input INPUT. The last four stages all contain residual convolution blocks.

[0068] In this embodiment, the binary classifier includes a BN layer, a FC layer, and a Softmax layer from input to output.

[0069] BN, the full name of Batch Normalization, is a method proposed in 2015. This algorithm is mostly used when training deep networks. The main functions of the BN layer are to speed up the training and convergence of the network, control gradient explosion, prevent gradient disappearance, and prevent overfitting.

[0070] The features are extracted by the four residual convolution blocks of ResNet50 respectively. The features obtained by each residual convolution block pass through a BN layer, and the expression is as follows:

[0071] F i =B N (B i {I i |θ1,θ2,…,θ n});

[0072] Among them, B N represents the BN layer, B i Represents the backbone network ResNet50, I i represents the input RGB image, θ1,θ2,…,θ nRepresents the parameters of the residual convolution block. Then the features pass through the FC layer, which is a fully connected layer and acts as a classifier. It performs a weighted sum on the features of the previous layer, and then the features pass through the Softmax function of the Softmax layer to predict the probability of belonging to each class.

[0073] Step 102: Establish a guided constraint loss function L for each layer of residual convolution block G_i , so that the classification result of the latter residual convolution block is used as the label of the previous residual convolution block, and the guided constraint loss function L G_i Specifically:

[0074]

[0075] Among them, S i+1 represents the classification result of the latter residual convolution block, S i represents the classification result of the previous residual convolution block, B represents the batch size, ||S i+1 -S i ||2 represents the binary norm of the i+1th classification result and the i-th classification result, so that the classification result of the latter residual convolution block is used as the label of the previous residual convolution block, and it is hoped that the i-th classification result is as close as possible to the i+1th classification result.

[0076] Step 103: Establish the classification result of the residual convolution block in the last layer and the backbone network loss function of the real label

[0077] In this embodiment, the backbone network loss function Specifically:

[0078]

[0079] Where ε∈[0,1], K is the number of face categories, and p(k) represents the probability of predicting belonging to category k.

[0080] The backbone network loss function It is the cross entropy loss function of label smoothing regularization commonly used in ResNet50 network.

[0081] Step 104: The guided constraint loss function L G_i With the backbone network loss function Merge to obtain the framework loss function L all ;

[0082] Wherein, the guided constraint loss function L G_i With the backbone network loss function Merge to obtain the framework loss function L allSpecifically include:

[0083] Each guided constraint loss function L G_i Multiply each by a hyperparameter to obtain the coefficient loss function, and convert the backbone network loss function Add the coefficient loss functions to obtain the framework loss function L all , the framework loss function L all Specifically:

[0084] Among them, λ is a hyperparameter, and λ∈[0,1].

[0085] Since the backbone network in this embodiment is ResNet50, L all It manifests as:

[0086]

[0087] Reference Figure 5 In an optional embodiment, the value of the hyperparameter is obtained by the following steps:

[0088] Step 201: Set the initial value of the hyperparameter to 0, and increase d in sequence between 0 and 1 to obtain multiple different hyperparameters and determine multiple different framework loss functions.

[0089] The specific step is: starting from λ1, setting the initial value of the hyperparameter λ1 to λ 0 , and λ 0 =0, and λ 0 Increase d between 0 and 1, where d∈[0,1], to obtain multiple different hyperparameters λ 1 And determine multiple different framework loss functions L all , d in this embodiment is preferably 0.1.

[0090] Step 202: Using a plurality of different framework loss functions L all Train the initial training model to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge respectively. all The minimum value of

[0091] Step 203: Compare the framework loss functions L after the different face detection models converge. all The minimum value among the minimum values ​​of , taking the framework loss function L corresponding to the minimum value all The hyperparameter λ in 1 is the final hyperparameter λ1.

[0092] Then, starting from λ2, the above steps 201 to 203 are repeated to obtain the final hyperparameter λ2;

[0093] Finally, starting from λ3, the above steps 201 to 203 are repeated to obtain the final hyperparameter λ3.

[0094] Reference Figure 6 In another optional embodiment, the value of the hyperparameter is obtained by the following steps:

[0095] Step 301: Set the initial value of the hyperparameter to 0, and increase d1 from 0 to 1 in sequence to obtain multiple different hyperparameters and determine multiple different framework loss functions.

[0096] The specific step is: starting from λ1, setting the initial value of the hyperparameter λ1 to λ 0 , and λ 0 =0, and λ 0 Increase d1 between 0 and 1 to obtain multiple different hyperparameters λ 1 And determine multiple different framework loss functions L all ; In this embodiment, d1 is preferably 0.1;

[0097] Step 302: Using a plurality of different framework loss functions L all Train the initial models separately to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge. all The minimum value of

[0098] Step 303: Compare the framework loss functions L after the different face detection models converge respectively. all The minimum value among the minimum values ​​of , and obtain the framework loss function L corresponding to the minimum value all The hyperparameter λ in 1 ;

[0099] Step 304: Continue to narrow the range of hyperparameters, obtain multiple different hyperparameters and determine multiple different framework loss functions.

[0100] The specific step is: 1 -t,λ 1 +t], and increase d2 successively to obtain multiple different hyperparameters λ 2 And determine a plurality of different framework loss functions L all , where t∈[0,0.1], d2∈[0,t]; in this embodiment, t is preferably 0.1, and d2 is preferably 0.05.

[0101] Step 305: Using multiple different hyperparameters λ2 Determine the multiple different framework loss functions L all Train the initial training model to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge respectively. all The minimum value of

[0102] Step 306: Compare the framework loss functions L after the different face detection models converge. all The minimum value among the minimum values ​​of , taking the framework loss function L corresponding to the minimum value all The hyperparameter λ in 2 is the final hyperparameter λ1.

[0103] Then, starting from λ2, repeat the above steps 301 to 306 to obtain the final hyperparameter λ2;

[0104] Finally, starting from λ3, the above steps 301 to 306 are repeated to obtain the final hyperparameter λ3.

[0105] The λ1, λ2, and λ3 obtained by the method in this embodiment have higher precision. The present application preferably uses the λ1, λ2, and λ3 obtained by the method in this embodiment, and the final λ1, λ2, and λ3 obtained by the present application by this method are 0.25, 0.5, and 0.75, respectively, that is, L in this embodiment all The final result is:

[0106]

[0107] Step 105: Based on the framework loss function L all The initial training model is trained to obtain a final face detection model.

[0108] Further references Figure 7 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a face detection model generation device, which is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0109] A face detection model generation device disclosed in an embodiment of the present application includes:

[0110] A first acquisition module 401, the first acquisition module 401 is used to acquire training samples, the training samples include real samples and forged samples;

[0111] The training module 402 is used to input the training samples into the training initial model, the training initial model includes a multi-layer residual neural network and a plurality of binary classifiers, and the plurality of binary classifiers are used to extract the residual features of each layer of the residual convolution block in the multi-layer residual neural network and perform classification respectively;

[0112] Determining module 403, determining module 403 trains the initial model into a face detection model through the above-mentioned face detection model generation method.

[0113] The present application also discloses a forged face detection method, comprising the following steps:

[0114] Obtain a test sample, and input the test sample into a face detection model, wherein the face detection model is pre-trained based on the above-mentioned face detection model generation method;

[0115] Output the classification result of the residual convolution block of the last layer of the face detection model, and use the classification result of the residual convolution block of the last layer as the basis for determining whether the face is forged.

[0116] Further references Figure 8 As an implementation of the forged face detection method, the present application provides an embodiment of a forged face detection device, which can be specifically applied to various electronic devices.

[0117] A forged face detection device disclosed in an embodiment of the present application includes:

[0118] A second acquisition module 501, the second acquisition module 501 is used to acquire a test sample acquired by an image acquisition device;

[0119] The testing module 502 is used to input the test sample into the face detection model, the face detection model is pre-trained based on the above-mentioned fake face detection method, and outputs the classification result of the last layer of residual convolution block.

[0120] According to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer readable medium, the computer program including a computer program for executing Figure 1 When the computer program is executed by a central processing unit (CPU) and a graphics processing unit (GPU), the above functions defined in the method of the present application are performed.

[0121] It should be noted that the computer-readable medium of the present application may be a computer-readable signal medium or a computer-readable medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor device, device or component, or any combination of the above. More specific examples of computer-readable media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution device, device or component. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium that can send, propagate or transmit a program for use by or in conjunction with an instruction execution device, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0122] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0123] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0124] The modules involved in the embodiments described in the present application may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an acquisition module, an analysis module, and an output module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.

[0125] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.

Claims

1. A method for generating a face detection model, characterized in that: The following steps are involved: Obtain training samples, input the training samples into a multi-layer residual neural network, extract residual features of each layer of residual convolution blocks in the multi-layer residual neural network, and input the residual features into a binary classifier established for the residual convolution blocks of the layer for classification, so as to obtain an initial training model; For each layer of residual convolution block, a guided constraint loss function L is established G_i , so that the classification result of the latter residual convolution block is used as the label of the previous residual convolution block, and the guided constraint loss function L G_i Specifically: Among them, S i+1 represents the classification result of the latter residual convolution block, S i represents the classification result of the previous residual convolution block, and B represents the batch size; Establish the classification result of the residual convolution block in the last layer and the backbone network loss function of the real label The guided constraint loss function L G_i With the backbone network loss function Merge to obtain the framework loss function L all ; Based on the framework loss function L all The initial training model is trained to obtain a face detection model.

2. The method for generating a face detection model according to claim 1, wherein: The binary classifier includes a BN layer, a FC layer and a Softmax layer from input to output.

3. The method for generating a face detection model according to claim 1, wherein: The multi-layer residual neural network is a ResNet50 neural network.

4. The method for generating a face detection model according to claim 3, wherein: The backbone network loss function Specifically: Where ε∈[0,1], K is the number of face categories, and p(k) represents the probability of predicting belonging to category k.

5. The method for generating a face detection model according to claim 4, characterized in that: The guided constraint loss function L G_i With the backbone network loss function Merge to obtain the framework loss function L all Specifically include: Each guided constraint loss function L G_i Multiply each by a hyperparameter to obtain the coefficient loss function, and convert the backbone network loss function Add the coefficient loss functions to obtain the framework loss function L all , the framework loss function L all Specifically: Among them, λ is a hyperparameter, and λ∈[0,1].

6. A method for generating a face detection model according to claim 5, characterized in that: The values ​​of the hyperparameters are obtained by the following steps: Set the initial value of the hyperparameter to λ 0 , and λ 0 =0, and λ 0 Increase d between 0 and 1, where d∈[0,1], to obtain multiple different hyperparameters λ 1 And determine multiple different framework loss functions L all ; Through a plurality of different framework loss functions L all Train the initial training model to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge respectively. all The minimum value of Compare the framework loss function L after the different face detection models converge respectively all The minimum value among the minimum values ​​of , taking the framework loss function L corresponding to the minimum value all The hyperparameter λ in 1 is the final hyperparameter λ1.

7. The method for generating a face detection model according to claim 5, characterized in that: The values ​​of the hyperparameters are obtained by the following steps: Set the initial value of the hyperparameter to λ 0 , and λ 0 =0, and λ 0 Increase d1 between 0 and 1 to obtain multiple different hyperparameters λ 1 And determine multiple different framework loss functions L all ; Through a plurality of different framework loss functions L all Train the initial models separately to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge. all The minimum value of Compare the framework loss function L after the different face detection models converge respectively all The minimum value among the minimum values ​​of , and obtain the framework loss function L corresponding to the minimum value all The hyperparameter λ in 1 ; In [λ 1 -t,λ 1 +t], and increase d2 successively to obtain multiple different hyperparameters λ 2 And determine a plurality of different framework loss functions L all , where t∈[0,0.1], d2∈[0,t]; By using a plurality of different hyperparameters λ 2 Determine the multiple different framework loss functions L all Train the initial training model to obtain multiple different face detection models, and calculate the framework loss function L after the multiple different face detection models converge respectively. all The minimum value of Compare the framework loss function L after the different face detection models converge respectively all The minimum value among the minimum values ​​of , taking the framework loss function L corresponding to the minimum value all The hyperparameter λ in 2 is the final hyperparameter λ1.

8. A method for detecting fake faces, characterized in that: The following steps are involved: Obtain a test sample, and input the test sample into a face detection model, wherein the face detection model is pre-trained based on the method described in any one of claims 1 to 7; Output the classification result of the residual convolution block of the last layer of the face detection model, and use the classification result of the residual convolution block of the last layer as the basis for determining whether the face is forged.

9. A face detection model generation device, characterized in that: The device comprises: A first acquisition module, the first acquisition module is used to acquire training samples, the training samples include real samples and forged samples; A training module, wherein the training module is used to input the training samples into an initial training model, wherein the initial training model includes a multi-layer residual neural network and a plurality of binary classifiers, wherein the multi-layer residual neural network is used to extract residual features of each layer of residual convolution blocks in the multi-layer residual neural network, and the plurality of binary classifiers classify the extracted residual features for each layer of residual convolution blocks respectively; A determination module, wherein the determination module trains the initial model into a face detection model by using the method described in any one of claims 1 to 7.

10. A forged face detection device, characterized in that: The device comprises: A second acquisition module, the second acquisition module is used to acquire a test sample acquired by an image acquisition device; A test module, wherein the test module is used to input a test sample into a face detection model, wherein the face detection model is pre-trained based on the method described in any one of claims 1-7, and outputs a classification result of the last layer of residual convolution blocks.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.