Face recognition method and device, computer equipment and storage medium

By constructing an inner face feature extraction network and an outer face feature extraction network in the dual-stream face recognition model, combining feature consistency loss and classification loss, the performance degradation caused by image quality reduction in deep forgery detection is solved, and a higher facial recognition accuracy is achieved.

CN119559675APending Publication Date: 2025-03-04HANGZHOU HIGH-TECH ZONE (BINJIANG) INSTITUTE OF BLOCKCHAIN & DATA SECURITY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411515059.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

When the image quality of the existing depth forgery detection scheme decreases, shallow textures are easily destroyed, resulting in a sharp decline in performance, thereby reducing the accuracy of face recognition.

Method used

The dual-stream face recognition model is adopted, and the inner face feature extraction network and the outer face feature extraction network are used to extract the sample inner face features and outer face features respectively. Combined with feature consistency loss, face recognition classification loss and identity consistency loss, it is determined that the target face recognition model is used to detect whether the image to be detected is a deep fake image.

Benefits of technology

By digging out the feature differences between the inner face image and the outer face image in the depth-fake image, the accuracy of face recognition is improved, and the problem of performance degradation in the prior art is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559675A_ABST
    Figure CN119559675A_ABST
Patent Text Reader

Abstract

The invention relates to a face recognition method and device, computer equipment and a storage medium. Comprising the steps that sample inner face features of a model training image are extracted through an inner face feature extraction network in a double-flow face recognition model, and sample outer face features of the model training image are extracted through an outer face feature extraction network in the double-flow face recognition model; determining feature consistency loss, face recognition classification loss and identity consistency loss of the double-flow face recognition model according to the model training image, the sample inner face features and the sample outer face features; determining whether the double-flow face recognition model can be used as a target face recognition model or not according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the dichotomy cross entropy loss of the double-flow face recognition model during model training; and if yes, determining whether the to-be-detected image is a deep counterfeit image or not according to the target face recognition model. According to the scheme, the accuracy of face recognition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing technology, and in particular to a face recognition method, device, computer equipment and storage medium. Background Art

[0002] As deep learning technology continues to advance and innovate, people have begun to widely apply it to the tampering of multimedia content. This allows some social applications to provide users with powerful tools that allow them to easily modify personal facial attributes in images and videos, such as expressions, hairstyles, gender, and age. These applications can even achieve highly realistic face-swapping effects, allowing users to replace their own or other people's faces with specific characters, thereby creating images that appear to be real but are actually completely fictional. Usually, this type of technology is called deep fake, and the increasing popularity of deep fake functions has also caused a lot of anxiety and concern among people. On the one hand, people are worried that this technology may be used for malicious purposes, such as creating false information, fraud, or invading the privacy of others. On the other hand, since these forged contents are often difficult to distinguish the authenticity with the naked eye, it is crucial to judge and verify the authenticity of information on the Internet.

[0003] The current deepfake detection technology is developing rapidly. It can identify facial images through the optimal deep neural network architecture to determine whether the facial image is a fake image. However, the shallow textures that the existing deepfake detection schemes rely on are easily damaged or even disappear when the image quality deteriorates, which leads to a sharp drop in performance and low accuracy of face recognition. Therefore, how to improve the accuracy of face recognition and accurately determine whether a face image is a deepfake image is a problem that needs to be solved. Summary of the invention

[0004] Based on this, it is necessary to provide a face recognition method, device, computer equipment and storage medium that can improve the accuracy of face recognition and accurately determine whether a face image is a deep fake image in response to the above technical problems.

[0005] In a first aspect, the present application provides a face recognition method, the method comprising:

[0006] Get model training images;

[0007] Input the model training image into a dual-stream face recognition model, and extract sample inner face features of the model training image through an inner face feature extraction network in the dual-stream face recognition model, and extract sample outer face features of the model training image through an outer face feature extraction network in the dual-stream face recognition model;

[0008] Determine the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model according to the model training image, the in-sample face features and the out-of-sample face features;

[0009] Determine whether the dual-stream face recognition model is trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, and if so, use the dual-stream face recognition model after training as the target face recognition model;

[0010] The image to be detected is input into the target face recognition model, and it is determined whether the image to be detected is a deep fake image according to the target face recognition model.

[0011] In one embodiment, obtaining a model training image includes:

[0012] Collect sample training images from the deepfake dataset;

[0013] The sample training image is horizontally inverted, Gaussian blurred, and brightness adjusted to determine a model training image.

[0014] In one embodiment, determining the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model according to the model training image, the in-sample face features and the out-of-sample face features includes:

[0015] Determining the feature consistency loss of the dual-stream face recognition model according to the sample inner face features, the sample outer face features, the number of sample real images and the number of sample forged images in the sample training images through a consistency loss function;

[0016] Through the classification loss function, the face recognition classification loss of the two-stream face recognition model is determined according to the in-sample face features and the out-of-sample face features;

[0017] The identity consistency loss of the dual-stream face recognition model is determined according to the sample inner face features, the sample outer face features, the sample real image and the sample forged image through a consistency loss function.

[0018] In one embodiment, determining the face recognition classification loss of the dual-stream face recognition model according to the in-sample face features and the out-of-sample face features through a classification loss function includes:

[0019] Determine the feature difference between the face feature in the sample and the face feature outside the sample;

[0020] By using a classification loss function, an angle between the feature difference and a class center corresponding to the classification loss function is determined according to the feature difference, and a face recognition classification loss of a dual-stream face recognition model is determined based on the angle.

[0021] In one embodiment, determining the identity consistency loss of the two-stream face recognition model according to the sample inner face features, the sample outer face features, the sample real image and the sample forged image through a consistency loss function includes:

