Living body detection method, device, equipment and medium

By analyzing the eye status parameters in the user's facial image, automatically counting the number of blinks and sending alarm information, the problem of vision damage when children are unsupervised is solved, and accurate and timely reminding users of their eyes health is achieved.

CN119723687APending Publication Date: 2025-03-28BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411811418.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

Children's long-term viewing of videos can lead to vision damage, and the existing technology cannot effectively monitor and remind children to use their eyes correctly when they are unsupervised.

Method used

By obtaining the user's facial image, using the open-close state parameters of the eyes for analysis, automatically counting the number of blinks. When the number of blink abnormalities reaches the preset number, an alarm message is sent to remind the user to pay attention to eye health.

Benefits of technology

It realizes accurate and timely reminders of users' eye fatigue, reduces the cost of manual reminders, and ensures users' healthy eyes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723687A_ABST
    Figure CN119723687A_ABST
Patent Text Reader

Abstract

The invention provides a living body detection method and device, equipment and a medium, and the method comprises the steps: obtaining at least one to-be-detected video, and enabling the to-be-detected video to comprise a plurality of face images of a user; based on the four positions of the same eye in the face images, determining eye parameters corresponding to each face image, and when a first difference between a first eye parameter corresponding to the first target face image and a second eye parameter corresponding to the second target face image is greater than or equal to a first threshold value, determining that a blink occurs. And when the total number of blinking times in one to-be-detected video is smaller than the first number of times threshold value or larger than the second number of times threshold value, it is determined that blinking abnormity occurs once. And when the number of times of abnormal blinking in all the to-be-detected videos reaches a first preset number of times, asthenopia of the user is determined, and first alarm information is sent. The eye fatigue can be accurately and timely reminded, the labor cost of manual reminding can be reduced, and healthy eye use of the user is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to a method, device, equipment and medium for detecting a living body. Background Art

[0002] As electronic devices become more and more popular, the time users spend using them is also increasing. More and more users will stare at the device screen for a long time to watch videos, which will damage their eyesight and cause vision loss. Especially for children, their vision will gradually develop when they are 1-6 years old, and will be basically fully developed at the age of 6, with most of them reaching 1.0. If children watch videos for a long time, it will seriously affect their vision development. When users watch videos, they often do not blink for a long time due to excessive concentration, or they may blink too many times due to eye discomfort. Blinking too much or too little will cause eye fatigue and damage vision.

[0003] In the related art, other people, such as parents, can only be relied upon to urge moviegoers, such as children, to pay attention to and protect their eyes.

[0004] However, when there is no parent around, children cannot use their eyes properly and vision damage still exists. Therefore, providing a suitable liveness detection technology to monitor the user's eye health has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of this, the purpose of this application is to provide a liveness detection method, device, equipment and medium, which can not only realize accurate and timely reminders of eye fatigue, but also reduce the labor cost of manual reminders and ensure the healthy use of users' eyes. The specific scheme is as follows:

[0006] On the one hand, the present application provides a method for detecting a living body, comprising:

[0007] Acquire at least one video to be detected; the video to be detected includes multiple facial images of a user; the facial images are obtained by the first device capturing the user's face when the user watches a video through a video software in the first device;

[0008] For each of the facial images, eye parameters corresponding to each of the facial images are determined based on a first position, a second position, a third position, and a fourth position of the same eye in the facial image; the first position and the second position are respectively located at the upper boundary line and the lower boundary line of the eye; the third position and the fourth position are respectively located at the intersection of the upper boundary line and the lower boundary line; the eye parameters are used to indicate the open or closed state of the eye;

[0009] When a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold, determining that a blink occurs; and a first moment corresponding to the first target facial image is before a second moment corresponding to the second target facial image;

[0010] When the total number of blinks in the video to be detected is less than the first number threshold, or greater than the second number threshold, it is determined that an abnormal blink occurs; and the second number threshold is greater than the first number threshold;

[0011] When the number of abnormal blinking in all the videos to be detected reaches a first preset number, it is determined that the user has eye fatigue and a first alarm message is sent.

[0012] Optionally, when a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold, determining that a blink occurs includes:

[0013] When the first difference between the first eye parameter corresponding to the first target facial image and the second eye parameter corresponding to the second target facial image is greater than or equal to the first threshold, and the second difference between the second eye parameter and the third eye parameter corresponding to the third target facial image is greater than or equal to the second threshold, it is determined that a blink has occurred; the third moment corresponding to the third target facial image is located after the second moment.

[0014] Optionally, when the number of abnormal blinking in all the videos to be detected reaches a first preset number, determining that the user is suffering from eye fatigue and sending a first alarm message include:

[0015] When the number of abnormal blinking in all the videos to be detected reaches a first preset number, determining that the user has eye fatigue, and determining the account information logged in to the video software;

[0016] Determine a device identifier of a second device based on the account information; the second device is a device that logs into a social platform through the account information; the social platform has an application associated with the video software;

[0017] The first alarm information is sent to the second device based on the device identifier; the first alarm information is used to issue an alarm through the application.

[0018] Optionally, the method further comprises:

