Human face liveness detection method, device, storage medium and computer equipment

Through the analysis of multi-frame continuous monocular infrared sensor images and optical flow field information, a face time-series image pair is constructed for liveness detection, which solves the problems of low efficiency and low accuracy of face liveness detection in the existing technology, and achieves a more efficient and more efficient Accurate detection.

CN118447583BActive Publication Date: 2024-09-20ZHUHAI HAOZE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410902717.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-09-20
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

Existing face liveness detection technology has low efficiency and low accuracy, especially when the user responds slowly or understands instructions incorrectly, resulting in prolonged liveness detection time and reduced accuracy.

Method used

Multi-frame continuous monocular infrared sensor images are used for face recognition and optical flow field information analysis. Face time-series image pairs are constructed through preset face recognition models and live body detection models, and optical flow field information is used for live body detection.

Benefits of technology

It improves the efficiency and accuracy of live face detection, avoids low-precision problems caused by insufficient information in a single image, reduces the time wasted in command actions, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118447583B
    Figure CN118447583B
Patent Text Reader

Abstract

The present invention discloses a method, device, storage medium and computer equipment for face liveness detection, which relates to the field of face detection technology, and mainly aims to improve the detection efficiency and detection accuracy of liveness. The method includes: obtaining multiple frames of continuous monocular infrared sensor images of a face to be detected; taking any frame image except the last frame in the multiple frames of monocular infrared sensor images as a frame of target monocular infrared sensor image, and using a preset recognition model to recognize each frame of the target monocular infrared sensor image to obtain a recognized face image; based on the position information of the recognized face image, determining the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image; forming a face time-series image pair from the recognized face image and the predicted face image, and determining the optical flow field information of the face time-series image pair; inputting each face time-series image pair and its corresponding optical flow field information into a preset liveness detection model for liveness detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of face detection, and in particular to a method, device, storage medium and computer equipment for detecting live faces. Background Art

[0002] Facial liveness detection technology is a method used to verify whether an individual is alive. It is primarily used in biometric systems, security authentication, intelligent monitoring, and other fields to prevent identity fraud and ensure system security. With the advancement of technology, liveness detection technology is increasingly being used across various industries.

[0003] Currently, liveness is typically determined by requiring the user to perform specific facial movements according to system instructions. However, this liveness detection method can prolong liveness detection time if the user's reaction is slow, resulting in lower liveness detection efficiency. Furthermore, if the user misunderstands the instructions and performs the wrong movements, liveness detection accuracy can be low. Summary of the Invention

[0004] The present invention provides a method, device, storage medium and computer equipment for detecting live faces, which are mainly capable of improving the detection efficiency and accuracy of live faces.

[0005] According to a first aspect of the present invention, a method for detecting a living face is provided, comprising:

[0006] Acquire multiple frames of continuous monocular infrared sensor images containing the face to be detected;

[0007] any frame except the last frame of the multiple frames of the monocular infrared sensor image is used as a frame of the target monocular infrared sensor image, and a preset face recognition model is used to perform face recognition on each frame of the target monocular infrared sensor image to obtain a recognized face image in each frame of the target monocular infrared sensor image;

[0008] Determining a predicted face image in a next frame of a monocular infrared sensor image corresponding to the target monocular infrared sensor image based on position information of the recognized face image corresponding to the target monocular infrared sensor image;

[0009] A face time-series image pair under the target monocular infrared sensor image is formed by the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and optical flow field information of the face time-series image pair is determined;

[0010] The face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information are input into a preset face liveness detection model for liveness detection to obtain a liveness detection result corresponding to the face to be detected.

[0011] Optionally, determining the optical flow field information of the face time-series image pair includes:

[0012] Determining sparse pixel points on the recognized face image in the target monocular infrared sensor image, and determining reference sparse pixel points corresponding to the sparse pixel points in a next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image;

[0013] Determining sparse position information of each of the sparse pixel points and reference sparse position information of each of the reference sparse pixel points;

[0014] Determine sparse motion state information of the sparse pixels between the target monocular infrared sensor image and the next frame of the monocular infrared sensor image based on the sparse position information of each of the sparse pixels, the reference sparse position information of each of the reference sparse pixels, and the shooting time interval between the target monocular infrared sensor image and the next frame of the monocular infrared sensor image, wherein the sparse motion state information includes the motion direction and motion speed of the sparse pixels;

[0015] Determining dense pixel points in the target monocular infrared sensor image, and determining reference dense pixel points corresponding to the dense pixel points in a next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image;

[0016] Determining dense position information of each of the dense pixel points and reference dense position information of each of the reference dense pixel points;

[0017] Determining dense motion state information of dense pixels between the target monocular infrared sensor image and the next frame of monocular infrared sensor image based on dense position information of each of the dense pixels, reference dense position information of each of the reference dense pixels, and a shooting time interval between the target monocular infrared sensor image and the next frame of monocular infrared sensor image, wherein the dense motion state information includes a motion direction and a motion speed of the dense pixels;

[0018] Determining weight coefficients corresponding to the sparse motion state information and the dense motion state information respectively;

[0019] Based on the weight coefficient, the sparse motion state information and the dense motion state information are added to obtain optical flow field information of the face time series image pair.

[0020] Optionally, performing face recognition on each frame of the target monocular infrared sensor image using a preset face recognition model to obtain a recognized face image in each frame of the target monocular infrared sensor image includes:

[0021] Input each frame of the target monocular infrared sensor image into a preset face recognition model for face recognition, and obtain a pixel-level heat map corresponding to each frame of the target monocular infrared sensor image;

[0022] According to different color areas in the pixel-level heat map, a recognized face image in each frame of the target monocular infrared sensor image is determined.

[0023] Optionally, determining the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image based on the position information of the recognized face image corresponding to the target monocular infrared sensor image includes:

[0024] Based on the position information of the recognized face image corresponding to the target monocular infrared sensor image, an image area at the same position as the recognized face image in the target monocular infrared sensor image is determined in the next frame of the monocular infrared sensor image, and the image area at the same position is determined as the predicted face image in the next frame of the monocular infrared sensor image.

[0025] Optionally, before inputting the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information into a preset face liveness detection model for liveness detection and obtaining a liveness detection result corresponding to the face to be detected, the method further includes:

[0026] Build a preset initial face liveness detection model;

[0027] Obtaining a sample face time-series image pair corresponding to multiple frames of continuous sample monocular infrared sensor images containing a sample face image and its corresponding sample optical flow field information, as well as an actual face liveness detection result corresponding to the sample face image;

[0028] Inputting each of the sample face time-series image pairs and their corresponding sample optical flow field information into the preset initial face liveness detection model for liveness detection, and obtaining a predicted face liveness detection result corresponding to the sample face image;

[0029] Constructing a loss function based on the actual face liveness detection result and the predicted face liveness detection result;

[0030] Based on the loss function, the preset initial face liveness detection model is iteratively trained to obtain the preset face liveness detection model.

[0031] Optionally, the preset face liveness detection model includes a backbone network layer, a feature branching layer, and a feature classification layer; the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information are input into the preset face liveness detection model for liveness detection, and a liveness detection result corresponding to the face to be detected is obtained, including:

[0032] Inputting each of the face time-series image pairs into the backbone network layer for feature extraction to obtain a face image feature vector of the face to be detected;

[0033] Inputting the optical flow field information corresponding to each of the face time series image pairs into the feature branch layer for feature extraction to obtain the optical flow feature vector of the face to be detected;

[0034] Cross-processing the facial image feature vector and the optical flow feature vector to obtain a facial cross feature vector;

[0035] Inputting the face cross feature vector into the feature classification layer for classification processing to obtain the liveness detection probability and non-liveness detection probability corresponding to the face to be detected;

[0036] If the liveness detection probability is greater than the non-liveness detection probability, determining that the face to be detected is a live face;