[0022] grouping the sample real images and the sample forged images according to the association relationship between the sample real images and the sample forged images to determine a sample image group;

[0023] The identity consistency loss of the dual-stream face recognition model is determined according to the in-sample face features, the out-sample face features and the number of images in the sample image group through a consistency loss function.

[0024] In one embodiment, determining whether the dual-stream face recognition model is trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss, and the binary cross entropy loss of the dual-stream face recognition model during model training includes:

[0025] The feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the two-stream face recognition model during model training are weighted summed to determine a model loss function;

[0026] If the model loss function is less than or equal to the target loss function, it is determined that the dual-stream face recognition model training is completed.

[0027] In one embodiment, inputting an image to be detected into a target face recognition model, and determining whether the image to be detected is a deep fake image according to the target face recognition model includes:

[0028] Inputting the image to be detected into the target face recognition model, extracting the target inner face features of the image to be detected through the inner face feature extraction network in the face recognition model, and extracting the target outer face features of the image to be detected through the outer face feature extraction network in the face recognition model;

[0029] Determining feature similarity between the target inner face feature and the target outer face feature;

[0030] If the feature similarity is greater than a preset similarity threshold, determining that the image to be detected is a real image;

[0031] If the feature similarity is less than or equal to the similarity threshold, it is determined that the image to be detected is a deep fake image.

[0032] In a second aspect, the present application further provides a face recognition device, characterized in that the face recognition device comprises:

[0033] An image acquisition module is used to acquire model training images;

[0034] A feature extraction module, used to input the model training image into a dual-stream face recognition model, and extract sample inner face features of the model training image through an inner face feature extraction network in the dual-stream face recognition model, and extract sample outer face features of the model training image through an outer face feature extraction network in the dual-stream face recognition model;

[0035] A model loss determination module, used to determine the feature consistency loss, face recognition classification loss and identity consistency loss of a dual-stream face recognition model according to the model training image, the face features in the sample and the face features outside the sample;

[0036] A model training module, which determines whether the dual-stream face recognition model has been trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, and if so, uses the dual-stream face recognition model after training as a target face recognition model;

[0037] The image detection module is used to input the image to be detected into the target face recognition model, and determine whether the image to be detected is a deep fake image according to the target face recognition model.

[0038] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:

[0039] Get model training images;

[0040] Input the model training image into a dual-stream face recognition model, and extract sample inner face features of the model training image through an inner face feature extraction network in the dual-stream face recognition model, and extract sample outer face features of the model training image through an outer face feature extraction network in the dual-stream face recognition model;

[0041] Determine the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model according to the model training image, the in-sample face features and the out-of-sample face features;

[0042] Determine whether the dual-stream face recognition model is trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, and if so, use the dual-stream face recognition model after training as the target face recognition model;

[0043] The image to be detected is input into the target face recognition model, and it is determined whether the image to be detected is a deep fake image according to the target face recognition model.

[0044] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0045] Get model training images;

[0046] Input the model training image into a dual-stream face recognition model, and extract sample inner face features of the model training image through an inner face feature extraction network in the dual-stream face recognition model, and extract sample outer face features of the model training image through an outer face feature extraction network in the dual-stream face recognition model;

[0047] Determine the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model according to the model training image, the in-sample face features and the out-of-sample face features;

[0048] Determine whether the dual-stream face recognition model is trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, and if so, use the dual-stream face recognition model after training as the target face recognition model;

[0049] The image to be detected is input into the target face recognition model, and it is determined whether the image to be detected is a deep fake image according to the target face recognition model.

[0050] The above-mentioned face recognition method, device, computer equipment and storage medium obtain a model training image; input the model training image into the dual-stream face recognition model, and extract the sample inner face features of the model training image through the inner face feature extraction network in the dual-stream face recognition model, and extract the sample outer face features of the model training image through the outer face feature extraction network in the dual-stream face recognition model; determine the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model according to the model training image, the sample inner face features and the sample outer face features; determine whether the dual-stream face recognition model is trained according to the feature consistency loss, face recognition classification loss, identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, and if so, use the dual-stream face recognition model after training as the target face recognition model; input the image to be detected into the target face recognition model, and determine whether the image to be detected is a deep fake image according to the target face recognition model. The problem that the shallow texture relied on by the existing deep fake detection scheme is easily destroyed or even disappears when the image quality decreases, thereby causing a sharp decline in performance and resulting in low accuracy of face recognition is solved. The above scheme constructs an inner face feature extraction network and an outer face feature extraction network in the dual-stream face recognition model, extracts sample inner face features of the model training image through the inner face feature extraction network, and extracts sample outer face features of the model training image through the outer face feature extraction network, and obtains the prediction result of the dual-stream face recognition model according to the feature difference between the sample inner face features and the sample outer face features. The model loss function of the dual-stream face recognition model is determined based on the prediction result of the dual-stream face recognition model, the model training image, the sample inner face features and the sample outer face features. The dual-stream face recognition model can be adjusted based on the model function, thereby improving the prediction accuracy of the dual-stream face recognition model, and obtaining the target face recognition model. Whether the image to be detected is a deep fake image is detected by the target face recognition model, and the feature difference between the inner face image and the outer face image in the deep fake image can be mined to improve the accuracy of face recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 A diagram showing an application environment of a face recognition method in an embodiment;

[0052] Figure 2 1 is a flow chart of a face recognition method in one embodiment;

[0053] Figure 3 This is an example diagram of the network structure of the Xception network;

[0054] Figure 4 is a flowchart of a face recognition method in another embodiment;

[0055] Figure 5is a structural block diagram of a face recognition device in one embodiment;

