Face recognition method and device, terminal device and storage medium

By detecting changes in the brightness value of the human eye area, the accuracy of live face recognition in multiple face images is solved, and the image exposure effect is optimized.

CN115984932BActive Publication Date: 2025-12-23XIAN WINGTECH INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211698170.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-28
Publication Date
2025-12-23
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

Existing automatic exposure technology cannot accurately identify live faces when there are multiple faces in an image, resulting in poor exposure results.

Method used

By detecting the brightness value of the human eye area within a preset time period, the changes in the human eye state are judged, a live face is identified, and the image brightness is adjusted according to the brightness value of the live face.

Benefits of technology

When multiple faces are present in an image, the system accurately identifies live faces and optimizes image exposure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115984932B_ABST
    Figure CN115984932B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a face recognition method and device, a terminal device and a storage medium. The method is applied to the terminal device, and includes: obtaining a face image in a preset time period, and determining an eye region from the face image; detecting a luminance value corresponding to the eye region at each unit time, and determining an eye state corresponding to the eye region at each unit time according to the luminance value corresponding to the eye region at each unit time, wherein the unit time is any time in the preset time period; and when the eye state corresponding to the eye region in the preset time period changes, determining a face in which the eye region is located as a live face. The embodiments of the present application accurately recognize a live face in an image, especially in the case that multiple faces exist in the image, thereby providing a basis for subsequent optimization of the image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image recognition, in particular to a face recognition method and device, a terminal device and a storage medium. BACKGROUND

[0002] With the improvement of people's living standards and the popularity of digital devices with cameras, people will take pictures of faces in various different scenes. Automatic exposure is an important technology to improve the shooting effect. The existing automatic exposure technology generally identifies the largest face frame in the image and takes the brightness of this face frame as the basis for automatic exposure. However, in the case of multiple faces in the image, such as a person and an advertisement board containing a face, the live face cannot be identified, resulting in automatic exposure based on the face in the advertisement board, which makes the exposure effect poor. SUMMARY

[0003] The embodiments of the present application disclose a face recognition method and device, a terminal device and a storage medium, which can improve the face recognition effect in the case of multiple faces in an image and accurately identify the live face in the image.

[0004] The first aspect of the embodiments of the present application discloses a face recognition method, which comprises:

[0005] Obtaining a face image in a preset time period and determining a human eye region from the face image;

[0006] Detecting the brightness value corresponding to each unit time of the human eye region, and determining the human eye state corresponding to the human eye region at each unit time according to the brightness value corresponding to each unit time of the human eye region, wherein the unit time is any time in the preset time period;

[0007] When the human eye state corresponding to the human eye region in the preset time period changes, the face where the human eye region is located is determined as a live face.

[0008] As an optional implementation, in the first aspect of the embodiments of the present application, the detection of the brightness value corresponding to each unit time of the human eye region and the determination of the human eye state corresponding to the human eye region at each unit time according to the brightness value corresponding to each unit time of the human eye region comprise:

[0009] Dividing the human eye region into multiple human eye region blocks and determining the brightness value corresponding to each unit time of each human eye region block;

[0010] For each unit time, the number of the human eye region blocks whose corresponding luminance values are in the preset luminance interval is determined as a target number, and the preset luminance interval indicates a luminance interval of a human pupil.

[0011] According to the target number corresponding to the human eye region at each unit time, a human eye state corresponding to the human eye region at each unit time is determined.

[0012] As an optional implementation, in the first aspect of the embodiment, the determining of the human eye state corresponding to the human eye region at each unit time according to the target number corresponding to the human eye region at each unit time comprises:

[0013] A proportion of the target number corresponding to the human eye region at each unit time in a total number of region blocks is determined, and the total number of region blocks is a total number of human eye region blocks into which the human eye region is divided.

[0014] When the proportion of the target number corresponding to the human eye region at a target unit time in the total number of region blocks is greater than a proportion threshold, the human eye state corresponding to the human eye region at the target unit time is determined as an open-eye state.

[0015] When the proportion of the target number corresponding to the human eye region at a target unit time in the total number of region blocks is less than or equal to the proportion threshold, the human eye state corresponding to the human eye region at the target unit time is determined as a closed-eye state, and the target unit time is any unit time.

[0016] As an optional implementation, in the first aspect of the embodiment, when the human eye state corresponding to the human eye region changes in the preset time period, the human face in which the human eye region is located is determined as a living human face, comprising:

[0017] When the human eye state corresponding to the human eye region at any two unit times in the preset time period is an open-eye state and a closed-eye state respectively, it is determined that the human eye state changes in the preset time period, and the human face in which the human eye region is located is determined as a living human face.

[0018] As an optional implementation, in the first aspect of the embodiment, the determining of the human eye region from the human face image comprises:

[0019] The left corner position, the right corner position, the upper eyelid position and the lower eyelid position in the human face image are detected by the human eye recognition model after training.

[0020] The human eye region is determined according to the left eye corner position, the right eye corner position, the upper eyelid position and the lower eyelid position.

[0021] As an optional implementation, in the first aspect of the embodiment, the obtaining of the human face image in the preset time period and the determination of the human eye region from the human face image include:

[0022] The human face image in the preset time period is obtained, and the human face image is subjected to automatic exposure processing.