[0037] If the liveness detection probability is less than or equal to the non-liveness detection probability, the face to be detected is determined to be a non-liveness face.

[0038] Optionally, cross-processing the facial image feature vector and the optical flow feature vector to obtain a facial cross feature vector includes:

[0039] Multiplying each element in the facial image feature vector with the element at the corresponding position in the optical flow feature vector to obtain each vector product, and determining a transformation coefficient corresponding to each vector product; performing a linear transformation on each vector product based on the transformation coefficient to obtain a first cross feature vector;

[0040] Multiplying each element in the facial image feature vector by each element in the optical flow feature vector to obtain a second cross feature vector;

[0041] horizontally splicing the facial image feature vector and the optical flow feature vector to obtain a spliced ​​feature vector, determining a splicing coefficient corresponding to the spliced ​​feature vector, and performing a linear transformation on the spliced ​​feature vector based on the splicing coefficient to obtain a third cross feature vector;

[0042] The face cross feature vector is determined based on the first cross feature vector, the second cross feature vector, and the third cross feature vector.

[0043] According to a second aspect of the present invention, there is provided a face liveness detection device, comprising:

[0044] An acquisition unit, configured to acquire multiple frames of continuous monocular infrared sensor images containing a face to be detected;

[0045] a face recognition unit, configured to use any frame image except the last frame of the multiple frames of the monocular infrared sensor image as a frame of the target monocular infrared sensor image, perform face recognition on each frame of the target monocular infrared sensor image using a preset face recognition model, and obtain a recognized face image in each frame of the target monocular infrared sensor image;

[0046] A first determining unit is configured to determine, based on position information of the recognized face image corresponding to the target monocular infrared sensor image, a predicted face image in a next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image;

[0047] a second determining unit, configured to construct a face time-series image pair under the target monocular infrared sensor image from the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and determine optical flow field information of the face time-series image pair;

[0048] The liveness detection unit is used to input the face time-series image pair and the corresponding optical flow field information of each frame of the target monocular infrared sensor image into a preset face liveness detection model for liveness detection, and obtain the liveness detection result corresponding to the face to be detected.

[0049] According to a third aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned face liveness detection method is implemented.

[0050] According to a fourth aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for liveness detection of a face when executing the program.

[0051] According to a face liveness detection method, device, storage medium and computer equipment provided by the present invention, compared with the current method of requiring the user to perform specific facial movements according to the system's instructions and determining whether the user is alive based on the execution of the facial movements, the present invention obtains multiple frames of continuous monocular infrared sensor images containing the face to be detected; and uses any frame image except the last frame of the multiple frames of the monocular infrared sensor images as a frame of target monocular infrared sensor image, and uses a preset face recognition model to perform face recognition on each frame of the target monocular infrared sensor image to obtain a recognized face image in each frame of the target monocular infrared sensor image; at the same time, based on the target monocular infrared sensor image The method comprises the following steps: first, determining the position information of the recognized face image corresponding to the target monocular infrared sensor image, determining the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image; then, forming a face time-series image pair under the target monocular infrared sensor image by the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and determining the optical flow field information of the face time-series image pair; finally, inputting the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information into a preset face liveness detection model for liveness detection, and obtaining a liveness detection result corresponding to the face to be detected. Therefore, by obtaining continuous frame monocular infrared sensor images and capturing face time-series image pairs through recognition model and position information, the model is finally used to analyze the face time-series image pairs and their corresponding optical flow field information to obtain the face liveness detection result. That is, the present application can better distinguish screen face images through the monocular infrared method compared with the visible light method, which is convenient for the recognition of face images. At the same time, by constructing face time-series image pairs for liveness detection, it can avoid the problem of low liveness detection accuracy caused by less detection information when performing liveness detection on a single image. Therefore, the present invention can improve the face liveness detection accuracy. In addition, the present invention introduces the optical flow field information of the time-series image pairs when performing face liveness detection, which can further improve the face liveness detection accuracy. In addition, the present invention can also avoid the time wasted in instructing the face to perform the corresponding instruction action, so that the present invention can improve the face liveness detection efficiency and enhance the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0053] Figure 1 A flow chart of a method for detecting live faces provided by an embodiment of the present invention is shown;

[0054] Figure 2 A flowchart of another method for detecting living faces provided by an embodiment of the present invention is shown;

[0055] Figure 3 A schematic structural diagram of a face liveness detection device provided by an embodiment of the present invention is shown;

[0056] Figure 4 A schematic structural diagram of another face liveness detection device provided by an embodiment of the present invention is shown;

[0057] Figure 5 A schematic diagram of the physical structure of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0058] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of the present application can be combined with each other.

[0059] Currently, the method of requiring users to perform specific facial movements according to the system's instructions and determining whether the user is alive is based on the execution of the facial movements. If the user reacts slowly, the efficiency of liveness detection will be low. At the same time, if the user misunderstands the instructions and performs the wrong movements, the accuracy of liveness detection will be low.

[0060] In order to solve the above problems, the embodiment of the present invention provides a method for detecting human face liveness, such as Figure 1 As shown, the method includes:

[0061] 101. Acquire multiple frames of continuous monocular infrared sensor images containing a face to be detected.

[0062] The monocular infrared sensor image is a single image for each video frame formed by the infrared sensor receiving infrared rays emitted by the face to be detected. In the embodiment of the present invention, a multi-frame continuous monocular infrared sensor image of the face to be detected is obtained using an infrared sensor. Then, based on the multi-frame continuous monocular infrared sensor image, a face time-series image pair is captured. Then, based on the face time-series image pair, a model is used to perform face liveness detection. Thus, the multi-frame continuous monocular infrared sensor image of the face to be detected is obtained by infrared. Compared with the visible light method, the screen face image can be better distinguished, thereby improving the accuracy of face liveness detection. At the same time, by constructing the face time-series image pair, more face information can be obtained, thereby further improving the accuracy of face liveness detection.

[0063] 102. Any frame image except the last frame in the multiple frames of monocular infrared sensor images is used as a frame of target monocular infrared sensor image, and a preset face recognition model is used to perform face recognition on each frame of the target monocular infrared sensor image to obtain a recognized face image in each frame of the target monocular infrared sensor image.

[0064] For example, if at time t0, t1, ..., t n Obtain consecutive frames of monocular infrared sensor images as img0, img1, ..., img n , and will exclude img n Monocular infrared sensor images other than img0, img1, ..., img n-1 They are respectively used as target monocular infrared sensor images, and the preset face recognition model is used to respectively detect the target monocular infrared sensor images img0, img1, ..., img n-1 Perform face recognition, img0, img1, ..., img n-1 The facial recognition image areas detected in the image are marked as box0, box1, ..., box n-1 Then, based on the position information of the recognized face image in the target monocular infrared sensor image, the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image is determined, so that the recognized face image in the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to it constitute a face time-series image pair, and finally based on the face time-series image pair, liveness recognition is performed on the face to be detected. Therefore, by capturing the face time-series frames in the face recognition process to construct image pairs and performing liveness recognition through a neural network, the liveness recognition efficiency and accuracy of the face can be improved.

[0065] 103. Determine a predicted face image in a next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image based on position information of the recognized face image corresponding to the target monocular infrared sensor image.

[0066] 104. A face time-series image pair under the target monocular infrared sensor image is formed by the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and optical flow field information of the face time-series image pair is determined.

[0067] The optical flow field information refers to a two-dimensional (2D) instantaneous velocity field information composed of all pixels in the image, that is, the apparent motion of the image grayscale pattern, including the instantaneous motion velocity vector information of each pixel in the image.