[0019] When the number of abnormal blinking in all the videos to be detected reaches a second preset number and the play mode switching control of the video software is in an open state, the video is switched from the video play mode to the audio play mode; the second preset number is greater than the first preset number.

[0020] Optionally, the method further comprises:

[0021] Determine a target video to be detected; the target video to be detected is the video to be detected with the latest acquisition time among all the videos to be detected;

[0022] When the first difference is less than the eye closing threshold and the second eye parameter is less than the eye closing parameter, determining that an eye closing occurs;

[0023] If the total number of eye closure times in the target video to be detected is greater than the third number threshold, it is determined that the user has closed his eyes for a long time, so that the video software stops playing the video.

[0024] Optionally, the method further comprises:

[0025] Determining an image eye distance between two eyes in the facial image, and a target real eye distance of the user;

[0026] Determine the distance between the eye and the first device based on the image eye distance, the focal length of the camera in the first device, and the target real eye distance;

[0027] Determining whether the distance is less than a preset distance;

[0028] If the distance is less than the preset distance, a second warning message is sent.

[0029] Optionally, determining the target real eye distance of the user includes:

[0030] Extracting features from the facial image to obtain facial features of the facial image;

[0031] determining a target age of the user based on the facial features;

[0032] Based on the corresponding relationship between age and the real eye distance, a target real eye distance corresponding to the target age is determined.

[0033] On the other hand, an embodiment of the present application provides a living body detection device, comprising:

[0034] A first acquisition unit is used to acquire at least one video to be detected; the video to be detected includes multiple facial images of a user; the facial images are acquired by the first device capturing the user's face when the user watches a video through a video software in the first device;

[0035] A first determining unit is used to determine, for each of the facial images, eye parameters corresponding to each of the facial images based on a first position, a second position, a third position, and a fourth position of the same eye in the facial image; the first position and the second position are respectively located at an upper boundary line and a lower boundary line of the eye; the third position and the fourth position are respectively located at two end intersections of the upper boundary line and the lower boundary line; the eye parameters are used to indicate an open or closed state of the eye;

[0036] a second determining unit, configured to determine that a blink occurs when a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold; and a first moment corresponding to the first target facial image is before a second moment corresponding to the second target facial image;

[0037] A third determination unit is used to determine that an abnormal blink occurs when the total number of blinks in the video to be detected is less than a first number threshold, or greater than a second number threshold; and the second number threshold is greater than the first number threshold;

[0038] The sending unit is used to determine that the user has eye fatigue and send a first alarm message when the number of abnormal blinking in all the videos to be detected reaches a first preset number.

[0039] In another aspect, an embodiment of the present application provides a computer device, the computer device comprising a processor and a memory:

[0040] The memory is used to store program codes and transmit the program codes to the processor;

[0041] The processor is configured to execute the method described above according to the instructions in the program code.

[0042] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method described in the above aspects.

[0043] The embodiment of the present application provides a method, device, equipment and medium for detecting a living body, obtaining at least one video to be detected, wherein the video to be detected includes multiple facial images of a user, and the facial images are obtained by collecting the user's face by the first device when the user watches the video through the video software in the first device. For each facial image, based on the first position, second position, third position and fourth position of the same eye in the facial image, the eye parameters corresponding to each facial image are determined, the first position and the second position are respectively located at the upper boundary line and the lower boundary line of the eye; the third position and the fourth position are respectively located at the intersection of the two ends of the upper boundary line and the lower boundary line; the eye parameters are used to indicate the open and closed state of the eyes. When the first difference between the first eye parameter corresponding to the first target facial image and the second eye parameter corresponding to the second target facial image is greater than or equal to the first threshold, it indicates that the user's eyes change from an open state to a closed state, that is, it can be determined that a blink has occurred; wherein the first moment corresponding to the first target facial image is before the second moment corresponding to the second target facial image. When the total number of blinks in a video to be detected is less than the first count threshold, or greater than the second count threshold, it means that the user blinks too little or too much, and is not within the normal number range, then it is determined that a blink abnormality has occurred, and the second count threshold is greater than the first count threshold. When the number of blink abnormalities in all videos to be detected reaches the first preset number, it means that the total number of blinks of the user is not within the normal number range after multiple occurrences, then it can be determined that the user has eye fatigue, and a first alarm message is sent, and the first alarm message can be used to remind the user to pay attention to eye health. In this way, by collecting the user's facial image, the number of blinks can be automatically counted, and then when it is determined that eye fatigue has occurred, the user can be warned in time, without the need for manual reminders for users watching the video, which can not only achieve accurate and timely reminders of eye fatigue, but also reduce the labor cost of manual reminders, and ensure the user's healthy eyes. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0045] Figure 1 A schematic diagram of a flow chart of a living body detection method provided in an embodiment of the present application is shown;

[0046] Figure 2 A schematic diagram showing an eye in an open state and a closed state provided by an embodiment of the present application is shown;

[0047] Figure 3 A schematic diagram showing a change in eye aspect ratio provided by an embodiment of the present application is shown;

[0048] Figure 4 A schematic diagram showing another eye in an open state and a closed state provided by an embodiment of the present application is shown;

[0049] Figure 5 A schematic diagram of an opening interface of a video software of an electronic device provided by an embodiment of the present application is shown;

