A living body detection method, device and electronic equipment
By training the first network model with live and non-live data from different data domains and adjusting the model parameters, the problem of inaccurate recognition results in silent liveness detection was solved, and the accuracy of liveness detection was improved.
Patent Information
- Application Number
- CN202111662675.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2041-12-31
AI Technical Summary
Existing facial recognition systems have security vulnerabilities in liveness detection, and silent liveness detection cannot guarantee the accuracy of recognition results.
The first network model is trained using live and non-live data from different data domains, and the parameters of the first network model are adjusted using the domain classification results and liveness detection results, including updating the parameters of the classifier and feature generator, in order to reduce the impact of data domain differences on liveness detection.
It improves the accuracy of liveness detection, reduces detection errors caused by differences in data domains, and enhances the robustness of liveness detection.
Smart Images

Figure CN114360072B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of face recognition, and in particular to a living body detection method and device and electronic equipment. BACKGROUND
[0002] At present, face recognition technology is widely used in permission verification scenarios of various terminal devices, such as opening of access control, unlocking of mobile phones, face payment, etc., due to its good user experience, fast detection speed, and no need for contact. However, the face recognition system still has security risks, for example, using a photo or video of the permission owner for permission verification may bring risks to the personal information and property of the permission owner. Therefore, the living body detection technology is usually applied to the face recognition scene to ensure that the face recognition object is a real living body, thereby protecting the user's rights and interests.
[0003] The current living body detection methods are divided into silent living body detection and dynamic cooperation living body detection. The dynamic cooperation living body detection requires the user to perform relevant instructions, and determines whether the current face is an intruding face according to the completion of the user to the relevant instructions. The silent living body detection does not have an interaction process with the user. Therefore, it is a difficult problem to perform face recognition by the silent living body detection method and ensure the accuracy of the recognition result. SUMMARY
[0004] The present application provides a living body detection method, device and electronic equipment. The living body data and non-living body data in different data domains are used to train a first network model, and the first network model parameters are adjusted by the domain classification result and the living body detection result, thereby reducing the influence of different data domains on living body detection and improving the living body detection accuracy of the obtained second network model.
[0005] In a first aspect, the present application provides a living body detection method, comprising:
[0006] Inputting living body data and non-living body data in at least one data domain into a first network model, wherein the living body data and the non-living body data at least include face data;
[0007] Obtaining a living body detection result generated by a classifier in the first network model and a domain classification result generated by an adversarial network in the first network model;
[0008] Updating the parameters corresponding to the classifier according to the living body detection result;
[0009] Updating the parameters corresponding to the feature generator in the first network model according to the living body detection result and / or the domain classification result;
[0010] According to the updated feature generator and the updated classifier, a second network model is obtained, wherein the second network model is used for living body detection.
[0011] By the above method, the first network model is trained using living body data and non-living body data in different data domains, and the first network model parameters are adjusted using the domain classification result and the living body detection result, so as to reduce the influence of different data domains on living body detection and improve the living body detection accuracy.
[0012] In a possible design, the inputting of the living body data and the non-living body data in at least one data domain into the first network model comprises:
[0013] The living body data and the non-living body data are obtained, wherein the living body data and the non-living body data include face image data and image data other than the face image range;
[0014] The living body data and the non-living body data in at least one data domain are input into the first network model.
[0015] By the above method, the first network model is trained using living body data and non-living body data containing image data other than the face image range, so as to improve the recognition ability of the feature generator in the first network model to the image data other than the face image range in the training process, and the image data other than the face image range corresponding to the non-living body data usually contains significant features of the non-living body data, which helps to distinguish the living body data and the non-living body data.
[0016] In a possible design, the updating of the parameters corresponding to the classifier according to the living body detection result comprises:
[0017] A first loss value corresponding to a plurality of the living body detection results is calculated, and whether the first loss value converges is detected;
[0018] If not, the parameters corresponding to the classifier are adjusted until the first loss value converges.
[0019] By the above method, the classifier parameters are adjusted, so as to improve the classification ability of the classifier to the living body data and the non-living body data, and further help to improve the living body detection accuracy.
[0020] In a possible design, the updating of the parameters corresponding to the feature generator in the first network model according to the living body detection result and / or the domain classification result comprises:
[0021] A first loss value corresponding to a plurality of the living body detection results is calculated;
[0022] adjusting the parameters corresponding to the feature generator in the first network model when the first loss value does not converge until the first loss value converges; and / or
[0023] calculating a second loss value corresponding to the plurality of domain classification results, wherein the second loss value indicates a constraint function loss value corresponding to the adversarial network;
[0024] adjusting the parameters corresponding to the feature generator in the first network model when the second loss value does not converge until the second loss value converges.
[0025] By the above method, the parameters corresponding to the feature generator are adjusted using the live body detection result, or the parameters corresponding to the feature generator are adjusted using the domain classification result, reducing the influence of different data domains on live body detection and improving the accuracy of live body detection.
[0026] In a possible design, after the second network model is obtained, the method further includes:
[0027] when the target face is detected, inputting image data corresponding to the target face into the second network model;
[0028] determining the classification of the image data by the feature generator and the classifier in the second network model, and determining whether the target face is a live body according to the classification result.
[0029] By the above method, the second network model obtained after training is used for live body detection, which can reduce the influence of different data domains on live body detection and improve the accuracy of live body detection.
[0030] In a possible design, the determining the classification of the image data by the feature generator and the classifier in the second network model, and determining whether the target face is a live body according to the classification result, includes:
[0031] classifying the image data by the feature generator and the classifier in the second network model to obtain a classification result containing a data category and a probability corresponding to the data category, wherein the data category includes live body data and non-live body data.
[0032] determining whether the target face is a live body according to the classification result.
[0033] By the above method, whether the detected target face is a live body is determined according to the classification result of the second network model.
[0034] In a possible design, before the live body data and the non-live body data in the at least one data domain are input into the first network model, the method further includes:
[0035] obtain first extended data, and perform data augmentation on the first extended data to obtain second extended data, wherein the first extended data at least includes face image data and image data outside the face image range, and the preset data at least includes face image data;
[0036] input the first extended data and the second extended data into a first network model;
[0037] generate first feature data corresponding to the first extended data and second feature data corresponding to the second extended data according to a feature generator in the first network model;
[0038] adjust parameters of the feature generator in the first network model according to a contrast loss value between the first feature data and the second feature data.
[0039] Through the above method, the feature generator is trained using the extended data before data augmentation and the extended data after data augmentation, so that the feature similarity between the extended data before data augmentation and the extended data after data augmentation meets the preset requirement, the consistency of the training sample features is maintained while the training data is augmented, and the robustness of the feature generator is improved.
[0040] In a possible design, the obtaining of the first extended data includes:
[0041] When collecting face image data, a first detection frame is enlarged to obtain a second detection frame, wherein the second detection frame includes face images and images outside the face image range.
[0042] obtain all image data in the second detection frame, and perform blur processing on preset data in the all image data to obtain the first extended data, wherein the preset data at least includes face image data.
[0043] Through the above method, the extended data obtained contains image data other than face image data. For non-living body data, these data other than face image data usually contain significant features that are different from living body data, which is conducive to improving the accuracy of living body detection. At the same time, by performing blur processing on the face data in the image data, the recognition ability of the feature generator for the significant features is improved, and the accuracy of living body detection is improved.
[0044] In a possible design, the adjusting of the parameters of the feature generator in the first network model according to the contrast loss value between the first feature data and the second feature data includes:
[0045] calculate a contrast loss value between a plurality of first feature parameters and second feature parameters.
[0046] determining whether the contrast loss value converges;
[0047] if not, adjusting parameters corresponding to the feature generator in the first network model until the contrast loss value converges.
[0048] By the above method, the training process of the feature generator is constrained, so that the consistency of the feature data is maintained before and after the expansion of the training sample, thereby improving the robustness of the feature generator.
[0049] In a possible design, the second network model includes the feature generator with the updated parameters, the classifier with the updated parameters, and the adversarial network.
[0050] In a second aspect, the present application provides a living body detection device, which includes:
[0051] a first input module configured to input living body data and non-living body data in at least one data field into a first network model, wherein the living body data and the non-living body data at least include face data;
[0052] an acquisition module configured to acquire a living body detection result generated by a classifier in the first network model and a domain classification result generated by an adversarial network in the first network model;
[0053] a first update module configured to update parameters corresponding to the classifier according to the living body detection result, and update parameters corresponding to a feature generator in the first network model according to the living body detection result and / or the domain classification result;
[0054] a determination module configured to obtain a second network model according to the feature generator with the updated parameters and the classifier with the updated parameters, wherein the second network model is used for living body detection.
[0055] In a possible design, the first input module is specifically configured to:
[0056] acquire the living body data and the non-living body data, wherein the living body data and the non-living body data include face image data and image data other than the face image range;
[0057] input the living body data and the non-living body data in at least one data field into the first network model.
[0058] In a possible design, the first update module is specifically configured to:
[0059] calculate a first loss value corresponding to a plurality of the living body detection results, and detect whether the first loss value converges;
[0060] If not, the parameters corresponding to the classifier are adjusted until the first loss value converges.
[0061] In a possible design, the first updating module is further configured to:
[0062] calculate a first loss value corresponding to a plurality of the living body detection results;
[0063] adjust the parameters corresponding to the feature generator in the first network model when the first loss value does not converge, until the first loss value converges; and / or
[0064] calculate a second loss value corresponding to a plurality of the domain classification results, where the second loss value indicates a constraint function loss value corresponding to the adversarial network;
[0065] adjust the parameters corresponding to the feature generator in the first network model when the second loss value does not converge, until the second loss value converges.
[0066] In a possible design, the apparatus further includes:
[0067] a detection module configured to input image data corresponding to the target face into the second network model when the target face is detected;
[0068] a determination module configured to determine the classification of the image data by using the feature generator and the classifier in the second network model, and determine whether the target face is a living body according to the classification result.
[0069] In a possible design, the determination module is specifically configured to:
[0070] classify the image data by using the feature generator and the classifier in the second network model, to obtain a classification result including a data category and a probability corresponding to the data category, where the data category includes living body data and non-living body data.
[0071] determine whether the target face is a living body according to the classification result.
[0072] In a possible design, the apparatus further includes:
[0073] an expansion module configured to obtain first external expansion data, and perform data expansion on the first external expansion data to obtain second external expansion data, where the first external expansion data at least includes face image data and image data other than the face image range, and the preset data at least includes face image data.
[0074] a second input module configured to input the first external expansion data and the second external expansion data into the first network model.
[0075] generating, according to a feature generator in the first network model, first feature data corresponding to the first expanded data and second feature data corresponding to the second expanded data;
[0076] a second updating module, configured to adjust parameters of the feature generator in the first network model according to a contrast loss value between the first feature data and the second feature data.
[0077] In a possible design, the expansion module is specifically configured to:
[0078] expand the first detection frame to obtain a second detection frame, wherein the second detection frame includes the face image and image data other than the face image;
[0079] obtain all image data in the second detection frame, and perform blur processing on preset data in the all image data to obtain the first expanded data, wherein the preset data at least includes the face image data.
[0080] In a possible design, the second updating module is specifically configured to:
[0081] calculate a contrast loss value between a plurality of the first feature parameters and the second feature parameters;
[0082] determine whether the contrast loss value converges;
[0083] if not, adjust the parameters of the feature generator in the first network model until the contrast loss value converges.
[0084] In a possible design, the second network model includes the feature generator with the updated parameters, the classifier with the updated parameters, and the adversarial network.
[0085] In a third aspect, the present application provides an electronic device, comprising:
[0086] a memory configured to store a computer program;
[0087] a processor configured to execute the computer program stored in the memory to implement the steps of the living body detection method.
[0088] In a fourth aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the living body detection method.
[0089] Based on the above living body detection method, the first network model is trained using living body data and non-living body data in different data domains, and the parameters corresponding to the first network model are adjusted using the domain classification results and the living body detection results corresponding to different data domains, thereby reducing the influence of different data domains on the accuracy of the living body detection results, and further improving the accuracy of the second network model in living body detection of the target face.
[0090] The above aspects and the technical effects that can be achieved by each aspect in the second aspect to the fifth aspect are described above with reference to the technical effects that can be achieved by the first aspect or the various possible solutions in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0091] Figure 1 A flowchart of a living body detection method provided by the present application is shown in the figure.
[0092] Figure 2 An example diagram of a living body detection method provided by the present application is shown in the figure.
[0093] Figure 3 A structural schematic diagram of a living body detection device provided by the present application is shown in the figure.
[0094] Figure 4 A structural schematic diagram of an electronic device provided by the present application is shown in the figure. DETAILED DESCRIPTION
[0095] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be described in further detail below with reference to the accompanying drawings. The specific operation method in the method embodiment can also be applied to the device embodiment or the system embodiment. It should be noted that in the description of the present application, "multiple" is understood as "at least two". The association relationship between the associated objects is described, which means that there can be three relationships, for example, A and / or B, which means that there are three cases: A exists alone, A and B exist together, and B exists alone. A and B are connected, which means that A and B are directly connected and A and B are connected through C. In addition, in the description of the present application, "first", "second", etc. are used only for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance, nor can it be understood as indicating or implying order.
[0096] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0097] In the field of face recognition, in order to avoid the face recognition system being attacked by face photos or screens displaying faces, it is usually necessary to perform live body detection in the process of face recognition. The current methods for implementing live body detection are divided into silent live body detection and dynamic cooperative live body detection. The dynamic cooperative live body detection requires the user to perform relevant instructions, and judges whether the current face is an intruding face according to the completion of the user to the relevant instructions. The silent live body detection does not have the process of interacting with the user. Therefore, it is a difficult problem to perform face recognition through the silent live body detection and ensure the accuracy of the recognition result.
[0098] To solve the above problems, the present application provides a live body detection method, which uses live body data and non-live body data in different data domains to train a first network model, and adjusts the parameters of the first network model with the domain classification result and the live body detection result, thereby reducing the influence of the difference between the data domains on live body detection and improving the live body detection accuracy of the obtained second network model. The method and device described in the embodiments of the present application are based on the same technical concept. Since the principles of the problems solved by the method and device are similar, the embodiments of the device and the method can be mutually referred to, and the repeated parts will not be described again.
[0099] As shown in Figure 1 , a flowchart of a live body detection method provided by the present application, specifically comprising the following steps:
[0100] S11, inputting live body data and non-live body data in at least one data domain into a first network model;
[0101] S12, obtaining a live body detection result generated by a classifier in the first network model and a domain classification result generated by an adversarial network in the first network model;
[0102] S13, updating the parameters corresponding to the classifier according to the live body detection result;
[0103] S14, updating the parameters corresponding to the feature generator in the first network model according to the live body detection result and / or the domain classification result;
[0104] S15, obtaining a second network model according to the updated feature generator and the updated classifier.
[0105] In the embodiments of the present application, when the target face is obtained, in order to accurately detect whether the target face is a live body, the first network model needs to be trained to obtain a second network model for live body detection, and the specific training method is as shown in Figure 1 .
[0106] In Figure 1In some embodiments, the training data for training the first network model is from different data domains. For example, some training data corresponds to images with a desert background, some training data corresponds to images with a snowy background, and some training data corresponds to images with a mountain, river, lake, sea, or the like. Each data domain includes live body data and non-live body data.
[0107] After inputting the live body data and non-live body data from different data domains into the first network model, the live body detection result generated by the classifier in the first network model and the domain classification result generated by the adversarial network in the first network model are obtained. Further, the parameters corresponding to the classifier are updated according to the live body detection result. The method for updating the parameters is as follows:
[0108] The first loss value corresponding to the plurality of live body detection results is calculated, and whether the first loss value converges is detected. If not, the parameters corresponding to the classifier are adjusted until the first loss value converges.
[0109] In the above process, the formula for calculating the first loss value is as follows:
[0110]
[0111] In formula (1), L ce represents the first loss value, y i represents the data category corresponding to the classification result, wherein the data category includes live body data and non-live body data. p i represents the probability corresponding to the prediction y i . The classifier is trained by the constraint function corresponding to formula (1), and the training process is constrained to make the classifier after training have strong classification ability and ensure the accuracy of the classification result.
[0112] Of course, in the process of training the first network model, in addition to adjusting the parameters corresponding to the classifier, the parameters corresponding to the feature generator in the first network model are also updated according to the live body detection result and / or the domain classification result. The specific method for adjusting the parameters of the feature generator in the first network model includes:
[0113] The first loss value corresponding to the plurality of live body detection results is calculated. When the first loss value approaches a certain specific value and reaches a balance state, it indicates that the first loss value converges. When the first loss value does not converge, the parameters corresponding to the feature generator in the first network model are adjusted until the first loss value converges; and / or
[0114] The second loss value corresponding to the plurality of domain classification results is calculated, wherein the second loss value indicates a constraint function loss value corresponding to the adversarial network; when the second loss value approaches a certain specific value and reaches a balance state, it indicates that the second loss value converges; when the second loss value does not converge, the parameters corresponding to the feature generator in the first network model are adjusted until the second loss value converges.
[0115] In the above process, the calculation method of the first loss value refers to formula (1), and the calculation method of the second loss value refers to formula (2):
[0116]
[0117] In formula (2), the calculation result of L a is the second loss value, Y D represents the category of the domain, X f is the non-living data, N is the number of data domains, and Ⅱ i=y is an indicator function, which takes a value of 1 when i=y, and a value of 0 otherwise. The method of taking the gradient of the second loss function is to add a gradient reverse layer (GRL).
[0118] In the embodiments of the present application, the parameters corresponding to the feature generator can be adjusted according to the second loss value alone, or the parameters corresponding to the feature generator can be adjusted according to the first loss value alone, of course, the best way is to consider the first loss value and the second loss value at the same time, and use the constraint function corresponding to formula (1) and the constraint function corresponding to formula (2) to constrain the training process of the feature generator, so that the feature generator does not pay attention to the domain of each living body data or non-living body data when obtaining the data features corresponding to the living body data and the non-living body data in each data domain, thereby reducing the influence of different data domains on the living body detection result.
[0119] Further, according to the updated parameters of the feature generator and the updated parameters of the classifier, a second network model is obtained, and in one possible design, the second network model and the adversarial network. The method for performing living body detection using the second network model is as follows:
[0120] When the target face is detected, the image data corresponding to the target face is input into the second network model;
[0121] The image data is classified by the feature generator and the classifier in the second network model to obtain a classification result containing data categories and probabilities corresponding to the data categories;
[0122] According to the classification result, it is determined whether the target face is a living body.
[0123] Based on the above living body detection method, the living body data and the non-living body data in different data domains are used to train the first network model, and the domain classification results and the living body detection results corresponding to the different data domains are used to adjust the parameters corresponding to the first network model, thereby reducing the influence of the difference between the data domains on the accuracy of the living body detection results, and improving the accuracy of the second network model in living body detection of the target face.
[0124] In a possible design, in order to improve the accuracy of distinguishing the living body data and the non-living body data, a criterion for distinguishing the living body data and the non-living body data needs to be found. For the non-living body data, such as a photo or a screen displaying a face image, there are edge features, such as photo edge features and screen edge features; and for the living body data, there are no edge features. That is, the edge features can be used as the criterion for distinguishing the living body data and the non-living body data. Therefore, when the living body data and the non-living body data in each data domain are used to train the first network model, the living body data and the non-living body data include face image data and image data other than the face image range, and the image data other than the face image range contains significant features, such as edge features, which are only possessed by the non-living body data and are helpful to distinguish the living body data and the non-living body data.
[0125] When the first network model is trained by the above method and the second network model is used to detect the living body of the target face, if the target face is non-living body data and contains the significant features, the feature generator in the second network model can extract the feature data corresponding to the significant features, and the significant features are important indicators for distinguishing the living body data and the non-living body data, thereby improving the accuracy of the living body detection.
[0126] In a possible design, in order to expand the training samples and ensure the feature consistency before and after the expansion of the training samples, before the living body data and the non-living body data in each data domain are used to train the first network model, the first network model can also be trained according to the following method:
[0127] The first external expansion data is obtained, and the specific method includes: expanding the first detection frame to obtain a second detection frame when the face image data is collected, wherein the second detection frame includes the face image and the image other than the face image range; obtaining all image data in the second detection frame, and performing blur processing on preset data in all image data to obtain the first expansion data, wherein the preset data at least includes the face image data. For example, the face in the image data corresponding to the second detection frame is shielded, or interference data is added, and the background data, light data, and the like in the image data corresponding to the second detection frame can also be blurred.
[0128] The first external expansion data obtained by the above method contains image data other than face image data, and among the data other than the face image data, there are usually significant features that distinguish the living body data, thereby facilitating the improvement of the accuracy of the living body detection. At the same time, by performing the blurring processing on the face data in the image data, the recognition ability of the feature generator to the significant features is facilitated, thereby improving the accuracy of the living body detection.
[0129] Further, the first external expansion data is data augmented to obtain second external expansion data. The data augmentation is data enhancement. The specific data enhancement method can be style transfer method, or the corresponding data of the original image after spatial geometric transformation is added to the first expansion data to realize the data augmentation of the first external expansion data. The spatial geometric transformation includes flipping, cropping, rotating, parallel transformation, etc. Of course, there are other color transformation, image standardization, etc. Data enhancement methods, which are not listed one by one here.
[0130] Further, the first external expansion data and the second external expansion data are input into the first network model, and the feature generator in the first network model is used to generate first feature data corresponding to the first external expansion data and second feature data corresponding to the second external expansion data.
[0131] Further, according to the comparison loss value between the first feature data and the second feature data, the parameters corresponding to the feature generator in the first network model are adjusted. Specifically, the comparison loss value between a plurality of first feature parameters and second feature parameters is calculated, and the specific calculation formula is:
[0132]
[0133] In formula (3), L c is the comparison loss, G(X) is the first expansion data, is the second expansion data.
[0134] Further, it is judged whether the comparison loss value converges. When the comparison loss value tends to a certain specific value and reaches a balance state, it indicates that the comparison loss value converges. If the comparison loss value does not converge, the parameters corresponding to the feature generator in the first network model are adjusted until the comparison loss value converges.
[0135] Of course, in the embodiment of the present application, the image data without blurring processing and the second external expansion data can also be input into the first network model for training. The specific training method is the same as the above method, which is not repeated here.
[0136] By the above method, the feature generator is trained using the pre-data augmentation out-expansion data and the post-data augmentation out-expansion data, so that the feature similarity between the pre-data augmentation out-expansion data and the post-data augmentation out-expansion data meets the preset requirement, realizing the enhancement of the training data while maintaining the consistency of the training sample features, and further improving the robustness of the feature generator.
[0137] In one possible design, the total loss value is calculated according to the constraint function corresponding to formula (1), the constraint function corresponding to formula (2), and the constraint function corresponding to formula (3). If the total loss value converges during the training process, it indicates that the feature generator and the classifier are trained, and the first feature generator and the first classifier are obtained. If the total loss value does not converge, the parameters of the feature generator and the classifier are adjusted, and the training of the live body detection process is continued until the total loss value converges.
[0138] Further, in order to more specifically describe the live body detection method provided in the present application, the method provided in the present application is described in detail below through a specific application scenario.
[0139] Specifically, first, the training for live body detection mainly includes the training of the feature generator and the training of the classifier, and the specific training method is referred to Figure 3 In Figure 3 , first, single-frame pictures of multiple fields are obtained, wherein the single-frame pictures of each field include live body data and non-live body data. Then, the face data in all pictures is detected by a face detection operator, and then the first out-expansion data corresponding to the face data is obtained by preprocessing the face data. Then, the first out-expansion data is data augmented by a data expander to obtain second out-expansion data.
[0140] Next, the feature generator is trained using the first out-expansion data and the second out-expansion data. During the training process, in order to maintain the consistency between the features corresponding to the first out-expansion data and the features corresponding to the second out-expansion data, the training process of the feature generator is constrained by using the first loss function in the live body detection method as shown in Figure 1 .
[0141] At the same time, in order to improve the extraction ability of the feature generator to the significant features commonly corresponding to the non-live body data, the adversarial training process of the feature generator is constrained by using the second loss function in the live body detection method as shown in Figure 1 .
[0142] The above first loss function and second loss function are mainly used to constrain the training process of the feature generator. In order to improve the accuracy of the final live body detection, the training process of the classifier also needs to be constrained.
[0143] Specifically, after the feature generator extracts the feature data, the feature data is classified and trained using a classifier to obtain a classification result. In order to ensure the accuracy of the classification result, in the process of classification training, the training process of the feature generator is constrained by the third loss function in the living body detection method as shown in the formula (3). Figure 1
[0144] As can be seen from the above, in the process of living body detection training, the first loss function, the second loss function and the third loss function are mainly used to constrain the training process of the living body detection. The total loss function is shown in formula (4):
[0145] L=L ce +αL c +βL a (4)
[0146] In formula (4), α and β are weight parameters.
[0147] In the process of training, if the total loss value calculated according to formula (4) converges, it indicates that the training process of the living body detection has been completed.
[0148] Through the above method for living body detection training, not only can the feature similarity between the expanded data before the expansion and the expanded data after the expansion meet the requirements, but also the feature generator can improve the extraction ability of the significant features corresponding to the non-living body data, and the classifier can improve the accuracy of the feature data classification, thereby improving the accuracy of the subsequent living body detection stage.
[0149] Based on the same inventive concept, the embodiment of the present application also provides a living body detection device, as shown in Figure 3 The device includes:
[0150] The first input module 31 is configured to input living body data and non-living body data in at least one data domain into a first network model, wherein the living body data and the non-living body data at least include face data.
[0151] The acquisition module 32 is configured to acquire a living body detection result generated by a classifier in the first network model and a domain classification result generated by an adversarial network in the first network model.
[0152] The first update module 33 is configured to update parameters corresponding to the classifier according to the living body detection result, and update parameters corresponding to a feature generator in the first network model according to the living body detection result and / or the domain classification result.
[0153] The determining module 34 is configured to obtain a second network model according to the feature generator after the updating and the classifier after the updating, wherein the second network model is used for living body detection.
[0154] In a possible design, the first input module 31 is specifically configured to:
[0155] obtain the living body data and the non-living body data, wherein the living body data and the non-living body data include face image data and image data other than the face image data;
[0156] input the living body data and the non-living body data in at least one data field into the first network model.
[0157] In a possible design, the first updating module 33 is specifically configured to:
[0158] calculate a first loss value corresponding to a plurality of living body detection results, and detect whether the first loss value converges;
[0159] If not, adjust the parameters corresponding to the classifier until the first loss value converges.
[0160] In a possible design, the first updating module 33 is further configured to:
[0161] calculate a first loss value corresponding to a plurality of living body detection results;
[0162] adjust the parameters corresponding to the feature generator in the first network model when the first loss value does not converge, until the first loss value converges; and / or
[0163] calculate a second loss value corresponding to a plurality of domain classification results, wherein the second loss value indicates a constraint function loss value corresponding to the adversarial network;
[0164] adjust the parameters corresponding to the feature generator in the first network model when the second loss value does not converge, until the second loss value converges.
[0165] In a possible design, the apparatus further includes:
[0166] The detecting module is configured to input image data corresponding to the target face into the second network model when the target face is detected.
[0167] The determining module is configured to determine the classification of the image data by the feature generator and the classifier in the second network model, and determine whether the target face is a living body according to the classification result.
[0168] In a possible design, the determining module 34 is specifically configured to:
[0169] classifying the image data by the feature generator and the classifier in the second network model to obtain a classification result comprising a data category and a corresponding probability of the data category, wherein the data category comprises living body data and non-living body data;
[0170] determining whether the target face is a living body according to the classification result.
[0171] In a possible design of the apparatus, the apparatus further includes:
[0172] an expansion module, configured to acquire first expanded data and perform data expansion on the first expanded data to obtain second expanded data, wherein the first expanded data at least includes face image data and image data other than the face image data, and the preset data at least includes the face image data;
[0173] a second input module, configured to input the first expanded data and the second expanded data into the first network model;
[0174] a generation module, configured to generate first feature data corresponding to the first expanded data and second feature data corresponding to the second expanded data according to a feature generator in the first network model;
[0175] a second update module, configured to adjust parameters of the feature generator in the first network model according to a contrast loss value between the first feature data and the second feature data.
[0176] In a possible design of the apparatus, the expansion module is specifically configured to:
[0177] when the face image data is collected, expand the first detection frame to obtain a second detection frame, wherein the second detection frame includes the face image and image data other than the face image;
[0178] acquire all image data in the second detection frame, and perform blurring processing on preset data in the all image data to obtain the first expanded data, wherein the preset data at least includes the face image data.
[0179] In a possible design of the apparatus, the second update module is specifically configured to:
[0180] calculate a contrast loss value between a plurality of the first feature parameters and the second feature parameters;
[0181] determine whether the contrast loss value converges;
[0182] if not, adjust the parameters of the feature generator in the first network model until the contrast loss value converges.
[0183] In a possible design, the second network model comprises the updated feature generator, the updated classifier, and the adversarial network.
[0184] Based on the living body detection apparatus, the first network model is trained using living body data and non-living body data in different data domains, and the parameters corresponding to the first network model are adjusted using the domain classification results and the living body detection results corresponding to the different data domains, thereby reducing the influence of the different data domains on the accuracy of the living body detection results, and further improving the accuracy of the second network model in living body detection of a target face.
[0185] Based on the same inventive concept, an electronic device is further provided in the embodiments of the present application, which can realize the functions of the foregoing living body detection apparatus, and refer to Figure 4 , the electronic device comprises:
[0186] at least one processor 41 and a memory 42 connected with the at least one processor 41, and the specific connection medium between the processor 41 and the memory 42 is not limited in the embodiments of the present application, Figure 4 In the foregoing embodiments, the connection between the processor 41 and the memory 42 is taken as an example connected through a bus 40. The bus 40 is represented by a thick line in Figure 4 the foregoing embodiments, and the connection modes between other components are only schematically illustrated and are not limited. The bus 40 can be divided into an address bus, a data bus, a control bus and the like, and for the convenience of representation, Figure 4 In the foregoing embodiments, only one thick line is used to represent the bus 40, but it does not mean that there is only one bus or only one type of bus. Alternatively, the processor 41 can also be referred to as a controller, and the name is not limited.
[0187] In the embodiments of the present application, the memory 42 stores instructions executable by the at least one processor 41, and the at least one processor 41 can execute the living body detection method discussed above by executing the instructions stored in the memory 42. The processor 41 can realize the functions of various modules in the apparatus shown in Figure 2 .
[0188] The processor 41 is the control center of the apparatus, can connect all parts of the control device through various interfaces and lines, and can monitor the whole apparatus by running or executing the instructions stored in the memory 42 and calling the data stored in the memory 42, thereby processing data and realizing various functions of the apparatus.
[0189] In one possible design, the processor 41 can include one or more processing units, and the processor 41 can integrate an application processor and a modem processor, where the application processor mainly processes operating systems, user interfaces, and application programs, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 41. In some embodiments, the processor 41 and the memory 42 can be implemented on the same chip, and in some embodiments, they can also be implemented on separate chips respectively.
[0190] The processor 41 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic component, a discrete hardware component, and can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the living body detection method disclosed in the embodiments of the present application can be directly embodied by a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.
[0191] The memory 42 is a non-volatile computer readable storage medium, which can be used to store non-volatile software programs, non-volatile computer executable programs, and modules. The memory 42 can include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. The memory 42 is any other medium capable of carrying or storing desired program codes in the form of instructions or data structures and capable of being accessed by a computer, but is not limited to this. The memory 42 in the embodiments of the present application can also be a circuit or any other device capable of realizing a storage function, used for storing program instructions and / or data.
[0192] By designing and programming the processor 41, the codes corresponding to the living body detection method introduced in the above embodiments can be fixed into the chip, so that the chip can execute the codes when running Figure 1The steps of the living body detection method of the embodiment shown. How to design and program the processor 41 is known to those skilled in the art, and will not be repeated here.
[0193] Based on the same inventive concept, the embodiment of the present application also provides a storage medium, which stores computer instructions, and when the computer instructions run on a computer, the computer instructions make the computer execute the living body detection method discussed above.
[0194] In some possible implementation manners, various aspects of the living body detection method provided by the present application can also be implemented in the form of a program product, which includes program codes for causing the control device to execute the steps in the living body detection method according to various exemplary embodiments of the present application described above in the specification when the program product runs on the device.
[0195] Those skilled in the art should understand that the embodiments of the present application can be provided in the form of a method, a system, or a computer program product. Therefore, the present application can be in the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0196] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device implemented in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flow(s) or block(s).
[0197] These computer program instructions can also be stored in a computer-readable memory that can direct the computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction apparatus, which implements the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flow(s) or block(s).
[0198] These computer program instructions can also be loaded into a computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices to generate computer-implemented processes, thus the instructions executed on the computer or other programmable data processing devices provide processes for implementing the functions specified in the flowchart Figure 1 flowchart or multiple flows and / or blocks Figure 1 flowchart or multiple flows and / or blocks
[0199] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these modifications and variations.
Claims
1. A method for detecting liveness, characterized in that, The method includes: Live data and non-live data from at least one data domain are input into a first network model, wherein the live data and the non-live data include at least face data; Obtain the liveness detection results generated by the classifier in the first network model and the domain classification results generated by the adversarial network in the first network model; The parameters of the classifier are updated based on the liveness detection results. Update the parameters corresponding to the feature generator in the first network model based on the liveness detection results and the domain classification results; Based on the updated feature generator and the updated classifier, a second network model is obtained, which is used for liveness detection. The method further includes, before inputting live data and non-live data from at least one data domain into the first network model: Acquire first extended data and expand the first extended data to obtain second extended data, wherein the first extended data includes at least face image data and image data outside the range of the face image; Input the first external data and the second external data into the first network model; Based on the feature generator in the first network model, generate first feature data corresponding to the first extended data and second feature data corresponding to the second extended data; Based on the comparison loss value between the first feature data and the second feature data, adjust the parameters corresponding to the feature generator in the first network model.
2. The method as described in claim 1, characterized in that, The step of inputting live data and non-live data from at least one data domain into the first network model includes: The liveness data and the non-liveness data are acquired, wherein the liveness data and the non-liveness data include face image data and image data outside the range of face images; The live data and the non-live data from at least one data domain are input into the first network model.
3. The method as described in claim 1, characterized in that, The step of updating the parameters corresponding to the classifier based on the liveness detection result includes: Calculate the first loss value corresponding to multiple liveness detection results, and detect whether the first loss value converges; If not, adjust the parameters corresponding to the classifier until the first loss value converges.
4. The method as described in claim 1, characterized in that, The step of updating the parameters corresponding to the feature generator in the first network model based on the liveness detection result and the domain classification result includes: Calculate the first loss value corresponding to multiple liveness detection results; When the first loss value does not converge, adjust the parameters of the feature generator in the first network model until the first loss value converges. Calculate a second loss value corresponding to the multiple domain classification results, wherein the second loss value indicates the constraint function loss value corresponding to the adversarial network; When the second loss value does not converge, adjust the parameters corresponding to the feature generator in the first network model until the second loss value converges.
5. The method as described in claim 1, characterized in that, After obtaining the second network model, the following is also included: When a target face is detected, the image data corresponding to the target face is input into the second network model; The image data is classified using the feature generator and classifier in the second network model, and the target face is determined to be a live object based on the classification result.
6. The method as described in claim 5, characterized in that, The step of determining the classification of the image data through the feature generator and classifier in the second network model, and determining whether the target face is a live subject based on the classification result, includes: The image data is classified by the feature generator and classifier in the second network model to obtain a classification result containing data categories and the corresponding probabilities of the data categories, wherein the data categories include live data and non-live data; Based on the classification results, it is determined whether the target face is a live person.
7. The method as described in claim 1, characterized in that, The acquisition of the first external data includes: When collecting face image data, the first detection box is expanded to obtain a second detection box, wherein the second detection box includes the face image and the image outside the face image area; All image data within the second detection frame are acquired, and preset data in all image data are blurred to obtain the first extended data, wherein the preset data includes at least face image data.
8. The method as described in claim 1, characterized in that, The step of adjusting the parameters of the feature generator in the first network model based on the comparison loss value between the first feature data and the second feature data includes: Calculate the contrast loss values between multiple first feature data and second feature data; Determine whether the comparison loss value has converged; If not, adjust the parameters corresponding to the feature generator in the first network model until the contrast loss value converges.
9. The method as described in claim 1, characterized in that, The second network model includes a feature generator with updated parameters, a classifier with updated parameters, and an adversarial network with updated parameters.
10. A liveness detection device, characterized in that, The device includes: The first input module is used to input live data and non-live data from at least one data domain into the first network model, wherein the live data and the non-live data include at least face data. The acquisition module is used to acquire the liveness detection results generated by the classifier in the first network model and the domain classification results generated by the adversarial network in the first network model. The first update module is used to update the parameters corresponding to the classifier based on the liveness detection result; and to update the parameters corresponding to the feature generator in the first network model based on the liveness detection result and the domain classification result. The determination module is used to obtain a second network model based on the updated parameter feature generator and the updated parameter classifier, wherein the second network model is used for liveness detection; The device further includes: An expansion module is used to acquire first expanded data and expand the first expanded data to obtain second expanded data, wherein the first expanded data includes at least face image data and image data outside the range of the face image; The second input module is used to input the first extended data and the second extended data into the first network model; The generation module is used to generate first feature data corresponding to the first extended data and second feature data corresponding to the second extended data according to the feature generator in the first network model; The second update module is used to adjust the parameters of the feature generator in the first network model based on the comparison loss value between the first feature data and the second feature data.
11. The apparatus as claimed in claim 10, characterized in that, The device further includes: The detection module is used to input the image data corresponding to the target face into the second network model when a target face is detected; The determination module is used to determine the classification of the image data through the feature generator and classifier in the second network model, and to determine whether the target face is a live object based on the classification result.
12. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a computer program stored in the memory, implements the method steps of any one of claims 1-9.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method steps of any one of claims 1-9.
Citation Information
Patent Citations
Living body recognition method and device, storage medium, and computer equipment
CN107818313A
Living body detection method and device
CN112052759A