[0068] For the embodiment of the present invention, if the target monocular infrared sensor images img0, img1, ..., img n-1 Perform face recognition, and the identified face images are marked as box0, box1, ..., box n-1 Then, according to the position information of the recognized face image box0 in the target monocular infrared sensor image img0, the image of the same area in the monocular infrared sensor image img1 is determined, that is, the predicted face image box0_. Similarly, according to the position information of the recognized face image box1 in the target monocular infrared sensor image img1, the image of the same area in the monocular infrared sensor image img2 is determined, that is, the predicted face image box1_. n-1 In the target monocular infrared sensor image img n-1 The position information in the monocular infrared sensor image img n Determine the image of the same area, that is, predict the face image box n-1 _, then box0 and box0_ are determined as the face time sequence image pair under the target monocular infrared sensor image img0, box1 and box1_ are determined as the face time sequence image pair under the target monocular infrared sensor image img1, and box n-1 and box n-1 _Identified as the target monocular infrared sensor image img n-1 The face time-series image pairs under the face are obtained, and then the optical flow field information corresponding to each face time-series image pair is determined. Finally, based on each face time-series image pair and its corresponding optical flow field information, the model is used to perform liveness detection on the face to be detected. Therefore, in the face recognition process, by capturing the face time-series frames to construct the time-series image pairs, the problem of insufficient information in a single image can be avoided, thereby improving the accuracy of face liveness detection. At the same time, the optical flow field information is introduced in the face liveness detection process, which can capture the movement information of the face in continuous frame images, thereby further improving the accuracy of face liveness detection. At the same time, liveness recognition through the model can improve the efficiency and accuracy of face liveness detection.

[0069] 105. Input the face time-series image pair and its corresponding optical flow field information in each frame of the target monocular infrared sensor image into a preset face liveness detection model for liveness detection, and obtain a liveness detection result corresponding to the face to be detected.

[0070] In an embodiment of the present invention, after acquiring a face time-series image pair for each frame of a target monocular infrared sensor image and the optical flow field information of each face time-series image pair, each face time-series image pair and its corresponding optical flow field information are simultaneously input into a preset face liveness detection model for liveness detection. Finally, the preset face liveness detection model can output a detection result of whether the face to be detected is alive. Thus, by constructing face time-series image pairs for liveness detection, the problem of low liveness detection accuracy caused by less detection information when performing liveness detection on a single image can be avoided, thereby improving the accuracy of face liveness detection. In addition, the present invention introduces the optical flow field information of the time-series image pairs when performing face liveness detection. By performing liveness detection through comprehensive analysis of the image pairs and the optical flow field information, the accuracy of face liveness detection can be further improved. In addition, the present invention can also avoid the time wasted in instructing the face to perform the corresponding command action, thereby improving the efficiency of face liveness detection and enhancing the user experience. It should be noted that the embodiment of the present invention can also simply input a face time-series image pair under a target monocular infrared sensor image and its corresponding optical flow field information into a preset face liveness detection model for liveness detection. This method can also detect whether the face is a live face.

[0071] According to a face liveness detection method provided by the present invention, compared with the current method of requiring the user to perform specific facial movements according to the system's instructions and determining whether the user is alive based on the execution of the facial movements, the present invention obtains multiple frames of continuous monocular infrared sensor images containing the face to be detected; and uses any frame image except the last frame of the multiple frames of the monocular infrared sensor images as a frame of target monocular infrared sensor image, and uses a preset face recognition model to perform face recognition on each frame of the target monocular infrared sensor image to obtain a recognized face image in each frame of the target monocular infrared sensor image; at the same time, based on the recognized face corresponding to the target monocular infrared sensor image, The method comprises the following steps: first, determining the position information of the face image, determining the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and then forming a face time-series image pair under the target monocular infrared sensor image by using the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and determining the optical flow field information of the face time-series image pair; and finally inputting the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information into a preset face liveness detection model for liveness detection, and obtaining a liveness detection result corresponding to the face to be detected. Therefore, by obtaining continuous frame monocular infrared sensor images and capturing face time-series image pairs through recognition model and position information, the model is finally used to analyze the face time-series image pairs and their corresponding optical flow field information to obtain the face liveness detection result. That is, the present application can better distinguish screen face images through the monocular infrared method compared with the visible light method, which is convenient for the recognition of face images. At the same time, by constructing face time-series image pairs for liveness detection, it can avoid the problem of low liveness detection accuracy caused by less detection information when performing liveness detection on a single image. Therefore, the present invention can improve the face liveness detection accuracy. In addition, the present invention introduces the optical flow field information of the time-series image pairs when performing face liveness detection, which can further improve the face liveness detection accuracy. In addition, the present invention can also avoid the time wasted in instructing the face to perform the corresponding instruction action, so that the present invention can improve the face liveness detection efficiency and enhance the user experience.

[0072] Furthermore, in order to better illustrate the above process of performing liveness detection on a face, as a refinement and extension of the above embodiment, an embodiment of the present invention provides another method for liveness detection on a face, such as Figure 2 As shown, the method includes:

[0073] 201. Acquire multiple frames of continuous monocular infrared sensor images containing a face to be detected.

[0074] Specifically, at multiple consecutive moments, multiple images of the face to be detected are obtained by using an infrared sensor, and then image preprocessing is performed on each of the consecutive images to be detected. The specific preprocessing method is to perform grayscale processing on each image to be detected to obtain a grayscale image corresponding to each image to be detected, and then each grayscale image is normalized, that is, each grayscale image is normalized to an image between -1 and 1. For example, for each pixel in the grayscale image, normalization can be performed according to the following formula:

[0075]

[0076] Among them, Gray g Represents the normalized pixel, Gray represents any pixel value in the grayscale image. Therefore, the above formula can be used to normalize each pixel in the grayscale image, thereby obtaining a normalized grayscale image, and the normalized image is determined as a monocular infrared sensor image.

[0077] 202. Any frame image except the last frame in the multiple frames of monocular infrared sensor images is used as a frame of target monocular infrared sensor image, and a preset face recognition model is used to perform face recognition on each frame of the target monocular infrared sensor image to obtain a recognized face image in each frame of the target monocular infrared sensor image.

[0078] For the embodiment of the present invention, any frame image except the last frame in the multiple frames of monocular infrared sensor images is respectively used as a frame of target monocular infrared sensor image, and then face recognition is performed on each frame of the target monocular infrared sensor image. Based on this, step 202 specifically includes: inputting each frame of the target monocular infrared sensor image into a preset face recognition model for face recognition, and obtaining a pixel-level heat map corresponding to each frame of the target monocular infrared sensor image; and determining the recognized face image in each frame of the target monocular infrared sensor image according to different color areas in the pixel-level heat map.

