Liveness detection method, device and electronic equipment

By obtaining the color chromatic aberration vector and color aberration change prediction code of the face image sequence and combining the color random code for live detection, the problems of low accuracy and high cost in the existing methods are solved, and efficient and accurate live detection is achieved.

CN116682183BActive Publication Date: 2025-08-26BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310691639.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-12
Publication Date
2025-08-26
Estimated Expiration
2043-06-12

AI Technical Summary

Technical Problem

The existing live detection methods are susceptible to natural light, have low accuracy, high training costs and high calculation costs.

Method used

By acquiring the face image sequence, the color chromatic aberration vector and the color difference change prediction code are determined, and the color random code is combined for live detection to avoid the influence of ambient light and reduce the calculation complexity.

Benefits of technology

It improves the accuracy and efficiency of live detection, reduces training costs, and enhances its resistance to injection attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116682183B_ABST
    Figure CN116682183B_ABST
Patent Text Reader

Abstract

The present disclosure provides a liveness detection method, device, and electronic device, which relate to the fields of artificial intelligence technology, especially computer vision, image processing, deep learning, and other technical fields, and can be applied to scenarios such as smart cities and smart finance. The specific implementation scheme is as follows: the server obtains a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in a color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device collects the facial image; based on the color difference vectors of the multiple facial images, the color difference change prediction code corresponding to the facial image sequence is determined; based on the color difference change prediction code and the color difference change random code determined based on the color random code, the liveness detection result is determined, wherein the setting and verification of the color random code can resist injection attacks, and the determination of the color difference vector can avoid the influence of ambient natural light, thereby improving the efficiency of liveness detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to technical fields such as computer vision, image processing, and deep learning, and can be applied to scenarios such as smart cities and smart finance, and in particular to a liveness detection method, device, and electronic equipment. Background Art

[0002] Liveness detection determines whether an image is taken by a real person. It is a fundamental module of facial recognition systems, ensuring their security. Currently, with the continuous advancement of hacking technology, hackers are able to replace the face image being uploaded by the terminal device with the face image being uploaded, a technique known as an injection attack.

[0003] Currently, the main method to resist injection attacks is to use screen light to encode the chromaticity and intensity of light into the screen light; use the reflected light signal of the captured face image to regress the gradient of chromaticity and intensity; and finally verify whether the input image is an injection attack based on the regressed chromaticity and intensity gradient values.

[0004] However, the regression of chromaticity and intensity gradients in the above methods is easily affected by natural light, resulting in low liveness detection accuracy. Furthermore, the regression of chromaticity and intensity gradients requires the use of a two-dimensional convolutional network, which is expensive to train and computationally intensive. Summary of the Invention

[0005] The present disclosure provides a living body detection method, device and electronic equipment.

[0006] According to one aspect of the present disclosure, a liveness detection method is provided, which is applied to a server, and the method includes: obtaining a facial image sequence; a plurality of facial images in the facial image sequence correspond one-to-one to a plurality of colors in a color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image; determining a color difference vector of the plurality of facial images; the color difference vector includes a color difference value between every two color channels in the facial image; determining a color difference change prediction code corresponding to the facial image sequence based on the color difference vectors of the plurality of facial images; and determining a liveness detection result based on the color difference change prediction code and a color difference change random code determined based on the color random code.

[0007] According to another aspect of the present disclosure, a liveness detection method is provided, which is applied to a terminal device, and includes: obtaining a facial image sequence; corresponding multiple facial images in the facial image sequence to multiple colors in a color random code; the colors corresponding to the facial images are the colors of the screen lighting when the terminal device captures the facial images; sending the facial image sequence to a server, and receiving a liveness score value returned by the server after performing liveness detection processing on the facial image sequence; and determining the liveness detection result based on the liveness score value.

[0008] According to another aspect of the present disclosure, a liveness detection device is provided, which is applied to a server, and the device includes: an acquisition module for acquiring a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in a color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image; a first determination module for determining the color difference vectors of the multiple facial images; the color difference vector includes the color difference value between every two color channels in the facial image; a second determination module for determining the color difference change prediction code corresponding to the facial image sequence based on the color difference vectors of the multiple facial images; and a third determination module for determining the liveness detection result based on the color difference change prediction code and the color difference change random code determined based on the color random code.

[0009] According to another aspect of the present disclosure, a liveness detection apparatus is provided for use in a terminal device, the apparatus comprising: an acquisition module for acquiring a facial image sequence; a plurality of facial images in the facial image sequence corresponding one-to-one to a plurality of colors in a color random code; the colors corresponding to the facial images being the colors of the screen lighting when the terminal device captures the facial images; a receiving module for sending the facial image sequence to a server and receiving a liveness score value returned by the server after performing liveness detection processing on the facial image sequence; and a determination module for determining the liveness detection result based on the liveness score value.

[0010] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the liveness detection method proposed above in the present disclosure.

[0011] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the living body detection method proposed above in the present disclosure.

[0012] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements the steps of the liveness detection method proposed above in the present disclosure when executed by a processor.

[0013] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings are used to better understand the present invention and do not constitute a limitation of the present invention.

[0015] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;

[0016] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;

[0017] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;

[0018] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure;

[0019] Figure 5 It is a calibration logic diagram based on random color codes;

[0020] Figure 6 is a schematic diagram of a liveness detection system;

[0021] Figure 7 is a schematic diagram according to a fifth embodiment of the present disclosure;

[0022] Figure 8 is a schematic diagram according to a sixth embodiment of the present disclosure;

[0023] Figure 9 4 is a block diagram of an electronic device for implementing the living body detection method according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0025] Liveness detection determines whether an image is taken by a real person. It is a fundamental module of facial recognition systems, ensuring their security. Currently, with the continuous advancement of hacking technology, hackers are able to replace the face image being uploaded by the terminal device with the face image being uploaded, a technique known as an injection attack.

