Liveness detection model training, liveness detection method, device, equipment and medium

By using face pictures at different distances to generate optical flow maps and train the live detection model, the problem of poor live detection effect in the prior art is solved, and more efficient and accurate live recognition is achieved.

CN111738176BActive Publication Date: 2025-02-25ZOLOZ PTE LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010594280.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-24
Publication Date
2025-02-25
Estimated Expiration
2040-06-24

AI Technical Summary

Technical Problem

The prior art is difficult to effectively and efficiently identify living bodies in vivo detection, especially when facing high-definition screen photos, remakes or printed photos, and videos generated by face generation software.

Method used

By obtaining a sample set containing at least two face pictures of different distances, the optical flow map of the sample is determined, and the live detection model is trained using these optical flow maps to determine whether the live detection object is a living body based on the output data of the model.

Benefits of technology

This method can more accurately identify living bodies, improve the effectiveness and efficiency of living bodies detection, and resist fraudulent behaviors of forged pictures and videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111738176B_ABST
    Figure CN111738176B_ABST
Patent Text Reader

Abstract

The embodiments of this specification disclose a liveness detection model training, a liveness detection method, an apparatus, a device and a medium. The liveness detection model training method includes: obtaining a sample set for model training, wherein the samples in the sample set include positive samples and negative samples, and each sample includes at least two facial images at different distances; determining an optical flow map corresponding to each sample; and using the optical flow map corresponding to each sample to train a liveness detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a liveness detection model training, liveness detection method, device, equipment and medium. Background Art

[0002] Liveness detection is an important application of computer technology. How to improve the effect and efficiency of liveness detection has become an important topic.

[0003] In view of this, a more effective and efficient liveness detection solution is needed. Summary of the invention

[0004] The embodiments of this specification provide a liveness detection model training, liveness detection method, device, equipment and medium to solve the technical problem of how to perform liveness detection more effectively and efficiently.

[0005] To solve the above technical problems, the embodiments of this specification adopt the following technical solutions:

[0006] The present invention provides a method for training a liveness detection model, including:

[0007] Obtaining a sample set for model training, wherein the samples in the sample set include positive samples and negative samples, and each sample includes at least two face images at different distances;

[0008] Determine the optical flow map corresponding to each sample;

[0009] The optical flow map corresponding to each sample is used to train a living body detection model.

[0010] The present embodiment provides a first living body detection method, including:

[0011] Acquire a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object;

[0012] Determine an optical flow map corresponding to the picture group;

[0013] The optical flow map is input into the liveness detection model obtained by the above training, and whether the liveness detection object is a live body is determined according to the output data of the liveness detection model.

[0014] The present specification provides a second method for detecting liveness, including:

[0015] Collecting a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object;

[0016] The image group is sent to a liveness detection end so that the liveness detection end determines an optical flow map corresponding to the image group; and the optical flow map is input into the liveness detection model obtained by the above training, and whether the liveness detection object is alive is determined according to the output data of the liveness detection model.

[0017] The embodiment of this specification provides a living body detection model training device, including:

[0018] A sample module, used to obtain a sample set for model training, wherein the samples in the sample set include positive samples and negative samples, and each sample includes at least two face images at different distances;

[0019] Optical flow module, used to determine the optical flow map corresponding to each sample;

[0020] The training module is used to train a living body detection model using the optical flow map corresponding to each sample.

[0021] The embodiment of this specification provides a living body detection device, which is configured with the living body detection model obtained through the training, including:

[0022] A picture module, used to obtain a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object;

[0023] An optical flow module, used to determine an optical flow map corresponding to the picture group;

[0024] The detection module is used to input the optical flow map into the liveness detection model, and determine whether the liveness detection object is a live body according to the output data of the liveness detection model.

[0025] The embodiment of this specification provides a living body detection device, including:

[0026] A picture module, used for collecting a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object;

[0027] A sending module, used for sending the picture group to a liveness detection end so that the liveness detection end determines an optical flow map corresponding to the picture group; and inputting the optical flow map into a liveness detection model obtained according to any one of claims 1 to 7, and judging whether the liveness detection object is alive according to the output data of the liveness detection model.

[0028] The embodiment of this specification provides a liveness detection model training device, including:

[0029] at least one processor;

[0030] as well as,

[0031] a memory communicatively coupled to the at least one processor;

[0032] in,

[0033] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the above-mentioned living body detection model training method.

[0034] The embodiment of this specification provides a living body detection device, including:

[0035] at least one processor;

[0036] as well as,

[0037] a memory communicatively coupled to the at least one processor;

[0038] in,

[0039] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can perform the above-mentioned first living body detection method.

[0040] The embodiment of this specification provides a living body detection device, including:

[0041] at least one processor;

[0042] as well as,

[0043] a memory communicatively coupled to the at least one processor;

[0044] in,

[0045] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can perform the second living body detection method mentioned above.

[0046] An embodiment of the present specification provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the above-mentioned living body detection model training method is implemented.

[0047] An embodiment of the present specification provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the above-mentioned first living body detection model training method is implemented.

[0048] An embodiment of the present specification provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the above-mentioned second living body detection model training method is implemented.

[0049] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:

[0050] The optical flow of face images at different distances is calculated and an optical flow map is generated. The liveness detection model is trained through the optical flow map and used for liveness detection. This can reflect the dynamic changes of the face and the perspective effect, and improve the liveness detection effect and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments of this specification or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0052] Figure 1 It is a schematic diagram of the execution body of the living body detection model training method provided in the first embodiment of this specification.

[0053] Figure 2 It is a flowchart of the liveness detection model training method provided in the first embodiment of this specification.

[0054] Figure 3 This is a schematic diagram of the liveness detection model training provided in the first embodiment of this specification.

[0055] Figure 4 It is a flowchart of the liveness detection method provided in the second embodiment of this specification.

[0056] Figure 5 It is a display schematic diagram in the second embodiment of this specification.

[0057] Figure 6 It is another display schematic diagram in the second embodiment of this specification.

[0058] Figure 7 It is another display schematic diagram in the second embodiment of this specification.