[0079] Specifically, the preset face recognition model is a pre-trained neural network model. The preset face recognition model has 8 convolutional layers. The number, width, height and thickness of the convolution kernels of the first convolution layer are 96×11×11×3 respectively. The number, width, height and thickness of the convolution kernels of the second convolution layer are 256×5×5×48 respectively. The number, width, height and thickness of the convolution kernels of the third convolution layer are 384×3×3×256 respectively. The number, width, height and thickness of the convolution kernels of the fourth convolution layer are and thickness are 384×3×3×192 respectively. The number, width, height and thickness of the convolution kernel of the fifth convolution layer are 256×3×3×192 respectively. The size (number of channels, width, height) of the convolution kernel of the sixth layer is (4096,1,1), the size (number of channels, width, height) of the convolution kernel of the seventh layer is (4096,1,1), and the size (number of channels, width, height) of the convolution kernel of the eighth layer is (1000,1,1). The step size of the above convolution kernels can all be set to 1, and the padding is filled with 0.Specifically, each frame of the target monocular infrared sensor image is input into the preset face recognition model for face recognition. The target monocular infrared sensor image can be pre-processed into an image of size 3×480×640. The number, width, height and thickness of the convolution kernel of the first convolution layer are 96×11×11×3 respectively. The target monocular infrared sensor image is processed by the first convolution layer, and the resulting image size is 96×240×320. The number, width, height and thickness of the convolution kernel of the second convolution layer are 256 respectively. ×5×5×48, the target monocular infrared sensor image is processed by the second convolution layer, and the resulting image size is 256×120×160. The number, width, height and thickness of the convolution kernels of the third convolution layer are 384×3×3×256 respectively. The target monocular infrared sensor image is processed by the third convolution layer, and the resulting image size is 384×60×80. The number, width, height and thickness of the convolution kernels of the fourth convolution layer are 384×3×3×192 respectively. After the fourth convolution layer processing, the size of the target monocular infrared sensor image is 384×60×80. The number, width, height and thickness of the convolution kernel of the fifth convolution layer are 256×3×3×192 respectively. The target monocular infrared sensor image is processed by the fifth convolution layer, and the size of the image is 256×60×80. The size of the convolution kernel of the sixth layer (number of channels, width, height) is (4096,1,1). The target monocular infrared sensor image is processed by the sixth convolution layer, and the size of the image is 40 The convolution kernel size of the seventh layer (number of channels, width, height) is (4096, 1, 1). The target monocular infrared sensor image is processed by the seventh convolution layer, resulting in an image size of 4096 × 30 × 40. The convolution kernel size of the eighth layer (number of channels, width, height) is (1000, 1, 1). The target monocular infrared sensor image is processed by the eighth convolution layer, resulting in an image size of 1000 × 30 × 40. The stride of the convolution kernels can all be set to 1, and the padding is 0. The preset face recognition model ultimately outputs a pixel-level heat map. Based on the different color regions on this heat map, face and non-face areas can be distinguished, thereby identifying faces in each target monocular infrared sensor image. Using a preset face recognition model with multiple convolution layers to identify face regions in an image can improve face recognition accuracy, thereby improving the accuracy of face liveness detection.

[0080] 203. Determine a predicted face image in a next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image based on the position information of the recognized face image corresponding to the target monocular infrared sensor image.

[0081] For an embodiment of the present invention, in order to form a face time-series image pair, it is also necessary to use a method different from the preset face recognition model to identify a predicted face image in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image. Based on this, step 203 specifically includes: based on the position information of the recognized face image corresponding to the target monocular infrared sensor image, determining in the next frame of monocular infrared sensor image the image area at the same position as the recognized face image in the target monocular infrared sensor image, and determining the image area at the same position as the predicted face image in the next frame of monocular infrared sensor image.

[0082] Specifically, if the coordinates of the four vertices of the circumscribed rectangular outline of the recognized face image in the target monocular infrared sensor image are (x, y), (x1, y), (x1, y1), and (x, y1), then an area corresponding to the same coordinate position is found in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image, and the area is determined as the predicted face image in the next frame of monocular infrared sensor image. Then, the recognized face image in the target monocular infrared sensor image and the predicted face image in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image constitute a face time-series image pair under the target monocular infrared sensor image. Performing face liveness detection through the face time-series image pair can avoid the problem of insufficient information in a single image, that is, more image information can be obtained, thereby improving the detection accuracy of face liveness. In addition, there is a time-series logic between the image pairs, which can make the acquired image information more meaningful for reference, thereby further improving the detection accuracy of human liveness.

[0083] 204. A face time-series image pair under the target monocular infrared sensor image is formed by the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and optical flow field information of the face time-series image pair is determined.

[0084] For an embodiment of the present invention, if the recognized face image in the target monocular infrared sensor image img0 is box0, and the predicted face image in the next frame monocular infrared sensor image img1 corresponding to image img0 is box0_, then box0 and box0_ constitute a face time-series image pair under the target monocular infrared sensor image img0; if the recognized face image in the target monocular infrared sensor image img1 is box1, and the predicted face image in the next frame monocular infrared sensor image img2 corresponding to image img1 is box1_, then box1 and box1_ constitute a face time-series image pair under the target monocular infrared sensor image img1, thereby obtaining a face time-series image pair under each target monocular infrared sensor image. Furthermore, in order to improve the accuracy of face liveness detection, after determining the face time-series image pairs under each target monocular infrared sensor image, it is also necessary to determine the optical flow field information corresponding to each face time-series image. Based on this, step 204 specifically includes: determining sparse pixel points on the recognized face image in the target monocular infrared sensor image, and determining reference sparse pixel points corresponding to the sparse pixel points in the next frame monocular infrared sensor image corresponding to the target monocular infrared sensor image; determining the sparse position information of each of the sparse pixel points and the reference sparse position information of each of the reference sparse pixel points; based on the sparse position information of each of the sparse pixel points, the reference sparse position information of each of the reference sparse pixel points, and the shooting time interval between the target monocular infrared sensor image and the next frame monocular infrared sensor image, determining the sparse motion state information of the sparse pixel points between the target monocular infrared sensor image and the next frame monocular infrared sensor image, wherein the sparse motion state information includes the motion direction of the sparse pixel points and motion speed; determining dense pixel points in the target monocular infrared sensor image, and determining reference dense pixel points corresponding to the dense pixel points in the next frame monocular infrared sensor image corresponding to the target monocular infrared sensor image; determining dense position information of each of the dense pixel points and reference dense position information of each of the reference dense pixel points; based on the dense position information of each of the dense pixel points, the reference dense position information of each of the reference dense pixel points, and the shooting time interval between the target monocular infrared sensor image and the next frame monocular infrared sensor image, determining dense motion state information of the dense pixel points between the target monocular infrared sensor image and the next frame monocular infrared sensor image, wherein the dense motion state information includes the motion direction and motion speed of the dense pixel points; respectively determining weight coefficients corresponding to the sparse motion state information and the dense motion state information; based on the weight coefficients, adding the sparse motion state information and the dense motion state information to obtain optical flow field information of the face time series image pair.

[0085] Among them, the optical flow field information is the instantaneous speed of pixel movement of a spatial moving object on the observation imaging plane. It is a method of using the changes in pixels in the time domain in the image sequence and the correlation between adjacent frames to find the correspondence between the previous frame and the current frame, thereby calculating the motion information of the object between adjacent frames; sparse pixel points refer to several key pixel points in the target monocular infrared sensor image, such as the pixel points of the eye and nose parts on the face image, and dense pixel points refer to all pixel points in the target monocular infrared sensor image; the weight coefficient is set based on empirical data.

[0086] Specifically, the effectiveness of optical flow depends on the following conditions: the pixel intensity of the object does not change between consecutive frames, and adjacent pixels in the same image have similar motion. If the sparse position information of a sparse pixel point a in a monocular infrared sensor image of a target is (x, y, t), at time d t The position information (reference coefficient position information) of the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image is (x+d x , y+d y ), when the grayscale values ​​in the two images remain unchanged, the following formula can be obtained:

[0087]

[0088] Where I is the grayscale value (pixel intensity) calculation function, x represents the horizontal coordinate of the sparse pixel point a in the target monocular infrared sensor image, y represents the vertical coordinate of the sparse pixel point a in the target monocular infrared sensor image, t represents the acquisition time of the target monocular infrared sensor image, d x Indicates the horizontal coordinate change of the sparse pixel point a from the target monocular infrared sensor image to the next frame monocular infrared sensor image, d y Indicates the change in the vertical coordinate of the sparse pixel point a from the target monocular infrared sensor image to the next frame of the monocular infrared sensor image, d t Represents the time interval between the capture of the target monocular infrared sensor image and the capture of the next monocular infrared sensor image. Regarding the above formula, perform Taylor series expansion on the right side of the equal sign, eliminate the same terms, and divide both sides by dt to obtain the following optical flow equation formula:

[0089]

[0090] ;

[0091] ;