[0026] Currently, the main method to resist injection attacks is to use screen light to encode the chromaticity and intensity of light into the screen light; use the reflected light signal of the captured face image to regress the gradient of chromaticity and intensity; and finally verify whether the input image is an injection attack based on the regressed chromaticity and intensity gradient values.

[0027] However, the regression of chromaticity and intensity gradients in the above methods is easily affected by natural light, resulting in low liveness detection accuracy. Furthermore, the regression of chromaticity and intensity gradients requires the use of a two-dimensional convolutional network, which is expensive to train and computationally intensive.

[0028] To address the above problems, the present disclosure provides a living body detection method, device, and electronic device.

[0029] Figure 1 This is a schematic diagram according to the first embodiment of the present disclosure. It should be noted that the liveness detection method of the embodiment of the present disclosure can be applied to a liveness detection device, which can be set in an electronic device so that the electronic device can perform a liveness detection function.

[0030] The electronic device may be any device with computing capabilities, such as a personal computer (PC), a mobile terminal, a server, etc. The mobile terminal may be, for example, an in-vehicle device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a smart speaker, or other hardware device with various operating systems, a touch screen, and / or a display. In the following embodiments, the execution subject is described as a server.

[0031] like Figure 1 As shown, the living body detection method may include the following steps:

[0032] Step 101, obtain a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image.

[0033] In the embodiment of the present disclosure, the process of the server executing step 101 may, for example, be: upon receiving a liveness detection request from a terminal device, generating a color random code; sending the color random code to the terminal device to instruct the terminal device to perform video capture and facial image sequence extraction processing according to multiple colors in the color random code; and receiving the facial image sequence returned by the terminal device.

[0034] The color random code is a code randomly generated by the server. The number of colors in the color random code can be randomly set; or the number of colors in the color random code is fixed and set by the server; or the number of colors in the color random code is fixed and agreed upon by the server and the terminal device.

[0035] The colors in the color random code can be represented by abbreviations of the colors. The colors in the color random code are randomly selected from multiple specified colors. For ease of distinction, colors with high light intensity and significant differences can be selected as the specified colors. For example, the specified colors can include at least two of the following: white, red, blue, green, yellow, cyan, and purple. The names, R / G / B color values, and abbreviations of the different specified colors can be shown in Table 1 below.

[0036] Table 1 Color value table of specified colors

[0037] Color Name B / G / R color values Abbreviation white (255,255,255) w red (0,0,255) r green (0,255,0) g blue (255,0,0) b yellow (0,255,255) y green (255,0,255) m purple (255,255,0) c

[0038] Among them, the server can send a color random code to the terminal device according to the liveness detection request of the terminal device to instruct the terminal device to perform video capture and facial image sequence extraction and processing according to multiple colors in the color random code; then the server can perform verification processing according to the facial image sequence and the color random code, so that the color random code can be flexibly adjusted to avoid the possibility of hackers preparing facial images with fixed colors in advance and injecting them, thereby improving the accuracy of liveness detection.

[0039] Step 102: Determine the color difference vectors of the multiple facial images; the color difference vectors include the color difference values ​​between every two color channels in the facial images.

[0040] In the disclosed embodiment, the color channels involved in the facial image may include a red channel (R), a green channel (G), and a blue channel (B). The color difference between any two color channels in the facial image may be determined based on the pixel values ​​of each pixel in the two color channels in the facial image.

[0041] Because the components of ambient light in the three color channels generally vary synchronously, we perform a color difference calculation on any two color channels in the facial image to suppress ambient light and highlight the color of the screen lighting.

[0042] Step 103: Determine a color difference change prediction code corresponding to the facial image sequence based on the color difference vectors of the plurality of facial images.

[0043] In the embodiment of the present disclosure, the numerical value on each bit in the color difference change prediction code corresponding to the facial image sequence may refer to the color difference change between the color difference vectors of adjacent facial images. Taking the facial image sequence as an example including 4 images, namely image A, image B, image C and image D, the color difference change prediction code may include numerical values ​​on 9 bits. The numerical values ​​on the first 3 bits respectively represent the color difference change on each color channel from the color difference vector of image A to the color difference vector of image B. The numerical values ​​on the middle 3 bits represent the color difference change on each color channel from the color difference vector of image B to the color difference vector of image C. The numerical values ​​on the last three bits represent the color difference change on each color channel from the color difference vector of image C to the color difference vector of image D.

[0044] The color difference change prediction code may be, for example, {{-, =, +}, {+, +, -}, {+, -, +}}. In the first bracket, "-" indicates that the color difference change on the red channel is decreasing; "=" indicates that the color difference change on the green channel is unchanged; and "+" indicates that the color difference change on the blue channel is increasing.

[0045] Step 104 : Determine a liveness detection result according to the color difference change prediction code and the color difference change random code determined based on the color random code.

[0046] In an embodiment of the present disclosure, a method for determining a color difference change random code based on a color random code includes: obtaining multiple colors in the color random code; for each pair of adjacent colors in the multiple colors, querying a color difference change matrix based on two colors in the adjacent colors to obtain a color difference change between the two colors; and determining the color difference change random code based on the color difference change between the two colors in each pair of adjacent colors in the color random code.

[0047] The color difference change matrix is ​​determined based on the color difference values ​​of multiple specified colors. The color difference value of each specified color is obtained by subtracting the values ​​of the specified color on multiple color channels. That is, each specified color may include three color difference values: one color difference value is obtained by subtracting the values ​​on the blue channel from the values ​​on the red channel; one color difference value is obtained by subtracting the values ​​on the green channel from the values ​​on the blue channel; and one color difference value is obtained by subtracting the values ​​on the red channel from the values ​​on the green channel. The names, color difference values, and abbreviations of different specified colors may be shown in Table 2 below.