[0056] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0058] The face recognition method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers. The server 104 obtains a model training image; inputs the model training image into a dual-stream face recognition model, and extracts sample inner face features of the model training image through an inner face feature extraction network in the dual-stream face recognition model, and extracts sample outer face features of the model training image through an outer face feature extraction network in the dual-stream face recognition model; determines a feature consistency loss, a face recognition classification loss, and an identity consistency loss of the dual-stream face recognition model according to the model training image, the sample inner face features, and the sample outer face features; determines whether the dual-stream face recognition model is trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss, and the binary cross entropy loss of the dual-stream face recognition model during model training, and if so, uses the trained dual-stream face recognition model as a target face recognition model; inputs an image to be detected into a target face recognition model, determines whether the image to be detected is a deep fake image according to the target face recognition model, and sends a judgment result of whether the image to be detected is a deep fake image to the terminal 102 through a communication network. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0059] In one embodiment, Figure 2As shown, a face recognition method is provided. This embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0060] S210: Obtain model training images.

[0061] The model training images refer to sample images used for model training of the two-stream face recognition model. The model training images can be collected from the FaceForensics++ dataset, the DeepFake Detection dataset, the DeepFakeDetection Challenge dataset, and / or the Celeb-DF dataset. The FaceForensics++ dataset is the most widely used deep fake dataset for evaluation. The FaceForensics++ dataset also contains videos of two different compression qualities, namely low-quality c40 videos and high-quality c23 videos. The DeepFake Detection dataset contains 590 real videos and 5639 high-quality fake videos generated using an improved deep fake algorithm. The DeepFakeDetection Challenge dataset is currently the largest open source face-changing dataset, which contains 1133 real videos and 4080 deep fake videos for testing. The Celeb-DF dataset contains 590 real videos and 5639 high-quality fake videos generated using an improved deep fake algorithm.

[0062] S220. Input the model training image into the dual-stream face recognition model, and extract the sample inner face features of the model training image through the inner face feature extraction network in the dual-stream face recognition model, and extract the sample outer face features of the model training image through the outer face feature extraction network in the dual-stream face recognition model.

[0063] Among them, the dual-stream face recognition model includes an inner face feature extraction network and an outer face feature extraction network. The inner face feature extraction network and the outer face feature extraction network are two parallel backbone convolutional neural networks. The backbone convolutional neural network can be an Xception network embedded with a spatial attention mechanism. The spatial attention mechanism is embedded in the Xception network, and the intermediate features of the inner face feature extraction network can be used to prompt the outer face feature extraction network to focus on the area when extracting features. The core unit in the Xception network is a continuous structure composed of deeply separable convolutional layers, usually called a block perspective Block. The Xception network obtains a complete network structure by stacking blocks, and can be divided into three modules, namely the input stream, the intermediate stream and the output stream. The attention mechanism is embedded in the input stream and the intermediate stream modules.

[0064] It should be noted that there are deep fake images and real images in the model training images. When the dual-stream face recognition model is trained through the model training images, the model training images can be regarded as deep fake images. At this time, the sample inner face features and sample outer face features corresponding to the real image should be consistent in theory, while the sample inner face features and sample outer face features corresponding to the deep fake image have low similarity. The sample inner face features refer to the facial features corresponding to the real face image that is covered in the model training image, and the sample outer face features refer to the facial features corresponding to the fake image used to cover the real face image in the model training image, that is, the outer face is a fake image, and the inner face is a real image covered by the fake image.

[0065] For example, the network structure of the Xception network is shown in the figure below: Figure 3 As shown. The input stream is the initial part of the Xception network, responsible for performing preliminary feature extraction and dimensionality reduction operations on the input model training image, and extracting some low-level features, such as local features such as edges and textures in the model training image. The intermediate stream is the middle part of the Xception network, and its function is to express and mine the extracted primary features at a deeper level to obtain more abstract and advanced feature representations. The output stream is the last part of the Xception network, which is used to convert the extracted features into the final prediction results. The input stream contains 3 blocks, and only the output of the last block can be extracted as the identity feature. The intermediate stream contains a total of 8 blocks, and 2 blocks can be used as the granularity to extract intermediate features. Facial features of 4 scales can be extracted from the intermediate stream. Among them, the extraction formula of the intermediate feature is shown in formula (1):

[0066]

[0067] in, is the intermediate feature extracted from the intermediate flow, σ(·) represents the convolution operation, ⊙ represents the element-by-element multiplication, Ri represents the i-th intermediate feature extracted from the inner face feature extraction network, and Z is used i Represents the face feature extraction network corresponding to R i The i-th intermediate feature of , where 1≤i≤5, and i is an integer.

[0068] Specifically, the model training image is input into the two-stream face recognition model, and the input stream of the inner face feature extraction network in the two-stream face recognition model is used to perform preliminary feature extraction and dimensionality reduction operations on the model training image to determine the local features of the inner face image such as the inner face edge features and the inner face texture features of the model training image; the local features of the inner face image are subjected to feature mining through the intermediate stream of the inner face feature extraction network to determine the deep features of the inner face; the deep features of the inner face are extracted with two blocks as a granularity to obtain four scales of deep features of the inner face, namely, sample inner face features; the feature extraction results of the inner face image in the model training image are output through the output stream of the inner face feature extraction network, namely, the output sample inner face features.

[0069] Correspondingly, the input stream of the external face feature extraction network in the dual-stream face recognition model is used to perform preliminary feature extraction and dimensionality reduction operations on the model training image to determine the local features of the external face image such as the external face edge features and external face texture features of the model training image; the middle stream of the external face feature extraction network is used to perform feature mining on the local features of the external face image to determine the deep features of the external face; the deep features of the external face are extracted with two blocks as a granularity, and four scales of deep features of the external face can be obtained, namely, sample external face features; the feature extraction results of the external face images in the model training image are output through the output stream of the external face feature extraction network, namely, the output sample external face features.