[0092] Among them, fx is the gradient of the horizontal coordinate direction of the pixel point a position information in the target monocular infrared sensor image, f y is the gradient in the ordinate direction of the position information, f t is the gradient in the time direction, u represents the motion direction of the sparse pixel point a between the target monocular infrared sensor image and the corresponding next frame monocular infrared sensor image, v represents the motion speed of the sparse pixel point a between the target monocular infrared sensor image and the corresponding next frame monocular infrared sensor image, represents the partial derivative of the optical flow function f with respect to the horizontal coordinate x, Represents the partial derivative of the optical flow function f with respect to the ordinate y, represents the partial derivative of the optical flow function x with respect to time t, Represents the partial derivative of the optical flow function y with respect to the ordinate t. Furthermore, if all pixels in the domain have the same motion, for example, 9 sparse pixels in a 3x3 domain have the same motion, the optical flow equations for the 9 points can be obtained through the calculation process of the above optical flow equation (i.e., the above formula). These equations are used to solve the two unknowns (u, v). For a more accurate solution, the least squares method can be used to fit multiple optical flow equations. The fitted optical flow information calculation formula is as follows:

[0093]

[0094] Among them, i represents the i-th sparse pixel point, f xi is the gradient of the horizontal coordinate direction of the pixel i position information in the target monocular infrared sensor image, f yi is the gradient in the ordinate direction of the pixel i position information, f ti is the gradient of pixel i in the time direction. Therefore, the above formula can be used to calculate the motion direction u and motion speed v of the sparse pixels between the target monocular infrared sensor image and the next frame monocular infrared sensor image. Similarly, all pixels (dense pixels) are determined in the target monocular infrared sensor image, and the optical flow equations of all dense pixels are determined according to the above method. Then, all optical flow equations are fitted into the optical flow information calculation formula using the least squares method. The motion direction u of the dense pixels between the target monocular infrared sensor image and the next frame monocular infrared sensor image can be calculated through the optical flow information calculation formula. c and the movement speed v c , then determine the weight coefficients corresponding to the sparse motion state information and the dense motion state information based on empirical data. For example, if the weight coefficient of the sparse motion state information is θ1 and the weight coefficient of the dense motion state information is θ2, then the transport direction u in the optical flow field information corresponding to the face time series image under the target infrared sensor image is z For: u z=θ1×u+θ2×u c , movement speed v z For: v z =θ1×v+θ2×v c . Then, based on each pair of face time-series images and their corresponding optical flow field information, liveness detection is performed on the face. Therefore, in the process of face liveness detection, not only the static image information but also the motion information of the face in the image is considered, thereby improving the accuracy of face liveness detection. It should be noted that the embodiment of the present invention is not limited to the above-mentioned method of calculating the optical flow field information, and the optical flow field information can also be calculated by image matching or the optical flow algorithm in opencv (OpenSource Computer Vision Library, visual processing open source software library) to calculate the optical flow field information.

[0095] Furthermore, after obtaining each face time-series image pair and its corresponding optical flow field information, it is necessary to input the face time-series image pair and its corresponding optical flow field information into a preset face liveness detection model for liveness detection. In order to improve the detection accuracy of the preset face liveness detection model, it is necessary to pre-train and construct the preset face liveness detection model. Based on this, the method includes: constructing a preset initial face liveness detection model; obtaining sample face time-series image pairs and their corresponding sample optical flow field information corresponding to multiple frames of continuous sample monocular infrared sensor images with sample face images, as well as actual face liveness detection results corresponding to the sample face images; inputting each of the sample face time-series image pairs and their corresponding sample optical flow field information into the preset initial face liveness detection model for liveness detection, and obtaining predicted face liveness detection results corresponding to the sample face images; constructing a loss function based on the actual face liveness detection results and the predicted face liveness detection results; and iteratively training the preset initial face liveness detection model based on the loss function to obtain the preset face liveness detection model.

[0096] Among them, the sample face images include living face images and non-living face images, and the sample optical flow field information refers to a two-dimensional (2D) instantaneous velocity field information composed of all pixels in the sample image, that is, the apparent motion of the image grayscale pattern, including the instantaneous motion velocity vector information of each pixel in the sample image. The images except the last frame image in the multi-frame continuous sample monocular infrared sensor image are respectively determined as a frame of target sample image, and the face recognition model is used to perform face recognition on each frame of target sample image to obtain the sample recognition face image in each frame of target sample image. At the same time, according to the position information of the sample recognition face image in the target sample image, the predicted sample face image is determined in the next frame of sample image corresponding to the target sample image. The sample recognition face image and the predicted sample face image constitute a sample face time series image pair, and the sample optical flow field information of the sample face time series image pair is determined. Then, the sample face time series image pair under each target sample image and its The corresponding sample optical flow field information is jointly input into a preset initial face liveness detection model to obtain a predicted face liveness detection result. A loss function is then constructed based on the actual face recognition result and the predicted face liveness detection result. The preset initial liveness detection model is iteratively trained using this loss function until a model with a required loss is obtained. The model with the required loss is ultimately determined as the preset face liveness detection model. It should be noted that during model training, a branch module is added to the backbone network. This branch module guides the training of the backbone network's intermediate features, with the labels for the training being the optical flow information of the input image pair. The introduction of the feature branch enables the backbone network's intermediate features to learn the optical flow field information of the input image pair, increasing the information content of the intermediate features and facilitating the final classification accuracy. Thus, by iteratively training the preset initial face liveness detection model to construct the preset face liveness detection model, the trained preset face liveness detection model can achieve higher prediction accuracy, thereby improving the accuracy of face liveness detection.

[0097] 205. Input each face time-series image pair into the backbone network layer of a preset face liveness detection model for feature extraction to obtain a face image feature vector of the face to be detected.

[0098] 206. Input the optical flow field information corresponding to each face time-series image pair into the feature branch layer of the preset face liveness detection model for feature extraction to obtain the optical flow feature vector of the face to be detected.

[0099] 207. Cross-process the facial image feature vector and the optical flow feature vector to obtain a facial cross feature vector.

[0100] 208. Input the face cross feature vector into the feature classification layer of the preset face liveness detection model for classification processing to obtain the liveness detection probability and non-liveness detection probability corresponding to the face to be detected.

[0101] 209. If the liveness detection probability is greater than the non-liveness detection probability, the face to be detected is determined to be a live face; if the liveness detection probability is less than or equal to the non-liveness detection probability, the face to be detected is determined to be a non-live face.

[0102] Among them, the preset face liveness detection model includes a backbone network layer, a feature branch layer, and a feature classification layer. The feature classification layer is composed of CNN convolution and full connection. For the embodiment of the present invention, first, each face time series image pair is input into the backbone network layer for feature extraction to obtain a face image feature vector. At the same time, the optical flow field information corresponding to each face time series image pair is input into the feature branch layer for feature extraction to obtain an optical flow feature vector. Furthermore, since the face image feature vector and the optical flow feature vector are vectors of different fields and dimensions, in order to extract more invisible feature information from the face image feature vector and the optical flow feature vector, it is necessary to cross-process the face image feature vector and the optical flow feature vector. The specific cross-processing method includes: multiplying each element in the face image feature vector with the element at the corresponding position in the optical flow feature vector to obtain each Vector products are obtained, and the transformation coefficients corresponding to each vector product are determined respectively. Based on the transformation coefficients, the each vector product is linearly transformed to obtain a first cross feature vector; each element in the facial image feature vector is multiplied by each element in the optical flow feature vector to obtain a second cross feature vector; the facial image feature vector and the optical flow feature vector are horizontally spliced ​​to obtain a spliced ​​feature vector, and the splicing coefficients corresponding to the splicing feature vector are determined. Based on the splicing coefficients, the splicing feature vector is linearly transformed to obtain a third cross feature vector; based on the first cross feature vector, the second cross feature vector and the third cross feature vector, the face cross feature vector is determined.