[0048] Table 2 Color difference value table of specified colors

[0049]

[0050]

[0051] After determining the color difference values ​​of multiple specified colors, the color difference change between any two specified colors can be determined based on the color difference values ​​of the two specified colors; and then the color difference change matrix can be determined based on the color difference change between any two specified colors.

[0052] Among them, the color difference change matrix is ​​determined in advance in combination with the color difference value of the specified color; then, according to each pair of adjacent colors in the color random code, the color difference change matrix is ​​queried to obtain the color difference change between two colors in the adjacent colors, and then the color difference change random code is determined. The color difference change random code can be quickly determined, thereby improving the speed of liveness detection.

[0053] In the embodiment of the present disclosure, the process of the server executing step 104 may, for example, be as follows: when the color difference change prediction code is inconsistent with the color difference change random code, determining the value of the liveness score to be zero; when the color difference change prediction code is consistent with the color difference change random code, combining multiple face images in the face image sequence and the liveness detection model to determine the value of the liveness score; and determining the liveness detection result based on the determined value of the liveness score.

[0054] If the color difference change prediction code and the color difference change random code are consistent, it indicates that the facial image was captured by a real person, not by an injection attack. Therefore, the liveness detection model can be further combined to perform liveness detection processing and determine the liveness score. Furthermore, if the color difference change prediction code and the color difference change random code are inconsistent, it indicates that the facial image was captured by an injection attack, not by a real person, and therefore the liveness score can be determined to be zero.

[0055] Among them, the server combines multiple face images in the face image sequence and the liveness detection model to determine the value of the liveness score. For example, the process can be to input the multiple face images in the face image sequence into a pre-trained liveness detection model and obtain the value of the liveness score output by the liveness detection model.

[0056] The server may determine the liveness detection result based on the determined liveness score value, for example, by sending the determined liveness score value to the terminal device, and the terminal device determining the liveness detection result based on the liveness score value and a preset threshold. The liveness detection result indicates whether the liveness detection succeeded or failed.

[0057] Among them, by comparing the color difference change prediction code with the color difference change random code, the situation where the face image sequence is obtained through injection attack can be ruled out, and the possibility of giving a successful liveness detection result for the face image sequence obtained by injection attack can be avoided, thereby further improving the accuracy of liveness detection.

[0058] The liveness detection method of the embodiment of the present disclosure is as follows: the server obtains a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device collects the facial image; the color difference vectors of the multiple facial images are determined; the color difference vector includes the color difference value between every two color channels in the facial image; according to the color difference vectors of the multiple facial images, the color difference change prediction code corresponding to the facial image sequence is determined; according to the color difference change prediction code and the color difference change random code determined based on the color random code, the liveness detection result is determined, wherein, through the setting and verification of the color random code, the injection attack can be resisted, and through the determination of the color difference vector, the influence of the ambient natural light is avoided, and no convolutional network is used, which reduces the cost of liveness detection and improves the efficiency of liveness detection.

[0059] In order to accurately determine the color difference vector of the face image and improve the accuracy of the determination of the color difference vector, the color mean vector of the face image can be determined first, and then the mean values ​​on each two color channels are processed to obtain the color difference vector. Figure 2 As shown, Figure 2 is a schematic diagram according to a second embodiment of the present disclosure, Figure 2 The illustrated embodiment may include the following steps:

[0060] Step 201, obtain a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image.

[0061] Step 202: for each face image in the face image sequence, determine the color mean vector of the face image; the color mean vector includes the mean value of each color channel.

[0062] In one example of an embodiment of the present disclosure, the server may perform step 202 by, for example, performing, for each facial image in the facial image sequence and for each color channel, averaging the values ​​of the color channels of multiple pixels in the facial image to obtain a mean value for the color channel; and determining a color mean vector for the facial image based on the mean values ​​for each color channel. Determining the color mean vector for the facial image by combining the values ​​of multiple pixels in the facial image for each color channel can comprehensively consider multiple pixels in the facial image and improve the accuracy of the determined color mean vector.

[0063] For example, if the number of pixels in a face image is N, and the color channels include red, blue, and green channels, then for the red channel, the values ​​of the N pixels on the red channel can be averaged to obtain the average value of the red channel; the values ​​of the N pixels on the blue channel can be averaged to obtain the average value of the blue channel; and the values ​​of the N pixels on the green channel can be averaged to obtain the average value of the green channel.

[0064] In the embodiment of the present disclosure, with respect to screen lighting, the pupil of the human eye can effectively reflect the screen lighting, thereby obtaining a pupil image containing the lighting color information. However, the effect of other parts of the face reflecting the screen lighting is worse than that of the pupil of the human eye. Therefore, correspondingly, in order to further improve the accuracy of determining the color mean vector, and thereby improve the accuracy of the color difference change prediction code, in another example, the process of the server executing step 202 may be, for example, for each face image in the face image sequence, performing pupil area detection processing on the face image to obtain the pupil area image in the face image; for each color channel, performing mean processing on the values ​​on the color channel in multiple pixel points of the pupil area image to obtain the mean value on the color channel; and determining the color mean vector of the face image based on the mean value on each color channel.

[0065] In one example, there can be one pupil area image in a facial image, which includes all pupil areas in the facial image. In another example, there can be one or more pupil area images in a facial image, each of which includes a pupil area in the facial image. In this example, the presence of one pupil area image refers to the case where the facial image only includes a portion of the face, and the portion of the face only involves one pupil.