[0023] The human eye region is determined from the human face image subjected to the automatic exposure processing.

[0024] After the human face in which the human eye region is located is determined as the living human face, the method further includes:

[0025] The brightness of the human face image is adjusted according to the brightness value of the living human face.

[0026] As an optional implementation, in the first aspect of the embodiment, the adjusting of the brightness of the human face image according to the brightness value of the living human face includes:

[0027] In the case where the human face image contains a plurality of living human faces, an image size corresponding to each of the living human faces is detected, and a target living human face with the largest image size is determined.

[0028] The brightness of the human face image is adjusted according to the brightness value of the target living human face.

[0029] The second aspect of the embodiment discloses a human face recognition device, and the device includes:

[0030] The region determination module is configured to obtain a human face image in a preset time period and determine a human eye region from the human face image.

[0031] The brightness detection module is configured to detect a brightness value corresponding to the human eye region at each unit time and determine a human eye state corresponding to the human eye region at each unit time according to the brightness value corresponding to the human eye region at each unit time, the unit time being any time in the preset time period.

[0032] The living body detection module is configured to determine the human face in which the human eye region is located as a living human face when the human eye state corresponding to the human eye region in the preset time period changes.

[0033] The third aspect of the embodiment of the present application discloses a terminal device, comprising a memory and a processor, the memory stores a computer program, and the computer program is executed by the processor to enable the processor to implement any one of the face recognition methods disclosed by the embodiment of the present application.

[0034] The fourth aspect of the embodiment of the present application discloses a computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement a face recognition method disclosed by the embodiment of the present application.

[0035] Compared with the related art, the embodiment of the present application has the following beneficial effects:

[0036] The image containing a face in a preset time period is obtained, the eye region is determined from the face image, the brightness value corresponding to the eye region at each unit time in the preset time period is detected. According to the brightness value corresponding to the eye region at each unit time, the eye state corresponding to the eye region in the face image at each unit time is determined, and in the case that the eye state changes in the preset time period, the face where the eye region is located is determined as a living face, which realizes accurately identifying the living face in the image in the case that there is a face in the image, especially in the case that there are multiple faces, thereby providing a basis for subsequent optimization of the photographed image. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0038] Figure 1 It is an application scenario diagram of the face recognition method in an embodiment;

[0039] Figure 2 It is a flowchart of the face recognition method in an embodiment;

[0040] Figure 3 It is a flowchart of another face recognition method disclosed by an embodiment;

[0041] Figure 4 It is a schematic diagram of an eye region disclosed by an embodiment;

[0042] Figure 5 It is a schematic diagram of the eye region divided into multiple eye region blocks disclosed by an embodiment;

[0043] Figure 6 It is a flowchart of another face recognition method disclosed by an embodiment;

[0044] Figure 7 is a structural schematic diagram of a face recognition device disclosed by an embodiment of the present application;

[0045] Figure 8 is a structural schematic diagram of a terminal device disclosed by an embodiment. DETAILED DESCRIPTION

[0046] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0047] It should be noted that the terms "comprising" and "having" and any variations thereof in the embodiments of the present application and the drawings are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally further include steps or units not listed or can optionally further include other steps or units inherent to the process, method, product or device.

[0048] The embodiments of the present application disclose a face recognition method and device, a terminal device and a storage medium, which can improve the face recognition effect in the case that an image contains multiple faces and accurately recognize a live face in the image. The following will be described in detail respectively.

[0049] Please refer to Figure 1 , Figure 1 is an application scenario diagram of a face recognition method in an embodiment. As shown in Figure 1 , the application scenario diagram can include a terminal device 10 and a user 20, and the terminal device 10 can be a desktop computer, a tablet computer, a notebook computer, a mobile phone or the like. The terminal device 10 can at least include a central processing unit and an image acquisition device. The computer system in the terminal device 10 can be Windows, Linux, IOS or Unix, which is not specifically limited here. The terminal device 10 obtains a face image in a preset time period and determines an eye region from the face image. The terminal device 10 detects a luminance value corresponding to the eye region at each time in the preset time period, determines an eye state corresponding to each time according to the luminance value at each time, and determines a face in which the eye region is located as a live face in the case that the eye state changes in the preset time period.

[0050] Please refer to Figure 2 , Figure 2Fig. 1 is a flowchart of a face recognition method in an embodiment, which can be applied to a terminal device 10 in an application scenario as shown in Fig. 1. As shown in Fig. 1, the method can include the following steps: Figure 1 Figure 2

[0051] 210. Obtain face images in a preset time period, and determine eye regions from the face images.

[0052] In an embodiment of the present application, the terminal device obtains face images in a preset time period, which can be that the terminal device continuously photographs a photographed object in advance through an image acquisition component such as a camera or an electronic eye, and obtains an image containing at least one face in the preset time period, that is, a face image.

[0053] After the terminal device obtains the face images in the preset time period, the terminal device can detect and recognize the face images in the preset time period through a trained eye detection model or directly through an image processing library such as OpenCV containing an image analysis tool, so as to determine eye regions from the face images. The terminal device can use Haar features in a sample face image to train a classifier, and obtain a cascade boosted classifier, which can detect eye regions in a picture.

