A method and device for detecting living body based on near infrared camera
By combining visible light and near-infrared image data, using multi-task convolutional neural network and bright pupil effect edge detection algorithm, the problem of distinguishing real faces and fake faces in face recognition is solved, and high-accuracy living body detection is achieved. Improved user experience and detection capabilities.
Patent Information
- Application Number
- CN202010649058.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-08
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-07-08
AI Technical Summary
Existing face recognition technology cannot accurately distinguish between real faces and fake faces, and there is a risk of being attacked by fake faces. Moreover, the living body detection method based on near-infrared light is high in cost and complexity, and cannot recognize printed images of special materials. Poor.
By combining visible light cameras and near-infrared cameras to collect image data, a multi-task convolutional neural network is used to locate the face area, and filter based on factors such as hue, saturation, and brightness in color images and near-infrared images, combined with the bright pupil effect and The edge detection algorithm determines whether it is a real face.
It achieves simple, easy and real-time living body detection with high accuracy, good user experience, no user interaction is required, reduced calculation amount, enhanced detection capability, and improved screening accuracy of near-infrared images.
Smart Images

Figure CN111832464B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a living body detection method and device based on a near-infrared camera, belonging to the field of face recognition. Background Art
[0002] With the rapid development of face recognition technology, its application scope is becoming more and more extensive, and its application in life scenarios includes food, clothing, housing and transportation. However, although the current face recognition technology can identify the identity of a face, it cannot accurately distinguish the authenticity of the input face, and there is a risk of being attacked by forged faces. Common ways to forge faces include the following three: pictures containing user faces, videos containing user faces, and 3D models or masks made using user faces. Therefore, it is necessary to perform liveness detection on the recognized face, that is, to determine whether the recognized face is from a real user, or from a picture, video or other forged face containing the user's face.
[0003] At present, the methods of liveness detection are mainly divided into the following three categories: based on microtexture, based on motion information, and based on multispectrum. Among them, the method based on microtexture is easily affected by light and image resolution, and is easily deceived by video; the method based on motion information requires user interaction, and the user experience is not high; the method based on multispectrum uses the difference in spectral reflectance between skin and other materials for detection. Most of them use near-infrared light, which has strong recognition ability and high accuracy, but has poor recognition ability for printed images of some special materials. In addition, most of the current liveness detection methods based on near-infrared light perform liveness detection by constructing and training deep learning models, but this requires a lot of data and time for training, which is costly and complex. Summary of the invention
[0004] In order to solve the problems existing in the above-mentioned prior art, the present invention provides a method and device for detecting liveness based on a near-infrared camera, and provides a simple and easy method and device for detecting liveness by analyzing the color range of a face and the law of light distribution under different lighting conditions. The technical solution of the present invention is as follows:
[0005] Technical solution 1:
[0006] A method for detecting a living body based on a near infrared camera comprises the following steps:
[0007] Collecting image data, wherein the image data includes a color image obtained by a visible light camera and a near-infrared image obtained by a near-infrared camera;
[0008] Locate the face area on the image data, input the color image and the near-infrared image into the multi-task convolutional neural network respectively, and the multi-task convolutional neural network locates the face area on the above two images. If the face area is successfully located on both images, proceed to the next step; otherwise, end the detection;
[0009] According to the color of the face area in the color image, whether the color image is a real face is judged, and the screening conditions of the pixels are preset, and the screening conditions include three factors: hue, saturation and brightness. The pixels in the face area in the color image are traversed according to the screening conditions; a threshold value of the number of pixels is preset, and the number of pixels that meet the screening conditions is counted. If the number of pixels that meet the conditions exceeds the threshold value, the next step is continued, otherwise the detection is terminated;
[0010] According to the brightness of the face area in the near-infrared image, whether the near-infrared image is a real face is judged, the filtering conditions of the pixels are preset, and the pixels in the face area of the near-infrared image are traversed according to the filtering conditions; the number threshold of the pixels is preset, and the number of pixels that meet the filtering conditions is counted. If the number of pixels that meet the conditions exceeds the number threshold, it is considered that the near-infrared image is a real face; otherwise, the detection is terminated.
[0011] Furthermore, the screening conditions used in the process of determining whether the color image is a real face are specifically: the hue of the pixel point ranges from 0 to 25 or 335 to 360, the saturation ranges from 0.2 to 0.9, and the brightness ranges from 0 to 0.4.
[0012] Furthermore, the screening conditions used in the process of judging whether the near-infrared image is a real face are specifically as follows: traverse the pixel points in the face area of the near-infrared image, and record each visited point as point A; select another point near point A, recorded as point B, and point B is farther from the center of the face than point A; calculate the average values avrA and avrB of the brightness of the pixels in the respective areas of points A and B respectively, and if avrA>avrB, it is considered that point A meets the screening conditions.
[0013] Furthermore, the multi-task convolutional neural network locates the face area on the above two images and also locates the area where the eyes are located; after locating the face area on the image data, it also determines whether the color image and the near-infrared image are real faces based on the bright pupil effect, and the specific steps are:
[0014] Calculate the average brightness of all pixels in the human eye area in the color image and near-infrared image respectively; traverse the pixels in the human eye area in the color image and near-infrared image respectively, and count the number of pixels whose brightness is greater than 1.5 times the average brightness of the human eye area, which are recorded as Sum1 and Sum2 respectively; if Sum1 is greater than 15% of the total number of pixels in the human eye area in the color image and Sum2 is less than 20% of the total number of pixels in the human eye area in the near-infrared image, it is considered that the color image and the near-infrared image are real faces; otherwise, the detection is terminated.
[0015] Furthermore, after locating the face area on the image data, an edge detection algorithm is used to determine whether the near-infrared image is a real face. The specific steps are:
[0016] Find the pixel points that constitute the face contour in the near-infrared image. If the number of pixel points that constitute the face contour is greater than the threshold, it is considered that the near-infrared image is a real face; otherwise, the detection ends.
[0017] Technical Solution 2
[0018] A living body detection device based on a near infrared camera includes a memory and a processor, wherein the memory stores instructions, and the instructions are suitable for being loaded by the processor and executing the following steps:
[0019] Collecting image data, wherein the image data includes a color image obtained by a visible light camera and a near-infrared image obtained by a near-infrared camera;
[0020] Locate the face area on the image data, input the color image and the near-infrared image into the multi-task convolutional neural network respectively, and the multi-task convolutional neural network locates the face area on the above two images. If the face area is successfully located on both images, proceed to the next step; otherwise, end the detection;
[0021] According to the color of the face area in the color image, whether the color image is a real face is judged, and the screening conditions of the pixels are preset, and the screening conditions include three factors: hue, saturation and brightness. The pixels in the face area in the color image are traversed according to the screening conditions; a threshold value of the number of pixels is preset, and the number of pixels that meet the screening conditions is counted. If the number of pixels that meet the conditions exceeds the threshold value, the next step is continued, otherwise the detection is terminated;
[0022] According to the brightness of the face area in the near-infrared image, whether the near-infrared image is a real face is judged, the filtering conditions of the pixels are preset, and the pixels in the face area of the near-infrared image are traversed according to the filtering conditions; the number threshold of the pixels is preset, and the number of pixels that meet the filtering conditions is counted. If the number of pixels that meet the conditions exceeds the number threshold, it is considered that the near-infrared image is a real face; otherwise, the detection is terminated.
[0023] Furthermore, the screening conditions used in the process of determining whether the color image is a real face are specifically: the hue of the pixel point ranges from 0 to 25 or 335 to 360, the saturation ranges from 0.2 to 0.9, and the brightness ranges from 0 to 0.4.
[0024] Furthermore, the screening conditions used in the process of judging whether the near-infrared image is a real face are specifically as follows: traverse the pixel points in the face area of the near-infrared image, and record each visited point as point A; select another point near point A, recorded as point B, and point B is farther from the center of the face than point A; calculate the average values avrA and avrB of the brightness of the pixels in the respective areas of points A and B respectively, and if avrA>avrB, it is considered that point A meets the screening conditions.
[0025] Furthermore, the multi-task convolutional neural network locates the face area on the above two images and also locates the area where the eyes are located; after locating the face area on the image data, it also determines whether the color image and the near-infrared image are real faces based on the bright pupil effect, and the specific steps are:
[0026] Calculate the average brightness of all pixels in the human eye area in the color image and near-infrared image respectively; traverse the pixels in the human eye area in the color image and near-infrared image respectively, and count the number of pixels whose brightness is greater than 1.5 times the average brightness of the human eye area, which are recorded as Sum1 and Sum2 respectively; if Sum1 is greater than 15% of the total number of pixels in the human eye area in the color image and Sum2 is less than 20% of the total number of pixels in the human eye area in the near-infrared image, it is considered that the color image and the near-infrared image are real faces; otherwise, the detection is terminated.
[0027] Furthermore, after locating the face area on the image data, an edge detection algorithm is used to determine whether the near-infrared image is a real face. The specific steps are:
[0028] Find the pixel points that constitute the face contour in the near-infrared image. If the number of pixel points that constitute the face contour is greater than the threshold, it is considered that the near-infrared image is a real face; otherwise, the detection ends.
[0029] The present invention has the following beneficial effects:
[0030] 1. The present invention is simple and easy to implement, and has strong real-time performance; it has a high judgment accuracy and excellent detection capability; it does not require the user to perform actions for interaction, and has a good user experience.
[0031] 2. The present invention performs screening based on the bright pupil effect, which reduces the amount of subsequent calculations and enhances detection capabilities.
[0032] 3. The present invention enhances the screening of near-infrared images, improves the accuracy and enhances the detection capability through edge detection algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flow chart of the present invention;
[0034] Figure 2 This is a schematic diagram of the brightness of the face area;
[0035] Figure 3 To forge a comparison of human eyes in a face captured by visible light and near-infrared light;
[0036] Figure 4 Schematic diagram of the face contour in near-infrared image. DETAILED DESCRIPTION
[0037] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0038] Embodiment 1
[0039] See also Figures 1 to 4 , a living body detection method based on a near infrared camera, comprising the following steps:
[0040] Collecting image data, wherein the image data includes a color image obtained by a visible light camera and a near-infrared image obtained by a near-infrared camera;
[0041] Locate the face area on the image data, input the color image and the near-infrared image into the multi-task convolutional neural network respectively, the multi-task convolutional neural network locates the face area on the above two images, if the face area is successfully located on both images, then proceed to the next step; otherwise, end the detection; when the face is located on the color image but not on the near-infrared image, it means that this is an attack behavior of forging the face, and there is no need to proceed to the next step of detection;
[0042] According to the color of the face area in the color image, whether the color image is a real face is judged, and the screening conditions of the pixels are preset, and the screening conditions include three factors: hue, saturation and brightness. The pixels in the face area in the color image are traversed according to the screening conditions; a number threshold of the pixels is preset, and the number of pixels that meet the screening conditions is counted. If the number of pixels that meet the conditions exceeds the number threshold (in this embodiment, the number threshold is 15% of the number of all pixels in the face area), then proceed to the next step, otherwise the detection is terminated;
[0043] According to the brightness of the face area in the near-infrared image, whether the near-infrared image is a real face is judged, and the filtering conditions of the pixel points are preset. The pixel points in the face area in the near-infrared image are traversed according to the filtering conditions; a pixel number threshold is preset, and the number of pixel points that meet the filtering conditions is counted. If the number of pixel points that meet the conditions exceeds the number threshold (in this embodiment, the number threshold is 50% of the number of all pixel points in the face area), it is considered that the near-infrared image is a real face; otherwise, the detection is terminated.
[0044] Furthermore, the screening conditions used in the process of determining whether a color image is a real face are as follows: the hue of the pixel point ranges from 0 to 25 or 335 to 360, the saturation ranges from 0.2 to 0.9, and the brightness ranges from 0 to 0.4.
[0045] For further information, see Figure 2 , the screening conditions used in the process of judging whether the near-infrared image is a real face are as follows: traverse the pixel points in the face area of the near-infrared image, and record each visited point as point A; select another point near point A, record it as point B, and the point B is farther from the center of the face than point A (in this embodiment, the selection method of point B is: set the ordinate of point B to be the same as that of point A, and the abscissa is offset by several pixels in the direction away from the center of the face); respectively calculate the average values of the brightness of the pixels in the respective areas of points A and B, avrA and avrB; the calculation formula of avrA is as follows:
[0046]
[0047] The area of A and B is a 5*5 square with A and B as the centroid. Here, δ represents the neighborhood of point A, and I(k) represents the point in the neighborhood. Similarly, avrB can be obtained.
[0048] If avrA>avrB, it is considered that the point A meets the screening condition.
[0049] The beneficial effect of this embodiment is that the color image taken by the visible light camera is judged according to the rule that the color of the real face is within a certain range; the near-infrared image taken by the near-infrared camera is judged according to the rule that the light distribution of the portrait is gradually decreasing from the center line of the portrait to both sides. The method is simple and easy to implement, with strong real-time performance; the accuracy rate of judging living bodies is high, and the detection ability is excellent; no user action is required for interaction, and the user experience is good.
[0050] Embodiment 2
[0051] Furthermore, the multi-task convolutional neural network locates the face area on the two images and also locates the area where the eyes are located; after locating the face area on the image data, see Figure 3, and also judge whether the color image and near-infrared image are real faces based on the bright pupil effect (the human eye does not reflect near-infrared as strongly as the image, so the white of the real human eye in the near-infrared image will be darker than that in the color image). The specific steps are:
[0052] The average brightness of all pixels in the human eye area in the color image and the near-infrared image is calculated respectively. In this embodiment, the calculation formula of the average brightness is specifically:
[0053]
[0054] Where δ represents the entire eye area, I(k) represents the brightness value of the pixel in the area, and n represents the number of all pixels in the eye area;
[0055] The pixels in the human eye area of the color image and the near-infrared image are traversed respectively, and the number of pixels whose brightness is greater than 1.5 times the average brightness of the human eye area is counted, which are recorded as Sum1 and Sum2 respectively; if Sum1 is greater than 15% of the total number of pixels in the human eye area of the color image and Sum2 is less than 20% of the total number of pixels in the human eye area of the near-infrared image, the color image and the near-infrared image are considered to be real faces; otherwise, the detection is terminated.
[0056] The improvement of this embodiment is that it determines whether the color image and the near-infrared image are real faces based on the bright pupil effect, and makes a preliminary screening for subsequent judgments, thereby reducing the subsequent calculation amount and enhancing the detection capability.
[0057] Embodiment 3
[0058] Furthermore, after locating the face area on the image data, an edge detection algorithm is used to determine whether the near-infrared image is a real face. The specific steps are:
[0059] See also Figure 4 , find out the pixel points that constitute the face contour in the near-infrared image (based on the open source edge detection algorithm canny). If the number of pixel points that constitute the face contour is greater than the threshold (in this embodiment, the threshold is specifically 50), it is considered that the near-infrared image is a real face; otherwise, the detection is terminated.
[0060] The improvement of this embodiment lies in that the edge detection algorithm is used to enhance the screening of near-infrared images, improve the accuracy, and enhance the detection capability.
[0061] Embodiment 4
[0062] See also Figures 1 to 4 A living body detection device based on a near infrared camera includes a memory and a processor, wherein the memory stores instructions, and the instructions are suitable for being loaded by the processor and executing the following steps:
[0063] Collecting image data, wherein the image data includes a color image obtained by a visible light camera and a near-infrared image obtained by a near-infrared camera;
[0064] Locate the face area on the image data, input the color image and the near-infrared image into the multi-task convolutional neural network respectively, the multi-task convolutional neural network locates the face area on the above two images, if the face area is successfully located on both images, then proceed to the next step; otherwise, end the detection; when the face is located on the color image but not on the near-infrared image, it means that this is an attack behavior of forging the face, and there is no need to proceed to the next step of detection;
[0065] According to the color of the face area in the color image, whether the color image is a real face is judged, and the screening conditions of the pixels are preset, and the screening conditions include three factors: hue, saturation and brightness. The pixels in the face area in the color image are traversed according to the screening conditions; a number threshold of the pixels is preset, and the number of pixels that meet the screening conditions is counted. If the number of pixels that meet the conditions exceeds the number threshold (in this embodiment, the number threshold is 15% of the number of all pixels in the face area), then proceed to the next step, otherwise the detection is terminated;
[0066] According to the brightness of the face area in the near-infrared image, whether the near-infrared image is a real face is judged, and the filtering conditions of the pixel points are preset. The pixel points in the face area in the near-infrared image are traversed according to the filtering conditions; a pixel number threshold is preset, and the number of pixel points that meet the filtering conditions is counted. If the number of pixel points that meet the conditions exceeds the number threshold (in this embodiment, the number threshold is 50% of the number of all pixel points in the face area), it is considered that the near-infrared image is a real face; otherwise, the detection is terminated.
[0067] Furthermore, the screening conditions used in the process of determining whether a color image is a real face are as follows: the hue of the pixel point ranges from 0 to 25 or 335 to 360, the saturation ranges from 0.2 to 0.9, and the brightness ranges from 0 to 0.4.
[0068] For further information, see Figure 2 , the screening conditions used in the process of judging whether the near-infrared image is a real face are as follows: traverse the pixel points in the face area of the near-infrared image, and record each visited point as point A; select another point near point A, record it as point B, and the point B is farther from the center of the face than point A (in this embodiment, the selection method of point B is: set the ordinate of point B to be the same as that of point A, and the abscissa is offset by several pixels in the direction away from the center of the face); respectively calculate the average values of the brightness of the pixels in the respective areas of points A and B, avrA and avrB; the calculation formula of avrA is as follows:
[0069]
[0070] The area of A and B is a 5*5 square with A and B as the centroid. Here, δ represents the neighborhood of point A, and I(k) represents the point in the neighborhood. Similarly, avrB can be obtained.
[0071] If avrA>avrB, it is considered that the point A meets the screening condition.
[0072] The beneficial effect of this embodiment is that the color image taken by the visible light camera is judged according to the rule that the color of the real face is within a certain range; the near-infrared image taken by the near-infrared camera is judged according to the rule that the light distribution of the portrait is gradually decreasing from the center line of the portrait to both sides. The method is simple and easy to implement, with strong real-time performance; the accuracy rate of judging living bodies is high, and the detection ability is excellent; no user action is required for interaction, and the user experience is good.
[0073] Embodiment 5
[0074] Furthermore, the multi-task convolutional neural network locates the face area on the two images and also locates the area where the eyes are located; after locating the face area on the image data, see Figure 3 , and also judge whether the color image and near-infrared image are real faces based on the bright pupil effect (the human eye does not reflect near-infrared as strongly as the image, so the white of the real human eye in the near-infrared image will be darker than that in the color image). The specific steps are:
[0075] The average brightness of all pixels in the human eye area in the color image and the near-infrared image is calculated respectively. In this embodiment, the calculation formula of the average brightness is specifically:
[0076]
[0077] Where δ represents the entire eye area, I(k) represents the brightness value of the pixel in the area, and n represents the number of all pixels in the eye area;
[0078] The pixels in the human eye area of the color image and the near-infrared image are traversed respectively, and the number of pixels whose brightness is greater than 1.5 times the average brightness of the human eye area is counted, which are recorded as Sum1 and Sum2 respectively; if Sum1 is greater than 15% of the total number of pixels in the human eye area of the color image and Sum2 is less than 20% of the total number of pixels in the human eye area of the near-infrared image, the color image and the near-infrared image are considered to be real faces; otherwise, the detection is terminated.
[0079] The improvement of this embodiment is that it determines whether the color image and the near-infrared image are real faces based on the bright pupil effect, and makes a preliminary screening for subsequent judgments, thereby reducing the subsequent calculation amount and enhancing the detection capability.
[0080] Embodiment 6
[0081] Furthermore, after locating the face area on the image data, an edge detection algorithm is used to determine whether the near-infrared image is a real face. The specific steps are:
[0082] See also Figure 4 , find out the pixel points that constitute the face contour in the near-infrared image (based on the open source edge detection algorithm canny). If the number of pixel points that constitute the face contour is greater than the threshold (in this embodiment, the threshold is specifically 50), it is considered that the near-infrared image is a real face; otherwise, the detection is terminated.
[0083] The improvement of this embodiment lies in that the edge detection algorithm is used to enhance the screening of near-infrared images, improve the accuracy, and enhance the detection capability.
[0084] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A living body detection method based on a near infrared camera, characterized in that: The following steps are involved: Collecting image data, wherein the image data includes a color image obtained by a visible light camera and a near-infrared image obtained by a near-infrared camera; Locate the face area on the image data, input the color image and the near-infrared image into the multi-task convolutional neural network respectively, and the multi-task convolutional neural network locates the face area on the above two images. If the face area is successfully located on both images, proceed to the next step; otherwise, end the detection; According to the color of the face area in the color image, determine whether the color image is a real face, preset pixel point screening conditions, the screening conditions include three factors: hue, saturation and brightness, and traverse the pixel points in the face area in the color image according to the screening conditions; A pixel number threshold is preset, and the number of pixels that meet the screening conditions is counted. If the number of pixels that meet the conditions exceeds the threshold, the next step is continued, otherwise the detection is terminated; According to the brightness of the face area in the near-infrared image, determine whether the near-infrared image is a real face, preset the filtering conditions of the pixel points, and traverse the pixel points in the face area in the near-infrared image according to the filtering conditions; A pixel number threshold is preset, and the number of pixels that meet the screening conditions is counted. If the number of pixels that meet the conditions exceeds the threshold, the near-infrared image is considered to be a real face; otherwise, the detection is terminated. The multi-task convolutional neural network locates the face area on the above two images and also locates the area where the human eye is located; after locating the face area on the image data, it is also judged whether the color image and the near-infrared image are real faces based on the bright pupil effect, and the specific steps are: respectively calculating the brightness average of all pixels in the human eye area in the color image and the near-infrared image; respectively traversing the pixels in the human eye area in the color image and the near-infrared image, and respectively counting the number of pixels whose brightness is greater than 1.5 times the average brightness of the human eye area where they are located, and recording them as Sum1 and Sum2 respectively; if Sum1 is greater than 15% of the total number of pixels in the human eye area in the color image and Sum2 is less than 20% of the total number of pixels in the human eye area in the near-infrared image, it is considered that the color image and the near-infrared image are real faces; otherwise, the detection is terminated.
2. A method for detecting living things based on a near infrared camera according to claim 1, characterized in that: The screening conditions used in the process of determining whether the color image is a real face are specifically: the hue of the pixel point ranges from 0 to 25 or 335 to 360, the saturation ranges from 0.2 to 0.9, and the brightness ranges from 0 to 0.
4.
3. A method for detecting living things based on a near infrared camera according to claim 2, characterized in that: The screening conditions used in the process of determining whether the near-infrared image is a real face are as follows: traverse the pixel points in the face area of the near-infrared image, and record each visited point as point A; select another point near point A, record it as point B, and point B is farther from the center of the face than point A; The average values of the brightness of the pixels in the respective areas of points A and B, avrA and avrB, are calculated respectively. If avrA>avrB, it is considered that point A meets the screening condition.
4. The method for detecting living body based on near infrared camera according to claim 1, characterized in that: After locating the face area on the image data, the edge detection algorithm is also used to determine whether the near-infrared image is a real face. The specific steps are as follows: Find the pixel points that constitute the face contour in the near-infrared image. If the number of pixel points that constitute the face contour is greater than the threshold, it is considered that the near-infrared image is a real face; otherwise, the detection ends.
5. A living body detection device based on a near-infrared camera, characterized in that: The invention comprises a memory and a processor, wherein the memory stores instructions, and the instructions are suitable for being loaded by the processor and executing the following steps: Collecting image data, wherein the image data includes a color image obtained by a visible light camera and a near-infrared image obtained by a near-infrared camera; Locate the face area on the image data, input the color image and the near-infrared image into the multi-task convolutional neural network respectively, and the multi-task convolutional neural network locates the face area on the above two images. If the face area is successfully located on both images, proceed to the next step; otherwise, end the detection; According to the color of the face area in the color image, determine whether the color image is a real face, preset pixel point screening conditions, the screening conditions include three factors: hue, saturation and brightness, and traverse the pixel points in the face area in the color image according to the screening conditions; A pixel number threshold is preset, and the number of pixels that meet the screening conditions is counted. If the number of pixels that meet the conditions exceeds the threshold, the next step is continued, otherwise the detection is terminated; According to the brightness of the face area in the near-infrared image, determine whether the near-infrared image is a real face, preset the filtering conditions of the pixel points, and traverse the pixel points in the face area in the near-infrared image according to the filtering conditions; A pixel number threshold is preset, and the number of pixels that meet the screening conditions is counted. If the number of pixels that meet the conditions exceeds the threshold, the near-infrared image is considered to be a real face; otherwise, the detection is terminated. The multi-task convolutional neural network locates the face area on the above two images and also locates the area where the human eye is located; after locating the face area on the image data, it is also judged whether the color image and the near-infrared image are real faces based on the bright pupil effect, and the specific steps are: respectively calculating the brightness average of all pixels in the human eye area in the color image and the near-infrared image; respectively traversing the pixels in the human eye area in the color image and the near-infrared image, and respectively counting the number of pixels whose brightness is greater than 1.5 times the average brightness of the human eye area where they are located, and recording them as Sum1 and Sum2 respectively; if Sum1 is greater than 15% of the total number of pixels in the human eye area in the color image and Sum2 is less than 20% of the total number of pixels in the human eye area in the near-infrared image, it is considered that the color image and the near-infrared image are real faces; otherwise, the detection is terminated.
6. The living body detection device based on a near infrared camera according to claim 5, characterized in that: The screening conditions used in the process of determining whether the color image is a real face are specifically: the hue of the pixel point ranges from 0 to 25 or 335 to 360, the saturation ranges from 0.2 to 0.9, and the brightness ranges from 0 to 0.
4.
7. The living body detection device based on a near infrared camera according to claim 6, characterized in that: The screening conditions used in the process of determining whether the near-infrared image is a real face are as follows: traverse the pixel points in the face area of the near-infrared image, and record each visited point as point A; select another point near point A, record it as point B, and point B is farther from the center of the face than point A; The average values of the brightness of the pixels in the respective areas of points A and B, avrA and avrB, are calculated respectively. If avrA>avrB, it is considered that point A meets the screening condition.
8. The method for detecting living body based on near infrared camera according to claim 5, characterized in that: After locating the face area on the image data, the edge detection algorithm is also used to determine whether the near-infrared image is a real face. The specific steps are as follows: Find the pixel points that constitute the face contour in the near-infrared image. If the number of pixel points that constitute the face contour is greater than the threshold, it is considered that the near-infrared image is a real face; otherwise, the detection ends.
