Face living body detection method and system, computer device and storage medium
By acquiring video data, obtaining face detection bounding boxes and key point coordinates, and using DCT transform to calculate noise color signals, this technology solves the problems of large data requirements for face liveness detection and insufficient ability to defend against fake face attacks in existing technologies, and achieves efficient and accurate liveness detection and rapid interception of fake face attacks.
Patent Information
- Application Number
- CN202310367329.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-07
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2043-04-07
AI Technical Summary
In existing technologies, face liveness detection methods suffer from problems such as large data requirements and insufficient ability to defend against fake face attacks. In particular, silent liveness detection methods require massive amounts of data, and motion liveness detection is easily bypassed by attack videos.
By collecting video data input from the person to be detected, extracting 2D image frames, obtaining face detection boxes and key point coordinates, calculating noise color signals using DCT transform and inverse transform, determining their consistency with pre-issued noise color signals, and outputting liveness detection results.
It achieves efficient and accurate liveness detection, can quickly intercept fake face attacks, and improves the ability to defend against fake face attacks.
Smart Images

Figure CN116403261B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of facial recognition technology, specifically to a method, system, computer device, and non-volatile computer-readable storage medium for facial liveness detection. Background Technology
[0002] Currently, with the development of mobile internet, facial recognition for identity verification (determining the authenticity of users) is receiving increasing attention in fields such as finance, insurance, banking, and securities. Simultaneously, the security issue of attackers using fake faces to complete facial recognition is becoming increasingly common. To prevent attackers from using fake faces for facial recognition, existing technologies typically employ methods such as silent liveness detection and action liveness detection to resist cybercriminals using fake faces for online facial recognition. Among these,
[0003] I. Silent liveness detection based on a single image: This type of method collects massive amounts of data (including live and non-live face images) to train a binary classification network model. Silent liveness detection methods have the following problems: they require the collection of massive amounts of data, and the binary classification network model performs poorly against non-live faces synthesized by various malicious software, making it difficult to prevent.
[0004] II. Action liveness detection based on random actions. This type of method usually prompts the user to open their mouth, shake their head, blink their eyes, etc. for verification. Action liveness detection method has the following problems: when the attacking user uses a pre-recorded attack video with the above actions, it is easy to bypass the action liveness verification.
[0005] In summary, how to provide a face liveness detection method, system, computer device, and non-volatile computer-readable storage medium to accurately detect face liveness, quickly intercept fake faces, and improve the ability to defend against fake face attacks is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] In view of the shortcomings of the prior art, the purpose of this invention is to provide a face liveness detection method, system, computer device and non-volatile computer-readable storage medium that can be used in financial technology or other related fields to accurately realize face liveness detection, quickly intercept fake faces and improve the ability to defend against fake face attacks.
[0007] To achieve the above objectives, the present invention adopts the following technical solution:
[0008] A face liveness detection method, comprising:
[0009] Collect video data input by the person to be detected, and extract 2D image frames that are to be detected in the video data and arranged sequentially to form an image sequence.
[0010] The face detection bounding box of the person to be detected is obtained based on the 2D image frame;
[0011] Based on the face detection box, the face region image of the person to be detected is extracted from the 2D image frame, and the face region image is input into a pre-trained face key point localization model to perform face key point localization, so as to obtain the face key point coordinates of the person to be detected.
[0012] The facial region of the person to be detected is obtained based on the coordinates of the facial key points.
[0013] The noise color signal contained in the decoded sequence is calculated based on the DCT transform and inverse DCT transform of the mean sequences of the R and G channels of the face region.
[0014] Determine whether the noise color signal contained in the decoded sequence is consistent with the pre-sent noise color signal, and output the face liveness detection result.
[0015] In a further technical solution, the face liveness detection method, wherein the step of acquiring video data input by the person to be detected and extracting 2D image frames arranged sequentially from the video data to form an image sequence, includes:
[0016] The video data input by the person being tested is collected through a front-end device;
[0017] Extract the 2D image frames to be detected from the video data and arrange them sequentially to form a glare image sequence.
[0018] In a further technical solution, the face liveness detection method, wherein obtaining the face detection box of the person to be detected based on the 2D image frame includes:
[0019] Define the detection region of the 2D image frame;
[0020] An image of the detection region is extracted from the 2D image frame based on the detection region;
[0021] The image of the detection area is input into a preset face detection model for face detection, and the face heat map, face scale map and face center offset map are output.
[0022] Points in the face heatmap that exceed a preset threshold are identified as faces. Then, the face coordinate offset is taken from the corresponding position on the face center offset map. The face coordinate offset is added to the coordinates in the face heatmap to obtain the final center position of the face. Then, the width and height of the face are calculated on the face scale map through exponential conversion to obtain the face detection box of the person to be detected.
[0023] In a further technical solution, the face liveness detection method, wherein the step of extracting the face region image of the person to be detected from the 2D image frame based on the face detection box, and inputting the face region image into a pre-trained face key point localization model for face key point localization to obtain the face key point coordinates of the person to be detected, includes:
[0024] The face detection frame is expanded outwards in all directions;
[0025] Based on the expanded face detection box, the face region image of the person to be detected is extracted from the 2D image frame;
[0026] The face region image is input into a pre-trained facial landmark localization model to perform facial landmark localization, so as to obtain the facial landmark coordinates of the person to be detected.
[0027] In a further technical solution, the face liveness detection method, wherein obtaining the face region of the person to be detected based on the coordinates of the facial key points includes:
[0028] The facial contour points of the person to be detected are extracted based on the coordinates of the facial key points;
[0029] The facial region of the person to be detected is segmented based on the facial contour points.
[0030] In a further technical solution, the face liveness detection method, wherein the calculation of the noise color signal contained in the decoded sequence based on the DCT transform and inverse DCT transform of the mean sequences of the R and G channels of the face region includes:
[0031] The face region calculates the mean values of its R and G channels respectively based on the glare color sequence pre-issued by the front-end device, and forms the mean value sequences of the two channels respectively.
[0032] Data preprocessing is performed on the mean sequences of the two channels;
[0033] DCT transformation is performed on the mean sequence of the R channel of the face region after data preprocessing to obtain DCT_R;
[0034] Take the inverse DCT transform of DCT_R to obtain IDCT_R;
[0035] Find the maximum and minimum points of the IDCT_R sequence, i.e., the peaks and troughs of IDCT_R.
[0036] Sort the peak and trough indices of IDCT_R, and obtain the corresponding elements of the mean sequence of the G channel based on the sorted indices to obtain sequence G2;
[0037] The sequence G2 outputs a decoding sequence based on the threshold T. When an element in the sequence G2 is greater than T, the output is 1; when an element in the sequence G2 is less than or equal to T, the output is 0, thus obtaining the decoding sequence G3.
[0038] The formula for calculating T is as follows:
[0039]
[0040] In a further technical solution, the face liveness detection method, wherein determining whether the noise color signal contained in the decoded sequence is consistent with the pre-sent noise color signal and outputting the face liveness detection result includes:
[0041] Determine whether the noise color signal contained in the decoded sequence G3 is consistent with the noise color signal contained in the glare color sequence pre-sent by the front-end device;
[0042] If so, output the face liveness detection result as "live".
[0043] If not, the output face liveness detection result will be "not live".
[0044] A face liveness detection system, comprising:
[0045] The acquisition and extraction module is used to acquire video data input by the person to be detected, and extract 2D image frames that are to be detected in the video data and arranged sequentially to form an image sequence.
[0046] The detection box acquisition module is used to acquire the face detection box of the person to be detected based on the 2D image frame;
[0047] The key point coordinate acquisition module is used to extract the face region image of the person to be detected from the 2D image frame based on the face detection box, and input the face region image into a pre-trained face key point localization model to perform face key point localization in order to obtain the face key point coordinates of the person to be detected.
[0048] A face region acquisition module is used to acquire the face region of the person to be detected based on the coordinates of the facial key points;
[0049] The calculation module is used to calculate the noise color signal contained in the decoded sequence based on the DCT transform and inverse DCT transform of the mean sequences of the R and G channels of the face region;
[0050] The judgment module is used to determine whether the noise color signal contained in the decoded sequence is consistent with the pre-sent noise color signal, and output the face liveness detection result.
[0051] A computer device, wherein the computer device includes at least one processor; and,
[0052] A memory communicatively connected to the at least one processor; wherein,
[0053] The memory stores a computer program that can be executed by the at least one processor. When the computer program is executed by the at least one processor, it can implement the face liveness detection method as described above.
[0054] A non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, which, when executed by at least one processor, can implement the face liveness detection method as described in any of the preceding claims.
[0055] Compared to existing technologies, this invention provides a method, system, computer device, and storage medium for face liveness detection. The method includes: acquiring video data input by a person to be detected; extracting 2D image frames from the video data, arranged sequentially to form an image sequence; obtaining a face detection bounding box for the person to be detected based on the 2D image frames; cropping a face region image of the person to be detected from the 2D image frames based on the face detection bounding box; inputting the face region image into a pre-trained face keypoint localization model for face keypoint localization to obtain the face keypoint coordinates of the person to be detected; obtaining the face region of the person to be detected based on the face keypoint coordinates; calculating the noise color signal contained in the decoded sequence based on the DCT transform and inverse DCT transform of the mean sequences of the R and G channels of the face region; determining whether the noise color signal contained in the decoded sequence is consistent with a pre-issued noise color signal; and outputting a face liveness detection result. This invention can accurately detect face liveness, quickly intercept fake faces, and improve the ability to defend against fake face attacks. Attached Figure Description
[0056] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0057] Figure 1 This is a flowchart illustrating the face liveness detection method provided in an embodiment of the present invention.
[0058] Figure 2 This is a schematic diagram of the network structure of the face key point localization network provided in an embodiment of the present invention.
[0059] Figure 3 This is a schematic diagram of the functional modules of the face liveness detection system provided in an embodiment of the present invention.
[0060] Figure 4 This is a schematic diagram of the hardware structure of the computer device provided in an embodiment of the present invention. Detailed Implementation
[0061] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0062] In the description of this invention, the terms "comprising," "including," "having," and "containing" are all open-ended terms, meaning that they include but are not limited to. The terms "one embodiment," "one specific embodiment," "some embodiments," and "for example," etc., refer to specific features, structures, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. The order of steps involved in the various embodiments is used to illustrate the implementation of this application, and the order of steps is not limited and can be adjusted appropriately as needed.
[0063] Various non-limiting embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0064] Please see Figure 1 This invention provides a method for face liveness detection, wherein the method includes the following steps:
[0065] S100: Collect video data input by the person to be detected, and extract 2D image frames from the video data that are to be detected arranged sequentially to form an image sequence.
[0066] S200: Obtain the face detection box of the person to be detected based on the 2D image frame;
[0067] S300. Based on the face detection box, the face region image of the person to be detected is extracted from the 2D image frame, and the face region image is input into a pre-trained face key point localization model to perform face key point localization, so as to obtain the face key point coordinates of the person to be detected.
[0068] S400. Obtain the face region of the person to be detected based on the coordinates of the facial key points;
[0069] S500. Calculate the noise color signal contained in the decoded sequence based on the DCT transform and inverse DCT transform of the mean sequences of the R and G channels of the face region.
[0070] S600. Determine whether the noise color signal contained in the decoded sequence is consistent with the pre-sent noise color signal, and output the face liveness detection result.
[0071] Furthermore, in the aforementioned face liveness detection method, the step of acquiring video data input by the person to be detected and extracting 2D image frames from the video data that are sequentially arranged to form an image sequence includes:
[0072] The video data input by the person being tested is collected through a front-end device;
[0073] Extract the 2D image frames to be detected from the video data and arrange them sequentially to form a glare image sequence.
[0074] In a specific implementation, in this embodiment, when the person to be tested logs into an application (such as Ping An Pocket Bank APP), the camera of the front-end device (such as a mobile phone) is used to collect the video data input by the person to be tested, and then the 2D image frames of the glare image sequence are extracted from the video data and arranged in sequence to form the glare image sequence.
[0075] Furthermore, in the aforementioned face liveness detection method, the step of obtaining the face detection box of the person to be detected based on the 2D image frame includes:
[0076] Define the detection region of the 2D image frame;
[0077] An image of the detection region is extracted from the 2D image frame based on the detection region;
[0078] The image of the detection area is input into a preset face detection model for face detection, and the face heat map, face scale map and face center offset map are output.
[0079] Points in the face heatmap that exceed a preset threshold are identified as faces. Then, the face coordinate offset is taken from the corresponding position on the face center offset map. The face coordinate offset is added to the coordinates in the face heatmap to obtain the final center position of the face. Then, the width and height of the face are calculated on the face scale map through exponential conversion to obtain the face detection box of the person to be detected.
[0080] In this specific implementation, the detection area of the 2D image frame is first defined, and then the detection area image is extracted from the 2D image frame based on the detection area. The detection area image is then input into a preset face detection model for face detection, and a face heatmap, a face scale map, and a face center offset map are output. Points in the face heatmap that are greater than a preset threshold of 0.35 are identified as faces. Then, the face coordinate offset is extracted from the corresponding position on the face center offset map. The face coordinate offset is added to the coordinates in the face heatmap to obtain the final center position of the face. Then, the width and height of the face are calculated by exponential conversion on the face scale map to obtain the face detection box of the person to be detected. Finally, duplicate face detection boxes can be removed by non-maximum suppression (NMS).
[0081] Further, in the aforementioned face liveness detection method, the step of extracting the face region image of the person to be detected from the 2D image frame based on the face detection box, and inputting the face region image into a pre-trained face key point localization model for face key point localization to obtain the face key point coordinates of the person to be detected, includes:
[0082] The face detection frame is expanded outwards in all directions;
[0083] Based on the expanded face detection box, the face region image of the person to be detected is extracted from the 2D image frame;
[0084] The face region image is input into a pre-trained facial landmark localization model to perform facial landmark localization, so as to obtain the facial landmark coordinates of the person to be detected.
[0085] In specific implementation, in this embodiment, the generation process of the facial landmark localization model is as follows:
[0086] I. Facial landmark localization network design: Based on transfer learning technology, the backbone network adopts MobileNetV2. The last three layers (convolutional layers, average pooling layers, and fully connected layers) of MobileNetV2 are removed, and custom convolutional layers, multi-scale convolutional layers, and fully connected layers (outputting 896 neurons) are added. The network structure is as follows: Figure 2 As shown;
[0087] II. Preprocess the face region training images, including data augmentation and data normalization. Data augmentation includes operations such as random edge padding and random color jittering.
[0088] III. Input the training images of the face regions into the facial landmark localization network. Calculate the loss L using the network's 896-dimensional output and the ground truth values (i.e., the x and y coordinates of 486 facial landmarks). offThe formula is shown below:
[0089]
[0090]
[0091] Among them, L off For the loss value of facial landmark coordinates, o k These are the actual coordinate values that were manually labeled. N represents the coordinates predicted by the facial landmark localization network, where N is the total number of samples.
[0092] IV. Train the optimizer Adam, with hyperparameters β1 and β2 set to 0.9 and 0.999, respectively;
[0093] V. Learning rate is 5e -4 ;
[0094] VI. Reduce the learning rate to 5e after 80 iterations. -5 Continue iterating 80 times. When the final loss value is less than or equal to the preset threshold, adjust the internal parameters of the face landmark localization model (internal parameters are the model's weights, gradients, etc.) until the final loss value is greater than the preset threshold, and then output the standard face landmark localization model.
[0095] In this specific implementation, after obtaining the facial key point localization model, the face detection box is expanded outwards in all directions. [x1, y1, x2, y2] are the coordinates of the face detection box, where x1 and x2 are expanded outwards by one-quarter of the face detection box width w. The y1 and y2 of the face detection bounding box are expanded outward by one-quarter of the height h of the face detection bounding box, i.e. Based on the expanded face detection bounding box, the face region image of the person to be detected is extracted from the 2D image frame. Then, the face region image is input into the face key point localization model obtained above to locate the face key points, and outputs the coordinates of 468 face key points.
[0096] Furthermore, in the aforementioned face liveness detection method, the step of obtaining the face region of the person to be detected based on the coordinates of the facial key points includes:
[0097] The facial contour points of the person to be detected are extracted based on the coordinates of the facial key points;
[0098] The facial region of the person to be detected is segmented based on the facial contour points.
[0099] In a specific implementation, in this embodiment, the facial contour points of the person to be detected are extracted based on the coordinates of the facial key points, and a facial region mask is generated by filling the facial contour points with 255 pixel values. The facial region mask is multiplied by the original image (2D image frame) to segment the facial region of the person to be detected.
[0100] Furthermore, in the aforementioned face liveness detection method, the step of calculating the noise color signal contained in the decoded sequence based on the DCT transform and inverse DCT transform of the mean sequences of the R and G channels of the face region includes:
[0101] The face region calculates the mean values of its R and G channels respectively based on the glare color sequence pre-issued by the front-end device, and forms the mean value sequences of the two channels respectively.
[0102] Data preprocessing is performed on the mean sequences of the two channels;
[0103] DCT transformation is performed on the mean sequence of the R channel of the face region after data preprocessing to obtain DCT_R;
[0104] Take the inverse DCT transform of DCT_R to obtain IDCT_R;
[0105] Find the maximum and minimum points of the IDCT_R sequence, i.e., the peaks and troughs of IDCT_R.
[0106] Sort the peak and trough indices of IDCT_R, and obtain the corresponding elements of the mean sequence of the G channel based on the sorted indices to obtain sequence G2;
[0107] The sequence G2 outputs a decoding sequence based on the threshold T. When an element in the sequence G2 is greater than T, the output is 1; when an element in the sequence G2 is less than or equal to T, the output is 0, thus obtaining the decoding sequence G3.
[0108] The formula for calculating T is as follows:
[0109]
[0110] In a specific implementation, in this embodiment, the face region calculates the mean values of its R and G channels respectively based on the glare color sequence (black, red, and yellow color combination) pre-issued by the front-end device, and forms the mean value sequences of the two channels respectively.
[0111] Next, the mean sequences of the two channels are preprocessed, that is, the mean sequences of the two channels are normalized and the data is distributed on both sides of the x-axis, as shown in the following formula:
[0112]
[0113] Then, DCT transformation is performed on the mean sequence of the face region R channel after data preprocessing to obtain DCT_R. DCT transformation is often used in audio and video signal compression coding, which is a processing method that converts the signal time domain space to the frequency domain space. The frequency domain coefficients obtained by performing DCT transformation on the time domain signal are the amplitudes of many cosine signals.
[0114] Then, the frequency node is derived from the length of the mean sequence of the R channel and the sampling rate (i.e. the frame rate of the image sequence). The frequency node is obtained based on the rfftfreq method of the NumPy open source library. Then, the signal component index index_signal is determined based on the prior signal frequency, such as 5Hz.
[0115] Based on index_signal, only the DCT_R frequency node component is retained, and the other frequency node components are set to 0;
[0116] Take the inverse DCT transform of the processed DCT_R to obtain IDCT_R;
[0117] Find the maximum and minimum points of the IDCT_R sequence, i.e., the peaks and troughs of IDCT_R.
[0118] Sort the peak and trough indices of IDCT_R, and then obtain the corresponding elements of the mean sequence of the G channel according to the sorted indices to obtain sequence G2;
[0119] The sequence G2 outputs a decoding sequence based on the threshold T. When an element in the sequence G2 is greater than T, the output is 1; when an element in the sequence G2 is less than or equal to T, the output is 0, thus obtaining the decoding sequence G3.
[0120] The formula for calculating T is as follows:
[0121]
[0122] Furthermore, in the aforementioned face liveness detection method, the step of determining whether the noise color signal contained in the decoded sequence is consistent with the pre-sent noise color signal and outputting the face liveness detection result includes:
[0123] Determine whether the noise color signal contained in the decoded sequence G3 is consistent with the noise color signal contained in the glare color sequence pre-sent by the front-end device;
[0124] If so, output the face liveness detection result as "live".
[0125] If not, the output face liveness detection result will be "not live".
[0126] In this specific implementation, it is assumed that the color sequence pre-issued by the front-end device is black-red-black-red-yellow...black-red-yellow, where yellow light is the result of red light superimposed with noise green light. The superimposed noise color signal sequence is encoded as S = [0,0,0,0,1,0,0,0,0,1...]. If the decoded sequence G3 matches S, it means that the superimposed noise color signal is green, and the face is a live person; otherwise, it is a non-live person.
[0127] As can be seen from the above method embodiments, the face liveness detection method provided by the present invention utilizes the video data input by the user (the person to be detected) during the login application verification on the front-end device. It extracts 2D image frames from the video data, arranged sequentially to form a glare image sequence. Then, it obtains the face region of the person to be detected using these 2D image frames. Based on the DCT transform and inverse DCT transform of the mean sequences of the R and G channels of the face region, it calculates the noise color signal contained in the decoded sequence. Finally, it outputs the face liveness detection result by determining whether the noise color signal contained in the decoded sequence matches the noise color signal contained in the glare color sequence pre-sent by the front-end device. The method is sensitive, efficient, and accurate. The method of the present invention can accurately achieve face liveness detection, quickly intercept fake faces, and improve the ability to defend against fake face attacks.
[0128] It should be understood that although this application provides the method operation steps as described in the embodiments or flowcharts, conventional or non-inventive labor may include more or fewer operation steps, and these operation steps are not necessarily executed sequentially according to the order of the embodiments or flowcharts. The order of steps listed in the embodiments or flowcharts is merely one way of executing many steps and does not represent the only execution order. It should be noted that there is no necessary sequential order between the above steps. Those skilled in the art can understand from the description of the embodiments of the present invention that the above steps may have different execution orders in different embodiments, that is, they may be executed in parallel or in exchange, etc. Moreover, at least some steps in the embodiments or flowcharts may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn, alternately, or synchronously with other steps or at least a part of the sub-steps or stages of other steps.
[0129] Based on the above embodiments, please refer to Figure 3 Another embodiment of the present invention also provides a face liveness detection system, wherein the system includes:
[0130] The acquisition and extraction module 11 is used to acquire video data input by the person to be detected and extract 2D image frames that are to be detected in the video data and arranged in sequence to form an image sequence.
[0131] The detection box acquisition module 12 is used to acquire the face detection box of the person to be detected based on the 2D image frame;
[0132] The key point coordinate acquisition module 13 is used to extract the face region image of the person to be detected from the 2D image frame based on the face detection box, and input the face region image into a pre-trained face key point localization model to perform face key point localization in order to obtain the face key point coordinates of the person to be detected.
[0133] The face region acquisition module 14 is used to acquire the face region of the person to be detected based on the coordinates of the face key points;
[0134] Calculation module 15 is used to calculate the noise color signal contained in the decoded sequence based on the DCT transform and inverse DCT transform of the mean sequences of the R and G channels of the face region;
[0135] The judgment module 16 is used to determine whether the noise color signal contained in the decoded sequence is consistent with the pre-sent noise color signal, and output the face liveness detection result.
[0136] For specific implementation methods, please refer to the above method embodiments, which will not be repeated here.
[0137] Based on the above embodiments, please refer to Figure 4 Another embodiment of the present invention also provides a computer device, wherein the computer device 10 includes:
[0138] Memory 120 and one or more processors 110, Figure 4 The following description uses a processor 110 as an example. The processor 110 and the memory 120 can be connected via a communication bus or other means. Figure 4 Taking the example of China and Israel being connected via a communication bus.
[0139] Processor 110 performs various control logic functions of computer device 10. It can be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), microcontroller, ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. Furthermore, processor 110 can also be any conventional processor, microprocessor, or state machine. Processor 110 can also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.
[0140] The memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the computer program corresponding to the face liveness detection method in the embodiments of the present invention. The processor 110 executes various functional applications and data processing of the computer device 10 by running the non-volatile software programs, instructions, and units stored in the memory 120, thereby implementing the face liveness detection method in the above-described method embodiments.
[0141] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store application programs required for operating the device and at least one function; and the data storage area may store data created based on the use of the computer device 10. Furthermore, the memory 120 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include memory remotely located relative to the processor 110, and these remote memories may be connected to the computer device 10 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0142] One or more units are stored in memory 120, and when executed by one or more processors 110, they can implement the face liveness detection method as described in any of the above method embodiments. For example, they can implement the methods described above. Figure 1 The method steps S100 to S600.
[0143] Those skilled in the art will understand that Figure 4 The hardware structure diagram shown is only a schematic diagram of a part of the structure related to the present invention and does not constitute a limitation on the computer device on which the present invention is applied. The specific computer device may include more components than shown in the figure, or combine some components, or have different component arrangements.
[0144] Based on the above embodiments, the present invention also provides a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by at least one processor, it can implement the face liveness detection method as described in any of the above method embodiments, for example, it can implement the above-described method. Figure 1 The method steps S100 to S600.
[0145] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchronous ink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The memory components or memories disclosed in the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.
[0146] Another embodiment of the present invention provides a computer program product comprising a computer program stored on a non-volatile computer-readable storage medium, the computer program including program instructions that, when executed by a processor, can implement the face liveness detection method as described in any of the above method embodiments, for example, the method described above. Figure 1 The method steps S100 to S600.
[0147] The embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0148] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general-purpose hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can exist in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0149] Among other things, conditional language such as “can,” “may,” “may,” or “may,” unless otherwise specifically stated or otherwise understood as in the context in which they are used, is generally intended to convey that a particular implementation may include (but not others) certain features, elements, and / or operations. Therefore, such conditional language is also generally intended to imply that features, elements, and / or operations are necessary for one or more implementations in any way, or that one or more implementations must include logic for determining, with or without input or prompting, whether such features, elements, and / or operations are included or will be performed in any particular implementation.
[0150] The contents already described herein in this specification and accompanying drawings include examples of methods, systems, computer devices, and non-volatile computer-readable storage media capable of providing face liveness detection. It is, of course, impossible to describe every conceivable combination of elements and / or methods for the purpose of describing the various features of this disclosure, but it will be appreciated that many other combinations and substitutions of the disclosed features are possible. Therefore, it will be apparent that various modifications can be made to this disclosure without departing from the scope or spirit of this disclosure, but all such various modifications should fall within the protection scope of the appended claims. Furthermore, or in alternatives, other embodiments of this disclosure may become apparent from consideration of this specification and accompanying drawings and from practice of this disclosure as presented herein. It is intended that the examples presented in this specification and accompanying drawings be considered illustrative rather than restrictive in all respects. Although specific terminology is used herein, it is used in a general and descriptive sense and is not intended for limiting purposes.
Claims
1. A face liveness detection method, characterized in that, The method comprises the following steps: Collecting video data input by a person to be detected, and extracting 2D image frames in the video data to be detected which are sequentially arranged to form an image sequence; Obtaining a face detection frame of the person to be detected based on the 2D image frames; Cutting a face region image of the person to be detected from the 2D image frames based on the face detection frame, and inputting the face region image into a pre-trained face key point positioning model to perform face key point positioning, so as to obtain face key point coordinates of the person to be detected; Obtaining a face region of the person to be detected based on the face key point coordinates; Calculating a noise color signal contained in a decoding sequence based on DCT transformation and inverse DCT transformation of R and G two-channel mean value sequences of the face region; Judging whether the noise color signal contained in the decoding sequence is consistent with a pre-issued noise color signal, and outputting a face living body detection result; The collecting of the video data input by the person to be detected comprises: Collecting the video data input by the person to be detected through a front-end device; The calculation of the noise color signal contained in the decoding sequence based on the DCT transformation and the inverse DCT transformation of the R and G two-channel mean value sequences of the face region comprises: The face region calculates the mean values of R and G two channels respectively according to a pre-issued glare color sequence of the front-end device, and forms two-channel mean value sequences respectively; Data preprocessing is performed on the mean value sequences of the two channels; DCT transformation is performed on the mean value sequence of the R channel of the face region after data preprocessing to obtain DCT_R; Inverse DCT transformation is performed on DCT_R to obtain IDCT_R; The maximum and minimum points of the IDCT_R sequence, i.e. the peaks and valleys of IDCT_R, are obtained; The peak and valley point indexes of IDCT_R are sorted, and the corresponding elements of the G channel mean value sequence are obtained according to the sorted indexes to obtain a sequence G2; The sequence G2 outputs a decoding sequence according to a threshold T, when the elements in the sequence G2 are greater than T, 1 is output, and when the elements in the sequence G2 are less than or equal to T, 0 is output, to obtain a decoding sequence G3; The calculation formula of T is as follows: 。 2. The face liveness detection method of claim 1, wherein, The collecting of the video data input by the person to be detected, and the extracting of 2D image frames in the video data to be detected which are sequentially arranged to form an image sequence, comprises: Collecting the video data input by the person to be detected through a camera of a front-end device; Extracting 2D image frames in the video data to be detected which are sequentially arranged to form a glare image sequence.
3. The face liveness detection method of claim 2, wherein, The obtaining of the face detection frame of the person to be detected based on the 2D image frames comprises: Defining a detection region of the 2D image frames; Cutting a detection region image from the 2D image frames based on the detection region; Inputting the detection region image into a pre-set face detection model to perform face detection, and outputting a face heat map, a face scale map and a face center offset map; The point greater than the preset threshold in the human face heat map is determined as a human face, then a human face coordinate offset is taken out at the corresponding position on the human face center offset map, the human face coordinate offset is added to the coordinate in the human face heat map, a center position of the final human face is obtained, and the width and height of the human face are calculated through exponential conversion on the human face scale map, so as to obtain the human face detection frame of the to-be-detected person.
4. The face liveness detection method of claim 3, wherein, The human face region image of the to-be-detected person is intercepted from the 2D image frame based on the human face detection frame, and the human face region image is input into a pre-trained human face key point positioning model for human face key point positioning, so as to obtain the human face key point coordinates of the to-be-detected person, including: The human face detection frame is outwardly expanded to the four directions; The human face region image of the to-be-detected person is intercepted from the 2D image frame based on the outwardly expanded human face detection frame; The human face region image is input into a pre-trained human face key point positioning model for human face key point positioning, so as to obtain the human face key point coordinates of the to-be-detected person.
5. The face liveness detection method of claim 4, wherein, The human face region of the to-be-detected person is obtained based on the human face key point coordinates, including: The human face contour points of the to-be-detected person are taken out based on the human face key point coordinates; The human face region of the to-be-detected person is segmented based on the human face contour points.
6. The face liveness detection method of claim 5, wherein, The consistency of the noise color signal contained in the decoding sequence with the noise color signal pre-issued is judged, and a human face living body detection result is output, including: The consistency of the noise color signal contained in the decoding sequence G3 with the noise color signal contained in the glint color sequence pre-issued by the front-end device is judged; If yes, the human face living body detection result is output as a living body; If no, the human face living body detection result is output as a non-living body.
7. A face liveness detection system, characterized in that, Including: A collection and extraction module is configured to collect video data input by a to-be-detected person, and extract 2D image frames in the video data which are sequentially arranged to form an image sequence; A detection frame acquisition module is configured to acquire a human face detection frame of the to-be-detected person based on the 2D image frames; A key point coordinate acquisition module is configured to intercept a human face region image of the to-be-detected person from the 2D image frames based on the human face detection frame, and input the human face region image into a pre-trained human face key point positioning model for human face key point positioning, so as to obtain human face key point coordinates of the to-be-detected person; A human face region acquisition module is configured to obtain a human face region of the to-be-detected person based on the human face key point coordinates; A calculation module is configured to calculate a noise color signal contained in a decoding sequence based on DCT transformation and DCT inverse transformation of R and G two-channel mean sequence of the human face region; A judgment module is configured to judge the consistency of the noise color signal contained in the decoding sequence with a noise color signal pre-issued, and output a human face living body detection result; The video data input by the to-be-detected person is collected, including: The video data input by the to-be-detected person is collected through a front-end device; The noise color signal contained in the decoding sequence is calculated based on DCT transformation and DCT inverse transformation of R and G two-channel mean sequence of the human face region, including: The face region calculates the mean values of R and G channels respectively according to the glint color sequence pre-issued by the front-end device, and forms two channel mean value sequences respectively; The mean value sequences of the two channels are pre-processed; DCT_R is obtained by performing DCT transformation on the mean value sequence of the R channel of the face region after data pre-processing; IDCT_R is obtained by performing inverse DCT transformation on DCT_R; The maximum and minimum points of the IDCT_R sequence, i.e. the peaks and valleys of IDCT_R, are obtained; The peak and valley points index of IDCT_R is sorted, and the corresponding elements of the G channel mean value sequence are obtained to obtain sequence G2 according to the sorted index; The sequence G2 outputs a decoding sequence according to a threshold T, when the element in the sequence G2 is greater than T, 1 is output, and when the element in the sequence G2 is less than or equal to T, 0 is output, to obtain a decoding sequence G3; The calculation formula of T is as follows: 。 8. A computer device, comprising: The computer device comprises at least one processor; and The memory is in communication connection with the at least one processor; wherein The memory has a computer program stored thereon, which can be executed by the at least one processor, and when the computer program is executed by the at least one processor, the face living body detection method of any one of claims 1-6 can be realized.
9. A non-transitory computer readable storage medium, comprising: The non-volatile computer readable storage medium stores a computer program, and when the computer program is executed by at least one processor, the face living body detection method of any one of claims 1-6 can be realized.
Citation Information
Patent Citations
Living body detection method and device and storage medium
CN107992794A
Face living body detection method and system
CN115546874A