[0054] In an embodiment of the present application, after the terminal device obtains the face images in the preset time period, the terminal device can obtain a plurality of face images in unit time, and determine eye regions in each face image.

[0055] In some embodiments, the terminal device can output prompt information when obtaining the face images in the preset time period, and the prompt information is used to prompt a user to adjust the terminal device so that an image acquisition device on the terminal device can photograph the face of the user. By prompting the user to adjust the terminal device so that the terminal device can photograph the face of the user, the face image acquisition efficiency can be improved.

[0056] 220. Detect the luminance value corresponding to the eye region in each unit time, and determine the eye state corresponding to the eye region in each unit time according to the luminance value corresponding to the eye region in each unit time, the unit time being any time in the preset time period.

[0057] In an embodiment of the present application, after the terminal device obtains the face images in each unit time in the preset time period and determines the eye regions in each face image, the terminal device can detect the luminance value of the eye region in each face image, so as to detect the luminance value corresponding to the eye region in each unit time. The terminal device determines the eye state corresponding to the eye region in each unit time according to the luminance value corresponding to the eye region in each unit time, wherein the luminance value can be represented by a value in the interval of 0-255.​​

[0058] In the embodiment of the present application, the terminal device can be pre-configured with a plurality of luminance value intervals, each of which can correspond to a different eye state. The terminal device determines the eye state of the eye region at each unit time according to the luminance value interval in which the luminance value corresponding to the eye region at each unit time falls.

[0059] For example, the maximum range of the luminance value corresponding to the eye region is 0-255, with 0 representing the darkest and 255 representing the brightest. The terminal device can be configured with five luminance value intervals, namely interval 1, interval 2, interval 3, interval 4 and interval 5, the luminance value range corresponding to interval 1 is 0-51, the luminance value range corresponding to interval 2 is 52-102, the luminance value range corresponding to interval 3 is 103-153, the luminance value range corresponding to interval 4 is 154-204, and the luminance value range corresponding to interval 5 is 205-255. Since the pupil is darker and the overall brightness is lower in the open-eye state, and there is no pupil and the overall brightness is higher in the closed-eye state. Therefore, the terminal device can set five different eye states corresponding to the five luminance value intervals according to the angle of the open eye. Interval 1 corresponds to the first eye state, interval 2 corresponds to the second eye state, interval 3 corresponds to the third eye state, interval 4 corresponds to the fourth eye state, and interval 5 corresponds to the fifth eye state. Among them, the angle of the open eye is the largest in the first eye state, followed by the second eye state, the third eye state, the fourth eye state and the fifth eye state in turn; and the angle of the open eye is 0 in the fifth eye state, that is, the closed-eye state. The preset time period includes three unit times, and the luminance values corresponding to the three unit times are 25, 30 and 35 respectively. Therefore, the terminal device can determine that the eye state of the eye region at the three unit times is the first eye state.

[0060] 230、When the eye state of the eye region in the preset time period changes, the face in which the eye region is located is determined as a living face.

[0061] In the embodiment of the present application, the terminal device determines whether the eye state of the eye region in the preset time period changes according to the eye state of the eye region at each unit time in the unit time period. If the eye state changes, the terminal device can determine the face in which the eye region is located as a living face; if the eye state does not change, the terminal device determines the face in which the eye region is located as a non-living face.

[0062] In the embodiments of the present application, for judging whether the state of the human eye region corresponding to the human eye changes in the preset time period, the terminal device can judge whether the state of the human eye region corresponding to the human eye at any two adjacent unit instants in the preset time period is different, and if so, the terminal device can judge that the state of the human eye region corresponding to the human eye changes in the preset time period; the terminal device can also judge whether the state of the human eye region corresponding to the human eye at any two unit instants in the preset time period is different, and if so, the terminal device can judge that the state of the human eye region corresponding to the human eye changes in the preset time period; in addition, the terminal device can also judge whether the state of the human eye region corresponding to the human eye at any two unit instants in the preset time period is the specific two states of the human eye, and if so, the terminal device can judge that the state of the human eye region corresponding to the human eye changes in the preset time period, for example, if the state of the human eye region corresponding to the human eye at any two unit instants in the preset time period is the first state and the fifth state respectively, the terminal device can judge that the state of the human eye region corresponding to the human eye changes in the preset time period; if the state of the human eye region corresponding to the human eye at any two unit instants in the preset time period is the second state and the fourth state respectively, the terminal device can judge that the state of the human eye region corresponding to the human eye does not change in the preset time period.

[0063] By using the above embodiments, the live human face in the image can be accurately identified in the case that there is a human face in the image, especially in the case that there are multiple human faces, thereby providing a basis for subsequent optimization of the captured image.

[0064] In some embodiments, the process of obtaining the human face image in the preset time period in step 210 and determining the human eye region from the human face image can include the following steps:

[0065] Obtaining the human face image in the preset time period and performing automatic exposure processing on the human face image;

[0066] Determining the human eye region from the human face image after the automatic exposure processing;

[0067] After step 230 determines the human face where the human eye region is located as a live human face, the following steps are further included:

[0068] Adjusting the brightness of the human face image according to the brightness value of the live human face.