[0070] S230, determining the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model according to the model training image, the face features within the sample and the face features outside the sample.

[0071] Among them, feature consistency loss is the feature consistency loss function based on metric learning, face recognition classification loss is the face recognition classification function based on image quality assessment, and identity consistency loss is the identity consistency loss function across forgery categories.

[0072] S240, determining whether the dual-stream face recognition model is trained based on feature consistency loss, face recognition classification loss, identity consistency loss, and binary cross entropy loss of the dual-stream face recognition model during model training; if so, using the dual-stream face recognition model after training as the target face recognition model.

[0073] Among them, the binary cross entropy loss is a loss function that measures the gap between the model's predicted probability and the true probability, which can be used to characterize the accuracy of the two-stream face recognition model.

[0074] Specifically, determine whether the feature consistency loss, face recognition classification loss, identity consistency loss, and the binary cross entropy loss of the dual-stream face recognition model during model training all meet the preset model training end conditions. If so, determine that the dual-stream face recognition model training is completed, and use the dual-stream face recognition model after training as the target face recognition model; if not, determine that the dual-stream face recognition model is not trained, and continue to iteratively train the dual-stream face recognition model until it is determined that the feature consistency loss, face recognition classification loss, identity consistency loss, and the binary cross entropy loss of the dual-stream face recognition model during model training meet the preset model training end conditions.

[0075] Exemplarily, the preset model training end condition may be that the feature consistency loss is less than the first loss data, the face recognition classification loss is less than the second loss data, the identity consistency loss is less than the third loss data, the binary cross entropy loss of the dual-stream face recognition model during model training is less than the fourth loss data, and the first loss data, the second loss data, the third loss data and the fourth loss data can all be set according to actual needs.

[0076] S250: Input the image to be detected into a target face recognition model, and determine whether the image to be detected is a deep fake image according to the target face recognition model.

[0077] Among them, the image to be detected refers to a person image that needs to be detected whether it is a deep fake image.

[0078] Specifically, the image to be detected is input into the target face recognition model, and the output data of the target face recognition model is used to determine whether the image to be detected is a deep fake image.

[0079] In the above face recognition method, a model training image is obtained; the model training image is input into a dual-stream face recognition model, and the sample inner face features of the model training image are extracted through the inner face feature extraction network in the dual-stream face recognition model, and the sample outer face features of the model training image are extracted through the outer face feature extraction network in the dual-stream face recognition model; the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model are determined according to the model training image, the sample inner face features and the sample outer face features; according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, it is determined whether the dual-stream face recognition model is trained, and if so, the dual-stream face recognition model after training is used as the target face recognition model; the image to be detected is input into the target face recognition model, and it is determined whether the image to be detected is a deep fake image according to the target face recognition model. The problem that the shallow texture relied on by the existing deep fake detection scheme is easily destroyed or even disappears when the image quality decreases, thereby causing a sharp decline in performance and resulting in low accuracy of face recognition is solved. The above scheme constructs an inner face feature extraction network and an outer face feature extraction network in the dual-stream face recognition model, extracts sample inner face features of the model training image through the inner face feature extraction network, and extracts sample outer face features of the model training image through the outer face feature extraction network, and obtains the prediction result of the dual-stream face recognition model according to the feature difference between the sample inner face features and the sample outer face features. The model loss function of the dual-stream face recognition model is determined based on the prediction result of the dual-stream face recognition model, the model training image, the sample inner face features and the sample outer face features. The dual-stream face recognition model can be adjusted based on the model function, thereby improving the prediction accuracy of the dual-stream face recognition model, and obtaining the target face recognition model. Whether the image to be detected is a deep fake image is detected by the target face recognition model, and the feature difference between the inner face image and the outer face image in the deep fake image can be mined to improve the accuracy of face recognition.

[0080] In one embodiment, obtaining a model training image includes:

[0081] Collect sample training images from the deep fake dataset; perform horizontal inversion, Gaussian blur and brightness adjustment on the sample training images to determine the model training images.

[0082] Among them, the deep fake dataset can be a FaceForensics++ dataset, a DeepFake Detection dataset, a DeepFake Detection Challenge dataset and / or a Celeb-DF dataset.

[0083] Specifically, sample training images are collected from the FaceForensics++ dataset, the DeepFake Detection dataset, the DeepFakeDetection Challenge dataset and / or the Celeb-DF dataset, and image enhancement processing is performed on the sample training images, that is, horizontal inversion, Gaussian blur and brightness adjustment are performed on the sample training images, and the sample training images after image enhancement processing are used as model training images.

[0084] The above scheme performs image enhancement processing on sample training images collected from the deep fake data set to determine the model training image, which can improve the effectiveness and completeness of the model training image.

[0085] In one embodiment, Figure 4 As shown, the feature consistency loss, face recognition classification loss and identity consistency loss of the two-stream face recognition model are determined according to the model training image, the face features in the sample and the face features out of the sample, including:

[0086] S410, determining the feature consistency loss of the dual-stream face recognition model according to the sample inner face features, the sample outer face features, the number of sample real images in the sample training images, and the number of sample forged images through a consistency loss function.

[0087] Exemplarily, the method of calculating the feature consistency loss of the two-stream face recognition model by the consistency loss function is as shown in formula (2):

[0088]

[0089] Among them, L con is the feature consistency loss of the two-stream face recognition model, R represents the sample real image in the sample training image, and N R represents the number of sample real images in the sample training images, F represents the sample forged images in the sample training images, and N F represents the number of sample forged images in the sample training image, δ(.) represents the cosine distance calculation function, F in It is the inner face feature extraction network in the two-stream face recognition model, F out It is the external face feature extraction network in the two-stream face recognition model.

