A method, device, storage medium and electronic device for training a living body detection model
By using timing models and cross-domain adaptation models in face recognition, combined with timing relationships and cross-domain adaptation technology, the problem of attenuation of live attacks and cross-domain detection performance is solved, and the accuracy and stability of live detection are improved.
Patent Information
- Application Number
- CN202211743671.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2042-12-28
AI Technical Summary
The prior art has evasion behavior of living attacks in facial recognition, and the live detection performance deteriorates seriously during cross-domain detection.
By obtaining sample feature information of the training sample set, input the timing model to determine the timing relationship between samples, calculate the timing loss function to train the timing model, and input the sample feature vectors to the cross-domain adaptation model for cross-domain adaptation, and calculate the cross-domain adaptation loss function to train the cross-domain adaptation model.
It improves the prediction accuracy of cross-domain live detection, reduces the performance attenuation during cross-domain detection, and enhances the defense ability of live attacks.
Smart Images

Figure CN116259115B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for training a liveness detection model. Background Art
[0002] Nowadays, face recognition has a wide range of applications in all aspects of daily life, such as providing convenience in identity authentication. However, in the process of face recognition, there are behaviors that try to circumvent face recognition by using methods such as photos and masks. Such behaviors are liveness attacks. Summary of the invention
[0003] The present application provides a liveness detection model training method, device, storage medium and electronic device, which can reduce the performance degradation caused by cross-domain detection based on temporal relationship fusion features, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection.
[0004] In a first aspect, an embodiment of the present application provides a method for training a liveness detection model, the method comprising:
[0005] Acquire sample feature information corresponding to a training sample set, wherein the training sample set is an image data set containing a human portrait;
[0006] Inputting the sample feature information into the time series model to determine the time series relationship between the training samples in the training sample set, and obtaining a sample feature vector corresponding to the sample feature information based on the time series relationship;
[0007] Calculating a timing loss function corresponding to the timing model, and determining a first training state of the timing model based on the timing loss function, until the first training state indicates that the timing model has converged, thereby obtaining a trained timing model;
[0008] Inputting the sample feature vector into the cross-domain adaptation model, obtaining the sample adaptation feature vector after the sample feature vector is adapted and the prediction result of the liveness detection, and obtaining the adaptation time sequence relationship and migration characteristics between each of the sample adaptation feature vectors based on the sample adaptation feature vector, wherein the migration characteristics are used to indicate the feature ratio retained before and after the sample feature vector is adapted;
[0009] A cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated, and a second training state of the cross-domain adaptation model is determined based on the cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation model converges, thereby obtaining a trained cross-domain adaptation model.
[0010] In a second aspect, an embodiment of the present application provides a living body detection method, the method comprising:
[0011] Acquire an image data set sent by a terminal device, perform feature extraction on the image data set, and acquire feature information corresponding to the image data set, wherein the image data set is an image data set including a portrait;
[0012] Inputting the feature information into the trained time series model obtained by the above-mentioned liveness detection model training method, and outputting a feature vector corresponding to the feature information;
[0013] Inputting the feature vector into the cross-domain adaptation model trained by the above-mentioned liveness detection model training method, and outputting the prediction result corresponding to the feature vector, wherein the prediction result is used to indicate whether the human image in the image data set is a live body;
[0014] The prediction result is sent to the terminal device so that the terminal device displays the prediction result.
[0015] In a third aspect, an embodiment of the present application provides a living body detection model training device, comprising:
[0016] An information acquisition unit, used to acquire sample feature information corresponding to a training sample set, wherein the training sample set is an image data set containing a human portrait;
[0017] A time series vector acquisition unit, configured to input the sample feature information into the time series model to determine the time series relationship between the training samples in the training sample set, and acquire a sample feature vector corresponding to the sample feature information based on the time series relationship;
[0018] A timing model completion unit, configured to calculate a timing loss function corresponding to the timing model, determine a first training state of the timing model based on the timing loss function, until the first training state indicates that the timing model has converged, and obtain a training completed timing model;
[0019] A cross-domain model training unit, used to input the sample feature vector into the cross-domain adaptation model, obtain the sample adaptation feature vector after the sample feature vector is adapted and the prediction result of the liveness detection, and obtain the adaptation time sequence relationship and migration characteristics between each of the sample adaptation feature vectors based on the sample adaptation feature vector, wherein the migration characteristics are used to indicate the feature ratio retained before and after the sample feature vector is adapted;
[0020] A cross-domain model completion unit is used to calculate a cross-domain adaptation loss function corresponding to the cross-domain adaptation model, and determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation model converges, thereby obtaining a trained cross-domain adaptation model.
[0021] In a fourth aspect, an embodiment of the present application provides a living body detection model training device, including:
[0022] a feature acquisition unit, configured to acquire an image data set sent by a terminal device, perform feature extraction on the image data set, and acquire feature information corresponding to the image data set, wherein the image data set is an image data set containing a portrait;
[0023] A vector output unit, used to input the feature information into the trained time series model obtained by the above-mentioned liveness detection model training method, and output a feature vector corresponding to the feature information;
[0024] A result output unit, used to input the feature vector into the cross-domain adaptation model trained by the above-mentioned liveness detection model training method, and output a prediction result corresponding to the feature vector, wherein the prediction result is used to indicate whether the human image in the image data set is a live body;
[0025] The result sending unit is used to send the prediction result to the terminal device so that the terminal device displays the prediction result.
[0026] In a fifth aspect, an embodiment of the present specification provides a computer program product, wherein the computer program product stores at least one instruction, and the at least one instruction is suitable for being loaded by a processor and executing the above-mentioned method steps.
[0027] In a sixth aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the steps of the above-mentioned method.
[0028] In a seventh aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the above method.
[0029] In an embodiment of the present application, by obtaining sample feature information corresponding to a training sample set, the sample feature information is input into a timing model to obtain a timing relationship and a sample feature vector corresponding to the training sample set, and then the loss function of the timing model is calculated. The first training state of the timing model is determined based on the timing loss function until the first training state indicates that the timing model converges to obtain a trained timing model, and then the sample feature vector is input into a cross-domain adaptation model to obtain an adapted sample adaptation feature vector and a prediction result of liveness detection. Based on the sample adaptation feature vector, the corresponding adaptation timing relationship and migration feature are obtained, and the cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine a second training state of the cross-domain adaptation model until the second training state indicates that the cross-domain adaptation model converges to obtain a trained cross-domain adaptation model, so as to facilitate liveness detection after cross-domain adaptation based on the timing relationship of the training samples, thereby reducing the performance degradation caused by cross-domain detection based on the timing relationship fusion feature, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0031] Figure 1 A system architecture diagram of a liveness detection model training method provided in an embodiment of the present application;
[0032] Figure 2 A flowchart of a method for training a liveness detection model provided in an embodiment of the present application;
[0033] Figure 3 A flow chart of a body detection model training method provided in an embodiment of the present application;
[0034] Figure 4 A schematic diagram of a flow chart of a body detection method provided in an embodiment of the present application;
[0035] Figure 5 An example schematic diagram of displaying a liveness detection result provided in an embodiment of the present application;
[0036] Figure 6 A schematic diagram of the structure of a liveness detection model training device provided in an embodiment of the present application;
[0037] Figure 7 A schematic diagram of the structure of an information acquisition unit provided in an embodiment of the present application;
[0038] Figure 8 A schematic diagram of the structure of a timing vector acquisition unit provided in an embodiment of the present application;
[0039] Fig. 9 A schematic diagram of the structure of a timing model completion unit provided in an embodiment of the present application;
[0040] Fig.10 A schematic diagram of the structure of a cross-domain model training unit provided in an embodiment of the present application;
[0041] Fig.11 A schematic diagram of the structure of a cross-domain model completion unit provided in an embodiment of the present application;
[0042] Fig.12 A schematic diagram of the structure of a living body detection device provided in an embodiment of the present application;
[0043] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0044] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the features and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0046] In the prior art, in order to prevent liveness attacks, different methods are used to perform liveness recognition in images to determine whether the person in the image is alive. However, when actually performing liveness recognition, there are problems such as poor performance, low recognition rate or low applicability. In addition, when performing cross-domain detection, there is a situation where the liveness detection performance is seriously degraded.
[0047] Based on this, an embodiment of the present application provides a method for training a liveness detection model. By using the embodiment of the present application, sample feature information corresponding to a training sample set is obtained, and the sample feature information is input into a timing model to obtain a timing relationship and a sample feature vector corresponding to the training sample set, and then the loss function of the timing model is calculated. The first training state of the timing model is determined based on the timing loss function, until the first training state indicates that the timing model converges to obtain a trained timing model, and then the sample feature vector is input into a cross-domain adaptation model to obtain an adapted sample adaptation feature vector and a prediction result of liveness detection. The corresponding adaptation timing relationship and migration feature are obtained based on the sample adaptation feature vector, and the cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine the second training state of the cross-domain adaptation model until the second training state indicates that the cross-domain adaptation model converges to obtain a trained cross-domain adaptation model, so as to facilitate liveness detection after cross-domain adaptation according to the timing relationship of the training samples, thereby reducing the performance degradation caused by cross-domain detection based on the timing relationship fusion feature, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection.
[0048] See also Figure 1 , which is a system structure diagram for training a liveness detection model according to an embodiment of the present application. Figure 1 As shown, the liveness detection model training method provided in the embodiment of the present application can be applied to the terminal to realize the process of training the liveness detection model for the terminal application in the terminal. The system structure provided in the embodiment of the present application mainly includes a liveness detection model training server 10 and a training sample acquisition device 20. Among them, the liveness detection model training server 10 can be a large integrated server used by an enterprise, or a microcomputer, such as a personal computer; the training sample acquisition device 20 can be a device equipped with a camera capable of collecting image data, such as a camera on a door access control, or a smart phone equipped with a camera.
[0049] In an embodiment of the present application, the liveness detection model training server 10 obtains the training sample set sent by the training sample acquisition device 20, extracts sample feature information from the training sample set, inputs the sample feature information into the timing model, obtains the timing relationship and sample feature vector corresponding to the training sample set, and calculates the timing loss function of the timing model to determine the trained timing model according to the timing loss function, inputs the sample feature vector into the cross-domain adaptation model to obtain the adapted sample feature vector and the prediction result of the liveness detection, and calculates the cross-domain adaptation loss function of the cross-domain adaptation model, and determines the trained cross-domain adaptation model based on the cross-domain adaptation loss function.
[0050] In an embodiment of the present application, by obtaining sample feature information corresponding to a training sample set, the sample feature information is input into a timing model to obtain a timing relationship and a sample feature vector corresponding to the training sample set, and then the loss function of the timing model is calculated. The first training state of the timing model is determined based on the timing loss function until the first training state indicates that the timing model converges to obtain a trained timing model, and then the sample feature vector is input into a cross-domain adaptation model to obtain an adapted sample adaptation feature vector and a prediction result of liveness detection. Based on the sample adaptation feature vector, the corresponding adaptation timing relationship and migration feature are obtained, and the cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine a second training state of the cross-domain adaptation model until the second training state indicates that the cross-domain adaptation model converges to obtain a trained cross-domain adaptation model, so as to facilitate liveness detection after cross-domain adaptation based on the timing relationship of the training samples, thereby reducing the performance degradation caused by cross-domain based on the timing relationship fusion feature, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection.
[0051] based on Figure 1 The system architecture shown below will be combined with Figure 2 , the liveness detection model training method provided in the embodiment of the present application is introduced in detail.
[0052] See also Figure 2 , which is a flow chart of a method for training a liveness detection model according to an embodiment of the present application. Figure 2 As shown, the method may include the following steps S102 to S110.
[0053] S102, obtaining sample feature information corresponding to the training sample set;
[0054] In one embodiment, a training sample set sent by a training sample acquisition device is obtained, and sample feature information is extracted from images in the training sample set to obtain sample feature information corresponding to the training sample set.
[0055] Furthermore, the training sample set may be an image data set containing human portraits. To ensure the accuracy of liveness detection based on the training sample set, the image data of the image data set are arranged in chronological order. For example, image data collected over a period of time may be collected as the training sample set.
[0056] Furthermore, the sample feature information may be optical flow information, key point information, and feature maps, so as to facilitate subsequent liveness detection of the training sample set based on the sample feature information. The optical flow information may be used to indicate the motion change of the entire picture in the image data; the key point information may be used to indicate the motion change of the portrait in the image data; and the feature map may be used to extract the feature vector of the image data.
[0057] Furthermore, the method for extracting sample feature information can be to use a pre-trained model for extraction, such as using a FlowNet model to extract optical flow information, using an openpose model to extract key point information, and using a SwimTransformer model to extract a feature map of an image. It should be noted that the feature information extraction model can be replaced according to actual conditions.
[0058] S104, inputting the sample feature information into the time series model to determine the time series relationship between the training samples in the training sample set, and obtaining a sample feature vector corresponding to the sample feature information based on the time series relationship;
[0059] In one embodiment, after obtaining the sample feature information of the training sample set, the sample feature information is input into the timing model to obtain a single-frame feature vector corresponding to each frame of sample image data in the sequence sample set, and then the timing relationship between the sample image data of each frame is further calculated, and a multi-frame feature vector corresponding to the training sample set is obtained based on the timing relationship and the single-frame feature vector.
[0060] Furthermore, the timing model may include three modules, namely a single-frame feature fusion module, a timing relationship modeling module and a multi-frame feature fusion module. The sample feature information of a frame of image data is input into the single-frame feature fusion module to obtain the single-frame feature vector of the frame image data. After obtaining the single-frame feature vectors corresponding to each frame of image data, each single-frame feature vector is input into the timing relationship modeling module to obtain the timing relationship matrix between the feature vectors of each frame. The timing relationship matrix and the single-frame feature vector are then input into the multi-frame feature fusion module to obtain the multi-frame feature vector corresponding to the training sample set.
[0061] It should be noted that the single-frame feature fusion module not only fuses the feature information, but also performs liveness detection on the frame image data; the multi-frame feature vector obtained based on the multi-frame feature fusion module is a feature vector corresponding to the training sample set.
[0062] S106, calculating a timing loss function corresponding to the timing model, and determining a first training state of the timing model based on the timing loss function, until the first training state indicates that the timing model has converged, thereby obtaining a trained timing model;
[0063] In one embodiment, after obtaining the single-frame feature vector of each frame training sample in the training sample set and the temporal relationship between each single-frame feature vector, the single-frame detection loss function corresponding to the single-frame feature vector and the single-frame temporal relationship loss function corresponding to each single-frame feature vector are calculated, and then the temporal loss function corresponding to the temporal model is obtained according to the single-frame detection loss function and the single-frame temporal relationship loss function. After obtaining the pre-stored preset temporal loss function, the first training state of the temporal model is determined based on the preset temporal loss function and the temporal loss function, until the first training state indicates that the temporal model converges, and a trained temporal model is obtained. It should be noted that single-frame feature vectors and multi-frame feature vectors are collectively referred to as sample feature vectors.
[0064] Furthermore, the method for obtaining the timing loss function can be: calculating the timing model to obtain the single-frame detection loss function corresponding to each living body detection, and the single-frame timing relationship loss function corresponding to the similarity between the feature vectors of each single frame, adding the single-frame detection loss functions and taking the average to obtain the detection loss function corresponding to the timing model, adding the timing relationship losses of each single frame to obtain the timing relationship loss function corresponding to the timing model, and adding the detection loss function and the timing relationship loss function to obtain the timing loss function corresponding to the timing model.
[0065] Furthermore, the single-frame detection loss function may be a corresponding loss function calculated in the process of performing liveness detection on each single-frame training sample; the temporal relationship loss function may be a corresponding loss function calculated in the process of obtaining the temporal relationship between each single-frame training sample.
[0066] Furthermore, the first training state can be a parameter used to indicate whether the timing model converges. The first training state is determined by comparing a preset timing loss function with the timing loss function. If the timing loss function is less than or equal to the preset timing loss function, it can be considered that the first training state indicates that the timing model converges.
[0067] Furthermore, if the first training state indicates that the timing model has not converged, the step of "inputting the sample feature information into the timing model to determine the timing relationship between the training samples in the training sample set, and obtaining the sample feature vector corresponding to the sample feature information based on the timing relationship" is executed again, and the timing loss function corresponding to the timing model is calculated again, and the first training state of the timing model is determined based on the timing loss function, until the first training state indicates that the timing model has converged, and a trained timing model is obtained.
[0068] S108, inputting the sample feature vector into the cross-domain adaptation model, obtaining the sample adaptation feature vector after the sample feature vector is adapted and the prediction result of the liveness detection, and obtaining the adaptation time sequence relationship and migration characteristics between the sample adaptation feature vectors based on the sample adaptation feature vector, wherein the migration characteristics are used to indicate the feature ratio retained before and after the sample feature vector is adapted;
[0069] In one embodiment, after obtaining the sample feature vector based on the training sample and the timing model, the sample feature vector is input into the cross-domain adaptation model to perform cross-domain adaptation on the sample feature vector, and the sample adaptation feature vector after the sample feature vector is adapted is obtained, as well as the prediction result of the adapted liveness detection. Based on the single-frame adaptation feature vector corresponding to each single-frame feature vector in the sample adaptation feature vector, the adaptation timing relationship and migration feature vector between each single-frame adaptation feature vector are obtained.
[0070] Furthermore, cross-domain adaptation can be performed for different scenarios to improve the accuracy of liveness detection for the training sample set. For example, the detection scenario corresponding to the time series model is detection using a door access camera during the day, while the detection scenario corresponding to the training sample set is image data obtained by the door access camera at night. In order to ensure the accuracy of liveness detection, it is necessary to adjust the parameters of the image data for liveness detection under dark light conditions at night.
[0071] Furthermore, the sample feature vector may include a single-frame feature vector and a multi-frame feature vector. After the sample feature vector is input into the cross-domain adaptation model, a single-frame adaptation feature vector corresponding to the single-frame feature vector and a multi-frame adaptation feature vector corresponding to the multi-frame feature vector are obtained.
[0072] Furthermore, a method for obtaining the prediction result of the adapted liveness detection may be to perform liveness detection based on the multi-frame adapted feature vectors, and use the prediction result of the liveness detection as the prediction result corresponding to the adapted training sample set. Another feasible method is to perform liveness detection based on each single-frame adapted feature vector, and obtain the prediction result corresponding to the training sample set based on the detection result of the liveness detection.
[0073] Furthermore, a feasible method for acquiring the adaptation timing relationship may be to calculate the approximation between the adaptation feature vectors of each single frame after cross-domain, and obtain the adaptation timing relationship between the adaptation feature vectors of each single frame based on the approximation calculation result.
[0074] Furthermore, a feasible method for calculating similarity may be to calculate the similarity of adjacent single-frame adaptation feature vectors, construct an adaptation timing matrix corresponding to the adapted adaptation feature vector based on the obtained similarities corresponding to each adjacent single-frame adaptation feature vector, and determine the adaptation timing relationship between each single-frame adaptation feature vector based on the adaptation timing matrix.
[0075] Furthermore, a feasible method for obtaining migration features is to compare the single-frame feature vector before cross-domain with the single-frame adaptation feature vector after cross-domain, calculate the feature ratio retained by each single-frame adaptation feature vector before and after adaptation, and use the feature ratio as the migration feature corresponding to each single-frame adaptation feature vector.
[0076] S110, calculating a cross-domain adaptation loss function corresponding to the cross-domain adaptation model, and determining a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation model has converged, thereby obtaining a trained cross-domain adaptation model;
[0077] In one embodiment, in order to obtain a trained cross-domain adaptation model, a cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation model converges, thereby determining that a trained cross-domain adaptation model is obtained.
[0078] Furthermore, a method for obtaining a cross-domain adaptation loss function can be to calculate a cross-domain adaptation model to obtain a prediction loss function corresponding to a prediction result, an adaptation timing loss function corresponding to an adaptation timing relationship, and a migration loss function corresponding to a migration feature, add the prediction loss function, the adaptation timing loss function, and the migration loss function to obtain a cross-domain adaptation loss function corresponding to the cross-domain adaptation model, obtain a pre-stored preset cross-domain adaptation loss function, and determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function and the preset cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation loss function converges, thereby obtaining a trained cross-domain adaptation model.
[0079] Furthermore, the method for obtaining the prediction loss function, the adaptation timing loss function and the migration loss function can be: calculating the prediction loss function corresponding to the prediction result of the cross-domain adaptation model; calculating the single-frame adaptation timing loss function corresponding to the adaptation timing relationship between each single-frame adaptation feature vector, adding and averaging the single-frame adaptation timing loss functions, and obtaining the adaptation timing loss function corresponding to the cross-domain adaptation model; calculating the single-frame migration loss function corresponding to the migration feature of each single-frame adaptation feature vector, adding and averaging the single-frame migration loss functions, and obtaining the migration loss function corresponding to the cross-domain adaptation model.
[0080] Furthermore, the second training state can be a parameter used to indicate whether the cross-domain adaptation model converges. The second training state is determined by comparing a preset cross-domain adaptation loss function with the cross-domain adaptation loss function. If the preset cross-domain adaptation loss function is greater than the cross-domain adaptation loss function, it can be considered that the second training state indicates that the cross-domain adaptation model converges.
[0081] Furthermore, if the second training state indicates that the cross-domain adaptation model has not converged, the step of "inputting the sample feature vector into the cross-domain adaptation model, obtaining the sample adaptation feature vector after adaptation of the sample feature vector and the prediction result of the liveness detection, and obtaining the adaptation timing relationship and migration characteristics between each of the sample adaptation feature vectors based on the sample adaptation feature vector" is executed again, and the cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated again, and the second training state is determined based on the cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation model converges, and a trained cross-domain adaptation model is obtained.
[0082] It should be noted that during the training process of the time series model and the cross-domain adaptation model, it is not necessary for the time series model to converge. The cross-domain time series model can only be trained after the trained time series model is obtained. A feasible method is to obtain the sample feature vector corresponding to the sample feature information corresponding to the training sample set, input the sample feature vector into the cross-domain adaptation model for training, and after obtaining the prediction results and sample adaptation feature vectors corresponding to the cross-domain adaptation model, as well as the adaptation time series relationship and migration characteristics, respectively calculate the loss functions of the time series model and the cross-domain adaptation model, and determine whether the model training is completed based on each loss function.
[0083] In an embodiment of the present application, by obtaining sample feature information corresponding to a training sample set, the sample feature information is input into a timing model to obtain a timing relationship and a sample feature vector corresponding to the training sample set, and then the loss function of the timing model is calculated. The first training state of the timing model is determined based on the timing loss function until the first training state indicates that the timing model converges to obtain a trained timing model, and then the sample feature vector is input into a cross-domain adaptation model to obtain an adapted sample adaptation feature vector and a prediction result of liveness detection. Based on the sample adaptation feature vector, the corresponding adaptation timing relationship and migration feature are obtained, and the cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine a second training state of the cross-domain adaptation model until the second training state indicates that the cross-domain adaptation model converges to obtain a trained cross-domain adaptation model, so as to facilitate liveness detection after cross-domain adaptation according to the timing relationship of the training samples, thereby reducing the performance degradation caused by cross-domain detection based on the timing relationship fusion feature, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection.
[0084] See also Figure 3, which is a flow chart of a method for training a liveness detection model according to an embodiment of the present application. Figure 3 As shown, the method may include the following steps S202-S220.
[0085] S202, obtaining a training sample set;
[0086] In one embodiment, a training sample set sent by a training sample collection device is obtained.
[0087] Furthermore, the training sample set may be an image data set containing a human portrait. In order to ensure the accuracy of liveness detection based on the training sample set, the image data of the image data set are arranged in chronological order. For example, the image data set collected over a period of time may be collected as the training sample set. S204, extracting features from the training samples in the training sample set based on a pre-trained feature extraction model to obtain sample feature information corresponding to the training samples;
[0088] In one embodiment, after the training sample set is acquired, sample feature information is extracted from the images in the training sample set based on a pre-trained adjustment extraction model to acquire sample feature information corresponding to the training sample set.
[0089] Furthermore, the sample feature information may be optical flow information, key point information, and feature maps, so as to facilitate subsequent liveness detection of the training sample set based on the sample feature information. The optical flow information may be used to indicate the motion change of the entire picture in the image data; the key point information may be used to indicate the motion change of the portrait in the image data; and the feature map may be used to extract the feature vector of the image data.
[0090] Furthermore, the method for extracting sample feature information can be to use a pre-trained model for extraction, such as using a FlowNet model to extract optical flow information, using an openpose model to extract key point information, and using a SwimTransformer model to extract a feature map of an image. It should be noted that the feature information extraction model can be replaced according to actual conditions.
[0091] S206, inputting the sample feature information into the time series model, performing fusion calculation on the sample feature information corresponding to each training sample in the training sample set, obtaining a single-frame feature vector corresponding to each training sample, and obtaining a single-frame liveness detection result corresponding to each training sample based on each single-frame feature vector;
[0092] In one embodiment, the sample feature information extracted from the training sample set is input into the time series model, and the sample feature information corresponding to each training sample in the training sample set is fused and calculated to obtain the single-frame feature vector corresponding to each training sample. Then, liveness detection is performed on the single-frame image data based on the single-frame feature vector to obtain the single-frame liveness detection result corresponding to each training sample.
[0093] Furthermore, the time series model may include a single-frame feature fusion module. After each single-frame image data in the training sample set is input into the single-frame feature fusion module in the time series model, the optical flow information, key point information and feature map of each frame image data are fused to obtain a single-frame feature vector corresponding to each single-frame image data, and then liveness detection is performed based on each single-frame feature vector to obtain a single-frame liveness detection result for each frame image data.
[0094] S208, calculating the similarity between the feature vectors of each single frame, and obtaining a time series matrix corresponding to the training sample set based on the similarity;
[0095] In one embodiment, after obtaining the single-frame feature vectors corresponding to each single-frame image data, each single-frame feature vector is input into the timing relationship modeling module in the timing model, and the similarity between each single-frame feature vector is calculated. Based on the similarity between each single-frame feature vector, the timing matrix corresponding to the training sample set is obtained to obtain the timing relationship corresponding to the training sample set.
[0096] Furthermore, a feasible method for similarity calculation may be to calculate the similarity of adjacent single-frame feature vectors, construct a timing matrix corresponding to the sample feature vector based on the obtained similarities corresponding to each adjacent single-frame feature vector, and determine the adaptation timing relationship between each single-frame feature vector based on the timing matrix.
[0097] Furthermore, the timing matrix can be used to indicate the timing relationship between the feature vectors of each single frame, so as to improve the detection capability of subsequent cross-domain adaptation through the timing relationship. It should be noted that there is a difference between the feature information of the living body and the feature information of the attack image, and the difference will not change with cross-domain, so the cross-domain detection capability can be guaranteed by calculating the timing relationship of the training sample set.
[0098] The attack image may be collected image data of a person wearing a mask, or may be collected image data disguised as a living person using a photograph or the like.
[0099] S210, fusing the time series matrix and each of the single-frame feature vectors to obtain a multi-frame feature vector corresponding to the training sample set;
[0100] In one embodiment, after obtaining each single-frame feature vector and the time series matrix corresponding to the training sample set, the time series matrix and each single-frame feature vector are input into a multi-frame feature fusion module in the time series model to obtain a multi-frame feature vector corresponding to the training sample set.
[0101] Furthermore, the multi-frame feature vector may be a feature vector corresponding to the training sample set, and the liveness detection result corresponding to the training sample set may be obtained through the multi-frame feature vector. If cross-domain adaptation is not required, the liveness detection result may be used as the liveness prediction result corresponding to the training sample set across domains.
[0102] S212, calculating a timing loss function corresponding to the timing model, and determining a first training state of the timing model based on the timing loss function, until the first training state indicates that the timing model has converged, thereby obtaining a trained timing model;
[0103] In one embodiment, after obtaining the single-frame feature vector of each frame training sample in the training sample set and the temporal relationship between each single-frame feature vector, the single-frame detection loss function corresponding to the single-frame feature vector and the single-frame temporal relationship loss function corresponding to each single-frame feature vector are calculated, and then the temporal loss function corresponding to the temporal model is obtained according to the single-frame detection loss function and the single-frame temporal relationship loss function. After obtaining the pre-stored preset temporal loss function, the first training state of the temporal model is determined based on the preset temporal loss function and the temporal loss function, until the first training state indicates that the temporal model converges, and a trained temporal model is obtained. It should be noted that single-frame feature vectors and multi-frame feature vectors are collectively referred to as sample feature vectors.
[0104] Furthermore, the method for obtaining the timing loss function can be: calculating the timing model to obtain the single-frame detection loss function corresponding to each living body detection, and the single-frame timing relationship loss function corresponding to the similarity between the feature vectors of each single frame, adding the single-frame detection loss functions and taking the average to obtain the detection loss function corresponding to the timing model, adding the timing relationship losses of each single frame to obtain the timing relationship loss function corresponding to the timing model, and adding the detection loss function and the timing relationship loss function to obtain the timing loss function corresponding to the timing model.
[0105] Furthermore, the single-frame detection loss function may be a corresponding loss function calculated in the process of performing liveness detection on each single-frame training sample; the temporal relationship loss function may be a corresponding loss function calculated in the process of obtaining the temporal relationship between each single-frame training sample.
[0106] Furthermore, the first training state can be a parameter used to indicate whether the timing model converges. The first training state is determined by comparing a preset timing loss function with the timing loss function. If the timing loss function is less than or equal to the preset timing loss function, it can be considered that the first training state indicates that the timing model converges.
[0107] Furthermore, if the first training state indicates that the timing model has not converged, the step of "inputting the sample feature information into the timing model to determine the timing relationship between the training samples in the training sample set, and obtaining the sample feature vector corresponding to the sample feature information based on the timing relationship" is executed again, and the timing loss function corresponding to the timing model is calculated again, and the first training state of the timing model is determined based on the timing loss function, until the first training state indicates that the timing model has converged, and a trained timing model is obtained.
[0108] S214, inputting the single-frame feature vector and the multi-frame feature vector into the cross-domain adaptation model, generating a single-frame adaptation feature vector corresponding to the single-frame feature vector after cross-domain adaptation and a multi-frame adaptation feature vector corresponding to the multi-frame feature vector, and obtaining a prediction result corresponding to the liveness detection performed on the training sample set based on the multi-frame adaptation feature vector;
[0109] In one embodiment, after obtaining the single-frame feature vector and the multi-frame feature vector output by the timing model, the single-frame feature vector and the multi-frame feature vector are input into the feature encoding module in the cross-domain adaptation model to generate a single-frame adaptation feature vector corresponding to the single-frame feature vector after cross-domain adaptation and a multi-frame adaptation feature vector corresponding to the multi-frame feature vector, and then based on the multi-frame adaptation feature vector, the prediction result corresponding to the adapted liveness detection for the training sample set is obtained.
[0110] Furthermore, cross-domain adaptation can be performed for different scenarios to improve the accuracy of liveness detection for the training sample set. For example, the detection scenario corresponding to the time series model is detection using a door access camera during the day, while the detection scenario corresponding to the training sample set is image data obtained by the door access camera at night. In order to ensure the accuracy of liveness detection, it is necessary to adjust the parameters of the image data for liveness detection under dark light conditions at night.
[0111] Furthermore, a method for obtaining the prediction result of the adapted liveness detection may be to perform liveness detection based on the multi-frame adapted feature vectors, and use the prediction result of the liveness detection as the prediction result corresponding to the adapted training sample set. Another feasible method is to perform liveness detection based on each single-frame adapted feature vector, and obtain the prediction result corresponding to the training sample set based on the detection result of the liveness detection.
[0112] S216, based on the single frame adaptation feature vector, obtaining an adaptation timing relationship between the single frame adaptation feature vectors after cross-domain adaptation;
[0113] In one embodiment, after obtaining the single-frame adaptation feature vectors, each single-frame feature vector is input into the timing relationship adaptation module in the cross-domain adaptation model, and the similarity between each single-frame adaptation feature vector is calculated to obtain the adaptation timing relationship between each single-frame adaptation feature vector after adaptation.
[0114] Furthermore, a feasible method for calculating similarity may be to calculate the similarity of adjacent single-frame adaptation feature vectors, construct an adaptation timing matrix corresponding to the adapted adaptation feature vector based on the obtained similarities corresponding to each adjacent single-frame adaptation feature vector, and determine the adaptation timing relationship between each single-frame adaptation feature vector based on the adaptation timing matrix.
[0115] S218, comparing the single-frame adaptation feature vector with the single-frame feature vector, calculating the feature ratios retained by each of the single-frame adaptation feature vectors before and after adaptation, so as to obtain the migration features corresponding to each of the single-frame adaptation feature vectors
[0116] In one embodiment, the single-frame adaptation feature vector is input into the timing feature adaptation module in the cross-domain adaptation model, and the difference between each single-frame feature vector and the corresponding single-frame adaptation feature vector is calculated to obtain the feature ratio retained by each single-frame adaptation feature vector before and after adaptation, and then obtain the migration feature corresponding to each single-frame feature vector.
[0117] It should be noted that by calculating the migration features corresponding to each single-frame feature vector, the feature loss of the single-frame feature vector after adaptation can be judged according to the migration features, and then the training parameters of the cross-domain adaptation model are adjusted based on the migration features to ensure that the features of the single-frame feature vector before and after adaptation can be preserved as much as possible.
[0118] S220, calculating a cross-domain adaptation loss function corresponding to the cross-domain adaptation model, and determining a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation model converges, thereby obtaining a trained cross-domain adaptation model;
[0119] In one embodiment, in order to obtain a trained cross-domain adaptation model, a cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation model converges, thereby determining that a trained cross-domain adaptation model is obtained.
[0120] Furthermore, a method for obtaining a cross-domain adaptation loss function can be to calculate a cross-domain adaptation model to obtain a prediction loss function corresponding to a prediction result, an adaptation timing loss function corresponding to an adaptation timing relationship, and a migration loss function corresponding to a migration feature, add the prediction loss function, the adaptation timing loss function, and the migration loss function to obtain a cross-domain adaptation loss function corresponding to the cross-domain adaptation model, obtain a pre-stored preset cross-domain adaptation loss function, and determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function and the preset cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation loss function converges, thereby obtaining a trained cross-domain adaptation model.
[0121] Furthermore, the method for obtaining the prediction loss function, the adaptation timing loss function and the migration loss function can be: calculating the prediction loss function corresponding to the prediction result of the cross-domain adaptation model; calculating the single-frame adaptation timing loss function corresponding to the adaptation timing relationship between each single-frame adaptation feature vector, adding and averaging the single-frame adaptation timing loss functions, and obtaining the adaptation timing loss function corresponding to the cross-domain adaptation model; calculating the single-frame migration loss function corresponding to the migration feature of each single-frame adaptation feature vector, adding and averaging the single-frame migration loss functions, and obtaining the migration loss function corresponding to the cross-domain adaptation model.
[0122] Furthermore, the second training state can be a parameter used to indicate whether the cross-domain adaptation model converges. The second training state is determined by comparing a preset cross-domain adaptation loss function with the cross-domain adaptation loss function. If the preset cross-domain adaptation loss function is greater than the cross-domain adaptation loss function, it can be considered that the second training state indicates that the cross-domain adaptation model converges.
[0123] Furthermore, if the second training state indicates that the cross-domain adaptation model has not converged, the step of "inputting the sample feature vector into the cross-domain adaptation model, obtaining the sample adaptation feature vector after adaptation of the sample feature vector and the prediction result of the liveness detection, and obtaining the adaptation timing relationship and migration characteristics between each of the sample adaptation feature vectors based on the sample adaptation feature vector" is executed again, and the cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated again, and the second training state is determined based on the cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation model converges, and a trained cross-domain adaptation model is obtained.
[0124] It should be noted that during the training process of the time series model and the cross-domain adaptation model, it is not necessary for the time series model to converge. The cross-domain time series model can only be trained after the trained time series model is obtained. A feasible method is to obtain the sample feature vector corresponding to the sample feature information corresponding to the training sample set, input the sample feature vector into the cross-domain adaptation model for training, and after obtaining the prediction results and sample adaptation feature vectors corresponding to the cross-domain adaptation model, as well as the adaptation time series relationship and migration characteristics, respectively calculate the loss functions of the time series model and the cross-domain adaptation model, and determine whether the model training is completed based on each loss function.
[0125] In an embodiment of the present application, by obtaining sample feature information corresponding to a training sample set, the sample feature information is input into a timing model to obtain a timing relationship and a sample feature vector corresponding to the training sample set, and then a loss function of the timing model is calculated. The first training state of the timing model is determined based on the timing loss function until the first training state indicates that the timing model converges to obtain a trained timing model, and then the sample feature vector is input into a cross-domain adaptation model to obtain an adapted sample adaptation feature vector and a prediction result of liveness detection, and the corresponding adaptation timing relationship and migration feature are obtained based on the sample adaptation feature vector. A cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine a second training state of the cross-domain adaptation model, until the second training state indicates that the cross-domain adaptation model has converged, and a trained cross-domain adaptation model is obtained. The embodiment of the present application is adopted to extract and fuse the multi-source sample feature information of the training sample set, and calculate the timing relationship between each single-frame training sample, so as to perform liveness detection after cross-domain adaptation according to the timing relationship of the training samples, thereby reducing the performance degradation caused by cross-domain detection based on the fusion features of the timing relationship, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection.
[0126] See also Figure 4 , which is a flow chart of a method for training a liveness detection model according to an embodiment of the present application. Figure 4 As shown, the method may include the following steps S302-S308.
[0127] S302, obtaining an image data set sent by a terminal device, performing feature extraction on the image data set, and obtaining feature information corresponding to the image data set;
[0128] In one embodiment, an image data set sent by a terminal device is obtained, and a trained feature extraction model is used to perform feature extraction on the image data set to obtain feature information corresponding to the image data set.
[0129] Furthermore, the terminal device may be a device equipped with a camera capable of collecting image data, such as a camera on a door access control system, or a smart phone equipped with a camera.
[0130] Furthermore, the image data set may be an image data set containing a human portrait, and in order to ensure the accuracy of liveness detection based on the image data set, the image data of the image data set are arranged in chronological order. For example, image data sets collected over a period of time may be collected as a training sample set.
[0131] Furthermore, the feature information may be optical flow information, key point information, and feature maps, so as to facilitate subsequent liveness detection of the image data set based on the feature information. The optical flow information may be used to indicate the motion change of the entire picture in the image data; the key point information may be used to indicate the motion change of the portrait in the image data; and the feature map may be used to extract the feature vector of the image data.
[0132] Furthermore, the feature information extraction method can be to use a pre-trained model for extraction, such as using a FlowNet model to extract optical flow information, using an openpose model to extract key point information, and using a SwimTransformer model to extract a feature map of an image. It should be noted that the feature information extraction model can be replaced according to actual conditions.
[0133] S304, inputting the feature information into the trained time series model obtained by the above-mentioned liveness detection model training method, and outputting a feature vector corresponding to the feature information;
[0134] In one embodiment, the feature information is input into the trained time series model obtained by the above detection model method to obtain the feature vector corresponding to the feature information output by the time series model.
[0135] S306, inputting the feature vector into the cross-domain adaptation model trained by the above-mentioned liveness detection model training method, and outputting the prediction result corresponding to the feature vector;
[0136] In one embodiment, the acquired feature vector is input into a cross-domain adaptation model trained by the liveness detection model training method described above, and a prediction result of liveness detection corresponding to the feature vector output by the cross-domain adaptation model is obtained.
[0137] Furthermore, the prediction result may be used to indicate whether a person in the image data set is a living person.
[0138] S308, sending the prediction result to the terminal device;
[0139] In one embodiment, after the prediction result corresponding to the image data set is obtained based on the time series model and the cross-domain adaptation model, the prediction result is sent to the terminal device so that the terminal device displays the prediction result.
[0140] Furthermore, the specific display mode of the prediction result can be based on the display mode of the terminal device. For example, if the terminal device is a door access control device equipped with a camera, the display mode of the prediction result can be as follows: Figure 5 As shown, Figure 5 In addition to displaying the image data collected by the camera, the prediction result corresponding to the image data, "the portrait is alive", is also displayed.
[0141] In an embodiment of the present application, an image data set sent by a terminal device is acquired and merged to extract feature information, the feature information is input into a trained time series model to obtain a corresponding feature vector, and then the feature vector is input into a trained cross-domain adaptation model to obtain a prediction result of liveness detection corresponding to the image data set, and the prediction result is sent to the terminal device, so as to obtain a prediction result of liveness detection for a portrait in the image data set based on the feature information of the collected image data set, thereby reducing the performance degradation caused by cross-domain detection based on the fusion of features based on the time series relationship, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection and improving the reliability and security of face recognition.
[0142] based on Figure 1 The system architecture shown below will be combined with Figure 6-Figure 10 , the liveness detection model training device provided in the embodiment of the present application is introduced in detail. It should be noted that, Figure 6-Figure 10 The liveness detection model training device in the present application is used to execute Figure 2-Figure 3 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 2-Figure 3 The embodiment shown.
[0143] See also Figure 6 , is a schematic diagram of the structure of a liveness detection model training device provided in an embodiment of the present application. Figure 6 As shown, the liveness detection model training device 1 of the embodiment of the present application may include: an information acquisition unit 11, a time series vector acquisition unit 12, a time series model completion unit 13, a cross-domain model training unit 14 and a cross-domain model completion unit 15.
[0144] An information acquisition unit 11 is used to acquire sample feature information corresponding to a training sample set, where the training sample set is an image data set containing a human portrait;
[0145] A time series vector acquisition unit 12 is used to input the sample feature information into the time series model to determine the time series relationship between the training samples in the training sample set, and acquire a sample feature vector corresponding to the sample feature information based on the time series relationship;
[0146] A timing model completion unit 13 is used to calculate a timing loss function corresponding to the timing model, determine a first training state of the timing model based on the timing loss function, until the first training state indicates that the timing model has converged, and obtain a trained timing model;
[0147] The cross-domain model training unit 14 is used to input the sample feature vector into the cross-domain adaptation model, obtain the sample adaptation feature vector after the sample feature vector is adapted and the prediction result of the liveness detection, and obtain the adaptation time sequence relationship and migration characteristics between each of the sample adaptation feature vectors based on the sample adaptation feature vector, wherein the migration characteristics are used to indicate the feature ratio retained before and after the sample feature vector is adapted;
[0148] The cross-domain model completion unit 15 is used to calculate the cross-domain adaptation loss function corresponding to the cross-domain adaptation model, and determine the second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation model converges, thereby obtaining a trained cross-domain adaptation model.
[0149] Optional, such as Figure 7 As shown, the information acquisition unit 11 includes:
[0150] A set acquisition subunit 111 is used to acquire a training sample set, where the training sample set is an image data set containing a human portrait;
[0151] The feature extraction subunit 112 is used to extract features from the training samples in the training sample set based on a pre-trained feature extraction model, and obtain sample feature information corresponding to the training samples, wherein the sample feature information includes at least one of the optical flow information, key point information and feature map of the training samples.
[0152] Optional, such as Figure 8 As shown, the timing vector acquisition unit 12 includes:
[0153] The single-frame vector acquisition subunit 121 is used to input the sample feature information into the time series model, perform fusion calculation on the sample feature information corresponding to each training sample in the training sample set, obtain a single-frame feature vector corresponding to each training sample, and obtain a single-frame liveness detection result corresponding to each training sample based on each single-frame feature vector;
[0154] A time series relationship acquisition subunit 122, used for calculating the similarity between the single-frame feature vectors, and obtaining a time series matrix corresponding to the training sample set based on the similarity, wherein the time series matrix is used for indicating the time series relationship between the single-frame feature vectors;
[0155] The multi-frame vector acquisition subunit 123 is used to fuse the time series matrix and each of the single-frame feature vectors to obtain a multi-frame feature vector corresponding to the training sample set.
[0156] Optional, such as Fig. 9 As shown, the timing model completion unit 13 includes:
[0157] The single-frame function calculation subunit 131 is used to calculate the time series model to obtain the single-frame detection loss function corresponding to each of the living body detection results, and the single-frame time series relationship loss function corresponding to the similarity between each of the single-frame feature vectors;
[0158] A function adding subunit 132 is used to add and average the detection loss functions of each single frame to obtain the detection loss function corresponding to the timing model, and to add and average the timing relationship loss functions of each single frame to obtain the timing relationship loss function corresponding to the timing model;
[0159] A timing function acquisition subunit 133, configured to add the detection loss function and the timing relationship loss function to obtain a timing loss function corresponding to the timing model;
[0160] The timing model completion subunit 134 is used to obtain a pre-stored preset timing loss function, determine a first training state of the timing model based on the preset timing loss function and the timing loss function, until the first training state indicates that the timing model converges, and obtain a trained timing model.
[0161] Optional, such as Fig.10 As shown, the cross-domain model training unit 14 includes:
[0162] The vector adaptation subunit 141 is used to input the single-frame feature vector and the multi-frame feature vector into the cross-domain adaptation model, generate a single-frame adaptation feature vector corresponding to the single-frame feature vector after cross-domain adaptation and a multi-frame adaptation feature vector corresponding to the multi-frame feature vector, and obtain a prediction result corresponding to the liveness detection performed on the training sample set based on the multi-frame adaptation feature vector;
[0163] The adaptation timing acquisition subunit 142 is used to obtain the adaptation timing relationship between the single-frame adaptation feature vectors after cross-domain adaptation based on the single-frame adaptation feature vectors;
[0164] The migration feature acquisition subunit 143 is used to compare the single-frame adaptation feature vector with the single-frame feature vector, calculate the feature ratios retained by each of the single-frame adaptation feature vectors before and after adaptation, so as to obtain the migration features corresponding to each of the single-frame adaptation feature vectors.
[0165] Optional, such as Fig.11 As shown, the cross-domain model completion unit 15 includes:
[0166] A cross-domain function calculation subunit 151 is used to calculate the cross-domain adaptation model to obtain a prediction loss function corresponding to the prediction result, an adaptation timing loss function corresponding to the adaptation timing relationship, and a migration loss function corresponding to the migration feature;
[0167] A cross-domain function adding subunit 152, configured to add the prediction loss function, the adaptation timing loss function and the migration loss function to obtain a cross-domain adaptation loss function corresponding to the cross-domain adaptation model;
[0168] The cross-domain model completion subunit 153 is used to obtain a pre-stored preset cross-domain adaptation loss function, and determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function and the preset cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation loss function converges, thereby obtaining a trained cross-domain adaptation model.
[0169] Optionally, the cross-domain function calculation subunit 151 is further used for:
[0170] Calculate and obtain the cross-domain adaptation model to obtain a prediction loss function corresponding to the prediction result;
[0171] Calculate and obtain the single-frame adaptation timing loss function corresponding to the adaptation timing relationship between each of the single-frame adaptation feature vectors, add and average the single-frame adaptation timing loss functions, and obtain the adaptation timing loss function corresponding to the cross-domain adaptation model;
[0172] The single-frame migration loss function corresponding to the migration feature of each of the single-frame adaptation feature vectors is calculated and obtained, and the single-frame migration loss functions are added and averaged to obtain the migration loss function corresponding to the cross-domain adaptation model.
[0173] In an embodiment of the present application, by obtaining sample feature information corresponding to a training sample set, the sample feature information is input into a timing model to obtain a timing relationship and a sample feature vector corresponding to the training sample set, and then a loss function of the timing model is calculated. The first training state of the timing model is determined based on the timing loss function until the first training state indicates that the timing model converges to obtain a trained timing model, and then the sample feature vector is input into a cross-domain adaptation model to obtain an adapted sample adaptation feature vector and a prediction result of liveness detection, and the corresponding adaptation timing relationship and migration feature are obtained based on the sample adaptation feature vector. A cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine a second training state of the cross-domain adaptation model, until the second training state indicates that the cross-domain adaptation model has converged, and a trained cross-domain adaptation model is obtained. The embodiment of the present application is adopted to extract and fuse the multi-source sample feature information of the training sample set, and calculate the timing relationship between each single-frame training sample, so as to perform liveness detection after cross-domain adaptation according to the timing relationship of the training samples, thereby reducing the performance degradation caused by cross-domain detection based on the fusion features of the timing relationship, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection.
[0174] based on Figure 1 The system architecture shown below will be combined with Fig.12 , the liveness detection device provided in the embodiment of the present application is introduced in detail. It should be noted that, Fig.12 The living body detection device in the present application is used to execute Figure 4-Figure 5 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 4-Figure 5 The embodiment shown.
[0175] See also Fig.12 , is a schematic diagram of the structure of a living body detection device provided in an embodiment of the present application. Fig.12 As shown, the living body detection device 2 in the embodiment of the present application may include: a feature acquisition unit 21, a vector output unit 22, a result output unit 23 and a result sending unit 24.
[0176] The feature acquisition unit 21 is used to acquire an image data set sent by a terminal device, perform feature extraction on the image data set, and acquire feature information corresponding to the image data set, wherein the image data set is an image data set containing a portrait;
[0177] A vector output unit 22, used to input the feature information into the trained time series model and output a feature vector corresponding to the feature information;
[0178] A result output unit 23, used for inputting the feature vector into the trained cross-domain adaptation model, and outputting a prediction result corresponding to the feature vector, wherein the prediction result is used to indicate whether the human image in the image data set is alive;
[0179] The result sending unit 24 is used to send the prediction result to the terminal device so that the terminal device displays the prediction result.
[0180] In an embodiment of the present application, an image data set sent by a terminal device is acquired and merged to extract feature information, the feature information is input into a trained time series model to obtain a corresponding feature vector, and then the feature vector is input into a trained cross-domain adaptation model to obtain a prediction result of liveness detection corresponding to the image data set, and the prediction result is sent to the terminal device, so as to obtain a prediction result of liveness detection for a portrait in the image data set based on the feature information of the collected image data set, thereby reducing the performance degradation caused by cross-domain detection based on the fusion of features based on the time series relationship, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection and improving the reliability and security of face recognition.
[0181] The present application also provides a computer storage medium, which can store multiple program instructions, and the program instructions are suitable for being loaded and executed by a processor as described above. Figure 1-Figure 5 The method steps of the embodiment shown in the figure can be found in the specific implementation process. Figure 1-Figure 5 The specific description of the illustrated embodiment will not be repeated here.
[0182] The present specification also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor as described above. Figure 1-Figure 5 The liveness detection model training method of the embodiment shown in the figure can be specifically implemented by referring to Figure 1-Figure 5 The specific description of the illustrated embodiment will not be repeated here.
[0183] See also Fig.13 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.13As shown, the electronic device 1000 may include: at least one processor 1001, such as a CPU, at least one network interface 1004, an input / output interface 1003, a memory 1005, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The network interface 1004 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As shown in FIG. Fig.13 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, an input and output interface module, and a liveness detection model training application.
[0184] exist Fig.13 In the electronic device 1000 shown, the input-output interface 1003 is mainly used to provide an input interface for the user and obtain data input by the user.
[0185] In one embodiment, the processor 1001 may be used to call a liveness detection model training application stored in the memory 1005, and specifically perform the following operations:
[0186] Acquire sample feature information corresponding to a training sample set, wherein the training sample set is an image data set containing a human portrait;
[0187] Inputting the sample feature information into the time series model to determine the time series relationship between the training samples in the training sample set, and obtaining a sample feature vector corresponding to the sample feature information based on the time series relationship;
[0188] Calculating a timing loss function corresponding to the timing model, and determining a first training state of the timing model based on the timing loss function, until the first training state indicates that the timing model has converged, thereby obtaining a trained timing model;
[0189] Inputting the sample feature vector into the cross-domain adaptation model, obtaining the sample adaptation feature vector after the sample feature vector is adapted and the prediction result of the liveness detection, and obtaining the adaptation time sequence relationship and migration characteristics between each of the sample adaptation feature vectors based on the sample adaptation feature vector, wherein the migration characteristics are used to indicate the feature ratio retained before and after the sample feature vector is adapted;
[0190] A cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated, and a second training state of the cross-domain adaptation model is determined based on the cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation model converges, thereby obtaining a trained cross-domain adaptation model.
[0191] Optionally, when executing to obtain sample feature information corresponding to the training sample set, the processor 1001 performs the following operations:
[0192] Acquire a training sample set, where the training sample set is an image data set containing human portraits;
[0193] Based on a pre-trained feature extraction model, feature extraction is performed on the training samples in the training sample set to obtain sample feature information corresponding to the training samples, where the sample feature information includes at least one of the optical flow information, key point information and feature map of the training samples.
[0194] Optionally, when the processor 1001 inputs the sample feature information into the time series model to determine the time series relationship between the training samples in the training sample set, and obtains the sample feature vector corresponding to the sample feature information based on the time series relationship, the processor 1001 specifically performs the following operations:
[0195] Input the sample feature information into the time series model, perform fusion calculation on the sample feature information corresponding to each training sample in the training sample set, obtain a single-frame feature vector corresponding to each training sample, and obtain a single-frame liveness detection result corresponding to each training sample based on each single-frame feature vector;
[0196] Calculating the similarity between the single-frame feature vectors, and obtaining a time series matrix corresponding to the training sample set based on the similarity, wherein the time series matrix is used to indicate the time series relationship between the single-frame feature vectors;
[0197] The time series matrix and each of the single-frame feature vectors are fused to obtain a multi-frame feature vector corresponding to the training sample set.
[0198] Optionally, when the processor 1001 calculates the timing loss function corresponding to the timing model, determines the first training state of the timing model based on the timing loss function, and obtains the trained timing model until the first training state indicates that the timing model converges, the processor 1001 specifically performs the following operations:
[0199] Calculating the time series model to obtain a single-frame detection loss function corresponding to each of the living body detection results, and a single-frame time series relationship loss function corresponding to the similarity between each of the single-frame feature vectors;
[0200] The detection loss function corresponding to the timing model is obtained by adding and averaging the detection loss functions of the single frames, and the timing relationship loss function corresponding to the timing model is obtained by adding and averaging the timing relationship loss functions of the single frames;
[0201] Adding the detection loss function and the timing relationship loss function to obtain a timing loss function corresponding to the timing model;
[0202] A pre-stored preset timing loss function is obtained, and a first training state of the timing model is determined based on the preset timing loss function and the timing loss function, until the first training state indicates that the timing model converges, thereby obtaining a trained timing model.
[0203] Optionally, when the processor 1001 inputs the sample feature vector into the cross-domain adaptation model, obtains the sample adaptation feature vector after the sample feature vector is adapted and the prediction result of the liveness detection, and obtains the adaptation timing relationship and migration characteristics between each of the sample adaptation feature vectors based on the sample adaptation feature vector, the following specific operations are performed:
[0204] Inputting the single-frame feature vector and the multi-frame feature vector into the cross-domain adaptation model, generating a single-frame adaptation feature vector corresponding to the single-frame feature vector after cross-domain adaptation and a multi-frame adaptation feature vector corresponding to the multi-frame feature vector, and obtaining a prediction result corresponding to the liveness detection performed on the training sample set based on the multi-frame adaptation feature vector;
[0205] Based on the single-frame adaptation feature vectors, obtaining an adaptation timing relationship between the single-frame adaptation feature vectors after cross-domain adaptation;
[0206] The single-frame adaptation feature vector is compared with the single-frame feature vector, and the feature ratios retained by each of the single-frame adaptation feature vectors before and after adaptation are calculated to obtain migration features corresponding to each of the single-frame adaptation feature vectors.
[0207] Optionally, the processor 1001 calculates a cross-domain adaptation loss function corresponding to the cross-domain adaptation model, determines a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation model converges, and obtains a trained cross-domain adaptation model, specifically performing the following operations:
[0208] Calculating the cross-domain adaptation model to obtain a prediction loss function corresponding to the prediction result, an adaptation timing loss function corresponding to the adaptation timing relationship, and a migration loss function corresponding to the migration feature;
[0209] Adding the prediction loss function, the adaptation timing loss function and the migration loss function to obtain a cross-domain adaptation loss function corresponding to the cross-domain adaptation model;
[0210] Obtain a pre-stored preset cross-domain adaptation loss function, and determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function and the preset cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation loss function converges, to obtain a trained cross-domain adaptation model.
[0211] Optionally, when the processor 1001 calculates the cross-domain adaptation model to obtain a prediction loss function corresponding to the prediction result, an adaptation timing loss function corresponding to the adaptation timing relationship, and a migration loss function corresponding to the migration feature, the following operations are specifically performed:
[0212] Calculate and obtain the cross-domain adaptation model to obtain a prediction loss function corresponding to the prediction result;
[0213] Calculate and obtain the single-frame adaptation timing loss function corresponding to the adaptation timing relationship between each of the single-frame adaptation feature vectors, add and average the single-frame adaptation timing loss functions, and obtain the adaptation timing loss function corresponding to the cross-domain adaptation model;
[0214] The single-frame migration loss function corresponding to the migration feature of each of the single-frame adaptation feature vectors is calculated and obtained, and the single-frame migration loss functions are added and averaged to obtain the migration loss function corresponding to the cross-domain adaptation model.
[0215] In an embodiment of the present application, by obtaining sample feature information corresponding to a training sample set, the sample feature information is input into a timing model to obtain a timing relationship and a sample feature vector corresponding to the training sample set, and then a loss function of the timing model is calculated. The first training state of the timing model is determined based on the timing loss function until the first training state indicates that the timing model converges to obtain a trained timing model, and then the sample feature vector is input into a cross-domain adaptation model to obtain an adapted sample adaptation feature vector and a prediction result of liveness detection, and the corresponding adaptation timing relationship and migration feature are obtained based on the sample adaptation feature vector. A cross-domain adaptation loss function corresponding to the cross-domain adaptation model is calculated to determine a second training state of the cross-domain adaptation model, until the second training state indicates that the cross-domain adaptation model has converged, and a trained cross-domain adaptation model is obtained. The embodiment of the present application is adopted to extract and fuse the multi-source sample feature information of the training sample set, and calculate the timing relationship between each single-frame training sample, so as to perform liveness detection after cross-domain adaptation according to the timing relationship of the training samples, thereby reducing the performance degradation caused by cross-domain detection based on the fusion features of the timing relationship, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection.
[0216] See also Fig.14 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.14 As shown, the electronic device 2000 may include: at least one processor 2001, such as a CPU, at least one network interface 2004, an input / output interface 2003, a memory 2005, and at least one communication bus 2002. The communication bus 2002 is used to realize the connection and communication between these components. The network interface 2004 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 2005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 2005 may optionally be at least one storage device located away from the aforementioned processor 2001. As shown in FIG. Fig.14 As shown, the memory 2005 as a computer storage medium may include an operating system, a network communication module, an input and output interface module, and a liveness detection application.
[0217] exist Fig.14 In the electronic device 2000 shown, the input-output interface 2003 is mainly used to provide an input interface for the user and obtain data input by the user.
[0218] In one embodiment, the processor 2001 may be used to call a living body detection application stored in the memory 2005, and specifically perform the following operations:
[0219] Acquire an image data set sent by a terminal device, perform feature extraction on the image data set, and acquire feature information corresponding to the image data set, wherein the image data set is an image data set including a portrait;
[0220] Inputting the feature information into the trained time series model, and outputting a feature vector corresponding to the feature information;
[0221] Inputting the feature vector into a cross-domain adaptation model that has been trained, and outputting a prediction result corresponding to the feature vector, wherein the prediction result is used to indicate whether the human image in the image data set is alive;
[0222] The prediction result is sent to the terminal device so that the terminal device displays the prediction result.
[0223] In an embodiment of the present application, an image data set sent by a terminal device is acquired and merged to extract feature information, the feature information is input into a trained time series model to obtain a corresponding feature vector, and then the feature vector is input into a trained cross-domain adaptation model to obtain a prediction result of liveness detection corresponding to the image data set, and the prediction result is sent to the terminal device, so as to obtain a prediction result of liveness detection for the portrait in the image data set based on the feature information of the collected image data set, thereby reducing the performance degradation caused by cross-domain detection based on the time series relationship fusion feature, thereby achieving the effect of improving the prediction accuracy of cross-domain liveness detection and improving the reliability and security of face recognition.
[0224] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0225] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A method for training a liveness detection model, the method include: Acquire sample feature information corresponding to a training sample set, wherein the training sample set is an image data set containing a human portrait; Inputting the sample feature information into a time series model to determine a time series relationship between training samples in the training sample set, and obtaining a sample feature vector corresponding to the sample feature information based on the time series relationship; Calculating a timing loss function corresponding to the timing model, and determining a first training state of the timing model based on the timing loss function, until the first training state indicates that the timing model has converged, thereby obtaining a trained timing model; Inputting the sample feature vector into the cross-domain adaptation model, obtaining the sample adaptation feature vector after the sample feature vector is adapted and the prediction result of the liveness detection, and obtaining the adaptation time sequence relationship and migration characteristics between each of the sample adaptation feature vectors based on the sample adaptation feature vector, wherein the migration characteristics are used to indicate the feature ratio retained before and after the sample feature vector is adapted; Calculating a cross-domain adaptation loss function corresponding to the cross-domain adaptation model, and determining a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation model converges, thereby obtaining a trained cross-domain adaptation model; The calculating a cross-domain adaptation loss function corresponding to the cross-domain adaptation model includes: Calculating the cross-domain adaptation model to obtain a prediction loss function corresponding to the prediction result, an adaptation timing loss function corresponding to the adaptation timing relationship, and a migration loss function corresponding to the migration feature; The prediction loss function, the adaptation timing loss function and the migration loss function are added together to obtain a cross-domain adaptation loss function corresponding to the cross-domain adaptation model.
2. According to the method of claim 1, the step of obtaining sample feature information corresponding to the training sample set is: include: Acquire a training sample set, where the training sample set is an image data set containing human portraits; Based on a pre-trained feature extraction model, feature extraction is performed on the training samples in the training sample set to obtain sample feature information corresponding to the training samples, where the sample feature information includes at least one of the optical flow information, key point information and feature map of the training samples.
3. The method according to claim 1, wherein the sample feature information is input into the time series model to determine the time series relationship between the training samples in the training sample set, and the sample feature vector corresponding to the sample feature information is obtained based on the time series relationship. include: Input the sample feature information into the time series model, perform fusion calculation on the sample feature information corresponding to each training sample in the training sample set, obtain a single-frame feature vector corresponding to each training sample, and obtain a single-frame liveness detection result corresponding to each training sample based on each single-frame feature vector; Calculating the similarity between the single-frame feature vectors, and obtaining a time series matrix corresponding to the training sample set based on the similarity, wherein the time series matrix is used to indicate the time series relationship between the single-frame feature vectors; The time series matrix and each of the single-frame feature vectors are fused to obtain a multi-frame feature vector corresponding to the training sample set.
4. According to the method of claim 3, the timing loss function corresponding to the timing model is calculated, and a first training state of the timing model is determined based on the timing loss function, until the first training state indicates that the timing model converges, thereby obtaining a trained timing model. include: Calculating the time series model to obtain a single-frame detection loss function corresponding to each of the living body detection results, and a single-frame time series relationship loss function corresponding to the similarity between each of the single-frame feature vectors; The detection loss function corresponding to the timing model is obtained by adding and averaging the detection loss functions of the single frames, and the timing relationship loss function corresponding to the timing model is obtained by adding and averaging the timing relationship loss functions of the single frames; Adding the detection loss function and the timing relationship loss function to obtain a timing loss function corresponding to the timing model; A pre-stored preset timing loss function is obtained, and a first training state of the timing model is determined based on the preset timing loss function and the timing loss function, until the first training state indicates that the timing model converges, thereby obtaining a trained timing model.
5. The method according to claim 3, wherein the sample feature vector is input into the cross-domain adaptation model, a sample adaptation feature vector after the sample feature vector is adapted and a prediction result of liveness detection are obtained, and an adaptation timing relationship and migration characteristics between each of the sample adaptation feature vectors are obtained based on the sample adaptation feature vector. include: Inputting the single-frame feature vector and the multi-frame feature vector into the cross-domain adaptation model, generating a single-frame adaptation feature vector corresponding to the single-frame feature vector after cross-domain adaptation and a multi-frame adaptation feature vector corresponding to the multi-frame feature vector, and obtaining a prediction result corresponding to the liveness detection performed on the training sample set based on the multi-frame adaptation feature vector; Based on the single frame adaptation feature vectors, obtaining an adaptation timing relationship between the single frame adaptation feature vectors after cross-domain adaptation; The single-frame adaptation feature vector is compared with the single-frame feature vector, and the feature ratios retained by each of the single-frame adaptation feature vectors before and after adaptation are calculated to obtain migration features corresponding to each of the single-frame adaptation feature vectors.
6. According to the method of claim 5, the second training state of the cross-domain adaptation model is determined based on the cross-domain adaptation loss function until the second training state indicates that the cross-domain adaptation model converges, thereby obtaining a trained cross-domain adaptation model. include: Obtain a pre-stored preset cross-domain adaptation loss function, and determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function and the preset cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation loss function converges, to obtain a trained cross-domain adaptation model.
7. According to the method of claim 6, the cross-domain adaptation model is calculated to obtain a prediction loss function corresponding to the prediction result, an adaptation timing loss function corresponding to the adaptation timing relationship, and a migration loss function corresponding to the migration feature. include: Calculate and obtain the cross-domain adaptation model to obtain a prediction loss function corresponding to the prediction result; Calculate and obtain the single-frame adaptation timing loss function corresponding to the adaptation timing relationship between each of the single-frame adaptation feature vectors, add and average the single-frame adaptation timing loss functions, and obtain the adaptation timing loss function corresponding to the cross-domain adaptation model; The single-frame migration loss function corresponding to the migration feature of each of the single-frame adaptation feature vectors is calculated and obtained, and the single-frame migration loss functions are added and averaged to obtain the migration loss function corresponding to the cross-domain adaptation model.
8. A method for detecting a living body, the method comprising: include: Acquire an image data set sent by a terminal device, perform feature extraction on the image data set, and acquire feature information corresponding to the image data set, wherein the image data set is an image data set including a portrait; Inputting the feature information into a time series model that has been trained by the liveness detection model training method according to any one of claims 1 to 7, and outputting a feature vector corresponding to the feature information; Inputting the feature vector into a cross-domain adaptation model trained by the liveness detection model training method according to any one of claims 1 to 7, and outputting a prediction result corresponding to the feature vector, wherein the prediction result is used to indicate whether the human image in the image data set is a live body; The prediction result is sent to the terminal device so that the terminal device displays the prediction result.
9. A liveness detection model training device, include: An information acquisition unit, used to acquire sample feature information corresponding to a training sample set, wherein the training sample set is an image data set containing a human portrait; A time series vector acquisition unit, configured to input the sample feature information into a time series model to determine a time series relationship between the training samples in the training sample set, and acquire a sample feature vector corresponding to the sample feature information based on the time series relationship; A timing model completion unit, configured to calculate a timing loss function corresponding to the timing model, determine a first training state of the timing model based on the timing loss function, until the first training state indicates that the timing model has converged, and obtain a training completed timing model; A cross-domain model training unit, used to input the sample feature vector into a cross-domain adaptation model, obtain a sample adaptation feature vector after the sample feature vector is adapted and a prediction result of liveness detection, and obtain an adaptation time sequence relationship and a migration feature between each of the sample adaptation feature vectors based on the sample adaptation feature vector, wherein the migration feature is used to indicate a feature ratio retained before and after the sample feature vector is adapted; A cross-domain model completion unit, used to calculate a cross-domain adaptation loss function corresponding to the cross-domain adaptation model, and determine a second training state of the cross-domain adaptation model based on the cross-domain adaptation loss function, until the second training state indicates that the cross-domain adaptation model converges, thereby obtaining a trained cross-domain adaptation model; The cross-domain model completion unit includes: A cross-domain function calculation subunit, used to calculate the cross-domain adaptation model to obtain a prediction loss function corresponding to the prediction result, an adaptation timing loss function corresponding to the adaptation timing relationship, and a migration loss function corresponding to the migration feature; The cross-domain function adding subunit is used to add the prediction loss function, the adaptation timing loss function and the migration loss function to obtain the cross-domain adaptation loss function corresponding to the cross-domain adaptation model.
10. A living body detection device, include: a feature acquisition unit, configured to acquire an image data set sent by a terminal device, perform feature extraction on the image data set, and acquire feature information corresponding to the image data set, wherein the image data set is an image data set containing a portrait; A vector output unit, used to input the feature information into a time series model trained by the liveness detection model training method according to any one of claims 1 to 7, and output a feature vector corresponding to the feature information; A result output unit, used for inputting the feature vector into a cross-domain adaptation model trained by the liveness detection model training method according to any one of claims 1 to 7, and outputting a prediction result corresponding to the feature vector, wherein the prediction result is used to indicate whether the human image in the image data set is a live body; The result sending unit is used to send the prediction result to the terminal device so that the terminal device displays the prediction result.
11. A computer storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the steps of the method according to any one of claims 1 to 8.
12. An electronic device, include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method according to any one of claims 1 to 8.
13. A computer program product having at least one instruction stored thereon, wherein when the at least one instruction is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Transferable rumor detection method based on domain self-adaptation
CN112541081A
Living body detection method based on image style migration information fusion
CN113128269A