[0069] In the embodiments of the present application, the terminal device can obtain a face image at each unit time within a preset time period, and after obtaining the face image, the terminal device can perform automatic exposure processing on the obtained face image. The terminal device can divide the entire face image into a plurality of blocks, count the brightness value of each block, and give each block a weight. In the face image, the terminal device can identify the face frame included in the face image, and in the case where there are multiple face frames, determine the face frame with the largest size, and give the block where the face frame with the largest size a largest weight, and perform automatic exposure on the face image according to the counted brightness value of each block and the weight of each block. The terminal device determines the eye region of each face from the face image after automatic exposure.

[0070] In the embodiments of the present application, after the terminal device determines the live face in the face image, if the live face is not identified, the brightness of the face image is not adjusted; if the live face is identified, the brightness of the face image can be adjusted according to the brightness value of the identified live face. The terminal device can specifically adjust the brightness of the live face according to the brightness of the live face after automatic exposure processing. If the brightness of the live face after the automatic exposure processing process is the maximum in the face image, the terminal device can not adjust the brightness of the live face; if the brightness of the live face after the automatic exposure processing process is not the maximum in the face image, the terminal device can increase the brightness of the live face.

[0071] By using the above embodiments, the terminal device can perform automatic exposure processing on the obtained face image in advance, and after identifying the live face, adjust the brightness of the face image according to the brightness value of the live face, which can improve the display effect of the face image in advance, and further improve the display effect of the face image according to the identification of the live face.

[0072] In some embodiments, the process of adjusting the brightness of the face image according to the brightness value of the live face can include the following steps:

[0073] In the case where the face image contains multiple live faces, the image size corresponding to each live face is detected, and the target live face with the largest image size is determined;

[0074] Adjust the brightness of the face image according to the brightness value of the target live face.

[0075] In the embodiments of the present application, after the terminal device identifies the live face, the terminal device determines the number of live faces contained in the face image. If the number of live faces identified by the terminal device from the face image is more than one, the terminal device can detect the image size of each live face in the face image, and determine the live face with the largest image size as the target live face. Then the terminal device detects the brightness value of the target live face, and adjusts the brightness of the face image according to the brightness value of the target live face. Specifically, if the brightness of the target live face after the automatic exposure processing process is already the maximum in the face image, the terminal device can not adjust the brightness of the target live face; if the brightness of the target live face after the automatic exposure processing process is not the maximum in the face image, the terminal device can increase the brightness of the target live face.

[0076] By using the above embodiments, the brightness of the face image can be adjusted based on the live face with the largest image size in the case where the face image contains multiple live faces, and the display effect of the face image in the case of multiple live faces is further improved.

[0077] In one embodiment, please refer to Figure 3 , Figure 3 is a flowchart of another face recognition method disclosed by an embodiment. The method can be applied to the terminal device 10 in the application scenario as shown in Figure 1 . As shown in Figure 3 , the method can include the following steps:

[0078] 310, obtaining a face image in a preset time period, and detecting the left corner position, the right corner position, the upper eyelid position and the lower eyelid position of the face image by using the trained eye recognition model.

[0079] In the embodiments of the present application, the terminal device obtains the face image in the preset time period, which can be that the terminal device pre-photographs the photographed object continuously by using the image acquisition components such as the camera and the electronic eye, and obtains the image containing at least one face in the preset time period, that is, the face image.

[0080] In the embodiments of the present application, after the terminal device obtains the face image in the preset time period, the terminal device can detect and recognize the face image in the preset time period by using the trained eye detection model, or directly by using the image processing library containing image analysis tools such as OpenCV, so as to identify the left corner position, the right corner position, the upper eyelid position and the lower eyelid position of each face from the face image. Please refer to Figure 4 , Figure 4 is a schematic diagram of the eye region disclosed by an embodiment. Figure 4The human eye part includes a p1 point as a left corner position of an eye, a p2 point as a right corner position of the eye, a p3 point as an upper eyelid position, and a p4 point as a lower eyelid position.

[0081] 320. Determine the human eye region according to the left corner position of the eye, the right corner position of the eye, the upper eyelid position, and the lower eyelid position.

[0082] In the embodiment of the present application, after the terminal device determines the left corner position of the eye, the right corner position of the eye, the upper eyelid position, and the lower eyelid position on the face, the terminal device determines a quadrilateral region or even a rectangular region on the human eye according to the left corner position of the eye, the right corner position of the eye, the upper eyelid position, and the lower eyelid position corresponding to the face. The quadrilateral region on the face is the human eye region on the face. Please refer to Figure 4 , Figure 4 The rectangular region connecting the left corner position of the eye, the right corner position of the eye, the upper eyelid position, and the lower eyelid position in the human eye region is the human eye region on the face.

[0083] The above is the human eye region corresponding to a face in a face image at a unit time. If the face image at a unit time includes multiple faces, the same method is used to determine the face frame on each face.

[0084] By detecting the left corner position of the eye, the right corner position of the eye, the upper eyelid position, and the lower eyelid position, and using the quadrilateral region constructed according to the four positions as the human eye region, the accuracy of the determined human eye region can be improved, and the influence of the brightness value of other human eye regions on the subsequent live face detection process is reduced as much as possible, and the accuracy of live face recognition is further improved.

[0085] 330. Divide the human eye region into multiple human eye region blocks, and determine the brightness value of each human eye region block at each unit time.