[0050] Figure 6 A structural block diagram of a living body detection device provided in an embodiment of the present application;

[0051] Figure 7 A structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below with reference to the accompanying drawings.

[0053] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present application. Therefore, the present application is not limited to the specific embodiments disclosed below.

[0054] The liveness detection method provided in the embodiment of the present application can be implemented by a computer device, which can be a terminal device or a server, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Terminal devices include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, etc. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions on this.

[0055] For ease of understanding, a liveness detection method, device, equipment and medium provided in an embodiment of the present application are described in detail below with reference to the accompanying drawings.

[0056] refer to Figure 1 As shown, it is a flow chart of a liveness detection method provided in an embodiment of the present application. The method can be executed by a computer device. In this embodiment, the computer device is taken as a server as an example for explanation. The method can include the following steps.

[0057] S101: Obtain at least one video to be detected.

[0058] Specifically, the video to be detected may be a video that needs to be subjected to liveness detection, such as blink detection. The video to be detected may include multiple facial images of the user, and the facial image may be understood as an image reflecting the facial contour of the user, and the facial image may uniquely identify the user. The video to be detected may be a video obtained by photographing the face of the user.

[0059] In order to detect whether the user blinks normally while watching a video, the user's facial image can be collected while the user is watching the video. That is, the facial image is obtained by the first device collecting the user's face when the user watches the video through the video software in the first device.

[0060] That is, video software is installed on the first device, and the video software is used to play videos, and the videos may be, for example, movies, TV series, cartoons, or homemade short videos, etc. When the user opens the video software on the first device to watch a video, the user's face can be photographed through the camera on the first device to obtain a video to be detected, so that the facial changes of the user when watching the video, such as whether blinking occurs, can be reflected in the video to be detected.

[0061] In practical applications, the acquisition time or acquisition cycle of the video to be detected can be set, and when the acquisition time or acquisition cycle is reached, the user's face is photographed to obtain the video to be detected. For example, the acquisition cycle can be set to detect once per minute, and then one video to be detected can be obtained per minute. The number of videos to be detected can be one or more.

[0062] S102, for each facial image, determining eye parameters corresponding to each facial image based on a first position, a second position, a third position and a fourth position of a same eye in the facial image.

[0063] For each facial image, the server may determine a first position, a second position, a third position, and a fourth position located on the same eye in the facial image, wherein the first position and the second position are located at an upper boundary line and a lower boundary line of the eye, respectively.

[0064] The server can use the position of any point on the upper boundary line of the eye as the first position, and the position of any point on the lower boundary line as the second position. The first position can represent the approximate position of the upper boundary line of the eye. If the first position changes, it means that the upper boundary line of the eye has changed, such as blinking. Similarly, the second position can represent the approximate position of the lower boundary line of the eye. When the user blinks, the position of the lower boundary line will also change slightly, that is, the second position will change.

[0065] The third position and the fourth position are located at the intersection of the upper boundary line and the lower boundary line, respectively. That is, the upper boundary line and the lower boundary line of the eye converge at both ends to form two intersections, and the positions of the two intersections can be used as the third position and the fourth position. In short, the third position and the fourth position are located at the two corners of the same eye.

[0066] refer to Figure 2 As shown, it is a schematic diagram of an eye in an open state and a closed state provided by an embodiment of the present application. In (a), when the eye is in the open state, the first position P1 is located directly above the eyeball, the second position P2 is located directly below the eyeball, the third position P3 is located at the leftmost intersection of the eye, and the fourth position P4 is located at the rightmost intersection of the eye. At this time, the distance between the first position P1 and the second position P2 is large. In (b), when the eye is in the closed state, the distance between the first position P1 and the second position P2 is significantly reduced.

[0067] For each facial image, the server may calculate the eye parameter corresponding to each facial image based on the first position, the second position, the third position and the fourth position, that is, one facial image corresponds to one eye parameter.

[0068] The eye parameter can be used to indicate the open or closed state of the eye, that is, the value of the eye parameter can indicate whether the eye is open or closed. In the process of calculating the eye parameter, the vertical distance can be calculated based on the difference between the first position and the second position in the vertical direction, and the vertical distance is the length of an eye. The horizontal distance is calculated based on the difference between the third position and the fourth position in the horizontal direction, and the horizontal distance is the width of the eye. The ratio between the vertical distance and the horizontal distance can be recorded as the eye aspect ratio, and the eye aspect ratio can be used as the eye parameter.

[0069] For example, the eye aspect ratio can be expressed as:

[0070]

[0071] Among them, EAR is the eye aspect ratio, P1 is the first position, P2 is the second position, P3 is the third position, P4 is the fourth position, ‖P1-P2‖ is the vertical distance, and ‖P3-P4‖ is the horizontal distance.

[0072] When the eyes are open, the eye aspect ratio is relatively large, for example, around 0.25, and when the eyes are closed, the eye aspect ratio is relatively small, for example, around 0.07. Figure 3 As shown, it is a schematic diagram of the change of the eye aspect ratio provided in an embodiment of the present application, where the horizontal axis represents time and the vertical axis represents the eye aspect ratio. When a blink occurs near time t, the eye aspect ratio drops rapidly from about 0.25 to about 0.07.