[0103] The transformation coefficients and concatenation coefficients are set empirically. Specifically, in practical applications, facial image features and optical flow features are different fields. The processing method is to embed the two features into vectors of the same latitude. For example, the feature vectors of the two fields are the facial image feature ringing (a1, a2, a3) and the optical flow feature vector (b1, b2, b3). The specific cross processing includes: performing feature-level crossover between the features of different fields, that is, after performing Hadamard products on all elements between the vectors, different transformation coefficients w1, w2, and w3 are assigned to each product, and then linear transformation is performed under certain transformation coefficients to obtain the first cross feature vector: f(w1× a1×b1, w2× a2× b2, w3× a3×b3); at the same time, each element in the facial image feature vector is multiplied by each element in the optical flow feature vector to obtain the second cross vector: f( (a1×b1, a1×b2, a1×b3, a2×b1, a2× b2, a2× b3, a3× b1, a3×b2, a3× b3); at the same time, the facial image feature vector and the optical flow feature vector are horizontally spliced, and then linearly transformed under a certain splicing coefficient λ to obtain the third cross feature vector: f(λ(a1, a2, a3, b1, b2, b3)), and finally the above three cross feature vectors are combined together, and the preset transformation function is used for transformation processing to obtain the face cross feature vector. It should be noted that the preset transformation function here can be set according to actual conditions, and this embodiment does not limit this. It should be noted that the above examples are only for illustration and do not limit the embodiments of the present application. Therefore, by cross-processing the facial image feature vector and the optical flow feature vector, the relationship between different features can be fully utilized to extract more implicit features, while taking into account both high-order and low-order processing, so that the feature data can be more fully utilized, and then it is obtained. The face liveness detection result is more accurate and meets the needs of actual application scenarios. Furthermore, after the face cross feature vector is determined, the face cross feature vector is input into the feature classification layer for classification processing. The feature classification layer can output the liveness detection probability that the face to be detected is alive and the non-liveness detection probability that the face to be detected is non-live. The maximum probability is determined among the two probabilities, and finally the detection result corresponding to the maximum probability is determined as the final face liveness detection result. For example, if the liveness detection probability obtained by the feature classification layer is 75% and the non-liveness detection probability is 25%, then the face to be detected is determined to be a live face. Therefore, the present application can reduce the consumption of storage resources and computing power by performing face liveness detection using a single-stage end-to-end preset face liveness detection model, while also improving the efficiency and accuracy of face liveness detection.

[0104] According to another face liveness detection method provided by the present invention, compared with the current method of requiring the user to perform specific facial movements according to the system's instructions and determining whether the user is alive based on the execution of the facial movements, the present invention obtains multiple frames of continuous monocular infrared sensor images containing the face to be detected; and uses any frame image except the last frame in the multiple frames of the monocular infrared sensor images as a frame of target monocular infrared sensor image, and uses a preset face recognition model to perform face recognition on each frame of the target monocular infrared sensor image to obtain a recognized face image in each frame of the target monocular infrared sensor image; at the same time, based on the position information of the recognized face image corresponding to the target monocular infrared sensor image, determines the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image; then, the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image are used to determine the predicted face image. The predicted face image constitutes a face time-series image pair under the target monocular infrared sensor image, and the optical flow field information of the face time-series image pair is determined; finally, each of the face time-series image pairs is inputted into the backbone network layer of the preset face liveness detection model for feature extraction to obtain the face image feature vector of the face to be detected; the optical flow field information corresponding to each of the face time-series image pairs is inputted into the feature branch layer for feature extraction to obtain the optical flow feature vector of the face to be detected; the face image feature vector and the optical flow feature vector are cross-processed to obtain a face cross feature vector; the face cross feature vector is inputted into the feature classification layer for classification processing to obtain the liveness detection probability and the non-liveness detection probability corresponding to the face to be detected; if the liveness detection probability is greater than the non-liveness detection probability, the face to be detected is determined to be a liveness face; if the liveness detection probability is less than or equal to the non-liveness detection probability, the face to be detected is determined to be a non-liveness face.Thus, by acquiring continuous frame monocular infrared sensor images and capturing face time-series image pairs through the recognition model and position information, the model is finally used to analyze the face time-series image pairs and their corresponding optical flow field information to obtain the face liveness detection result. That is, the present application can better distinguish screen face images through the monocular infrared method compared to the visible light method, facilitating face image recognition. At the same time, by constructing face time-series image pairs for liveness detection, it can avoid the problem of low liveness detection accuracy caused by less detection information when performing liveness detection on a single image, thereby improving the accuracy of face liveness detection. In addition, the present invention introduces the optical flow field information of the time-series image pairs when performing face liveness detection, that is, the motion information of the face in the continuous images is referenced, thereby further improving the accuracy of face liveness detection. In addition, the embodiments of the present invention can obtain more invisible information through cross-processing between features, thereby improving the prediction accuracy of the model. In addition, the present invention can also avoid the time wasted in instructing the face to perform the corresponding command action, thereby improving the efficiency of face liveness detection and enhancing the user experience.

[0105] Further, as Figure 1 The embodiment of the present invention provides a face liveness detection device, such as Figure 3 As shown, the device includes: an acquisition unit 31, a face recognition unit 32, a first determination unit 33, a second determination unit 34, and a living body detection unit 35.

[0106] The acquisition unit 31 may be configured to acquire multiple frames of continuous monocular infrared sensor images containing a face to be detected.

[0107] The face recognition unit 32 can be used to treat any frame image except the last frame in the multiple frames of the monocular infrared sensor image as a frame of the target monocular infrared sensor image, and use a preset face recognition model to perform face recognition on each frame of the target monocular infrared sensor image to obtain a recognized face image in each frame of the target monocular infrared sensor image.

[0108] The first determining unit 33 may be configured to determine a predicted face image in a next frame of a monocular infrared sensor image corresponding to the target monocular infrared sensor image based on position information of the recognized face image corresponding to the target monocular infrared sensor image.

[0109] The second determination unit 34 can be used to form a face time-series image pair under the target monocular infrared sensor image based on the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image, and determine the optical flow field information of the face time-series image pair.

[0110] The liveness detection unit 35 can be used to input the face time-series image pair and its corresponding optical flow field information of each frame of the target monocular infrared sensor image into a preset face liveness detection model for liveness detection, and obtain the liveness detection result corresponding to the face to be detected.

[0111] In specific application scenarios, in order to determine the optical flow field information of the face time series image pair, such as Figure 4 As shown, the second determining unit 34 includes a first determining module 341 and an adding module 342 .

[0112] The first determination module 341 can be used to determine sparse pixel points on the recognized face image in the target monocular infrared sensor image, and determine reference sparse pixel points corresponding to the sparse pixel points in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image.

[0113] The first determining module 341 may be specifically configured to determine the sparse position information of each of the sparse pixel points and the reference sparse position information of each of the reference sparse pixel points.

[0114] The first determination module 341 can be specifically used to determine the sparse motion state information of the sparse pixels between the target monocular infrared sensor image and the next frame monocular infrared sensor image based on the sparse position information of each of the sparse pixel points, the reference sparse position information of each of the reference sparse pixel points, and the shooting time interval between the target monocular infrared sensor image and the next frame monocular infrared sensor image, wherein the sparse motion state information includes the motion direction and motion speed of the sparse pixel points.

[0115] The first determination module 341 can also be used to determine dense pixel points in the target monocular infrared sensor image, and determine reference dense pixel points corresponding to the dense pixel points in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image.

[0116] The first determining module 341 may be specifically configured to determine the dense position information of each of the dense pixels and the reference dense position information of each of the reference dense pixels.

[0117] The first determination module 341 can be specifically used to determine the dense motion state information of the dense pixels between the target monocular infrared sensor image and the next frame monocular infrared sensor image based on the dense position information of each of the dense pixels, the reference dense position information of each of the reference dense pixels, and the shooting time interval between the target monocular infrared sensor image and the next frame monocular infrared sensor image, wherein the dense motion state information includes the motion direction and motion speed of the dense pixels.

[0118] The first determining module 341 may also be configured to respectively determine weight coefficients corresponding to the sparse motion state information and the dense motion state information.

[0119] The adding module 342 may be configured to add the sparse motion state information and the dense motion state information based on the weight coefficient to obtain the optical flow field information of the face time-series image pair.

[0120] In a specific application scenario, in order to perform face recognition on each frame of the target monocular infrared sensor image, the face recognition unit 32 includes a face recognition module 321 and a second determination module 322 .

[0121] The face recognition module 321 can be used to input each frame of the target monocular infrared sensor image into a preset face recognition model for face recognition, and obtain a pixel-level heat map corresponding to each frame of the target monocular infrared sensor image.

[0122] The second determination module 322 can be used to determine the recognized face image in each frame of the target monocular infrared sensor image based on different color areas in the pixel-level heat map.

[0123] In a specific application scenario, in order to determine the predicted face image, the first determination unit 33 can be specifically used to determine the image area at the same position as the recognized face image in the target monocular infrared sensor image in the next frame of monocular infrared sensor image based on the position information of the recognized face image corresponding to the target monocular infrared sensor image, and determine the image area at the same position as the predicted face image in the next frame of monocular infrared sensor image.

[0124] In a specific application scenario, in order to construct a preset face liveness detection model, the device further includes: a construction unit 36 ​​and a training unit 37.

[0125] The construction unit 36 ​​can be used to construct a preset initial face liveness detection model.

[0126] The acquisition unit 31 can be used to obtain sample face time-series image pairs corresponding to multiple frames of continuous sample monocular infrared sensor images with sample face images and their corresponding sample optical flow field information, as well as actual face liveness detection results corresponding to the sample face images.

[0127] The face recognition unit 32 can also be used to input each of the sample face time-series image pairs and their corresponding sample optical flow field information into the preset initial face liveness detection model for liveness detection, and obtain the predicted face liveness detection result corresponding to the sample face image.

[0128] The construction unit 36 ​​may also be configured to construct a loss function based on the actual face liveness detection result and the predicted face liveness detection result.

[0129] The training unit 37 can be used to iteratively train the preset initial face liveness detection model based on the loss function to obtain the preset face liveness detection model.

[0130] In a specific application scenario, in order to perform face liveness detection, the liveness detection unit 35 includes a feature extraction module 351 , a cross-processing module 352 , a classification module 353 , and a determination module 354 .

[0131] The feature extraction module 351 can be used to input each of the facial time-series image pairs into the backbone network layer for feature extraction to obtain the facial image feature vector of the face to be detected.

[0132] The feature extraction module 351 may also be configured to input the optical flow field information corresponding to each of the face time-series image pairs into the feature branch layer for feature extraction, thereby obtaining an optical flow feature vector of the face to be detected.

[0133] The cross processing module 352 may be configured to perform cross processing on the facial image feature vector and the optical flow feature vector to obtain a facial cross feature vector.

[0134] The classification module 353 may be configured to input the face cross feature vector into the feature classification layer for classification processing to obtain a liveness detection probability and a non-liveness detection probability corresponding to the face to be detected.

[0135] The determination module 354 may be configured to determine that the face to be detected is a living face if the liveness detection probability is greater than the non-liveness detection probability.

[0136] The determination module 354 may also be configured to determine that the face to be detected is a non-living face if the liveness detection probability is less than or equal to the non-livingness detection probability.

[0137] In a specific application scenario, in order to cross-process the facial image feature vector and the optical flow feature vector, the cross-processing module 352 can be specifically used to multiply each element in the facial image feature vector with the element at the corresponding position in the optical flow feature vector to obtain each vector product, and respectively determine the transformation coefficient corresponding to each vector product, and based on the transformation coefficient, perform a linear transformation on each vector product to obtain a first cross feature vector; multiply each element in the facial image feature vector with each element in the optical flow feature vector to obtain a second cross feature vector; horizontally splice the facial image feature vector and the optical flow feature vector to obtain a spliced ​​feature vector, and determine the splicing coefficient corresponding to the spliced ​​feature vector, and based on the splicing coefficient, perform a linear transformation on the spliced ​​feature vector to obtain a third cross feature vector; determine the facial cross feature vector based on the first cross feature vector, the second cross feature vector, and the third cross feature vector.

[0138] It should be noted that for other corresponding descriptions of the functional modules involved in the face liveness detection device provided in the embodiment of the present invention, please refer to Figure 1 The corresponding description of the method shown will not be repeated here.

[0139] Based on the above Figure 1 The method shown, accordingly, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the following steps are implemented: obtaining multiple frames of continuous monocular infrared sensor images containing a face to be detected; taking any frame image except the last frame of the multiple frames of the monocular infrared sensor images as a frame of target monocular infrared sensor image, and performing face recognition on each frame of the target monocular infrared sensor image using a preset face recognition model to obtain a recognized face image in each frame of the target monocular infrared sensor image; determining the position information of the recognized face image corresponding to the target monocular infrared sensor image based on the position information of the recognized face image Determine a predicted face image in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image; construct a face time-series image pair under the target monocular infrared sensor image by using the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image, and determine the optical flow field information of the face time-series image pair; input the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information into a preset face liveness detection model for liveness detection, and obtain a liveness detection result corresponding to the face to be detected.

[0140] Based on the above Figure 1 The method shown and Figure 3The embodiment of the device shown in the figure, the embodiment of the present invention also provides a physical structure diagram of a computer device, such as Figure 5 As shown, the computer device includes: a processor 41, a memory 42, and a computer program stored in the memory 42 and executable on the processor, wherein the memory 42 and the processor 41 are both arranged on a bus 43 and the processor 41 implements the following steps when executing the program: acquiring multiple frames of continuous monocular infrared sensor images containing a face to be detected; using any frame image except the last frame in the multiple frames of the monocular infrared sensor images as a frame of target monocular infrared sensor image, performing face recognition on each frame of the target monocular infrared sensor image using a preset face recognition model, and obtaining a recognized face image in each frame of the target monocular infrared sensor image; based on the target monocular infrared sensor image The method comprises the following steps: according to the position information of the recognized face image corresponding to the target monocular infrared sensor image, determining the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image; forming a face time-series image pair under the target monocular infrared sensor image by the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and determining the optical flow field information of the face time-series image pair; inputting the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information into a preset face liveness detection model for liveness detection, and obtaining a liveness detection result corresponding to the face to be detected.

[0141] According to the technical solution of the present invention, a plurality of continuous monocular infrared sensor images containing a face to be detected are obtained; and any frame image except the last frame of the plurality of monocular infrared sensor images is used as a frame of target monocular infrared sensor image, and face recognition is performed on each frame of the target monocular infrared sensor image using a preset face recognition model to obtain a recognized face image in each frame of the target monocular infrared sensor image; at the same time, based on the position information of the recognized face image corresponding to the target monocular infrared sensor image, a predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image is determined; then, a face time-series image pair under the target monocular infrared sensor image is formed by the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and optical flow field information of the face time-series image pair is determined; finally, the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information are input into a preset face liveness detection model for liveness detection to obtain a liveness detection result corresponding to the face to be detected. Therefore, by obtaining continuous frame monocular infrared sensor images and capturing face time-series image pairs through recognition model and position information, the model is finally used to analyze the face time-series image pairs and their corresponding optical flow field information to obtain the face liveness detection result. That is, the present application can better distinguish screen face images through the monocular infrared method compared with the visible light method, which is convenient for the recognition of face images. At the same time, by constructing face time-series image pairs for liveness detection, it can avoid the problem of low liveness detection accuracy caused by less detection information when performing liveness detection on a single image. Therefore, the present invention can improve the face liveness detection accuracy. In addition, the present invention introduces the optical flow field information of the time-series image pairs when performing face liveness detection, which can further improve the face liveness detection accuracy. In addition, the present invention can also avoid the time wasted in instructing the face to perform the corresponding instruction action, so that the present invention can improve the face liveness detection efficiency and enhance the user experience.

[0142] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, centralized on a single computing device, or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0143] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.

