Living body detection method, device, electronic device and storage medium
By extracting the features and difference images of multi-frame target face images, the efficiency and accuracy of live body detection in face recognition technology are achieved, the problem of low security in face recognition technology is solved, and the security of identity verification is enhanced. .
Patent Information
- Application Number
- CN201911063398.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-31
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2039-10-31
AI Technical Summary
In existing face recognition technology, identity verification based on face recognition has the problem of low security. Illegal logins can be deceived by forging faces, resulting in low accuracy of liveness detection.
By extracting multiple frames of target face images from the video to be detected, based on the feature extraction results of each frame of the target face image and the difference images of every two adjacent frames of target face images, the live detection result is determined, using the user's multi-frame differences Larger face images are detected silently to improve detection efficiency and resist screen duplication attacks.
It improves the accuracy and efficiency of liveness detection, enhances the security of identity verification, and effectively resists screen copy attacks.
Smart Images

Figure CN112749603B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a living body detection method, device, electronic device and storage medium. Background Art
[0002] When face recognition technology is used for identity authentication, the user's face photo is first obtained in real time through an image acquisition device, and then the real-time face photo is compared with the pre-stored face photo. If the comparison is consistent, the identity authentication is passed. However, during the face recognition process, illegal registrants can "cheat" the image acquisition device by forging a face, making the identity authentication based on face recognition less secure. At present, how to improve the accuracy of liveness detection in identity authentication based on face recognition technology is a research hotspot in this field. Summary of the invention
[0003] In view of this, the present disclosure at least provides a liveness detection method, device, electronic device and storage medium, which can improve the detection efficiency during the liveness detection process.
[0004] In a first aspect, an optional implementation of the present disclosure provides a liveness detection method, comprising: extracting multiple frames of target face images from an acquired video to be detected; obtaining a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of target face images; obtaining a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images; and determining a liveness detection result of the video to be detected based on the first detection result and the second detection result.
[0005] It can extract multiple frames of target face images from the video to be detected, and then obtain a first detection result based on the feature extraction result of each frame of the target face image in the multiple frames, and obtain a second detection result based on the differential image of every two adjacent target face images in the multiple frames; and then determine the liveness detection result of the video to be detected based on the first detection result and the second detection result. In this method, the user does not need to make any specified actions, but uses multiple frames of the user's face images with large differences to silently detect whether the user is alive, which has higher detection efficiency.
[0006] At the same time, the image obtained by reshooting the screen will lose a lot of image information of the original image. If the video to be detected is a face video obtained by reshooting the screen, the loss of image information will make it impossible to detect the user's multi-frame face images with large differences silently, thereby effectively resisting the attack method of screen reshooting.
[0007] In an optional implementation of the first aspect, extracting multiple frames of target face images from the acquired video to be detected includes: determining the multiple frames of target face images from the video to be detected based on the similarity between the multiple frames of face images included in the video to be detected.
[0008] In an optional implementation of the first aspect, the similarity between every two adjacent target face images in the multiple frames of target face images is lower than a first value.
[0009] In this way, there are large differences between the multiple target face images obtained, and thus the detection results can be obtained with higher accuracy.
[0010] In a second aspect, an optional implementation of the present disclosure also provides a liveness detection method, comprising: extracting multiple frames of target face images from an acquired video to be detected, wherein the similarity between adjacent target face images in the multiple frames of target face images is lower than a first value; based on the multiple frames of target face images, determining a liveness detection result of the video to be detected.
[0011] In this way, multiple frames of target face images are extracted from the video to be detected, and the similarity between adjacent target face images in the multiple frames of target face images is lower than the first value, and then based on the target face images, the liveness detection result of the video to be detected is determined. The user does not need to make any specified actions, but uses the user's multiple frames of face images with large differences to silently detect whether the user is alive, and the detection efficiency is higher.
[0012] At the same time, the image obtained by reshooting the screen will lose a lot of image information of the original image. If the video to be detected is a face video obtained by reshooting the screen, the loss of image information will make it impossible to detect subtle changes in the user's appearance, thereby effectively resisting the attack method of screen reshooting.
[0013] In an optional implementation of the second aspect, determining the liveness detection result of the video to be detected based on the multiple frames of target facial images includes: obtaining a first detection result based on a feature extraction result of each frame of the target facial images in the multiple frames of target facial images, and / or obtaining a second detection result based on a differential image of every two adjacent target facial images in the multiple frames of target facial images; determining the liveness detection result of the video to be detected based on the first detection result and / or the second detection result.
[0014] In this way, the differences between target face images can be better captured and the detection accuracy can be improved.
[0015] In an optional implementation of any of the above aspects, extracting multiple frames of target face images from the acquired video to be detected includes:
[0016] Determine a first target face image among the multiple frames of target face images from the video to be detected;
[0017] Based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected is determined, wherein the similarity between the second target facial image and the first target facial image meets a preset similarity requirement.
[0018] In an optional implementation of any of the above aspects, the similarity requirement includes:
[0019] The second target facial image is a facial image having the smallest similarity with the first target facial image among the multiple frames of continuous facial images.
[0020] In this way, there are large differences between the multiple target face images obtained, and thus the detection results can be obtained with higher accuracy.
[0021] In an optional implementation of any of the above aspects, the method further includes:
[0022] Dividing the video to be detected into multiple segments, wherein each segment includes multiple frames of continuous face images;
[0023] The step of determining the first target face image in the multiple frames of target face images from the video to be detected includes:
[0024] Selecting a first target face image from a first segment of the plurality of segments;
[0025] The method of determining, based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected comprises:
[0026] Based on the first target facial image, a second target facial image is determined from a second segment adjacent to the first segment among the multiple segments.
[0027] In this way, by determining the target facial image by dividing it into multiple segments, the target facial image can be dispersed throughout the entire video to be detected, thereby better capturing the changes in the user's appearance during the duration of the video to be detected.
[0028] In an optional implementation of any of the above aspects, the similarity between the first target face image and the second target face image in the multiple frames of target face images is obtained based on the following method:
[0029] Obtaining a face difference image between the first target face image and the second target face image based on a pixel value of each pixel in the first target face image and a pixel value of each pixel in the second target face image;
[0030] Obtaining the variance corresponding to the face difference image according to the pixel value of each pixel point in the face difference image;
[0031] The variance is used as the similarity between the first target face image and the second target face image.
[0032] Thus, the similarity obtained by this method has the characteristic of simple calculation.
[0033] In an optional implementation manner of any of the above aspects, before extracting multiple frames of target face images from the acquired video to be detected, the method further includes:
[0034] Obtain key point information of each face image in multiple frames of face images included in the video to be detected;
[0035] Based on the key point information of each face image in the multiple face images, aligning the multiple face images to obtain the aligned face images;
[0036] The step of extracting multiple frames of target face images from the acquired video to be detected includes:
[0037] The multiple frames of target face images are extracted from the multiple frames of face images after the alignment process.
[0038] In this way, the interference of subtle changes in the human face caused by changes in head position and direction can be avoided, thereby obtaining more accurate detection results.
[0039] In an optional implementation of any of the above aspects, obtaining the first detection result based on the feature data of each frame of the target face image in the multiple frames of target face images includes:
[0040] Performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data;
[0041] Based on the first fused feature data, the first detection result is obtained.
[0042] In this way, by performing multi-dimensional feature extraction and time-series feature fusion on multiple frames of target face images, the feature data corresponding to each frame of the target face image includes the characteristics of subtle changes in the face, thereby performing accurate liveness detection without the user having to make any specified actions.
[0043] In an optional implementation of any of the above aspects, the feature extraction result of each frame of the target face image includes: first intermediate feature data corresponding to each level of first feature extraction processing obtained by performing multi-level first feature extraction processing on the target face image;
[0044] The step of performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data includes:
[0045] For each level of first feature extraction processing, fusing the first intermediate feature data corresponding to each of the multiple frames of target face images in the first feature extraction processing of that level to obtain intermediate fused data corresponding to the first feature extraction processing of that level;
[0046] The first fused feature data is obtained based on the intermediate fused data respectively corresponding to the multi-level first feature extraction processing.
[0047] In this way, the features in the target face image are extracted at multiple levels, so that the feature data of the target face image finally obtained contains richer information, thereby improving the accuracy of liveness detection.
[0048] In an optional implementation of any of the above aspects, the fusing of the first intermediate feature data corresponding to the first feature extraction process of the multiple frames of target face images in the first feature extraction process of the level to obtain the intermediate fused data corresponding to the first feature extraction process of the level includes:
[0049] Based on the first intermediate feature data respectively corresponding to the plurality of frames of target face images in the first feature extraction process of the first level, obtaining a feature sequence corresponding to the first feature extraction process of the first level;
[0050] The feature sequence is input into a recurrent neural network for fusion processing to obtain intermediate fusion data corresponding to the first feature extraction processing of this level.
[0051] In this way, by fusing the spatially varying features of each target face image, the features of the face that change slightly over time can be better extracted, thereby increasing the accuracy of liveness detection.
[0052] In an optional implementation of any of the above aspects, before obtaining the feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data corresponding to the multiple frames of target facial images in the first feature extraction process of the level, the method further includes:
[0053] Performing global average pooling processing on first intermediate feature data corresponding to each frame of the target face image in the multiple frames of the target face image in the first feature extraction processing at this level, to obtain second intermediate feature data corresponding to each frame of the target face image in the first feature extraction processing at this level;
[0054] The step of obtaining a feature sequence corresponding to the first feature extraction process at this level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process at this level comprises:
[0055] According to the time sequence of the multiple frames of target facial images, the feature sequence is obtained based on the second intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target facial images at this level.
[0056] In this way, the first intermediate feature data can be transformed in dimension, simplifying the subsequent processing process.
[0057] In an optional implementation of any of the above aspects, the step of obtaining the first fused feature data based on the intermediate fused data corresponding to the multi-level first feature extraction process includes:
[0058] After the intermediate fusion data corresponding to the multi-level first feature extraction processing are spliced, a full connection process is performed to obtain the first fusion feature data.
[0059] In this way, the intermediate fusion data can be further fused, so that the first fusion feature data is affected by the intermediate fusion data corresponding to each level of first feature extraction processing, and the extracted first fusion feature data can better characterize the features of multiple frames of target face images.
[0060] In an optional implementation of any of the above aspects, the feature extraction result of each frame of the target face image is obtained in the following manner:
[0061] Performing a multi-level feature extraction process on the target face image to obtain first initial feature data corresponding to each first feature extraction process in the multi-level feature extraction process;
[0062] For each level of the first feature extraction processing, a fusion process is performed based on the first initial feature data of the first feature extraction processing of that level and the first initial feature data of at least one level of first feature extraction processing subsequent to the first feature extraction processing of that level to obtain the first intermediate feature data corresponding to the first feature extraction processing of that level, wherein the feature extraction result of the target facial image includes the first intermediate feature data corresponding to each level of the first feature extraction processing in the multiple levels of first feature extraction processing.
[0063] In this way, the facial features obtained by the first feature extraction process at each level can be more informative, and ultimately higher detection accuracy can be achieved.
[0064] In an optional implementation of any of the above aspects, the first initial feature data of the first feature extraction process of the level is fused with the first initial feature data of at least one level of first feature extraction process subsequent to the first feature extraction process of the level to obtain the first intermediate feature data corresponding to the first feature extraction process of the level, including:
[0065] The first initial feature data of the first feature extraction processing of the level and the first intermediate feature data corresponding to the first feature extraction processing of the lower level of the first feature extraction processing of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction processing of the level, wherein the first intermediate feature data corresponding to the lower level first feature extraction processing is obtained based on the first initial feature data of the lower level first feature extraction processing.
[0066] In this way, the facial features obtained by the first feature extraction process at each level can be more informative, and ultimately higher detection accuracy can be achieved.
[0067] In an optional implementation of any of the above aspects, the first initial feature data of the first feature extraction process of the level and the first intermediate feature data corresponding to the first feature extraction process of the lower level of the first feature extraction process of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of the level, including:
[0068] Up-sampling the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process to obtain up-sampled data corresponding to the first feature extraction process of the next level;
[0069] The up-sampled data corresponding to the first feature extraction process of this level and the first initial feature data are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of this level.
[0070] In this way, the features processed by deep feature extraction are upsampled after adjusting the number of channels, and added to the features processed by shallow feature extraction, so that the deep features can flow to the shallow features, making the information extracted by the shallow feature extraction process richer and increasing the detection accuracy.
[0071] In an optional implementation of any of the above aspects,
[0072] The obtaining of a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images comprises:
[0073] Performing cascade processing on the differential images of every two adjacent target face images in the multiple frames of target face images to obtain a differential cascade image;
[0074] Based on the differential cascaded image, the second detection result is obtained.
[0075] In this way, the change features can be better extracted from the multi-frame differential cascade images, thereby improving the accuracy of the second detection result.
[0076] In an optional implementation of any of the above aspects, obtaining the second detection result based on the differential cascaded image includes:
[0077] Performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image;
[0078] Performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data;
[0079] Based on the second fused feature data, the second detection result is obtained.
[0080] In this way, the change features can be better extracted from the multi-frame differential cascade images, thereby improving the accuracy of the second detection result.
[0081] In an optional implementation of any of the above aspects, performing feature extraction processing on the differential cascaded image to obtain a feature extraction result of the differential cascaded image includes:
[0082] Performing multi-level second feature extraction processing on the differential cascaded image to obtain second initial feature data corresponding to each level of the second feature extraction processing;
[0083] Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processes, a feature extraction result of the differential cascade image is obtained.
[0084] In this way, the differential cascade image is subjected to multi-level second feature extraction processing, the receptive field of feature extraction is increased, and richer information in the differential cascade image can be obtained.
[0085] In an optional implementation of any of the above aspects, obtaining a feature extraction result of the differential cascaded image based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing includes:
[0086] For each level of second feature extraction processing, the second initial feature data of the second feature extraction processing of the level is fused with the second initial feature data of at least one level of second feature extraction processing before the second feature extraction processing of the level, so as to obtain third intermediate feature data corresponding to the second feature extraction processing of the level;
[0087] The feature extraction result of the differential cascaded image includes third intermediate feature data corresponding to the multiple levels of second feature extraction processing.
[0088] In this way, the information obtained by each level of second feature extraction processing is richer, and this information can better characterize the change information in the differential image to improve the accuracy of the second detection result.
[0089] In an optional implementation of any of the above aspects, the second initial feature data of the second feature extraction process of the level is fused with the second initial feature data of the second feature extraction process of at least one level before the second feature extraction process of the level to obtain the third intermediate feature data corresponding to each level of the second feature extraction process, including:
[0090] Down-sampling the second initial feature data of the upper second feature extraction process of the second feature extraction process of the level to obtain down-sampled data corresponding to the second feature extraction process of the level;
[0091] The down-sampled data corresponding to the second feature extraction process of the stage and the second initial feature data are fused to obtain third intermediate feature data corresponding to the second feature extraction process of the stage.
[0092] In this way, the information obtained by the multi-level second feature extraction processing flows from the upper-level second feature extraction processing to the summer second feature extraction processing, so that the information obtained by each level of the second feature extraction processing is richer.
[0093] In an optional implementation of any of the above aspects, before performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data, the method further includes:
[0094] Performing global average pooling processing on the third intermediate feature data in the second feature extraction processing of each level of the differential cascade image, respectively, to obtain fourth intermediate feature matrices corresponding to the second feature extraction processing of each level of the differential cascade image;
[0095] The step of performing feature fusion on the feature extraction result of the differential cascaded image to obtain second fused feature data includes:
[0096] Feature fusion is performed on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data.
[0097] In this way, the third intermediate feature data can be transformed in dimension, simplifying the subsequent processing process.
[0098] In an optional implementation of any of the above aspects, the step of performing feature fusion on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascaded image to obtain the second fused feature data includes:
[0099] After the fourth intermediate feature matrices corresponding to the multi-level second feature extraction processing are spliced, a full connection process is performed to obtain the second fused feature data.
[0100] In an optional implementation of any of the above aspects, determining a liveness detection result for the video to be detected based on the first detection result and the second detection result includes:
[0101] The first detection result and the second detection result are weightedly summed to obtain the liveness detection result.
[0102] In this way, the first detection result and the second detection result are weighted and summed, and the two detection results are combined to obtain a more accurate liveness detection result.
[0103] In a third aspect, an optional implementation of the present disclosure provides a living body detection device, including:
[0104] An acquisition module is used to extract multiple frames of target face images from the acquired video to be detected;
[0105] A first detection module, configured to obtain a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of the target face image;
[0106] A second detection module, configured to obtain a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images;
[0107] A determination module is used to determine a liveness detection result of the video to be detected based on the first detection result and the second detection result.
[0108] In an optional implementation manner, the acquisition module, when extracting multiple frames of target face images from the acquired video to be detected, is used to:
[0109] Based on the similarity between the multiple frames of face images included in the video to be detected, the multiple frames of target face images are determined from the video to be detected.
[0110] In an optional implementation, the similarity between every two adjacent target face images in the multiple frames of target face images is lower than a first value.
[0111] In an optional implementation manner, the acquisition module, when extracting multiple frames of target face images from the acquired video to be detected, is used to:
[0112] Determine a first target face image among the multiple frames of target face images from the video to be detected;
[0113] Based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected is determined, wherein the similarity between the second target facial image and the first target facial image meets a preset similarity requirement.
[0114] In an optional implementation manner, the similarity requirement includes:
[0115] The second target facial image is a facial image having the smallest similarity with the first target facial image among the multiple frames of continuous facial images.
[0116] In an optional implementation manner, the acquisition device is further used for:
[0117] Dividing the video to be detected into multiple segments, wherein each segment includes multiple frames of continuous face images;
[0118] The acquisition device, when determining the first target face image in the plurality of frames of target face images from the video to be detected, is used to:
[0119] Selecting a first target face image from a first segment of the plurality of segments;
[0120] The acquisition device, when determining, based on the first target facial image, from multiple frames of continuous facial images in the video to be detected, a second target facial image adjacent to the first target facial image in the multiple frames of target facial images, is used to:
[0121] Based on the first target facial image, a second target facial image is determined from a second segment adjacent to the first segment among the multiple segments.
[0122] In an optional implementation manner, the similarity between the first target face image and the second target face image in the multiple frames of target face images is obtained based on the following method:
[0123] Obtaining a face difference image between the first target face image and the second target face image based on a pixel value of each pixel in the first target face image and a pixel value of each pixel in the second target face image;
[0124] Obtaining the variance corresponding to the face difference image according to the pixel value of each pixel point in the face difference image;
[0125] The variance is used as the similarity between the first target face image and the second target face image.
[0126] In an optional implementation manner, the acquisition module, before extracting multiple frames of target face images from the acquired video to be detected, is further used to:
[0127] Obtain key point information of each face image in multiple frames of face images included in the video to be detected;
[0128] Based on the key point information of each face image in the multiple face images, aligning the multiple face images to obtain the aligned face images;
[0129] The acquisition module, when extracting multiple frames of target face images from the acquired video to be detected, is used to:
[0130] The multiple frames of target face images are extracted from the multiple frames of face images after the alignment process.
[0131] In an optional implementation, when the first detection module obtains the first detection result based on the feature data of each target face image in the multiple frames of target face images, it is configured to:
[0132] Performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data;
[0133] Based on the first fused feature data, the first detection result is obtained.
[0134] In an optional implementation, the feature extraction result of each frame of the target face image includes: first intermediate feature data corresponding to each level of first feature extraction processing respectively obtained by performing multi-level first feature extraction processing on the target face image;
[0135] The first detection module, when performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data, is used to:
[0136] For each level of first feature extraction processing, fusing the first intermediate feature data corresponding to each of the multiple frames of target face images in the first feature extraction processing of that level to obtain intermediate fused data corresponding to the first feature extraction processing of that level;
[0137] The first fused feature data is obtained based on the intermediate fused data respectively corresponding to the multi-level first feature extraction processing.
[0138] In an optional implementation, the first detection module, when fusing the first intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target face images at the first level to obtain the intermediate fused data corresponding to the first feature extraction processing at the first level, is used to:
[0139] Based on the first intermediate feature data respectively corresponding to the plurality of frames of target face images in the first feature extraction process of the first level, obtaining a feature sequence corresponding to the first feature extraction process of the first level;
[0140] The feature sequence is input into a recurrent neural network for fusion processing to obtain intermediate fusion data corresponding to the first feature extraction processing of this level.
[0141] In an optional implementation, the first detection module, before obtaining a feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, is further configured to:
[0142] Performing global average pooling processing on first intermediate feature data corresponding to each frame of the target face image in the multiple frames of the target face image in the first feature extraction processing at this level, to obtain second intermediate feature data corresponding to each frame of the target face image in the first feature extraction processing at this level;
[0143] The first detection module, when obtaining a feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, is used to:
[0144] According to the time sequence of the multiple frames of target facial images, the feature sequence is obtained based on the second intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target facial images at this level.
[0145] In an optional implementation, when the first detection module obtains the first fused feature data based on the intermediate fused data corresponding to the multi-level first feature extraction process, it is configured to:
[0146] After the intermediate fusion data corresponding to the multi-level first feature extraction processing are spliced, a full connection process is performed to obtain the first fusion feature data.
[0147] In an optional implementation manner, the first detection module is used to obtain a feature extraction result of each frame of the target face image in the following manner:
[0148] Performing a multi-level feature extraction process on the target face image to obtain first initial feature data corresponding to each first feature extraction process in the multi-level feature extraction process;
[0149] For each level of the first feature extraction processing, a fusion process is performed based on the first initial feature data of the first feature extraction processing of that level and the first initial feature data of at least one level of first feature extraction processing subsequent to the first feature extraction processing of that level to obtain the first intermediate feature data corresponding to the first feature extraction processing of that level, wherein the feature extraction result of the target facial image includes the first intermediate feature data corresponding to each level of the first feature extraction processing in the multiple levels of first feature extraction processing.
[0150] In an optional embodiment, the first detection module, when performing a fusion process based on the first initial feature data of the first feature extraction process of the level and the first initial feature data of at least one level of first feature extraction process subsequent to the first feature extraction process of the level to obtain the first intermediate feature data corresponding to the first feature extraction process of the level, is used to:
[0151] The first initial feature data of the first feature extraction processing of the level and the first intermediate feature data corresponding to the first feature extraction processing of the lower level of the first feature extraction processing of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction processing of the level, wherein the first intermediate feature data corresponding to the lower level first feature extraction processing is obtained based on the first initial feature data of the lower level first feature extraction processing.
[0152] In an optional implementation, the first detection module, when fusing the first initial feature data of the first feature extraction process of the first level with the first intermediate feature data corresponding to the first feature extraction process of the lower level of the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level, is used to:
[0153] Up-sampling the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process to obtain up-sampled data corresponding to the first feature extraction process of the next level;
[0154] The up-sampled data corresponding to the first feature extraction process of this level and the first initial feature data are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of this level.
[0155] In an optional implementation,
[0156] The second detection module, when obtaining the second detection result based on the differential image of every two adjacent target face images in the multiple frames of target face images, is used to:
[0157] Performing cascade processing on the differential images of every two adjacent target face images in the multiple frames of target face images to obtain a differential cascade image;
[0158] Based on the differential cascaded image, the second detection result is obtained.
[0159] In an optional implementation, when the second detection module obtains the second detection result based on the differential cascaded image, it is configured to:
[0160] Performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image;
[0161] Performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data;
[0162] Based on the second fused feature data, the second detection result is obtained.
[0163] In an optional implementation, the second detection module, when performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image, is used to:
[0164] Performing multi-level second feature extraction processing on the differential cascaded image to obtain second initial feature data corresponding to each level of the second feature extraction processing;
[0165] Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processes, a feature extraction result of the differential cascade image is obtained.
[0166] In an optional implementation, the second detection module, when obtaining the feature extraction result of the differential cascade image based on the second initial feature data respectively corresponding to the multi-level second feature extraction process, is used to:
[0167] For each level of second feature extraction processing, the second initial feature data of the second feature extraction processing of the level is fused with the second initial feature data of at least one level of second feature extraction processing before the second feature extraction processing of the level, so as to obtain third intermediate feature data corresponding to the second feature extraction processing of the level;
[0168] The feature extraction result of the differential cascaded image includes third intermediate feature data corresponding to the multiple levels of second feature extraction processing.
[0169] In an optional embodiment, the second detection module, when fusing the second initial feature data of the second feature extraction process of the level with the second initial feature data of the second feature extraction process of at least one level before the second feature extraction process of the level to obtain the third intermediate feature data corresponding to each level of the second feature extraction process, is used to:
[0170] Down-sampling the second initial feature data of the upper second feature extraction process of the second feature extraction process of the level to obtain down-sampled data corresponding to the second feature extraction process of the level;
[0171] The down-sampled data corresponding to the second feature extraction process of the stage and the second initial feature data are fused to obtain third intermediate feature data corresponding to the second feature extraction process of the stage.
[0172] In an optional implementation, the second detection module, before performing feature fusion on the feature extraction result of the differential cascade image to obtain the second fused feature data, is further used to:
[0173] Performing global average pooling processing on the third intermediate feature data in the second feature extraction processing of each level of the differential cascade image, respectively, to obtain fourth intermediate feature matrices corresponding to the second feature extraction processing of each level of the differential cascade image;
[0174] The step of performing feature fusion on the feature extraction result of the differential cascaded image to obtain second fused feature data includes:
[0175] Feature fusion is performed on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data.
[0176] In an optional implementation manner, the second detection module, when performing feature fusion on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data, is used to:
[0177] After the fourth intermediate feature matrices corresponding to the multi-level second feature extraction processing are spliced, a full connection process is performed to obtain the second fused feature data.
[0178] In an optional implementation, the determination module, when determining the liveness detection result for the video to be detected based on the first detection result and the second detection result, is used to:
[0179] The first detection result and the second detection result are weightedly summed to obtain the liveness detection result.
[0180] In a fourth aspect, an optional implementation of the present disclosure provides a living body detection device, including:
[0181] An acquisition unit, configured to extract a plurality of target face images from the acquired video to be detected, wherein the similarity between adjacent target face images in the plurality of target face images is lower than a first value;
[0182] The detection unit is used to determine the liveness detection result of the video to be detected based on the multiple frames of target face images.
[0183] In an optional implementation manner, the acquisition unit, when extracting multiple frames of target face images from the acquired video to be detected, is used to:
[0184] Determine a first target face image among the multiple frames of target face images from the video to be detected;
[0185] Based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected is determined, wherein the similarity between the second target facial image and the first target facial image meets a preset similarity requirement.
[0186] In an optional implementation manner, the similarity requirement includes:
[0187] The second target facial image is a facial image having the smallest similarity with the first target facial image among the multiple frames of continuous facial images.
[0188] In an optional implementation manner, the acquisition device is further used for:
[0189] Dividing the video to be detected into multiple segments, wherein each segment includes multiple frames of continuous face images;
[0190] The acquisition device, when determining the first target face image in the plurality of frames of target face images from the video to be detected, is used to:
[0191] Selecting a first target face image from a first segment of the plurality of segments;
[0192] The acquisition device, when determining, based on the first target facial image, from multiple frames of continuous facial images in the video to be detected, a second target facial image adjacent to the first target facial image in the multiple frames of target facial images, is used to:
[0193] Based on the first target facial image, a second target facial image is determined from a second segment adjacent to the first segment among the multiple segments.
[0194] In an optional implementation manner, the similarity between the first target face image and the second target face image in the multiple frames of target face images is obtained based on the following method:
[0195] Obtaining a face difference image between the first target face image and the second target face image based on a pixel value of each pixel in the first target face image and a pixel value of each pixel in the second target face image;
[0196] Obtaining the variance corresponding to the face difference image according to the pixel value of each pixel point in the face difference image;
[0197] The variance is used as the similarity between the first target face image and the second target face image.
[0198] In an optional implementation manner, the acquisition unit, before extracting multiple frames of target face images from the acquired video to be detected, is further used to:
[0199] Obtain key point information of each face image in multiple frames of face images included in the video to be detected;
[0200] Based on the key point information of each face image in the multiple face images, aligning the multiple face images to obtain the aligned face images;
[0201] The acquisition unit, when extracting multiple frames of target face images from the acquired video to be detected, is used to:
[0202] The multiple frames of target face images are extracted from the multiple frames of face images after the alignment process.
[0203] In an optional implementation, the detection unit includes: a first detection module and / or a second detection module, and a determination module;
[0204] The first detection module is used to obtain a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of the target face image;
[0205] The second detection module is used to obtain a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images;
[0206] The determination module is used to determine a liveness detection result of the video to be detected based on the first detection result and / or the second detection result.
[0207] In an optional implementation, when the first detection module obtains the first detection result based on the feature data of each target face image in the multiple frames of target face images, it is configured to:
[0208] Performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data;
[0209] Based on the first fused feature data, the first detection result is obtained.
[0210] In an optional implementation, the feature extraction result of each frame of the target face image includes: first intermediate feature data corresponding to each level of first feature extraction processing respectively obtained by performing multi-level first feature extraction processing on the target face image;
[0211] The first detection module, when performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data, is used to:
[0212] For each level of first feature extraction processing, fusing the first intermediate feature data corresponding to each of the multiple frames of target face images in the first feature extraction processing of that level to obtain intermediate fused data corresponding to the first feature extraction processing of that level;
[0213] The first fused feature data is obtained based on the intermediate fused data respectively corresponding to the multi-level first feature extraction processing.
[0214] In an optional implementation, the first detection module, when fusing the first intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target face images at the first level to obtain the intermediate fused data corresponding to the first feature extraction processing at the first level, is used to:
[0215] Based on the first intermediate feature data respectively corresponding to the plurality of frames of target face images in the first feature extraction process of the first level, obtaining a feature sequence corresponding to the first feature extraction process of the first level;
[0216] The feature sequence is input into a recurrent neural network for fusion processing to obtain intermediate fusion data corresponding to the first feature extraction processing of this level.
[0217] In an optional implementation, the first detection module, before obtaining a feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, is further configured to:
[0218] Performing global average pooling processing on first intermediate feature data corresponding to each frame of the target face image in the multiple frames of the target face image in the first feature extraction processing at this level, to obtain second intermediate feature data corresponding to each frame of the target face image in the first feature extraction processing at this level;
[0219] The first detection module, when obtaining a feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, is used to:
[0220] According to the time sequence of the multiple frames of target facial images, the feature sequence is obtained based on the second intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target facial images at this level.
[0221] In an optional implementation, when the first detection module obtains the first fused feature data based on the intermediate fused data corresponding to the multi-level first feature extraction process, it is configured to:
[0222] After the intermediate fusion data corresponding to the multi-level first feature extraction processing are spliced, a full connection process is performed to obtain the first fusion feature data.
[0223] In an optional implementation manner, the first detection module is used to obtain a feature extraction result of each frame of the target face image in the following manner:
[0224] Performing a multi-level feature extraction process on the target face image to obtain first initial feature data corresponding to each first feature extraction process in the multi-level feature extraction process;
[0225] For each level of the first feature extraction processing, a fusion process is performed based on the first initial feature data of the first feature extraction processing of that level and the first initial feature data of at least one level of first feature extraction processing subsequent to the first feature extraction processing of that level to obtain the first intermediate feature data corresponding to the first feature extraction processing of that level, wherein the feature extraction result of the target facial image includes the first intermediate feature data corresponding to each level of the first feature extraction processing in the multiple levels of first feature extraction processing.
[0226] In an optional embodiment, the first detection module, when performing a fusion process based on the first initial feature data of the first feature extraction process of the level and the first initial feature data of at least one level of first feature extraction process subsequent to the first feature extraction process of the level to obtain the first intermediate feature data corresponding to the first feature extraction process of the level, is used to:
[0227] The first initial feature data of the first feature extraction processing of the level and the first intermediate feature data corresponding to the first feature extraction processing of the lower level of the first feature extraction processing of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction processing of the level, wherein the first intermediate feature data corresponding to the lower level first feature extraction processing is obtained based on the first initial feature data of the lower level first feature extraction processing.
[0228] In an optional implementation, the first detection module, when fusing the first initial feature data of the first feature extraction process of the first level with the first intermediate feature data corresponding to the first feature extraction process of the lower level of the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level, is used to:
[0229] Up-sampling the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process to obtain up-sampled data corresponding to the first feature extraction process of the next level;
[0230] The up-sampled data corresponding to the first feature extraction process of this level and the first initial feature data are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of this level.
[0231] In an optional implementation, the second detection module, when obtaining the second detection result based on the differential image of every two adjacent target face images in the multiple frames of target face images, is used to:
[0232] Performing cascade processing on the differential images of every two adjacent target face images in the multiple frames of target face images to obtain a differential cascade image;
[0233] Based on the differential cascaded image, the second detection result is obtained.
[0234] In an optional implementation, when the second detection module obtains the second detection result based on the differential cascaded image, it is configured to:
[0235] Performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image;
[0236] Performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data;
[0237] Based on the second fused feature data, the second detection result is obtained.
[0238] In an optional implementation, the second detection module, when performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image, is used to:
[0239] Performing multi-level second feature extraction processing on the differential cascaded image to obtain second initial feature data corresponding to each level of the second feature extraction processing;
[0240] Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processes, a feature extraction result of the differential cascade image is obtained.
[0241] In an optional implementation, the second detection module, when obtaining the feature extraction result of the differential cascade image based on the second initial feature data respectively corresponding to the multi-level second feature extraction process, is used to:
[0242] For each level of second feature extraction processing, the second initial feature data of the second feature extraction processing of the level is fused with the second initial feature data of at least one level of second feature extraction processing before the second feature extraction processing of the level, so as to obtain third intermediate feature data corresponding to the second feature extraction processing of the level;
[0243] The feature extraction result of the differential cascaded image includes third intermediate feature data corresponding to the multiple levels of second feature extraction processing.
[0244] In an optional embodiment, the second detection module, when fusing the second initial feature data of the second feature extraction process of the level with the second initial feature data of the second feature extraction process of at least one level before the second feature extraction process of the level to obtain the third intermediate feature data corresponding to each level of the second feature extraction process, is used to:
[0245] Down-sampling the second initial feature data of the upper second feature extraction process of the second feature extraction process of the level to obtain down-sampled data corresponding to the second feature extraction process of the level;
[0246] The down-sampled data corresponding to the second feature extraction process of the stage and the second initial feature data are fused to obtain third intermediate feature data corresponding to the second feature extraction process of the stage.
[0247] In an optional implementation, the second detection module, before performing feature fusion on the feature extraction result of the differential cascade image to obtain the second fused feature data, is further used to:
[0248] Performing global average pooling processing on the third intermediate feature data in the second feature extraction processing of each level of the differential cascade image, respectively, to obtain fourth intermediate feature matrices corresponding to the second feature extraction processing of each level of the differential cascade image;
[0249] The step of performing feature fusion on the feature extraction result of the differential cascaded image to obtain second fused feature data includes:
[0250] Feature fusion is performed on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data.
[0251] In an optional implementation manner, the second detection module, when performing feature fusion on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data, is used to:
[0252] After the fourth intermediate feature matrices corresponding to the multi-level second feature extraction processing are spliced, a full connection process is performed to obtain the second fused feature data.
[0253] In an optional implementation, the determination module, when determining the liveness detection result for the video to be detected based on the first detection result and the second detection result, is used to:
[0254] The first detection result and the second detection result are weightedly summed to obtain the liveness detection result.
[0255] In a third aspect, an optional implementation of the present disclosure further provides an electronic device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.
[0256] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.
[0257] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, the following specifically lists preferred optional implementation methods and describes them in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0258] In order to more clearly illustrate the technical solutions of the optional implementations of the present disclosure, the following will briefly introduce the drawings required for use in the optional implementations. The drawings herein are incorporated into the specification and are a part of the specification. These drawings illustrate optional implementations that conform to the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate some optional implementations of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0259] Figure 1 A flow chart of a living body detection method provided by an optional implementation of the present disclosure is shown;
[0260] Figure 2 An example of obtaining a first detection result based on a feature extraction result of each frame of a target face image in multiple frames of target face images in a liveness detection method provided by an optional implementation of the present disclosure is shown;
[0261] Figure 3 An example of obtaining a second detection result based on a differential image of every two adjacent target face images in multiple frames of target face images in a living body detection method provided by an optional implementation of the present disclosure is shown;
[0262] Figure 4 A flowchart of another living body detection method provided by an optional implementation of the present disclosure is shown;
[0263] Figure 5 A schematic diagram of a living body detection device provided by an optional implementation of the present disclosure is shown;
[0264] Figure 6 A schematic diagram of an electronic device provided by an optional implementation of the present disclosure is shown;
[0265] Figure 7 A flowchart showing an example of applying the living body detection method provided by the present disclosure;
[0266] Figure 8 A schematic diagram showing an example of applying the living body detection method provided by the present disclosure. DETAILED DESCRIPTION
[0267] In order to make the purpose, technical solution and advantages of the optional implementation of the present disclosure clearer, the technical solution in the optional implementation of the present disclosure will be clearly and completely described below in conjunction with the drawings in the optional implementation of the present disclosure. Obviously, the described optional implementation is only a part of the optional implementation of the present disclosure, rather than all the optional implementations. The components of the optional implementation of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the optional implementation of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected optional implementation of the present disclosure. Based on the optional implementation of the present disclosure, all other optional implementations obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0268] Research has found that when performing face liveness detection based on image recognition methods, the user to be detected is usually required to perform certain specified actions. For example, when a bank system authenticates a user, the user is required to stand in front of the camera of the terminal device and perform certain specified facial expressions according to the prompts in the terminal device. When the user performs the specified action, the camera obtains the face video. Then, based on the obtained face video, it is detected whether the user performs the specified action and whether the user who performs the specified action is a legitimate user. If so, the identity verification is passed. This method of liveness detection usually consumes a lot of time in the process of interacting with the user, resulting in low detection efficiency.
[0269] The present disclosure provides a method and device for detecting liveness, which can extract multiple frames of target face images from a video to be detected, and then obtain a first detection result based on the feature extraction result of each frame of the target face images in the multiple frames, and obtain a second detection result based on the differential image of each two adjacent target face images in the multiple frames; and then determine the liveness detection result of the video to be detected based on the first detection result and the second detection result. In this method, the user does not need to make any specified actions, but uses multiple frames of the user's face images with large differences to silently detect whether the user is alive, and the detection efficiency is higher.
[0270] At the same time, the image obtained by reshooting the screen will lose a lot of image information of the original image. If the video to be detected is a face video obtained by reshooting the screen, the loss of image information will make it impossible to detect subtle changes in the user's appearance, thereby effectively resisting the attack method of screen reshooting.
[0271] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0272] The technical solutions in the present disclosure will be clearly and completely described below in conjunction with the drawings in the present disclosure. Obviously, the described optional implementations are only part of the optional implementations of the present disclosure, rather than all of the optional implementations. The components of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the optional implementations of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected optional implementations of the present disclosure. Based on the optional implementations of the present disclosure, all other optional implementations obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0273] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0274] To facilitate understanding of this optional implementation, a liveness detection method disclosed in the optional implementation of the present disclosure is first introduced in detail. The execution subject of the liveness detection method provided by the optional implementation of the present disclosure is generally an electronic device with certain computing capabilities, and the electronic device includes, for example: a terminal device or a server or other processing device, and the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the liveness detection method can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0275] The following describes the liveness detection method provided by the optional implementation of the present disclosure by taking the execution subject as a terminal device as an example.
[0276] See also Figure 1 As shown, it is a flowchart of a liveness detection method provided by an optional implementation of the present disclosure, and the method includes steps S101 to S104, wherein:
[0277] S101: extracting multiple frames of target face images from the acquired video to be detected.
[0278] S102: Obtain a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of target face images.
[0279] S103: Obtain a second detection result based on a differential image between every two adjacent target face images in the multiple frames of target face images.
[0280] S104: Determine a liveness detection result of the video to be detected based on the first detection result and the second detection result.
[0281] Among them: S102 and S103 have no execution order.
[0282] The above S101 to S104 are described in detail below.
[0283] I: In the above S101, an image acquisition device is installed in the terminal device, through which the original detection video can be instantly acquired; each frame of the original detection video includes a face. The original detection video can be used as the video to be detected; or the face part included in the original detection video can be captured to obtain the video to be detected.
[0284] In order to improve the detection accuracy, the video length of the detected video is, for example, above a preset time length threshold. The preset time length range can be specifically set according to actual needs. For example, the preset time length threshold is 2 seconds, 3 seconds, 4 seconds, etc.
[0285] The number of face images included in the video to be detected is greater than the number of target face images that need to be extracted.
[0286] The number of target face detection images can be fixed or determined according to the video length of the video to be detected.
[0287] After obtaining the video to be detected, multiple frames of target face images need to be extracted from the video to be detected.
[0288] Exemplarily, in an optional implementation of the present disclosure, the multiple frames of target face images are determined from the video to be detected, for example based on the similarity between the multiple frames of face images included in the video to be detected.
[0289] When determining multiple frames of target face images based on the similarity between multiple frames of face images included in the video to be detected, the multiple frames of target face images meet at least one of the following requirements (1) and (2):
[0290] (1) The similarity between every two adjacent target face images in the multiple frames of target face images is lower than a first value.
[0291] For example, any frame of face image in the video to be detected can be used as a reference image, and the similarities between the remaining frames of face images and the reference image can be determined respectively, and multiple frames of face images with first data in the similarity area can be taken as target face images.
[0292] (2) determining a first target face image among the multiple frames of target face images from the video to be detected;
[0293] Based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected is determined, wherein the similarity between the second target facial image and the first target facial image meets a preset similarity requirement.
[0294] Here, the similarity requirement includes, for example: the second target facial image is a facial image having the smallest similarity with the first target facial image among the multiple frames of continuous facial images.
[0295] Exemplarily, the first target face image in multiple frames of target face images may be determined in the following manner:
[0296] Dividing the video to be detected into multiple segments, wherein each segment includes multiple frames of continuous face images;
[0297] A first target face image is selected from a first segment of the plurality of segments.
[0298] Based on the first target facial image, a second target facial image is determined from a second segment adjacent to the first segment in the multiple segments.
[0299] The specific implementation process is shown in A below.
[0300] A: The optional implementation of the present disclosure provides a specific method for extracting a preset number of target face images from a video to be detected, including the following 1.1 to 1.3:
[0301] 1.1 According to the order of timestamps corresponding to the face images of each frame in the video to be detected, the face images included in the video to be detected are divided into N image groups according to the level; wherein N=preset number-1.
[0302] Here, among the N image groups, the number of face images included in different image groups may be the same or different, and may be set according to actual needs.
[0303] 1.2 For the first group of images, the first frame of facial image in the image group is determined as the first frame of target facial image, and the first frame of target facial image is used as the reference facial image to obtain the similarity between other facial images in the image group and the reference facial image; the facial image with the smallest similarity to the reference facial image is determined as the target facial image in the image group except the first frame of target facial image.
[0304] 1.3 For each other image group, the target face image in the previous image group is used as the reference face image, and the similarity between each frame face image in the image group and the reference face image is obtained; the face image with the smallest similarity to the reference face image is used as the target face image of the image group; wherein, if the previous image group is the first image group, the target face image used as the reference face image of the current image group is the target face image other than the first frame target face image.
[0305] In a specific implementation, the similarity between the face image and the reference face image may be determined by any of the following two methods, but not limited to:
[0306] ①: Based on the pixel value of each pixel in the first target face image and the pixel value of each pixel in the second target face image, a face difference image between the first target face image and the second target face image is obtained; according to the pixel value of each pixel in the face difference image, a variance corresponding to the face difference image is obtained; and the variance is used as the similarity between the first target face image and the second target face image.
[0307] Here, the pixel value of any pixel point M in the face difference image=the pixel value of the pixel point M' in the face image-the pixel value of the pixel point M" in the reference face image.
[0308] The position of the pixel point M in the face difference image, the position of the pixel point M' in the face image, and the position of the pixel point M" in the reference face image are consistent.
[0309] The larger the obtained variance is, the smaller the similarity between the face image and the reference face image is.
[0310] ②: Perform at least one level of feature extraction on the face image and the reference face image to obtain feature data corresponding to the face image and the reference face image respectively; then calculate the distance between the feature data corresponding to the face image and the reference face image respectively, and use the distance as the similarity between the face image and the reference face image.
[0311] The larger the distance, the smaller the similarity between the face image and the reference face image.
[0312] Here, a convolutional neural network can be used to extract features from the face image and the reference face image.
[0313] For example, there are 20 frames of face images in the video to be detected, namely a1 to a20, and the preset number of target face images is 5. Then, according to the order of timestamps, the video to be detected is divided into 4 groups, namely:
[0314] The first group: a1~a5;
[0315] The second group: a6~a10;
[0316] The third group: a11~a15;
[0317] The fourth group: a16~a20.
[0318] For the first group of images, a1 is used as the first frame target face image and a1 is used as the reference face image to obtain the similarities between a2 to a5 and a1. Assuming that the similarity between a3 and a1 is the smallest, a3 is used as another target face image in the first group of images.
[0319] For the second group of images, a3 is used as the reference face image, and the similarities between a6 to a10 and a3 are obtained. Assuming that the similarity between a7 and a3 is the smallest, a7 is used as the target face image in the second group of images.
[0320] For the third group of images, a7 is used as the reference face image, and the similarities between a11 to a15 and a7 are obtained. Assuming that the similarity between a14 and a7 is the smallest, a14 is used as the target face image in the third group of images.
[0321] For the fourth image group, a14 is used as the reference face image, and the similarities between a16 to a20 and a14 are obtained. Assuming that the similarity between a19 and a14 is the smallest, a19 is used as the target face image in the fourth image group.
[0322] The final target face images include five frames: a1, a3, a7, a14, and a19.
[0323] For another example, a first target face image is selected from the video to be detected; then the remaining face images are divided into multiple segments, and based on the first target face image, a second target face image is determined from the multiple segments adjacent to the first target face image.
[0324] The specific implementation process is shown in B below.
[0325] B: The optional implementation of the present disclosure provides another specific method for extracting a preset number of target face images from a video to be detected, including the following 2.1 to 2.4:
[0326] 2.1 Determine the first frame of face image in the video to be detected as the first frame of target face image.
[0327] 2.2 According to the order of timestamps corresponding to the facial images in each frame of the video to be detected, the facial images included in the video to be detected except the first frame of the target facial image are divided into N image groups according to the level; wherein N=preset number-1.
[0328] 2.3 For the first group of images, the first frame target face image is used as the reference face image, and the similarity between other face images in the image group and the reference face image is obtained; the face image with the smallest similarity with the reference face image is determined as the target face image in the first group of images.
[0329] 2.4 For each other group of images, the target face image in the previous group of images is used as the reference face image, and the similarity between each frame of the face image in the image group and the reference face image is obtained; the face image with the smallest similarity with the reference face image is used as the target face image of the image group.
[0330] Here, the method for determining the similarity between the face image and the reference face image is similar to that in A above and will not be repeated here.
[0331] For example, there are 20 frames of face images in the video to be detected, namely a1 to a20, and the preset number of target face images is 5. Taking a1 as the first frame of the target face image, a2 to a20 are divided into 4 groups according to the order of timestamps, which are:
[0332] The first group: a2~a6;
[0333] The second group: a7~a11;
[0334] The third group: a12~a16;
[0335] The fourth group: a17~a20.
[0336] For the first group of images, a1 is used as the reference face image, and the similarities between a2 to a6 and a1 are obtained. Assuming that the similarity between a4 and a1 is the smallest, a4 is used as the target face image in the first group of images.
[0337] For the second group of images, a4 is used as the reference face image, and the similarities between a7 to a11 and a4 are obtained. Assuming that the similarity between a10 and a4 is the smallest, a10 is used as the target face image in the second group of images.
[0338] For the third group of images, a10 is used as the reference face image, and the similarities between a12 to a16 and a10 are obtained. Assuming that the similarity between a13 and a10 is the smallest, a13 is used as the target face image in the third group of images.
[0339] For the fourth image group, a13 is used as the reference face image, and the similarities between a17 to a20 and a13 are obtained. Assuming that the similarity between a19 and a13 is the smallest, a19 is used as the target face image in the fourth image group.
[0340] The final target face images include five frames: a1, a4, a10, a13, and a19.
[0341] In addition, in another optional implementation of the present disclosure, in order to avoid interference caused by slight changes in the appearance of the human body due to the overall displacement of the user, such as changes in the position and direction of the head, the optional implementation of the present disclosure further includes, before extracting a preset number of target face images from the video to be detected:
[0342] Acquire key point information of each face image in the multiple face images included in the video to be detected; and align the multiple face images based on the key point information of each face image in the multiple face images to obtain the aligned multiple face images.
[0343] For example, determine the key point positions of at least three target key points in each frame of face images in multiple frames of face images in the face video to be detected; based on the key point positions of the target key points in each frame of face images, take the face image with the earliest corresponding timestamp as the reference image, perform key point alignment processing on the face images of each frame except the face image with the earliest corresponding timestamp, and obtain aligned face images corresponding to the face images of each frame except the face image with the earliest corresponding timestamp.
[0344] Here, for example, multiple frames of face images in the video to be detected are input into the pre-trained face key point detection model in order to obtain the key point positions of each target key point in each frame of face image, and then based on the obtained key point positions of the target key points, the first frame of face image is used as the reference image to align the other face images except the first frame of face image, so that the position and angle of the face in different face images are consistent, avoiding interference caused by changes in head position and direction on subtle changes in human face.
[0345] In this case, a preset number of target face images are extracted from the video to be detected, including:
[0346] The multiple frames of target face images are extracted from the multiple frames of face images after the alignment process.
[0347] The method of extracting the target face image here is similar to the above method and will not be repeated here.
[0348] II: In the above S102, for example, the feature extraction results of the multiple frames of target facial images are subjected to feature fusion processing to obtain first fused feature data; based on the first fused feature data, the first detection result is obtained.
[0349] First, the specific method of obtaining the feature extraction results of each frame of the target face image is explained:
[0350] C: The optional implementation of the present disclosure provides a method for obtaining a feature extraction result of each frame of the target face image, including the following 3.1 to 3.2:
[0351] 3.1 Perform multi-level feature extraction processing on the target face image to obtain first initial feature data corresponding to each first feature extraction processing in the multi-level feature extraction processing.
[0352] Here, the target face image may be input into a pre-trained first convolutional neural network, and a multi-level first feature extraction process may be performed on the target face image.
[0353] In an optional implementation, the first convolutional neural network includes multiple convolutional layers; the multiple convolutional layers are connected in order, and the output of any convolutional layer is the input of the next convolutional layer of the convolutional layer. And the output of each convolutional layer is used as the first intermediate feature data corresponding to the convolutional layer.
[0354] In another optional implementation, pooling layers, fully connected layers, etc. can also be set between multiple convolutional layers; for example, a pooling layer is connected after each convolutional layer, and a fully connected layer is connected after the pooling layer, so that the convolutional layer, the pooling layer, and the fully connected layer constitute a first-level network structure for performing the first feature extraction processing.
[0355] The specific structure of the first convolutional neural network can be set according to actual needs and will not be described in detail here.
[0356] The number of convolutional layers in the first convolutional neural network is consistent with the number of stages for performing the first feature extraction process.
[0357] 3.2 For each level of the first feature extraction processing, a fusion process is performed based on the first initial feature data of the first feature extraction processing of that level and the first initial feature data of at least one level of first feature extraction processing subsequent to the first feature extraction processing of that level to obtain the first intermediate feature data corresponding to the first feature extraction processing of that level, wherein the feature extraction result of the target facial image includes the first intermediate feature data corresponding to each level of the first feature extraction processing in the multiple levels of first feature extraction processing.
[0358] Here, for example, the first intermediate feature data corresponding to any level of first feature extraction processing is obtained in the following manner:
[0359] The first initial feature data of the first feature extraction processing of the level and the first intermediate feature data corresponding to the first feature extraction processing of the lower level of the first feature extraction processing of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction processing of the level, wherein the first intermediate feature data corresponding to the lower level first feature extraction processing is obtained based on the first initial feature data of the lower level first feature extraction processing.
[0360] Specifically, for each first feature extraction process except the last one, based on the first initial feature data obtained by the first feature extraction process of the first level and the first intermediate feature data obtained by the first feature extraction process of the next level, the first intermediate feature data corresponding to the first feature extraction process of the level is obtained;
[0361] For the last level of first feature extraction processing, determining the first initial feature data obtained by the last level of first feature extraction processing as the first intermediate feature data corresponding to the last level of first feature extraction processing;
[0362] The second intermediate feature data is used as the result of feature extraction for the target face image of the frame.
[0363] Here, the first intermediate feature data corresponding to the first feature extraction process of this level can be obtained in the following manner:
[0364] Up-sampling the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process to obtain up-sampled data corresponding to the first feature extraction process of the next level;
[0365] The up-sampled data corresponding to the first feature extraction process of this level and the first initial feature data are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of this level.
[0366] For example, the target face image is subjected to a 5-level first feature extraction process.
[0367] The first initial feature data obtained through the 5-level feature extraction process are: V1, V2, V3, V4 and V5.
[0368] For the fifth-level first feature extraction process, V5 is used as the first intermediate feature data M5 corresponding to the fifth-level first feature extraction process;
[0369] For the first feature extraction process at level 4, the first intermediate feature data M5 obtained by the first feature extraction process at level 5 is upsampled to obtain upsampled data M5' corresponding to the first feature extraction process at level 4. The first intermediate feature data M4 corresponding to the first feature extraction process at level 4 is generated based on V4 and M5'.
[0370] For the first feature extraction process at level 3, the first intermediate feature data M4 obtained by the first feature extraction process at level 4 is upsampled to obtain upsampled data M4' corresponding to the first feature extraction process at level 3. The first intermediate feature data M4 corresponding to the first feature extraction process at level 3 is generated based on V3 and M4'.
[0371] …
[0372] For the first feature extraction process at level 1, the first intermediate feature data M2 obtained by the second feature extraction process is upsampled to obtain upsampled data M2' corresponding to the first feature extraction process at level 1. The first intermediate feature data M1 corresponding to the first feature extraction process at level 1 is generated based on V1 and M2'.
[0373] The up-sampled data corresponding to the first feature extraction process of the level and the first initial feature data may be fused in the following manner to obtain the first intermediate feature data corresponding to the first feature extraction process of the level:
[0374] The upsampled data and the first initial feature data are added together. Here, the addition refers to adding the data value of each data in the upsampled data to the data value of the data at the corresponding position in the first initial feature matrix.
[0375] Here, after upsampling the first intermediate feature data corresponding to the first feature extraction processing of the next level, the dimension of the obtained upsampled data is the same as the dimension of the first initial feature data corresponding to the first feature extraction processing of this level. After adding the upsampled data and the first initial feature data, the dimension of the obtained first intermediate feature data is also the same as the dimension of the first initial feature matrix corresponding to the first feature extraction processing of this level.
[0376] In another optional implementation, the upsampled data and the first initial feature matrix may also be concatenated.
[0377] For example, the dimensions of the upsampled data and the first initial feature data are both m*n*f. After the two are vertically spliced, the dimensions of the first intermediate feature data obtained are: 2m*n*f. After the two are horizontally spliced, the dimensions of the first intermediate feature data obtained are: m*2n*f.
[0378] Next, the process of performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain the first fused feature data is described in detail:
[0379] D: The optional implementation of the present disclosure provides a method of performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data, including the following 4.1 to 4.3:
[0380] 4.1 For each level of first feature extraction processing, the first intermediate feature data corresponding to the multiple frames of target face images in the first feature extraction processing of that level are fused to obtain the intermediate fused data corresponding to the first feature extraction processing of that level.
[0381] Here, the intermediate fusion data corresponding to the first feature extraction process at each level can be obtained in the following manner:
[0382] Based on the first intermediate feature data respectively corresponding to the multiple frames of target facial images in the first feature extraction processing of this level, a feature sequence corresponding to the first feature extraction processing of this level is obtained; the feature sequence is input into a recurrent neural network for fusion processing to obtain intermediate fusion data corresponding to the first feature extraction processing of this level.
[0383] Here, the recurrent neural network includes, for example, one or more of: Long Short-Term Memory Network (LSTM), Recurrent Neural Networks (RNN), and Gated Recurrent Unit (GRU).
[0384] If the first feature extraction process has n levels, n intermediate fusion data can be obtained in the end.
[0385] In another optional implementation, before obtaining the feature sequence corresponding to the first feature extraction process at this level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process at this level, the method further includes:
[0386] Performing global average pooling processing on first intermediate feature data corresponding to each frame of the target face image in the multiple frames of the target face image in the first feature extraction processing at this level, to obtain second intermediate feature data corresponding to each frame of the target face image in the first feature extraction processing at this level;
[0387] At this time, the first intermediate feature data corresponding to the first feature extraction process of the first level in the multi-frame target face images are respectively obtained to obtain a feature sequence corresponding to the first feature extraction process of the first level, specifically:
[0388] According to the time sequence of the multiple frames of target facial images, the feature sequence is obtained based on the second intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target facial images at this level.
[0389] Here, global average pooling can convert three-dimensional feature data into two-dimensional feature data.
[0390] If the target face image is in a first feature extraction process at a certain level, the dimension of the obtained first intermediate feature data is 7*7*128, which can be understood as superimposing 128 7*7 two-dimensional matrices together.
[0391] When performing global average pooling on the first intermediate feature data, for each 7*7 two-dimensional matrix, the mean value of each element in the two-dimensional matrix is calculated.
[0392] Finally, 128 mean values can be obtained and used as intermediate feature data.
[0393] For example, the target face images are: b1 to b5. The second intermediate feature data corresponding to each frame of the target face image are: P1, P2, P3, P4 and P5, and the feature sequence obtained from the second intermediate feature data of the five frames of the target face image is: (P1, P2, P3, P4, P5).
[0394] For any level of the first feature extraction processing, after obtaining the second intermediate feature data corresponding to each frame of the target facial image in the first feature extraction processing at that level, the feature sequence is obtained based on the time sequence of the target facial images of each frame and based on the second intermediate feature data corresponding to the first feature extraction processing of the multiple frames of the target facial images at that level.
[0395] After obtaining the feature sequences corresponding to the first feature extraction processing of each level, the feature sequences are respectively input into the corresponding recurrent neural network models to obtain the intermediate fusion data corresponding to the first feature extraction processing of each level.
[0396] 4.2 Based on the intermediate fusion data corresponding to the multi-level first feature extraction processing, the first fusion feature data is obtained.
[0397] Here, the intermediate fusion data corresponding to each level of first feature extraction processing may be spliced to obtain first fusion feature data that uniformly represents the target facial image.
[0398] The intermediate fusion data corresponding to the multi-level first feature extraction processing may also be concatenated and then fully connected to obtain the first fusion feature data.
[0399] After obtaining the first fusion feature data, the first fusion feature data can be input into the first classifier to obtain the first detection result.
[0400] Here, the first classifier is, for example, a softmax classifier.
[0401] like Figure 2As shown, an example of obtaining a first detection result based on the feature extraction result of each target face image in multiple frames of target face images is provided. In this example, a 5-level feature extraction process is performed on the target face image, and the first initial feature data obtained are: V1, V2, V3, V4 and V5;
[0402] Generate first intermediate feature data M5 of the fifth level first feature extraction process based on the first initial feature data V5, and upsample the first intermediate feature data M5 to obtain upsampled data M5' of the fourth level first feature extraction process;
[0403] The first initial feature data V4 of the fourth-level first feature extraction process and the up-sampled data M5' are added to obtain the first intermediate feature data M4 of the fourth-level first feature extraction process, and the first intermediate feature data M4 is up-sampled to obtain the up-sampled data M4' of the third-level first feature extraction process;
[0404] The first initial feature data V3 of the third-level first feature extraction process and the up-sampled data M4' are added to obtain the first intermediate feature data M3 of the third-level first feature extraction process, and the first intermediate feature data M3 is up-sampled to obtain the up-sampled data M3' of the second-level first feature extraction process;
[0405] The first initial feature data V2 of the second-level first feature extraction process and the up-sampled data M3' are added to obtain the first intermediate feature data M2 of the second-level first feature extraction process, and the first intermediate feature data M2 is up-sampled to obtain the up-sampled data M2' of the first-level first feature extraction process;
[0406] The first initial feature data V1 of the first level first feature extraction process and the up-sampled data M2 ′ are added to obtain the first intermediate feature data M1 of the first level first feature extraction process.
[0407] The obtained first intermediate feature data M1, M2, M3, M4 and M5 are used as feature extraction results obtained after feature extraction is performed on the target face image.
[0408] Then, for each frame of target face image, the first intermediate feature data corresponding to the target face image in the five-level first feature extraction processing are average pooled to obtain the second intermediate feature data G1, G2, G3, G4 and G5 corresponding to the target face image in the frame under the five-level first feature extraction processing.
[0409] If at this time, the target face image has 5 frames, which are a1 to a5 in the order of timestamps, and:
[0410] The second intermediate feature data corresponding to the first frame target face image a1 under the five-level first feature extraction processing are: G11, G12, G13, G14, G15;
[0411] The second intermediate feature data corresponding to the second frame target face image a2 under the five-level first feature extraction processing are: G21, G22, G23, G24, G25;
[0412] The second intermediate feature data corresponding to the target face image a2 of the third frame under the five-level first feature extraction processing are: G31, G32, G33, G34, G35;
[0413] The second intermediate feature data corresponding to the target face image a2 of the fourth frame under the five-level first feature extraction processing are: G41, G42, G43, G44, G45;
[0414] The second intermediate feature data corresponding to the target face image a2 of the fifth frame under the five-level first feature extraction processing are: G51, G52, G53, G54, G55;
[0415] So:
[0416] The feature sequence corresponding to the first-level feature extraction process is: (G11, G21, G31, G41, G51).
[0417] The feature sequence corresponding to the second-level feature extraction process is: (G1, G22, G32, G42, G52).
[0418] The feature sequence corresponding to the third-level feature extraction processing is: (G13, G23, G33, G43, G53).
[0419] The feature sequence corresponding to the fourth-level feature extraction processing is: (G14, G24, G34, G44, G54).
[0420] The feature sequence corresponding to the fifth-level feature extraction processing is: (G15, G25, G35, G45, G55).
[0421] Then the feature sequence (G11, G21, G31, G41, G51) is input into the LSTM network corresponding to the first-level first feature extraction process to obtain the intermediate fusion data R1 corresponding to the first-level first feature extraction process.
[0422] The feature sequence (G1, G22, G32, G42, G52) is input into the LSTM network corresponding to the second-level first feature extraction process to obtain the intermediate fusion data R2 corresponding to the second-level first feature extraction process.
[0423] The feature sequence (G13, G23, G33, G43, G53) is input into the LSTM network corresponding to the third-level first feature extraction process to obtain the intermediate fusion data R3 corresponding to the third-level first feature extraction process.
[0424] The feature sequence (G14, G24, G34, G44, G54) is input into the LSTM network corresponding to the fourth-level first feature extraction process to obtain the intermediate fusion data R4 corresponding to the fourth-level first feature extraction process.
[0425] The feature sequence (G15, G25, G35, G45, G55) is input into the LSTM network corresponding to the fifth-level first feature extraction process to obtain the intermediate fusion data R5 corresponding to the second-level first feature extraction process.
[0426] After the intermediate fusion data R1, R2, R3, R4 and R5 are concatenated, they are passed to the fully connected layer for full connection processing to obtain the first fusion feature data.
[0427] Then the first fused feature data is passed to the first classifier to obtain a first detection result.
[0428] III: In the above S103, the second detection result may be obtained based on the differential image of every two adjacent target face images in the multiple frames of target face images in the following manner:
[0429] Performing cascade processing on the differential images of every two adjacent target face images in the multiple frames of target face images to obtain a differential cascade image;
[0430] Based on the differential cascaded image, the second detection result is obtained.
[0431] Specifically, the method for obtaining the differential image of every two adjacent frames of the target face image is similar to that in the above A, and will not be repeated here.
[0432] When the differential images are cascaded, the differential images are cascaded on the color channels. For example, if the differential image is a three-channel image, after cascading two differential images, the differential cascaded image obtained is a six-channel image.
[0433] In a specific implementation, different differential images have the same number of color channels and the same number of pixels.
[0434] For example, if the number of color channels of the difference image is 3 and the number of pixels is 256*1024, the representation vector of the difference image is: 256*1024*3. The element value of any element Aijk in the representation vector is the pixel value of the pixel Aij' in the kth color channel.
[0435] If there are s differential images, the s differential images are cascaded to obtain a differential cascaded image with a dimension of 256*1024*(3×s).
[0436] In an optional implementation, the second detection result may be obtained based on the differential cascaded image in the following manner:
[0437] Performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image; performing feature fusion on the feature extraction result of the differential cascade image to obtain second fused feature data; and obtaining the second detection result based on the second fused feature data.
[0438] The following describes in detail the specific process of feature extraction of differential cascaded images through the following E:
[0439] E: The optional implementation of the present disclosure provides a specific method for extracting features from differential cascaded images, including the following 5.1 to 5.2.
[0440] 5.1. Perform multi-level second feature extraction processing on the differential cascade image to obtain second initial feature data corresponding to each level of second feature extraction processing;
[0441] Here, the differential cascaded image may be input into a pre-trained second convolutional neural network, and a multi-level second feature extraction process may be performed on the differential cascaded image.
[0442] The second convolutional neural network is similar to the first convolutional neural network described above and will not be described in detail here.
[0443] It should be noted that the network structure of the second convolutional neural network and the first convolutional neural network can be the same or different; when the structures are the same, the network parameters are different.
[0444] It should be noted here that the number of stages of the first feature extraction process may be the same as or different from the number of stages of the second feature extraction process.
[0445] 5.2. Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processes, a feature extraction result of the differential cascade image is obtained.
[0446] Exemplarily, the feature extraction result of the differential cascade image can be obtained by extracting the second initial feature data corresponding to each of the multi-level second feature extraction processes in the following manner:
[0447] For each level of second feature extraction processing, the second initial feature data of the second feature extraction processing of the level is fused with the second initial feature data of at least one level of second feature extraction processing before the second feature extraction processing of the level, so as to obtain third intermediate feature data corresponding to the second feature extraction processing of the level;
[0448] The feature extraction result of the differential cascaded image includes third intermediate feature data corresponding to the multiple levels of second feature extraction processing.
[0449] Here, the specific method of fusing the second initial feature data of any level of second feature extraction processing with the second initial feature data of at least one level of second feature extraction processing before the level of second feature extraction processing is, for example:
[0450] Down-sampling the second initial feature data of the upper second feature extraction process of the second feature extraction process of the level to obtain down-sampled data corresponding to the second feature extraction process of the level;
[0451] The down-sampled data corresponding to the second feature extraction process of the stage and the second initial feature data are fused to obtain third intermediate feature data corresponding to the second feature extraction process of the stage.
[0452] Specifically: for the last level second feature extraction process, the second initial feature data obtained by the last level second feature extraction process is determined as the third intermediate feature data corresponding to the last level second feature extraction process.
[0453] For the second feature extraction processing of other levels, the third intermediate feature data corresponding to the second feature extraction processing of this level is obtained based on the second initial feature data obtained by the second feature extraction processing of this level and the third intermediate feature data obtained by the second feature extraction processing of the previous level.
[0454] The third intermediate feature data corresponding to each level of the second feature extraction processing are used as the result of feature extraction on the differential cascade image.
[0455] Here, the third intermediate feature data corresponding to each level of second feature extraction processing can be obtained in the following manner:
[0456] Downsampling the third intermediate feature data obtained by the second feature extraction process of the previous level to obtain downsampled data corresponding to the second feature extraction process of this level; the vector dimension of the downsampled data corresponding to the second feature extraction process of this level is the same as the dimension of the second initial feature data obtained based on the second feature extraction process of this level;
[0457] Based on the down-sampled data corresponding to the second feature extraction process of this stage and the second initial feature data, the third intermediate feature data corresponding to the second feature extraction process of this stage is obtained.
[0458] For example, Figure 3 In the example provided, a five-level second feature extraction process is performed on the differential cascade image.
[0459] The second initial feature numbers obtained by the 5-level second feature extraction process are: W1, W2, W3, W4 and W5.
[0460] For the first-level second feature extraction process, W1 is used as the third intermediate feature data E1 corresponding to the first-level second feature extraction process;
[0461] For the second-level second feature extraction process, the third intermediate feature data E1 obtained by the first-level second feature extraction process is downsampled to obtain the downsampled data E1' corresponding to the second-level first feature extraction process. The third intermediate feature data E2 corresponding to the second-level second feature extraction process is generated based on W2 and E1'.
[0462] …
[0463] For the fifth level second feature extraction process, the third intermediate feature data E4 obtained by the fourth level second feature extraction process is downsampled to obtain downsampled data E4' corresponding to the fifth level second feature extraction process. The fifth intermediate feature data E5 corresponding to the fifth level second feature extraction process is generated based on W5 and E4'.
[0464] The process of performing feature fusion on the feature extraction results of the differential cascaded images through F to obtain the second fused feature data is described in detail below.
[0465] F: The present disclosure provides an optional implementation method for performing feature fusion on the feature extraction results of differential cascaded images, including the following 6.1 to 6.2:
[0466] 6.1. Perform global average pooling processing on the third intermediate feature data of the differential cascade image in each level of the second feature extraction processing to obtain fourth intermediate feature matrices corresponding to the differential cascade image in each level of the second feature extraction processing.
[0467] Here, the method of performing global average pooling on the third intermediate feature data is similar to the above-mentioned method of performing global average pooling on the first intermediate feature data, and will not be repeated here.
[0468] 6.2. Perform feature fusion on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data.
[0469] Here, for example, after the fourth intermediate feature data corresponding to each level of second feature extraction processing are spliced, they are input into the fully connected network for full connection processing to obtain the second fused feature data.
[0470] After obtaining the second fused feature data, the second fused feature data is input into a second classifier to obtain a second detection result.
[0471] For example, Figure 3 In the example shown:
[0472] The third intermediate feature data E1 corresponding to the first-level second feature extraction process is subjected to global average pooling to obtain a fourth intermediate feature matrix U1;
[0473] The third intermediate feature data E2 corresponding to the second feature extraction process of the second level are subjected to global average pooling to obtain a fourth intermediate feature matrix U2;
[0474] The third intermediate feature data E3 corresponding to the third-level second feature extraction process are subjected to global average pooling to obtain a fourth intermediate feature matrix U3;
[0475] The third intermediate feature data E4 corresponding to the fourth-level second feature extraction process are subjected to global average pooling to obtain a fourth intermediate feature matrix U4;
[0476] The third intermediate feature data E5 corresponding to the second feature extraction process of the fifth level are subjected to global average pooling to obtain a fourth intermediate feature matrix U5;
[0477] The fourth intermediate feature matrices U1, U2, U3, U4 and U5 are concatenated and input into the fully connected layer for full connection processing to obtain second fused feature data, and then the second fused feature data is input into the second classifier to obtain a second detection result.
[0478] The second classifier is, for example, a softmax classifier.
[0479] IV: In the above S104, the detection result may be determined in the following manner: weighted sum of the first detection result and the second detection result is performed to obtain a target detection result.
[0480] The weights corresponding to the first detection result and the second detection result can be specifically set according to actual needs and are not limited here.
[0481] V: In another optional implementation of the present disclosure, another liveness detection method is also provided, and the liveness detection method is implemented by a liveness detection model. The liveness detection model includes: a first sub-model, a second sub-model, and a calculation module;
[0482] The first sub-model includes: a first feature extraction network, a first feature fusion network, and a first classifier;
[0483] The second sub-model includes: a second feature extraction network, a second feature fusion network, and a second classifier;
[0484] The liveness detection model is trained using sample face videos in the training sample set, and the sample face videos are annotated with information on whether they are live or not.
[0485] Wherein: the first feature extraction network is used to obtain the first detection result based on the feature extraction result of each frame of the target face image in the multiple frames of target face images.
[0486] The second feature extraction network is used to obtain a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images.
[0487] The calculation module is used to obtain a liveness detection result based on the first detection result and the second detection result.
[0488] The disclosed embodiment can extract multiple frames of target face images from the video to be detected, and then obtain a first detection result based on the feature extraction result of each frame of the target face image in the multiple frames of the target face image, and obtain a second detection result based on the differential image of each two adjacent target face images in the multiple frames of the target face image; and then determine the liveness detection result of the video to be detected based on the first detection result and the second detection result. In this method, the user does not need to make any specified actions, but uses multiple frames of the user's face images with large differences to silently detect whether the user is alive, and the detection efficiency is higher.
[0489] At the same time, the image obtained by reshooting the screen will lose a lot of image information of the original image. If the video to be detected is a face video obtained by reshooting the screen, the loss of image information will make it impossible to detect subtle changes in the user's appearance, thereby effectively resisting the attack method of screen reshooting.
[0490] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict order of execution and does not impose any limitation on the implementation process. The specific order of execution of the steps should be determined by their functions and possible internal logic.
[0491] See also Figure 4 As shown, the embodiment of the present disclosure also provides another living body detection method, including:
[0492] S401: extracting multiple frames of target face images from the acquired video to be detected, wherein the similarity between adjacent target face images in the multiple frames of target face images is lower than a first value;
[0493] S402: Determine a liveness detection result of the video to be detected based on the multiple frames of target face images.
[0494] The specific implementation method of S401 is shown above and will not be repeated here.
[0495] The disclosed embodiment extracts multiple frames of target face images from the video to be detected, and the similarity between adjacent target face images in the multiple frames of target face images is lower than a first value, and then determines the liveness detection result of the video to be detected based on the target face images. The user does not need to make any specified actions, but uses multiple frames of face images of the user with large differences to silently detect whether the user is alive, and the detection efficiency is higher.
[0496] At the same time, the image obtained by reshooting the screen will lose a lot of image information of the original image. If the video to be detected is a face video obtained by reshooting the screen, the loss of image information will make it impossible to detect subtle changes in the user's appearance, thereby effectively resisting the attack method of screen reshooting.
[0497] In a possible implementation, determining the liveness detection result of the video to be detected based on the multiple frames of target face images includes:
[0498] Obtaining a first detection result based on a feature extraction result of each target face image in the multiple frames of target face images, and / or obtaining a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images;
[0499] Based on the first detection result and / or the second detection result, a living body detection result of the video to be detected is determined.
[0500] The implementation method for obtaining the first detection result and the second detection result may refer to the above description, and for the sake of brevity, it will not be repeated here.
[0501] In a possible implementation manner, a first detection result is obtained and used as a target detection result, or the first detection result is processed to obtain a target detection result.
[0502] In another possible implementation, the second detection result is obtained and used as the target detection result, or the second detection result is processed to obtain the target detection result.
[0503] In another possible implementation, a first detection result and a second detection result are obtained, and based on the first detection result and the second detection result, a liveness detection result for the video to be detected is determined. For example, the first detection result and the second detection result are weightedly summed to obtain the liveness detection result.
[0504] Based on a similar concept, a liveness detection device corresponding to the liveness detection method is also provided in the embodiments of the present disclosure. Since the principle of solving the problem by the device in the embodiments of the present disclosure is similar to the above-mentioned liveness detection method in the embodiments of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0505] Reference Figure 5 FIG. 1 is a schematic diagram of a living body detection device provided by an embodiment of the present disclosure, wherein the device comprises: an acquisition module 51, a first detection module 52, a second detection module 53, and a determination module 54; wherein:
[0506] An acquisition module is used to extract multiple frames of target face images from the acquired video to be detected;
[0507] A first detection module, configured to obtain a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of the target face image;
[0508] A second detection module, configured to obtain a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images;
[0509] A determination module is used to determine a liveness detection result of the video to be detected based on the first detection result and the second detection result.
[0510] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0511] The optional implementation of the present disclosure also provides another living body detection device, including:
[0512] An acquisition unit, configured to extract a plurality of target face images from the acquired video to be detected, wherein the similarity between adjacent target face images in the plurality of target face images is lower than a first value;
[0513] The detection unit is used to determine the liveness detection result of the video to be detected based on the multiple frames of target face images.
[0514] Among them, the description of the processing flow of the acquisition unit and the interaction flow between the modules can refer to the relevant description in the above method embodiment, which will not be described in detail here.
[0515] In an optional implementation, the detection unit includes: a first detection module and / or a second detection module, and a determination module;
[0516] The first detection module is used to obtain a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of the target face image;
[0517] The second detection module is used to obtain a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images;
[0518] The determination module is used to determine a liveness detection result of the video to be detected based on the first detection result and / or the second detection result.
[0519] Here, the description of the processing flow of the first detection module, the second detection module, the determination module, and the interaction flow between the modules can refer to the relevant description in the above method embodiment, which will not be described in detail here.
[0520] The optional implementation of the present disclosure further provides an electronic device 600, such as Figure 6 As shown, it is a schematic diagram of the structure of an electronic device 600 provided in an optional implementation of the present disclosure, including:
[0521] Processor 61, memory 62; memory 62 is used to store execution instructions, including memory 621 and external memory 622; memory 621 here is also called internal memory, which is used to temporarily store the operation data in processor 61 and the data exchanged with external memory 622 such as hard disk. Processor 61 exchanges data with external memory 622 through memory 621. When the electronic device 600 is running, the processor 61 executes the following instructions in user mode:
[0522] Extract multiple frames of target face images from the acquired video to be detected;
[0523] Obtaining a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of the target face image;
[0524] Obtaining a second detection result based on a differential image between every two adjacent target face images in the multiple frames of target face images;
[0525] Based on the first detection result and the second detection result, a living body detection result of the video to be detected is determined.
[0526] Or execute the following command:
[0527] Extracting a plurality of target face images from the acquired video to be detected, wherein the similarity between adjacent target face images in the plurality of target face images is lower than a first value;
[0528] Based on the multiple frames of target face images, a liveness detection result of the video to be detected is determined.
[0529] An optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the liveness detection method described in the optional implementation of the above method are executed.
[0530] Also, see Figure 7 and Figure 8 As shown, the embodiment of the present disclosure also discloses an example of a specific application of the living body detection method provided by the disclosed embodiment.
[0531] In this example, the liveness detection method is performed by the cloud server 1; the cloud server 1 is connected to the user end 2 in communication. The interaction process between the two is shown in the following steps:
[0532] S701: The user terminal 2 uploads the user video to the cloud server. The user terminal 2 uploads the acquired user video to the cloud server 1.
[0533] S702: The cloud server performs facial key point detection. After receiving the user video sent by the user terminal 2, the cloud server 1 performs facial key point detection on each frame image in the user video. If the detection fails, jump to S703; if the detection succeeds, jump to S704.
[0534] S703: the cloud server 1 feeds back the reason for the detection failure to the user terminal 2; at this time, the reason for the detection failure is: no face is detected;
[0535] S704: After receiving the reason for the detection failure from the cloud server 1, the user terminal 2 reacquires the user video and jumps to S701.
[0536] S705: The cloud server 1 crops each frame image in the user video according to the detected facial key points to obtain the video to be detected.
[0537] S706: The cloud server 1 performs alignment processing on each frame of face image in the video to be detected based on the face key points.
[0538] S707: The cloud server 1 selects multiple frames of target face images from the video to be detected.
[0539] S708: The cloud server 1 inputs multiple frames of target face images into the first sub-model of the liveness detection model; and inputs the difference image between each two adjacent frames of target face images into the second sub-model of the liveness detection model for detection.
[0540] Among them, the first sub-model is used to obtain the first detection result based on the feature extraction result of each frame of the target face image in the multiple frames of target face images.
[0541] The second sub-model is used to obtain a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images.
[0542] S709: After the cloud server 1 obtains the first detection result and the second detection result output by the liveness detection model, it obtains the liveness detection result according to the first detection result and the second detection result.
[0543] S710: Feedback the liveness detection result to the user terminal 2.
[0544] Through the above process, the liveness detection process of a video obtained from the user terminal 2 is realized.
[0545] The computer program product of the liveness detection method provided in the optional implementation of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the liveness detection method described in the optional implementation of the above method. For details, please refer to the optional implementation of the above method, which will not be repeated here.
[0546] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the optional implementation of the aforementioned method, and will not be repeated here. In the several optional implementations provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The optional implementation of the device described above is only schematic. For example, the division of the unit is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0547] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of this optional implementation scheme.
[0548] In addition, each functional unit in each optional implementation of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0549] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each optional implementation of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0550] Finally, it should be noted that the optional implementations described above are only specific implementations of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the aforementioned optional implementations, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the aforementioned optional implementations or easily think of changes within the technical scope disclosed in the present disclosure, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the optional implementations of the present disclosure, and should all be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Claims
1. A method for detecting a living body, characterized in that: include: Extract multiple frames of target face images from the acquired video to be detected; Obtaining a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of the target face image; Obtaining a second detection result based on a differential image between every two adjacent target face images in the multiple frames of target face images; Determine a liveness detection result of the video to be detected based on the first detection result and the second detection result; The step of obtaining a first detection result based on the feature data of each target face image in the multiple frames of target face images includes: Performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data; Obtaining the first detection result based on the first fused feature data; The feature extraction result of each frame of the target face image includes: first intermediate feature data corresponding to each level of first feature extraction processing obtained by performing multi-level first feature extraction processing on the target face image; The step of performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data includes: For each level of first feature extraction processing, fusing the first intermediate feature data corresponding to each of the multiple frames of target face images in the first feature extraction processing of that level to obtain intermediate fused data corresponding to the first feature extraction processing of that level; The first fused feature data is obtained based on the intermediate fused data respectively corresponding to the multi-level first feature extraction processing.
2. The method for detecting living body according to claim 1, characterized in that: The step of extracting multiple frames of target face images from the acquired video to be detected includes: Based on the similarity between the multiple frames of face images included in the video to be detected, the multiple frames of target face images are determined from the video to be detected.
3. The method for liveness detection according to claim 1 or 2, characterized in that: The similarity between every two adjacent target face images in the multiple frames of target face images is lower than a first value.
4. The method for liveness detection according to claim 1 or 2, characterized in that: The step of extracting multiple frames of target face images from the acquired video to be detected includes: Determine a first target face image among the multiple frames of target face images from the video to be detected; Based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected is determined, wherein the similarity between the second target facial image and the first target facial image meets a preset similarity requirement.
5. The method for detecting living body according to claim 4, characterized in that: The similarity requirements include: The second target facial image is a facial image having the smallest similarity with the first target facial image among the multiple frames of continuous facial images.
6. The method for detecting living body according to claim 4, characterized in that: The method further comprises: Dividing the video to be detected into multiple segments, wherein each segment includes multiple frames of continuous face images; The step of determining the first target face image in the multiple frames of target face images from the video to be detected includes: Selecting a first target face image from a first segment of the plurality of segments; The method of determining, based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected comprises: Based on the first target facial image, a second target facial image is determined from a second segment adjacent to the first segment among the multiple segments.
7. The method for detecting living body according to claim 4, characterized in that: The similarity between the first target face image and the second target face image in the multiple frames of target face images is obtained based on the following method: Obtaining a face difference image between the first target face image and the second target face image based on a pixel value of each pixel in the first target face image and a pixel value of each pixel in the second target face image; Obtaining the variance corresponding to the face difference image according to the pixel value of each pixel point in the face difference image; The variance is used as the similarity between the first target face image and the second target face image.
8. The method for detecting a living body according to any one of claims 1 to 2 and 5 to 7, characterized in that: Before extracting multiple frames of target face images from the acquired video to be detected, the method further includes: Obtain key point information of each face image in multiple frames of face images included in the video to be detected; Based on the key point information of each face image in the multiple face images, aligning the multiple face images to obtain the aligned face images; The step of extracting multiple frames of target face images from the acquired video to be detected includes: The multiple frames of target face images are extracted from the multiple frames of face images after the alignment process.
9. The method for liveness detection according to claim 1, characterized in that: The fusing process of the first intermediate feature data respectively corresponding to the first feature extraction process of the multiple frames of target face images at the first level to obtain the intermediate fused data corresponding to the first feature extraction process at the first level includes: Based on the first intermediate feature data respectively corresponding to the plurality of frames of target face images in the first feature extraction process of the first level, obtaining a feature sequence corresponding to the first feature extraction process of the first level; The feature sequence is input into a recurrent neural network for fusion processing to obtain intermediate fusion data corresponding to the first feature extraction processing of this level.
10. The method for liveness detection according to claim 9, characterized in that: Before obtaining the feature sequence corresponding to the first feature extraction process at this level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process at this level, the method further includes: Performing global average pooling processing on first intermediate feature data corresponding to each frame of the target face image in the multiple frames of the target face image in the first feature extraction processing at this level, to obtain second intermediate feature data corresponding to each frame of the target face image in the first feature extraction processing at this level; The obtaining of a feature sequence corresponding to the first feature extraction process at this level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process at this level comprises: According to the time sequence of the multiple frames of target facial images, the feature sequence is obtained based on the second intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target facial images at this level.
11. The method for detecting living body according to any one of claims 1, 9 to 10, characterized in that: The step of obtaining the first fused feature data based on the intermediate fused data corresponding to the multi-level first feature extraction processing includes: After the intermediate fusion data corresponding to the multi-level first feature extraction processing are spliced, full connection processing is performed to obtain the first fusion feature data.
12. The method for detecting living body according to claim 11, characterized in that: The feature extraction results of each frame of the target face image are obtained in the following way: Performing a multi-level feature extraction process on the target face image to obtain first initial feature data corresponding to each first feature extraction process in the multi-level feature extraction process; For each level of the first feature extraction processing, a fusion process is performed based on the first initial feature data of the first feature extraction processing of that level and the first initial feature data of at least one level of first feature extraction processing subsequent to the first feature extraction processing of that level to obtain the first intermediate feature data corresponding to the first feature extraction processing of that level, wherein the feature extraction result of the target facial image includes the first intermediate feature data corresponding to each level of the first feature extraction processing in the multiple levels of first feature extraction processing.
13. The method for liveness detection according to claim 12, characterized in that: The step of fusing the first initial feature data of the first feature extraction process of the first level with the first initial feature data of at least one level of first feature extraction process subsequent to the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level includes: The first initial feature data of the first feature extraction processing of the level and the first intermediate feature data corresponding to the first feature extraction processing of the lower level of the first feature extraction processing of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction processing of the level, wherein the first intermediate feature data corresponding to the lower level first feature extraction processing is obtained based on the first initial feature data of the lower level first feature extraction processing.
14. The method for liveness detection according to claim 13, characterized in that: The fusing the first initial feature data of the first feature extraction process of the first level with the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level, comprises: Up-sampling the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process to obtain up-sampled data corresponding to the first feature extraction process of the next level; The up-sampled data corresponding to the first feature extraction process of this level and the first initial feature data are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of this level.
15. The method for detecting living body according to any one of claims 1-2, 5-7, 9-10, 13-14, characterized in that: The obtaining of a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images comprises: Performing cascade processing on the differential images of every two adjacent target face images in the multiple frames of target face images to obtain a differential cascade image; Based on the differential cascaded image, the second detection result is obtained.
16. The method for detecting living body according to claim 15, characterized in that: The obtaining the second detection result based on the differential cascaded image includes: Performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image; Performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data; Based on the second fused feature data, the second detection result is obtained.
17. The method for detecting living body according to claim 16, characterized in that: The step of performing feature extraction processing on the differential cascaded image to obtain a feature extraction result of the differential cascaded image includes: Performing multi-level second feature extraction processing on the differential cascaded image to obtain second initial feature data corresponding to each level of the second feature extraction processing; Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing, a feature extraction result of the differential cascade image is obtained.
18. The method for detecting living body according to claim 16, characterized in that: Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing, a feature extraction result of the differential cascade image is obtained, including: For each level of second feature extraction processing, the second initial feature data of the second feature extraction processing of the level is fused with the second initial feature data of at least one level of second feature extraction processing before the second feature extraction processing of the level, so as to obtain third intermediate feature data corresponding to the second feature extraction processing of the level; The feature extraction result of the differential cascaded image includes third intermediate feature data corresponding to the multiple levels of second feature extraction processing.
19. The method for detecting living body according to claim 18, characterized in that: The second initial feature data of the second feature extraction process of the level is fused with the second initial feature data of the second feature extraction process of at least one level before the second feature extraction process of the level to obtain the third intermediate feature data corresponding to each level of the second feature extraction process, including: Down-sampling the second initial feature data of the upper second feature extraction process of the second feature extraction process of the level to obtain down-sampled data corresponding to the second feature extraction process of the level; The down-sampled data corresponding to the second feature extraction process of the stage and the second initial feature data are fused to obtain third intermediate feature data corresponding to the second feature extraction process of the stage.
20. The method for detecting living body according to claim 19, characterized in that: Before performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data, the method further includes: Performing global average pooling processing on the third intermediate feature data in the second feature extraction processing of each level of the differential cascade image, respectively, to obtain fourth intermediate feature matrices corresponding to the second feature extraction processing of each level of the differential cascade image; The step of performing feature fusion on the feature extraction result of the differential cascaded image to obtain second fused feature data includes: Feature fusion is performed on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data.
21. The method for detecting living body according to claim 20, characterized in that: The step of performing feature fusion on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascaded image to obtain the second fused feature data includes: After the fourth intermediate feature matrices corresponding to the multi-level second feature extraction processing are spliced, a full connection process is performed to obtain the second fused feature data.
22. The method for detecting living body according to any one of claims 1-2, 5-7, 9-10, 13-14, 16-19 and 21, characterized in that: The determining, based on the first detection result and the second detection result, a liveness detection result for the video to be detected includes: The first detection result and the second detection result are weightedly summed to obtain the liveness detection result.
23. A method for detecting a living body, characterized in that: include: Extracting a plurality of target face images from the acquired video to be detected, wherein the similarity between adjacent target face images in the plurality of target face images is lower than a first value; Determine a liveness detection result of the video to be detected based on the multiple frames of target face images; The step of determining the liveness detection result of the video to be detected based on the multiple frames of target face images includes: Obtaining a first detection result based on a feature extraction result of each target face image in the multiple frames of target face images, and / or obtaining a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images; Determine a liveness detection result of the video to be detected based on the first detection result and / or the second detection result; The step of obtaining a first detection result based on the feature data of each target face image in the multiple frames of target face images includes: Performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data; Obtaining the first detection result based on the first fused feature data; The feature extraction result of each frame of the target face image includes: first intermediate feature data corresponding to each level of first feature extraction processing obtained by performing multi-level first feature extraction processing on the target face image; The step of performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data includes: For each level of first feature extraction processing, fusing the first intermediate feature data corresponding to each of the multiple frames of target face images in the first feature extraction processing of that level to obtain intermediate fused data corresponding to the first feature extraction processing of that level; The first fused feature data is obtained based on the intermediate fused data respectively corresponding to the multi-level first feature extraction processing.
24. The method for detecting living body according to claim 23, characterized in that: The step of extracting multiple frames of target face images from the acquired video to be detected includes: Determine a first target face image among the multiple frames of target face images from the video to be detected; Based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected is determined, wherein the similarity between the second target facial image and the first target facial image meets a preset similarity requirement.
25. The method for detecting living body according to claim 24, characterized in that: The similarity requirements include: The second target facial image is a facial image having the smallest similarity with the first target facial image among the multiple frames of continuous facial images.
26. The living body detection method according to any one of claims 24-25, characterized in that: The method further comprises: Dividing the video to be detected into multiple segments, wherein each segment includes multiple frames of continuous face images; The step of determining the first target face image in the multiple frames of target face images from the video to be detected includes: Selecting a first target face image from a first segment of the plurality of segments; The method of determining, based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected comprises: Based on the first target facial image, a second target facial image is determined from a second segment adjacent to the first segment among the multiple segments.
27. The living body detection method according to any one of claims 24-25, characterized in that: The similarity between the first target face image and the second target face image in the multiple frames of target face images is obtained based on the following method: Obtaining a face difference image between the first target face image and the second target face image based on a pixel value of each pixel in the first target face image and a pixel value of each pixel in the second target face image; Obtaining the variance corresponding to the face difference image according to the pixel value of each pixel point in the face difference image; The variance is used as the similarity between the first target face image and the second target face image.
28. The living body detection method according to any one of claims 23 to 25, characterized in that: Before extracting multiple frames of target face images from the acquired video to be detected, the method further includes: Obtain key point information of each face image in multiple frames of face images included in the video to be detected; Based on the key point information of each face image in the multiple face images, aligning the multiple face images to obtain the aligned face images; The step of extracting multiple frames of target face images from the acquired video to be detected includes: The multiple frames of target face images are extracted from the multiple frames of face images after the alignment process.
29. The method for detecting living body according to claim 23, characterized in that: The fusing process of the first intermediate feature data respectively corresponding to the first feature extraction process of the multiple frames of target face images at the first level to obtain the intermediate fused data corresponding to the first feature extraction process at the first level includes: Based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, obtaining a feature sequence corresponding to the first feature extraction process of the first level; The feature sequence is input into a recurrent neural network for fusion processing to obtain intermediate fusion data corresponding to the first feature extraction processing of this level.
30. The method for detecting living body according to claim 29, characterized in that: Before obtaining the feature sequence corresponding to the first feature extraction process at this level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process at this level, the method further includes: Performing global average pooling processing on first intermediate feature data corresponding to each frame of the target face image in the multiple frames of the target face image in the first feature extraction processing at this level, to obtain second intermediate feature data corresponding to each frame of the target face image in the first feature extraction processing at this level; The obtaining of a feature sequence corresponding to the first feature extraction process at this level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process at this level comprises: According to the time sequence of the multiple frames of target face images, the feature sequence is composed based on the second intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target face images at this level.
31. The method for detecting living body according to any one of claims 23, 29-30, characterized in that: The step of obtaining the first fused feature data based on the intermediate fused data corresponding to the multi-level first feature extraction processing includes: After the intermediate fusion data corresponding to the multi-level first feature extraction processing are spliced, full connection processing is performed to obtain the first fusion feature data.
32. The method for detecting living body according to claim 31, characterized in that: The feature extraction results of each frame of the target face image are obtained in the following way: Performing a multi-level feature extraction process on the target face image to obtain first initial feature data corresponding to each first feature extraction process in the multi-level feature extraction process; For each level of the first feature extraction processing, a fusion process is performed based on the first initial feature data of the first feature extraction processing of that level and the first initial feature data of at least one level of first feature extraction processing subsequent to the first feature extraction processing of that level to obtain the first intermediate feature data corresponding to the first feature extraction processing of that level, wherein the feature extraction result of the target facial image includes the first intermediate feature data corresponding to each level of the first feature extraction processing in the multiple levels of first feature extraction processing.
33. The method for detecting living body according to claim 32, characterized in that: The step of fusing the first initial feature data of the first feature extraction process of the first level with the first initial feature data of at least one level of first feature extraction process subsequent to the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level includes: The first initial feature data of the first feature extraction processing of the level and the first intermediate feature data corresponding to the first feature extraction processing of the lower level of the first feature extraction processing of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction processing of the level, wherein the first intermediate feature data corresponding to the lower level first feature extraction processing is obtained based on the first initial feature data of the lower level first feature extraction processing.
34. The method for detecting living body according to claim 33, characterized in that: The fusing the first initial feature data of the first feature extraction process of the first level with the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level, comprises: Up-sampling the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process to obtain up-sampled data corresponding to the first feature extraction process of the next level; The up-sampled data corresponding to the first feature extraction process of this level and the first initial feature data are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of this level.
35. The method for detecting living body according to any one of claims 23, 29-30, characterized in that: The obtaining of a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images comprises: Performing cascade processing on the differential images of every two adjacent target face images in the multiple frames of target face images to obtain a differential cascade image; Based on the differential cascaded image, the second detection result is obtained.
36. The method for detecting living body according to claim 35, characterized in that: The obtaining the second detection result based on the differential cascaded image includes: Performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image; Performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data; Based on the second fused feature data, the second detection result is obtained.
37. The method for detecting living body according to claim 36, characterized in that: The step of performing feature extraction processing on the differential cascaded image to obtain a feature extraction result of the differential cascaded image includes: Performing multi-level second feature extraction processing on the differential cascaded image to obtain second initial feature data corresponding to each level of the second feature extraction processing; Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing, a feature extraction result of the differential cascade image is obtained.
38. The method for detecting living body according to claim 37, characterized in that: Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing, a feature extraction result of the differential cascade image is obtained, including: For each level of second feature extraction processing, the second initial feature data of the second feature extraction processing of the level is fused with the second initial feature data of at least one level of second feature extraction processing before the second feature extraction processing of the level, so as to obtain third intermediate feature data corresponding to the second feature extraction processing of the level; The feature extraction result of the differential cascaded image includes third intermediate feature data corresponding to the multiple levels of second feature extraction processing.
39. The method for detecting living body according to claim 38, characterized in that: The second initial feature data of the second feature extraction process of the level is fused with the second initial feature data of the second feature extraction process of at least one level before the second feature extraction process of the level to obtain the third intermediate feature data corresponding to each level of the second feature extraction process, including: Down-sampling the second initial feature data of the upper second feature extraction process of the second feature extraction process of the level to obtain down-sampled data corresponding to the second feature extraction process of the level; The down-sampled data corresponding to the second feature extraction process of the stage and the second initial feature data are fused to obtain third intermediate feature data corresponding to the second feature extraction process of the stage.
40. The method for detecting living body according to claim 39, characterized in that: Before performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data, the method further includes: Performing global average pooling processing on the third intermediate feature data in the second feature extraction processing of each level of the differential cascade image, respectively, to obtain fourth intermediate feature matrices corresponding to the second feature extraction processing of each level of the differential cascade image; The step of performing feature fusion on the feature extraction result of the differential cascaded image to obtain second fused feature data includes: Feature fusion is performed on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data.
41. The method for detecting living body according to claim 40, characterized in that: The step of performing feature fusion on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascaded image to obtain the second fused feature data includes: After the fourth intermediate feature matrices corresponding to the multi-level second feature extraction processing are spliced, a full connection process is performed to obtain the second fused feature data.
42. The method for detecting a living body according to any one of claims 23-25, 29-30, 33-34, 36-39, and 41, characterized in that: The determining, based on the first detection result and / or the second detection result, a liveness detection result for the video to be detected includes: The first detection result and the second detection result are weightedly summed to obtain the liveness detection result.
43. A living body detection device, characterized in that: include: An acquisition module is used to extract multiple frames of target face images from the acquired video to be detected; A first detection module, configured to obtain a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of the target face image; A second detection module, configured to obtain a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images; A determination module, configured to determine a liveness detection result of the video to be detected based on the first detection result and the second detection result; The first detection module, when obtaining a first detection result based on the feature data of each target face image in the multiple frames of target face images, is used to: Performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data; Obtaining the first detection result based on the first fused feature data; The feature extraction result of each frame of the target face image includes: first intermediate feature data corresponding to each level of first feature extraction processing obtained by performing multi-level first feature extraction processing on the target face image; The first detection module, when performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data, is used to: For each level of first feature extraction processing, fusing the first intermediate feature data corresponding to each of the multiple frames of target face images in the first feature extraction processing of that level to obtain intermediate fused data corresponding to the first feature extraction processing of that level; The first fused feature data is obtained based on the intermediate fused data respectively corresponding to the multi-level first feature extraction processing.
44. The living body detection device according to claim 43, characterized in that: The acquisition module, when extracting multiple frames of target face images from the acquired video to be detected, is used to: Based on the similarity between the multiple frames of face images included in the video to be detected, the multiple frames of target face images are determined from the video to be detected.
45. The living body detection device according to claim 43 or 44, characterized in that: The similarity between every two adjacent target face images in the multiple frames of target face images is lower than a first value.
46. The living body detection device according to claim 43 or 44, characterized in that: The acquisition module, when extracting multiple frames of target face images from the acquired video to be detected, is used to: Determine a first target face image among the multiple frames of target face images from the video to be detected; Based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected is determined, wherein the similarity between the second target facial image and the first target facial image meets a preset similarity requirement.
47. The living body detection device according to claim 46, characterized in that: The similarity requirements include: The second target facial image is a facial image having the smallest similarity with the first target facial image among the multiple frames of continuous facial images.
48. The living body detection device according to claim 46, characterized in that: The acquisition module is also used for: Dividing the video to be detected into multiple segments, wherein each segment includes multiple frames of continuous face images; The acquisition module, when determining the first target face image in the multiple frames of target face images from the video to be detected, is used to: Selecting a first target face image from a first segment of the plurality of segments; The acquisition module is used to determine, based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected, and: Based on the first target facial image, a second target facial image is determined from a second segment adjacent to the first segment among the multiple segments.
49. The living body detection device according to claim 46, characterized in that: The similarity between the first target face image and the second target face image in the multiple frames of target face images is obtained based on the following method: Obtaining a face difference image between the first target face image and the second target face image based on a pixel value of each pixel in the first target face image and a pixel value of each pixel in the second target face image; Obtaining the variance corresponding to the face difference image according to the pixel value of each pixel point in the face difference image; The variance is used as the similarity between the first target face image and the second target face image.
50. The living body detection device according to any one of claims 43-44, 47-49, characterized in that: The acquisition module, before extracting multiple frames of target face images from the acquired video to be detected, is further used to: Obtain key point information of each face image in multiple frames of face images included in the video to be detected; Based on the key point information of each face image in the multiple face images, aligning the multiple face images to obtain the aligned face images; The acquisition module, when extracting multiple frames of target face images from the acquired video to be detected, is used to: The multiple frames of target face images are extracted from the multiple frames of face images after the alignment process.
51. The living body detection device according to claim 43, characterized in that: The first detection module, when fusing the first intermediate feature data corresponding to the first feature extraction process of the multiple frames of target face images in the first feature extraction process of the first level to obtain the intermediate fused data corresponding to the first feature extraction process of the first level, is used to: Based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, obtaining a feature sequence corresponding to the first feature extraction process of the first level; The feature sequence is input into a recurrent neural network for fusion processing to obtain intermediate fusion data corresponding to the first feature extraction processing of this level.
52. The living body detection device according to claim 51, characterized in that: The first detection module, before obtaining a feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, is further used to: Performing global average pooling processing on first intermediate feature data corresponding to each frame of the target face image in the multiple frames of the target face image in the first feature extraction processing at this level, to obtain second intermediate feature data corresponding to each frame of the target face image in the first feature extraction processing at this level; The first detection module, when obtaining a feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, is used to: According to the time sequence of the multiple frames of target facial images, the feature sequence is obtained based on the second intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target facial images at this level.
53. The living body detection device according to any one of claims 43, 51-52, characterized in that: The first detection module, when obtaining the first fused feature data based on the intermediate fused data corresponding to the multi-level first feature extraction process, is used to: After the intermediate fusion data corresponding to the multi-level first feature extraction processing are spliced, full connection processing is performed to obtain the first fusion feature data.
54. The living body detection device according to claim 53, characterized in that: The first detection module is used to obtain the feature extraction result of each frame of the target face image in the following manner: Performing a multi-level feature extraction process on the target face image to obtain first initial feature data corresponding to each first feature extraction process in the multi-level feature extraction process; For each level of the first feature extraction processing, a fusion process is performed based on the first initial feature data of the first feature extraction processing of that level and the first initial feature data of at least one level of first feature extraction processing subsequent to the first feature extraction processing of that level to obtain the first intermediate feature data corresponding to the first feature extraction processing of that level, wherein the feature extraction result of the target facial image includes the first intermediate feature data corresponding to each level of the first feature extraction processing in the multiple levels of first feature extraction processing.
55. The living body detection device according to claim 54, characterized in that: The first detection module, when performing a fusion process based on the first initial feature data of the first feature extraction process of the first level and the first initial feature data of the first feature extraction process of at least one level subsequent to the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level, is used to: The first initial feature data of the first feature extraction processing of the level and the first intermediate feature data corresponding to the first feature extraction processing of the lower level of the first feature extraction processing of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction processing of the level, wherein the first intermediate feature data corresponding to the lower level first feature extraction processing is obtained based on the first initial feature data of the lower level first feature extraction processing.
56. The living body detection device according to claim 55, characterized in that: The first detection module, when fusing the first initial feature data of the first feature extraction process of the first level with the first intermediate feature data corresponding to the first feature extraction process of the lower level of the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level, is used to: Up-sampling the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process to obtain up-sampled data corresponding to the first feature extraction process of the next level; The up-sampled data corresponding to the first feature extraction process of this level and the first initial feature data are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of this level.
57. The living body detection device according to any one of claims 43-44, 47-49, 51-52, 55-56, characterized in that: The second detection module, when obtaining the second detection result based on the differential image of every two adjacent target face images in the multiple frames of target face images, is used to: Performing cascade processing on the differential images of every two adjacent target face images in the multiple frames of target face images to obtain a differential cascade image; Based on the differential cascaded image, the second detection result is obtained.
58. The living body detection device according to claim 57, characterized in that: The second detection module, when obtaining the second detection result based on the differential cascaded image, is used to: Performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image; Performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data; Based on the second fused feature data, the second detection result is obtained.
59. The living body detection device according to claim 58, characterized in that: The second detection module, when performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image, is used to: Performing multi-level second feature extraction processing on the differential cascaded image to obtain second initial feature data corresponding to each level of the second feature extraction processing; Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing, a feature extraction result of the differential cascade image is obtained.
60. The living body detection device according to claim 59, characterized in that: The second detection module, when obtaining the feature extraction result of the differential cascade image based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing, is used to: For each level of second feature extraction processing, the second initial feature data of the second feature extraction processing of the level is fused with the second initial feature data of at least one level of second feature extraction processing before the second feature extraction processing of the level, so as to obtain third intermediate feature data corresponding to the second feature extraction processing of the level; The feature extraction result of the differential cascaded image includes third intermediate feature data corresponding to the multiple levels of second feature extraction processing.
61. The living body detection device according to claim 60, characterized in that: The second detection module, when fusing the second initial feature data of the second feature extraction process of the level with the second initial feature data of the second feature extraction process of at least one level before the second feature extraction process of the level to obtain the third intermediate feature data corresponding to the second feature extraction process of each level, is used to: Down-sampling the second initial feature data of the upper second feature extraction process of the second feature extraction process of the level to obtain down-sampled data corresponding to the second feature extraction process of the level; The down-sampled data corresponding to the second feature extraction process of the stage and the second initial feature data are fused to obtain third intermediate feature data corresponding to the second feature extraction process of the stage.
62. The living body detection device according to any one of claims 58 to 61, characterized in that: The second detection module, before performing feature fusion on the feature extraction result of the differential cascade image to obtain second fused feature data, is further used to: Performing global average pooling processing on the third intermediate feature data in the second feature extraction processing of each level of the differential cascade image, respectively, to obtain fourth intermediate feature matrices corresponding to the second feature extraction processing of each level of the differential cascade image; The step of performing feature fusion on the feature extraction result of the differential cascaded image to obtain second fused feature data includes: Feature fusion is performed on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data.
63. The living body detection device according to claim 62, characterized in that: The second detection module, when performing feature fusion on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data, is used to: After the fourth intermediate feature matrices corresponding to the multi-level second feature extraction processing are spliced, a full connection process is performed to obtain the second fused feature data.
64. The living body detection device according to any one of claims 43-44, 47-49, 51-52, 55-56, 58-61, and 63, characterized in that: The determination module is used, when determining the living body detection result for the video to be detected based on the first detection result and the second detection result, to: The first detection result and the second detection result are weightedly summed to obtain the liveness detection result.
65. A living body detection device, characterized in that: include: An acquisition unit, configured to extract a plurality of target face images from the acquired video to be detected, wherein the similarity between adjacent target face images in the plurality of target face images is lower than a first value; A detection unit, used to determine a liveness detection result of the video to be detected based on the multiple frames of target face images; The detection unit includes: a first detection module and / or a second detection module, and a determination module; The first detection module is used to obtain a first detection result based on a feature extraction result of each frame of the target face image in the multiple frames of the target face image; The second detection module is used to obtain a second detection result based on a differential image of every two adjacent target face images in the multiple frames of target face images; The determination module is used to determine a liveness detection result of the video to be detected based on the first detection result and / or the second detection result; The first detection module, when obtaining a first detection result based on the feature data of each target face image in the multiple frames of target face images, is used to: Performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data; Obtaining the first detection result based on the first fused feature data; The feature extraction result of each frame of the target face image includes: first intermediate feature data corresponding to each level of first feature extraction processing obtained by performing multi-level first feature extraction processing on the target face image; The first detection module, when performing feature fusion processing on the feature extraction results of the multiple frames of target face images to obtain first fused feature data, is used to: For each level of first feature extraction processing, fusing the first intermediate feature data corresponding to each of the multiple frames of target face images in the first feature extraction processing of that level to obtain intermediate fused data corresponding to the first feature extraction processing of that level; The first fused feature data is obtained based on the intermediate fused data respectively corresponding to the multi-level first feature extraction processing.
66. The living body detection device according to claim 65, characterized in that: The acquisition unit, when extracting multiple frames of target face images from the acquired video to be detected, is used to: Determine a first target face image among the multiple frames of target face images from the video to be detected; Based on the first target facial image, a second target facial image adjacent to the first target facial image in the multiple frames of continuous facial images in the video to be detected is determined, wherein the similarity between the second target facial image and the first target facial image meets a preset similarity requirement.
67. The living body detection device according to claim 66, characterized in that: The similarity requirements include: The second target facial image is a facial image having the smallest similarity with the first target facial image among the multiple frames of continuous facial images.
68. The living body detection device according to any one of claims 65 to 67, characterized in that: The acquisition unit is also used for: Dividing the video to be detected into multiple segments, wherein each segment includes multiple frames of continuous face images; The acquisition unit, when determining the first target face image in the plurality of frames of target face images from the video to be detected, is used to: Selecting a first target face image from a first segment of the plurality of segments; The acquisition unit, when determining, based on the first target facial image, from multiple frames of continuous facial images in the video to be detected, a second target facial image adjacent to the first target facial image in the multiple frames of target facial images, is used to: Based on the first target facial image, a second target facial image is determined from a second segment adjacent to the first segment among the multiple segments.
69. The living body detection device according to any one of claims 66-67, characterized in that: The similarity between the first target face image and the second target face image in the multiple frames of target face images is obtained based on the following method: Obtaining a face difference image between the first target face image and the second target face image based on a pixel value of each pixel in the first target face image and a pixel value of each pixel in the second target face image; Obtaining the variance corresponding to the face difference image according to the pixel value of each pixel point in the face difference image; The variance is used as the similarity between the first target face image and the second target face image.
70. The living body detection device according to any one of claims 65 to 67, characterized in that: The acquisition unit, before extracting multiple frames of target face images from the acquired video to be detected, is further used to: Obtain key point information of each face image in multiple frames of face images included in the video to be detected; Based on the key point information of each face image in the multiple face images, aligning the multiple face images to obtain the aligned face images; The acquisition unit, when extracting multiple frames of target face images from the acquired video to be detected, is used to: The multiple frames of target face images are extracted from the multiple frames of face images after the alignment process.
71. The living body detection device according to claim 65, characterized in that: The first detection module, when fusing the first intermediate feature data corresponding to the first feature extraction process of the multiple frames of target face images in the first feature extraction process of the first level to obtain the intermediate fused data corresponding to the first feature extraction process of the first level, is used to: Based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, obtaining a feature sequence corresponding to the first feature extraction process of the first level; The feature sequence is input into a recurrent neural network for fusion processing to obtain intermediate fusion data corresponding to the first feature extraction processing of this level.
72. The living body detection device according to claim 71, characterized in that: The first detection module, before obtaining a feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, is further used to: Performing global average pooling processing on first intermediate feature data corresponding to each frame of the target face image in the multiple frames of the target face image in the first feature extraction processing at this level, to obtain second intermediate feature data corresponding to each frame of the target face image in the first feature extraction processing at this level; The first detection module, when obtaining a feature sequence corresponding to the first feature extraction process of the first level based on the first intermediate feature data respectively corresponding to the multiple frames of target face images in the first feature extraction process of the first level, is used to: According to the time sequence of the multiple frames of target facial images, the feature sequence is obtained based on the second intermediate feature data respectively corresponding to the first feature extraction processing of the multiple frames of target facial images at this level.
73. The living body detection device according to any one of claims 65, 71-72, characterized in that: The first detection module, when obtaining the first fused feature data based on the intermediate fused data corresponding to the multi-level first feature extraction process, is used to: After the intermediate fusion data corresponding to the multi-level first feature extraction processing are spliced, full connection processing is performed to obtain the first fusion feature data.
74. The living body detection device according to claim 73, characterized in that: The first detection module is used to obtain the feature extraction result of each frame of the target face image in the following manner: Performing a multi-level feature extraction process on the target face image to obtain first initial feature data corresponding to each first feature extraction process in the multi-level feature extraction process; For each level of the first feature extraction processing, a fusion process is performed based on the first initial feature data of the first feature extraction processing of that level and the first initial feature data of at least one level of first feature extraction processing subsequent to the first feature extraction processing of that level to obtain the first intermediate feature data corresponding to the first feature extraction processing of that level, wherein the feature extraction result of the target facial image includes the first intermediate feature data corresponding to each level of the first feature extraction processing in the multiple levels of first feature extraction processing.
75. The living body detection device according to claim 74, characterized in that: The first detection module, when performing a fusion process based on the first initial feature data of the first feature extraction process of the first level and the first initial feature data of the first feature extraction process of at least one level subsequent to the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level, is used to: The first initial feature data of the first feature extraction processing of the level and the first intermediate feature data corresponding to the first feature extraction processing of the lower level of the first feature extraction processing of the level are fused to obtain the first intermediate feature data corresponding to the first feature extraction processing of the level, wherein the first intermediate feature data corresponding to the lower level first feature extraction processing is obtained based on the first initial feature data of the lower level first feature extraction processing.
76. The living body detection device according to claim 75, characterized in that: The first detection module, when fusing the first initial feature data of the first feature extraction process of the first level with the first intermediate feature data corresponding to the first feature extraction process of the lower level of the first feature extraction process of the first level to obtain the first intermediate feature data corresponding to the first feature extraction process of the first level, is used to: Up-sampling the first intermediate feature data corresponding to the first feature extraction process of the next level of the first feature extraction process to obtain up-sampled data corresponding to the first feature extraction process of the next level; The up-sampled data corresponding to the first feature extraction process of this level and the first initial feature data are fused to obtain the first intermediate feature data corresponding to the first feature extraction process of this level.
77. The living body detection device according to any one of claims 65, 71-72, characterized in that: The second detection module, when obtaining the second detection result based on the differential image of every two adjacent target face images in the multiple frames of target face images, is used to: Performing cascade processing on the differential images of every two adjacent target face images in the multiple frames of target face images to obtain a differential cascade image; Based on the differential cascaded image, the second detection result is obtained.
78. The living body detection device according to claim 77, characterized in that: The second detection module, when obtaining the second detection result based on the differential cascaded image, is used to: Performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image; Performing feature fusion on the feature extraction results of the differential cascaded images to obtain second fused feature data; Based on the second fused feature data, the second detection result is obtained.
79. The living body detection device according to claim 78, characterized in that: The second detection module, when performing feature extraction processing on the differential cascade image to obtain a feature extraction result of the differential cascade image, is used to: Performing multi-level second feature extraction processing on the differential cascaded image to obtain second initial feature data corresponding to each level of the second feature extraction processing; Based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing, a feature extraction result of the differential cascade image is obtained.
80. The living body detection device according to claim 79, characterized in that: The second detection module, when obtaining the feature extraction result of the differential cascade image based on the second initial feature data respectively corresponding to the multi-level second feature extraction processing, is used to: For each level of second feature extraction processing, the second initial feature data of the second feature extraction processing of the level is fused with the second initial feature data of at least one level of second feature extraction processing before the second feature extraction processing of the level, so as to obtain third intermediate feature data corresponding to the second feature extraction processing of the level; The feature extraction result of the differential cascaded image includes third intermediate feature data corresponding to the multiple levels of second feature extraction processing.
81. The living body detection device according to claim 80, characterized in that: The second detection module, when fusing the second initial feature data of the second feature extraction process of the level with the second initial feature data of the second feature extraction process of at least one level before the second feature extraction process of the level to obtain the third intermediate feature data corresponding to the second feature extraction process of each level, is used to: Down-sampling the second initial feature data of the upper second feature extraction process of the second feature extraction process of the level to obtain down-sampled data corresponding to the second feature extraction process of the level; The down-sampled data corresponding to the second feature extraction process of the stage and the second initial feature data are fused to obtain third intermediate feature data corresponding to the second feature extraction process of the stage.
82. The living body detection device according to any one of claims 78 to 81, characterized in that: The second detection module, before performing feature fusion on the feature extraction result of the differential cascade image to obtain second fused feature data, is further used to: Performing global average pooling processing on the third intermediate feature data in the second feature extraction processing of each level of the differential cascade image, respectively, to obtain fourth intermediate feature matrices corresponding to the second feature extraction processing of each level of the differential cascade image; The step of performing feature fusion on the feature extraction result of the differential cascaded image to obtain second fused feature data includes: Feature fusion is performed on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data.
83. The living body detection device according to claim 82, characterized in that: The second detection module, when performing feature fusion on the fourth intermediate feature matrices corresponding to the second feature extraction processes at each level of the differential cascade image to obtain the second fused feature data, is used to: After the fourth intermediate feature matrices corresponding to the multi-level second feature extraction processing are spliced, a full connection process is performed to obtain the second fused feature data.
84. The living body detection device according to any one of claims 65-67, 71-72, 75-76, 78-81, and 83, characterized in that: The determination module is used, when determining the living body detection result for the video to be detected based on the first detection result and / or the second detection result, to: The first detection result and the second detection result are weightedly summed to obtain the liveness detection result.
85. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor performs the steps of the liveness detection method according to any one of claims 1 to 43.
86. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program. When the computer program is executed by an electronic device, the electronic device performs the steps of the liveness detection method according to any one of claims 1 to 43.