[0086] In the embodiment of the present application, after the terminal device determines the human eye region of the face, the terminal device divides the human eye region on each face into multiple region blocks, that is, human eye region blocks, and detects the brightness value corresponding to each human eye region block divided in the face. Please refer to Figure 5 , Figure 5 The figure is a schematic diagram of the human eye region divided into multiple human eye region blocks disclosed by the embodiment. As shown in Figure 5 The human eye region is divided into a human eye region block 1, a human eye region block 2, a human eye region block 3, a human eye region block 4, a human eye region block 5, and a human eye region block 6.

[0087] 340. For each unit time, the number of human eye region blocks whose brightness value is in a preset brightness interval is determined as a target number, and the preset brightness interval indicates the brightness interval of the pupil of the person.

[0088] In the embodiment of the present application, the terminal device determines, for each unit time face image, whether the luminance value of each eye region block of a person eye region on a face is in a preset luminance interval; if it is in the preset luminance interval, it is considered that the eye region block belongs to the target eye region block; if it is not in the preset luminance interval, it is considered that the eye region block does not belong to the target eye region block. The terminal device counts the number of all target eye region blocks in the eye region, and the obtained number is recorded as the target number. The preset luminance interval is an interval indicating the pupil luminance on the face.

[0089] If there are multiple faces on each unit time face image, the above method is also used to determine the target eye region block on the face and count the target number of the target eye region block on the face.

[0090] 350, according to the target number corresponding to the eye region at each unit time, determine the eye state corresponding to the eye region at each unit time.

[0091] In the embodiment of the present application, for each unit time face image, the target number of the eye region in the unit time face image, that is, the number of eye region blocks with luminance values in the preset luminance interval, is determined to determine the eye state corresponding to the eye region at the unit time. For each unit time, the target number of the eye region in the unit time face image is compared with a preset number threshold. If the target number is greater than the number threshold, it can be determined that the eye region at the unit time corresponds to a person eye state; if the target number is less than or equal to the number threshold, it can be determined that the eye region at the unit time corresponds to another eye state, and the two eye states are different.

[0092] For example, the preset time period includes 3 unit instants, which are unit instant A, unit instant B and unit instant C. Each unit instant corresponds to a face image, so the terminal device obtains 3 face images, each of which includes a face, which is face a. For unit instant A, the terminal device determines an eye region from face a, divides the eye region into 6 eye region blocks, and detects that the luminance values of each eye region block are 25, 30, 35, 200, 210 and 220 respectively. The terminal device presets a luminance value interval of 0-51, so the terminal device counts that the number of eye region blocks in the preset luminance interval is 3. The terminal device compares the target number 3 with the preset number threshold 4. If the target number is less than or equal to the number threshold 4, the eye region corresponds to an open eye state, and if the target number is greater than the number threshold 4, the eye region corresponds to a closed eye state. It can be considered that the eye region in face a corresponds to an open eye state, that is, the eye region in face a corresponds to an open eye state at unit instant A.

[0093] If face b is also included in the face image, the terminal device can count the target number of the eye region in face b at each unit instant by the above method. If the target number of face b is 5 at unit instant A, it can be considered that the eye region in face b corresponds to a closed eye state, at this time, the eye region in face a corresponds to an open eye state and the eye region in face b corresponds to a closed eye state at unit instant A.

[0094] In the embodiment of the present application, the terminal device can also be preconfigured with a plurality of number intervals, each of which can correspond to a different eye state. The terminal device determines the eye state of the eye region at each unit instant according to the number interval in which the target number of the eye region at each unit instant is located.

[0095] For example, the terminal device can set five quantity intervals, i.e., interval 1, interval 2, interval 3, interval 4, and interval 5, the quantity range corresponding to interval 1 is 0-5, the quantity range corresponding to interval 2 is 6-10, the quantity range corresponding to interval 3 is 11-15, the quantity range corresponding to interval 4 is 16-20, and the quantity range corresponding to interval 5 is 21-25. The terminal device can set four different eye states corresponding to the four quantity intervals according to the angle of the open eyes. Interval 1 corresponds to a first eye state, interval 2 corresponds to a second eye state, interval 3 corresponds to a third eye state, and interval 4 corresponds to a fourth eye state. Among them, the angle of the open eyes in the first eye state is the largest, and the angles of the open eyes in the second eye state, the third eye state, and the fourth eye state are sequentially smaller. The angle of the open eyes in the fifth eye state is 0, that is, the closed eye state. The preset time period includes three unit instants, and the target quantity corresponding to the eye region on the face a in the three unit instants is 5, 4, and 3, respectively. Therefore, the terminal device can determine that the eye state of the eye region on the face a in the three unit instants is the first eye state.

[0096] By using the above embodiment, the terminal device can divide the eye region into a plurality of eye region blocks, determine the luminance value of each eye region block, determine the eye state corresponding to the eye region according to the quantity of the eye region blocks in the preset luminance interval, and further improve the accuracy of the determined eye state corresponding to the eye region, thereby improving the accuracy of the live face recognition.

[0097] 360、When the eye state corresponding to the eye region in the preset time period changes, the face where the eye region is located is determined as a live face.