Claims

1. A method for detecting liveness of a face, characterized in that: include: Acquire multiple frames of continuous monocular infrared sensor images containing faces to be detected; Any frame image except the last frame in the multiple frames of the monocular infrared sensor image is used as a frame of the target monocular infrared sensor image, and a preset face recognition model is used to perform face recognition on each frame of the target monocular infrared sensor image to obtain a recognized face image in each frame of the target monocular infrared sensor image; Determine, based on the position information of the recognized face image corresponding to the target monocular infrared sensor image, a predicted face image in a next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image; A face time-series image pair under the target monocular infrared sensor image is formed by the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and optical flow field information of the face time-series image pair is determined; The face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information are input into a preset face liveness detection model for liveness detection to obtain a liveness detection result corresponding to the face to be detected.

2. The method according to claim 1, characterized in that The determining of the optical flow field information of the face time-series image pair includes: Determine sparse pixel points on the recognized face image in the target monocular infrared sensor image, and determine reference sparse pixel points corresponding to the sparse pixel points in the next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image; Determine sparse position information of each of the sparse pixel points and reference sparse position information of each of the reference sparse pixel points; Based on the sparse position information of each of the sparse pixel points, the reference sparse position information of each of the reference sparse pixel points, and the shooting time interval between the target monocular infrared sensor image and the next frame of the monocular infrared sensor image, the sparse motion state information of the sparse pixel points between the target monocular infrared sensor image and the next frame of the monocular infrared sensor image is determined, wherein the sparse motion state information includes the motion direction and motion speed of the sparse pixel points; Determine dense pixel points in the target monocular infrared sensor image, and determine reference dense pixel points corresponding to the dense pixel points in a next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image; Determine dense position information of each of the dense pixel points and reference dense position information of each of the reference dense pixel points; Based on the dense position information of each of the dense pixels, the reference dense position information of each of the reference dense pixels, and the shooting time interval between the target monocular infrared sensor image and the next frame of the monocular infrared sensor image, the dense motion state information of the dense pixels between the target monocular infrared sensor image and the next frame of the monocular infrared sensor image is determined, wherein the dense motion state information includes the motion direction and motion speed of the dense pixels; Determine weight coefficients corresponding to the sparse motion state information and the dense motion state information respectively; Based on the weight coefficient, the sparse motion state information and the dense motion state information are added to obtain the optical flow field information of the face time-series image pair.