[0090] S420. Determine the face recognition classification loss of the dual-stream face recognition model according to the in-sample face features and the out-of-sample face features through a classification loss function.

[0091] Among them, the classification loss function is the MagFace classification function.

[0092] Exemplarily, the face recognition classification loss of the dual-stream face recognition model is calculated by the classification loss function as shown in formula (3):

[0093]

[0094] Among them, L mag is the face recognition classification loss of the two-stream face recognition model, e is a natural constant, j represents the class center of the jth class corresponding to the classification loss function, and y i is the identity category, which is the identity category corresponding to the real image or the identity category corresponding to the forged image. represents the angle between the identity category and the class center of the jth class corresponding to the classification loss function, g(a i ) To promote the two-stream face recognition model to learn a larger regularization term from the image, λ is a hyperparameter that balances the classification loss term and the regularization term. It should be noted that for model training images of different qualities, the corresponding interval in the MagFace classification function changes dynamically, so that the trained target face recognition model can have better robustness in the face of data with large changes in facial attributes.

[0095] S430. Determine the identity consistency loss of the dual-stream face recognition model according to the face features inside the sample, the face features outside the sample, the real image of the sample, and the forged image of the sample through a consistency loss function.

[0096] It should be noted that identity consistency loss refers to CICL (Cross-manipulation Identity Consistency Loss). Due to the differences in forgery methods in the real world, even if the source image is the same as the person in the face-swapped image, it may be difficult to extract the same inner face information. Therefore, the model can be trained based on identity consistency loss for the two-stream face recognition model to improve the model's accuracy in extracting inner face information.

[0097] The above scheme provides a method for calculating the feature consistency loss, face recognition classification loss and identity consistency loss of the two-stream face recognition model, thereby improving the accuracy of the loss function.

[0098] In one embodiment, the face recognition classification loss of the dual-stream face recognition model is determined according to the face features in the sample and the face features out of the sample through the classification loss function, including:

[0099] Determine the feature difference between the face features within the sample and the face features outside the sample; determine the angle between the feature difference and the class center corresponding to the classification loss function according to the feature difference through the classification loss function, and determine the face recognition classification loss of the dual-stream face recognition model based on the angle.

[0100] The above scheme, based on the feature difference between the face features inside the sample and the face features outside the sample, determines the angle between the feature difference and the class center corresponding to the classification loss function through the loss function, which can improve the calculation accuracy of the face recognition classification loss of the dual-stream face recognition model.

[0101] In one embodiment, determining the identity consistency loss of the two-stream face recognition model according to the sample inner face features, the sample outer face features, the sample real image and the sample forged image through a consistency loss function includes:

[0102] The sample real images and the sample forged images are grouped according to the correlation between them to determine the sample image group; the identity consistency loss of the two-stream face recognition model is determined according to the sample in-sample face features, the sample out-of-sample face features and the number of images in the sample image group through the consistency loss function.

[0103] The sample image group includes a sample real image and at least one sample forged image corresponding to the sample real image.

[0104] For example, if the model training image contains a sample real image x with identity category y1 i , a sample forged image x with the inner face identity y1 and the outer face identity y2 j , and the sample forged image x with the inner face identity y1 and the outer face identity y3 k On this basis, even if different image processing methods are used to transfer and merge the identities of the sample real image and the sample forged image, the inner face features between the sample real image and the two sample forged images should still have a very high similarity. However, due to the different outer face identities between the sample real image and the two sample forged images, the distance between the outer face features of the three images in the feature space should be far. The calculation formula for the identity consistency loss of the two-stream face recognition model is shown in formula (4):

[0105]

[0106] Among them, L cicl is the identity consistency loss of the two-stream face recognition model, P represents the triplet formed by matching the sample real image and the sample forged images obtained by two different face-changing methods, that is, the sample image group, and N P is the number of images in the sample image group, F out (x i ) is the sample real image x i The corresponding out-of-sample face features, F out (x j ) is a sample forged image x j The corresponding out-of-sample face features, F out(x k ) is a sample forged image x k The corresponding out-of-sample face features, F in (x i ) means that the sample real image x i The corresponding sample face features, F in (x j ) is a sample forged image x j The corresponding sample face features, F in (x k ) Sample forged image x k The corresponding face features in the sample.

[0107] The above scheme provides a method for calculating the identity consistency loss of a two-stream face recognition model, which can improve the calculation accuracy of the identity consistency loss.

[0108] In one embodiment, determining whether the dual-stream face recognition model is trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss, and the binary cross entropy loss of the dual-stream face recognition model during model training includes:

[0109] The feature consistency loss, face recognition classification loss, identity consistency loss and the binary cross entropy loss of the two-stream face recognition model during model training are weighted summed to determine the model loss function; if the model loss function is less than or equal to the target loss function, the training of the two-stream face recognition model is determined to be completed.

[0110] Among them, the objective loss function can be set according to actual needs.

[0111] The above scheme determines the model loss function according to the feature consistency loss, face recognition classification loss, identity consistency loss and the binary cross entropy loss of the two-stream face recognition model during model training, so as to determine whether the training of the two-stream face recognition model is completed according to the model loss function, thereby improving the prediction accuracy of the target face recognition model.

[0112] Exemplarily, inputting the image to be detected into a target face recognition model, and determining whether the image to be detected is a deep fake image according to the target face recognition model includes:

[0113] The image to be detected is input into the target face recognition model, the target inner face features of the image to be detected are extracted through the inner face feature extraction network in the face recognition model, and the target outer face features of the image to be detected are extracted through the outer face feature extraction network in the face recognition model; the feature similarity between the target inner face features and the target outer face features is determined; if the feature similarity is greater than a preset similarity threshold, the image to be detected is determined to be a real image; if the feature similarity is less than or equal to the similarity threshold, the image to be detected is determined to be a deep fake image.

[0114] The similarity threshold can be set according to actual needs.

[0115] The above scheme identifies the target inner face features and target outer face features corresponding to the image to be detected through a target face recognition model including an outer face feature extraction network and an inner face feature extraction network, and determines whether the image to be detected is a deep fake image based on the similarity between the target inner face features and the target outer face features, thereby improving the accuracy of judging deep fake images.

[0116] Exemplarily, based on the above embodiment, the face recognition method includes:

[0117] Sample training images are collected from the FaceForensics++ dataset, the DeepFake Detection dataset, the DeepFake DetectionChallenge dataset and / or the Celeb-DF dataset, and image enhancement processing is performed on the sample training images, that is, horizontal inversion, Gaussian blur and brightness adjustment are performed on the sample training images, and the sample training images after image enhancement processing are used as model training images.

[0118] The model training image is input into the two-stream face recognition model, and preliminary feature extraction and dimensionality reduction operations are performed on the model training image through the input stream of the inner face feature extraction network in the two-stream face recognition model to determine the local features of the inner face image such as the inner face edge features and inner face texture features of the model training image; feature mining is performed on the local features of the inner face image through the intermediate stream of the inner face feature extraction network to determine the deep features of the inner face; the deep features of the inner face are extracted with two blocks as a granularity, and four scales of deep features of the inner face can be obtained, namely, sample inner face features; the feature extraction results of the inner face image in the model training image are output through the output stream of the inner face feature extraction network, namely, the output sample inner face features.

[0119] Correspondingly, the input stream of the external face feature extraction network in the dual-stream face recognition model is used to perform preliminary feature extraction and dimensionality reduction operations on the model training image to determine the local features of the external face image such as the external face edge features and external face texture features of the model training image; the middle stream of the external face feature extraction network is used to perform feature mining on the local features of the external face image to determine the deep features of the external face; the deep features of the external face are extracted with two blocks as a granularity, and four scales of deep features of the external face can be obtained, namely, sample external face features; the feature extraction results of the external face images in the model training image are output through the output stream of the external face feature extraction network, namely, the output sample external face features.

[0120] The feature consistency loss of the dual-stream face recognition model is determined by the consistency loss function according to the sample inner face feature, the sample outer face feature, the number of sample real images in the sample training image, and the number of sample forged images. The feature difference between the sample inner face feature and the sample outer face feature is determined; the angle between the feature difference and the class center corresponding to the classification loss function is determined according to the feature difference, and the face recognition classification loss of the dual-stream face recognition model is determined based on the angle. The sample real image and the sample forged image are grouped according to the association relationship between the sample real image and the sample forged image to determine the sample image group; the identity consistency loss of the dual-stream face recognition model is determined according to the sample inner face feature, the sample outer face feature, and the number of images in the sample image group through the consistency loss function.

[0121] According to the feature consistency loss, face recognition classification loss, identity consistency loss and the binary cross entropy loss of the two-stream face recognition model during model training, it is determined whether the two-stream face recognition model is trained. If so, the two-stream face recognition model after training is used as the target face recognition model.

[0122] After determining the target face recognition model, you can also collect model test images from the FaceForensics++ dataset, DeepFakeDetection dataset, DeepFake Detection Challenge dataset, and / or Celeb-DF dataset, input the model test images into the target face recognition model, and determine the AUC (area under the curve) index of the target face recognition model based on the predicted data of the target face recognition model. Determine whether the AUC index meets the preset index conditions. If so, the target face recognition model can be used to detect whether the image to be detected is a deep fake image. If not, further iterative training of the target face recognition model is required.

[0123] After determining that the target face recognition model can be used to detect whether the image to be detected is a deep fake image, the image to be detected is input into the target face recognition model, the target inner face features of the image to be detected are extracted through the inner face feature extraction network in the face recognition model, and the target outer face features of the image to be detected are extracted through the outer face feature extraction network in the face recognition model; determine the feature similarity between the target inner face features and the target outer face features; if the feature similarity is greater than a preset similarity threshold, determine that the image to be detected is a real image; if the feature similarity is less than or equal to the similarity threshold, determine that the image to be detected is a deep fake image.

[0124] In the above face recognition method, a model training image is obtained; the model training image is input into a dual-stream face recognition model, and the sample inner face features of the model training image are extracted through the inner face feature extraction network in the dual-stream face recognition model, and the sample outer face features of the model training image are extracted through the outer face feature extraction network in the dual-stream face recognition model; the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model are determined according to the model training image, the sample inner face features and the sample outer face features; according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, it is determined whether the dual-stream face recognition model is trained, and if so, the dual-stream face recognition model after training is used as the target face recognition model; the image to be detected is input into the target face recognition model, and it is determined whether the image to be detected is a deep fake image according to the target face recognition model. The problem that the shallow texture relied on by the existing deep fake detection scheme is easily destroyed or even disappears when the image quality decreases, thereby causing a sharp decline in performance and resulting in low accuracy of face recognition is solved. The above scheme constructs an inner face feature extraction network and an outer face feature extraction network in the dual-stream face recognition model, extracts sample inner face features of the model training image through the inner face feature extraction network, and extracts sample outer face features of the model training image through the outer face feature extraction network, and obtains the prediction result of the dual-stream face recognition model according to the feature difference between the sample inner face features and the sample outer face features. The model loss function of the dual-stream face recognition model is determined based on the prediction result of the dual-stream face recognition model, the model training image, the sample inner face features and the sample outer face features. The dual-stream face recognition model can be adjusted based on the model function, thereby improving the prediction accuracy of the dual-stream face recognition model, and obtaining the target face recognition model. Whether the image to be detected is a deep fake image is detected by the target face recognition model, and the feature difference between the inner face image and the outer face image in the deep fake image can be mined to improve the accuracy of face recognition.