[0073] As an example, the second position may be located directly below the first position, that is, the horizontal coordinates of the second position and the first position may be the same. Figure 1 As shown, in this way, the vertical distance determined based on the first position and the second position can be directly used to represent the longitudinal size of the eye, and the value change of the vertical distance when the eyes are in the open state and the closed state is most obvious, the value difference is the largest, and the eye parameters are larger, so that it is possible to more accurately determine whether blinking occurs.

[0074] In addition, the eye parameter may also be the sum of the vertical distance and the horizontal distance. In short, the specific mathematical expression of the eye parameter is not limited here, as long as the change of the eye parameter can reflect the change of opening and closing of the eye.

[0075] In a possible implementation, in order to improve the accuracy of blink judgment, more positions can be determined on the eye. The first position and the second position can both be M, where M is an integer greater than 1, and the eye parameter is calculated based on the M first positions, the M second positions, the third position, and the fourth position.

[0076] Among them, the M first positions can be evenly distributed on the upper boundary line or unevenly distributed, and the M second positions can be evenly distributed on the lower boundary line or unevenly distributed. The M first positions and the M second positions are calculated in pairs, and a total of M vertical distances can be obtained. The eye parameters can be calculated based on the M vertical distances and one horizontal distance. In other words, one first position will only be calculated with one second position.

[0077] refer to Figure 4 , which is a schematic diagram of another eye in an open state and a closed state provided by an embodiment of the present application, when M is 2, in (a), the eye is in an open state, with two first positions P2 and P6, both located at the upper boundary line, two second positions P2 and P6, both located at the lower boundary line, and a third position P3 and a fourth position P4. In (b), the eye is in a closed state.

[0078] As an example, when M is 2, the eye aspect ratio can be expressed as:

[0079]

[0080] Among them, EAR is the eye aspect ratio, P1 and P5 are two first positions, P2 and P6 are two second positions, P3 is the third position, P4 is the fourth position, ‖P1-P2‖ is the first distance, ‖P5-P6‖ is also the first distance, and ‖P3-P4‖ is the second distance.

[0081] In this way, when calculating eye parameters, calculations can be performed based on more vertical distances, that is, more positions are determined for each boundary line of the eye, and more pairs of first positions and second positions are determined. Compared with only one pair of first positions and second positions, more pairs of position changes can better fit the actual changes of the eyes, and can reduce the impact of measurement errors, improve the calculation accuracy of eye parameters, and thereby improve the accuracy of blink judgment.

[0082] S103: When a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold, determine that a blink occurs.

[0083] The first moment corresponding to the first target facial image is before the second moment corresponding to the second target facial image. Specifically, the first target facial image is any one of the multiple facial images, and the second target facial image is another one of the multiple facial images. The moment corresponding to the first target facial image is the first moment, and the moment corresponding to the second target facial image is the second moment. The first moment is before the second moment, that is, in chronological order, the second target facial image is an image after the first target facial image. In addition, the time interval between the first moment and the second moment is not limited here.

[0084] The eye parameters corresponding to the first target facial image may be recorded as first eye parameters, the eye parameters corresponding to the second target facial image may be recorded as second eye parameters, and the difference between the first eye parameters and the second eye parameters may be recorded as a first difference.

[0085] The first threshold may be a preset threshold, which is the minimum change in eye parameters that can be used to determine when a blink occurs. If the first difference is not less than the first threshold, it means that the first difference is relatively large, and is greater than the minimum change when blinking, indicating that there is a relatively large difference between the first eye parameter and the second eye parameter, and further indicating that the state of the eye has changed between open and closed, and it can be determined that a blink has occurred. Figure 3 As shown, the eye aspect ratio changes significantly around time t, and a blink occurs.

[0086] S104: When the total number of blinks in the video to be detected is less than the first count threshold or greater than the second count threshold, it is determined that a blink abnormality occurs.

[0087] If it can be determined whether a blink occurs between every two facial images, the total number of blinks in the video to be detected can be counted and recorded as the total number of blinks. For example, if the total number of blinks is 10, it means that the user blinked 10 times in total in the video to be detected.

[0088] The first count threshold may be a pre-set threshold, which represents the minimum number of blinks that the user should have within the duration of the video to be detected. The second count threshold may also be a pre-set threshold, which is greater than the first count threshold, and which represents the maximum number of blinks that the user should have within the duration of the video to be detected. In other words, if the total number of blinks of the user is within the range formed by the first count threshold and the second count threshold, it means that the user's blinking is normal.

[0089] If the total number of blinks in the video to be detected is not within the range, that is, the total number of blinks is less than the first count threshold, or greater than the second count threshold, it means that the user's blinks are too few or too many, and the user's eyes are likely to be uncomfortable, then it is determined that an abnormal blink has occurred.

[0090] S105: When the number of abnormal blinking in all videos to be detected reaches a first preset number, it is determined that the user has eye fatigue and a first alarm message is sent.

[0091] In order to more accurately determine whether eye fatigue occurs, all videos to be detected can be counted. After determining whether abnormal blinking occurs in each video to be detected, the number of abnormal blinking is summarized and compared with the first preset number.