[0066] Among them, if the number of pupil area images in the face image is two, then for each color channel, the values ​​on the color channel in multiple pixel points of the two pupil area images can be averaged to obtain the color mean vector of the face image.

[0067] Step 203 : performing a difference process on the mean values ​​of every two color channels to obtain a color difference value between every two color channels.

[0068] In the embodiment of the present disclosure, the process of the server executing step 203 may, for example, be to perform difference processing on the mean value on the blue channel and the mean value on the red channel to obtain the color difference value from the blue channel to the red channel; perform difference processing on the mean value on the green channel and the mean value on the blue channel to obtain the color difference value from the green channel to the blue channel; perform difference processing on the mean value on the red channel and the mean value on the green channel to obtain the color difference value from the red channel to the green channel.

[0069] Step 204: Determine the color difference vector of the face image based on the color difference value between every two color channels.

[0070] The color difference vector of the face image may include: the color difference value from the blue channel to the red channel, the color difference value from the green channel to the blue channel, and the color difference value from the red channel to the green channel.

[0071] Step 205 : determining a color difference change prediction code corresponding to the facial image sequence based on the color difference vectors of the plurality of facial images.

[0072] Step 206 : Determine a liveness detection result according to the color difference change prediction code and the color difference change random code determined based on the color random code.

[0073] It should be noted that the details of step 201, step 205 and step 206 can be found in Figure 1 Step 101, step 103 to step 104 in the illustrated embodiment will not be described in detail here.

[0074] In the liveness detection method of the embodiment of the present disclosure, a server obtains a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in a color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device collects the facial image; for each facial image in the facial image sequence, a color mean vector of the facial image is determined; the color mean vector includes the mean value on each color channel; the mean value on each two color channels is subtracted to obtain the color difference value between each two color channels; based on the color difference value between each two color channels, a color color difference vector of the facial image is determined; based on the color color difference vectors of the multiple facial images, a color difference change prediction code corresponding to the facial image sequence is determined; and based on the color difference change random code determined based on the color random code, a liveness detection result is determined. In the method, the setting and verification of the color random code can resist injection attacks, and the determination of the color color difference vector avoids the influence of ambient natural light. No convolutional network is used, thereby reducing the cost of liveness detection and improving the efficiency of liveness detection.

[0075] In order to accurately determine the color difference change prediction code corresponding to the facial image sequence and further improve the efficiency of liveness detection, the color difference matrix can be determined based on the color difference values ​​in the color difference vectors of multiple facial images; and then the color difference change prediction code can be determined by combining the color difference matrix and the color difference threshold. Figure 3 As shown, Figure 3 is a schematic diagram according to a third embodiment of the present disclosure, Figure 3 The illustrated embodiment may include the following steps:

[0076] Step 301, obtain a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image.

[0077] Step 302: Determine the color difference vectors of the multiple facial images; the color difference vectors include the color difference values ​​between every two color channels in the facial images.

[0078] Step 303: Determine a color difference matrix based on the color difference values ​​in the color difference vectors of the multiple face images.

[0079] In the embodiment of the present disclosure, the process of the server executing step 303 may, for example, be to use each color difference value in the color difference vector of the first facial image as the first row data of the matrix; use each color difference value in the color difference vector of the second facial image as the second row data of the matrix; repeat the execution until multiple facial images are processed, and then use the obtained matrix as the color difference matrix.

[0080] Step 304 : performing zero mean processing on the color and color difference matrix to obtain a processed color and color difference matrix.

[0081] In the embodiment of the present disclosure, the process of the server executing step 304 may, for example, be to perform mean processing on all color difference values ​​in the color difference matrix to obtain a color difference mean; subtract the color difference mean from each color difference value in the color difference matrix to obtain a processed color difference value corresponding to each color difference value; and generate a processed color difference matrix based on the processed color difference values ​​corresponding to each color difference value.

[0082] Step 305: Determine the color difference threshold corresponding to the processed color difference matrix.

[0083] In the embodiment of the present disclosure, the process of the server executing step 305 may, for example, be to perform absolute value processing on each processed color difference value in the processed color difference matrix to obtain the absolute color difference value corresponding to each processed color difference value, and then obtain the absolute color difference matrix; multiply the absolute color difference matrix by a specified coefficient to obtain an intermediate color difference matrix; perform median processing on each color difference value in the intermediate color difference matrix that has been processed by the specified coefficient, and use the obtained median as the color difference threshold corresponding to the processed color difference matrix.

[0084] Step 306 : Determine the color difference change prediction code corresponding to the facial image sequence based on the processed color difference matrix and the color difference threshold corresponding to the processed color difference matrix.

[0085] In the embodiment of the present disclosure, the process of the server executing step 306 may, for example, be as follows: for each processed color difference value in the processed color difference matrix, when the processed color difference value is greater than or equal to the color difference threshold, determining that the color difference change corresponding to the processed color difference value is an increase; when the processed color difference value is less than or equal to the negative color difference threshold, determining that the color difference change corresponding to the processed color difference value is a decrease; when the processed color difference value is less than the color difference threshold and greater than the negative color difference threshold, determining that the color difference change corresponding to the processed color difference value is an unchanged situation; and determining the color difference change prediction code corresponding to the face image sequence based on the color difference change corresponding to each processed color difference value in the processed color difference matrix.

[0086] The threshold, determined based on the processed color difference change matrix, can reflect the color difference changes between facial images with different screen lighting colors, the color difference changes between facial images with the same screen lighting color, and the boundary between these two color difference changes. In other words, the threshold can reflect the boundary between the color difference changes between facial images with different lighting colors. Therefore, combined with the above threshold, the color difference change prediction code corresponding to the facial image sequence can be accurately determined, further improving the accuracy of liveness detection.