[0125] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0126] Based on the same inventive concept, the embodiment of the present application also provides a face recognition device for implementing the face recognition method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more face recognition device embodiments provided below can refer to the limitations on the face recognition method above, and will not be repeated here.

[0127] In one embodiment, Figure 5 As shown, a face recognition device is provided, including: an image acquisition module 501, a feature extraction module 502, a model loss determination module 503, a model training module 504 and an image detection module 505, wherein:

[0128] An image acquisition module 501 is used to acquire model training images;

[0129] A feature extraction module 502 is used to input the model training image into the dual-stream face recognition model, and extract the sample inner face features of the model training image through the inner face feature extraction network in the dual-stream face recognition model, and extract the sample outer face features of the model training image through the outer face feature extraction network in the dual-stream face recognition model;

[0130] A model loss determination module 503, used to determine a feature consistency loss, a face recognition classification loss and an identity consistency loss of a dual-stream face recognition model according to the model training image, the face features in the sample and the face features out of the sample;

[0131] The model training module 504 determines whether the dual-stream face recognition model has been trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss, and the binary cross entropy loss of the dual-stream face recognition model during model training. If so, the dual-stream face recognition model after training is used as the target face recognition model.

[0132] The image detection module 505 is used to input the image to be detected into the target face recognition model, and determine whether the image to be detected is a deep fake image according to the target face recognition model.

[0133] Exemplarily, the image acquisition module 501 is specifically used for:

[0134] Collect sample training images from the deepfake dataset;

[0135] The sample training image is horizontally inverted, Gaussian blurred, and brightness adjusted to determine a model training image.

[0136] Exemplarily, the model loss determination module 503 is specifically used for:

[0137] Determining the feature consistency loss of the dual-stream face recognition model according to the sample inner face features, the sample outer face features, the number of sample real images and the number of sample forged images in the sample training images through a consistency loss function;

[0138] Through the classification loss function, the face recognition classification loss of the two-stream face recognition model is determined according to the in-sample face features and the out-of-sample face features;

[0139] The identity consistency loss of the dual-stream face recognition model is determined according to the sample inner face features, the sample outer face features, the sample real image and the sample forged image through a consistency loss function.

[0140] Exemplarily, the model loss determination module 503 is further specifically used for:

[0141] Determine the feature difference between the face feature in the sample and the face feature outside the sample;

[0142] By using a classification loss function, an angle between the feature difference and a class center corresponding to the classification loss function is determined according to the feature difference, and a face recognition classification loss of a dual-stream face recognition model is determined based on the angle.

[0143] Exemplarily, the model loss determination module 503 is further specifically used for:

[0144] grouping the sample real images and the sample forged images according to the association relationship between the sample real images and the sample forged images to determine a sample image group;

[0145] The identity consistency loss of the dual-stream face recognition model is determined according to the in-sample face features, the out-sample face features and the number of images in the sample image group through a consistency loss function.

[0146] Exemplarily, the model training module 504 is specifically used for:

[0147] The feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the two-stream face recognition model during model training are weighted summed to determine a model loss function;

[0148] If the model loss function is less than or equal to the target loss function, it is determined that the dual-stream face recognition model training is completed.

[0149] Exemplarily, the image detection module 505 is specifically used for:

[0150] Inputting the image to be detected into the target face recognition model, extracting the target inner face features of the image to be detected through the inner face feature extraction network in the face recognition model, and extracting the target outer face features of the image to be detected through the outer face feature extraction network in the face recognition model;

[0151] Determining feature similarity between the target inner face feature and the target outer face feature;

[0152] If the feature similarity is greater than a preset similarity threshold, determining that the image to be detected is a real image;

[0153] If the feature similarity is less than or equal to the similarity threshold, it is determined that the image to be detected is a deep fake image.

[0154] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a face recognition method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0155] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0156] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0157] Step 1: Obtain model training images;

[0158] Step 2: Input the model training image into the dual-stream face recognition model, and extract the sample inner face features of the model training image through the inner face feature extraction network in the dual-stream face recognition model, and extract the sample outer face features of the model training image through the outer face feature extraction network in the dual-stream face recognition model;

[0159] Step 3: Determine the feature consistency loss, face recognition classification loss and identity consistency loss of the two-stream face recognition model according to the model training image, the face features in the sample and the face features out of the sample;

[0160] Step 4: Determine whether the two-stream face recognition model is trained based on the feature consistency loss, face recognition classification loss, identity consistency loss, and the binary cross entropy loss of the two-stream face recognition model during model training. If so, use the trained two-stream face recognition model as the target face recognition model.

[0161] Step 5: Input the image to be detected into the target face recognition model, and determine whether the image to be detected is a deep fake image based on the target face recognition model.

[0162] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0163] Step 1: Obtain model training images;

[0164] Step 2: Input the model training image into the dual-stream face recognition model, and extract the sample inner face features of the model training image through the inner face feature extraction network in the dual-stream face recognition model, and extract the sample outer face features of the model training image through the outer face feature extraction network in the dual-stream face recognition model;

[0165] Step 3: Determine the feature consistency loss, face recognition classification loss and identity consistency loss of the two-stream face recognition model according to the model training image, the face features in the sample and the face features out of the sample;