[0092] The first preset number of times may be a pre-set number of times, and the first preset number of times may specifically be the minimum number of abnormal blinks for determining eye fatigue. If the number of abnormal blinks in all videos to be detected is greater than or equal to the first preset number of times, it indicates that the user has eye fatigue and needs to send a first warning message. The first warning message is used to remind the user to pay attention to eye fatigue and the need for eye rest, that is, to remind the user to pay attention to eye health.

[0093] In actual applications, the first alarm information can be, for example, a pop-up window, that is, the first device displays a pop-up window, and the pop-up window content is used to remind the user to pay attention to eye health. The first alarm information can also be voice, that is, the first device broadcasts voice content to the user to pay attention to eye health. The first alarm information can also be in other forms.

[0094] In this way, by collecting the user's facial image, the number of blinks can be automatically counted, and then when eyes fatigue occurs, an alarm can be given to the user in time. There is no need for manual reminders for users watching videos. This can not only provide accurate and timely reminders of eyes fatigue, but also reduce the labor cost of manual reminders, thereby ensuring the user's healthy eyes.

[0095] In one possible implementation, S103 determines that a blink has occurred when a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold. Specifically, it can be determined that a blink has occurred when a first difference between the first eye parameter corresponding to the first target facial image and the second eye parameter corresponding to the second target facial image is greater than or equal to the first threshold, and a second difference between the second eye parameter and the third eye parameter corresponding to the third target facial image is greater than or equal to the second threshold.

[0096] Specifically, the third target facial image can be one of the multiple facial images, and the time corresponding to the third target facial image can be recorded as the third time, and the third time is located after the second time. In other words, three facial images can be determined from the video to be detected, and they are recorded as the first target facial image, the second target facial image, and the third target facial image in order from early to late according to the corresponding time.

[0097] The eye parameter corresponding to the third target facial image can be recorded as the third eye parameter, and the difference between the third eye parameter and the second eye parameter can be recorded as the second difference. In order to more accurately determine whether a blink occurs, the second difference can be compared with a second threshold. The second threshold can be a pre-set value, and the second threshold can be understood as a smaller change in the eye parameter that can determine when the eye blinks. The second threshold can be equal to or different from the first threshold.

[0098] Since users may close their eyes to rest while watching videos, in this case, the difference in eye parameters between the first target facial image captured with eyes open and the second target facial image captured with eyes closed is relatively large. That is, it can be determined that a blink has occurred through the first difference being not less than the first threshold, which leads to a misjudgment of a blink.

[0099] Therefore, in order to more accurately determine whether a blink occurs, the second target facial image can be compared with the subsequent third target facial image. If the second difference in their eye parameters is not less than the second threshold, it means that the eyes have changed from a closed state to an open state.

[0100] That is, by determining that the first difference is not less than the first threshold value, and the second difference is not less than the second threshold value, it can be determined that the eyes change from an open state to a closed state, and then to an open state, which conforms to the human blinking law, and therefore, it can be determined that a blink has occurred. In short, by comparing the differences between the three target images, it is possible to more accurately determine whether a blink has occurred, avoid misjudging the user's short-term eye closure as a blink, and improve the accuracy of blink judgment.

[0101] In order to further remind users to pay attention to eye health, warning messages can be sent to users not only in the video software, but also through other applications.

[0102] In a possible implementation, when the number of abnormal blinking in all videos to be detected reaches a first preset number, S105 determines that the user has eye fatigue and sends a first alarm message, which may specifically include S1051-S1053.

[0103] S1051, when the number of abnormal blinking in all the videos to be detected reaches a first preset number, it is determined that the user has eye fatigue, and the account information logged in to the video software is determined.

[0104] Specifically, when determining that the user has eye fatigue, the server may determine the account information for logging into the video software on the first device.

[0105] S1052: Determine a device identifier of the second device based on the account information.

[0106] The account information can be registered in both the video software and the social platform at the same time, that is, the account information can be logged in not only in the video software, but also in the social platform. The social platform can be an application software for users to communicate.

[0107] The second device is a device for logging into the social platform through account information. Specifically, the device for logging into the social platform through the account information can be recorded as the second device, that is, the social platform is installed on the second device, and the user can log in to the social platform through the account information. The second device and the first device can be the same device or different devices.

[0108] The server may determine the device identifier corresponding to the account information based on the correspondence between the account information and the device identifier of the second device, that is, determine on which specific device the social platform is logged in using the account information.

[0109] The social platform has an application associated with the video software, that is, the application is deployed on the social platform, and there is a correlation between the video software and the application, for example, the two can share some data, such as account-related information.

[0110] S1053: Send first alarm information to the second device based on the device identifier.

[0111] The server can also send a first alarm message to the second device based on the device identifier, and the first alarm message is used to warn through the application. In this way, when the user opens the social platform, the application in the social platform will also display the first alarm message, which can remind the user of eye fatigue again. Especially in the scenario where children watch videos, parents can also receive alarm messages when they open the social platform, which can facilitate timely supervision of children to pay attention to eye health. In short, by issuing alarm prompts on both the social platform and the video software, double reminders can be made to further ensure that users pay attention to eye health.