[0098] In one embodiment, please refer to Figure 6 , Figure 6 is a flowchart of another face recognition method disclosed in an embodiment. The method can be applied to the terminal device 10 in the application scenario as shown in Figure 1 . As shown in Figure 6 , the method can include the following steps:

[0099] 610, obtaining a face image in a preset time period, and determining an eye region from the face image.

[0100] 620, dividing the eye region into a plurality of eye region blocks, and determining a luminance value corresponding to each eye region block at each unit instant.

[0101] 630, for each unit instant, determining the quantity of the eye region blocks in the preset luminance interval as the target quantity, the preset luminance interval indicating the luminance interval of the pupil of the person.

[0102] 640, determine a proportion of the target number of the human eye region corresponding to the region block in the total number of region blocks at each unit time, the total number of region blocks being a total number of the human eye region divided into a plurality of human eye region blocks.

[0103] In the embodiment of the present application, the terminal device divides the human eye region into a plurality of human eye region blocks, and counts the luminance values of each human eye region block. The luminance values of each human eye region block are compared with the preset luminance interval respectively, and the number of human eye region blocks whose luminance values are in the preset luminance interval, that is, the target number, is determined. Then the terminal device can calculate the proportion of the target number of the human eye region corresponding to the region block in the total number of region blocks, that is, the proportion of the number of human eye region blocks whose luminance values are in the preset luminance interval in the total number of human eye region blocks divided by the human eye region.

[0104] 650, when the proportion of the target number of the human eye region corresponding to the region block in the total number of region blocks at the target unit time is greater than the proportion threshold, the human eye state of the human eye region corresponding to the target unit time is determined as the open eye state.

[0105] 660, when the proportion of the target number of the human eye region corresponding to the region block in the total number of region blocks at the target unit time is less than or equal to the proportion threshold, the human eye state of the human eye region corresponding to the target unit time is determined as the closed eye state, and the target unit time is any unit time.

[0106] In the embodiment of the present application, for any one unit time, the terminal device can compare the proportion of the target number of the human eye region corresponding to the region block in the total number of region blocks determined with a preset proportion threshold. If the determined proportion is greater than the proportion threshold, it is determined that the human eye state corresponding to the human eye region is the open eye state. If the determined proportion is less than or equal to the proportion threshold, the terminal device can determine that the human eye state corresponding to the human eye region is the closed eye state.

[0107] For example, the terminal device obtains a face image at each unit time within a preset time period, and the face image includes face A and face B. The terminal device determines an eye region a in face A and an eye region b in face B. The terminal device divides the eye region a into six eye region blocks. At the unit time a, the luminance values of the six eye region blocks are 10, 20, 30, 40, 100, and 150 respectively, wherein the luminance value ranges from 0 to 255, 0 is the darkest, and 255 is the brightest. Since the luminance of the pupil of the eye generally falls between 0 and 51, and the pupil accounts for 1 / 3-1 / 4 of the entire eye frame in the open-eye condition, the preset luminance interval is 0-51, and the preset proportion threshold is 1 / 4. Therefore, according to the luminance values of the six eye region blocks divided by the eye region a, the terminal device can determine that the target number of eye region blocks with luminance values in the preset luminance interval is 4, and further determine that the proportion of the target number corresponding to the eye region a in the total number of blocks at the unit time a is 2 / 3. Since 2 / 3 is greater than 1 / 4, the terminal device can determine that the eye state corresponding to the eye region a at the unit time a is the open-eye state. Similarly, the terminal device also divides the eye region b into six eye region blocks. At the unit time a, the luminance values of the six eye region blocks are 10, 200, 230, 240, 100, and 150 respectively. Therefore, according to the luminance values of the six eye region blocks divided by the eye region b, the terminal device can determine that the target number of eye region blocks with luminance values in the preset luminance interval is 1, and further determine that the proportion of the target number corresponding to the eye region b in the total number of blocks at the unit time a is 1 / 6. Since 1 / 6 is less than 1 / 4, the terminal device can determine that the eye state corresponding to the eye region b at the unit time a is the closed-eye state.

[0108] By using the above embodiment, the proportion threshold can be set according to the conventional proportion of the pupil in the eye region, and then the eye state corresponding to the eye region at each unit time can be determined by the size relationship between the proportion of the target number corresponding to the eye region in the total number of blocks at each unit time and the proportion threshold, thereby further improving the accuracy of the eye state determination, and thus improving the accuracy of determining whether it is a live face according to whether the eye state changes.

[0109] 670、When the eye states corresponding to the eye region at any two unit times within the preset time period are the open-eye state and the closed-eye state respectively, it is determined that the eye state changes within the preset time period, and the face where the eye region is located is determined as a live face.

[0110] In the embodiment of the present application, for a human eye region, the terminal device can determine the human eye state of the human eye region at each unit time within a preset time period. If the human eye state of the human eye region at a unit time within the preset time period is an open-eye state and the human eye state of the human eye region at another unit time is a closed-eye state, the terminal device can consider that the human eye state of the human eye region has changed. The terminal device can determine that the face where the human eye region is located is a live face.

[0111] By using the above embodiment, the open-eye state and the closed-eye state of the human eye region at two unit times within a preset time period are respectively determined, so as to detect whether the face blinks within the preset time period, thereby determining whether the face is a live face, and the accuracy of live face recognition is improved.