[0166] Step 4: Determine whether the two-stream face recognition model is trained based on the feature consistency loss, face recognition classification loss, identity consistency loss, and the binary cross entropy loss of the two-stream face recognition model during model training. If so, use the trained two-stream face recognition model as the target face recognition model.

[0167] Step 5: Input the image to be detected into the target face recognition model, and determine whether the image to be detected is a deep fake image based on the target face recognition model.

[0168] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0169] Step 1: Obtain model training images;

[0170] Step 2: Input the model training image into the dual-stream face recognition model, and extract the sample inner face features of the model training image through the inner face feature extraction network in the dual-stream face recognition model, and extract the sample outer face features of the model training image through the outer face feature extraction network in the dual-stream face recognition model;

[0171] Step 3: Determine the feature consistency loss, face recognition classification loss and identity consistency loss of the two-stream face recognition model according to the model training image, the face features in the sample and the face features out of the sample;

[0172] Step 4: Determine whether the two-stream face recognition model is trained based on the feature consistency loss, face recognition classification loss, identity consistency loss, and the binary cross entropy loss of the two-stream face recognition model during model training. If so, use the trained two-stream face recognition model as the target face recognition model.

[0173] Step 5: Input the image to be detected into the target face recognition model, and determine whether the image to be detected is a deep fake image based on the target face recognition model.

[0174] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0175] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded vector non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0176] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0177] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A face recognition method, characterized in that: include: Get model training images; Input the model training image into a dual-stream face recognition model, and extract sample inner face features of the model training image through an inner face feature extraction network in the dual-stream face recognition model, and extract sample outer face features of the model training image through an outer face feature extraction network in the dual-stream face recognition model; Determine the feature consistency loss, face recognition classification loss and identity consistency loss of the dual-stream face recognition model according to the model training image, the in-sample face features and the out-of-sample face features; Determine whether the dual-stream face recognition model is trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, and if so, use the dual-stream face recognition model after training as the target face recognition model; The image to be detected is input into the target face recognition model, and it is determined whether the image to be detected is a deep fake image according to the target face recognition model.

2. The method according to claim 1, characterized in that: Get model training images, including: Collect sample training images from the deepfake dataset; The sample training image is horizontally inverted, Gaussian blurred, and brightness adjusted to determine a model training image.

3. The method according to claim 1, characterized in that: Determining the feature consistency loss, face recognition classification loss and identity consistency loss of a two-stream face recognition model according to the model training image, the face features in the sample and the face features out of the sample, including: Determining the feature consistency loss of the dual-stream face recognition model according to the sample inner face features, the sample outer face features, the number of sample real images and the number of sample forged images in the sample training images through a consistency loss function; Through the classification loss function, the face recognition classification loss of the two-stream face recognition model is determined according to the in-sample face features and the out-of-sample face features; The identity consistency loss of the dual-stream face recognition model is determined according to the sample inner face features, the sample outer face features, the sample real image and the sample forged image through a consistency loss function.

4. The method according to claim 3, characterized in that Through the classification loss function, the face recognition classification loss of the two-stream face recognition model is determined according to the in-sample face features and out-of-sample face features, including: Determine the feature difference between the face feature in the sample and the face feature outside the sample; By using a classification loss function, an angle between the feature difference and a class center corresponding to the classification loss function is determined according to the feature difference, and a face recognition classification loss of a dual-stream face recognition model is determined based on the angle.

5. The method according to claim 3, characterized in that: Determining the identity consistency loss of the two-stream face recognition model according to the sample inner face features, the sample outer face features, the sample real image and the sample forged image through a consistency loss function, including: grouping the sample real images and the sample forged images according to the association relationship between the sample real images and the sample forged images to determine a sample image group; The identity consistency loss of the dual-stream face recognition model is determined by a consistency loss function according to the in-sample face features, the out-sample face features and the number of images in the sample image group.

6. The method according to claim 1, characterized in that Determining whether the dual-stream face recognition model is trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss, and the binary cross entropy loss of the dual-stream face recognition model during model training includes: The feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the two-stream face recognition model during model training are weighted summed to determine a model loss function; If the model loss function is less than or equal to the target loss function, it is determined that the dual-stream face recognition model training is completed.

7. The method according to claim 1, characterized in that Inputting the image to be detected into a target face recognition model, and determining whether the image to be detected is a deep fake image according to the target face recognition model, including: Inputting the image to be detected into the target face recognition model, extracting the target inner face features of the image to be detected through the inner face feature extraction network in the face recognition model, and extracting the target outer face features of the image to be detected through the outer face feature extraction network in the face recognition model; Determining feature similarity between the target inner face feature and the target outer face feature; If the feature similarity is greater than a preset similarity threshold, determining that the image to be detected is a real image; If the feature similarity is less than or equal to the similarity threshold, it is determined that the image to be detected is a deep fake image.

8. A face recognition device, characterized in that: The face recognition device comprises: An image acquisition module is used to acquire model training images; A feature extraction module, used to input the model training image into a dual-stream face recognition model, and extract sample inner face features of the model training image through an inner face feature extraction network in the dual-stream face recognition model, and extract sample outer face features of the model training image through an outer face feature extraction network in the dual-stream face recognition model; A model loss determination module, used to determine the feature consistency loss, face recognition classification loss and identity consistency loss of a dual-stream face recognition model according to the model training image, the face features in the sample and the face features outside the sample; A model training module, which determines whether the dual-stream face recognition model has been trained according to the feature consistency loss, the face recognition classification loss, the identity consistency loss and the binary cross entropy loss of the dual-stream face recognition model during model training, and if so, uses the dual-stream face recognition model after training as a target face recognition model; The image detection module is used to input the image to be detected into the target face recognition model, and determine whether the image to be detected is a deep fake image according to the target face recognition model.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

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