[0087] Step 307 : Determine a liveness detection result according to the color difference change prediction code and the color difference change random code determined based on the color random code.

[0088] It should be noted that the details of steps 301 to 302 and step 307 can be found in Figure 1 Steps 101 to 102 and 104 in the illustrated embodiment will not be described in detail here.

[0089] The liveness detection method of the embodiment of the present disclosure obtains a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device collects the facial image; the color difference vectors of the multiple facial images are determined; the color difference vector includes the color difference value between each two color channels in the facial image; the color difference matrix is ​​determined based on the color difference values ​​in the color difference vectors of the multiple facial images; the color difference matrix is ​​zero-mean processed to obtain the processed color difference matrix; the processed color difference matrix is ​​determined The method adopts a color difference threshold corresponding to the processed color difference matrix; determines the color difference change prediction code corresponding to the face image sequence according to the processed color difference matrix and the color difference threshold corresponding to the processed color difference matrix; determines the liveness detection result according to the color difference change prediction code and the color difference change random code determined based on the color random code, wherein, through the setting and verification of the color random code, it is possible to resist the injection attack, and through the determination of the color difference vector, it avoids the influence of the natural light of the environment, and does not adopt a convolutional network, thereby reducing the cost of liveness detection and improving the efficiency of liveness detection.

[0090] Figure 4 It should be noted that the liveness detection method of the embodiment of the present disclosure can be applied to a liveness detection device, which can be set in an electronic device so that the electronic device can perform a liveness detection function.

[0091] The electronic device may be any device with computing capabilities, such as a personal computer (PC), a mobile terminal, a server, etc. The mobile terminal may be, for example, an in-vehicle device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a smart speaker, or other hardware device with various operating systems, a touch screen, and / or a display. In the following embodiments, the execution subject is described as a terminal device.

[0092] like Figure 4 As shown, the living body detection method may include the following steps:

[0093] Step 401, obtain a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image.

[0094] In the embodiment of the present disclosure, the process of the terminal device executing step 401 may, for example, be sending a liveness detection request to the server to obtain a color random code returned by the server; while lighting the screen according to multiple colors in the color random code, a video is captured; for each color in the color random code, according to the lighting time period corresponding to the color, a facial image corresponding to the color is extracted from the video segment corresponding to the lighting time period in the video; and a facial image sequence is determined based on the facial images corresponding to the multiple colors in the color random code.

[0095] The color random code is a code randomly generated by the server. The number of colors in the color random code can be randomly set; or the number of colors in the color random code is fixed and set by the server; or the number of colors in the color random code is fixed and agreed upon by the server and the terminal device.

[0096] The colors in the color randomization code can be represented by abbreviations of the colors. The colors in the color randomization code are randomly selected from multiple specified colors. To facilitate differentiation, colors with high light intensity and significant differences can be selected as the specified colors. For example, the specified colors can include at least two of the following: white, red, blue, green, yellow, cyan, and purple.

[0097] Among them, the terminal device can perform screen lighting processing on multiple colors in the color random code in sequence according to the color random code indicated by the server, and collect video while the screen lighting processing is being performed, so as to extract face images within the lighting time period of each color in the video and obtain a face image sequence; thereby, the color random code used to obtain the face image sequence can be flexibly adjusted, avoiding the possibility of hackers preparing face images with fixed colors in advance and injecting them, thereby improving the accuracy of liveness detection.

[0098] Step 402: Send the facial image sequence to the server, and receive the liveness score value returned by the server after performing liveness detection processing on the facial image sequence.

[0099] In the embodiment of the present disclosure, the server performs liveness detection processing on the face image sequence to obtain the liveness score, which can be referred to Figures 1 to 3 The steps shown in the figure will not be described in detail here.

[0100] Step 403: Determine the liveness detection result according to the liveness score value.

[0101] In the disclosed embodiment, a lower liveness score indicates a lower likelihood of successful liveness detection; a higher liveness score indicates a higher likelihood of successful liveness detection. Therefore, determining the liveness detection result in combination with the liveness score can further improve the accuracy of liveness detection. Accordingly, the terminal device may, for example, determine that the liveness detection result is a liveness detection success if the liveness score is greater than or equal to a preset threshold; and determine that the liveness detection result is a liveness detection failure if the liveness score is less than the preset threshold.

[0102] In the liveness detection method of the embodiment of the present disclosure, the terminal device obtains a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device collects the facial image; the facial image sequence is sent to the server, and the server receives the liveness score value returned after performing liveness detection processing on the facial image sequence; the liveness detection result is determined according to the liveness score value, wherein, through the setting and verification of the color random code, the injection attack can be resisted, and by determining the color difference vector, the influence of ambient natural light is avoided, and no convolutional network is used, which reduces the cost of liveness detection and improves the efficiency of liveness detection.

[0103] The following examples are given to illustrate this. Figure 5 The figure shows the logic diagram of the calibration based on the random color code. Figure 5In the process, (1) a random code is input, that is, the terminal device inputs a color random code, such as wrgb, to control the screen to illuminate in sequence according to multiple colors. (2) During the screen illumination process, the terminal device collects video and extracts a sequence of face images. (3) Pupil detection, that is, for each face image in the face image sequence, the pupil area image is detected and obtained. (4) Image preprocessing, that is, the acquisition of color difference vectors, to obtain a color difference sequence (including multiple color difference vectors). (5) Prediction coding, that is, based on multiple color difference vectors, the color difference change prediction code is determined, and the GT code (color difference change random code) obtained by mapping the color difference change prediction code with the color random code is matched to determine the same color (the lighting color determined based on the face image is consistent with the lighting color corresponding to the face image) or different color (the lighting color determined based on the face image is inconsistent with the lighting color corresponding to the face image).