[0059] Figure 8 It is a flowchart of a liveness detection method provided in the third embodiment of this specification.

[0060] Fig. 9It is a structural diagram of a living body detection model training device provided in the fourth embodiment of this specification.

[0061] Fig.10 It is a structural schematic diagram of a living body detection device provided in the fifth embodiment of this specification.

[0062] Fig.11 It is a structural schematic diagram of a living body detection device provided in the sixth embodiment of this specification. DETAILED DESCRIPTION

[0063] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0064] In the prior art, liveness detection has become a common demand. For example, face-swiping login, face-swiping payment and other scenarios often require liveness detection. Generally speaking, it is necessary to collect pictures or videos of the detection object for liveness detection, and many models or algorithms for liveness detection have emerged, such as single-frame silent liveness algorithms or action liveness algorithms based on deep learning models (i.e., liveness detection algorithms that require actions such as blinking and shaking the head). On the other hand, there are currently some deceptive behaviors for liveness detection, such as liveness detection through videos or pictures generated by software or re-photographed pictures or printed pictures. For example, for the above-mentioned single-frame silent liveness algorithm, although it can effectively intercept screens and re-photographed photos with obvious borders and material features, the single-frame algorithm has poor recognition effect on high-definition screen photos; for another example, for the above-mentioned action liveness algorithm, it can also recognize high-definition screen photos or re-photographed or printed photos to a certain extent, but it is easy to be broken by videos containing actions (such as blinking, shaking the head, opening the mouth, etc.) generated by face generation software.

[0065] The first embodiment of this specification provides a method for training a liveness detection model. The execution subject of this embodiment can be a terminal (including but not limited to a mobile phone, computer, pad, etc.) or a server or a corresponding liveness detection model training platform or system or operating system, etc., that is, the execution subject can be various and can be set, used or changed as needed. In addition, a third-party application can also assist the execution subject in executing this embodiment. For example Figure 1As shown, the liveness detection model training method in this embodiment can be executed by the server, and an application corresponding to the server can be installed on the terminal (held by the user). Data can be transmitted between the terminal or the application and the server, and data can be collected, input or output or pages or information can be displayed (to the user) through the terminal or the application, thereby assisting the server in executing the liveness detection model training method in this embodiment.

[0066] like Figure 2 and Figure 3 As shown, the living body detection model training method provided in this embodiment includes:

[0067] S101: (Executing subject) obtaining a sample set for model training, wherein the samples in the sample set include positive samples and negative samples, and each sample includes at least two face images at different distances;

[0068] In this embodiment, a sample set may be obtained, which includes a plurality of samples, and the samples may include positive samples and negative samples, and each sample includes at least two facial images at different distances (the facial images may come from a corresponding database). Furthermore, each facial image should include a complete facial region. In this embodiment, the positive sample is a sample from a living body, that is, the facial image in the positive sample comes from a living body (the living body in this specification generally refers to a natural person), for example Figure 3 The negative sample is a sample that is not from a living body, that is, the face image in the negative sample is not from a living body, including but not limited to the face image in the negative sample is generated by software or copied from a screen or photo, for example Figure 3 'Photos' and 'Screens' rows.

[0069] In this embodiment, the number of face images included in each sample is not specifically limited, and can be two or more than two. Generally speaking, the face images included in each positive sample should be from the same living person, and the face images included in each negative sample should also be the face of the same person, even if they are generated by software or re-photographed.

[0070] In this embodiment, whether the distance between any two facial images is the same or different can be determined based on the ratio of the region of interest in each facial image to the facial image. Specifically, the facial area in the facial image (the facial area can be selected by an existing face detection algorithm, and the shape of the selected facial area includes but is not limited to a rectangle) can be used as the region of interest, and the ratio of the region of interest in each facial image to the facial image is calculated, including but not limited to calculating the ratio of the area of ​​the region of interest in each facial image to the area of ​​the facial image, or calculating the ratio of the width of the region of interest in each facial image to the width of the facial image, or calculating the ratio of the length of the region of interest in each facial image to the length of the facial image. The units of the above area / width / length include but are not limited to centimeters, pixels, inches, etc. The above ratio can be calculated using (existing) face detection algorithms or models, including but not limited to MTCNN algorithms.

[0071] The distances between different face images can be determined based on the above ratios. Specifically, the smaller the above ratios are, the larger the distance is. For example, if the above ratios in image A are 0.5 and in image B are 0.3, then the distance of image A is determined to be smaller than the distance of image B. It should be noted that when comparing the above ratios of any two face images, the ratios with the same meaning should be compared, for example, both images use area ratios, width ratios, or length ratios.

[0072] The "different distances" in this embodiment are equivalent to different shooting distances. For positive samples, facial images at different distances may be obtained due to different distances between the living body and the shooting device. For negative samples, due to the different ratios mentioned above, the facial images in the negative samples at least "look" to be taken at different shooting distances, or indicate different shooting distances.

[0073] S103: (Executing body) determining the optical flow map corresponding to each sample;

[0074] In this embodiment, the optical flow map corresponding to each sample can be determined. Specifically, determining the optical flow map corresponding to each sample includes: for any sample, aligning the facial images included in the sample, and determining the optical flow map corresponding to the sample using the aligned facial images of the sample.

[0075] In this embodiment, for any sample, aligning the facial images contained in the sample includes:

[0076] S1031: for any sample, performing first-stage alignment on each facial image included in the sample according to facial key points in each facial image included in the sample;

[0077] Specifically, for any sample, the key points of each face image in the sample are extracted, and the face images in the sample are aligned in the first stage according to the key points (the first stage alignment may also be called "rough alignment"). The key points may be extracted using an existing algorithm or model.

[0078] S1033: performing a second-stage alignment on the facial images of the sample after the first alignment according to the machine vision features of the facial images included in the sample.

[0079] After the first stage alignment of the facial images of the sample, the machine vision features of each facial image in the sample can be extracted, and the second stage alignment (the second stage alignment can also be called "fine alignment") is performed on each facial image in the sample according to the machine vision features. The machine vision features may include at least one of SIFT features, HOG features, SURF features, ORB features, LBP features, and HAAR features.