[0112] Please refer to Figure 7 , Figure 7 is a structural schematic diagram of a face recognition device disclosed in the embodiment of the present application. The face recognition device can be applied to a terminal device 10 in an application scenario as shown in Figure 1 . As shown in Figure 7 , the face recognition device 700 can include a region determination module 710, a brightness detection module 720, and a live detection module 730.

[0113] The region determination module 710 is configured to obtain a face image within a preset time period, and determine a human eye region from the face image.

[0114] The brightness detection module 720 is configured to detect a brightness value corresponding to the human eye region at each unit time, and determine a human eye state of the human eye region at each unit time according to the brightness value corresponding to the human eye region at each unit time, wherein the unit time is any time within the preset time period.

[0115] The live detection module 730 is configured to determine a face where the human eye region is located as a live face when the human eye state of the human eye region within the preset time period changes.

[0116] In some embodiments, the brightness detection module 720 is further configured to:

[0117] divide the human eye region into a plurality of human eye region blocks, and determine a brightness value corresponding to each human eye region block at each unit time;

[0118] for each unit time, determine a target number of human eye region blocks whose brightness values correspond to a preset brightness interval, wherein the preset brightness interval indicates a brightness interval of a pupil of a person.

[0119] According to the target quantity corresponding to the human eye area at each unit time, the human eye state corresponding to the human eye area at each unit time is determined.

[0120] In some embodiments, the brightness detection module 720 is further configured to:

[0121] Determine the proportion of the target quantity corresponding to the human eye area at each unit time in the total quantity of region blocks, the total quantity of region blocks being the total quantity of the human eye area divided into multiple human eye region blocks;

[0122] When the proportion of the target quantity corresponding to the human eye area at the target unit time in the total quantity of region blocks is greater than the proportion threshold, the human eye state corresponding to the human eye area at the target unit time is determined as the open eye state;

[0123] When the proportion of the target quantity corresponding to the human eye area at the target unit time in the total quantity of region blocks is less than or equal to the proportion threshold, the human eye state corresponding to the human eye area at the target unit time is determined as the closed eye state, and the target unit time is any unit time.

[0124] In some embodiments, the living body detection module 730 is further configured to:

[0125] When the human eye state corresponding to the human eye area at any two unit times in the preset time period is the open eye state and the closed eye state respectively, it is determined that the human eye state changes in the preset time period, and the human face where the human eye area is located is determined as a living human face.

[0126] In some embodiments, the region determination module 710 is further configured to:

[0127] Detect the left corner position, the right corner position, the upper eyelid position and the lower eyelid position in the human face image through the trained human eye recognition model;

[0128] Determine the human eye area according to the left corner position, the right corner position, the upper eyelid position and the lower eyelid position.

[0129] In some embodiments, the region determination module 710 is further configured to:

[0130] Obtain the human face image in the preset time period, and perform automatic exposure processing on the human face image;

[0131] Determine the human eye area from the human face image after automatic exposure processing;

[0132] Figure 5 The human face recognition device shown, further comprising:

[0133] The brightness adjustment module 740 is configured to, after determining the face in which the human eye region is located as a living face, adjust the brightness of the face image according to the brightness value of the living face.

[0134] In some embodiments, the brightness adjustment module 740 is further configured to:

[0135] In a case where the face image contains multiple living faces, detecting an image size corresponding to each living face, and determining a target living face with a maximum image size;

[0136] Adjusting the brightness of the face image according to the brightness value of the target living face.

[0137] Please refer to Figure 8 , Figure 8 is a structural schematic diagram of a terminal device according to an embodiment. As shown in Figure 8 , the terminal device 800 can include:

[0138] A memory 810 storing executable program codes.

[0139] A processor 820 coupled with the memory 810.

[0140] The processor 820 invokes the executable program codes stored in the memory 810 to execute any of the face recognition methods disclosed in the embodiments of the present application.

[0141] It should be noted that Figure 8 the terminal device shown in the figure can also include a power supply, input keys, a camera, a speaker, a screen, an RF circuit, a Wi-Fi module, a Bluetooth module, and other components not shown, which will not be described herein.

[0142] The embodiments of the present application disclose a computer readable storage medium storing a computer program, wherein the computer program causes a computer to execute any of the face recognition methods disclosed in the embodiments of the present application.

[0143] The embodiments of the present application disclose a computer program product including a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute any of the face recognition methods disclosed in the embodiments of the present application.

[0144] It should be understood that every feature, structure, or characteristic described herein is within a preferred embodiment of the present application. It should be noted that the features, structures, or characteristics described in connection with one embodiment can be combined in any manner with features, structures, or characteristics of other embodiments. For the purposes of the present application, the phrase "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described is included in at least one embodiment of the present application. Thus, appearances of the phrases "in one embodiment" or "in an embodiment" not necessarily refer to the same embodiment. Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It will be appreciated by persons skilled in the art that the embodiments described herein represent preferred embodiments of the present application. The features, structures, or characteristics described in connection with one embodiment can be combined in any manner with features, structures, or characteristics of other embodiments. The skilled person will also appreciate that the described embodiments are optional and that the described acts and modules are not necessarily required for the present application.