[0104] Among them, during pupil detection in step (3), the left eye pupil image (Il) and the right eye pupil image (Ir) can be extracted; then the color mean vector Ml of the left eye pupil image and the color mean vector Mr of the right eye pupil image are determined; then the two color mean vectors are combined to determine the color difference vector (the color difference vector of the face image).

[0105] The following examples are given to illustrate this. Figure 6 The figure shows a schematic diagram of a liveness detection system. Figure 6 In the process, (1) start. (2) The mobile terminal (terminal device) sends a request to the server (server) to request a random code (color random code). (3) Lighting is performed according to the random code wrgb received from the server. (4) The lighting video is recorded. (5) The corresponding color light image is extracted to obtain 4 images (to form a face image sequence). (6) The 4 images are uploaded to the server. (7) The server performs color difference verification logic based on the 4 images to obtain a prediction code (color difference change prediction code). (8) The server determines whether the prediction code is equal to the GT code (color difference change random code). If so, it combines the liveness model to determine the liveness score; if not, it determines that the liveness score is zero. (9) The terminal device determines whether the score is greater than the threshold. If so, the verification is successful; if not, the verification fails.

[0106] In order to implement the above embodiment, the present disclosure also provides a living body detection device. Figure 7 As shown, Figure 7 The liveness detection device 70 , applied to a server, may include: an acquisition module 701 , a first determination module 702 , a second determination module 703 , and a third determination module 704 .

[0107] The acquisition module 701 is used to acquire a facial image sequence; the multiple facial images in the facial image sequence correspond one-to-one to the multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image;

[0108] A first determining module 702 is configured to determine a color difference vector of a plurality of facial images; the color difference vector includes a color difference value between each two color channels in the facial image;

[0109] A second determining module 703 is configured to determine a color difference change prediction code corresponding to the facial image sequence based on the color difference vectors of the plurality of facial images;

[0110] The third determination module 704 is configured to determine a liveness detection result according to the color difference change prediction code and the color difference change random code determined based on the color random code.

[0111] As a possible implementation method of an embodiment of the present disclosure, the acquisition module 701 is specifically used to generate the color random code when receiving a liveness detection request from the terminal device; send the color random code to the terminal device to instruct the terminal device to perform video capture and facial image sequence extraction processing according to multiple colors in the color random code; and receive the facial image sequence returned by the terminal device.

[0112] As a possible implementation method of an embodiment of the present disclosure, the first determination module 702 includes: a first determination unit, a difference processing unit and a second determination unit; the first determination unit is used to determine the color mean vector of the facial image for each facial image in the facial image sequence; the color mean vector includes the mean values ​​on each color channel; the difference processing unit is used to perform difference processing on the mean values ​​on each two color channels to obtain the color difference value between each two color channels; the second determination unit is used to determine the color color difference vector of the facial image based on the color difference value between each two color channels.

[0113] As a possible implementation method of an embodiment of the present disclosure, the first determination unit is specifically used to, for each facial image in the facial image sequence and for each color channel, perform mean processing on the values ​​on the color channel of multiple pixel points of the facial image to obtain the mean value on the color channel; and determine the color mean vector of the facial image based on the mean values ​​on each color channel.

[0114] As a possible implementation method of an embodiment of the present disclosure, the first determination unit is specifically used to, for each facial image in the facial image sequence, perform pupil area detection processing on the facial image to obtain a pupil area image in the facial image; for each color channel, perform mean processing on the values ​​on the color channel in multiple pixel points of the pupil area image to obtain the mean value on the color channel; and determine the color mean vector of the facial image based on the mean values ​​on each of the color channels.

[0115] As a possible implementation method of an embodiment of the present disclosure, the second determination module 703 includes: a third determination unit, a zero mean processing unit, a fourth determination unit and a fifth determination unit; the third determination unit is used to determine the color difference matrix based on the color difference values ​​in the color difference vectors of the multiple facial images; the zero mean processing unit is used to perform zero mean processing on the color difference matrix to obtain a processed color difference matrix; the fourth determination unit is used to determine the color difference threshold corresponding to the processed color difference matrix; the fifth determination unit is used to determine the color difference change prediction code corresponding to the facial image sequence based on the processed color difference matrix and the color difference threshold corresponding to the processed color difference matrix.

[0116] As a possible implementation method of an embodiment of the present disclosure, the fifth determination unit is specifically used to, for each processed color difference value in the processed color difference matrix, when the processed color difference value is greater than or equal to the color difference threshold, determine that the color difference change corresponding to the processed color difference value is an increase; when the processed color difference value is less than or equal to the negative color difference threshold, determine that the color difference change corresponding to the processed color difference value is a decrease; when the processed color difference value is less than the color difference threshold and greater than the negative color difference threshold, determine that the color difference change corresponding to the processed color difference value is unchanged; and determine the color difference change prediction code corresponding to the face image sequence according to the color difference change corresponding to each processed color difference value in the processed color difference matrix.

[0117] As a possible implementation of an embodiment of the present disclosure, a method for determining the color difference change random code based on the color random code includes: obtaining multiple colors in the color random code; for each pair of adjacent colors in the multiple colors, querying a color difference change matrix based on two colors in the adjacent colors to obtain a color difference change between the two colors; and determining the color difference change random code based on the color difference change between the two colors in each pair of adjacent colors in the color random code.

[0118] As a possible implementation method of an embodiment of the present disclosure, the third determination module 704 is specifically used to, when the color difference change prediction code is inconsistent with the color difference change random code, determine the value of the liveness score to be zero; when the color difference change prediction code is consistent with the color difference change random code, combine multiple face images in the face image sequence and the liveness detection model to determine the value of the liveness score; and determine the liveness detection result based on the determined value of the liveness score.