[0080] For any sample, after aligning the facial images in the sample, the optical flow of each facial image in the sample (after alignment) can be calculated, and the optical flow map corresponding to each facial image in the sample is generated according to the optical flow of each facial image in the sample (after alignment), that is, the optical flow map corresponding to the sample.

[0081] By using the above content, the optical flow map corresponding to each sample (including positive samples and negative samples) can be determined.

[0082] S105: (Executing entity) Use the optical flow map corresponding to each sample to train a living body detection model.

[0083] In this embodiment, after generating the optical flow map corresponding to each sample, the optical flow map corresponding to each sample can be used to train the liveness detection model. Wherein, using the optical flow map corresponding to each sample to train the liveness detection model includes: using the optical flow map corresponding to each sample to train a classification model (or an optical flow map classification model) to obtain the liveness detection model.

[0084] The above-mentioned classification models include but are not limited to CNN classification models, PCA models, etc., and this embodiment does not make specific limitations.

[0085] In this embodiment, each sample contains facial images at different distances. If the facial images in the sample are from a living body, different perspective effects will be formed due to the different distances between the living body and the shooting device. The optical flow map can accurately show this perspective effect. Therefore, this embodiment uses the optical flow map to train the liveness detection model, so that the obtained liveness detection model can perform liveness detection based on the above perspective effect. Non-live videos or pictures, including but not limited to videos or pictures generated by software or re-photographed pictures or printed pictures, cannot show the above perspective effect. Therefore, the liveness detection model obtained in this embodiment can accurately detect whether it is alive, and the liveness detection effect is good and efficient. In this embodiment, the facial images can be aligned in two stages to generate an optical flow map, so that the generated optical flow map (for the above perspective effect) has a better performance effect, thereby improving the liveness detection effect and efficiency of the liveness detection model obtained thereby.

[0086] The second embodiment of this specification provides a liveness detection method, which can be regarded as the application of the liveness detection model obtained in the first embodiment. The execution subject of this embodiment can be a terminal (including but not limited to mobile phones, computers, pads, etc.) or a server or a corresponding liveness detection platform or system or operating system, etc., that is, the execution subject can be various and can be set, used or changed as needed. In addition, there can also be a third-party application to assist the execution subject in executing this embodiment. For example Figure 1 As shown, the liveness detection method in this embodiment can be executed by the server, and an application corresponding to the server can be installed on the terminal (held by the user). Data can be transmitted between the terminal or the application and the server, and data can be collected, input or output or pages or information can be displayed (to the user) through the terminal or the application, thereby assisting the server in executing the liveness detection method in this embodiment.

[0087] like Figure 4 As shown, the living body detection method provided in this embodiment includes:

[0088] S201: (Executing subject) obtaining a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object;

[0089] In this embodiment, a picture group including at least two face pictures at different distances (equivalent to different shooting distances) can be obtained. The picture group including at least two face pictures at different distances can be obtained in the following manner as described in 1.1, 1.2 or 1.3 (this embodiment is not limited to the manner described in 1.1, 1.2 or 1.3):

[0090] 1.1 Video Decomposition

[0091] In this embodiment, the shooting device (which may include but is not limited to a camera, the same below) can shoot a video for a live detection object (depending on the live detection result, the live detection object here may be a live object or a non-live video or picture, referred to as "non-live", such as a reshot or generated video or picture, the same below). Specifically, the shooting device can start shooting after detecting the live detection object. The shooting device can send the shot video to the execution subject of this embodiment (referred to as "execution subject").

[0092] After receiving the above-mentioned video, the execution subject can decompose the video to obtain several frames of images, and select at least two face pictures with different distances from the several frames of images to form a picture group. Whether the distances of the frames of images are different can be judged by the method provided in the first embodiment, and the same applies below.

[0093] 1.2. Receive pictures

[0094] In this embodiment, the camera device can send the taken facial picture of the liveness detection object to the execution subject every time it takes the facial picture. After receiving each facial picture, the execution subject sends a command to the camera device to make the camera device issue a prompt message, and the prompt message is used to prompt the liveness detection object to approach or move away from the camera device. For example, the prompt message may be "please move closer to or away from the camera". The camera device can issue the prompt message in text or audio form, the same below. For example, the camera device has a display screen, and the prompt message is issued in text form through the display screen, such as Figure 5 As shown; and / or, the shooting device is provided with an audio module, and the prompt information is released in audio form through the audio module.

[0095] It can be expected that if the liveness detection object is a living thing, it will move closer to or farther away from the shooting device after receiving (for example, seeing or hearing, the same below) the prompt information; if the liveness detection object is a non-living thing, it should be placed in front of the shooting device for shooting by its holder. If the holder of the liveness detection object receives the prompt information, he or she will also move the liveness detection object closer to or farther away from the shooting device.

[0096] After the photographing device releases the prompt information, it will take the next facial picture and send it to the execution subject.

[0097] The photographing device repeats the above process, i.e., "take and send the previous face picture - receive the instruction to issue prompt information - take and send the next face picture" ("previous picture" and "next picture" are two adjacent pictures, the same below), so that the execution subject can receive a series of face pictures and select at least two face pictures at different distances from them to form a picture group.

[0098] 1.3. Receive pictures and determine distance

[0099] In this embodiment, the photographing device can send the photographed facial picture to the execution subject each time it takes a facial picture of the liveness detection object. After receiving each facial picture, the execution subject determines prompt information according to the ratio of the region of interest in the facial picture to the picture (same as the first embodiment), and sends the prompt information to the photographing device so that the photographing device publishes the prompt information, and the prompt information is used to prompt the liveness detection object to approach or move away from the photographing device.