[0112] In a possible implementation, when the number of abnormal blinking in all videos to be detected reaches a second preset number and the playback mode switching control of the video software is on, the video is switched from video playback mode to audio playback mode; the second preset number is greater than the first preset number.

[0113] Among them, the second preset number of times can be a pre-set number of times, specifically, it can be the minimum number of abnormal blinking when switching the playback mode. If the number of abnormal blinking in all the videos to be detected is greater than or equal to the second preset number of times, it means that the number of abnormal blinking is too many, and it is necessary to rely on the first device to assist the user to relax his eyes. If the playback mode switching control of the video software is on at this time, the server can control the playback mode of the video software to switch from the original video playback mode to the audio playback mode. In other words, the first device only plays sound based on the audio stream corresponding to the video, and will not display the video stream corresponding to the video. At this time, the screen of the first device can be a black screen.

[0114] refer to Figure 5 As shown, it is a schematic diagram of the opening interface of the video software of an electronic device provided in an embodiment of the present application, showing that the "blue light weakening" control is in the off state, the "sitting posture correction" control is in the on state, and the words "automatically switch audio mode in case of eye fatigue" are displayed.

[0115] In short, by switching video playback to audio playback, users do not need to look at the screen, which effectively reduces the time users use their eyes and ensures their normal vision. At the same time, it will not affect the user's listening to the main content of the target video. That is, while ensuring the user's entertainment experience, it tries to protect the user's eye health.

[0116] In addition, more videos on protecting eyesight can be recommended to users on the homepage of the video software in the future, thereby further assisting users in protecting normal eyesight.

[0117] In a possible implementation, S106 - S108 may also be performed.

[0118] S106, determining the target video to be detected.

[0119] The target video to be detected may be the video to be detected with the latest acquisition time among all the videos to be detected. Specifically, the acquisition times corresponding to the videos to be detected may be compared, and the video with the latest acquisition time may be used as the target video to be detected.

[0120] S107: When the first difference is smaller than the eye closing threshold and the second eye parameter is smaller than the eye closing parameter, it is determined that an eye closing occurs.

[0121] Specifically, if the first difference between the first eye parameter and the second eye parameter is less than the eye-closing threshold, it means that the two eye parameters are very close, and it can be considered that the change of the eyes in the first target facial image and the second target facial image is very small. The eye-closing parameter can be understood as the eye parameter value when the eyes are in a closed state. If the second eye parameter is less than the eye-closing parameter, it means that the eyes in the second target facial image are in a closed state.

[0122] That is to say, when the first difference is smaller than the eye closing threshold and the second eye parameter is smaller than the eye closing parameter, it can be explained that the user's eyes are in a closed state and remain closed, which means that the user has closed his eyes once.

[0123] S108, if the total number of eye closing times in the target video to be detected is greater than the third number threshold, it is determined that the user has closed his eyes for a long time, and the video software stops playing the video.

[0124] If the total number of eye closures in the target video to be detected is greater than the third number threshold, it means that the total number of eye closures is too many and the user is in a state of long-term eye closure, such as falling asleep, and the server can control the video software to stop playing the video. In this way, by automatically detecting whether the user has long-term eye closure, the user can be guaranteed to sleep and the power consumption of the first device can be saved.

[0125] In a possible implementation, it is also possible to determine whether the distance between the user's eyes and the screen of the first device is appropriate, and the server may also execute S201-S204.

[0126] S201, determining an image eye distance between two eyes in a facial image and a target real eye distance of a user.

[0127] Specifically, the server can use the eye pair detection model to locate the eyes in the facial image, determine the position of the eye pair, and calculate the distance between the two eyes, which can be recorded as the image eye distance, which is the distance between the eyes in the facial image.

[0128] The target real eye distance can be understood as the distance between the eyes on the real face of the user. The target real eye distance can be preset or obtained by calculation. For example, the corresponding real eye distance can be preset for people of different age groups.

[0129] In a possible implementation, S201 determines the target real eye distance of the user, which may specifically include extracting features from a facial image to obtain facial features of the facial image; determining the target age of the user based on the facial features; and determining the target real eye distance corresponding to the target age based on a correspondence between age and the real eye distance.

[0130] Specifically, feature extraction can be performed on facial images to obtain facial features corresponding to the facial images. Facial features can be used to uniquely identify the user. Facial features can be, for example, facial contours, facial features, etc. The server can calculate the target age of the user based on the facial features. And according to the corresponding relationship between age and real eye distance, the target real eye distance corresponding to the target age is determined. This step can be implemented through a neural network model, that is, a facial image is input into the neural network model, and the target real eye distance is output. In this way, the user's age can be more accurately estimated through facial features, and then the target real eye distance of the user can be accurately determined.

[0131] S202, determining the distance between the eye and the first device based on the image eye distance, the focal length of the camera in the first device, and the target real eye distance.

[0132] Specifically, the server may calculate based on the image eye distance, the focal length of the camera in the first device, and the target real eye distance to determine the distance D between the eye and the first device. Specifically, the calculation may be based on similar triangles. The distance D may be expressed as:

[0133]