[0119] The liveness detection device of the embodiment of the present disclosure is as follows: the server obtains a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device collects the facial image; the color difference vectors of the multiple facial images are determined; the color difference vector includes the color difference value between every two color channels in the facial image; according to the color difference vectors of the multiple facial images, the color difference change prediction code corresponding to the facial image sequence is determined; according to the color difference change prediction code and the color difference change random code determined based on the color random code, the liveness detection result is determined, wherein, through the setting and verification of the color random code, the injection attack can be resisted, and through the determination of the color difference vector, the influence of the ambient natural light is avoided, and the convolutional network is not used, which reduces the cost of liveness detection and improves the efficiency of liveness detection.

[0120] In order to implement the above embodiment, the present disclosure also provides another living body detection device. Figure 8 As shown, Figure 8 80 is a schematic diagram of a sixth embodiment of the present disclosure. The liveness detection device 80 is applied to a terminal device and may include: an acquisition module 801 , a receiving module 802 and a determination module 803 .

[0121] The acquisition module 801 is used to acquire a facial image sequence; the multiple facial images in the facial image sequence correspond one-to-one to the multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image;

[0122] A receiving module 802 is configured to send the facial image sequence to a server and receive a liveness score value returned by the server after performing liveness detection processing on the facial image sequence;

[0123] The determination module 803 is configured to determine the liveness detection result according to the value of the liveness score.

[0124] As a possible implementation method of an embodiment of the present disclosure, the acquisition module 801 is specifically used to send a liveness detection request to the server to obtain a color random code returned by the server; while lighting the screen according to multiple colors in the color random code, a video is captured; for each color in the color random code, according to the lighting time period corresponding to the color, a facial image corresponding to the color is extracted from the video segment corresponding to the lighting time period in the video; and the facial image sequence is determined based on the multiple facial images corresponding to the colors in the color random code.

[0125] As a possible implementation of an embodiment of the present disclosure, the determination module 803 is specifically configured to, when the value of the liveness score is greater than or equal to a preset numerical threshold, determine that the liveness detection result is a liveness detection success; and when the value of the liveness score is less than the preset numerical threshold, determine that the liveness detection result is a liveness detection failure.

[0126] The liveness detection device of the embodiment of the present disclosure is as follows: the terminal device obtains a facial image sequence; multiple facial images in the facial image sequence correspond one-to-one to multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device collects the facial image; the facial image sequence is sent to the server, and the server receives the liveness score value returned after performing liveness detection processing on the facial image sequence; the liveness detection result is determined according to the liveness score value, wherein, through the setting and verification of the color random code, the injection attack can be resisted, and by determining the color difference vector, the influence of ambient natural light is avoided, and no convolutional network is used, thereby reducing the cost of liveness detection and improving the efficiency of liveness detection.

[0127] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are all carried out with the user's consent, comply with relevant laws and regulations, and do not violate public order and good morals.

[0128] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0129] Figure 9A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0130] like Figure 9 As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0131] Multiple components in the electronic device 900 are connected to the I / O interface 905, including an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a magnetic disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the electronic device 900 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0132] The computing unit 901 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as the liveness detection method. For example, in some embodiments, the liveness detection method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the liveness detection method described above can be performed. Alternatively, in other embodiments, the computing unit 901 can be configured to perform the liveness detection method by any other appropriate means (e.g., by means of firmware).

[0133] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0134] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0135] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0136] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0137] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0138] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.

[0139] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0140] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A liveness detection method, applied to a server, comprising: Get a sequence of face images; The multiple facial images in the facial image sequence correspond one-to-one to the multiple colors in the color random code; the color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image; Determining a plurality of color difference vectors of the facial images; the color difference vectors comprising a color difference value between each two color channels in the facial images; Determining a color difference matrix based on color difference values ​​in the color difference vectors of the plurality of facial images; Performing zero mean processing on the color difference matrix to obtain a processed color difference matrix; Determine a color difference threshold corresponding to the processed color difference matrix; Determining, according to the processed color difference matrix and the color difference threshold corresponding to the processed color difference matrix, a color difference change corresponding to each processed color difference value in the processed color difference matrix; Determining a color difference change prediction code corresponding to the facial image sequence according to a color difference change corresponding to each processed color difference value in the processed color difference matrix; determining a liveness detection result according to whether the color difference change prediction code and the color difference change random code determined based on the color random code are consistent; The method of determining the color difference change random code based on the color random code includes: Obtaining multiple colors in the color random code; For each pair of adjacent colors among the plurality of colors, obtaining a color difference change between the two colors based on two of the adjacent colors; The color difference change random code is determined according to a color difference change between two colors in each pair of adjacent colors in the color random code.

2. The method according to claim 1, wherein The step of obtaining a facial image sequence comprises: generating the color random code upon receiving a liveness detection request from the terminal device; Sending the color random code to the terminal device to instruct the terminal device to perform video capture and facial image sequence extraction processing according to multiple colors in the color random code; Receive the facial image sequence returned by the terminal device.

3. The method according to claim 1, wherein Determining the color difference vectors of the plurality of facial images includes: For each face image in the face image sequence, determining a color mean vector of the face image; the color mean vector includes mean values ​​on each color channel; Perform subtraction processing on the mean values ​​of each two color channels to obtain the color difference value between each two color channels; A color difference vector of the face image is determined according to the color difference value between every two color channels.

4. The method according to claim 3, wherein: The step of determining the color mean vector of each facial image in the facial image sequence includes: For each face image in the face image sequence, for each color channel, performing mean processing on the values ​​of the color channel in multiple pixels of the face image to obtain the mean value of the color channel; A color mean vector of the face image is determined based on the mean values ​​on each of the color channels.