[0100] Specifically, a threshold may be set. After each facial image is received by the execution subject, the ratio of the region of interest in the facial image to the image is determined. If the ratio is greater than (or greater than or equal to) the threshold, it indicates that the liveness detection object is close to the shooting device. Then the prompt information may be used to prompt the liveness detection object to stay away from the shooting device. For example, the prompt information may be “Please stay away from the camera”. Figure 6 If the ratio is less than or equal to (or less than) the threshold, it means that the live detection object is far away from the shooting device, then the prompt information can be used to prompt the live detection object to approach the shooting device, for example, the prompt information can be "please approach the camera", such as Figure 7 shown.

[0101] After the photographing device releases the prompt information, it will take the next facial picture and send it to the execution subject.

[0102] The photographing device repeats the above process, i.e., "take and send the previous face picture - receive instruction release prompt information - take and send the next face picture", so that the execution subject can receive a series of face pictures and select at least two face pictures at different distances from them to form a picture group.

[0103] In particular, in 1.2 or 1.3, after the camera releases the prompt information, it can detect whether the liveness detection object has moved, and only after movement occurs, the next face picture is taken. If the liveness detection object does not move after the prompt information is released, the prompt information is continuously released to prevent the liveness detection object from being non-live and the holder of the non-live object from not moving the liveness detection object and evading liveness detection.

[0104] In 1.2, the prompt information does not limit the liveness detection object to be close to or far from the camera. In 1.3, the distance between the liveness detection object and the camera is determined (by ratio), and then the prompt information limits the liveness detection object to be close to or far from the camera, so that the face area in the face image is not too large or too small, so that the face image quality is better. In 1.3, if the liveness detection object is close to the camera, it can be prompted to move away from the camera, otherwise it can be prompted to move closer to the camera, that is, it can adapt to the distance between the liveness detection object and the camera to improve the quality of the face image.

[0105] In 1.2 and 1.3, if the execution subject has received a sufficient number of facial images that meet different distances, the image capture device may be instructed to no longer capture facial images.

[0106] The facial images in the above picture group should satisfy the requirement of containing the (complete) facial region of the liveness detection object. Even if the liveness detection object is not a live object, it can be foreseen that it also contains the facial region for use in liveness detection.

[0107] In this embodiment, whether the distance between any two facial images is the same or different can be determined based on the ratio of the region of interest in each facial image to the facial image, and reference can be made to the content in the first embodiment.

[0108] S203: (Executing body) determining an optical flow graph corresponding to the picture group;

[0109] After obtaining the picture group, the optical flow map corresponding to each face picture in the picture group can be determined, and the optical flow map corresponding to the picture group is determined, that is, the face pictures are aligned, and the optical flow map corresponding to the picture group is determined using the aligned face pictures. Among them, the face pictures are aligned in the first stage according to the facial key points in the face pictures; and the face pictures after the first alignment are aligned in the second stage according to the machine vision features of the face pictures. The machine vision features include at least one of SIFT features, HOG features, SURF features, ORB features, LBP features, and HAAR features.

[0110] Determining the optical flow map corresponding to the picture group using the aligned facial pictures includes: calculating the optical flow of each facial picture; and generating the optical flow map corresponding to the picture group according to the optical flow of each facial picture.

[0111] For specific details, please refer to the contents in the first embodiment.

[0112] S205: (Executing body) Inputting the optical flow map into the liveness detection model obtained in the first embodiment, and judging whether the liveness detection object is a live body according to the output data of the liveness detection model.

[0113] After determining the optical flow map of the picture group, the optical flow map can be input into the liveness detection model trained in the first embodiment, and the liveness detection object is judged whether it is live according to the output data of the liveness detection model. Wherein, judging whether the liveness detection object is live according to the output data of the liveness detection model includes: judging whether the liveness detection object is live according to the confidence output by the liveness detection model (that is, the output data includes the confidence).

[0114] In this embodiment, after the optical flow map is input into the above-mentioned living body detection model, this embodiment further includes:

[0115] The liveness detection model is enabled to extract the image features of the optical flow map and calculate the softmax of the image features, so that the liveness detection model determines and outputs the confidence level, that is, the optical flow map is input into the liveness detection model, the liveness detection model extracts the image features of the optical flow map, calculates the softmax of the image features, determines and outputs the confidence level, and the confidence level represents the probability that the liveness detection object is alive.

[0116] Through the above content, it can be determined whether the liveness detection object is a live body.

[0117] In this embodiment, the picture group includes face pictures at different distances. If the face pictures in the picture group are from a living body, different perspective effects will be formed due to the different distances between the living body and the shooting device. This perspective effect can be accurately expressed through the optical flow map. The liveness detection model of this embodiment can perform liveness detection based on the above perspective effect. Inputting the optical flow map into the liveness detection model can accurately detect whether it is a living body, and the liveness detection effect is good and efficient. In this embodiment, the face pictures can be aligned in two stages to generate an optical flow map, so that the generated optical flow map (for the above perspective effect) has a better performance effect, thereby improving the liveness detection effect and efficiency. In this embodiment, the shooting distance of the liveness detection object is adaptive, and prompts are given to make the liveness detection object move, thereby obtaining the special optical flow formed by the liveness portrait during the movement, thereby improving the liveness detection effect and efficiency.

[0118] The third embodiment of this specification provides a liveness detection method, which can be regarded as the application of the liveness detection model obtained in the first embodiment. The execution subject of this embodiment can be a terminal (including but not limited to mobile phones, computers, pads, etc.) or a server or a corresponding liveness detection platform or system or operating system, etc., that is, the execution subject can be various and can be set, used or changed as needed. In addition, there can also be a third-party application to assist the execution subject in executing this embodiment. For example Figure 1As shown, the liveness detection method in this embodiment can be executed by the server, and an application corresponding to the server can be installed on the terminal (held by the user), and data can be transmitted between the terminal or the application and the server, and data can be collected, input or output or displayed (to the user) on a page or information through the terminal or the application, thereby assisting the server in executing the liveness detection method in this embodiment. The following is an example of the execution subject being a shooting device.

[0119] like Figure 8 As shown, the living body detection method provided in this embodiment includes:

[0120] S301: (executing body) collecting a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object;