[0145] In various embodiments of the present application, it should be understood that the magnitude of the serial number of the above processes does not mean the inevitable sequence of execution, and the execution sequence of the processes should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0146] The units described above as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. can be located in one place, or can be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0147] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0148] The integrated unit described above, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer accessible memory. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a memory and includes a number of steps for enabling a computer device (which can be a personal computer, a server or a network device, etc., and specifically can be a processor in the computer device) to execute the above-mentioned method of each embodiment of the present application.

[0149] Those skilled in the art can understand that all or part of the steps of various methods in the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer readable storage medium, including Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM) or other optical disk storage, magnetic disk storage, magnetic tape storage, or any other medium that can be used to carry or store data in a computer readable manner.

[0150] The face recognition method, device, terminal equipment and storage medium disclosed in the embodiments of the present application are described in detail above, and specific examples are applied in this paper to describe the principles and implementation modes of the present application. The above embodiment is only used to help understand the method and core idea of the present application. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed. In summary, the content of the specification should not be understood as a limitation of the present application.

Claims

1. A face recognition method, characterized by, The method comprises: obtaining a face image in a preset time period, and determining an eye region from the face image; detecting a luminance value corresponding to the eye region at each unit time, and determining an eye state corresponding to the eye region at each unit time according to the luminance value corresponding to the eye region at each unit time, the unit time being any time in the preset time period; when the eye state corresponding to the eye region in the preset time period changes, determining a face in which the eye region is located as a living face; adjusting the luminance of the face image according to the luminance value of the living face; wherein the obtaining of the face image in the preset time period and the determination of the eye region from the face image comprise: obtaining a face image in a preset time period, and performing automatic exposure processing on the face image; and determining an eye region from the face image after automatic exposure processing; the adjusting of the luminance of the face image according to the luminance value of the living face comprises: when the face image contains multiple living faces, detecting an image size corresponding to each living face, and determining a target living face with the largest image size; and adjusting the luminance of the face image according to the luminance value of the target living face.

2. The method of claim 1, wherein, the detection of the luminance value corresponding to the eye region at each unit time, and the determination of the eye state corresponding to the eye region at each unit time according to the luminance value corresponding to the eye region at each unit time, comprises: dividing the eye region into multiple eye region blocks, and determining a luminance value corresponding to each eye region block at each unit time; for each unit time, determining a target number of eye region blocks whose luminance values correspond to a preset luminance interval, the preset luminance interval indicating a luminance interval of a pupil of a person; determining the eye state corresponding to the eye region at each unit time according to the target number corresponding to the eye region at each unit time.

3. The method of claim 2, wherein, the determination of the eye state corresponding to the eye region at each unit time according to the target number corresponding to the eye region at each unit time, comprises: determining a proportion of the target number corresponding to the eye region in a total number of region blocks at each unit time, the total number of region blocks being a total number of the eye region divided into multiple eye region blocks; when the proportion of the target number corresponding to the eye region in the total number of region blocks at a target unit time is greater than a proportion threshold, determining an open-eye state of the eye state corresponding to the eye region at the target unit time; when the proportion of the target number corresponding to the eye region in the total number of region blocks at a target unit time is less than or equal to the proportion threshold, determining a closed-eye state of the eye state corresponding to the eye region at the target unit time, the target unit time being any unit time.

4. The method of claim 3, wherein, When the human eye state corresponding to the human eye region in the preset time period changes, the human face in which the human eye region is located is determined as a living human face, comprising: When the human eye state corresponding to the human eye region in any two unit instants in the preset time period is respectively an open-eye state and a closed-eye state, it is determined that the human eye state changes in the preset time period, and the human face in which the human eye region is located is determined as a living human face.

5. The method of claim 1, wherein, The human eye region is determined from the human face image, comprising: The left corner of the eye position, the right corner of the eye position, the upper eyelid position and the lower eyelid position in the human face image are detected by the human eye recognition model after training; The human eye region is determined according to the left corner of the eye position, the right corner of the eye position, the upper eyelid position and the lower eyelid position.

6. A face recognition apparatus characterized by comprising: The device comprises: The region determination module is used to obtain the human face image in a preset time period, and determine the human eye region from the human face image; The brightness detection module is used to detect the brightness value corresponding to the human eye region at each unit instant, and determine the human eye state corresponding to the human eye region at each unit instant according to the brightness value corresponding to the human eye region at each unit instant, the unit instant being any instant in the preset time period; The living body detection module is used to determine the human face in which the human eye region is located as a living human face when the human eye state corresponding to the human eye region in the preset time period changes; The brightness adjustment module is used to adjust the brightness of the human face image according to the brightness value of the living human face; The region determination module is specifically used to obtain the human face image in a preset time period, and perform automatic exposure processing on the human face image; and determine the human eye region from the human face image after automatic exposure processing; The brightness adjustment module is specifically used to detect the image size corresponding to each living human face when the human face image contains multiple living human faces, and determine a target living human face with the largest image size; and adjust the brightness of the human face image according to the brightness value of the target living human face.

7. A terminal device, characterized by comprising: The terminal device comprises a memory and a processor, the memory stores a computer program, and the computer program is executed by the processor to enable the processor to implement the method of any one of claims 1 to 5.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Living body detection method and device based on blink, readable storage medium and equipment

    CN111860056A

  • Sleeping face recognition device

    JP2013120954A