Method for training live body detection model, live body detection method and device
By constructing a new domain training set and decoupling domain-related and domain-independent features, the problem of insufficient applicability of the liveness detection model across different sensors is solved, achieving higher detection accuracy and cross-domain applicability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZKTECO CO LTD
- Filing Date
- 2023-03-28
- Publication Date
- 2026-07-21
AI Technical Summary
Existing liveness detection models suffer from insufficient cross-device applicability and versatility due to significant differences in the distribution of image features acquired by different sensors. They are unable to effectively distinguish between domain-related and domain-independent features, thus affecting detection accuracy and cross-domain applicability.
By constructing a new domain training set, whose corresponding domain-independent features are identical to the domain-independent features of each source domain training set, and using the new domain training set and each source domain training set to train the liveness detection model, the domain-related features and domain-independent features are decoupled, thereby improving feature similarity and detection accuracy.
The liveness detection model has been successfully applied to sensors in different devices, improving cross-domain versatility and applicability, avoiding classification confusion caused by domain-related features, and ensuring effective classification of live and prosthetic bodies.
Smart Images

Figure CN116403292B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a training method for a liveness detection model, a training device for a liveness detection model, a liveness detection method, a liveness detection device, a storage medium, and a computer device. Background Technology
[0002] With the development of computer technology, various identity verification methods and systems based on human body parts or facial organs have emerged, such as access control systems based on facial recognition technology, pupil recognition technology, or palm verification results. During verification, in order to identify spoofs such as photos, videos, and masks as accurately as possible and to defend against liveness detection attacks, existing technologies determine whether the object is alive or spoofed based on the object's physiological characteristics, i.e., they perform liveness detection.
[0003] Currently, liveness detection is generally achieved through neural network models. An original liveness detection model is trained using images acquired by a specific sensor as training data. This allows the trained liveness detection model to detect images acquired by the same sensor and determine whether the image records the physiological characteristics of a living object.
[0004] However, images acquired by different sensors exhibit significant differences in feature distribution. Consequently, the anti-spoofing performance of the same liveness detection model varies greatly depending on the sensor used. Therefore, the trained liveness detection model cannot be applied to different sensors. This demonstrates that existing technologies suffer from low algorithmic versatility. Summary of the Invention
[0005] The purpose of this application is to address at least one of the aforementioned technical deficiencies, particularly the low versatility of existing technologies.
[0006] Firstly, this application provides a method for training a liveness detection model, the method comprising:
[0007] Obtain a source domain training set from multiple source domains;
[0008] Based on each of the source domain training sets, a new domain training set is constructed; the domain-independent features corresponding to the new domain training set are partially the same as the domain-independent features corresponding to each of the source domain training sets.
[0009] The liveness detection model is trained using the new domain training set and each of the source domain training sets until the liveness detection model meets the training termination condition; wherein, the liveness detection model is used to decouple domain-related features and domain-independent features, and to perform liveness detection based on domain-independent features.
[0010] Secondly, embodiments of this application provide a liveness detection method, the method comprising:
[0011] Acquire the image to be detected;
[0012] The image to be detected is input into the liveness detection model, and the liveness detection result output by the liveness detection model is obtained; wherein, the liveness detection model is trained using the training method of the liveness detection model described in any of the above embodiments.
[0013] Thirdly, embodiments of this application provide a training apparatus for a liveness detection model, the apparatus comprising:
[0014] The first set acquisition module is used to acquire source domain training sets from multiple source domains;
[0015] The second set acquisition module is used to construct a new domain training set based on each of the source domain training sets; the domain-independent features corresponding to the new domain training set are partially the same as the domain-independent features corresponding to each of the source domain training sets.
[0016] The training module is used to train the liveness detection model using the new domain training set and each of the source domain training sets until the liveness detection model meets the training termination condition; wherein, the liveness detection model is used to decouple domain-related features and domain-independent features, and to perform liveness detection based on domain-independent features.
[0017] Fourthly, embodiments of this application provide a liveness detection device, the device comprising:
[0018] The image acquisition module is used to acquire the image to be detected.
[0019] The detection module inputs the image to be detected into the liveness detection model and obtains the liveness detection result output by the liveness detection model; wherein the liveness detection model is trained using the training method of the liveness detection model described in any of the above embodiments.
[0020] Fifthly, embodiments of this application provide a storage medium storing computer-readable instructions. When executed by one or more processors, the computer-readable instructions cause the one or more processors to perform the steps of the training method for the liveness detection model described in any of the above embodiments and / or perform the steps of the liveness detection method described in any of the above embodiments.
[0021] Sixthly, embodiments of this application provide a computer device, the computer device comprising: one or more processors, and a memory;
[0022] The memory stores computer-readable instructions, which, when executed by the one or more processors, perform the steps of the training method for the liveness detection model described in any of the above embodiments and / or perform the steps of the liveness detection method described in any of the above embodiments.
[0023] In the training method, training device, method, device, storage medium, and computer device of the liveness detection model disclosed in this application, the computer device can construct a new domain training set based on multiple source domain training sets, such that the domain-independent features corresponding to the new domain training set are partially identical to the domain-independent features corresponding to each source domain training set. This improves the feature similarity between the new domain training set and each source domain training set in terms of overall image features. By using a new domain training set and each source domain training set with high feature similarity for model training, the trained liveness detection model can more accurately distinguish between domain-related and domain-independent features in image features, thereby achieving accurate feature decoupling.
[0024] When performing inference detection on images in unknown domains, a well-trained liveness detection model can perform liveness detection based on accurately separated domain-independent features, thus avoiding classification confusion caused by domain-related features and achieving effective classification of liveness and fakeness in unknown domains. In this way, computer devices can obtain liveness detection models that can accurately classify liveness in images in unknown domains based on training sets from multiple source domains. This makes the liveness detection model applicable to different device sensors, thereby improving the cross-domain versatility, applicability, and practicality of the liveness detection model. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a flowchart illustrating the training method for a liveness detection model in one embodiment.
[0027] Figure 2 This is a flowchart illustrating the steps of constructing a new domain training set based on each source domain training set in one embodiment.
[0028] Figure 3 This is a flowchart illustrating the steps of generating a new domain training set based on the domain-independent features corresponding to the new domain and the domain-related features corresponding to each source domain training set, as shown in one embodiment.
[0029] Figure 4 This is a flowchart illustrating the steps of training a liveness detection model using a new domain training set and various source domain training sets in one embodiment until the liveness detection model meets the training termination conditions.
[0030] Figure 5 This is a schematic structural block diagram of a training device for a liveness detection model in one embodiment;
[0031] Figure 6 This is a schematic internal block diagram of a computer device in one embodiment. Detailed Implementation
[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0033] In this paper, a domain can be understood as a scene. Different domains refer to situations that can be divided into different scenes according to scene classification rules. For example, different domains can be camera scenes with different spectral ranges. For ease of description, this paper classifies domains based on the sensor used to acquire the images. Images acquired by the same sensor belong to the same domain, while images acquired by different sensors belong to different domains.
[0034] In one embodiment, the training method for the liveness detection model provided in this application can be applied to a computer device, which refers to a device with data processing capabilities, and may include, but is not limited to, various servers, smartphones, smart tablets, and various authentication systems (such as access control systems, attendance systems, etc.).
[0035] like Figure 1 As shown, the method of this application may specifically include the following steps:
[0036] S102: Obtain the source domain training set of multiple source domains;
[0037] S104: Construct a new domain training set based on each source domain training set; the domain-independent features corresponding to the new domain training set are partially the same as the domain-independent features corresponding to each source domain training set.
[0038] S106: The liveness detection model is trained using a new domain training set and various source domain training sets until the liveness detection model meets the training termination condition; wherein, the liveness detection model is used to decouple domain-related features and domain-independent features, and to perform liveness detection based on the domain-independent features.
[0039] This application can use the image acquisition sensor as the basis for dividing each source domain training set. Each source domain training set includes multiple training images acquired by the same image acquisition sensor. Different source domain training sets correspond to different image acquisition sensors. In other words, every two training images belonging to different source domain training sets are acquired by different image acquisition sensors.
[0040] It is understandable that each source domain training set can include both prosthetic images and live images. Prosthetic images refer to images obtained by capturing images of prosthetics such as photos, videos, and masks, while live images refer to images obtained by directly capturing images of body parts of a user with their authorization. In one example, there are P source domain training sets. In the formula, Let represent the image feature vector of the i-th training image in the k-th source domain. express The corresponding category label is used to indicate Whether it is a prosthetic image or a live image, its value can be 0 or 1. P is a positive integer greater than or equal to 2.
[0041] Specifically, each training image in each source domain training set can simultaneously include domain-dependent features and domain-independent features. Domain-dependent features refer to features related to the sensor imaging process, including but not limited to spectral range and noise features. Domain-independent features refer to features associated with the image content; in the field of liveness detection, domain-independent features can be, but are not limited to, facial features, palm features, and fingerprint features. For ease of description, this paper uses live palm detection as an example; it is understood that the method of this application can also be used in fields such as live face detection and live fingerprint detection.
[0042] For multiple source domains, since liveness images from different source domains are all acquired from real human body parts, they share similarities in domain-independent features but dissimilarities in domain-dependent features. Similarly, prosthetic images from different source domains share similarities in domain-independent features but dissimilarities in domain-dependent features. However, for the same source domain, since all training images in that domain are acquired using the same image acquisition sensor, liveness images and prosthetic images in that source domain are similar in domain-dependent features but dissimilar in domain-independent features.
[0043] After inputting a training image into a liveness detection model, the model acquires the corresponding image features, which include both domain-independent and domain-dependent features. However, domain-dependent features have a weak correlation with the image content, making them unsuitable for liveness classification and prone to causing classification confusion. Therefore, the liveness detection model needs to decouple distinct features from the image features to extract domain-dependent and domain-independent features from the complete image features, facilitating subsequent liveness detection based on the domain-independent features.
[0044] Therefore, the degree of decoupling between domain-dependent and domain-independent features directly affects the accuracy of liveness detection and determines the cross-domain detection performance of the liveness detection model. However, since the training sets of each source domain can be images of hands in different poses captured under different lighting conditions and / or backgrounds, the similarity of the training sets in terms of domain-independent features is not high enough, and the similarity in terms of domain-dependent features is also low. When training the liveness detection model using only multiple source domain training sets, the liveness detection model struggles to accurately separate domain-dependent and domain-independent features, leading to some domain-dependent features being classified as domain-independent features and / or some domain-independent features being classified as domain-dependent features. This reduces the accuracy of the liveness detection model for images in unknown domains and affects the cross-domain generality of the liveness detection model.
[0045] In this application, a computer device can construct a new domain training set based on each source domain training set, such that the domain-independent features corresponding to the new domain training set are partially identical to the domain-independent features corresponding to each source domain training set. In other words, when the number of source domains is 2, the domain-independent features corresponding to the new domain training set are partially identical to the domain-independent features corresponding to the first source domain training set, and also partially identical to the domain-independent features corresponding to the second source domain training set. In one example, the computer device can initially obtain the domain-independent features and domain-dependent features corresponding to each source domain training set, and weight the domain-independent features corresponding to each source domain training set, generating a new domain training set based on the weighting result. It is understood that the new domain training set may include at least one prosthetic image and at least one live image, the specific limitations of which are as described above and will not be repeated here.
[0046] Thus, the image features corresponding to the new domain training set and the image features corresponding to each source domain training set share some similarities, thereby improving the similarity of the new domain training set and each source domain training set in terms of overall image features. The computer equipment can use the new domain training set and each source domain training set to train the liveness detection model. Because the new domain training set and each source domain training set have high feature similarity, the liveness detection model can more accurately distinguish between domain-related and domain-independent features in image features, thereby achieving accurate feature decoupling.
[0047] When performing inference detection on images in unknown domains, a well-trained liveness detection model can perform liveness detection based on accurately separated domain-independent features, thus avoiding classification confusion caused by domain-related features and achieving effective classification of live and fake bodies in unknown domains. In this way, the liveness detection model can be applied to different device sensors, thereby improving its cross-domain versatility, applicability, and practicality.
[0048] In one embodiment, such as Figure 2 As shown, the steps for constructing a new domain training set based on the various source domain training sets include:
[0049] S202: The feature encoding layer of the initial model is trained using training sets from various source domains until the feature encoding layer of the initial model satisfies the first feature decoupling condition, and a liveness detection model is obtained; wherein, the feature encoding layer of the liveness detection model is used to extract the domain-related features and domain-independent features of the input image respectively;
[0050] S204: Input each source domain training set into the feature encoding layer of the liveness detection model to obtain the domain-related features and domain-independent features corresponding to each source domain training set output by the feature encoding layer;
[0051] S206: The domain-independent features corresponding to the training sets of each source domain are weighted and summed to obtain the domain-independent features corresponding to the new domain;
[0052] S208: Generate a new domain training set based on the domain-independent features corresponding to the new domain and the domain-related features corresponding to each source domain training set.
[0053] The liveness detection model may include a feature encoding layer. This feature encoding layer is used to encode the input image to obtain the image features corresponding to the input image, and to separate domain-related features and domain-independent features from the image features.
[0054] Specifically, the computer device can train the feature encoding layer of the initial model using training sets from various source domains until the feature encoding layer of the initial model satisfies the first feature decoupling condition and can initially separate domain-related features and domain-independent features from image features. Under the condition of satisfying the first feature decoupling condition, the computer device can obtain a liveness detection model, and the feature encoding layer of the liveness detection model can achieve preliminary feature decoupling.
[0055] The computer device can input each source domain training set into a feature encoding layer that satisfies the first feature decoupling condition. This feature encoding layer performs preliminary feature decoupling on the image features corresponding to each source domain training set, obtaining domain-related and domain-independent features for each set. When obtaining the domain-independent features for each source domain training set, the computer device can perform a weighted summation of these features. The summation result is the domain-independent feature for the new domain. In other words, when there are two source domain training sets, the computer device needs to perform a weighted summation of the domain-independent features corresponding to the first and second source domain training sets to obtain the domain-independent feature for the new domain. This ensures that the domain-independent feature for the new domain is partially identical to the domain-independent feature for each source domain training set.
[0056] After obtaining the domain-independent features corresponding to the new domain, the computer device can generate each training image corresponding to the new domain based on the domain-independent features corresponding to the new domain and the domain-related features corresponding to each source domain training set. This results in the domain-independent features corresponding to the new domain training set being partially the same as the domain-independent features corresponding to each source domain training set, and the new domain training set and each source domain training set having a high degree of similarity in overall image features.
[0057] In this embodiment, on the one hand, the feature encoding layer of the model is trained based on the training sets of each source domain and the first feature decoupling condition, enabling it to initially separate the domain-related features and domain-independent features of each source domain training set. This reduces the training time during subsequent execution of S106 and improves the training efficiency of the liveness detection model. On the other hand, by weighted summing of the domain-independent features corresponding to each source domain training set, domain-independent features corresponding to the new domain are obtained. A new domain training set is then generated based on these new domain-independent features. This maximizes the feature similarity between the new domain training set and each source domain training set, thereby further improving the accuracy of feature decoupling and enhancing cross-domain generality.
[0058] In one embodiment, the domain-independent features corresponding to each source domain training set include liveness features extracted from liveness images in the source domain training set and prosthetic features extracted from prosthetic images in the source domain training set. In other words, the liveness features corresponding to each source domain training set refer to the domain-independent features extracted from the liveness images contained in each source domain training set, and the prosthetic features corresponding to each source domain training set refer to the domain-independent features extracted from the prosthetic images contained in each source domain training set.
[0059] The steps of weighted summation of the domain-independent features corresponding to each source domain training set to obtain the domain-independent features corresponding to the new domain include:
[0060] Based on the liveness feature weights corresponding to each source domain training set, the liveness features corresponding to each source domain training set are weighted and summed to obtain the liveness features corresponding to the new domain.
[0061] Based on the prosthetic feature weights corresponding to each source domain training set, the prosthetic features corresponding to each source domain training set are weighted and summed to obtain the prosthetic features corresponding to the new domain.
[0062] Specifically, the liveness feature weights and spoofing feature weights corresponding to each source domain training set can be predetermined or adjusted based on actual conditions. In one example, the weights of each liveness feature and spoofing feature are adjustable, and their specific values can be determined based on experimental results.
[0063] Considering that live images and prosthetic images corresponding to the same domain are similar in domain-related features but dissimilar in domain-independent features, to ensure the accuracy of the domain-independent features corresponding to the new domain and avoid adverse effects on subsequent training due to the confusion of live and prosthetic features in calculation, in this application, the computer device can separately calculate the new domain live features (i.e., the live features corresponding to the new domain) used to generate the new domain live image and the new domain prosthetic features (i.e., the prosthetic features corresponding to the new domain) used to generate the new domain prosthetic image. When generating the domain-independent features corresponding to the new domain, the computer device can weightedly combine the internal live features of each source domain according to the weights of each live feature to obtain the new domain live features. Similarly, the computer device can weightedly combine the internal prosthetic features of each source domain according to the weights of each prosthetic feature to obtain the new domain prosthetic features. In this way, the computer device can subsequently generate live images in the new domain training set based on the live features corresponding to the new domain and the domain-related features corresponding to each source domain training set, and generate spoof images in the new domain training set based on the spoof features corresponding to the new domain and the domain-related features corresponding to each source domain training set.
[0064] In one embodiment, such as Figure 3 As shown, the steps for generating a new domain training set based on the domain-independent features corresponding to the new domain and the domain-related features corresponding to each source domain training set include:
[0065] S302: Compress the domain-related features corresponding to each source domain training set into the same feature space to obtain compressed features;
[0066] S304: Combine the liveness features corresponding to the new domain with the compressed features to obtain the liveness image features of the new domain, and decode the liveness image features of the new domain to obtain the liveness images in the training set of the new domain.
[0067] S306: Combine the prosthesis features corresponding to the new domain with the compressed features to obtain the prosthesis image features of the new domain, and decode the prosthesis image features of the new domain to obtain the prosthesis images in the training set of the new domain.
[0068] Specifically, when acquiring the domain-related features corresponding to each source domain training set output by the feature encoder, the computer device can compress these domain-related features into the same feature space, so that the compressed features simultaneously include the domain-related features corresponding to each source domain training set. The computer device can then combine the liveness features corresponding to the new domain with the compressed features to obtain new domain liveness image features. These new domain liveness image features are the complete image features of the new domain liveness image; by decoding the new domain liveness image, the new domain liveness image can be obtained. Similarly, the computer device can combine the spoof features corresponding to the new domain with the compressed features to obtain new domain spoof image features. These new domain spoof image features are the complete image features of the new domain spoof image; by decoding the new domain spoof image, the new domain spoof image can be obtained.
[0069] Given new domain live images and new domain prosthesis images, the computer device can obtain a new domain training set that includes both the new domain live images and the new domain prosthesis images.
[0070] In this embodiment, the domain-related features corresponding to each source domain training set are compressed, and a new domain training set is obtained based on the compressed features and the domain-independent features corresponding to the new domain. Thus, the domain-related features corresponding to the new domain have a certain similarity to the domain-related features corresponding to each source domain training set, so that the liveness detection model can more accurately distinguish between domain-related features and domain-independent features in image features, and further improve the accuracy of feature decoupling.
[0071] In one embodiment, the feature encoding layer of the initial model includes a domain-independent feature extraction network and multiple domain-related classifiers for extracting domain-related features, with each domain-related classifier corresponding one-to-one with each source domain. That is, each source domain corresponds to a domain-related classifier, and the domain-related classifiers corresponding to different source domains are different. Furthermore, when training the liveness detection model using a new domain training set, the domain-related classifier corresponding to the new domain training set is different from the domain-related classifiers corresponding to each source domain.
[0072] Domain-independent feature extraction networks are networks used to extract domain-independent features. The first feature decoupling condition may include a first training objective and a second training objective.
[0073] The steps of training the feature encoding layer of the initial model using training sets from various source domains until the feature encoding layer of the initial model satisfies the first feature decoupling condition and obtaining the liveness detection model include:
[0074] Based on the training sets of each source domain, train the parameter weights of the domain-independent feature extraction network until the first training objective is met;
[0075] For each domain-related classifier, the source domain training set of the target source domain is input into the domain-related classifier to obtain the first classification result output by the domain-related classifier, and the source domain training set of the non-target source domain is input into the domain-related classifier to obtain the second classification result output by the domain-related classifier. The intra-domain classification loss is calculated based on the first classification result, and the inter-domain classification loss is calculated based on the second classification result. The parameter weights of the domain-related classifier are trained with the goal of minimizing the intra-domain classification loss and maximizing the inter-domain classification loss. The target source domain is the source domain corresponding to the domain-related classifier, and the non-target source domain is the other source domains besides the target source domain.
[0076] Specifically, the computer device can train a domain-related classifier for each domain (including the source domain and the new domain). For each domain-related classifier, it needs to have accurate classification performance for images in that domain, but its classification performance for images in other domains needs to have significant uncertainty, meaning it cannot accurately detect the liveness type in images from other domains. When the aforementioned requirements are met, the domain-related classifier can be used to extract domain-related features.
[0077] For each domain-related classifier, the computer device can train it based on the same principles and steps to ensure that each domain-related classifier meets the aforementioned requirements. The training set D is based on the S-th source domain. s For example, D S The corresponding domain-related classifier is Ψ S Computer equipment can D s Each training image is input into Ψ S In, and according to Ψ S Regarding D S The first classification result is used to calculate the in-domain classification loss. Computer equipment can be used to remove D s Each training image from other source domain training sets is input into Ψ s In, and according to Ψ S For the second classification results output from other source domain training sets, calculate the inter-domain classification loss. Computer devices can minimize in-domain classification loss. And maximizing inter-domain classification loss As the training objective for the domain-related classifier, train Ψ S The parameter weights, up to Ψ S This satisfies the training objective of the domain correlation classifier. The training process for other domain correlation classifiers can be found in Ψ. sThe training process will not be described in detail here.
[0078] In one embodiment, the in-domain classification loss Inter-domain classification loss Both can be calculated using the cross-entropy loss function. Furthermore, computer devices can use the principle of minimizing empirical risk to separately calculate the intra-domain classification loss and the inter-domain classification loss, thereby evaluating the algorithm's performance in real-world scenarios.
[0079] In this embodiment, by using minimizing the intra-domain classification loss and maximizing the inter-domain classification loss as the second training objective, the parameter weights of each domain-related classifier are trained respectively, so that the trained domain-related classifiers can be used to extract the domain-related features of each domain.
[0080] In one embodiment, prior to the training step of each domain-related classifier, the following is also included:
[0081] Obtain shallow parameters of the teacher network;
[0082] The shallow parameters of the teacher network are used as the shallow parameters of each domain-related classifier, and the shallow parameters of each domain-related classifier are frozen.
[0083] Specifically, for each domain-related classifier, the features learned by its shallow parameters are shallow feature representations, which cannot be used to effectively extract domain-related or domain-independent features. Therefore, the computer can directly use the shallow parameters of the teacher network as the shallow parameters of each domain-related classifier and freeze them. During the training of the domain-related classifier, the computer does not need to train the shallow parameters of the classifier, thereby improving the training speed of the domain-related classifier and thus improving the training speed of the liveness detection model. At the same time, since the shallow parameters used to learn shallow feature representations are frozen for training, it will not affect the training of intermediate or deep parameters, ensuring that the domain-related classifier can learn deep feature representations.
[0084] In one embodiment, the step of training the parameter weights of a domain-independent feature extraction network based on each source domain training set until a first training objective is met includes:
[0085] For each source domain, the source domain training set is input into the domain-independent feature extraction network to obtain the N-dimensional feature values corresponding to that source domain; where N is a positive integer.
[0086] The average value of each N-dimensional feature corresponding to each source domain is calculated separately to obtain the average value of the N-dimensional features corresponding to each source domain;
[0087] Calculate the distribution difference loss value between the training sets of each source domain based on the average value of the N-dimensional features corresponding to each source domain;
[0088] The primary training objective is to minimize the distribution difference loss value, and the parameter weights of the domain-independent feature extraction network are trained accordingly.
[0089] Since the differences in data distribution between different source domains are mainly caused by domain-related features, minimizing the feature distance between different domains can highlight the similar features of targets in different domains, thereby enabling the learning of domain-independent features.
[0090] Specifically, the domain-independent feature extraction network can use the same mapping function to map each training image to a high-dimensional feature space Φ, obtaining N-dimensional feature values for each training image, where N is a positive integer. The computer device can calculate the expected value of each source domain training set after mapping, and calculate the pairwise differences between each expected value to determine the distribution difference loss value between each source domain. In one embodiment, the distribution difference loss value can be determined based on the following expression:
[0091]
[0092] In the formula, Let P be the distribution difference loss value, P be the total number of source domains, f() be the mapping function used to map the training image to a high-dimensional feature space, and D be the distribution difference loss value. i For the i-th source domain training set, P i D i The total number of training images, x k Let y be the image feature corresponding to the k-th training image in the i-th source domain training set. k For x k The corresponding type label, D j For the j-th source domain training set, P j D j The total number of training images, x s Let y be the image feature corresponding to the s-th training image in the j-th source domain training set. s For x s The corresponding type tag.
[0093] To minimize the feature distance between different domains, it is necessary to minimize the distribution difference loss value so that the domain-independent feature extraction network can effectively learn similar features between different domains, that is, learn domain-independent features. Therefore, the computer device can use minimizing the distribution difference loss value as the primary training objective to train the parameter weights of the domain-independent feature extraction network (for example, by adjusting the dimension of the high-dimensional feature space) until the domain-independent feature extraction network satisfies the primary training objective.
[0094] In this embodiment, the domain-independent feature extraction network is trained by using the minimization of the distribution difference loss value as the first training objective, so that the trained domain-independent feature extraction network can be used to extract domain-independent features of each domain.
[0095] In one embodiment, the domain-independent features corresponding to each domain training data include live features extracted from live images of the domain training data and prosthetic features extracted from prosthetic images of the domain training data. For further explanation of live features and prosthetic features, please refer to the above embodiments; no specific limitations are imposed herein.
[0096] like Figure 4 As shown, the steps for training the liveness detection model using the new domain training set and each source domain training set until the liveness detection model meets the training termination conditions include:
[0097] S402: Fix the parameter weights of the feature encoding layer of the liveness detection model, whereby the feature encoding layer of the liveness detection model is used to extract domain-related features and domain-independent features of the input image, respectively;
[0098] S404: Input the new domain training set and the training sets of each source domain into the feature encoding layer of the liveness detection model to obtain the domain-related features, liveness features and spur features corresponding to each domain training data respectively;
[0099] S406: Input the domain-related features and liveness features corresponding to the training data of each domain into the first domain discriminator of the liveness detection model to obtain the first discrimination result output by the first domain discriminator;
[0100] S408: Input the domain-related features and spoof features corresponding to the training data of each domain into the second domain discriminator of the liveness detection model to obtain the second discrimination result output by the second domain discriminator;
[0101] S410: Calculate the adversarial loss value based on the first and second discrimination results, and use maximizing the adversarial loss value as the third training objective to train the parameter weights of the first domain discriminator and the parameter weights of the second domain discriminator.
[0102] S412: Based on the trained first-domain discriminator and the trained second-domain discriminator, backpropagate training is performed on the feature encoding layer of the liveness detection model until the training termination condition is met.
[0103] For details regarding the feature encoding layer of the liveness detection model, please refer to the above embodiments; they will not be repeated here. The first domain discriminator is used to determine the domain to which the liveness image belongs, and the second domain discriminator is used to determine the domain to which the spurious image belongs.
[0104] Specifically, after obtaining the new domain training set, the computer device can fix the parameter weights of the feature coding layer in the liveness detection model, and input each training image of the new domain training set and each training image of each source domain training set into the liveness detection model, so as to train the first domain discriminator and the second domain discriminator through the new domain training set and each source domain training set.
[0105] Specifically, after inputting the new domain training set and the training sets of each source domain into the liveness detection model, the feature encoding layer of the liveness detection model encodes features for each domain and separates domain-independent features and domain-dependent features from the encoded image features. Among them, the domain-independent features corresponding to each domain can include liveness features extracted from the liveness image of that domain and prosthetic features extracted from the prosthetic image of that domain.
[0106] The output of the feature encoding layer can be used as input to the first and second domain discriminators. The input to the first domain discriminator can be domain-related features and liveness features, used to determine the domain to which the training image belongs based on these features and output a first discrimination result. The input to the second domain discriminator can be domain-related features and spoofing features, used to determine the domain to which the training image belongs based on these features and output a second discrimination result. The computer can calculate the adversarial loss between the first and second domain discriminators based on the first and second discrimination results, and adjust the parameter weights of the first and second domain discriminators with maximizing the adversarial loss as the third training objective. When the first and second domain discriminators satisfy the third training objective, training of the first and second domain discriminators is considered complete. In this case, the parameter weights of the first and second domain discriminators can be fixed, and backpropagation training of the feature encoding layer of the liveness detection model can be performed until the training termination condition is met.
[0107] Since the domain discriminator can be used to determine the domain to which a training image belongs based on domain-related and domain-independent features, the feature decoupling of the feature decoding layer can be adjusted according to the discrimination results of the first and second domain discriminators. This allows the feature decoding layer to more accurately separate domain-related and domain-independent features. For example, when the parameter weights of the domain discriminator are fixed, the first feature, which was originally a domain-related feature, can be classified as a domain-independent feature. The updated domain-related features are then input into the corresponding domain discriminators. When the domain discriminator can accurately determine the domain to which it belongs, it indicates that the first feature is a domain-independent feature (i.e., a domain-independent feature). When the domain discriminator cannot accurately determine the domain to which it belongs, it indicates that the first feature is a domain-related feature.
[0108] In one example, the adversarial loss value can be calculated based on the following expression:
[0109]
[0110] In the formula, This refers to the risk-adversarial loss value; E represents the empirical risk minimization principle; D P Let P be the training sets of source domains; It refers to the image feature vector of the i-th training image in the k-th source domain; It means The corresponding type tag, when When corresponding to live images The value is 1, when When corresponding to the prosthesis image The value is 0; D L (A) refers to the output of the first domain discriminator when feature A is input; D F (A) refers to the output of the second domain discriminator when feature A is input to the second domain discriminator; It refers to the image features corresponding to image B output by the feature encoder after image B is input into the feature encoder. Specifically, it can include domain-independent features and domain-related features. It refers to the i-th training image in the k-th source domain training set, and this training image is a live image; For based on The generated new domain liveness image; It refers to the i-th training image in the k-th source domain training set, and this training image is a prosthetic image; Based on The generated new domain prosthesis image.
[0111] In this embodiment, the first domain discriminator and the second domain discriminator are trained using the source domain training sets and the new domain training sets. The trained first domain discriminator and the second domain discriminator are then used to backpropagate the feature encoding layer. This allows the feature encoding layer to more accurately separate domain-related features from domain-independent features, thereby further improving the cross-domain versatility of the trained liveness detection model.
[0112] In one embodiment, the step of training the parameter weights of the first domain discriminator and the parameter weights of the second domain discriminator includes:
[0113] In the (M+1)th iteration of training, the learning rate for the (M+1)th iteration is determined based on the adversarial loss value in the Mth iteration, and the parameter weights of the first domain discriminator and the second domain discriminator are adjusted based on the learning rate in the (M+1)th iteration; where M is a positive integer, and the learning rate in the (M+1)th iteration is positively correlated with the adversarial loss value in the Mth iteration.
[0114] Specifically, in the liveness detection process, domain-related features have a negative effect on cross-domain liveness detection. Therefore, to improve the generalization ability of the liveness detection model for cross-domain anti-spoofing, the model can weaken or remove the learning of domain-related features as much as possible, and effectively and accurately extract domain-independent features for liveness detection under data from different domains. Since domain-independent features are not affected by the image acquisition sensor, strengthening the learning of domain-independent features can effectively improve the anti-spoofing generalization ability of the liveness detection model for cross-domain detection.
[0115] During the training of the first and second domain discriminators, the computer can determine the learning rate for the current round based on the adversarial loss value from the previous round. A higher adversarial loss value from the previous round indicates a greater ability to learn domain-independent features, thus the learning rate is increased to strengthen the learning of these features. Conversely, a lower adversarial loss value indicates a greater ability to learn domain-related features, thus the learning rate is decreased to weaken the learning of these features. In this way, by weakening the learning of domain-related features and strengthening the learning of domain-independent features, the generalization ability of the liveness detection model for cross-domain anti-spoofing can be further improved.
[0116] In one embodiment, the liveness detection model may further include a type label predictor, which predicts the liveness type of the input image based on domain-independent features output by the feature coding layer. The computer device may train the type label predictor using a new domain training set and various source domain training sets until it meets the corresponding termination conditions.
[0117] In one embodiment, this application also provides a liveness detection method, which may include the following steps:
[0118] Acquire the image to be detected;
[0119] The image to be detected is input into the liveness detection model, and the liveness detection result output by the liveness detection model is obtained; wherein, the liveness detection model is trained using the training method of the liveness detection model described in any of the above embodiments.
[0120] In one embodiment, for liveness detection in an unknown domain, the liveness detection model can extract domain-independent features corresponding to the image in the unknown domain, calculate the Euclidean distance between the feature centers of the domain-independent features corresponding to the image in the unknown domain and the trained feature centers, and determine the type label of the image in the unknown domain based on the Euclidean distance. In this way, liveness classification can be effectively performed on images in the unknown domain.
[0121] The training apparatus for the liveness detection model provided in the embodiments of this application will be described below. The training apparatus for the liveness detection model described below can be referred to in correspondence with the training method for the liveness detection model described above.
[0122] In one embodiment, this application provides a training device 500 for a liveness detection model. For example... Figure 5 As shown, the training device 500 for the liveness detection model may include a first set acquisition module 510, a second set acquisition module 520, and a training module 530, wherein:
[0123] The first set acquisition module 510 is used to acquire source domain training sets of multiple source domains;
[0124] The second set acquisition module 520 is used to construct a new domain training set based on each of the source domain training sets; the domain-independent features corresponding to the new domain training set are partially the same as the domain-independent features corresponding to each of the source domain training sets.
[0125] The training module 530 is used to train the liveness detection model using the new domain training set and each of the source domain training sets until the liveness detection model meets the training termination condition; wherein, the liveness detection model is used to decouple domain-related features and domain-independent features, and to perform liveness detection based on domain-independent features.
[0126] In one embodiment, the second set acquisition module 520 may include a first encoding layer training unit, a first feature acquisition unit, a domain-independent feature acquisition unit, and a new domain generation unit. The first encoding layer training unit trains the feature encoding layer of an initial model using each of the source domain training sets until the feature encoding layer of the initial model satisfies a first feature decoupling condition, thus obtaining the liveness detection model. The feature encoding layer of the liveness detection model extracts domain-related features and domain-independent features from the input image. The first feature acquisition unit inputs each of the source domain training sets into the feature encoding layer of the liveness detection model to obtain the domain-related features and domain-independent features corresponding to each source domain training set output by the feature encoding layer. The domain-independent feature acquisition unit performs a weighted sum of the domain-independent features corresponding to each of the source domain training sets to obtain the domain-independent features corresponding to the new domain. The new domain generation unit generates a new domain training set based on the domain-independent features corresponding to the new domain and the domain-related features corresponding to each of the source domain training sets.
[0127] In one embodiment, the domain-independent features corresponding to each source domain training set include live features extracted from live images of the source domain training set and prosthetic features extracted from prosthetic images of the source domain training set.
[0128] The domain-independent feature acquisition unit includes a liveness feature acquisition unit and a spoofing feature acquisition unit. The liveness feature acquisition unit is used to perform a weighted summation of the liveness features corresponding to each of the source domain training sets based on the liveness feature weights corresponding to each source domain training set, to obtain the liveness features corresponding to the new domain. The spoofing feature acquisition unit is used to perform a weighted summation of the spoofing features corresponding to each of the source domain training sets based on the spoofing feature weights corresponding to each source domain training set, to obtain the spoofing features corresponding to the new domain.
[0129] In one embodiment, the new domain generation unit may include a compression unit, a new domain liveness image generation unit, and a new domain prosthetic image generation unit. The compression unit compresses the domain-related features corresponding to each of the source domain training sets into the same feature space to obtain compressed features. The new domain liveness image generation unit combines the liveness features corresponding to the new domain with the compressed features to obtain new domain liveness image features, and decodes the new domain liveness image features to obtain liveness images in the new domain training set. The new domain prosthetic image generation unit combines the prosthetic features corresponding to the new domain with the compressed features to obtain new domain prosthetic image features, and decodes the new domain prosthetic image features to obtain prosthetic images in the new domain training set.
[0130] In one embodiment, the feature encoding layer of the initial model includes a domain-independent feature extraction network and multiple domain-related classifiers for extracting domain-related features, each of the domain-related classifiers corresponding one-to-one with each of the source domains, and the first feature decoupling condition includes a first training objective and a second training objective.
[0131] The first encoding layer training unit of this application may include a first training unit and a second training unit. The first training unit is used to train the parameter weights of the domain-independent feature extraction network based on each of the source domain training sets until the first training objective is met. The second training unit is used to, for each of the domain-related classifiers, input the source domain training set of the target source domain into the domain-related classifier and obtain the first classification result output by the domain-related classifier, and input the source domain training set of non-target source domains into the domain-related classifier and obtain the second classification result output by the domain-related classifier. Based on the first classification result, an intra-domain classification loss is calculated; based on the second classification result, an inter-domain classification loss is calculated; and the second training objective is to minimize the intra-domain classification loss and maximize the inter-domain classification loss. The parameter weights of the domain-related classifier are then trained, wherein the target source domain is the source domain corresponding to the domain-related classifier, and the non-target source domains are the other source domains besides the target source domain.
[0132] In one embodiment, the feature encoding layer of the initial model may further include a teacher network acquisition unit and a freezing unit. The teacher network acquisition unit acquires the shallow parameters of the teacher network. The freezing unit uses the shallow parameters of the teacher network as the shallow parameters of each domain-related classifier and freezes the shallow parameters of each domain-related classifier.
[0133] In one embodiment, the first training unit may include a mapping unit, an averaging unit, a distribution difference loss calculation unit, and a first parameter weight training unit. The mapping unit is used to input the source domain training set of each source domain into the domain-independent feature extraction network to obtain N-dimensional feature values corresponding to that source domain; where N is a positive integer. The averaging unit is used to average the N-dimensional feature values corresponding to each source domain to obtain the average N-dimensional feature value for each source domain. The distribution difference loss calculation unit is used to calculate the distribution difference loss value between the training sets of each source domain based on the average N-dimensional feature value corresponding to each source domain. The first parameter weight training unit is used to train the parameter weights of the domain-independent feature extraction network with minimizing the distribution difference loss value as the first training objective.
[0134] In one embodiment, the domain-independent features corresponding to each domain training data include live features extracted from live images of the domain training data and prosthetic features extracted from prosthetic images of the domain training data.
[0135] The training module 530 may include a first weight fixing unit, a second feature acquisition unit, a first discrimination result acquisition unit, a second discrimination result acquisition unit, a domain discriminator training unit, and a second encoding layer training unit. The first weight fixing unit is used to fix the parameter weights of the feature encoding layer of the liveness detection model, wherein the feature encoding layer of the liveness detection model is used to extract domain-related features and domain-independent features of the input image, respectively. The second feature acquisition unit is used to input the new domain training set and each of the source domain training sets into the feature encoding layer of the liveness detection model to obtain the domain-related features, liveness features, and spurious features corresponding to each domain training data, respectively. The first discrimination result acquisition unit is used to input the domain-related features and liveness features corresponding to each domain training data into the first domain discriminator of the liveness detection model to obtain the first discrimination result output by the first domain discriminator. The second discrimination result acquisition unit is used to input the domain-related features and spurious features corresponding to each domain training data into the second domain discriminator of the liveness detection model to obtain the second discrimination result output by the second domain discriminator. The domain discriminator training unit is used to calculate the adversarial loss value based on the first and second discrimination results, and to train the parameter weights of the first and second domain discriminators with maximizing the adversarial loss value as the third training objective. The second encoding layer training unit is used to perform backpropagation training on the feature encoding layer of the liveness detection model based on the trained first and second domain discriminators until the training termination condition is met.
[0136] In one embodiment, the domain discriminator training unit includes a learning rate adjustment unit. This learning rate adjustment unit is used, during the (M+1)th iteration of training, to determine the learning rate for the (M+1)th iteration based on the adversarial loss value from the (M)th iteration, and to adjust the parameter weights of the first domain discriminator and the second domain discriminator based on the learning rate from the (M+1)th iteration; wherein M is a positive integer, and the learning rate for the (M+1)th iteration is positively correlated with the adversarial loss value from the (M)th iteration.
[0137] The following describes the liveness detection device provided in the embodiments of this application. The liveness detection device described below can be referred to in correspondence with the liveness detection method described above.
[0138] In one embodiment, this application provides a liveness detection device, which includes an image acquisition module and a detection module. Wherein:
[0139] The image acquisition module is used to acquire the image to be detected.
[0140] The detection module is used to input the image to be detected into the liveness detection model and obtain the liveness detection result output by the liveness detection model; wherein the liveness detection model is trained using the training method of the liveness detection model described in any of the above embodiments.
[0141] In one embodiment, this application also provides a storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the training method for the liveness detection model in any of the above embodiments and / or perform the steps of the liveness detection method in any of the above embodiments.
[0142] In one embodiment, this application also provides a computer device storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the training method of the liveness detection model in any of the above embodiments and / or perform the steps of the liveness detection method in any of the above embodiments.
[0143] Indicatively, Figure 6 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. In one example, the computer device can be a server. (Refer to...) Figure 6 The computer device 900 includes a processing component 902, which further includes one or more processors, and memory resources represented by memory 901 for storing instructions, such as application programs, that can be executed by the processing component 902. The application programs stored in memory 901 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 902 is configured to execute instructions to perform the steps of the methods described in any of the above embodiments.
[0144] The computer device 900 may also include a power supply component 903 configured to perform power management of the computer device 900, a wired or wireless network interface 904 configured to connect the computer device 900 to a network, and an input / output (I / O) interface 905. The computer device 900 may operate on an operating system stored in memory 901, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.
[0145] Those skilled in the art will understand that the internal structure of the computer device shown in this application is merely a block diagram of a portion of the structure related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0146] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. In this document, "a," "an," "the," "the," and "its" may also include plural forms unless the context clearly indicates otherwise. "Multiple" refers to at least two, such as 2, 3, 5, or 8, etc. "And / or" includes any and all combinations of the related listed items.
[0147] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.
[0148] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A training method for a liveness detection model, characterized in that, The method includes: Obtain a source domain training set from multiple source domains; Based on each of the source domain training sets, construct a new domain training set; The liveness detection model is trained using the new domain training set and each of the source domain training sets until the liveness detection model meets the training termination condition; wherein, the liveness detection model is used to decouple domain-related features and domain-independent features, and to perform liveness detection based on domain-independent features; The step of constructing a new domain training set based on each of the source domain training sets includes: The feature encoding layer of the initial model is trained using each of the aforementioned source domain training sets until the feature encoding layer of the initial model satisfies the first feature decoupling condition, and the liveness detection model is obtained; wherein, the feature encoding layer of the liveness detection model is used to extract domain-related features and domain-independent features of the input image respectively; Each of the source domain training sets is input into the feature encoding layer of the liveness detection model to obtain the domain-related features and domain-independent features corresponding to each of the source domain training sets output by the feature encoding layer; The domain-independent features corresponding to each of the source domain training sets are weighted and summed to obtain the domain-independent features corresponding to the new domain. A new domain training set is generated based on the domain-independent features corresponding to the new domain and the domain-related features corresponding to each source domain training set. The feature encoding layer of the initial model includes a domain-independent feature extraction network and multiple domain-related classifiers for extracting domain-related features. Each domain-related classifier corresponds one-to-one with each of the source domains. The first feature decoupling condition includes a first training objective and a second training objective. The step of training the feature encoding layer of the initial model using each of the source domain training sets until the feature encoding layer of the initial model satisfies the first feature decoupling condition, and obtaining the liveness detection model, includes: Based on each of the source domain training sets, train the parameter weights of the domain-independent feature extraction network until the first training objective is met; For each domain-related classifier, the source domain training set of the target source domain is input into the domain-related classifier and a first classification result output by the domain-related classifier is obtained. The source domain training set of non-target source domains is input into the domain-related classifier and a second classification result output by the domain-related classifier is obtained. Based on the first classification result, the intra-domain classification loss is calculated, and based on the second classification result, the inter-domain classification loss is calculated. The second training objective is to minimize the intra-domain classification loss and maximize the inter-domain classification loss. The parameter weights of the domain-related classifier are then trained. The target source domain is the source domain corresponding to the domain-related classifier, and the non-target source domains are the other source domains besides the target source domain.
2. The method according to claim 1, characterized in that, The domain-independent features corresponding to each source domain training set include live features extracted from live images in the source domain training set, and prosthetic features extracted from prosthetic images in the source domain training set. The step of weighted summing of the domain-independent features corresponding to each of the source domain training sets to obtain the domain-independent features corresponding to the new domain includes: Based on the live feature weights corresponding to each source domain training set, the live features corresponding to each source domain training set are weighted and summed to obtain the live features corresponding to the new domain. Based on the prosthetic feature weights corresponding to each source domain training set, the prosthetic features corresponding to each source domain training set are weighted and summed to obtain the prosthetic features corresponding to the new domain.
3. The method according to claim 2, characterized in that, The step of generating a new domain training set based on the domain-independent features corresponding to the new domain and the domain-dependent features corresponding to each of the source domain training sets includes: The domain-related features corresponding to each of the source domain training sets are compressed into the same feature space to obtain compressed features; The liveness features corresponding to the new domain are combined with the compressed features to obtain liveness image features of the new domain, and the liveness image features of the new domain are decoded to obtain liveness images in the training set of the new domain. The prosthesis features corresponding to the new domain are combined with the compressed features to obtain new domain prosthesis image features, and the new domain prosthesis image features are decoded to obtain prosthesis images in the new domain training set.
4. The method according to claim 1, characterized in that, Before the training step of each of the domain-related classifiers, the following is also included: Obtain shallow parameters of the teacher network; The shallow parameters of the teacher network are used as the shallow parameters of each domain-related classifier, and the shallow parameters of each domain-related classifier are frozen.
5. The method according to claim 1 or 4, characterized in that, The step of training the parameter weights of the domain-independent feature extraction network based on each of the source domain training sets until the first training objective is met includes: For each source domain, the source domain training set is input into the domain-independent feature extraction network to obtain the N-dimensional feature values corresponding to the source domain; where N is a positive integer. The average value of each N-dimensional feature corresponding to each source domain is calculated to obtain the average value of the N-dimensional features corresponding to each source domain. Calculate the distribution difference loss value between the training sets of each source domain based on the average value of the N-dimensional features corresponding to each source domain; The parameter weights of the domain-independent feature extraction network are trained with minimizing the distribution difference loss value as the first training objective.
6. The method according to any one of claims 1 to 4, characterized in that, Each domain-independent feature corresponding to the training data of that domain includes the live features extracted from the live images of the training data of that domain, and the prosthesis features extracted from the prosthesis images of the training data of that domain. The step of training the liveness detection model using the new domain training set and each of the source domain training sets until the liveness detection model meets the training termination condition includes: The parameter weights of the feature encoding layer of the liveness detection model are fixed, wherein the feature encoding layer of the liveness detection model is used to extract domain-related features and domain-independent features of the input image, respectively; The new domain training set and each of the source domain training sets are input into the feature encoding layer of the liveness detection model to obtain the domain-related features, liveness features and spur features corresponding to each domain training data respectively. The domain-related features and liveness features corresponding to the training data of each domain are input into the first domain discriminator of the liveness detection model to obtain the first discrimination result output by the first domain discriminator. The domain-related features and spur features corresponding to the training data of each domain are input into the second domain discriminator of the liveness detection model to obtain the second discrimination result output by the second domain discriminator; The adversarial loss value is calculated based on the first discrimination result and the second discrimination result, and the parameter weights of the first domain discriminator and the parameter weights of the second domain discriminator are trained with maximizing the adversarial loss value as the third training objective. Based on the trained first-domain discriminator and the trained second-domain discriminator, the feature encoding layer of the liveness detection model is backpropagated until the training termination condition is met.
7. The method according to claim 6, characterized in that, The steps of training the parameter weights of the first domain discriminator and the parameter weights of the second domain discriminator include: In the (M+1)th round of iterative training, the learning rate for the (M+1)th round is determined based on the adversarial loss value in the Mth round, and the parameter weights of the first domain discriminator and the second domain discriminator are adjusted based on the learning rate of the (M+1)th round; where M is a positive integer, and the learning rate in the (M+1)th round is positively correlated with the adversarial loss value in the Mth round.
8. A method for detecting liveness, characterized in that, The method includes: Acquire the image to be detected; The image to be detected is input into the liveness detection model, and the liveness detection result output by the liveness detection model is obtained; wherein the liveness detection model is trained using the training method of the liveness detection model as described in any one of claims 1 to 7.
9. A training device for a liveness detection model, characterized in that, The device includes: The first set acquisition module is used to acquire source domain training sets from multiple source domains; The second set acquisition module is used to construct a new domain training set based on each of the source domain training sets; The training module is used to train the liveness detection model using the new domain training set and each of the source domain training sets until the liveness detection model meets the training termination condition; wherein, the liveness detection model is used to decouple domain-related features and domain-independent features, and to perform liveness detection based on domain-independent features; The second set acquisition module includes a first encoding layer training unit, a first feature acquisition unit, a domain-independent feature acquisition unit, and a new domain generation unit. The first encoding layer training unit trains the feature encoding layer of an initial model using each of the source domain training sets until the feature encoding layer of the initial model satisfies a first feature decoupling condition, thus obtaining the liveness detection model. The feature encoding layer of the liveness detection model extracts domain-related features and domain-independent features from the input image. The first feature acquisition unit inputs each of the source domain training sets into the feature encoding layer of the liveness detection model to obtain domain-related features and domain-independent features corresponding to each source domain training set output by the feature encoding layer. The domain-independent feature acquisition unit performs a weighted sum of the domain-independent features corresponding to each of the source domain training sets to obtain the domain-independent features corresponding to the new domain. The new domain generation unit generates a new domain training set based on the domain-independent features corresponding to the new domain and the domain-related features corresponding to each of the source domain training sets. The feature encoding layer of the initial model includes a domain-independent feature extraction network and multiple domain-related classifiers for extracting domain-related features. Each domain-related classifier corresponds one-to-one with each of the source domains. The first feature decoupling condition includes a first training objective and a second training objective. The first encoding layer training unit includes a first training unit and a second training unit; wherein, the first training unit is used to train the parameter weights of the domain-independent feature extraction network according to each of the source domain training sets until the first training objective is met; the second training unit is used to, for each of the domain-related classifiers, input the source domain training set of the target source domain into the domain-related classifier and obtain the first classification result output by the domain-related classifier, and input the source domain training set of the non-target source domain into the domain-related classifier and obtain the second classification result output by the domain-related classifier, calculate the intra-domain classification loss based on the first classification result, calculate the inter-domain classification loss based on the second classification result, and use minimizing the intra-domain classification loss and maximizing the inter-domain classification loss as the second training objective to train the parameter weights of the domain-related classifier, wherein, the target source domain is the source domain corresponding to the domain-related classifier, and the non-target source domain is the other source domains besides the target source domain.
10. A liveness detection device, characterized in that, The device includes: The image acquisition module is used to acquire the image to be detected. The detection module is used to input the image to be detected into the liveness detection model and obtain the liveness detection result output by the liveness detection model; wherein the liveness detection model is trained using the training method of the liveness detection model as described in any one of claims 1 to 7.
11. A storage medium, characterized in that, The storage medium stores computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the training method for the liveness detection model as claimed in any one of claims 1 to 7 and / or the steps of the liveness detection method as claimed in claim 8.
12. A computer device, characterized in that, include: One or more processors, and memory; The memory stores computer-readable instructions that, when executed by the one or more processors, perform the steps of the training method for the liveness detection model as described in any one of claims 1 to 7 and / or the steps of the liveness detection method as described in claim 8.