[0121] In this embodiment, a picture group including at least two face pictures at different distances (equivalent to different shooting distances) may be collected. The method described in 2.1, 2.2 or 2.3 below may be used to obtain the picture group including at least two face pictures at different distances (this embodiment is not limited to the method described in 2.1, 2.2 or 2.3):

[0122] 2.1 Video Decomposition

[0123] In this embodiment, the shooting device (which may include but is not limited to a camera) may shoot a video of a live detection object (depending on the live detection result, the live detection object here may be a live object or a non-live video or picture, referred to as "non-live", such as a re-shot or generated video or picture, the same below). Specifically, the shooting device may start shooting after detecting the live detection object.

[0124] The execution subject may decompose the captured video to obtain a plurality of frames of images, and select at least two face images at different distances from the plurality of frames of images to form a picture group. Whether the distances of the frames of images are different may be determined by the method provided in the first embodiment, and the same applies below.

[0125] 2.2. Collect pictures

[0126] In this embodiment, the camera device can collect facial images of the liveness detection object, and publish a prompt message every time a facial image of the liveness detection object is taken, and the prompt message is used to prompt the liveness detection object to approach or move away from the camera device, for example, the prompt message can be "please move closer or away from the camera". The camera device can publish the prompt message in text or audio form, which is the same as 1.2.

[0127] It can be expected that if the liveness detection object is a living thing, it will move closer to or farther away from the shooting device after receiving (for example, seeing or hearing, the same below) the prompt information; if the liveness detection object is a non-living thing, it should be placed in front of the shooting device for shooting by its holder. If the holder of the liveness detection object receives the prompt information, he or she will also move the liveness detection object closer to or farther away from the shooting device.

[0128] After the photographing device releases the prompt information, it will take the next facial picture and send it to the execution subject.

[0129] The photographing device repeats the above process, i.e., "take the last face picture - issue prompt information - take the next face picture", so as to collect a series of face pictures, and select at least two face pictures at different distances from them to form a picture group.

[0130] 2.3. Receive pictures and determine distance

[0131] In this embodiment, the photographing device can collect facial images of the liveness detection object, and each time a facial image of the liveness detection object is taken, prompt information is determined according to the ratio of the area of ​​interest in the facial image to the image (the same as the first embodiment), and the prompt information is released. The prompt information is used to prompt the liveness detection object to approach or move away from the photographing device.

[0132] Specifically, a threshold value can be set. After each facial image is collected, the ratio of the area of ​​interest in the facial image to the image is determined. If the ratio is greater than (or greater than or equal to) the threshold, it means that the liveness detection object is close to the shooting device, and the prompt information can be used to prompt the liveness detection object to stay away from the shooting device. For example, the prompt information can be "Please stay away from the camera"; if the ratio is less than or equal to (or less than) the threshold, it means that the liveness detection object is far away from the shooting device, and the prompt information can be used to prompt the liveness detection object to approach the shooting device. For example, the prompt information can be "Please approach the camera".

[0133] After the photographing device releases the prompt information, it will take the next facial picture and send it to the execution subject.

[0134] The photographing device repeats the above process, i.e., "take the last face picture - issue prompt information - take the next face picture", so as to collect a series of face pictures, and select at least two face pictures at different distances from them to form a picture group.

[0135] In particular, in 1.2 or 1.3, after the camera releases the prompt information, it can detect whether the liveness detection object has moved, and only after movement occurs, the next face picture is taken. If the liveness detection object does not move after the prompt information is released, the prompt information is continuously released to prevent the liveness detection object from being non-live and the holder of the non-live object from not moving the liveness detection object and evading liveness detection.

[0136] In 1.2, the prompt information does not limit the liveness detection object to be close to or far from the camera. In 1.3, the distance between the liveness detection object and the camera is determined (by ratio), and then the prompt information limits the liveness detection object to be close to or far from the camera, so that the face area in the face image is not too large or too small, so that the face image quality is better. In 1.3, if the liveness detection object is close to the camera, it can be prompted to move away from the camera, otherwise it can be prompted to move closer to the camera, that is, it can adapt to the distance between the liveness detection object and the camera to improve the quality of the face image.

[0137] In 1.2 and 1.3, if the execution subject has received a sufficient number of facial images that meet different distances, the image capture device may be instructed to no longer capture facial images.

[0138] The facial images in the above picture group should satisfy the requirement of containing the (complete) facial region of the liveness detection object. Even if the liveness detection object is not a live object, it can be foreseen that it also contains the facial region for use in liveness detection.

[0139] In this embodiment, whether the distance between any two facial images is the same or different can be determined based on the ratio of the region of interest in each facial image to the facial image, and reference can be made to the content in the first embodiment.

[0140] S303: Sending the picture group to the liveness detection end so that the liveness detection end determines the optical flow map corresponding to the picture group; and inputting the optical flow map into the liveness detection model obtained in the first embodiment, and judging whether the liveness detection object is alive according to the output data of the liveness detection model.

[0141] The liveness detection end may be the execution subject of the second embodiment, or other subjects. The content here corresponds to the content of the second embodiment, and will not be repeated here.

[0142] For the contents not fully described in this embodiment, reference may be made to the first or second embodiment.

[0143] In this embodiment, the picture group includes face pictures at different distances. If the face pictures in the picture group are from a living body, different perspective effects will be formed due to the different distances between the living body and the shooting device. This perspective effect can be accurately expressed through the optical flow map. The liveness detection model of this embodiment can perform liveness detection based on the above perspective effect. Inputting the optical flow map into the liveness detection model can accurately detect whether it is a living body, and the liveness detection effect is good and efficient. In this embodiment, the face pictures can be aligned in two stages to generate an optical flow map, so that the generated optical flow map (for the above perspective effect) has a better performance effect, thereby improving the liveness detection effect and efficiency. In this embodiment, the shooting distance of the liveness detection object is adaptive, and prompts are given to make the liveness detection object move, thereby obtaining the special optical flow formed by the liveness portrait during the movement, thereby improving the liveness detection effect and efficiency.

[0144] like Fig. 9 As shown, the fourth embodiment of this specification provides a living body detection model training device, including:

[0145] A sample module 401 is used to obtain a sample set for model training, where the samples in the sample set include positive samples and negative samples, and each sample includes at least two facial images at different distances;

[0146] An optical flow module 403 is used to determine an optical flow map corresponding to each sample;

[0147] The training module 405 is used to train a living body detection model using the optical flow map corresponding to each sample.

[0148] Optionally, determining the optical flow map corresponding to each sample includes:

[0149] For any sample, the facial images contained in the sample are aligned, and the optical flow map corresponding to the sample is determined using the aligned facial images of the sample.

[0150] Optionally, for any sample, aligning the facial images contained in the sample includes:

[0151] For any sample, the first stage alignment is performed on each face image contained in the sample according to the facial key points in each face image contained in the sample;

[0152] According to the machine vision features of each facial image contained in the sample, a second stage alignment is performed on each facial image of the sample after the first alignment.

[0153] Optionally, the machine vision feature includes at least one of a SIFT feature, a HOG feature, a SURF feature, an ORB feature, a LBP feature, and a HAAR feature.

[0154] Optionally, using each facial image after the sample is aligned to determine the optical flow map corresponding to the sample includes:

[0155] Calculate the optical flow of each facial image after the sample is aligned;

[0156] An optical flow map corresponding to the sample is generated according to the optical flows of the facial images after the sample is aligned.

[0157] Optionally, the sample module 401 determines whether the distance between any two facial images is the same or different according to the ratio of the region of interest in each facial image to the facial image.

[0158] Optionally, using the optical flow map corresponding to each sample to train a living body detection model includes:

[0159] The optical flow map corresponding to each sample is used to train a classification model to obtain a living body detection model.

[0160] like Fig.10 As shown, the fifth embodiment of this specification provides a living body detection device, the device is configured with the living body detection model obtained in the first embodiment, including:

[0161] The picture module 501 is used to obtain a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object;

[0162] An optical flow module 503, used to determine an optical flow map corresponding to the picture group;

[0163] The detection module 505 is used to input the optical flow map into the liveness detection model, and determine whether the liveness detection object is a live body according to the output data of the liveness detection model.

[0164] Optionally, obtaining a picture group including at least two face pictures at different distances includes:

[0165] receiving a captured video of a living body detection object sent by a capturing device, decomposing the captured video to obtain a plurality of frames of images, and selecting at least two facial images at different distances from the plurality of frames of images to form a picture group;

[0166] or,

[0167] receiving the last facial picture sent by the photographing device, sending an instruction to the photographing device so that the photographing device issues prompt information, wherein the prompt information is used to prompt the living body detection object to approach or move away from the photographing device; and receiving the next facial picture sent by the photographing device;

[0168] Selecting at least two face pictures at different distances from the received face pictures to form a picture group;

[0169] or,

[0170] Receive the last facial picture sent by the photographing device, determine and send prompt information to the photographing device according to the ratio of the area of ​​interest in the last facial picture to the facial picture, so that the photographing device publishes the prompt information, and the prompt information is used to prompt the living body detection object to approach or move away from the photographing device; receive the next facial picture sent by the photographing device;

[0171] At least two face pictures with different distances are selected from the received face pictures to form a picture group.

[0172] Optionally, the picture module 501 determines whether the distance between any two facial pictures is the same or different according to the ratio of the region of interest in each facial picture to the facial picture.

[0173] Optionally, determining the optical flow map corresponding to the picture group includes:

[0174] The facial images are aligned, and the optical flow graph corresponding to the image group is determined using the aligned facial images.

[0175] Optionally, aligning the facial images includes:

[0176] Performing a first-stage alignment on each of the facial images according to facial key points in each of the facial images;

[0177] According to the machine vision features of each of the facial images, a second stage alignment is performed on each of the facial images after the first alignment.

[0178] Optionally, the machine vision feature includes at least one of a SIFT feature, a HOG feature, a SURF feature, an ORB feature, a LBP feature, and a HAAR feature.

[0179] Optionally, using the aligned facial images to determine the optical flow map corresponding to the image group includes:

[0180] Calculating the optical flow of each of the face images;

[0181] An optical flow map corresponding to the picture group is generated according to the optical flow of each of the facial pictures.

[0182] Optionally, judging whether the liveness detection object is live according to the output data of the liveness detection model includes:

[0183] Whether the liveness detection object is live is determined according to the confidence level output by the liveness detection model.

[0184] Optionally, the output data includes confidence; after the optical flow map is input into the living body detection model, the detection module 505 is further used to:

[0185] The living body detection model is enabled to extract image features of the optical flow map and calculate softmax for the image features, so that the living body detection model determines and outputs the confidence.

[0186] like Fig.11 As shown, the sixth embodiment of this specification provides a living body detection device, including:

[0187] A picture module 601 is used to collect a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object;

[0188] The sending module 603 is used to send the picture group to the liveness detection end so that the liveness detection end determines the optical flow map corresponding to the picture group; and input the optical flow map into the liveness detection model obtained in the first embodiment, and judge whether the liveness detection object is alive according to the output data of the liveness detection model.

[0189] Optionally, obtaining a picture group including at least two face pictures at different distances includes:

[0190] Collecting a video of a liveness detection object, decomposing the video to obtain a plurality of frames of images, and selecting at least two facial images at different distances from the plurality of frames of images to form a picture group;

[0191] or,

[0192] After collecting the last face picture, issuing prompt information, the prompt information is used to prompt the liveness detection object to approach or move away from the shooting device;

[0193] If it is determined that the liveness detection object has moved after the last facial image is collected, collecting the next facial image;

[0194] Selecting at least two face pictures at different distances from the collected face pictures to form a picture group;

[0195] or,

[0196] After collecting the last facial image, determining and publishing prompt information according to the ratio of the region of interest in the last facial image to the current facial image, wherein the prompt information is used to prompt the living body detection object to approach or move away from the shooting device;

[0197] If it is determined that the liveness detection object has moved after the last facial image is collected, collecting the next facial image;

[0198] At least two face pictures at different distances are selected from the collected face pictures to form a picture group.

