Living body detection method, device and equipment
By extracting video compression domain information and using a pre-trained live detection model for live detection, the problem of video decoding time consumption is solved, and efficient and accurate live detection is achieved.
Patent Information
- Application Number
- CN202411177578.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-21
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, in vivo detection, the video decoding process consumes more time, affects efficiency, and is difficult to take into account both detection accuracy and speed.
Extract video compression domain information for live detection, and use the pre-trained live detection model to generate non-live probability values, reducing the time consumption of the video decoding process and improving efficiency.
The video compression domain information generated during the video decoding process ensures the accuracy of the detection results, reduces the video decoding time, and improves the efficiency and real-time life detection.
Smart Images

Figure CN119131913A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer vision and image processing, and in particular to a method, device and equipment for detecting living things. Background Art
[0002] With the development of computer technology and optical imaging technology, user identification methods based on face recognition technology are becoming increasingly popular. In the application process of face recognition, it is usually necessary to verify whether the user is a real living person in order to identify fraud during face recognition and protect the interests of users. At present, when performing liveness detection, it is usually necessary to compress the video to be detected collected by the device first to facilitate the storage and transmission of the video to be detected. Subsequently, it is necessary to decode the compressed data of the video to be detected in order to generate the liveness detection result based on the decoded video data. However, it often takes a lot of time in the video decoding process, which affects the efficiency of liveness detection.
[0003] Based on this, how to improve the efficiency of liveness detection while ensuring the accuracy of the generated liveness detection results has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] In view of this, the embodiments of this specification provide a liveness detection method, device and equipment, which can improve the efficiency of liveness detection while ensuring the accuracy of the generated liveness detection results.
[0005] To solve the above technical problems, the embodiments of this specification are implemented as follows:
[0006] The embodiment of this specification provides a method for detecting a living body, including:
[0007] Obtaining compressed data of the video to be detected;
[0008] In the process of decoding the compressed data of the video to be detected, extracting the video compression domain information;
[0009] Performing liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is obtained by training a first classification model using a video compression domain information sample extracted from a video compression data sample;
[0010] If the first non-living body probability value is less than a first threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0011] The present invention provides a method for training a liveness detection model, including:
[0012] Obtain a video compression data sample set;
[0013] In a process of decoding at least part of the video compression data samples in the video compression data sample set, extracting video compression domain information of the video compression data samples to obtain video compression domain information samples;
[0014] Determining a living body classification label of the video compression domain information sample corresponding to the video compression data sample according to a preset living body classification result of the video compression data sample;
[0015] The classification model is trained using the video compression domain information samples carrying the live body classification label to obtain a live body detection model; the live body detection model is used to perform live body detection on the video compression domain information extracted from the compressed data of the video to be detected.
[0016] The embodiment of this specification provides a living body detection device, including:
[0017] An acquisition module is used to acquire compressed data of the video to be detected;
[0018] An extraction module, which extracts video compression domain information during decoding of compressed data of the video to be detected;
[0019] a detection module, performing liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is obtained by training a first classification model using a video compression domain information sample extracted from a video compression data sample;
[0020] The result generating module generates a detection result indicating that the video to be detected contains a living body if the first non-living body probability value is less than a first threshold.
[0021] The embodiment of this specification provides a training device for a liveness detection model, comprising:
[0022] An acquisition module, which acquires a set of video compression data samples;
[0023] An extraction module, which extracts video compression domain information of the video compression data samples in a process of decoding at least part of the video compression data samples in the video compression data sample set, and obtains video compression domain information samples;
[0024] A determination module, which determines a living body classification label of the video compression domain information sample corresponding to the video compression data sample according to a preset living body classification result of the video compression data sample;
[0025] The training module uses the video compression domain information samples carrying the live classification label to train the classification model to obtain a live detection model; the live detection model is used to perform live detection on the video compression domain information extracted from the compressed data of the video to be detected.
[0026] The embodiment of this specification provides a living body detection device, including:
[0027] at least one processor; and,
[0028] a memory communicatively connected to the at least one processor; wherein,
[0029] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0030] Obtaining compressed data of the video to be detected;
[0031] In the process of decoding the compressed data of the video to be detected, extracting the video compression domain information;
[0032] Performing liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is obtained by training a first classification model using a video compression domain information sample extracted from a video compression data sample;
[0033] If the first non-living body probability value is less than a first threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0034] The embodiment of this specification provides a training device for a liveness detection model, including:
[0035] at least one processor; and,
[0036] a memory communicatively connected to the at least one processor; wherein,
[0037] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0038] Obtain a video compression data sample set;
[0039] In a process of decoding at least part of the video compression data samples in the video compression data sample set, extracting video compression domain information of the video compression data samples to obtain video compression domain information samples;
[0040] Determining a living body classification label of the video compression domain information sample corresponding to the video compression data sample according to a preset living body classification result of the video compression data sample;
[0041] The classification model is trained using the video compression domain information samples carrying the live body classification label to obtain a live body detection model; the live body detection model is used to perform live body detection on the video compression domain information extracted from the compressed data of the video to be detected.
[0042] At least one embodiment provided in this specification can achieve the following beneficial effects:
[0043] When liveness detection is required, a first liveness detection model that has been pre-trained can be used to generate a first non-liveness probability value based on the video compression domain information extracted during the decoding of the compressed data of the video to be detected, and then determine the liveness detection result based on the first non-liveness probability value. In this solution, since the video compression domain information generated during the video decoding process contains a large amount of key information in the video to be detected, the accuracy of the liveness detection result generated based on the video compression domain information can be guaranteed. At the same time, since the information generated during the video decoding process can be used to generate the liveness detection result, there is no need to wait until the video compression data is completely decoded before generating the liveness detection result, which can reduce the time consumed by the video decoding process to improve the efficiency and real-time performance of liveness detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of this specification 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 recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0045] Figure 1 A schematic diagram of a flow chart of a liveness detection method provided in an embodiment of this specification;
[0046] Figure 2 A flowchart of a method for training a liveness detection model provided in an embodiment of this specification;
[0047] Figure 3 The embodiments of this specification provide corresponding to Figure 1 A schematic diagram of a lane flow chart of a liveness detection method;
[0048] Figure 4 The embodiments of this specification provide corresponding to Figure 1 A structural schematic diagram of a living body detection device;
[0049] Figure 5 The embodiments of this specification provide corresponding to Figure 2 A structural schematic diagram of a training device for a living body detection model;
[0050] Figure 6 The embodiments of this specification provide corresponding to Figure 1 A structural schematic diagram of a living body detection device;
[0051] Figure 7 The embodiments of this specification provide corresponding to Figure 2 A structural schematic diagram of a training device for a liveness detection model. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this description, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.
[0053] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0054] In the prior art, liveness detection algorithms have become standard for face recognition systems. Such algorithms generally use single-frame images or multi-frame video information as input to determine whether the user is a real person for face recognition. There are currently two main types of liveness detection methods, liveness detection methods based on single-frame images and liveness detection methods based on multi-frame video information. Among them, the liveness detection method based on single-frame images requires less information and runs faster, but has poor performance. The liveness detection method based on multi-frame video information not only needs to process multi-frame video information, which makes the amount of information it needs to process larger, but also needs to fully decode the compressed data of the video to be detected, so the running speed is slower. It can be seen that both methods in the prior art are difficult to take into account the accuracy and running speed of liveness detection.
[0055] In order to solve the defects in the prior art, this solution provides the following embodiments:
[0056] Figure 1 This is a flow chart of a liveness detection method in an embodiment of this specification. The execution subject of the liveness detection method provided in the embodiment of this specification can be a terminal device used for liveness detection, or a server connected to the terminal device for communication.
[0057] like Figure 1 As shown, the living body detection method may include the following steps:
[0058] Step 101: Obtain compressed data of a video to be detected.
[0059] In the embodiment of this specification, in step 101, the video to be detected may be video data obtained by using a face recognition terminal to collect video of the user during the face recognition process of the user, and the video to be detected may include the user's face movement, blinking, shaking head and other action information. In actual applications, the face recognition terminal may be a mobile phone terminal, a payment terminal, a computer terminal, etc., which is not specifically limited here.
[0060] After acquiring the video to be detected, the face recognition terminal can compress the video to be detected to obtain compressed data of the video to be detected. Since the compressed data of the video to be detected has a smaller data volume, it is convenient for storage and transmission. The face recognition terminal can store the compressed data of the video to be detected locally on the device to facilitate subsequent liveness detection based on the compressed data; or the face recognition terminal can send the compressed data of the video to be detected to the server so that the server can perform liveness detection based on the compressed data.
[0061] Among them, data compression is a technology that uses fewer data bits (or other information-related units) than unencoded data according to a specific encoding mechanism. The video data to be detected is compressed by a specific compression algorithm before storage and transmission. It can not only greatly reduce data storage space and data transmission volume, but also reduce IO when reading data. Therefore, it can also reduce query time to a certain extent, so as to effectively reduce the load of the entire server cluster.
[0062] Step 103: extracting video compression domain information during decoding of the compressed data of the video to be detected.
[0063] In the embodiment of the present specification, in step 103, the face recognition terminal or server can decode the compressed data of the video to be detected when performing liveness detection to obtain relevant information for liveness detection in the video to be detected. Generally, the compressed data of the video to be detected can be decoded by a video decoder to restore the video to be detected before compression, thereby obtaining the video to be detected.
[0064] Since it takes a lot of time to fully decode the compressed data of the video to be detected, which affects the efficiency of liveness detection, the face recognition terminal or server can partially decode the compressed data. In the process of partially decoding the compressed data, the video compression domain information carrying a large amount of key information in the video to be detected can be extracted and output, thereby using the video compression domain information for liveness detection to improve the efficiency of liveness detection.
[0065] Specifically, step 103: extracting video compression domain information during decoding the compressed data of the video to be detected may include:
[0066] In the process of decoding the compressed data of the video to be detected by using the first video decoder, video compression domain information is extracted; the video compression domain information includes: key frame images, motion vector data corresponding to the key frame images, and residual data corresponding to the key frame images.
[0067] In an embodiment of the present specification, the first video decoder can be used to partially decode the compressed data of the video to be detected and output video compression domain information, which can be expressed as {I, Motion, Diff}, where I can refer to a key frame image, Motion can refer to motion vector data corresponding to the key frame image I, and Diff can refer to residual data corresponding to the key frame image I.
[0068] The key frame image I may refer to an intra-frame coded image that compresses the amount of transmission data by removing image spatial redundant information as much as possible, and may describe the details of the image background and the moving subject.
[0069] The motion vector data Motion corresponding to the key frame image I may refer to the relative displacement data between the key frame image I and the adjacent frame image. Specifically, the motion vector data Motion may be in n*m format, and the pixel point data of the image frames before and after the key frame image I may be inferred based on the motion vector data Motion. It is understandable that in inter-frame coding, the relative displacement between the current coding block and the better matching block in its reference image may be represented by a motion vector.
[0070] The residual data Diff corresponding to the key frame image I can reflect the difference information of pixel color and brightness between the key frame image I and the adjacent frame images.
[0071] In practical applications, the video image frames can usually be reconstructed according to the video compression domain information to obtain the fully decompressed video to be detected.
[0072] Step 105: Perform liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is obtained by training a first classification model using a video compression domain information sample extracted from a video compression data sample.
[0073] Step 107: If the first non-living body probability value is less than a first threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0074] In the embodiments of this specification, if the first non-liveness probability value is less than the first threshold, it can usually indicate that the video to be detected collected this time contains a live user, that is, the real live user himself is performing face recognition, rather than criminals using printed face images, head covers and other attack methods to perform face recognition attacks and cheats, so that a detection result indicating that the video to be detected contains a live person can be generated, and liveness detection is completed. Among them, the first threshold can be set according to actual needs and is not specifically limited to this.
[0075] Figure 1 In the method, when liveness detection is required, a first liveness detection model that has been pre-trained can be used to generate a first non-liveness probability value based on the video compression domain information extracted during the decoding of the compressed data of the video to be detected, and then the liveness detection result is determined based on the first non-liveness probability value. In this solution, since the video compression domain information generated during the video decoding process contains a large amount of key information in the video to be detected, the accuracy of the liveness detection result generated based on the video compression domain information can be guaranteed. At the same time, since the information generated during the video decoding process can be used to generate the liveness detection result, there is no need to wait until the video compression data is completely decoded before generating the liveness detection result, which can reduce the time consumed by the video decoding process to improve the efficiency and real-time performance of liveness detection.
[0076] based on Figure 1 The method in this specification also provides some specific implementation plans of the method, which are described below.
[0077] In the embodiment of the present specification, in step 105, the video compression domain information is input into the first liveness detection model, and the probability value that the corresponding video to be detected does not contain a live user can be obtained, that is, the first non-liveness probability value. The first liveness detection model can be obtained by training using the first classification model, and the sample data for training the first classification model can be a video compression domain information sample extracted from a video compression data sample, and the video compression data sample can be obtained by compressing the video data collected in the historical liveness detection process, and the video compression data sample can carry label data indicating whether it contains a live user.
[0078] Furthermore, the first classification model may include a first classification sub-model, a second classification sub-model, and a third classification sub-model; the first classification sub-model, the second classification sub-model, and the third classification sub-model share a first fully connected layer and a first output layer; the first classification sub-model, the second classification sub-model, and the third classification sub-model may all belong to a convolutional neural network model, for example, a ResNet18 model.
[0079] During model training, the key frame images, motion vector data, and residual data in the video compression domain information sample can be sequentially input into the first classification sub-model, the second classification sub-model, and the third classification sub-model, and the first classification model is optimized according to the difference between the predicted classification result output by the first output layer and the label data of the video compression domain information sample, until the performance of the first classification model meets the requirements, so as to obtain the first liveness detection model. The predicted classification result output by the first output layer can represent the predicted probability that the video compression domain information sample does not contain a live user and the probability that it contains a live user.
[0080] Correspondingly, step 107: performing liveness detection on the video compression domain information using the first liveness detection model to obtain a first non-liveness probability value may specifically include:
[0081] The key frame image, the motion vector data, and the residual data are respectively input into the first classification sub-model, the second classification sub-model, and the third classification sub-model to obtain a first non-living body probability value output by the first output layer.
[0082] In the embodiments of the present specification, the first classification sub-model can perform feature extraction processing on the key frame image I, the second classification sub-model can perform feature extraction processing on the motion vector data Motion corresponding to the key frame image I, and the third classification sub-model can perform feature extraction processing on the residual data Diff corresponding to the key frame image I. The first classification sub-model, the second classification sub-model, and the third classification sub-model can respectively output the extracted feature data to the first fully connected layer, and the first fully connected layer is used to integrate the features extracted by the first classification sub-model, the second classification sub-model, and the third classification sub-model, and the first output layer then outputs the first non-living probability value based on the integrated features.
[0083] Specifically, the first fully connected layer can be used to receive the first feature vector, the second feature vector and the third feature vector respectively sent by the first classification sub-model, the second classification sub-model and the third classification sub-model, and perform summation processing on the first feature vector, the second feature vector and the third feature vector to obtain a first fused feature vector. The first feature vector, the second feature vector and the third feature vector are vector data obtained by performing feature extraction on the key frame image, the motion vector data and the residual data respectively.
[0084] The first output layer can be used to determine the probability that the video to be detected does not contain a living body according to the first fused feature vector, and obtain the first non-living body probability value.
[0085] In practical applications, since the number of key frame images I is related to the amount of compressed data of the video to be detected, generally, the larger the amount of compressed data of the video to be detected, the greater the number of key frame images I. However, since the input of the first classification sub-model in the first living body detection model is usually a preset number of key frame images, a preset number of key frame images I can be extracted from the multiple key frame images I extracted in step 103 as the input of the first classification sub-model in the first living body detection model. The key frame image I in the middle position of the acquisition timing among the multiple key frame images I extracted in step 103 can be selected as the input of the first classification sub-model in the first living body detection model, which is conducive to improving the accuracy of the living body detection result.
[0086] In practical applications, the data dimensions of the first eigenvector, the second eigenvector, and the third eigenvector may be the same. When the first fully connected layer fuses the first eigenvector, the second eigenvector, and the third eigenvector, it may sum the feature data of each dimension of the first eigenvector, the second eigenvector, and the third eigenvector, thereby obtaining a first fused feature vector having the same data dimension as the first eigenvector, the second eigenvector, and the third eigenvector. Subsequently, the output layer may perform binary classification based on the first fused feature vector, and use the determined probability that the video to be detected does not contain a living body as the first non-living body probability value. In addition, the output layer may also generally output the probability that the video to be detected contains a living body.
[0087] In the embodiment of the present specification, if the first non-liveness probability value is greater than or equal to the first threshold value, it may indicate that the video to be detected collected this time may not contain a live user, that is, the criminals may be performing face recognition attacks or cheating. In order to further improve the accuracy of liveness detection, the compressed data of the video to be detected can be further fully decoded, that is, decompressed, to obtain the decompressed video data to be detected, and further liveness detection is performed on the video data to be detected to generate the final liveness detection result.
[0088] Based on this, step 107: performing liveness detection on the video compression domain information using the first liveness detection model to obtain the first non-liveness probability value may also include:
[0089] If the first non-living body probability value is greater than or equal to a first threshold, the compressed data of the to-be-detected video is decoded by using a second video decoder to obtain decompressed to-be-detected video data.
[0090] The second liveness detection model is used to perform liveness detection on the decompressed video data to be detected to obtain a second non-liveness probability value; the second liveness detection model is obtained by training a second classification model using the decompressed video data samples.
[0091] If the second non-living body probability value is less than a second threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0092] In the embodiment of this specification, the second video decoder can be used to fully decode the compressed data of the video to be detected, and after decompression of the compressed data, a complete video to be detected can be obtained. In practical applications, the second video decoder and the first video decoder can be implemented based on a single video decoder, or can also be implemented by using two video decoders.
[0093] This is because, in the process of using the second video decoder to fully decode the compressed data of the video to be detected, the second video decoder will first generate video compression domain information, and then generate a complete video to be detected based on the video compression domain information. Therefore, the existing video decoder can be modified by adding program code for exporting video compression domain information so that the video decoder can be used to extract video compression domain information and generate complete decompressed video data to be detected, thereby realizing the second video decoder and the first video decoder based on a single video decoder.
[0094] Alternatively, an existing video decoder may be used as the second video decoder, and an innovative video decoder capable of outputting video compression domain information before full video decoding may be used as the first video decoder, so that two video decoders may be used to implement the second video decoder and the first video decoder respectively.
[0095] Generally, the time consumed by using the first video decoder to extract the video compression domain information corresponding to the video to be detected is less than the time consumed by using the second video decoder to generate the decompressed video data to be detected.
[0096] In an embodiment of the present specification, the decompressed video data to be detected may include video frame images in RGB format. Therefore, the second liveness detection model may be a pre-trained second classification model that can perform liveness detection based on RGB images. Thus, the image frames in the decompressed video data to be detected can be input into the second liveness detection model, and liveness detection is performed using the second liveness detection model to obtain a second non-liveness probability value. If the second non-liveness probability value is less than the second threshold, it can be indicated that the video to be detected contains a live body, and it is a real-person face-swiping video, which can be authenticated by face-swiping. If the second non-liveness probability value is greater than the second threshold, it can be indicated that the video to be detected does not contain a live body, and there is a risk of liveness attack.
[0097] In practical applications, the second liveness detection model can be implemented based on an existing model for liveness detection based on images, or can also be implemented based on a liveness detection model constructed by multiple sub-models proposed in this application.
[0098] Specifically, when the second liveness detection model is implemented based on multiple sub-models, the second classification model corresponding to the second liveness detection model may include a fourth classification sub-model, a fifth classification sub-model, and a sixth classification sub-model; the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model share the second fully connected layer and the second output layer; the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model may all belong to a convolutional neural network model, for example, a ResNet18 model.
[0099] During model training, the R, G, and B component information in the decompressed video data sample can be input into the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model in sequence, and the second classification model is optimized according to the difference between the predicted classification result output by the second output layer and the label data of the video data sample, until the performance of the second classification model meets the requirements, so as to obtain the second liveness detection model. Among them, the predicted classification result output by the second output layer can represent the predicted probability that the video data sample does not contain a live user and the probability that the video data sample contains a live user; the label data of the video data sample can be used to indicate whether the video data sample contains a live user.
[0100] Correspondingly, if the decompressed video data includes a video frame image in RGB format, performing liveness detection on the decompressed video data to be detected using a second liveness detection model to obtain a second non-liveness probability value may specifically include:
[0101] The red component value (R value), green component value (G value) and blue component value (B value) of the video frame image in RGB format are respectively input into the fourth classification sub-model, the fifth classification sub-model and the sixth classification sub-model to obtain the second non-living body probability value output by the second output layer.
[0102] In the embodiments of the present specification, the fourth classification sub-model can perform feature extraction processing on the red component value of the video frame image in the video to be detected, the fifth classification sub-model can perform feature extraction processing on the red and green component values of the video frame image in the video to be detected, and the sixth classification sub-model can perform feature extraction processing on the blue component value of the video frame image in the video to be detected. Subsequently, the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model can respectively output the extracted feature data to the second fully connected layer, and the second fully connected layer is used to integrate the features extracted by the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model, and then the second output layer outputs the second non-living probability value based on the integrated features.
[0103] Specifically, the second fully connected layer is used to receive the fourth eigenvector, the fifth eigenvector and the sixth eigenvector sent respectively by the fourth classification sub-model, the fifth classification sub-model and the sixth classification sub-model, and to perform summation processing on the fourth eigenvector, the fifth eigenvector and the sixth eigenvector to obtain a second fused feature vector; wherein the fourth eigenvector, the fifth eigenvector and the sixth eigenvector are vector data obtained by performing feature extraction on the red component value, the green component value and the blue component value of the video frame image in the RGB format, respectively.
[0104] The second output layer is used to determine the probability that the video to be detected does not contain a living body according to the second fused feature vector, and obtain the second non-living body probability value.
[0105] In a specific application embodiment, the data dimensions of the fourth eigenvector, the fifth eigenvector, and the sixth eigenvector may be the same. When the second fully connected layer fuses the fourth eigenvector, the fifth eigenvector, and the sixth eigenvector, it may sum the feature data of each dimension of the fourth eigenvector, the fifth eigenvector, and the sixth eigenvector, thereby obtaining a second fused feature vector having the same data dimension as the fourth eigenvector, the fifth eigenvector, and the sixth eigenvector. Subsequently, the output layer may perform binary classification based on the second fused feature vector, and use the determined probability that the video to be detected does not contain a living body as the second non-living body probability value. In addition, the output layer may also generally output the probability that the video to be detected contains a living body.
[0106] Furthermore, after performing liveness detection on the decompressed video data to be detected by using the second liveness detection model to obtain the second non-liveness probability value, the method may further include:
[0107] If the second non-liveness probability value is greater than or equal to a second threshold, a third non-liveness probability value is generated according to the first non-liveness probability value and the second non-liveness probability value using a logistic regression model; the logistic regression model is obtained by training an initial logistic regression model using the first non-liveness probability value sample and the second non-liveness probability value sample; the first non-liveness probability value sample is obtained by performing liveness detection on a video compression domain information sample extracted from a video compression data sample using the first liveness detection model, and the second non-liveness probability value sample is obtained by performing liveness detection on a decompressed video data sample corresponding to the video compression data sample using the second liveness detection model.
[0108] It is determined whether the third non-living body probability value is less than a third threshold value to obtain a determination result.
[0109] If the judgment result indicates that the third non-living body probability value is less than a third threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0110] If the judgment result indicates that the third non-living body probability value is greater than or equal to a third threshold, a detection result indicating that the video to be detected does not contain a living body is generated.
[0111] In the embodiments of this specification, in order to further improve the accuracy of liveness detection, for the video to be detected whose liveness detection results after the first liveness detection model and the second liveness detection model are both non-liveness, a logistic regression model can be further used to generate a third non-liveness probability value according to the first non-liveness probability value and the second non-liveness probability value. If the third non-liveness probability value is less than the third threshold value, it can be indicated that the video to be detected contains a live body, and it is a real person face scan, and face scan authentication can be passed. If the third non-liveness probability value is greater than or equal to the third threshold value, it can be indicated that the video to be detected does not contain a live body, there is a risk of liveness attack, and face scan authentication will not be passed.
[0112] Of course, preset weights may be set for the first non-live object probability value and the second non-live object probability value respectively, so that the sum of the products of the first non-live object probability value and the second non-live object probability value and their respective preset weights is used as the third non-live object probability value, which is convenient and quick.
[0113] In the embodiments of this specification, there is also provided Figure 1 A training example of the first living body detection model used in the scheme.
[0114] Figure 2 The following is a flow chart of a method for training a liveness detection model provided in an embodiment of this specification. From a program perspective, the execution subject of the process can be a cloud server. Figure 2 As shown, the process may include the following steps:
[0115] Step 202: Obtain a set of video compression data samples.
[0116] Step 204: In the process of decoding at least part of the video compression data samples in the video compression data sample set, extract the video compression domain information of the video compression data samples to obtain video compression domain information samples.
[0117] Step 206: Determine a living body classification label of the video compression domain information sample corresponding to the video compression data sample according to a preset living body classification result of the video compression data sample.
[0118] Step 208: training a classification model using the video compression domain information sample carrying the live body classification label to obtain a live body detection model; the live body detection model is used to perform live body detection on the video compression domain information extracted from the compressed data of the video to be detected.
[0119] In the embodiment of the present specification, after collecting the video compression data samples, the video compression domain information samples are obtained by partially decoding each video compression data. Subsequently, according to the actual situation of whether the decompressed video corresponding to the video compression data sample contains a live user, the live classification label of the video compression domain information sample can be determined.
[0120] For example, if the decompressed video corresponding to the video compression data sample 1 contains a live user, then the live classification label of the video compression domain information sample 1 can be live. If the decompressed video corresponding to the video compression data sample 2 does not contain a live user, then the live classification label of the video compression domain information sample 2 can be non-live. The live classification labels of other video compression domain information samples can be deduced in this way, which will not be repeated here.
[0121] By inputting the video compression domain information sample carrying the live body classification label into the classification model, the probability value predicted by the classification model that the video compression domain information sample does not contain a live body (i.e., the non-live body probability prediction value) can be obtained. Then, the classification model can be optimized according to the non-live body probability prediction value and the live body classification label to obtain a live body detection model that can perform live body detection on the video compression domain information (i.e., Figure 1 The first liveness detection model used in the scheme).
[0122] Specifically, each of the video compression domain information samples may include: a key frame image, motion vector data corresponding to the key frame image, and residual data corresponding to the key frame image; the classification model may include a first classification sub-model, a second classification sub-model, and a third classification sub-model; the first classification sub-model, the second classification sub-model, and the third classification sub-model share a fully connected layer and an output layer; the first classification sub-model, the second classification sub-model, and the third classification sub-model may all belong to a convolutional neural network model; for example, a ResNet18 model.
[0123] The training of the classification model using the video compression domain information sample carrying the living body classification label may specifically include:
[0124] The key frame image, the motion vector data, and the residual data are respectively input into the first classification sub-model, the second classification sub-model, and the third classification sub-model to obtain a non-living body probability prediction value output by the output layer.
[0125] With the goal of minimizing the difference between the non-living probability prediction value and the living classification label carried by the video compression domain information sample, the model parameters of the first classification sub-model, the second classification sub-model and the third classification sub-model are optimized.
[0126] The specific meanings of the key frame image, the motion vector data, and the residual data are as follows: Figure 1 The embodiments are described in detail in the embodiment and will not be repeated here.
[0127] Furthermore, the fully connected layer can be used to receive the first feature vector, the second feature vector and the third feature vector respectively sent by the first classification sub-model, the second classification sub-model and the third classification sub-model, and to perform summation processing on the first feature vector, the second feature vector and the third feature vector to obtain a fused feature vector; the second output layer can be used to determine the non-living probability prediction value based on the fused feature vector.
[0128] A training method for a liveness detection model provided in an embodiment of the present specification can generate a liveness detection model for liveness detection based on video compression domain information, so that when liveness detection is required, a first liveness detection model pre-trained based on the training method can be used to generate a first non-liveness probability value according to the video compression domain information extracted in the process of decoding the compressed data of the video to be detected, and then determine the liveness detection result based on the first non-liveness probability value. In this scheme, since the video compression domain information generated in the video decoding process contains a large amount of key information in the video to be detected, the accuracy of the liveness detection result generated based on the video compression domain information can be guaranteed. At the same time, since the information generated in the video decoding process can be used to generate the liveness detection result, there is no need to wait until the video compression data is completely decoded before generating the liveness detection result, which can reduce the time consumed by the video decoding process to improve the efficiency and real-time performance of liveness detection.
[0129] Figure 3 The embodiments of this specification provide corresponding to Figure 1 A schematic diagram of a lane flow chart of a liveness detection method in FIG. Figure 3 As shown, the liveness detection process may involve execution entities such as image acquisition equipment and liveness detection equipment.
[0130] During the image acquisition stage, the image acquisition device can acquire the video to be detected while the user is performing face recognition, and compress the video to be detected to obtain compressed data, and then send the compressed data of the video to be detected to the liveness detection device.
[0131] In the liveness detection stage, the liveness detection device can partially decode the compressed data using the first video decoder and extract the video compression domain information. The liveness detection device can further perform liveness detection on the video compression domain information using the first liveness detection model to obtain a first non-liveness probability value.
[0132] If the first non-living body probability value is less than the first threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0133] If the first non-liveness probability value is greater than or equal to the first threshold, the liveness detection device can use the second video decoder to decode the compressed data of the video to be detected to obtain decompressed video data to be detected; and can use the second liveness detection model to perform liveness detection on the decompressed video data to be detected to obtain a second non-liveness probability value.
[0134] If the second non-living body probability value is less than the second threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0135] If the second non-live body probability value is greater than or equal to a second threshold, a third non-live body probability value is generated according to the first non-live body probability value and the second non-live body probability value by using a logistic regression model.
[0136] If the third non-living body probability value is less than the third threshold, a detection result is generated indicating that the video to be detected contains a living body; if the judgment result indicates that the third non-living body probability value is greater than or equal to the third threshold, a detection result is generated indicating that the video to be detected does not contain a living body.
[0137] Based on the same inventive concept, the embodiments of this specification also provide a device corresponding to the above method.
[0138] in, Figure 4 The embodiments of this specification provide corresponding to Figure 1 A structural schematic diagram of a living body detection device.
[0139] like Figure 4 As shown, the device may include:
[0140] The acquisition module 401 acquires compressed data of the video to be detected.
[0141] The extraction module 402 extracts video compression domain information during the decoding of the compressed data of the video to be detected.
[0142] The detection module 403 performs liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is obtained by training a first classification model using a video compression domain information sample extracted from a video compression data sample.
[0143] The result generating module 404 generates a detection result indicating that the video to be detected contains a living body if the first non-living body probability value is less than a first threshold.
[0144] based on Figure 4The present specification also provides some specific implementation schemes of the device, which are described below.
[0145] Optionally, extracting video compression domain information during decoding the compressed data of the video to be detected specifically includes:
[0146] In the process of decoding the compressed data of the video to be detected by using the first video decoder, video compression domain information is extracted; the video compression domain information includes: key frame images, motion vector data corresponding to the key frame images, and residual data corresponding to the key frame images.
[0147] Optionally, the first classification model includes a first classification sub-model, a second classification sub-model, and a third classification sub-model; the first classification sub-model, the second classification sub-model, and the third classification sub-model share a first fully connected layer and a first output layer; the first classification sub-model, the second classification sub-model, and the third classification sub-model all belong to a convolutional neural network model.
[0148] The performing liveness detection on the video compression domain information using the first liveness detection model to obtain a first non-liveness probability value specifically includes:
[0149] The key frame image, the motion vector data, and the residual data are respectively input into the first classification sub-model, the second classification sub-model, and the third classification sub-model to obtain a first non-living body probability value output by the first output layer.
[0150] Optionally, the first fully connected layer is used to receive the first feature vector, the second feature vector and the third feature vector sent by the first classification sub-model, the second classification sub-model and the third classification sub-model respectively, and to sum the first feature vector, the second feature vector and the third feature vector to obtain a first fused feature vector.
[0151] The output layer is used to determine the probability that the video to be detected does not contain a living body according to the first fused feature vector, and obtain the first non-living body probability value.
[0152] Optionally, after performing liveness detection on the video compression domain information using the first liveness detection model to obtain a first non-liveness probability value, the method further includes:
[0153] If the first non-living body probability value is greater than or equal to a first threshold, the compressed data of the to-be-detected video is decoded by using a second video decoder to obtain decompressed to-be-detected video data.
[0154] The second liveness detection model is used to perform liveness detection on the decompressed video data to be detected to obtain a second non-liveness probability value; the second liveness detection model is obtained by training a second classification model using the decompressed video data samples.
[0155] If the second non-living body probability value is less than a second threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0156] Optionally, the decompressed video data includes video frame images in RGB format.
[0157] The second classification model includes a fourth classification sub-model, a fifth classification sub-model, and a sixth classification sub-model; the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model share a second fully connected layer and a second output layer; the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model all belong to convolutional neural network models.
[0158] The method of performing liveness detection on the decompressed video data to be detected by using the second liveness detection model to obtain a second non-liveness probability value specifically includes:
[0159] The red component value, green component value and blue component value of the video frame image in RGB format are respectively input into the fourth classification sub-model, the fifth classification sub-model and the sixth classification sub-model to obtain the second non-living body probability value output by the second output layer.
[0160] Optionally, the second fully connected layer is used to receive the fourth eigenvector, the fifth eigenvector and the sixth eigenvector sent by the fourth classification sub-model, the fifth classification sub-model and the sixth classification sub-model respectively, and to perform summing processing on the fourth eigenvector, the fifth eigenvector and the sixth eigenvector to obtain a second fused feature vector.
[0161] The second output layer is used to determine the probability that the video to be detected does not contain a living body according to the second fused feature vector, and obtain the second non-living body probability value.
[0162] Optionally, after performing liveness detection on the decompressed video data to be detected by using the second liveness detection model to obtain a second non-liveness probability value, the method further includes:
[0163] If the second non-liveness probability value is greater than or equal to a second threshold, a third non-liveness probability value is generated according to the first non-liveness probability value and the second non-liveness probability value using a logistic regression model; the logistic regression model is obtained by training an initial logistic regression model using the first non-liveness probability value sample and the second non-liveness probability value sample; the first non-liveness probability value sample is obtained by performing liveness detection on a video compression domain information sample extracted from a video compression data sample using the first liveness detection model, and the second non-liveness probability value sample is obtained by performing liveness detection on a decompressed video data sample corresponding to the video compression data sample using the second liveness detection model.
[0164] It is determined whether the third non-living body probability value is less than a third threshold value to obtain a determination result.
[0165] If the judgment result indicates that the third non-living body probability value is less than a third threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0166] If the judgment result indicates that the third non-living body probability value is greater than or equal to a third threshold, a detection result indicating that the video to be detected does not contain a living body is generated.
[0167] The embodiment of this specification provides a liveness detection device. When liveness detection is required, a first liveness detection model that has been pre-trained can be used to generate a first non-liveness probability value based on the video compression domain information extracted during the decoding of the compressed data of the video to be detected, and then the liveness detection result is determined based on the first non-liveness probability value. In this solution, since the video compression domain information generated during the video decoding process contains a large amount of key information in the video to be detected, the accuracy of the liveness detection result generated based on the video compression domain information can be guaranteed. At the same time, since the information generated during the video decoding process can be used to generate the liveness detection result, there is no need to wait until the video compression data is completely decoded before generating the liveness detection result, which can reduce the time consumed by the video decoding process to improve the efficiency and real-time performance of liveness detection.
[0168] Figure 5 The embodiments of this specification provide corresponding to Figure 2 A schematic diagram of the structure of a training device for a liveness detection model. Figure 5 As shown, the device may include:
[0169] The acquisition module 501 acquires a set of video compression data samples.
[0170] The extraction module 502 extracts the video compression domain information of the video compression data samples during decoding of at least part of the video compression data samples in the video compression data sample set to obtain video compression domain information samples.
[0171] The determination module 503 determines the living body classification label of the video compression domain information sample corresponding to the video compression data sample according to the preset living body classification result of the video compression data sample.
[0172] The training module 504 uses the video compression domain information samples carrying the live body classification label to train the classification model to obtain a live body detection model; the live body detection model is used to perform live body detection on the video compression domain information extracted from the compressed data of the video to be detected.
[0173] based on Figure 5 The present specification also provides some specific implementation schemes of the device, which are described below.
[0174] Optionally, the video compression domain information sample includes: a key frame image, motion vector data corresponding to the key frame image, and residual data corresponding to the key frame image.
[0175] The classification model includes a first classification sub-model, a second classification sub-model, and a third classification sub-model; the first classification sub-model, the second classification sub-model, and the third classification sub-model share a fully connected layer and an output layer; the first classification sub-model, the second classification sub-model, and the third classification sub-model all belong to a convolutional neural network model.
[0176] The training of the classification model using the video compression domain information sample carrying the living body classification label specifically includes:
[0177] The key frame image, the motion vector data, and the residual data are respectively input into the first classification sub-model, the second classification sub-model, and the third classification sub-model to obtain a non-living body probability prediction value output by the output layer.
[0178] With the goal of minimizing the difference between the non-living probability prediction value and the living classification label carried by the video compression domain information sample, the model parameters of the first classification sub-model, the second classification sub-model and the third classification sub-model are optimized.
[0179] Optionally, the fully connected layer is used to receive the first feature vector, the second feature vector and the third feature vector respectively sent by the first classification sub-model, the second classification sub-model and the third classification sub-model, and to sum the first feature vector, the second feature vector and the third feature vector to obtain a fused feature vector.
[0180] The output layer is used to determine the non-living body probability prediction value according to the fused feature vector.
[0181] The embodiment of this specification provides a training device for a liveness detection model. When liveness detection is required, a first liveness detection model that has been pre-trained can be used to generate a first non-liveness probability value based on the video compression domain information extracted during the decoding of the compressed data of the video to be detected, and then the liveness detection result is determined based on the first non-liveness probability value. In this solution, since the video compression domain information generated during the video decoding process contains a large amount of key information in the video to be detected, the accuracy of the liveness detection result generated based on the video compression domain information can be guaranteed. At the same time, since the information generated during the video decoding process can be used to generate the liveness detection result, there is no need to wait until the video compression data is completely decoded before generating the liveness detection result, which can reduce the time consumed by the video decoding process to improve the efficiency and real-time performance of liveness detection.
[0182] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method.
[0183] in, Figure 6 The embodiments of this specification provide corresponding to Figure 1 A structural schematic diagram of a living body detection device.
[0184] like Figure 6 As shown, the device 600 may include:
[0185] at least one processor 610; and,
[0186] A memory 630 is communicatively connected to the at least one processor; wherein,
[0187] The memory 630 stores instructions 620 executable by the at least one processor 610. The instructions are executed by the at least one processor 610 to enable the at least one processor 610 to:
[0188] Obtaining compressed data of the video to be detected;
[0189] In the process of decoding the compressed data of the video to be detected, extracting the video compression domain information;
[0190] Performing liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is obtained by training a first classification model using a video compression domain information sample extracted from a video compression data sample;
[0191] If the first non-living body probability value is less than a first threshold, a detection result indicating that the video to be detected contains a living body is generated.
[0192] in, Figure 7 The embodiments of this specification provide corresponding to Figure 2 A schematic diagram of the structure of a training device for a liveness detection model. Figure 7 As shown, the device 700 may include:
[0193] at least one processor 710; and,
[0194] A memory 730 in communication with the at least one processor; wherein,
[0195] The memory 730 stores instructions 720 that can be executed by the at least one processor 710. The instructions are executed by the at least one processor 710 to enable the at least one processor 710 to:
[0196] Obtain a video compression data sample set;
[0197] In a process of decoding at least part of the video compression data samples in the video compression data sample set, extracting video compression domain information of the video compression data samples to obtain video compression domain information samples;
[0198] Determining a living body classification label of the video compression domain information sample corresponding to the video compression data sample according to a preset living body classification result of the video compression data sample;
[0199] The classification model is trained using the video compression domain information samples carrying the live body classification label to obtain a live body detection model; the live body detection model is used to perform live body detection on the video compression domain information extracted from the compressed data of the video to be detected.
[0200] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. Figure 6 and Figure 7 As for the device shown, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0201] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0202] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0203] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0204] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0205] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0206] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0207] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0208] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0209] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0210] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0211] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0212] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0213] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0214] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0215] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for detecting liveness, include: Obtaining compressed data of the video to be detected; In the process of decoding the compressed data of the video to be detected, extracting the video compression domain information; Performing liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is trained using a video compression domain information sample extracted from a video compression data sample; inputting the video compression domain information into the first liveness detection model to obtain the first non-liveness probability value; If the first non-living body probability value is less than a first threshold, a detection result indicating that the video to be detected contains a living body is generated.
2. According to the method as claimed in claim 1, the video compression domain information includes multiple key frame images; the input of the first living body detection model includes a key frame image whose acquisition timing is in the middle position among the multiple key frame images.
3. The method according to claim 1, wherein in the process of decoding the compressed data of the video to be detected, the video compression domain information is extracted, specifically: include: In the process of decoding the compressed data of the video to be detected by using the first video decoder, extracting the video compression domain information; The video compression domain information includes: a key frame image, motion vector data corresponding to the key frame image, and residual data corresponding to the key frame image.
4. The method according to claim 3, wherein the first living body detection model is obtained by training the first classification model using the video compression domain information sample extracted from the video compression data sample; The first classification model includes a first classification sub-model, a second classification sub-model, and a third classification sub-model; the first classification sub-model, the second classification sub-model, and the third classification sub-model share a first fully connected layer and a first output layer; the first classification sub-model, the second classification sub-model, and the third classification sub-model all belong to a convolutional neural network model; The first liveness detection model is used to perform liveness detection on the video compression domain information to obtain a first non-liveness probability value. include: The key frame image, the motion vector data, and the residual data are respectively input into the first classification sub-model, the second classification sub-model, and the third classification sub-model to obtain a first non-living body probability value output by the first output layer.
5. The method according to claim 4, wherein the first fully connected layer is used to receive the first feature vector, the second feature vector and the third feature vector respectively sent by the first classification sub-model, the second classification sub-model and the third classification sub-model, and to perform summation processing on the first feature vector, the second feature vector and the third feature vector to obtain a first fused feature vector; The first output layer is used to determine the probability that the video to be detected does not contain a living body according to the first fused feature vector, and obtain the first non-living body probability value.
6. The method according to claim 5, wherein the first feature vector, the second feature vector and the third feature vector have the same data dimension; wherein the first feature vector, the second feature vector and the third feature vector are summed to obtain a first fused feature vector, specifically include: The feature data of each dimension of the first feature vector, the second feature vector and the third feature vector are summed to obtain a first fused feature vector having the same data dimension as the first feature vector, the second feature vector and the third feature vector.
7. The method according to claim 5, wherein the first output layer is used to determine the probability that the video to be detected does not contain a living body according to the first fused feature vector, and obtain the first non-living body probability value, specifically include: The first output layer performs binary classification processing based on the first fused feature vector, and outputs the probability that the video to be detected does not contain a living body and the probability that the video to be detected contains a living body; The probability that the video to be detected does not contain a living body is used as a first non-living body probability value.
8. The method of claim 1, further comprising: include: If the first non-living body probability value is greater than or equal to a first threshold, decoding the compressed data of the to-be-detected video using a second video decoder to obtain decompressed to-be-detected video data; Performing liveness detection on the decompressed video data to be detected using a second liveness detection model to obtain a second non-liveness probability value; the second liveness detection model is obtained by training a second classification model using the decompressed video data sample; If the second non-living body probability value is less than a second threshold, a detection result indicating that the video to be detected contains a living body is generated.
9. The method according to claim 8, wherein in the process of decoding the compressed data of the video to be detected, the video compression domain information is extracted, specifically: include: In the process of decoding the compressed data of the video to be detected by using the first video decoder, extracting the video compression domain information; wherein the first video decoder and the second video decoder are implemented based on a single video decoder; Alternatively, the first video decoder and the second video decoder are implemented based on two video decoders.
10. The method of claim 8, wherein the decompressed video data comprises a video frame image in RGB format; The second classification model includes a fourth classification sub-model, a fifth classification sub-model, and a sixth classification sub-model; the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model share a second fully connected layer and a second output layer; the fourth classification sub-model, the fifth classification sub-model, and the sixth classification sub-model all belong to a convolutional neural network model; The second liveness detection model is used to perform liveness detection on the decompressed video data to be detected, and a second non-liveness probability value is obtained. include: The red component value, green component value and blue component value of the video frame image in RGB format are respectively input into the fourth classification sub-model, the fifth classification sub-model and the sixth classification sub-model to obtain the second non-living body probability value output by the second output layer.
11. The method according to claim 10, wherein the second fully connected layer is used to receive the fourth feature vector, the fifth feature vector and the sixth feature vector respectively sent by the fourth classification sub-model, the fifth classification sub-model and the sixth classification sub-model, and to perform summation processing on the fourth feature vector, the fifth feature vector and the sixth feature vector to obtain a second fused feature vector; The second output layer is used to determine the probability that the video to be detected does not contain a living body according to the second fused feature vector, and obtain the second non-living body probability value.
12. The method according to claim 11, wherein the fourth eigenvector, the fifth eigenvector and the sixth eigenvector have the same data dimension; wherein the fourth eigenvector, the fifth eigenvector and the sixth eigenvector are summed to obtain the second fused eigenvector, specifically: include: A summation process is performed on the feature data of each dimension of the fourth feature vector, the fifth feature vector and the sixth feature vector to obtain a second fused feature vector having the same data dimension as the fourth feature vector, the fifth feature vector and the sixth feature vector.
13. The method according to claim 11, wherein the second output layer is used to determine the probability that the video to be detected does not contain a living body according to the second fused feature vector, and obtain the second non-living body probability value, specifically include: The second output layer performs binary classification processing based on the second fused feature vector, and outputs the probability that the video to be detected does not contain a living body and the probability that the video to be detected contains a living body; The probability that the video to be detected does not contain a living body is used as a second non-living body probability value.
14. The method of claim 8, further comprising: include: If the second non-live body probability value is greater than or equal to a second threshold, generating a third non-live body probability value according to the first non-live body probability value and the second non-live body probability value; Determine whether the third non-living body probability value is less than a third threshold value, and obtain a determination result; If the judgment result indicates that the third non-living body probability value is less than a third threshold, a detection result indicating that the video to be detected contains a living body is generated.
15. The method according to claim 14, wherein the third non-live probability value is generated according to the first non-live probability value and the second non-live probability value, specifically: include: A third non-liveliness probability value is generated according to the first non-liveliness probability value and the second non-liveliness probability value using a logistic regression model; the logistic regression model is obtained by training an initial logistic regression model using the first non-liveliness probability value sample and the second non-liveliness probability value sample; the first non-liveliness probability value sample is obtained by performing liveness detection on a video compression domain information sample extracted from a video compression data sample using the first liveness detection model, and the second non-liveliness probability value sample is obtained by performing liveness detection on a decompressed video data sample corresponding to the video compression data sample using the second liveness detection model.
16. The method according to claim 14, wherein the third non-live probability value is generated according to the first non-live probability value and the second non-live probability value, specifically: include: Setting preset weights for the first non-live object probability value and the second non-live object probability value respectively; The product of the first non-live body probability value and the preset weight corresponding to the first non-live body probability value and the product of the second non-live body probability value and the preset weight corresponding to the second non-live body probability value are summed to generate a third non-live body probability value.
17. The method of claim 14, further comprising: include: If the judgment result indicates that the third non-living body probability value is greater than or equal to a third threshold, a detection result indicating that the video to be detected does not contain a living body is generated.
18. The method according to claim 1, wherein the video to be detected is a video obtained by capturing video of the user using a face recognition terminal during the face recognition process of the user.
19. A training method for a liveness detection model. include: Obtain a video compression data sample set; In a process of decoding at least part of the video compression data samples in the video compression data sample set, extracting video compression domain information of the video compression data samples to obtain video compression domain information samples; Determining a living body classification label of the video compression domain information sample corresponding to the video compression data sample according to a preset living body classification result of the video compression data sample; A liveness detection model is obtained by training the video compression domain information sample carrying the liveness classification label; the liveness detection model is used to perform liveness detection on the video compression domain information extracted from the compressed data of the video to be detected; the input of the liveness detection model is the video compression domain information.
20. The method according to claim 19, wherein the liveness detection model is obtained by training the video compression domain information sample carrying the liveness classification label, specifically: include: Using the video compression domain information sample carrying the living body classification label to train the classification model to obtain a living body detection model; The video compression domain information sample includes: a key frame image, motion vector data corresponding to the key frame image, and residual data corresponding to the key frame image; The classification model includes a first classification sub-model, a second classification sub-model, and a third classification sub-model; the first classification sub-model, the second classification sub-model, and the third classification sub-model share a fully connected layer and an output layer; the first classification sub-model, the second classification sub-model, and the third classification sub-model all belong to a convolutional neural network model; The training of the classification model using the video compression domain information sample carrying the living body classification label specifically includes: Inputting the key frame image, the motion vector data, and the residual data into the first classification sub-model, the second classification sub-model, and the third classification sub-model respectively, to obtain a non-living body probability prediction value output by the output layer; With the goal of minimizing the difference between the non-living probability prediction value and the living classification label carried by the video compression domain information sample, the model parameters of the first classification sub-model, the second classification sub-model and the third classification sub-model are optimized.
21. The method of claim 20, wherein the fully connected layer is used to receive the first feature vector, the second feature vector and the third feature vector respectively sent by the first classification sub-model, the second classification sub-model and the third classification sub-model, and to perform summation processing on the first feature vector, the second feature vector and the third feature vector to obtain a fused feature vector; The output layer is used to determine the non-living body probability prediction value according to the fused feature vector.
22. A living body detection device, include: An acquisition module is used to acquire compressed data of the video to be detected; An extraction module, which extracts video compression domain information during decoding of compressed data of the video to be detected; a detection module, performing liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is trained using a video compression domain information sample extracted from a video compression data sample; the video compression domain information is input into the first liveness detection model to obtain the first non-liveness probability value; The result generating module generates a detection result indicating that the video to be detected contains a living body if the first non-living body probability value is less than a first threshold.
23. A training device for a liveness detection model, include: An acquisition module, which acquires a set of video compression data samples; An extraction module, which extracts video compression domain information of the video compression data samples in a process of decoding at least part of the video compression data samples in the video compression data sample set, and obtains video compression domain information samples; A determination module, which determines a living body classification label of the video compression domain information sample corresponding to the video compression data sample according to a preset living body classification result of the video compression data sample; A training module is used to train a liveness detection model using the video compression domain information samples carrying the liveness classification label; the liveness detection model is used to perform liveness detection on the video compression domain information extracted from the compressed data of the video to be detected; the input of the liveness detection model is the video compression domain information.
24. A liveness detection device, include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Obtaining compressed data of the video to be detected; In the process of decoding the compressed data of the video to be detected, extracting the video compression domain information; Performing liveness detection on the video compression domain information using a first liveness detection model to obtain a first non-liveness probability value; the first liveness detection model is trained using a video compression domain information sample extracted from a video compression data sample; inputting the video compression domain information into the first liveness detection model to obtain the first non-liveness probability value; If the first non-living body probability value is less than a first threshold, a detection result indicating that the video to be detected contains a living body is generated.
Citation Information
Patent Citations
Human face living body verification method and device
CN109670413A
Human face living body detection method
CN110598580A
Living body video picture processing method and device, computer equipment and storage medium
CN111428568A
Video sensitive character recognition method, system and equipment oriented to compressed domain
CN112990273A
System and method for liveness detection
US20190205680A1