[0134] Among them, r is the image eye distance, and R is the user's actual eye distance.

[0135] S203: Determine whether the distance is less than a preset distance.

[0136] The preset distance may be a preset appropriate distance between the user's eyes and the first device.

[0137] S204: If the distance is less than the preset distance, send a second warning message.

[0138] If the distance between the user's eyes and the first device is less than the preset distance, it means that the user's eyes are too close to the screen, and a second warning message may be issued to remind the user to pay attention to the distance between the user and the first device. The second warning message may be a pop-up window, a prompt tone, etc. For example, if the distance is found to be less than the preset distance of 30cm, a prompt tone is issued. If subsequent detection finds that the distance is still less than 30cm, it may also switch to audio playback.

[0139] In this way, by automatically detecting the distance between the user's eyes and the screen of the first device, the user can be reminded in time to maintain a proper distance, which can help the user correct his sitting posture and improve the user experience.

[0140] Based on the above liveness detection method, the present application embodiment also provides a liveness detection device, referring to Figure 6 FIG. 1 is a structural block diagram of a living body detection device provided in an embodiment of the present application, and the device may include:

[0141] The first acquisition unit 201 is used to acquire at least one video to be detected; the video to be detected includes multiple facial images of the user; the facial images are acquired by the first device capturing the user's face when the user watches the video through the video software in the first device;

[0142] The first determining unit 202 is used to determine, for each of the facial images, eye parameters corresponding to each of the facial images based on a first position, a second position, a third position and a fourth position of the same eye in the facial image; the first position and the second position are respectively located at the upper boundary line and the lower boundary line of the eye; the third position and the fourth position are respectively located at the intersection of the upper boundary line and the lower boundary line; the eye parameters are used to indicate the open or closed state of the eye;

[0143] The second determining unit 203 is configured to determine that a blink occurs when a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold; and a first moment corresponding to the first target facial image is before a second moment corresponding to the second target facial image;

[0144] The third determining unit 204 is configured to determine that an abnormal blinking occurs when the total number of blinks in the video to be detected is less than a first number threshold, or greater than a second number threshold; and the second number threshold is greater than the first number threshold;

[0145] The sending unit 205 is used to determine that the user has eye fatigue and send a first alarm message when the number of abnormal blinking in all the videos to be detected reaches a first preset number.

[0146] Specifically, the second determining unit is used for:

[0147] When the first difference between the first eye parameter corresponding to the first target facial image and the second eye parameter corresponding to the second target facial image is greater than or equal to the first threshold, and the second difference between the second eye parameter and the third eye parameter corresponding to the third target facial image is greater than or equal to the second threshold, it is determined that a blink has occurred; the third moment corresponding to the third target facial image is located after the second moment.

[0148] Specifically, the sending unit is used for:

[0149] When the number of abnormal blinking in all the videos to be detected reaches a first preset number, determining that the user has eye fatigue, and determining the account information logged in to the video software;

[0150] Determine a device identifier of a second device based on the account information; the second device is a device that logs into a social platform through the account information; the social platform has an application associated with the video software;

[0151] The first alarm information is sent to the second device based on the device identifier; the first alarm information is used to issue an alarm through the application.

[0152] Specifically, the device also includes:

[0153] A switching unit is used to switch the video from video playback mode to audio playback mode when the number of abnormal blinking in all the videos to be detected reaches a second preset number and the playback mode switching control of the video software is in an open state; the second preset number is greater than the first preset number.

[0154] Specifically, the device also includes:

[0155] A fourth determining unit is used to determine a target video to be detected; the target video to be detected is the video to be detected with the latest acquisition time among all the videos to be detected;

[0156] a fifth determining unit, configured to determine that an eye closure occurs when the first difference is less than an eye closure threshold and the second eye parameter is less than an eye closure parameter;

[0157] The sixth determination unit is used to determine that the user has closed his eyes for a long time if the total number of times of eye closure in the target video to be detected is greater than a third number threshold, so as to stop the video software from playing the video.

[0158] Specifically, the device also includes:

[0159] a seventh determining unit, configured to determine an image eye distance between two eyes in the facial image, and a target real eye distance of the user;

[0160] an eighth determining unit, configured to determine a distance between the eye and the first device based on the image eye distance, a focal length of a camera in the first device, and the target real eye distance;

[0161] A judging unit, used to judge whether the distance is less than a preset distance;

[0162] The sending unit is used to send a second warning message if the distance is less than a preset distance.

[0163] In another aspect, the present application provides a computer device, referring to Figure 7 , which is a structural diagram of a computer device provided in an embodiment of the present application, wherein the computer device includes a processor 310 and a memory 320:

[0164] The memory 320 is used to store program codes and transmit the program codes to the processor 310;

[0165] The processor 310 is used to execute the method provided in the above embodiment according to the instructions in the program code.

[0166] The computer device may include a terminal device or a server, and the aforementioned apparatus may be configured in the computer device.

[0167] On the other hand, an embodiment of the present application further provides a storage medium, wherein the storage medium is used to store a computer program, and the computer program is used to execute the method provided by the above embodiment.

