Living body detection method, electronic device, storage medium and computer program product
By aligning the image parameter sequence with the lighting parameter sequence in liveness detection, the problem of detection accuracy caused by frame drops is solved, and the pass rate of liveness detection for videos with dropped frames is improved.
Patent Information
- Application Number
- CN202210261414.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-16
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-03-16
AI Technical Summary
Due to limitations in the computing power of client devices, frame dropping causes misalignment between the image parameter sequence and the lighting parameter sequence in liveness detection, reducing the accuracy and pass rate of liveness detection.
By selecting n sets of image parameters to be aligned from the image parameter sequence and selecting m sets of lighting parameters with the highest correlation from the lighting parameter sequence, a second lighting parameter sequence is formed to maximize the correlation between the image parameter sequence and the lighting parameter sequence for liveness detection.
It effectively improves the liveness detection pass rate of video with dropped frames, bringing it close to the level of video without dropped frames, thus improving the accuracy of detection.
Smart Images

Figure CN114882544B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of biometric identification, and more particularly to a live body detection method, an electronic device, a storage medium and a computer program product. BACKGROUND
[0002] Live body detection is a method of determining the real physiological characteristics of an object in some identity verification scenarios. In face recognition applications, live body detection can verify whether a user is a real live body person by operating a combination of actions such as blinking, opening the mouth, shaking the head, nodding, and the like, using face key point positioning and face tracking technologies. Through live body detection technology, common live body attack means such as photos, face replacement, masks, occlusion, and screen flipping can be effectively resisted, thereby helping users to identify fraudulent behavior and protecting the interests of users.
[0003] Currently, there is a kind of iridescence live body detection technology. Iridescence live body detection can detect whether the light changes on a face in a series of face images (which can form a video) collected conform to requirements by taking a series of lighting parameters for indicating that a display screen displays a color image as a reference. For example, whether the video is an attack video can be judged based on the correlation between the series of lighting parameters and the image parameters of each image collected. Through this technology, camera hijacking attacks can be effectively eliminated. In order to accurately make the correlation judgment, when collecting face images, the technology needs to strictly align the images collected in a moment or period with the lighting parameters used for lighting in the moment or period. However, due to the computing power of the client device, the state (CPU load, memory occupation, etc.) when collecting images, frame loss phenomenon inevitably occurs. The live body detection pass rate of the frame loss video is significantly lower than that of the non-frame loss video.
[0004] Therefore, it is necessary to provide a technology of aligning the images collected in the same moment or period with the lighting parameters used. SUMMARY
[0005] The present application is proposed in consideration of the above problems. The present application provides a live body detection method, an electronic device, a storage medium and a computer program product.
[0006] According to an aspect of the present application, a living body detection method is provided, comprising: acquiring a first light parameter sequence and an image parameter sequence for living body detection; selecting n groups of image parameters to be aligned from the image parameter sequence, wherein the n groups of image parameters correspond to n acquisition time points one by one, and n is a positive integer greater than or equal to 1; selecting m groups of light parameters matched with the n groups of image parameters from the first light parameter sequence, wherein an acquisition time period spanned by the n groups of image parameters is consistent with a light time period spanned by the m groups of light parameters, the m groups of light parameters correspond to m light time points one by one, m is a positive integer greater than 1, and m > n; finding n groups of light parameters with the greatest correlation with the n groups of image parameters from the m groups of light parameters to obtain a second light parameter sequence; and determining whether a video to which the image parameter sequence belongs is an attack video according to the correlation between the image parameter sequence and a third light parameter sequence, wherein the third light parameter sequence comprises light parameters other than the m groups of light parameters in the first light parameter sequence and the second light parameter sequence.
[0007] Exemplarily, the maximum light parameter sequence S (i)(j) is found from the first j groups of light parameters in the m groups of light parameters, and the first i groups of image parameters in the n groups of image parameters, i = 1, 2, 3, … n, j = i, i + 1, i + 2, … m, wherein,
[0008] The n groups of light parameters with the greatest correlation with the n groups of image parameters are found from the m groups of light parameters to obtain the second light parameter sequence, comprising:
[0009] The maximum light parameter sequence S (i)(j) is determined by the following method:
[0010] In the case of j = i, the first j groups of light parameters in the m groups of light parameters are determined as the maximum light parameter sequence S (i)(j) .
[0011] In the case of j ≠ i,
[0012] The maximum light parameter sequence S (i-1)(j-1) is acquired.
[0013] The first correlation between the first i groups of image parameters in the n groups of image parameters and a temporary light parameter sequence is calculated, wherein the temporary light parameter sequence comprises the maximum light parameter sequence S (i-1)(j-1) and the jth group of light parameters in the m groups of light parameters.
[0014] The maximum light parameter sequence S (i)(j-1) is acquired.
[0015] The second correlation between the first i groups of image parameters in the n groups of image parameters and the maximum light parameter sequence S (i)(j-1) is calculated.
[0016] comparing the first correlation with the second correlation, if the first correlation is greater than or equal to the second correlation, determining the temporary lighting parameter sequence as the maximum lighting parameter sequence S (i)(j) , otherwise determining the maximum lighting parameter sequence S (i)(j-1) as the maximum lighting parameter sequence S (i)(j) ;
[0017] wherein, when i = n, j = m, the corresponding maximum lighting parameter sequence S (i)(j) is the second lighting parameter sequence.
[0018] Exemplarily, x[i] represents the i-th group of image parameters in the n groups of image parameters, and y[j] represents the j-th group of lighting parameters in the m groups of lighting parameters, wherein,
[0019] finding n groups of lighting parameters with the greatest correlation with the n groups of image parameters from the m groups of lighting parameters to obtain the second lighting parameter sequence comprises:
[0020] creating a first vector H[i][j][0] and a second vector H[i][j][1], H[i][j][0] is used to record the first i groups of image parameters in the n groups of image parameters, and H[i][j][1] is used to record the lighting parameters in the maximum lighting parameter sequence S (i)(j) , wherein H[i][j][0] and H[i][j][1] are initially empty vectors;
[0021] performing a first operation starting from i = 1 to i = n, the first operation comprising:
[0022] performing a second operation starting from j = i to j = m, the second operation comprising:
[0023] if j = i, then H[i][j][0] = H[i-1][j-1][0] + x[i], and H[i][j][1] = H[i-1][j-1][1] + y[j];
[0024] if j ≠ i, then:
[0025] H[i][j][0]' = H[i-1][j-1][0] + x[i], and H[i][j][1]' = H[i-1][j-1][1] + y[j], calculating the correlation between H[i][j][0]' and H[i][j][1]' to obtain the first correlation;
[0026] H[i][j][0]=H[i][j-1][0]+[null], H[i][j][1]=H[i][j-1][1]+y[j-1], calculate the correlation between H[i][j][0] and H[i][j][1] to obtain a second correlation, wherein the null is a skip symbol, and the skip symbol indicates skipping the y element in H[i][j][1] corresponding to the skip symbol;
[0027] compare the first correlation with the second correlation, if the first correlation is greater than or equal to the second correlation, H[i][j][0]=H[i][j][0]', otherwise H[i][j][0]=H[i][j][0]''.
[0028] wherein adding H[i][j][0] to any set of image parameters or skip symbol means adding the set of image parameters or skip symbol as a new element of H[i][j][0] to H[i][j][0], and adding H[i][j][1] to any set of lighting parameters means adding the set of lighting parameters as a new element of H[i][j][1] to H[i][j][1].
[0029] Exemplarily, the correlation is represented by a Pearson correlation coefficient, and when calculating the correlation between a specific number of sets of image parameters and a specific number of sets of lighting parameters, the Pearson correlation coefficient between the specific number of sets of image parameters and the specific number of sets of lighting parameters is calculated based on the following manner: when the specific number is 0, a target value is determined as the Pearson correlation coefficient; when the specific number is 1, the Pearson correlation coefficient is calculated based on the difference between the set of image parameters and the set of lighting parameters; when the specific number is 2, the Pearson correlation coefficient is calculated based on the difference between the two sets of image parameters and the difference between the two sets of lighting parameters; when the specific number is greater than 2, the Pearson correlation coefficient is calculated based on the covariance between the specific number of sets of image parameters and the specific number of sets of lighting parameters, the standard deviation of the specific number of sets of image parameters, and the standard deviation of the specific number of sets of lighting parameters.
[0030] Exemplarily, finding n sets of lighting parameters with the largest correlation with n sets of image parameters from m sets of lighting parameters to obtain a second lighting parameter sequence comprises: combining by extracting n sets of lighting parameters from m sets of lighting parameters to obtain at least one combination result; for each of the at least one combination result, calculating the correlation between the n sets of lighting parameters corresponding to the combination result and the n sets of image parameters; selecting the combination result with the largest corresponding correlation from the at least one combination result, and determining the n sets of lighting parameters corresponding to the selected combination result as the second lighting parameter sequence.
[0031] Exemplarily, the image parameter sequence includes at least one set of image parameters corresponding to at least one acquisition time, the first lighting parameter sequence includes at least one set of lighting parameters corresponding to at least one lighting time, and the obtaining of the first lighting parameter sequence and the image parameter sequence for the living body detection includes: obtaining a lighting parameter set and an image parameter set for living body detection, wherein the image parameter set includes at least one image parameter sub-set corresponding to at least one acquisition time in the video to be detected, and the lighting parameter set includes at least one lighting parameter sub-set corresponding to at least one lighting time; for each acquisition time in the at least one acquisition time, image parameters of p channels are obtained based on the image parameter sub-set corresponding to the acquisition time, wherein the p channels are divided into C channel sets, p is a positive integer greater than 1, and C is a positive integer greater than or equal to 1; for each lighting time in the at least one lighting time, lighting parameters of p channels are obtained based on the lighting parameter sub-set corresponding to the lighting time; for the kth channel set in the C channel sets, at least one set of image parameters corresponding to the at least one acquisition time and located in the channel set is determined as the image parameter sequence, and at least one set of lighting parameters corresponding to the at least one lighting time and located in the channel set is determined as the first lighting parameter sequence, wherein k = 1, 2, 3, …, C.
[0032] Exemplarily, C > 1, and the determining whether the video to which the image parameter sequence belongs is an attack video according to the correlation between the image parameter sequence and the third lighting parameter sequence includes: for each channel set in the C channel sets, a correlation parameter between the image parameter sequence corresponding to the channel set and the third lighting parameter sequence is calculated; a total correlation parameter is determined based on the correlation parameters corresponding to the C channel sets; and the total correlation parameter is compared with a target threshold value, and if the total correlation parameter is less than the target threshold value, it is determined that the video to be detected is an attack video.
[0033] Exemplarily, the determination of the total correlation parameter based on the correlation parameters corresponding to the C channel sets includes: selecting the maximum correlation parameter from the correlation parameters corresponding to the C channel sets as the total correlation parameter.
[0034] Exemplarily, each of the at least one parameter subset and each of the at least one lighting parameter subset is represented by color values in an initial color space, and obtaining, for each of the at least one capturing time, the p-channel image parameters based on the image parameter subset corresponding to the capturing time comprises: for each of the at least one capturing time, converting the image parameter subset corresponding to the capturing time into color values of a new color space to obtain the p-channel image parameters, the new color space containing p-channel color values; and obtaining, for each of the at least one lighting time, the p-channel lighting parameters based on the lighting parameter subset corresponding to the lighting time comprises: for each of the at least one lighting time, converting the lighting parameter subset corresponding to the lighting time into color values of the new color space to obtain the p-channel lighting parameters.
[0035] Exemplarily, the image parameter set is obtained by: obtaining a to-be-detected video, the to-be-detected video including at least one image corresponding to at least one capturing time; for each of the at least one image, determining a face region containing a face in the image; and averaging color values of pixels contained in the face region in the image to obtain an image parameter subset corresponding to the image, wherein the image parameter set includes at least one image parameter subset corresponding to at least one image.
[0036] According to another aspect of the present application, an electronic device is provided, including a processor and a memory, wherein the memory stores computer program instructions, and the computer program instructions are used to execute the above-mentioned living body detection method when executed by the processor.
[0037] According to another aspect of the present application, a storage medium is provided, and program instructions are stored on the storage medium, and the program instructions are used to execute the above-mentioned living body detection method when executed.
[0038] According to another aspect of the present application, a computer program product is provided, and the computer program product includes a computer program, and the computer program is used to execute the above-mentioned living body detection method when executed.
[0039] The living body detection method, the electronic device, the storage medium and the computer program product according to the embodiments of the present application can align the image parameter sequence and the lighting parameter sequence in the frame loss video, maximize the correlation between the two, and effectively solve the problem that the frame loss video is prone to false detection due to the inequality between the image parameter sequence length and the lighting parameter sequence. The living body detection method can effectively improve the living body detection pass rate of the frame loss real person video, and make the pass rate close to or even reach the level of the non-frame loss real person video. BRIEF DESCRIPTION OF DRAWINGS
[0040] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description thereof taken in conjunction with the accompanying drawings, in which like reference characters designate like elements in the figures. The accompanying drawings are intended to provide a further understanding of the present application, and are incorporated and constitute a part of this specification, illustrate embodiments of the present application and explain their principles. The figures provided are intended to explain the present application and do not limit the present application. In the drawings, like reference numerals refer to like elements or steps throughout.
[0041] Figure 1 A schematic block diagram of an example electronic device for implementing a method and apparatus for living body detection according to an embodiment of the present application is shown;
[0042] Figure 2 A schematic flowchart of a method for living body detection according to an embodiment of the present application is shown;
[0043] Figure 3 A schematic block diagram of an apparatus for living body detection according to an embodiment of the present application is shown;
[0044] Figure 4 A schematic block diagram of a system for living body detection according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0045] In recent years, important progress has been made in the research of computer vision, deep learning, machine learning, image processing, image recognition and other technologies based on artificial intelligence. Artificial intelligence (AI) is a new science and technology that studies and develops theories, methods, technologies and application systems for simulating and extending human intelligence. Artificial intelligence is a comprehensive discipline involving chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, neural networks and many other technology categories. Computer vision, as an important branch of artificial intelligence, is specifically to let machines recognize the world. Computer vision technology usually includes face recognition, live detection, fingerprint recognition and anti-forgery verification, biometric recognition, face detection, pedestrian detection, target detection, pedestrian recognition, image processing, image recognition, image semantic understanding, image retrieval, character recognition, video processing, video content recognition, three-dimensional reconstruction, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), computational photography, robot navigation and positioning and other technologies. With the research and progress of artificial intelligence technology, this technology has been applied in many fields, such as security prevention and control, city management, traffic management, building management, park management, face passage, face attendance, logistics management, warehouse management, robots, intelligent marketing, computational photography, mobile phone images, cloud services, smart home, wearable devices, unmanned vehicles, autonomous driving, intelligent medical care, face payment, face unlocking, fingerprint unlocking, face and certificate verification, smart screens, smart televisions, cameras, mobile Internet, network live broadcast, beauty, makeup, medical cosmetology, intelligent temperature measurement and other fields.
[0046] In order to make the purpose, technical solutions and advantages of the present application more obvious, the example embodiments according to the present application will be described in detail below with reference to the drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all embodiments of the present application, and it should be understood that the present application is not limited to the example embodiments described herein. Based on the embodiments of the present application described in the present application, all other embodiments obtained by those skilled in the art without creative labor shall fall within the scope of protection of the present application.
[0047] Embodiments of the present application provide a living body detection method, apparatus and system, and a storage medium. According to the living body detection method, the image parameter sequence and the lighting parameter sequence in the frame loss video can be aligned, and the correlation between the two can be maximized, which can effectively solve the problem that the frame loss video is prone to false detection due to the difference in length between the image parameter sequence and the lighting parameter sequence. The living body detection method can effectively improve the pass rate of the frame loss real video, and make the pass rate close to or even reach the level of the non-frame loss real video. The living body detection technology according to the embodiments of the present application can be applied to any field that needs to perform living body detection, including but not limited to various identity authentication, face recognition, face unlocking and the like.
[0048] First, referring to Figure 1 An example electronic device 100 for implementing the living body detection method and apparatus according to the embodiments of the present application is described.
[0049] As shown in Figure 1 The electronic device 100 includes one or more processors 102, one or more storage devices 104. Optionally, the electronic device 100 can also include an input device 106, an output device 108, and an image acquisition device 110, which are interconnected through a bus system 112 and / or other forms of connection mechanism (not shown). It should be noted that Figure 1 The components and structure of the electronic device 100 shown are only exemplary and are not limiting, and the electronic device can also have other components and structures as needed.
[0050] The processor 102 can be implemented in at least one of a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic array (PLA), a microprocessor, and can be a combination of one or more of a central processing unit (CPU), a graphics processor (GPU), an application-specific integrated circuit (ASIC) or other forms of processing units with data processing and / or instruction execution capabilities, and can control other components in the electronic device 100 to perform desired functions.
[0051] The storage 104 can include one or more computer program products that can include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory, for example, can include random access memory (RAM), cache memory, and / or the like. The non-volatile memory, for example, can include read-only memory (ROM), hard disk, flash memory, and / or the like. One or more computer program instructions can be stored on the computer-readable storage media, and the processor 102 can execute the program instructions to implement the client functions (implemented by the processor) in the embodiments described below and / or other desired functions. Various application programs and various data, such as various data used and / or generated by the application programs, and the like, can also be stored in the computer-readable storage media.
[0052] The input device 106 can be a device used by a user to input instructions, and can include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like.
[0053] The output device 108 can output various information (such as images and / or sounds) to the outside (such as a user), and can include one or more of a display, a speaker, and the like. Alternatively, the input device 106 and the output device 108 can be integrated together, implemented with the same interactive device (such as a touch screen).
[0054] The image acquisition device 110 can acquire images, and store the acquired images in the storage 104 for use by other components. The image acquisition device 110 can be a separate camera or a camera in a mobile terminal, and the like. It should be understood that the image acquisition device 110 is merely an example, and the electronic device 100 can not include the image acquisition device 110. In this case, images can be acquired using other devices with image acquisition capabilities, and the acquired images can be transmitted to the electronic device 100.
[0055] Exemplarily, an example electronic device for implementing the living body detection method and apparatus according to the embodiments of the present application can be implemented on a device such as a personal computer or a remote server.
[0056] In the following, the living body detection method according to the embodiments of the present application will be described with reference to the accompanying drawings. Figure 2 The living body detection method according to the embodiments of the present application will be described. Figure 2 A schematic flowchart of a living body detection method 200 according to one embodiment of the present application is shown. As shown in the figure, Figure 2 The living body detection method 200 includes steps S210, S220, S230, S240, and S250.
[0057] In step S210, a first sequence of lighting parameters and a sequence of image parameters for living body detection are acquired.
[0058] Exemplarily, the general flow of the live detection described herein is as follows.
[0059] The lighting and image capturing device (e.g., a client) can receive a series of lighting parameters (may be referred to herein as a lighting parameter set) from an external device (e.g., a server) or the lighting and image capturing device itself can store the lighting parameter set. The lighting and image capturing device can be used to emit corresponding light (i.e., lighting) based on the lighting parameters and capture the video to be detected. The lighting and image capturing device can be the same device. Alternatively, the lighting and image capturing device can also be two separate devices, for example, one for lighting and one for capturing the video to be detected.
[0060] The lighting parameter can be a color value such as a BGR value. For example, a BGR value of (0, 0, 255) represents red. When the lighting parameter is (0, 0, 255), the lighting can be performed by displaying a red image on a display screen. For another example, a BGR value of (0, 255, 0) represents green. When the lighting parameter is (0, 255, 0), the lighting can be performed by displaying a green image on a display screen. For yet another example, a BGR value of (255, 0, 0) represents blue. When the lighting parameter is (255, 0, 0), the lighting can be performed by displaying a blue image on a display screen. It should be noted that the scheme of performing lighting by displaying a color image on a display screen is only an example and not a limitation of the present application, for example, a scheme of performing lighting by directly emitting light of a corresponding color (red light, green light, blue light, etc.) according to the lighting parameter by using a light emitting device other than a display screen can also be applied to live detection and should also fall within the protection scope of the present application. The scheme of performing lighting by displaying a color image on a display screen is preferable, and the present application will be mainly described below in combination with this scheme.
[0061] The lighting and image capturing device can display a plurality of color images in sequence on its display screen according to the color specified in the set of lighting parameters, such as blue, red, green, yellow, etc. The light emitted by the display screen when displaying the color images can irradiate the image capturing area, and meanwhile the lighting and image capturing device can capture images of the image capturing area through the image capturing device to obtain a plurality of images. These captured images can form a video, which is referred to as a to-be-detected video in this document. If there is a face in the image capturing area, the to-be-detected video can contain a normal face, and in this case, theoretically, the set of lighting parameters and the image parameters of each image in the to-be-detected video should have a large correlation. Therefore, the set of lighting parameters and the image parameters of each image in the to-be-detected video can be correlated. Alternatively, the lighting and image capturing device can perform the above correlation calculation locally, or the lighting and image capturing device can send the to-be-detected video to another device (such as a server) to perform the above correlation calculation. The device used to perform the correlation calculation can be referred to as a live body detection device (such as the electronic device 100 described above). The live body detection device can include one of the lighting and image capturing device and the server, or both.
[0062] When calculating the correlation between the set of lighting parameters and the image parameters of each image in the to-be-detected video, if the correlation is lower than a target threshold, it can be considered that the to-be-detected video is not a video captured for the currently existing face, i.e., it can be an attack video, such as an attack video sent directly to the server by camera hijacking technology. If the correlation is not lower than the target threshold, it can be considered that the to-be-detected video is a video captured for the currently existing face. Alternatively, at this time, it can be determined that the live body detection passes, or it can continue to be combined with other live body detection methods for further verification.
[0063] Step S210 involves a sequence of image parameters derived from the to-be-detected video described above. The sequence of image parameters can include a plurality of groups of image parameters. Each group of image parameters corresponds to a capturing time, which can be any time point on the time axis. Alternatively, the time point can be an absolute time, which can be expressed as, for example, year-month-day-hour-minute-second. Alternatively, the time point can also be a relative time, which can be expressed as, for example, the frame number in the to-be-detected video.
[0064] In addition, each group of image parameters can be color values of a predetermined color space. For example, each group of image parameters can be color values of a BGR color space, or color values of a YUV color space, etc. Each group of image parameters can include color values of one channel, or color values of multiple channels. For example, each group of image parameters can include color values of three channels of blue (B), green (G), and red (R). For another example, each group of image parameters can include color values of only one of the three channels of blue, green, and red, such as color values of only red.
[0065] The above sequence of image parameters can be obtained by extracting image parameters from each image in the video to be detected. For example, the video to be detected can include N images, each of which corresponds to a capture time.
[0066] Those skilled in the art can understand that the images captured by the image capturing device are captured in sequence according to a certain frame rate. Each image has its own capture time. Therefore, the image parameters obtained based on the image also have a corresponding capture time.
[0067] For each image in the video to be detected, the image parameters of the image can be calculated. Through the calculation of the image parameters, a sub-set of image parameters corresponding to each image can be obtained, and N sub-sets of image parameters corresponding to N images can form a set of image parameters. Each sub-set of image parameters corresponding to an image can include image parameters of multiple channels, wherein at least part of the image parameters of the channels can form a group of image parameters corresponding to the image, and N groups of image parameters corresponding to N images can form the above sequence of image parameters.
[0068] For example, for any image, the color values of all pixels in the entire image can be averaged to obtain the color values of the image, or the color values of all pixels in the face frame containing only the face in the image can be averaged to obtain the color values of the image. The color values of the image obtained by averaging (first original color values) can include color values of multiple channels. Alternatively, the above first original color values can be further converted into color values (first converted color values) of other color spaces through color space conversion. The first converted color values can also include color values of multiple channels.
[0069] In the first original color value or the first converted color value, color values of multiple channels can be included. For any image (or any acquisition moment), color values of all channels corresponding to the image (or the acquisition moment) can be taken as a set of image parameters corresponding to the image (or the acquisition moment), or color values of any one or more channels corresponding to the image (or the acquisition moment) can be taken as a set of image parameters corresponding to the image (or the acquisition moment). N sets of image parameters corresponding to N images (or N acquisition moments) of the to-be-detected video are combined together, and thus a sequence of image parameters involved in step S210 can be obtained.
[0070] The set of lighting parameters can include M sub-sets of lighting parameters corresponding to M lighting moments. Similar to the acquisition moment corresponding to the image, the lighting moment corresponding to the sub-set of lighting parameters can also be understood as a time point on a time axis. Optionally, the time point can be an absolute time or a relative time. The lighting moment corresponding to any set of lighting parameters or any sub-set of lighting parameters can be understood as a moment of lighting based on the set of lighting parameters or the sub-set of lighting parameters.
[0071] The display screen can display color images of different colors in a preset time sequence. Each color image can last for a period of time. For example, images of three colors of blue, red, and green can be displayed in sequence, and each image lasts for 5 seconds. The image acquisition device acquires images at a speed of, for example, 1 frame per 1 second. Then, the appearance time of the lighting parameters corresponding to the blue image can be set to 5 lighting moments corresponding to the acquisition moments of the 1st to 5th frames of images, the appearance time of the lighting parameters corresponding to the red image can be set to 5 lighting moments corresponding to the acquisition moments of the 6th to 10th frames of images, and the appearance time of the lighting parameters corresponding to the green image can be set to 5 lighting moments corresponding to the acquisition moments of the 11th to 15th frames of images.
[0072] In this way, during the display of the above-mentioned three images of blue, red, and green, the acquired images are theoretically 15 frames corresponding to 15 acquisition moments, and the lighting parameters also correspond to 15 lighting moments. The acquisition moment of the image parameter of the acquired image and the lighting moment of the lighting parameter can theoretically correspond. If frame loss occurs, the acquired images will be less than 15 frames, but the lighting parameters still correspond to 15 lighting moments. At this time, the alignment between the image parameters and the lighting parameters can be performed by using the living body detection method proposed in the present application.
[0073] Each of the M sub-sets of lighting parameters can include color values (second original color values) of multiple channels. In the case of color space conversion for the color values corresponding to the captured images, the color space conversion can also be performed for the color values in the sub-sets of lighting parameters. The converted color values (second converted color values) can also include color values of multiple channels.
[0074] In the above-mentioned second original color values or second converted color values, color values of multiple channels can be included. For any lighting moment, color values of all channels corresponding to the lighting moment can be taken as a group of lighting parameters corresponding to the lighting moment, or color values of any one or more channels corresponding to the lighting moment can also be taken as a group of lighting parameters corresponding to the lighting moment. M groups of lighting parameters corresponding to M lighting moments are combined together, and thus the first lighting parameter sequence involved in step S210 can be obtained.
[0075] The following illustrates an exemplary acquisition manner of the image parameter sequence and the first lighting parameter sequence.
[0076] In the living body detection process, the color values of the entire image or only the pixels at the position of the human face in each frame of the video can be extracted. Assuming that the video has N frames, the average values of BGR channels extracted on the i-th frame are (b i ,g i ,r i ), and thus the pixel average value sequence V of the video is obtained as follows:
[0077]
[0078] Subsequently, the above-mentioned BGR color space is converted to other color spaces (such as YUV color space, etc.), and thus the video color matrix X can be obtained as follows:
[0079]
[0080] wherein W∈R p×3 represents a color space conversion matrix, and p represents the number of channels of the new color space. By the same method, the lighting parameter set is converted to the same color space, and thus the lighting parameter color matrix Y is obtained,
[0081]
[0082] wherein L∈R p×3 represents a reference color sequence parsed by the lighting parameter set, and M represents the number of frames of the lighting parameter set. Since the captured video can have frame loss due to the computing capability, state, etc. of the client device, theoretically N≤M.
[0083] The X and Y matrices each contain color values of p channels. In one example, the color values of each channel of X can be regarded as an image parameter sequence, and the color values of each corresponding channel of Y can be regarded as a first lighting parameter sequence. The alignment of the parameters can be performed for each channel. Subsequently, the total correlation can be determined based on the correlation calculation results of the p channels after alignment, and the total correlation can be used to determine whether the video to be detected is an attack video. For example, the correlation can be represented by a Pearson correlation coefficient, and the correlation between the image parameter sequence and the first lighting parameter sequence of each channel can be calculated by the following formula: Pearson (X i , Y i ), i = 1, 2,..., p, where X i = (x i1 , x i2 ,..., x iN ), Y i = (y i1 , y i2 ,..., y iM ). Of course, since the lengths of X i and Y i are not equal, the Pearson correlation coefficient cannot be directly calculated. Therefore, the alignment operation described herein can be performed first.
[0084] In the above-described embodiment of calculating the Pearson correlation coefficient, each element in X i can be regarded as a set of image parameters, and each element in Y i can be regarded as a set of lighting parameters.
[0085] The above-described selection embodiments of the image parameter sequence and the first lighting parameter sequence are only examples and not limitations of the present application. For example, each column vector in X can be regarded as a set of image parameters together, and the corresponding column vector in Y can be regarded as a set of lighting parameters.
[0086] In step S220, n sets of image parameters to be aligned are selected from the image parameter sequence, where the n sets of image parameters correspond to n acquisition times one by one, and n is a positive integer greater than or equal to 1.
[0087] Frame loss usually occurs in a certain period of time. Therefore, optionally, the period of time in which frame loss occurs can be found from the entire video to be detected, and the image parameters in the found period of time can be determined as the n sets of image parameters to be aligned.
[0088] The period of time in which frame loss occurs can be determined according to the acquisition times of each image in the video to be detected. For example, the acquisition times of each image can be recorded, and the period of time in which the acquisition times are sparse can be analyzed. The period of time in which the acquisition times are sparse can be regarded as the period of time in which frame loss occurs.
[0089] Of course, the segmented acquisition can also be performed when the video to be detected is acquired. For example, the entire video to be detected can be divided into three segments for acquisition, and there is a preset time interval between adjacent two segments, which is longer than the acquisition interval of two adjacent images in the same segment of video. If the number of images contained in any one of the three segments of video is less than the expected number of frames, the acquisition time corresponding to the images contained in the segment of video can be taken as the n acquisition times, that is, the image parameters (such as color values of all channels or part of channels) of the n images contained therein are taken as the n groups of image parameters.
[0090] It can be understood that the n groups of image parameters are adjacent to each other in the image parameter sequence, but at least part of the image parameters in the n groups of image parameters are adjacent to each other in the time axis with a time interval greater than the image acquisition interval.
[0091] Selecting part of the image parameters in the image parameter sequence as the n groups of image parameters to be aligned is only an example and not a limitation of the present application. For example, alternatively, all the image parameters in the image parameter sequence can be directly taken as the n groups of image parameters to be aligned, that is, alignment is performed for all the image parameters in the image parameter sequence. The scheme of performing alignment for all the image parameters in the image parameter sequence is relatively simple to implement. Many times, the acquisition time of the image is difficult to determine, at which time it is also difficult to determine the time period of frame loss, so all the image parameters of the entire video to be detected can be directly selected to participate in alignment, which facilitates efficient implementation of the living body detection, and helps to reduce the risk of detection error due to inaccurate determination of the frame loss time.
[0092] In step S230, m groups of lighting parameters matching the n groups of image parameters are selected from the first lighting parameter sequence, where the acquisition time period spanned by the n groups of image parameters is consistent with the lighting time period spanned by the m groups of lighting parameters, the m groups of lighting parameters correspond to the m time frames one by one, m is a positive integer greater than 1, and m>n.
[0093] For example, if it is known that the n groups of image parameters are from the 20th acquisition time to the 50th acquisition time on the time axis, then the lighting parameters corresponding to the 20th lighting time to the 50th lighting time can also be found from the first lighting parameter sequence. It should be noted that the acquisition times on the time axis are continuous, but when frame loss occurs, there is no image acquisition at some acquisition times on the time axis. The time axes adopted by the lighting parameter sequence and the image parameter sequence are consistent or correspondingly consistent, that is, there can be a misalignment at the starting point and the ending point of the time axis, but the two can be aligned through the time axis alignment operation.
[0094] In addition, the time interval between adjacent acquisition instants is fixed, the time interval between adjacent lighting instants is fixed, and the two time intervals are consistent.
[0095] In step S240, n sets of lighting parameters with the greatest correlation with the n sets of image parameters are searched from the m sets of lighting parameters to obtain a second lighting parameter sequence.
[0096] The number of the n sets of image parameters is consistent with the number of lighting parameters included in the second lighting parameter sequence.
[0097] Exemplarily, the correlation described herein can be expressed by any suitable parameter capable of expressing the degree of correlation between the two, including but not limited to Pearson correlation coefficient, Euclidean distance, etc. The present application is mainly described by taking the Pearson correlation coefficient as an example, but it can be understood that the embodiment in which it is replaced by other correlation parameters (such as Euclidean distance, etc.) is also feasible.
[0098] Exemplary implementation of searching n sets of lighting parameters with the greatest correlation with the n sets of image parameters from the m sets of lighting parameters will be described below.
[0099] In step S250, whether the image parameter sequence belongs to an attack video is determined according to the correlation between the image parameter sequence and a third lighting parameter sequence, the third lighting parameter sequence including lighting parameters in the first lighting parameter sequence except the m sets of lighting parameters and the second lighting parameter sequence.
[0100] Suppose that the image parameter sequence should theoretically include 20 sets of image parameters, but actually only includes 17 sets of image parameters, that is, 3 frames are lost. And suppose that the lost frames appear in the time period in which the 11th-15th sets of image parameters appear. In addition, suppose that the first lighting parameter sequence includes 20 sets of lighting parameters, and the 11th-18th sets of lighting parameters are matched with the 11th-15th sets of image parameters in the time axis, then 5 sets of lighting parameters with the greatest correlation with the 11th-15th sets of image parameters can be found from the 11th-18th sets of lighting parameters, and the remaining 1st-10th and 19th-20th sets of lighting parameters are recombined to form a third lighting parameter sequence. It can be seen that the third lighting parameter sequence also includes 17 sets of lighting parameters, at this time, the correlation calculation between the image parameter sequence and the third lighting parameter sequence can be performed.
[0101] If each set of image parameters in the image parameter sequence and each set of lighting parameters in the first lighting parameter sequence comprises color values of all channels, the image parameter sequence and the third lighting parameter sequence can reflect the correlation between the whole to-be-detected video and the set of lighting parameters, and whether the to-be-detected video belongs to an attack video can be directly determined based on the correlation between the image parameter sequence and the third lighting parameter sequence. If each set of image parameters in the image parameter sequence and each set of lighting parameters in the first lighting parameter sequence comprises color values of part (which can be one or more) channels, whether the to-be-detected video belongs to an attack video can be further comprehensively determined in combination with the correlation between the image parameter sequence and the third lighting parameter sequence corresponding to other channels.
[0102] According to the living body detection method, the image parameter sequence and the lighting parameter sequence in the frame-loss video can be aligned, and the correlation between the two is maximized, which can effectively solve the problem that the frame-loss video is prone to false detection due to the difference in length between the image parameter sequence and the lighting parameter sequence. The living body detection method can effectively improve the pass rate of the frame-loss real video, and the pass rate approaches or even reaches the level of the non-frame-loss real video.
[0103] Exemplarily, the living body detection method according to the embodiments of the present application can be implemented in a device, apparatus or system having a memory and a processor.
[0104] The living body detection method according to the embodiments of the present application can be deployed at an image acquisition end, for example, at a personal terminal or a server end.
[0105] Alternatively, the living body detection method according to the embodiments of the present application can also be distributed and deployed at a server end (or cloud end) and a personal terminal. For example, lighting can be performed and images can be collected at the client end, the collected images are transmitted to the server end (or cloud end), and the server end (or cloud end) performs living body detection.
[0106] The following describes an exemplary implementation scheme of finding n sets of lighting parameters with the greatest correlation with n sets of image parameters from m sets of lighting parameters.
[0107] According to the embodiments of the present application, finding n sets of lighting parameters with the greatest correlation with n sets of image parameters from m sets of lighting parameters to obtain the second lighting parameter sequence comprises: combining by extracting n sets of lighting parameters from m sets of lighting parameters to obtain at least one combination result; for each of the at least one combination result, calculating the correlation between the n sets of lighting parameters corresponding to the combination result and the n sets of image parameters; selecting the combination result with the greatest correlation from the at least one combination result, and determining the n sets of lighting parameters corresponding to the selected combination result as the second lighting parameter sequence.
[0108] For example, assuming that 3 groups of image parameters are to be aligned, and 5 groups of lighting parameters correspond thereto, 3 groups of lighting parameters with the greatest correlation to the 3 groups of image parameters need to be found from the 5 groups of lighting parameters. Alternatively, the 5 groups of lighting parameters can be combined in a manner of selecting 3 groups, and there are 10 combination results in total. Subsequently, the correlation between the 3 groups of lighting parameters corresponding to each of the 10 combination results and the 3 groups of image parameters can be calculated respectively, and the combination result with the greatest correlation can be found, and thus the 3 groups of lighting parameters can be obtained.
[0109] In this article, when finding n groups of lighting parameters with the greatest correlation to n groups of image parameters, the n groups of lighting parameters found maintain the original time sequence relationship therebetween. Therefore, the combination manner can ensure that the selected lighting parameters do not change in sequence in different combination results.
[0110] In the case where the number of lighting parameters and image parameters is small, this scheme of finding n groups of lighting parameters by combination is a relatively simple and convenient scheme.
[0111] According to an embodiment of the present application, the maximum lighting parameter sequence S (i)(j) represents i groups of lighting parameters with the greatest correlation to the first i groups of image parameters in the n groups of image parameters, i = 1, 2, 3,..., n, j = i, i+1, i+2,..., m, wherein,
[0112] Finding n groups of lighting parameters with the greatest correlation to n groups of image parameters from m groups of lighting parameters to obtain a second lighting parameter sequence comprises:
[0113] The maximum lighting parameter sequence S (i)(j) is determined in the following manner:
[0114] In the case where j = i, the first j groups of lighting parameters in the m groups of lighting parameters are determined as the maximum lighting parameter sequence S (i)(j) .
[0115] In the case where j ≠ i,
[0116] The maximum lighting parameter sequence S (i-1)(j-1) is obtained.
[0117] The first correlation between the first i groups of image parameters in the n groups of image parameters and a temporary lighting parameter sequence is calculated, and the temporary lighting parameter sequence comprises the maximum lighting parameter sequence S (i-1)(j-1) and the jth group of lighting parameters in the m groups of lighting parameters.
[0118] The maximum lighting parameter sequence S (i)(j-1) is obtained.
[0119] computing a second correlation between the first i groups of image parameters in the n groups of image parameters and the maximum lighting parameter sequence S (i)(j-1) ;
[0120] comparing the first correlation with the second correlation, and if the first correlation is greater than or equal to the second correlation, determining the temporary lighting parameter sequence as the maximum lighting parameter sequence S (i)(j) , otherwise determining the maximum lighting parameter sequence S (i)(j-1) as the maximum lighting parameter sequence S (i)(j) ;
[0121] wherein when i = n, j = m, the corresponding maximum lighting parameter sequence S (i)(j) is the second lighting parameter sequence.
[0122] The above examples of X and Y matrices are followed. Assume x = X i ∈ R N , y = Y i ∈ R M , where N ≤ M. Due to the occurrence of frame loss, for each element x i in x, there is a unique y z(i) corresponding to it, and vice versa. z(i) is a sequence mapping function, satisfying uniqueness and order, that is, if i > j, then z(i) > z(j). A dynamic programming method can be used to select an element from y for each element in x, that is, to find a subsequence of y that best matches x, so that the final Pearson correlation coefficient is maximum, and thus the real person video passes as much as possible.
[0123] The dynamic programming method can be as follows: take i = 1, 2, 3,... n in turn, and in each case where i is fixed, take j = i, i + 1, i + 2,... m in turn. Under any group of i and j, the current maximum lighting parameter sequence S (i)(j) can be obtained. If j = i, then the number of elements in the subsequence of x containing the first i elements is the same as the number of elements in the subsequence of y containing the first j elements, and the maximum lighting parameter sequence S (i)(j) can be directly set to include the first j groups of lighting parameters in the m groups of lighting parameters, that is, the first i elements of x and the first j elements of y are matched and maximally correlated. In the case of j ≠ i, the maximum lighting parameter sequence S (i-1)(j-1) and the maximum lighting parameter sequence S (i)(j-1) have been determined. At this time, it can be considered comprehensively which subsequence of y has the maximum correlation with the first i groups of image parameters based on these two sequences and the current jth group of lighting parameters. Specifically, S (i-1)(j-1)The (i-1)th group lighting parameter found from the (j-1)th group lighting parameter and the (i-1)th group image parameter, the sequence plus the jth group lighting parameter, can form a new lighting parameter sequence with i number. In addition, S (i)(j-1) The ith group lighting parameter found from the (j-1)th group lighting parameter and the ith group image parameter. The correlation between the above two lighting parameter sequences containing the ith group lighting parameter and the ith group image parameter can be calculated respectively, and the sequence with relatively larger correlation is determined as the required maximum lighting parameter sequence S (i)(j) .
[0124] The maximum lighting parameter sequence S (i)(j) under different i and j is found continuously in the above manner until i=n and j=m. That is, the maximum lighting parameter sequence S (n)(m) obtained finally by the above dynamic programming method is the required second lighting parameter sequence.
[0125] In the case of a large number of lighting parameters and image parameters, the calculation amount required for finding the second lighting parameter sequence by using the above dynamic programming method is relatively small, and the operation speed is relatively fast, which helps to improve the efficiency of the living body detection.
[0126] According to the embodiment of the application, x[i] represents the ith group image parameter in the n group image parameters, and y[j] represents the jth group lighting parameter in the m group lighting parameters, wherein,
[0127] Finding the n group lighting parameter with the maximum correlation with the n group image parameters from the m group lighting parameters to obtain the second lighting parameter sequence includes:
[0128] Creating a first vector H[i][j][0] and a second vector H[i][j][1], H[i][j][0] is used to record the first i group image parameters in the n group image parameters, and H[i][j][1] is used to record the lighting parameters in the maximum lighting parameter sequence S (i)(j) , wherein H[i][j][0] and H[i][j][1] are initially empty vectors;
[0129] The first operation is executed cyclically from i=1 to i=n, and the first operation includes:
[0130] The second operation is executed cyclically from j=i to j=m, and the second operation includes:
[0131] If j=i, then H[i][j][0]=H[i-1][j-1][0]+x[i] and H[i][j][1]=H[i-1][j-1][1]+y[j];
[0132] If j≠i, then:
[0133] Let H[i][j][0]' = H[i-1][j-1][0] + x[i], H[i][j][1]' = H[i-1][j-1][1] + y[j], calculate the correlation between H[i][j][0]' and H[i][j][1]' to obtain a first correlation;
[0134] Let H[i][j][0]'' = H[i][j-1][0] + [null], H[i][j][1]'' = H[i][j-1][1] + y[j-1], calculate the correlation between H[i][j][0]'' and H[i][j][1]'' to obtain a second correlation, wherein the null is a skip symbol, and the skip symbol indicates skipping the y element in H[i][j][1] corresponding to the skip symbol;
[0135] Compare the first correlation with the second correlation, if the first correlation is greater than or equal to the second correlation, then H[i][j][0] = H[i][j][0]', otherwise H[i][j][0] = H[i][j][0]'';
[0136] Wherein, adding H[i][j][0] to any set of image parameters or skip symbol means adding the set of image parameters or skip symbol as a new element of H[i][j][0] to H[i][j][0], and adding H[i][j][1] to any set of lighting parameters means adding the set of lighting parameters as a new element of H[i][j][1] to H[i][j][1].
[0137] The embodiment is a more specific exemplary embodiment of the dynamic programming described above. In this embodiment, the first vector H[i][j][0] and the second vector H[i][j][1] can be used to record the sub-sequence of x and the sub-sequence of y respectively used to calculate the maximum correlation corresponding to the maximum lighting parameter sequence S (i)(j) The first vector H[i][j][0] and the second vector H[i][j][1] can be understood as a list vector, and the elements in the list vector are recorded by a list, and the list can be filled continuously. The dimension of the list vector can increase by one dimension every time an element is filled. In the description herein, the operation of adding a list vector and an element means filling the element into the list vector. Exemplarily, the first vector and the second vector can be empty lists initially without elements filled. Preferably, the first vector and the second vector always maintain the same dimension at any value of i and j.
[0138] Optionally, the first vector H[i][j][0] and the second vector H[i][j][1] obtained under various combinations of i and j can be recorded in a path list matrix H. The size of the path list matrix H can be (n+1) x (m+1) x 2, which can be counted from i=0 and j=0, but the first vector H[i][j][0] and the second vector H[i][j][1] are both empty vectors when i=0 or j=0. The element H[i][j] of the path list matrix H includes two lists, which are the first vector H[i][j][0] and the second vector H[i][j][1] respectively.
[0139] Optionally, in the dynamic programming process, a Pearson correlation coefficient matrix P can also be used to record the maximum Pearson correlation coefficient obtained under various combinations of i and j. The size of P is (n+1) x (m+1), which can also be counted from i=0 and j=0. P is initially a zero matrix. P[i][j] represents the maximum Pearson correlation coefficient of x[:i] and y[:j]. P[i][j] represents the element of the i-th row and the j-th column of the P matrix, x[:i] represents the first i elements of x, and y[:j] represents the first j elements of y.
[0140] In a specific implementation: first, input the vectors x and y whose Pearson correlation coefficients are to be calculated, and the lengths of x and y are n and m respectively. If m=n, directly return the Pearson correlation coefficient of the two, and exit the algorithm. If m is not equal to n, initialize the Pearson correlation coefficient matrix P to a zero matrix of size (n+1) x (m+1), and initialize the path list matrix H to a matrix of size (n+1) x (m+1) x 2. Each element of the path list matrix H is two empty lists, corresponding to the two vectors H[i][j][0] and H[i][j][1] of equal length calculated to obtain P[i][j]. Both H[i][j][0] and H[i][j][1] can contain a null skip symbol, indicating that the corresponding element in the other vector corresponding to the skip symbol is skipped. The y elements skipped by the skip symbol do not participate in the correlation calculation, and the addition of the skip symbol is mainly used to mark which y elements are skipped, which helps to check comprehensively later.
[0141] Then the calculation of each element in P is started, the outer loop i is from 1 to n, and the inner loop j is from i to m. If j = i, then H[i][j] = H[i-1][j-1] + [x[i], y[j]]. That is, H[i][j][0] adds the element x[i] on the basis of H[i-1][j-1][0], and H[i][j][1] adds the element y[j] on the basis of H[i-1][j-1][1]. The Pearson correlation coefficient of H[i][j][0] and H[i][j][1] is calculated to obtain P[i][j], and it is noted that the null element and the element in the other list vector corresponding to the position of the null element are filtered when calculating. If j is not equal to i, there are two choices. The first is to add x[i] and y[j] on the basis of H[i-1][j-1], and the second is to skip y[j] on the basis of H[i][j-1]. The Pearson correlation coefficients in the above two cases are calculated respectively, and the highest value is taken from them. The specific calculation method is as follows: let the variable a be H[i-1][j-1] + [x[i], y[j]], and the variable b be H[i][j-1] + [null, y[j]], calculate the Pearson correlation coefficient pa of a[0] and a[1], the Pearson correlation coefficient pb of b[0] and b[1], and compare the sizes of pa and pb. If pa is greater than or equal to pb, then H[i][j] = a, P[i][j] = pa, otherwise H[i][j] = b, P[i][j] = pb. After the loop ends, P[n][m] can be obtained.
[0142] It should be noted that in the above embodiment, when the number of input parameters of Pearsonr is 1, the input matrix can be converted into two vectors of equal length to calculate the Pearson correlation coefficient. For example, in the above embodiment, H[i][j] can be converted into H[i][j][0] and H[i][j][1] first, and then the Pearson correlation coefficient between them is calculated. If the number of input parameters of Pearsonr is 2, it means that two vectors are input, and the Pearson correlation coefficient of them can be directly returned.
[0143] According to an embodiment of the present application, the correlation is represented by a Pearson correlation coefficient, and when calculating the correlation between a specific number of groups of image parameters and a specific number of groups of lighting parameters, the Pearson correlation coefficient between the specific number of groups of image parameters and the specific number of groups of lighting parameters is calculated based on the following manner: when the specific number is 0, a target value is determined as the Pearson correlation coefficient; when the specific number is 1, the Pearson correlation coefficient is calculated based on the difference between the group of image parameters and the group of lighting parameters; when the specific number is 2, the Pearson correlation coefficient is calculated based on the difference between the two groups of image parameters and the difference between the two groups of lighting parameters; and when the specific number is greater than 2, the Pearson correlation coefficient is calculated based on the covariance between the specific number of groups of image parameters and the specific number of groups of lighting parameters, the standard deviation of the specific number of groups of image parameters, and the standard deviation of the specific number of groups of lighting parameters.
[0144] The target value can be set to a suitable value as needed, such as negative infinity, etc.
[0145] Exemplarily, when calculating the correlation between a specific number of groups of image parameters and a specific number of groups of lighting parameters, the Pearson correlation coefficient between the specific number of groups of image parameters and the specific number of groups of lighting parameters can be calculated based on the following formula:
[0146]
[0147] wherein, l represents the specific number, x t represents the tthgroup of image parameters in the specific number of groups of image parameters, y t represents the tthgroup of lighting parameters in the specific number of groups of lighting parameters, represents the average of all image parameters in the specific number of groups of image parameters, represents the average of all lighting parameters in the specific number of groups of lighting parameters, and abs represents the absolute value operation. It can be understood that is the covariance between the specific number of groups of image parameters and the specific number of groups of lighting parameters. is the standard deviation of the specific number of groups of image parameters. is the standard deviation of the specific number of groups of lighting parameters.
[0148] In the algorithm flow of the video alignment described above, the Pearson r calculates the Pearson correlation coefficient of two sequences of equal length, and all nulls and the elements in y corresponding to the nulls can need to be filtered out in the calculation process. Therefore, in the process of dynamic programming, the length of the sequence can be less than or equal to 2. The application improves the calculation method of the Pearson correlation coefficient, and proposes the calculation formula of the Pearson correlation coefficient in various cases of l = 0, 1, 2 and l > 2 as described above. Through the above formula (4), the length of the sequence participating in the correlation calculation can be well handled in the case of less than or equal to 2, the probability of calculation error can be reduced, and the accuracy of the living body detection can be improved.
[0149] According to an embodiment of the present application, the image parameter sequence includes at least one set of image parameters corresponding to at least one acquisition time, and the first lighting parameter sequence includes at least one set of lighting parameters corresponding to at least one lighting time. The first lighting parameter sequence and the image parameter sequence used for living body detection are obtained by: obtaining a set of lighting parameters and a set of image parameters used for living body detection, wherein the set of image parameters includes at least one sub-set of image parameters corresponding to at least one acquisition time in the video to be detected, and the set of lighting parameters includes at least one sub-set of lighting parameters corresponding to at least one lighting time; for each acquisition time in the at least one acquisition time, obtaining image parameters of p channels based on the sub-set of image parameters corresponding to the acquisition time, wherein the p channels are divided into C channel sets, p is a positive integer greater than 1, and C is a positive integer greater than or equal to 1; for each lighting time in the at least one lighting time, obtaining lighting parameters of p channels based on the sub-set of lighting parameters corresponding to the lighting time; for the kth channel set in the C channel sets, determining at least one set of image parameters corresponding to the at least one acquisition time in the channel set as the image parameter sequence, and determining at least one set of lighting parameters corresponding to the at least one lighting time in the channel set as the first lighting parameter sequence, wherein k = 1, 2, 3, …, C.
[0150] For example, the image parameter sequence can include N sets of image parameters corresponding to N acquisition times, and the first lighting parameter sequence can include M sets of lighting parameters corresponding to M lighting times, where N and M are positive integers greater than or equal to 1.
[0151] The set of image parameters can include N sub-sets of image parameters corresponding to N acquisition times in the video to be detected, and the set of lighting parameters can include M sub-sets of lighting parameters corresponding to M lighting times.
[0152] N≥n. Illustratively, N can be equal to n, i.e., all image parameter sub-sets in the video to be detected participate in alignment. Illustratively, M can be equal to m, i.e., all lighting parameter sub-sets in the lighting parameter set can participate in alignment.
[0153] The meaning of the image parameters of the multiple channels and the lighting parameters of the multiple channels can be understood with reference to the embodiments described above in connection with equations (1)-(3), which will not be repeated here.
[0154] As described above, all image parameters of all channels at any acquisition time can be taken as a group of image parameters corresponding to the acquisition time, and all lighting parameters of all channels at any lighting time can be taken as a group of lighting parameters corresponding to the lighting time. In this case, C=1, i.e., p channels are all divided into the same channel set. In another example, for any channel, the image parameters of the channel at any acquisition time can be taken as a group of image parameters corresponding to the acquisition time, and the lighting parameters of the channel at any lighting time can be taken as a group of lighting parameters corresponding to the lighting time. In this case, C=p, i.e., p channels are each divided into a channel set. Of course, alternatively, C can also be any value between 1 and p, i.e., two or more channels but not all channels are divided into a channel set, and this channel division can be uniform division (the number of channels corresponding to all channel sets is the same) or non-uniform channel division (at least two channel sets corresponding to the number of channels are different).
[0155] According to an embodiment of the present application, C>1, and determining whether the video to which the image parameter sequence belongs is an attack video based on at least the correlation between the image parameter sequence and the third lighting parameter sequence comprises: for each channel set in the C channel sets, calculating a correlation parameter between the image parameter sequence corresponding to the channel set and the third lighting parameter sequence; determining a total correlation parameter based on the correlation parameters corresponding to the C channel sets; and comparing the total correlation parameter with a target threshold value, and if the total correlation parameter is less than the target threshold value, determining that the video to be detected is an attack video.
[0156] Any suitable algorithm can be used to synthesize the correlation parameters corresponding to the C channel sets to determine the total correlation parameter. For example, a weighted sum or weighted average can be used to calculate the correlation parameters corresponding to the C channel sets to obtain the total correlation parameter. For another example, the maximum correlation parameter can be selected from the correlation parameters corresponding to the C channel sets as the total correlation parameter.
[0157] According to an embodiment of the present application, determining the total correlation parameter based on the correlation parameters corresponding to the C channel sets comprises: selecting the maximum correlation parameter from the correlation parameters corresponding to the C channel sets as the total correlation parameter.
[0158] The scheme of selecting the maximum correlation parameter from the correlation parameters corresponding to the C channel set as the total correlation parameter can maximize the correlation between the lighting parameters and the image parameters, so that the live human video of the lost frame can pass the live detection as much as possible.
[0159] According to the embodiment of the present application, each image parameter subset in the at least one parameter subset and each lighting parameter subset in the at least one lighting parameter subset are represented by color values in the initial color space. For each of the at least one acquisition moment, the image parameters of the p channels are obtained based on the image parameter subset corresponding to the acquisition moment, including: for each of the at least one acquisition moment, converting the image parameter subset corresponding to the acquisition moment into color values of a new color space to obtain the image parameters of the p channels, the new color space containing color values of the p channels; for each of the at least one lighting moment, the lighting parameters of the p channels are obtained based on the lighting parameter subset corresponding to the lighting moment, including: for each of the at least one lighting moment, converting the lighting parameter subset corresponding to the lighting moment into color values of a new color space to obtain the lighting parameters of the p channels.
[0160] Exemplarily, the initial color space is a BGR color space, and the new color space is a YUV color space.
[0161] The embodiments of color space conversion have been described above, and will not be repeated here. The color space conversion operation is optional, and the color values of the original color space can be used for subsequent correlation calculation and other operations.
[0162] According to the embodiment of the present application, the image parameter set can be obtained by: obtaining a to-be-detected video, the to-be-detected video including at least one image corresponding to at least one acquisition moment one by one; for each of the at least one image, determining a face region containing a face in the image; and averaging the color values of the pixels contained in the face region in the image to obtain the image parameter subset corresponding to the image, wherein the image parameter set includes at least one image parameter subset corresponding to at least one image one by one.
[0163] In one example, the face region containing a face can be the entire image, that is, the color values of the pixels contained in the entire image can be directly averaged to obtain the image parameter subset corresponding to the image. This scheme is simple to calculate and fast to operate, which helps to improve the speed of live detection.
[0164] In another example, any existing or future possible face detection algorithm can be employed to detect faces in the image, obtain a face frame in which the face is located, and take the region within the face frame as the face region. Subsequently, the color values of the pixels contained in the face frame can be averaged to obtain the sub-set of image parameters corresponding to the image. This scheme is more accurate in locating the face and helps to improve the accuracy of the liveness detection.
[0165] According to another aspect of the present application, there is provided a liveness detection apparatus. Figure 3 A schematic block diagram of a liveness detection apparatus 300 according to an embodiment of the present application is shown.
[0166] As shown in Figure 3 The liveness detection apparatus 300 according to an embodiment of the present application comprises an obtaining module 310, a first selecting module 320, a second selecting module 330, a searching module 340 and a judging module 350. Each of the modules can perform the respective steps / functions of the liveness detection method described above in connection with Figure 2 The following only describes the main functions of the components of the liveness detection apparatus 300, and the details already described above are omitted.
[0167] The obtaining module 310 is configured to obtain a first sequence of lighting parameters and a sequence of image parameters for liveness detection. The obtaining module 310 can be implemented by the processor 102 in the electronic device shown in Figure 1 running program instructions stored in the storage 104.
[0168] The first selecting module 320 is configured to select n groups of image parameters to be aligned from the sequence of image parameters, wherein the n groups of image parameters correspond to n time instants one by one, and n is a positive integer greater than or equal to 1. The first selecting module 320 can be implemented by the processor 102 in the electronic device shown in Figure 1 running program instructions stored in the storage 104.
[0169] The second selecting module 330 is configured to select m groups of lighting parameters matching the n groups of image parameters from the first sequence of lighting parameters, wherein the time period spanned by the n groups of image parameters is consistent with the time period spanned by the m groups of lighting parameters, the m groups of lighting parameters correspond to m lighting time instants one by one, and m is a positive integer greater than 1, m>n. The second selecting module 330 can be implemented by the processor 102 in the electronic device shown in Figure 1 running program instructions stored in the storage 104.
[0170] The searching module 340 is configured to search for n groups of lighting parameters having the greatest correlation with the n groups of image parameters from the m groups of lighting parameters to obtain a second sequence of lighting parameters. The searching module 340 can be implemented by the processor 102 in the electronic device shown in Figure 1The processor 102 in the electronic device shown runs program instructions stored in the storage 104 to implement.
[0171] The determining module 350 is configured to determine whether the to-be-detected video to which the image parameter sequence belongs is an attack video according to a correlation between the image parameter sequence and a third lighting parameter sequence, the third lighting parameter sequence comprising lighting parameters in the first lighting parameter sequence other than the m groups of lighting parameters and the second lighting parameter sequence. Figure 1 The processor 102 in the electronic device shown runs program instructions stored in the storage 104 to implement.
[0172] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0173] Figure 4 A schematic block diagram of a living body detection system 400 according to an embodiment of the present application is shown. The living body detection system 400 comprises a storage device (i.e. a memory) 410 and a processor 420.
[0174] The storage device 410 stores computer program instructions for implementing corresponding steps in the living body detection method according to an embodiment of the present application.
[0175] The processor 420 is configured to run the computer program instructions stored in the storage device 410 to perform corresponding steps of the living body detection method according to an embodiment of the present application.
[0176] In one embodiment, the computer program instructions are run by the processor 420 to perform the following steps: obtaining a first light parameter sequence and an image parameter sequence for living body detection; selecting n groups of image parameters to be aligned from the image parameter sequence, wherein the n groups of image parameters correspond to n time points of acquisition one by one, and n is a positive integer greater than or equal to 1; selecting m groups of light parameters matching the n groups of image parameters from the first light parameter sequence, wherein an acquisition time period spanned by the n groups of image parameters is consistent with a light time period spanned by the m groups of light parameters, the m groups of light parameters correspond to m light time points one by one, m is a positive integer greater than 1, and m > n; finding n groups of light parameters having the greatest correlation with the n groups of image parameters from the m groups of light parameters to obtain a second light parameter sequence; and determining whether a video to which the image parameter sequence belongs is an attack video according to at least the correlation between the image parameter sequence and a third light parameter sequence, wherein the third light parameter sequence comprises light parameters other than the m groups of light parameters in the first light parameter sequence and the second light parameter sequence.
[0177] Exemplarily, the living body detection system 400 can further comprise a display screen 430. The display screen 430 is configured to emit light in a manner of displaying a color image according to at least an indication of the first light parameter sequence. The display screen 430 is optional, and the living body detection system 400 can not comprise the display screen 430. In this case, the first light parameter sequence can be transmitted to other devices (e.g., the light and image acquisition device described above) and light can be emitted by a display screen or a light emitting device of the other devices.
[0178] Exemplarily, the living body detection system 400 can further comprise an image acquisition device 440. The image acquisition device 440 is configured to acquire a video to be detected. The image acquisition device 440 is optional, and the living body detection system 400 can not comprise the image acquisition device 440. In this case, the video to be detected can be acquired by other image acquisition devices (e.g., the light and image acquisition device described above), and the acquired video to be detected can be transmitted to the living body detection system 400.
[0179] In addition, according to an embodiment of the present application, a storage medium is provided, and program instructions are stored on the storage medium. When the program instructions are run by a computer or a processor, the program instructions are used to perform corresponding steps of the living body detection method according to an embodiment of the present application, and are used to implement corresponding modules in the living body detection apparatus according to an embodiment of the present application. The storage medium can include, for example, a memory card of a smart phone, a memory component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disc read-only memory (CD-ROM), a USB memory, or any combination of the above storage media.
[0180] In one embodiment, the program instructions, when executed by the computer or the processor, can enable the computer or the processor to implement various functional modules of the living body detection apparatus according to the embodiments of the present application, and / or can perform the living body detection method according to the embodiments of the present application.
[0181] In one embodiment, the program instructions, when executed, are configured to perform the following steps: obtaining a first light parameter sequence and an image parameter sequence for living body detection; selecting n groups of image parameters to be aligned from the image parameter sequence, wherein the n groups of image parameters correspond to n acquisition time points one by one, and n is a positive integer greater than or equal to 1; selecting m groups of light parameters matched with the n groups of image parameters from the first light parameter sequence, wherein an acquisition time period spanned by the n groups of image parameters is consistent with a light time period spanned by the m groups of light parameters, the m groups of light parameters correspond to m light time points one by one, m is a positive integer greater than 1, and m > n; finding n groups of light parameters with the greatest correlation with the n groups of image parameters from the m groups of light parameters to obtain a second light parameter sequence; and determining whether a video to which the image parameter sequence belongs is an attack video according to the correlation between the image parameter sequence and a third light parameter sequence, wherein the third light parameter sequence includes light parameters in the first light parameter sequence other than the m groups of light parameters and the second light parameter sequence.
[0182] The modules in the living body detection system according to the embodiments of the present application can be implemented by running computer program instructions stored in the memory by the processor of the electronic device for living body detection according to the embodiments of the present application, or can be implemented when the computer instructions stored in the computer readable storage medium of the computer program product according to the embodiments of the present application are run by the computer.
[0183] Although the example embodiments have been described herein with reference to the accompanying drawings, it is to be understood that the above-described example embodiments are merely exemplary and are not intended to limit the scope of the present application. Those of ordinary skill in the art can make various changes and modifications without departing from the scope and spirit of the present application. All such changes and modifications are intended to be included within the scope of the present application as claimed in the appended claims.
[0184] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be realized by electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are performed by hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0185] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is merely a logical function division. In actual implementation, another division manner can be used, for example, a plurality of units or components can be combined or integrated into another device, or some features can be omitted or not executed.
[0186] In the specification provided herein, a large number of specific details are described. However, it can be understood that the embodiments of the present application can be practiced without these specific details. In some examples, well-known methods, structures and techniques are not described in detail in order not to obscure the understanding of the specification.
[0187] Similarly, it should be understood that, in order to simplify the present application and help understand one or more of the various application aspects, in the description of the exemplary embodiments of the present application, various features of the present application are sometimes grouped together in a single embodiment, figure, or description thereof. However, the method of the present application should not be interpreted as reflecting the intention that the claimed present application requires more features than the features explicitly recorded in each claim. Rather, as reflected in the corresponding claims, the application point is that the corresponding technical problem can be solved with fewer features than all the features of a certain disclosed single embodiment. Therefore, the claims following the specific embodiments are hereby expressly incorporated into the specific embodiments, wherein each claim itself is a separate embodiment of the present application.
[0188] Those skilled in the art can understand that, except for the mutual exclusion between features, all features disclosed in the specification (including the accompanying claims, abstract and drawings) and all processes or units of any method or device disclosed in this way can be combined in any combination. Unless explicitly stated otherwise, each feature disclosed in the specification (including the accompanying claims, abstract and drawings) can be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0189] In addition, those skilled in the art can understand that although some embodiments herein include certain features rather than other features included in other embodiments, the combination of features of different embodiments means that it is within the scope of the present application and forms different embodiments. For example, in the claims, any one of the claimed embodiments can be used in any combination.
[0190] The various component embodiments of the present application can be implemented in hardware, or as software modules running in one or more processors, or in combinations thereof. As will be appreciated by one skilled in the art, a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some of the modules in the living body detection apparatus according to the embodiments of the present application. The present application can also be implemented as a program for executing part or all of the methods described herein, for example, a computer program and a computer program product. The program implementing the present application can be stored on a computer readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, or provided on a carrier medium, or in any other form.
[0191] It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that one skilled in the art will be able to design many alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word 'comprising' does not exclude the presence of elements or steps other than those listed in a claim. The word 'a' or 'an' preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of both hardware and software, and any combination thereof. In a unit claim, several devices can be listed with a conjunction like 'or', but it is to be understood that each of these devices can be implemented by its own hardware item. The use of the words 'first','second' and 'third', etc. do not imply any order but rather are used for naming purposes only.
[0192] The above, merely is the specific implementation or explanation of the specific implementation of the present application, the protection scope of the present application is not limited to this, any skilled person in the art can easily think of the change or replacement in the technical range disclosed by the present application, all should be covered in the protection scope of the present application. The protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for live detection, comprising: obtaining a first light parameter sequence and an image parameter sequence for live detection, the first light parameter sequence comprising at least one set of light parameters corresponding to at least one light time, each set of light parameters being color values of one or more channels, the channels corresponding to the first light parameter sequence being consistent with the channels corresponding to the image parameter sequence; selecting n sets of image parameters to be aligned from the image parameter sequence, wherein the n sets of image parameters correspond to n acquisition times, and n is a positive integer greater than or equal to 1; selecting m sets of light parameters matching the n sets of image parameters from the first light parameter sequence, wherein the acquisition time period spanned by the n sets of image parameters is consistent with the light time period spanned by the m sets of light parameters, the m sets of light parameters correspond to m light times, and m is a positive integer greater than 1, m>n; finding n sets of light parameters having the greatest correlation with the n sets of image parameters from the m sets of light parameters to obtain a second light parameter sequence; determining whether a video to which the image parameter sequence belongs is an attack video according to the correlation between the image parameter sequence and a third light parameter sequence, the third light parameter sequence comprising light parameters other than the m sets of light parameters in the first light parameter sequence and the second light parameter sequence.
2. The method of claim 1, wherein, with the maximum lighting parameter sequence S (i)(j) represents the i-th group of lighting parameters with the maximum correlation to the first i-th group of image parameters in the n groups of image parameters, i = 1, 2, 3, …, n, j = i, i+1, i+2, …, m, wherein, The finding n sets of light parameters having the greatest correlation with the n sets of image parameters from the m sets of light parameters to obtain a second light parameter sequence comprises: The maximum lighting parameter sequence S is determined by the following way (i)(j) : In case j = i, the first j groups of lighting parameters in the m groups of lighting parameters are determined as the maximum lighting parameter sequence S (i)(j) ; in the case of j≠i, Obtaining a sequence of maximum lighting parameters S (i-1)(j-1) ; calculating a first correlation between a first i groups of image parameters in the n groups of image parameters and a temporary lighting parameter sequence, the temporary lighting parameter sequence comprising the maximum lighting parameter sequence S (i-1)(j-1) and a jth group of lighting parameters in the m groups of lighting parameters; Obtaining a sequence of maximum lighting parameters S (i)(j-1) ; calculating a second correlation between a first i of the n sets of image parameters and the sequence S of maximum lighting parameters (i)(j-1) ; comparing the first correlation with the second correlation, and if the first correlation is greater than or equal to the second correlation, determining the temporary lighting parameter sequence as the maximum lighting parameter sequence S (i)(j) , otherwise determining the maximum lighting parameter sequence S (i)(j-1) as the maximum lighting parameter sequence S (i)(j) ; wherein, when i=n, j=m, the corresponding maximum lighting parameter sequence S (i)(j) is the second lighting parameter sequence.
3. The method of claim 2, wherein, denoting the i th set of image parameters in the n sets of image parameters as x[i] and the j th set of light parameters in the m sets of light parameters as y[j], wherein, The finding n sets of light parameters having the greatest correlation with the n sets of image parameters from the m sets of light parameters to obtain a second light parameter sequence comprises: A first vector H[i][j][0] is created for recording the first i groups of image parameters in the n groups of image parameters, and a second vector H[i][j][1] is created for recording the lighting parameters in the maximum lighting parameter sequence S (i)(j) , where H[i][j][0] and H[i][j][1] are initially empty vectors. performing a first operation from i=1 to i=n, the first operation comprising: performing a second operation from j=i to j=m, the second operation comprising: if j=i, then H[i][j][0]=H[i-1][j-1][0]+x[i], H[i][j][1]=H[i-1][j-1][1]+y[j]; if j≠i, then: H[i][j][0]'=H[i-1][j-1][0]+x[i], H[i][j][1]'=H[i-1][j-1][1]+y[j], calculating the correlation between H[i][j][0]' and H[i][j][1]' to obtain the first correlation; calculating a correlation between H[i][j][0] and H[i][j][1] to obtain the second correlation, wherein the null is a skip symbol, and the skip symbol indicates skipping a y element in H[i][j][1] corresponding to the skip symbol; comparing the first correlation with the second correlation, if the first correlation is greater than or equal to the second correlation, H[i][j][0] = H[i][j][0]', otherwise H[i][j][0] = H[i][j][0]''. wherein adding H[i][j][0] to any group of image parameters or skip symbol means adding the group of image parameters or skip symbol as a new element of H[i][j][0] to H[i][j][0], and adding H[i][j][1] to any group of lighting parameters means adding the group of lighting parameters as a new element of H[i][j][1] to H[i][j][1].
4. The method of claim 2 or 3, wherein, The correlation is represented by a Pearson correlation coefficient, and when calculating the correlation between a specific number of groups of image parameters and a specific number of groups of lighting parameters, the Pearson correlation coefficient between the specific number of groups of image parameters and the specific number of groups of lighting parameters is calculated based on the following manner: when the specific number is 0, determining a target value as the Pearson correlation coefficient; when the specific number is 1, calculating the Pearson correlation coefficient based on the difference between the group of image parameters and the group of lighting parameters; when the specific number is 2, calculating the Pearson correlation coefficient based on the difference between the two groups of image parameters and the difference between the two groups of lighting parameters; when the specific number is greater than 2, calculating the Pearson correlation coefficient based on the covariance between the specific number of groups of image parameters and the specific number of groups of lighting parameters, the standard deviation of the specific number of groups of image parameters, and the standard deviation of the specific number of groups of lighting parameters.
5. The method of any one of claims 1 to 3, wherein, The searching, from the m groups of lighting parameters, for the n groups of lighting parameters having the greatest correlation with the n groups of image parameters to obtain a second lighting parameter sequence comprises: combining by extracting n groups of lighting parameters from the m groups of lighting parameters to obtain at least one combination result; for each of the at least one combination result, calculating the correlation between the n groups of lighting parameters corresponding to the combination result and the n groups of image parameters; selecting, from the at least one combination result, the combination result corresponding to the greatest correlation, and determining the n groups of lighting parameters corresponding to the selected combination result as the second lighting parameter sequence.
6. The method of any one of claims 1 to 3, wherein, The image parameter sequence comprises at least one group of image parameters corresponding to at least one acquisition time, The obtaining of the first lighting parameter sequence and the image parameter sequence for living body detection comprises: obtaining a set of lighting parameters and a set of image parameters for living body detection, wherein the set of image parameters comprises at least one sub-set of image parameters corresponding to at least one acquisition time in the video to be detected, and the set of lighting parameters comprises at least one sub-set of lighting parameters corresponding to at least one lighting time; for each acquisition time in the at least one acquisition time, obtaining image parameters of p channels based on the sub-set of image parameters corresponding to the acquisition time, wherein the p channels are divided into C channel sets, p is a positive integer greater than 1, and C is a positive integer greater than or equal to 1; for each lighting time in the at least one lighting time, obtaining lighting parameters of p channels based on the sub-set of lighting parameters corresponding to the lighting time; for the kth channel set in the C channel sets, determining at least one set of image parameters corresponding to the at least one acquisition time and located in the channel set as the image parameter sequence, and determining at least one set of lighting parameters corresponding to the at least one lighting time and located in the channel set as the first lighting parameter sequence, wherein k = 1, 2, 3, …, C.
7. The method of claim 6, wherein, C > 1, and the determination of whether the video to which the image parameter sequence belongs is an attack video based on the correlation between the image parameter sequence and the third lighting parameter sequence comprises: for each channel set in the C channel sets, calculating a correlation parameter between the image parameter sequence corresponding to the channel set and the third lighting parameter sequence; determining a total correlation parameter based on the correlation parameters corresponding to the C channel sets; comparing the total correlation parameter with a target threshold value, and if the total correlation parameter is less than the target threshold value, determining that the video to be detected is an attack video.
8. The method of claim 7, wherein, The determination of the total correlation parameter based on the correlation parameters corresponding to the C channel sets comprises: selecting the maximum correlation parameter from the correlation parameters corresponding to the C channel sets as the total correlation parameter.
9. The method of claim 6, wherein, Each image parameter sub-set in the at least one parameter sub-set and each lighting parameter sub-set in the at least one lighting parameter sub-set are represented by color values in an initial color space, The obtaining of the image parameters of p channels based on the sub-set of image parameters corresponding to the acquisition time for each acquisition time in the at least one acquisition time comprises: for each acquisition time in the at least one acquisition time, converting the sub-set of image parameters corresponding to the acquisition time into color values in a new color space to obtain image parameters of p channels, wherein the new color space contains color values of p channels; The obtaining of the lighting parameters of p channels based on the sub-set of lighting parameters corresponding to the lighting time for each lighting time in the at least one lighting time comprises: for each lighting time in the at least one lighting time, converting the sub-set of lighting parameters corresponding to the lighting time into color values in the new color space to obtain lighting parameters of p channels.
10. The method of claim 6, wherein, The set of image parameters is obtained by: acquire the video to be detected, the video to be detected comprising at least one image corresponding to the at least one acquisition time point one by one; for each image in the at least one image, determine a face region in the image containing a face; average color values of pixels contained in the face region in the image to obtain a sub-set of image parameters corresponding to the image, wherein the set of image parameters comprises at least one sub-set of image parameters corresponding to the at least one image one by one.
11. An electronic device comprising a processor and a memory, characterized in that The memory stores computer program instructions, and the computer program instructions are used to execute the living body detection method according to any one of claims 1 to 10 when executed by the processor.
12. A storage medium having stored thereon program instructions, the program instructions being executable by a processor to cause the processor to execute operations comprising: The program instructions are used to execute the living body detection method according to any one of claims 1 to 10 when executed.
13. A computer program product comprising a computer program, characterized in that, The computer program is used to execute the living body detection method according to any one of claims 1 to 10 when executed.
Citation Information
Patent Citations
Face dazzle degree detection method and device, equipment and storage medium
CN113792801A
Video detection method, video detection device, storage medium and electronic equipment
CN114170554A