5. The method according to claim 3, wherein The step of determining the color mean vector of each facial image in the facial image sequence includes: For each face image in the face image sequence, performing pupil region detection processing on the face image to obtain a pupil region image in the face image; For each color channel, performing mean processing on the values ​​of the color channel in multiple pixel points of the pupil area image to obtain the mean value of the color channel; A color mean vector of the face image is determined based on the mean values ​​on each of the color channels.

6. The method according to claim 1, wherein Determining, based on the processed color difference matrix and the color difference threshold corresponding to the processed color difference matrix, a color difference change corresponding to each processed color difference value in the processed color difference matrix, includes: For each processed color difference value in the processed color difference matrix, if the processed color difference value is greater than or equal to the color difference threshold, determining that the color difference change corresponding to the processed color difference value is an increase; When the processed color difference value is less than or equal to the negative color difference threshold, determining that the color difference change corresponding to the processed color difference value is a decrease; When the processed color difference value is smaller than the color difference threshold and larger than the negative color difference threshold, it is determined that the color difference change corresponding to the processed color difference value is unchanged.

7. The method according to claim 1, wherein The determining of the liveness detection result according to whether the color difference change prediction code and the color difference change random code determined based on the color random code are consistent includes: When the color difference change prediction code is inconsistent with the color difference change random code, determining the value of the liveness score to be zero; In a case where the color difference change prediction code is consistent with the color difference change random code, determining a value of a liveness score by combining multiple face images in the face image sequence and a liveness detection model; The liveness detection result is determined according to the determined value of the liveness score.

8. A liveness detection device, applied to a server, comprising: An acquisition module, used to acquire a facial image sequence; The plurality of facial images in the facial image sequence correspond one-to-one to the plurality of colors in the color random code; The color corresponding to the facial image is the color of the screen lighting when the terminal device captures the facial image; A first determining module, configured to determine color difference vectors of a plurality of facial images; The color difference vector includes the color difference value between every two color channels in the face image; The second determining module includes: a third determining unit, a zero-mean processing unit, a fourth determining unit, and a fifth determining unit; The third determining unit is configured to determine a color difference matrix based on color difference values ​​in the color difference vectors of the plurality of facial images; The zero mean processing unit is used to perform zero mean processing on the color difference matrix to obtain a processed color difference matrix; The fourth determining unit is used to determine a color difference threshold corresponding to the processed color difference matrix; The fifth determining unit is configured to determine, based on the processed color difference matrix and the color difference threshold corresponding to the processed color difference matrix, a color difference change corresponding to each processed color difference value in the processed color difference matrix; and determine a color difference change prediction code corresponding to the facial image sequence based on the color difference change corresponding to each processed color difference value in the processed color difference matrix; a third determination module, configured to determine a liveness detection result according to whether the color difference change prediction code and the color difference change random code determined based on the color random code are consistent; The method of determining the color difference change random code based on the color random code includes: Obtaining multiple colors in the color random code; For each pair of adjacent colors among the plurality of colors, obtaining a color difference change between the two colors based on two of the adjacent colors; The color difference change random code is determined according to a color difference change between two colors in each pair of adjacent colors in the color random code.

9. The device according to claim 8, wherein The acquisition module is specifically used to: generating the color random code upon receiving a liveness detection request from the terminal device; Sending the color random code to the terminal device to instruct the terminal device to perform video capture and facial image sequence extraction processing according to multiple colors in the color random code; Receive the facial image sequence returned by the terminal device.

10. The device according to claim 8, wherein The first determination module includes: a first determination unit, a difference processing unit, and a second determination unit; The first determining unit is configured to determine, for each face image in the face image sequence, a color mean vector of the face image; the color mean vector includes mean values ​​on each color channel; The difference processing unit is used to perform difference processing on the mean values ​​of each two color channels to obtain the color difference value between each two color channels; The second determining unit is configured to determine a color difference vector of the face image according to a color difference value between every two color channels.

11. The device according to claim 10, wherein The first determining unit is specifically configured to: For each face image in the face image sequence, for each color channel, performing mean processing on the values ​​of the color channel in multiple pixels of the face image to obtain the mean value of the color channel; A color mean vector of the face image is determined based on the mean values ​​on each of the color channels.

12. The device according to claim 10, wherein The first determining unit is specifically configured to: For each face image in the face image sequence, performing pupil region detection processing on the face image to obtain a pupil region image in the face image; For each color channel, performing mean processing on the values ​​of the color channel in multiple pixel points of the pupil area image to obtain the mean value of the color channel; A color mean vector of the face image is determined based on the mean values ​​on each of the color channels.

13. The device according to claim 8, wherein The fifth determining unit is specifically configured to: For each processed color difference value in the processed color difference matrix, if the processed color difference value is greater than or equal to the color difference threshold, determining that the color difference change corresponding to the processed color difference value is an increase; When the processed color difference value is less than or equal to the negative color difference threshold, determining that the color difference change corresponding to the processed color difference value is a decrease; When the processed color difference value is smaller than the color difference threshold and larger than the negative color difference threshold, it is determined that the color difference change corresponding to the processed color difference value is unchanged.

14. The device according to claim 8, wherein The third determining module is specifically configured to: When the color difference change prediction code is inconsistent with the color difference change random code, determining the value of the liveness score to be zero; In a case where the color difference change prediction code is consistent with the color difference change random code, determining a value of a liveness score by combining multiple face images in the face image sequence and a liveness detection model; The liveness detection result is determined according to the determined value of the liveness score.

15. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.

17. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Living body detection method based on color change

    CN110969077A

  • Human face living body detection method and device, electronic equipment and storage medium

    CN112507922A