[0168] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by program instruction hardware, and the above program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the above storage medium can be at least one of the following media: read-only memory (English: Read-only Memory, abbreviated: ROM), RAM, magnetic disk or optical disk, etc. Various media that can store program codes.

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

[0170] The above is only a preferred implementation of the present application. Although the present application has been disclosed as a preferred embodiment, it is not intended to limit the present application. Any technician familiar with the art can use the above disclosed methods and technical contents to make many possible changes and modifications to the technical solution of the present application without departing from the scope of the technical solution of the present application, or modify it into an equivalent embodiment of equivalent changes. Therefore, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application still falls within the scope of protection of the technical solution of the present application.

Claims

1. A method for detecting a living body, characterized in that: include: Acquire at least one video to be detected; the video to be detected includes multiple facial images of a user; the facial images are obtained by the first device capturing the user's face when the user watches a video through a video software in the first device; For each of the facial images, eye parameters corresponding to each of the facial images are determined based on a first position, a second position, a third position, and a fourth position of the same eye in the facial image; the first position and the second position are located at an upper boundary line and a lower boundary line of the eye, respectively; the third position and the fourth position are located at two end intersections of the upper boundary line and the lower boundary line, respectively; The eye parameter is used to indicate the open or closed state of the eye; When a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold, determining that a blink occurs; and a first moment corresponding to the first target facial image is before a second moment corresponding to the second target facial image; When the total number of blinks in the video to be detected is less than the first count threshold, or greater than the second count threshold, it is determined that a blink abnormality occurs; The second number threshold is greater than the first number threshold; When the number of abnormal blinking in all the videos to be detected reaches a first preset number, it is determined that the user has eye fatigue and a first alarm message is sent.

2. The method according to claim 1, characterized in that When a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold, determining that a blink occurs includes: When the first difference between the first eye parameter corresponding to the first target facial image and the second eye parameter corresponding to the second target facial image is greater than or equal to the first threshold, and the second difference between the second eye parameter and the third eye parameter corresponding to the third target facial image is greater than or equal to the second threshold, it is determined that a blink has occurred; the third moment corresponding to the third target facial image is located after the second moment.

3. The method according to claim 1, characterized in that When the number of abnormal blinking in all the videos to be detected reaches a first preset number, determining that the user is eye fatigued and sending a first alarm message include: When the number of abnormal blinking in all the videos to be detected reaches a first preset number, determining that the user has eye fatigue, and determining the account information logged in to the video software; Determine a device identifier of a second device based on the account information; the second device is a device that logs into a social platform through the account information; the social platform has an application associated with the video software; The first alarm information is sent to the second device based on the device identifier; the first alarm information is used to issue an alarm through the application.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the number of abnormal blinking in all the videos to be detected reaches a second preset number and the play mode switching control of the video software is in an open state, the video is switched from the video play mode to the audio play mode; the second preset number is greater than the first preset number.

5. The method according to claim 1, characterized in that The method further comprises: Determine a target video to be detected; the target video to be detected is the video to be detected with the latest acquisition time among all the videos to be detected; When the first difference is less than the eye closing threshold and the second eye parameter is less than the eye closing parameter, determining that an eye closing occurs; If the total number of eye closure times in the target video to be detected is greater than the third number threshold, it is determined that the user has closed his eyes for a long time, so that the video software stops playing the video.

6. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Determining an image eye distance between two eyes in the facial image, and a target real eye distance of the user; Determine the distance between the eye and the first device based on the image eye distance, the focal length of the camera in the first device, and the target real eye distance; Determining whether the distance is less than a preset distance; If the distance is less than the preset distance, a second warning message is sent.

7. The method according to claim 6, characterized in that Determining the target real eye distance of the user includes: Extracting features from the facial image to obtain facial features of the facial image; determining a target age of the user based on the facial features; Based on the corresponding relationship between age and the real eye distance, a target real eye distance corresponding to the target age is determined.

8. A living body detection device, characterized in that: include: A first acquisition unit, used to acquire at least one video to be detected; The video to be detected includes multiple facial images of the user; The facial image is obtained by collecting the face of the user by the first device when the user watches a video through the video software in the first device; A first determining unit is used to determine, for each of the facial images, eye parameters corresponding to each of the facial images based on a first position, a second position, a third position, and a fourth position of the same eye in the facial image; the first position and the second position are located at an upper boundary line and a lower boundary line of the eye, respectively; the third position and the fourth position are located at two end intersections of the upper boundary line and the lower boundary line, respectively; The eye parameter is used to indicate the open or closed state of the eye; a second determining unit, configured to determine that a blink occurs when a first difference between a first eye parameter corresponding to the first target facial image and a second eye parameter corresponding to the second target facial image is greater than or equal to a first threshold; and a first moment corresponding to the first target facial image is before a second moment corresponding to the second target facial image; A third determining unit, configured to determine that an abnormal blink occurs when the total number of blinks in the video to be detected is less than a first number threshold or greater than a second number threshold; The second number threshold is greater than the first number threshold; The sending unit is used to determine that the user has eye fatigue and send a first alarm message when the number of abnormal blinking in all the videos to be detected reaches a first preset number.

9. A computer device, characterized in that: The computer device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method according to any one of claims 1 to 7 according to the instructions in the program code.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 7.