[0199] The seventh embodiment of the present specification provides a living body detection model training device, including:

[0200] at least one processor;

[0201] as well as,

[0202] a memory communicatively coupled to the at least one processor;

[0203] in,

[0204] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the living body detection model training method described in the first embodiment.

[0205] The eighth embodiment of the present specification provides a living body detection model training device, including:

[0206] at least one processor;

[0207] as well as,

[0208] a memory communicatively coupled to the at least one processor;

[0209] in,

[0210] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor, so that the at least one processor can execute the living body detection method described in the second embodiment.

[0211] The ninth embodiment of the present specification provides a living body detection model training device, including:

[0212] at least one processor;

[0213] as well as,

[0214] a memory communicatively coupled to the at least one processor;

[0215] in,

[0216] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor, so that the at least one processor can execute the living body detection method described in the third embodiment.

[0217] The tenth embodiment of the present specification provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the living body detection model training method described in the first embodiment is implemented.

[0218] The eleventh embodiment of the present specification provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the living body detection method described in the second embodiment is implemented.

[0219] The twelfth embodiment of the present specification provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the living body detection method described in the third embodiment is implemented.

[0220] The above embodiments may be used in combination, and modules with the same name in different embodiments may be the same or different.

[0221] The above describes specific embodiments of the present specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily have to be performed in the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0222] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0223] The apparatus, device, non-volatile computer-readable storage medium and method provided in the embodiments of this specification correspond to each other, and therefore, the apparatus, device, and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the corresponding apparatus, device, and non-volatile computer storage medium will not be repeated here.

[0224] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0225] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0226] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0227] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0228] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification may be in the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the embodiments of this specification may be in the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0229] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0230] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0231] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0232] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0233] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0234] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0235] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0236] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0237] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0238] The above is only an embodiment of this specification and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A method for training a liveness detection model, comprising: Obtain a sample set for model training, wherein the samples in the sample set include positive samples and negative samples, and each sample includes at least two face images at different distances; the face images at different distances are face images at different shooting distances; For any of the samples, performing first-stage alignment on each of the facial images included in the sample according to facial key points in each of the facial images included in the sample; According to the machine vision features of each facial image contained in the sample, performing a second-stage alignment on each facial image of the sample after the first-stage alignment; Determine an optical flow map corresponding to the sample using each facial image after the second stage alignment of the sample; the optical flow map is used to express different perspective effects formed in each of the samples due to different distances at which the facial images are taken; The optical flow map corresponding to each sample is used to train a living body detection model.

2. The method as claimed in claim 1, wherein determining the optical flow map corresponding to each sample comprises: For any sample, the facial images contained in the sample are aligned, and the optical flow map corresponding to the sample is determined using the aligned facial images of the sample.

3. The method as claimed in claim 2, wherein for any sample, aligning the facial images contained in the sample comprises: For any sample, the first stage alignment is performed on each face image contained in the sample according to the facial key points in each face image contained in the sample; According to the machine vision features of each facial image contained in the sample, a second stage alignment is performed on each facial image of the sample after the first alignment.

4. The method as claimed in claim 3, wherein the machine vision feature comprises at least one of a SIFT feature, a HOG feature, a SURF feature, an ORB feature, a LBP feature, and a HAAR feature.

5. The method according to claim 2, wherein determining the optical flow map corresponding to the sample using the facial images after the sample alignment comprises: Calculate the optical flow of each facial image after the sample is aligned; An optical flow map corresponding to the sample is generated according to the optical flows of the facial images after the sample is aligned.

6. The method of claim 1, wherein the distance between any two facial images is determined to be the same or different based on the ratio of the region of interest in each facial image to the facial image.

7. The method according to claim 1, wherein the step of training a living body detection model using the optical flow map corresponding to each sample comprises: The optical flow map corresponding to each sample is used to train a classification model to obtain a living body detection model.

8. A method for detecting a living body, comprising: Acquire a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object; the face pictures at different distances are face pictures at different shooting distances; For any of the picture groups, the facial images included in the picture group are aligned in the first stage according to the facial key points in the facial images included in the picture group; the facial images in the picture group that have been aligned in the first stage are aligned in the second stage according to the machine vision features of the facial images included in the picture group; the optical flow map corresponding to the picture group is determined using the facial images in the picture group that have been aligned in the second stage; the optical flow map is used to express different perspective effects formed in each of the picture groups due to different distances at which the facial areas are photographed; The optical flow map is input into a liveness detection model obtained by any one of claims 1 to 7, and whether the liveness detection object is a live body is determined according to output data of the liveness detection model.

9. The method of claim 8, wherein obtaining a picture group including at least two face pictures at different distances comprises: receiving a captured video of a living body detection object sent by a capturing device, decomposing the captured video to obtain a plurality of frames of images, and selecting at least two facial images at different distances from the plurality of frames of images to form a picture group; or, receiving a previous facial image sent by a photographing device, sending an instruction to the photographing device so that the photographing device issues prompt information, wherein the prompt information is used to prompt the living body detection object to approach or move away from the photographing device; and receiving a next facial image sent by the photographing device; Selecting at least two face pictures at different distances from the received face pictures to form a picture group; or, receiving a previous face picture sent by a photographing device, determining and sending prompt information to the photographing device according to a ratio of an area of ​​interest in the previous face picture to the face picture, so that the photographing device publishes the prompt information, wherein the prompt information is used to prompt the living body detection object to approach or move away from the photographing device; Receiving the next facial image sent by the photographing device; At least two face pictures with different distances are selected from the received face pictures to form a picture group.

10. The method of claim 8, wherein the distance between any two facial images is determined to be the same or different based on the ratio of the region of interest in each facial image to the facial image.

11. The method of claim 8, wherein determining the optical flow map corresponding to the picture group comprises: The facial images are aligned, and the optical flow graph corresponding to the image group is determined using the aligned facial images.

12. The method of claim 11, aligning each of the facial images comprises: Performing a first-stage alignment on each of the facial images according to facial key points in each of the facial images; According to the machine vision features of each of the facial images, a second stage alignment is performed on each of the facial images after the first alignment.