3. The method according to claim 1, characterized in that The method of performing face recognition on each frame of the target monocular infrared sensor image using a preset face recognition model to obtain a recognized face image in each frame of the target monocular infrared sensor image includes: Input each frame of the target monocular infrared sensor image into a preset face recognition model for face recognition, and obtain a pixel-level heat map corresponding to each frame of the target monocular infrared sensor image; According to different color areas in the pixel-level heat map, a recognized face image in each frame of the target monocular infrared sensor image is determined.

4. The method according to claim 1, characterized in that: The step of determining the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image based on the position information of the recognized face image corresponding to the target monocular infrared sensor image comprises: Based on the position information of the recognized face image corresponding to the target monocular infrared sensor image, an image area at the same position as the recognized face image in the target monocular infrared sensor image is determined in the next frame of the monocular infrared sensor image, and the image area at the same position is determined as the predicted face image in the next frame of the monocular infrared sensor image.

5. The method according to claim 1, characterized in that Before inputting the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information into a preset face liveness detection model for liveness detection and obtaining the liveness detection result corresponding to the face to be detected, the method further includes: Construct a preset initial face liveness detection model; Obtaining a sample face time-series image pair corresponding to a plurality of frames of continuous sample monocular infrared sensor images with a sample face image and its corresponding sample optical flow field information, as well as an actual face liveness detection result corresponding to the sample face image; Inputting each of the sample face time-series image pairs and their corresponding sample optical flow field information into the preset initial face liveness detection model for liveness detection, and obtaining a predicted face liveness detection result corresponding to the sample face image; Constructing a loss function based on the actual face liveness detection result and the predicted face liveness detection result; Based on the loss function, the preset initial face liveness detection model is iteratively trained to obtain the preset face liveness detection model.

6. The method according to claim 1, characterized in that The preset face liveness detection model includes a backbone network layer, a feature branch layer, and a feature classification layer; the face time-series image pair of each frame of the target monocular infrared sensor image and its corresponding optical flow field information are input into the preset face liveness detection model for liveness detection, and the liveness detection result corresponding to the face to be detected is obtained, including: Inputting each of the face time-series image pairs into the backbone network layer for feature extraction to obtain a face image feature vector of the face to be detected; Inputting the optical flow field information corresponding to each of the face time-series image pairs into the feature branch layer for feature extraction to obtain the optical flow feature vector of the face to be detected; Cross-processing the facial image feature vector and the optical flow feature vector to obtain a facial cross feature vector; Inputting the face cross feature vector into the feature classification layer for classification processing to obtain the liveness detection probability and non-liveness detection probability corresponding to the face to be detected; If the liveness detection probability is greater than the non-liveness detection probability, determining that the face to be detected is a liveness face; If the liveness detection probability is less than or equal to the non-liveness detection probability, the face to be detected is determined to be a non-liveness face.

7. The method according to claim 6, characterized in that The cross-processing of the facial image feature vector and the optical flow feature vector to obtain a face cross feature vector includes: Multiplying each element in the facial image feature vector with the element at the corresponding position in the optical flow feature vector to obtain each vector product, and respectively determining the transformation coefficient corresponding to each vector product, and performing a linear transformation on each vector product based on the transformation coefficient to obtain a first cross feature vector; Multiplying each element in the facial image feature vector with each element in the optical flow feature vector to obtain a second cross feature vector; horizontally splicing the facial image feature vector and the optical flow feature vector to obtain a spliced ​​feature vector, determining a splicing coefficient corresponding to the spliced ​​feature vector, and performing a linear transformation on the spliced ​​feature vector based on the splicing coefficient to obtain a third cross feature vector; The face cross feature vector is determined based on the first cross feature vector, the second cross feature vector, and the third cross feature vector.

8. A face liveness detection device, characterized in that: include: An acquisition unit, used for acquiring multiple frames of continuous monocular infrared sensor images containing a face to be detected; A face recognition unit is used to use any frame image except the last frame in the multiple frames of the monocular infrared sensor image as a frame of the target monocular infrared sensor image, and perform face recognition on each frame of the target monocular infrared sensor image using a preset face recognition model to obtain a recognized face image in each frame of the target monocular infrared sensor image; A first determining unit is used to determine a predicted face image in a next frame of monocular infrared sensor image corresponding to the target monocular infrared sensor image based on the position information of the recognized face image corresponding to the target monocular infrared sensor image; A second determining unit is used to form a face time-series image pair under the target monocular infrared sensor image from the recognized face image corresponding to the target monocular infrared sensor image and the predicted face image in the next frame of the monocular infrared sensor image corresponding to the target monocular infrared sensor image, and determine the optical flow field information of the face time-series image pair; The liveness detection unit is used to input the face time-series image pair and the corresponding optical flow field information of each frame of the target monocular infrared sensor image into a preset face liveness detection model for liveness detection, and obtain the liveness detection result corresponding to the face to be detected.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.