13. The method as claimed in claim 12, wherein the machine vision feature comprises at least one of a SIFT feature, a HOG feature, a SURF feature, an ORB feature, a LBP feature, and a HAAR feature.

14. The method according to claim 11, wherein using the aligned facial images to determine the optical flow map corresponding to the image group comprises: Calculating the optical flow of each of the face images; An optical flow map corresponding to the picture group is generated according to the optical flow of each of the facial pictures.

15. The method according to claim 8, wherein judging whether the liveness detection object is live according to the output data of the liveness detection model comprises: Whether the liveness detection object is live is determined according to the confidence level output by the liveness detection model.

16. The method according to claim 8, wherein the output data includes confidence; after inputting the optical flow map into the living body detection model obtained in any one of claims 1 to 7, the method further comprises: The living body detection model is enabled to extract image features of the optical flow map and calculate softmax for the image features, so that the living body detection model determines and outputs the confidence.

17. A method for detecting a living body, applied to a photographing device, comprising: Collecting a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object; the face pictures at different distances are face pictures at different shooting distances; The picture group is sent to a liveness detection end so that the liveness detection end determines an optical flow map corresponding to the picture group; the optical flow map corresponding to any of the picture groups is determined by performing a first-stage alignment on each face picture included in the picture group according to the facial key points in each face picture included in the picture group; and performing a second-stage alignment on each face picture in the picture group after the first alignment according to the machine vision features of each face picture included in the picture group; and using each face picture after the second-stage alignment of the picture group; the optical flow map is used to express different perspective effects formed in each of the picture groups due to different distances at which the face area is photographed; and the optical flow map is input into a liveness detection model obtained by any one of claims 1 to 7, and judging whether the liveness detection object is live according to the output data of the liveness detection model.

18. The method of claim 17, wherein obtaining a picture group including at least two face pictures at different distances comprises: Collecting a video of a liveness detection object, decomposing the video to obtain a plurality of frames of images, and selecting at least two facial images at different distances from the plurality of frames of images to form a picture group; or, After collecting the last face picture, issuing prompt information, the prompt information is used to prompt the liveness detection object to approach or move away from the shooting device; If it is determined that the liveness detection object has moved after the last facial image is collected, collecting the next facial image; Selecting at least two face pictures at different distances from the collected face pictures to form a picture group; or, After collecting the last facial image, determining and publishing prompt information according to the ratio of the region of interest in the last facial image to the current facial image, wherein the prompt information is used to prompt the living body detection object to approach or move away from the shooting device; If it is determined that the liveness detection object has moved after the last facial image is collected, collecting the next facial image; At least two face pictures at different distances are selected from the collected face pictures to form a picture group.

19. A liveness detection model training device, comprising: A sample module, used to obtain a sample set for model training, wherein the samples in the sample set include positive samples and negative samples, and each sample includes at least two facial images at different distances; the facial images at different distances are facial images at different shooting distances; An optical flow module, for performing a first-stage alignment of each facial image included in the sample according to facial key points in each facial image included in the sample, for any of the samples; According to the machine vision features of each facial image contained in the sample, performing a second-stage alignment on each facial image of the sample after the first-stage alignment; Determine an optical flow map corresponding to the sample using each facial image after the second stage alignment of the sample; the optical flow map is used to express different perspective effects formed in each of the samples due to different distances at which the facial images are taken; The training module is used to train a living body detection model using the optical flow map corresponding to each sample.

20. A liveness detection device, the device being configured with the liveness detection model obtained according to any one of claims 1 to 7, comprising: A picture module, used to obtain a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a liveness detection object; the face pictures at different distances are face pictures at different shooting distances; The optical flow module is used to perform a first-stage alignment of each face picture included in any picture group according to the facial key points in each face picture included in the picture group; perform a second-stage alignment of each face picture in the picture group after the first alignment according to the machine vision features of each face picture included in the picture group; determine an optical flow map corresponding to the picture group using each face picture after the second-stage alignment of the picture group; the optical flow map is used to express different perspective effects formed in each picture group due to different distances at which the face area is photographed; The detection module is used to input the optical flow map into the liveness detection model, and determine whether the liveness detection object is a live body according to the output data of the liveness detection model.

21. A living body detection device, comprising: A picture module, used for collecting a picture group including at least two face pictures at different distances, wherein the face pictures include a face area of ​​a living body detection object; the face pictures at different distances are face pictures at different shooting distances; A sending module, used for sending the picture group to a liveness detection end, so that the liveness detection end determines an optical flow map corresponding to the picture group; the optical flow map corresponding to any of the picture groups is determined by performing a first-stage alignment on each face picture included in the picture group according to the facial key points in each face picture included in the picture group; and performing a second-stage alignment on each face picture in the picture group after the first alignment according to the machine vision features of each face picture included in the picture group; and using each face picture after the second-stage alignment of the picture group; the optical flow map is used to express different perspective effects formed in each of the picture groups due to different distances at which the face area is photographed; and the optical flow map is input into a liveness detection model obtained by any one of claims 1 to 7, and judging whether the liveness detection object is live according to the output data of the liveness detection model.

22. A liveness detection model training device, comprising: at least one processor; as well as, a memory communicatively coupled to the at least one processor; in, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the living body detection model training method described in any one of claims 1 to 7.

23. A living body detection device, comprising: at least one processor; as well as, a memory communicatively coupled to the at least one processor; in, The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the living body detection method according to any one of claims 8 to 16.

24. A living body detection device, comprising: at least one processor; as well as, a memory communicatively coupled to the at least one processor; in, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the living body detection method described in claim 17 or 18.

25. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the liveness detection model training method according to any one of claims 1 to 7.

26. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the living body detection method according to any one of claims 8 to 16.

27. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the liveness detection method according to claim 17 or 18.

Citation Information

Patent Citations

  • Interaction robot intelligent motion detection and control method based on nerve network

    CN107179683A

  • The invention discloses a novel living body detection method

    CN109598242A

  • Method and device for in-vivo examination, storage medium and electronic equipment

    CN111104833A