Danger early warning method suitable for recorder and recorder
Through target face recognition and emotion analysis in real-time video, combined with body information comparison, it solves the problem that existing recorders are difficult to accurately judge the aggressive behavior of the other driver, and improves driver safety.
Patent Information
- Application Number
- CN202410724167.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-08-23
AI Technical Summary
It is difficult for existing recorders to accurately judge the other driver's excessive behavior during riding, which threatens the driver's safety.
Through the recognition and emotion analysis of target faces in real-time videos, combined with body information comparison, different alarm modes are turned on to improve the accuracy of judgment of excessive behavior and the safety of drivers.
It achieves accurate judgment of excessive behavior, improves driver safety, and reminds the driver to take corresponding measures through different alarm modes to avoid potential dangers.
Smart Images

Figure CN118538006A
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image analysis, and in particular relates to a danger warning method applicable to a recorder and a recorder. Background Art
[0002] As people's living standards are improving, many people are pursuing a healthy life. Some people like to use recorders to record their lives. For example, among people who like to ride, whether it is a bicycle or a motorcycle, many are equipped with a riding recorder to record their riding process. However, you may encounter disputes with others during riding, which is very common in motorcycle riding. Some people do not know that motorcycles are motor vehicles and can be driven on motor vehicle lanes, leading to disputes with motorcycle drivers. Then the riding recorder can well record the dispute process and retain video evidence.
[0003] However, some people may engage in extreme behaviors during disputes. The riding recorder can only record what is happening. The driver can only rely on the other party's facial expressions and behaviors to judge whether the other party will engage in extreme behaviors. This judgment method has the problem of low accuracy, which will pose a threat to the driver's safety. Summary of the invention
[0004] The present application provides a danger warning method and a recorder applicable to a recorder, which are used to improve the accuracy of judging excessive behavior and the safety of the driver.
[0005] In a first aspect, the present application provides a danger warning method applicable to a recorder, wherein the recorder determines a target face in a real-time video, wherein the target face is a face that appears in the real-time video and lasts for more than a preset time threshold, and the real-time video is a video captured by a camera of the recorder; The recorder determines the target person according to the target face, and extracts the facial information and body information of the target person; The recorder inputs the facial information into the facial recognition model to obtain the real-time emotion value of the target person; The recorder compares the limb information with the preset abnormal behavior information to obtain a similarity value; When the recorder determines that the real-time emotion value is greater than the preset emotion threshold and the similarity value is not greater than the preset danger threshold, the preset first alarm mode is activated; When determining that the real-time emotion value is greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, the recorder switches to the preset second alarm mode, and the set of functions included in the preset first alarm mode is a subset of the set of functions included in the preset second alarm mode; When determining that the real-time emotion value is not greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, the recorder maintains the preset second alarm mode.
[0006] By adopting the above technical solution, the recorder determines the target face in the real-time video and extracts the facial information and body information of the target person. Then the facial information is input into the facial recognition model to obtain the real-time emotional value of the target person. At the same time, the body information is compared with the preset abnormal behavior information to obtain the similarity value, and the real-time emotional value and the similarity value are compared with the corresponding preset emotional threshold and preset danger threshold. Different alarm modes are turned on in different situations according to the comparison results, which can improve the accuracy of judging excessive behavior. The driver can take different measures according to different alarm modes, thereby improving the driver's safety.
[0007] In conjunction with some embodiments of the first aspect, in some embodiments, the recorder inputs the facial information into a facial recognition model to obtain a real-time emotion value of the target person, specifically including: The recorder adjusts all facial images in the facial information to a preset size to obtain a pre-processed facial image group; The recorder marks the target face in the preprocessed facial image group to obtain a facial contour; The recorder crops the pre-processed facial image according to the facial contour to obtain a facial image group; The recorder grayscales the face image group to obtain a grayscale image group; The recorder performs feature extraction on the grayscale image group to obtain a facial feature group; The recorder updates the facial information and inputs the updated facial information into the facial recognition model to obtain the real-time emotion value of the target person, and the updated facial information only includes the facial feature group.
[0008] By adopting the above technical solution, the facial information is preprocessed, marked, cropped, grayed and features are extracted. Through these steps, relevant information about the target person's face can be obtained and input into the facial recognition model to calculate the emotional value. The emotional state of the target person can be obtained in real time and accurately. The recorder can obtain the real-time emotional value of the target person in time, providing an accurate data basis for the subsequent alarm mode. The accuracy of judging excessive behavior is improved.
[0009] In conjunction with some embodiments of the first aspect, in some embodiments, after the recorder determines the target face in the real-time video, the method further includes: The recorder determines the real-time distance to the target person based on the real-time video; When the recorder determines that the real-time distance is not greater than the preset safety distance, the preset third alarm mode is activated, and the preset third alarm mode and the preset first alarm mode or the preset second alarm mode can be activated at the same time; When the recorder determines that the real-time distance is greater than the preset safety distance and not greater than the preset warning distance, the recorder determines the target person based on the target face and extracts the facial information and body information of the target person.
[0010] By adopting the above technical solution, the recorder determines the real-time distance of the target person based on the real-time video, and determines whether to turn on the preset third alarm mode based on the preset safety distance. The recorder can more accurately judge the target person's condition based on the distance between the target person and itself. If the target person is too close, it may pose a threat to the driver's safety, and the preset third alarm mode will be turned on. If the real-time distance is greater than the preset safety distance, the target person's emotions will be identified, thereby improving the driver's safety.
[0011] In conjunction with some embodiments of the first aspect, in some embodiments, after the recorder determines that the real-time distance is greater than the preset safety distance and not greater than the preset warning distance, the recorder determines the target person according to the target face and extracts the facial information and body information of the target person, the method further includes: The recorder calculates the change value of the real-time distance; When the recorder determines that the change value is greater than the preset change value, it switches to the preset fourth alarm mode. The set of functions included in the preset third alarm mode is a subset of the set of functions included in the preset fourth alarm mode, and the number of functions included in the preset fourth alarm mode is less than the number of functions included in the preset first alarm mode.
[0012] By adopting the above technical solution, the recorder can determine the movement of the target person by calculating the change value of the real-time distance, and switch to the preset fourth alarm mode when the change value is greater than the preset change value. When the change value is greater than the preset change value, it means that the target person is approaching the driver quickly and may pose a threat to the driver's safety, so it switches to the preset fourth alarm mode to remind the driver to take corresponding measures, thereby improving the driver's safety.
[0013] In conjunction with some embodiments of the first aspect, in some embodiments, the recorder determines the real-time distance to the target person according to the real-time video, specifically including: The recorder obtains the calibration parameters of the camera; The recorder determines the real-time position information of the target face in the real-time video; The recorder calculates the parallax using a binocular vision method according to the real-time position information; The recorder obtains the real-time distance according to the parallax and the calibration parameter.
[0014] By adopting the above technical solution, the calibration parameters of the camera are obtained, the real-time position information of the target face in the real-time video is determined, and the recorder uses the binocular vision method to calculate the parallax based on the real-time position information, and then the real-time distance is obtained based on the parallax and calibration parameters. The accurate implementation distance can be obtained, which provides an accurate data basis for the subsequent judgment of whether to turn on the preset third alarm mode or the preset fourth alarm mode, thereby improving the safety of the driver.
[0015] In combination with some embodiments of the first aspect, in some embodiments, the recorder obtains the real-time distance according to the parallax and the calibration parameter, specifically including: The calibration parameters include focal length and baseline length; The recorder inputs the focal length, the baseline length and the parallax into a distance calculation function to obtain the real-time distance; The distance calculation function is: In the formula, S is the real-time distance, l is the baseline length, n is the focal length, and a is the parallax.
[0016] By adopting the above technical solution, using focal length, baseline length and parallax as input, the real-time distance is obtained through the distance calculation function. This calculation method is simple and efficient, and can quickly obtain the accurate value of the real-time distance. It provides an accurate data basis for the subsequent judgment of whether to turn on the preset third alarm mode or the preset fourth alarm mode, thereby improving the safety of the driver.
[0017] In combination with some embodiments of the first aspect, in some embodiments, the facial recognition model is an intelligent model obtained by inputting the facial information into a deep learning algorithm and training with all historical facial information as training data. The facial information is input into the facial recognition model to obtain the real-time emotional value of the target person.
[0018] By adopting the above technical solution, the facial information is input into the facial recognition model to obtain the real-time emotional value of the target person. The real-time emotional value of the target person can be accurately identified through the facial information. This provides an accurate data basis for the subsequent judgment of whether to turn on the preset first alarm mode or the preset second alarm mode, thereby improving the safety of the driver.
[0019] In a second aspect, an embodiment of the present application provides a danger warning recorder suitable for a recorder, the recorder comprising: a face determination module, for determining a target face in a real-time video, the target face being a face that appears in the real-time video and lasts for more than a preset time threshold, the real-time video being a video captured by a camera of the recorder; An information extraction module is used to determine a target person according to the target face, and extract facial information and body information of the target person; The emotion value calculation module is used to input the facial information into the facial recognition model to obtain the real-time emotion value of the target person; the similarity value calculation module is used to compare the body information with the preset abnormal behavior information to obtain the similarity value; A first alarm mode activation module, configured to activate a preset first alarm mode when it is determined that the real-time emotion value is greater than a preset emotion threshold and the similarity value is not greater than a preset danger threshold; A second alarm mode switching module is used to switch to a preset second alarm mode when it is determined that the real-time emotion value is greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, and the set of functions included in the preset first alarm mode is a subset of the set of functions included in the preset second alarm mode; The execution module is used to maintain the preset second alarm mode when it is determined that the real-time emotion value is not greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold.
[0020] In the third aspect, an embodiment of the present application provides a hazard warning recorder suitable for a recorder, the recorder comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, the one or more processors call the computer instructions to enable the recorder to execute the method described in the first aspect and any possible implementation method of the first aspect.
[0021] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions. When the instructions are executed on a recorder, the recorder executes the method described in the first aspect and any possible implementation manner of the first aspect.
[0022] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. The present application provides a danger warning method suitable for a recorder. The recorder determines the target face in the real-time video and extracts the facial information and body information of the target person. The facial information is then input into the facial recognition model to obtain the real-time emotional value of the target person. At the same time, the body information is compared with the preset abnormal behavior information to obtain a similarity value. The real-time emotional value and the similarity value are compared with the corresponding preset emotional threshold and the preset danger threshold. Different alarm modes are turned on in different situations according to the comparison results, which can improve the accuracy of the judgment of excessive behavior. The driver can take different measures according to different alarm modes, thereby improving the driver's safety.
[0023] 2. The present application provides a danger warning method suitable for a recorder, which includes preprocessing, face marking, cropping, graying and feature extraction of facial information. Through these steps, relevant information of the target person's face can be obtained and input into the facial recognition model to calculate the emotion value. The emotional state of the target person can be obtained in real time and accurately. The recorder can obtain the real-time emotion value of the target person in a timely manner, providing an accurate data basis for the subsequent activation of the alarm mode. The accuracy of judging excessive behavior is improved.
[0024] 3. The present application provides a danger warning method suitable for a recorder. The recorder determines the real-time distance of the target person based on the real-time video, and determines whether to turn on the preset third alarm mode based on the preset safety distance. The recorder can more accurately judge the condition of the target person based on the distance between the target person and itself. If the target person is too close, it may pose a threat to the driver's safety, and the preset third alarm mode is turned on. If the real-time distance is greater than the preset safety distance, the target person's emotions are identified, thereby improving the driver's safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a flow chart of a danger warning method suitable for a recorder in an embodiment of the present application.
[0026] Figure 2 It is another flow chart of a danger warning method applicable to a recorder in an embodiment of the present application.
[0027] Figure 3 It is a schematic diagram of the functional module structure of a danger warning recorder suitable for a recorder provided in an embodiment of the present application.
[0028] Figure 4 It is a schematic diagram of the physical device structure of a danger warning recorder suitable for a recorder provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations comprising one or more listed items.
[0030] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0031] The following describes a scenario in which this application can be applied: Suppose a motorcycle enthusiast rides on a city road, with a dashcam installed on his helmet, which can record the riding process in real time. When the motorcycle driver is waiting for the traffic light, he stops at the first position. At this time, a car on the same road as him is behind him. The car driver does not know that motorcycles are also motor vehicles and can and must wait for traffic lights on the road where motor vehicles are driving. The car driver thinks that the motorcycle is blocking the position, so he keeps honking the horn at the motorcycle driver, signaling the motorcycle to pull over and give way. The motorcycle driver does not think he is at fault, so he still waits in place. The behavior of the motorcycle driver makes the car driver unhappy, so the car driver turns on the double flash, gets off the car and communicates with the motorcycle driver. The motorcycle driver's dashcam captures the car driver and records the entire dispute between the motorcycle driver and the car driver. During this process, the car driver may have some extreme behavior, and the motorcycle driver did not dodge in time, resulting in his safety being threatened.
[0032] In order to solve the above problems, the present application provides a danger warning method and a recorder suitable for a recorder, which are used to improve the accuracy of judging excessive behaviors and the safety of the driver.
[0033] Combine the following Figure 1 , a danger warning method applicable to a recorder in an embodiment of the present application is described: See also Figure 1 , which is a flow chart of a danger warning method suitable for a recorder in an embodiment of the present application.
[0034] S101, the recorder determines the target face in the real-time video; The recorder determines the target face in the real-time video. The target face is the face that appears in the real-time video and lasts for more than a preset time threshold. The real-time video is the video captured by the camera of the recorder. The target face appears in the real-time video and lasts for more than the preset time threshold, indicating that the person corresponding to the target face may be negotiating with the motorcycle driver. It is understandable that the recorder includes two cameras, both of which are used to shoot videos, and the videos shot by the two cameras are synthesized to form a real-time video. The recorder determines the target face in the real-time video through image processing algorithms and face recognition technology. Combined with the above scenario, the target face is the face of the car driver.
[0035] It should be noted that multiple target faces may appear in the real-time video. For the sake of convenience of explanation, the number of target faces in this embodiment is 1. In actual applications, the number of target faces can be greater than 1, which is not limited here.
[0036] S102, the recorder determines the real-time distance to the target person based on the real-time video; The recorder determines the real-time distance to the target person based on the real-time video. Specifically: The recorder obtains the calibration parameters of the camera, which include internal parameters and external parameters. The internal parameters include the focal length and principal point coordinates of the camera, and the external parameters include the position and posture information of the camera. The recorder determines the real-time position information of the target face in the real-time video; The recorder calculates the parallax based on the real-time position information using the binocular vision method, which is a technology that uses two cameras to simulate the stereoscopic vision of the human eye. Through the binocular vision method, the depth information of the scene can be obtained to achieve applications such as distance estimation, obstacle detection, and target tracking. It can be understood that the recorder of the present application includes two cameras, both of which are used to shoot videos, and the videos shot by the two cameras are synthesized to form a real-time video; The recorder obtains the real-time distance based on parallax and calibration parameters, specifically: The calibration parameters include focal length and baseline length; The recorder inputs the focal length, baseline length and parallax into the distance calculation function to obtain the real-time distance; The distance calculation function is: In the formula, S is the real-time distance, l is the baseline length, n is the focal length, and a is the parallax.
[0037] For example: through calculation, the real-time distance is 1 meter.
[0038] S103, when the recorder determines that the real-time distance is not greater than the preset safety distance, the preset third alarm mode is turned on; when the recorder determines that the real-time distance is not greater than the preset safety distance, the preset third alarm mode is turned on, and the preset safety distance is a preset value. When the real-time distance is not greater than the preset safety distance, it indicates that the safety of the motorcycle driver may be threatened, so the recorder turns on the preset third alarm mode, and the preset third alarm mode is a preset alarm mode, and its alarm form can be an audible and visual alarm, a vibration alarm, or an alarm form combining an audible and visual alarm with a vibration alarm, which is not limited here. The motorcycle driver can be reminded to take corresponding measures.
[0039] Continuing with the above example, assuming that the preset safety distance is 2 meters, if the real-time distance is less than the preset safety distance, the recorder will activate the preset third alarm mode.
[0040] S104, when the recorder determines that the real-time distance is greater than the preset safety distance and not greater than the preset warning distance, the recorder determines the target person according to the target face, and extracts the facial information and body information of the target person; When the recorder determines that the real-time distance is greater than the preset safety distance and not greater than the preset warning distance, the recorder determines the target person based on the target face and extracts the target person's facial and body information. When the real-time distance is greater than the preset safety distance, it means that the motorcycle driver's safety has not been seriously threatened, and the motorcycle driver and the car driver are still negotiating. The preset warning distance is the distance at which the recorder starts recording, which can be set in advance and is not limited here. Then the recorder determines the target person based on the target face and extracts the target person's facial and body information. The recorder can use facial recognition technology to identify the target person's face, extract information such as facial expressions, and analyze the target person's body movements through image processing.
[0041] S105, the recorder calculates the change value of the real-time distance; In the above steps, the recorder determines that the real-time distance is greater than the preset safety distance, but it also needs to calculate the change value of the real-time distance in real time. This is because the car driver may suddenly approach the motorcycle driver, which may threaten the safety of the motorcycle driver.
[0042] S106. When the recorder determines that the change value is greater than the preset change value, it switches to the preset fourth alarm mode; when the recorder determines that the change value is greater than the preset change value, it means that the car driver suddenly approaches the motorcycle driver, and this behavior may threaten the safety of the motorcycle driver, then the recorder switches to the preset fourth alarm mode. The preset third alarm mode is a pre-set alarm mode, and its alarm form can be an audible and visual alarm, a vibration alarm, or an alarm form combining an audible and visual alarm with a vibration alarm, which is not limited here, and can remind the motorcycle driver to take corresponding measures. And the set composed of the functions included in the preset third alarm mode is a subset of the set composed of the functions included in the preset fourth alarm mode. For example: the functions included in the preset third alarm mode are audible and visual alarms, and the functions included in the preset fourth alarm mode are audible and visual alarms and vibration alarms.
[0043] Of course, in some embodiments, the above step S106 may not be executed, that is, when the change value is not greater than the preset change value, step S106 may be skipped and step S107 may be executed directly, which is not limited here.
[0044] Alternatively, the above steps S102-S106 may not be performed, and step S107 may be directly performed, which is not limited here.
[0045] S107, the recorder inputs the facial information into the facial recognition model to obtain the real-time emotion value of the target person; The recorder inputs the facial information into the facial recognition model to obtain the real-time emotional value of the target person. The facial recognition model is an intelligent model that is trained by inputting facial information into a deep learning algorithm using all historical facial information as training data. The facial information is input into the facial recognition model to obtain the real-time emotional value of the target person.
[0046] S108, the recorder compares the limb information with the preset abnormal behavior information to obtain a similarity value; The recorder compares the body information with the preset abnormal behavior information to obtain a similarity value. The preset abnormal behavior information is pre-set abnormal behavior information, such as waving arms in a large range, holding controlled items, etc. The recorder can analyze the body movements of the car driver, such as waving hands, shaking head, etc., and then compare them with the preset abnormal behavior information to obtain a similarity value.
[0047] S109, when the recorder determines that the real-time emotion value is greater than the preset emotion threshold and the similarity value is not greater than the preset danger threshold, the preset first alarm mode is turned on; When the recorder determines that the real-time emotion value is greater than the preset emotion threshold and the similarity value is not greater than the preset danger threshold, it means that the car driver is quite excited and may be angry. Then the recorder turns on the preset first alarm mode to remind the motorcycle driver to take corresponding measures. The preset first alarm mode is a pre-set alarm mode, and its alarm form can be an audible and visual alarm, a vibration alarm, or an alarm form combining an audible and visual alarm with a vibration alarm, which is not limited here.
[0048] S110, when the recorder determines that the real-time emotion value is greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, switching to the preset second alarm mode; When the recorder determines that the real-time emotion value is greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, it means that the driver is very excited and has dangerous behavior. Then the recorder switches to the preset second alarm mode. The preset second alarm mode is a pre-set alarm mode, and its alarm form can be an audible and visual alarm, a vibration alarm, or an alarm form combining an audible and visual alarm with a vibration alarm, which is not limited here. Among them, the set of functions included in the preset first alarm mode is a subset of the set of functions included in the preset second alarm mode, the number of functions included in the preset fourth alarm mode is less than the number of functions included in the preset first alarm mode, and the preset third alarm mode and the preset first alarm mode or the preset second alarm mode can be turned on at the same time, and the preset fourth alarm mode and the preset first alarm mode or the preset second alarm mode can be turned on at the same time.
[0049] To facilitate understanding of the above four alarm modes, the following examples are given: Preset first alarm mode: beeping twice per second; Preset second alarm mode: beeping, frequency is 2 times per second; vibration mode, frequency is 3 times per second; strong light irradiation, light intensity is 50 lux; The third preset alarm mode: a ticking sound is emitted at a frequency of 2 times per second; The fourth alarm mode is preset: ticking sound at a frequency of 2 times per second; intermittent lighting at a frequency of 4 times per second.
[0050] Each alarm mode in the above examples may be other functions, and the number of functions may be more or less, which is not limited here.
[0051] S111 . When the recorder determines that the real-time emotion value is not greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, the recorder maintains the preset second alarm mode.
[0052] When the recorder determines that the real-time emotion value is not greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, it means that the car driver's emotions are not reflected at this time, but dangerous behaviors are still occurring. Then the recorder maintains the preset second alarm mode.
[0053] The above embodiments have the following beneficial effects: The recorder determines the target face in the real-time video and extracts the target person's facial information and body information. Then the facial information is input into the facial recognition model to obtain the target person's real-time emotional value. At the same time, the body information is compared with the preset abnormal behavior information to obtain the similarity value. The real-time emotional value and the similarity value are compared with the corresponding preset emotional threshold and preset danger threshold. Different alarm modes are activated under different circumstances according to the comparison results, which can improve the accuracy of the judgment of excessive behavior. The driver can take different measures according to different alarm modes, thereby improving the driver's safety.
[0054] The recorder determines the real-time distance of the target person based on the real-time video, and determines whether to activate the preset third alarm mode based on the preset safety distance. The recorder can more accurately determine the target person's condition based on the distance between the target person and itself. If the target person is too close, it may pose a threat to the driver's safety, and the preset third alarm mode will be activated. If the real-time distance is greater than the preset safety distance, the target person's emotions will be identified, thereby improving the driver's safety.
[0055] By calculating the change value of the real-time distance, the recorder can determine the movement of the target person, and switch to the preset fourth alarm mode when the change value is greater than the preset change value. When the change value is greater than the preset change value, it means that the target person is approaching the driver quickly and may pose a threat to the driver's safety, so it switches to the preset fourth alarm mode to remind the driver to take corresponding measures, thereby improving the driver's safety.
[0056] The calibration parameters of the camera are obtained to determine the real-time position information of the target face in the real-time video. The recorder uses the binocular vision method to calculate the parallax based on the real-time position information, and then obtains the real-time distance based on the parallax and calibration parameters. The accurate implementation distance can be obtained, which provides an accurate data basis for the subsequent judgment of whether to activate the preset third alarm mode or the preset fourth alarm mode, thereby improving the safety of the driver.
[0057] Using focal length, baseline length and parallax as input, the real-time distance is obtained through the distance calculation function. This calculation method is simple and efficient, and can quickly obtain the accurate value of the real-time distance. It provides an accurate data basis for the subsequent judgment of whether to turn on the preset third alarm mode or the preset fourth alarm mode, thereby improving the safety of the driver.
[0058] The facial information is input into the facial recognition model to obtain the real-time emotional value of the target person. The real-time emotional value of the target person can be accurately identified through facial information. This provides an accurate data basis for the subsequent judgment of whether to turn on the preset first alarm mode or the preset second alarm mode, thereby improving the safety of the driver.
[0059] In step S107 of the above embodiment, the recorder inputs the facial information into the facial recognition model to obtain the real-time emotion value of the target person. Figure 2 , describes how to obtain the real-time emotion value of the target person: See also Figure 2 , is another flow chart of a danger warning method suitable for a recorder in an embodiment of the present application.
[0060] S201, the recorder adjusts all facial images in the facial information to a preset size to obtain a pre-processed facial image group; the recorder adjusts all facial images in the facial information to a preset size to obtain a pre-processed facial image group in order to ensure the consistency and accuracy of subsequent processing. Assumption: the preset size is 200x200 pixels; Original face image 1: 300x300 pixels; Original face image 2: 150x150 pixels; Original face image 3: 250x250 pixels; By adjusting these original facial images, the recorder converts them into a preset size and obtains the following set of pre-processed facial images: Preprocessed facial image 1: 200x200 pixels; Preprocessed facial image 2: 200x200 pixels; Preprocessed facial image 3: 200x200 pixels; The recorder may use image processing techniques, such as image scaling or cropping, which can adjust the original facial image accordingly according to the preset size requirements.
[0061] S202, the recorder marks the target face in the pre-processed facial image group to obtain the face contour; The recorder marks the target face in the preprocessed facial image group and obtains the facial contour for subsequent processing and analysis. Assume that the preprocessed facial image group contains the following three images, each of which has a target face: Preprocessed facial image 1: 200x200 pixels, the target face is located in the area from coordinates (50,50) to (150,150); Preprocessed facial image 2: 200x200 pixels, the target face is located in the area from coordinates (75,75) to (175,175); Preprocessed facial image 3: 200x200 pixels, the target face is located in the area from coordinates (100,100) to (200,200); By marking the target face, the recorder can obtain the facial contour, that is, the boundary information of the area where the target face is located.
[0062] The recorder can use face detection techniques, such as feature point, color or texture based methods, which can find the target face in a set of pre-processed facial images and mark its location.
[0063] S203, the recorder crops the pre-processed facial image according to the facial contour to obtain a facial image group; The recorder crops the pre-processed facial image according to the facial contour to obtain a facial image group, wherein the facial image group only includes the target face.
[0064] Assume that the size of the face image after cropping according to the face contour is 100x100 pixels; Preprocess the facial image 1: 200x200 pixels, and crop it to get the face image 1: 100x100 pixels; Preprocess facial image 2: 200x200 pixels, crop to get face image 2: 100x100 pixels; Preprocess the face image 3: 200x200 pixels, and crop it to get the face image 3: 100x100 pixels; By cropping the preprocessed facial images, the recorder can obtain a facial image group containing only the target face.
[0065] The recorder can use image processing techniques, such as image cropping or masking, which can extract the target face from the pre-processed facial image based on the face contour information.
[0066] S204, the recorder grayscales the face image group to obtain a grayscale image group; The recorder grayscales the face image group to obtain a grayscale image group for subsequent feature extraction and processing. It is assumed that the grayscale image only contains grayscale values; Face image 1: 100x100 pixels, grayscale image 1: 100x100 pixels; Face image 2: 100x100 pixels, grayscale image 2: 100x100 pixels; Face image 3: 100x100 pixels, grayscale image 3: 100x100 pixels; By converting the face image group into a grayscale image, the recorder can convert each pixel of the color image into a single grayscale value.
[0067] The recorder can use image processing technology, such as grayscale algorithm, which can convert color images into grayscale images so that each pixel has only one grayscale value.
[0068] S205, the recorder extracts features from the grayscale image group to obtain a facial feature group; The recorder uses a feature extraction algorithm to extract features from the grayscale image group to obtain a facial feature group. Assume that the feature extraction algorithm extracts the following facial features: Grayscale image 1: 100x100 pixels, facial feature 1: 128-dimensional vector; Grayscale image 2: 100x100 pixels, facial feature 2: 128-dimensional vector; Grayscale image 3: 100x100 pixels, facial features 3: 128-dimensional vector; Through feature extraction, the recorder can convert each grayscale image into a facial feature vector with fixed dimension.
[0069] The recorder can use image processing and machine learning techniques such as convolutional neural networks (CNN) or local binary patterns (LBP). These techniques can extract discriminative facial features from grayscale images.
[0070] S206: The recorder updates the facial information and inputs the updated facial information into the facial recognition model to obtain the real-time emotion value of the target person.
[0071] The recorder will update the facial information and input the updated facial information into the facial recognition model to obtain the real-time emotion value of the target person. Assume that the facial recognition model outputs the following real-time emotion values: Facial features 1: 128-dimensional vector, real-time emotion value 1: 9; Facial features 2: 128-dimensional vector, real-time emotion value 2:1; Facial features 3: 128-dimensional vector, real-time emotion value 3: 4; By updating the facial information and the input of the facial recognition model, the recorder can obtain the current real-time emotional value of the target person.
[0072] The data examples listed in all the above embodiments are for the convenience of explaining and describing the steps of the present embodiment. The parameter values in actual situations should be determined according to the actual situation and are not limited here.
[0073] In the above embodiment, the facial information is preprocessed, the face is marked, cropped, grayed and the feature is extracted. Through these steps, the relevant information of the target person's face can be obtained and input into the facial recognition model to calculate the emotion value. The emotional state of the target person can be accurately obtained in real time. The recorder can obtain the real-time emotion value of the target person in time, providing an accurate data basis for the subsequent activation of the alarm mode. The accuracy of the judgment of excessive behavior is improved.
[0074] The following describes the recorder in the embodiment of the present application from the perspective of modules: See also Figure 3 , is a schematic diagram of the functional module structure of a danger warning recorder suitable for a recorder provided in an embodiment of the present application.
[0075] The recorder includes: A face determination module 301 is used to determine a target face in a real-time video, where the target face is a face that appears in the real-time video and lasts for more than a preset time threshold, and the real-time video is a video captured by a camera of the recorder; The information extraction module 302 is used to determine the target person according to the target face, and extract the facial information and body information of the target person; The emotion value calculation module 303 is used to input the facial information into a facial recognition model to obtain a real-time emotion value of the target person, wherein the facial recognition model is an intelligent model obtained by inputting the facial information into a deep learning algorithm and training with all historical facial information as training data, and the facial information is input into the facial recognition model to obtain a real-time emotion value of the target person; A similarity value calculation module 304 is used to compare the limb information with the preset abnormal behavior information to obtain a similarity value; A first alarm mode activation module 305, configured to activate a preset first alarm mode when it is determined that the real-time emotion value is greater than a preset emotion threshold and the similarity value is not greater than a preset danger threshold; A second alarm mode switching module 306, configured to switch to a preset second alarm mode when it is determined that the real-time emotion value is greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, wherein the set of functions included in the preset first alarm mode is a subset of the set of functions included in the preset second alarm mode; The execution module 307 is used to maintain the preset second alarm mode when it is determined that the real-time emotion value is not greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold.
[0076] In some embodiments, the emotion value calculation module 303 specifically includes: A preprocessing unit is used to adjust all facial images in the facial information to a preset size to obtain a preprocessed facial image group; a facial contour determination unit is used to mark the target face in the preprocessed facial image group to obtain a facial contour; A cropping unit, used for cropping the pre-processed facial image according to the facial contour to obtain a facial image group; A grayscale unit, used for grayscale the face image group to obtain a grayscale image group; A feature extraction unit, used for extracting features from the grayscale image group to obtain a facial feature group; The emotion value calculation unit is used to update the facial information and input the updated facial information into the facial recognition model to obtain the real-time emotion value of the target person, and the updated facial information only includes the facial feature group.
[0077] In some embodiments, the recorder further comprises: A real-time distance determination module, used to determine the real-time distance to the target person based on the real-time video; A third alarm mode activation module is used to activate a preset third alarm mode when it is determined that the real-time distance is not greater than a preset safety distance. The preset third alarm mode and the preset first alarm mode or the preset second alarm mode can be activated at the same time; The data processing module is used to execute the steps of the recorder determining the target person according to the target face and extracting the facial information and body information of the target person when it is determined that the real-time distance is greater than the preset safety distance.
[0078] In some embodiments, the recorder further comprises: A change value calculation module, used to calculate the change value of the real-time distance; The fourth alarm mode switching module is used to switch to the preset fourth alarm mode when it is determined that the change value is greater than the preset change value, the set of functions included in the preset third alarm mode is a subset of the set of functions included in the preset fourth alarm mode, and the number of functions included in the preset fourth alarm mode is less than the number of functions included in the preset first alarm mode.
[0079] In some embodiments, the real-time distance determination module specifically includes: A calibration parameter acquisition unit, used to acquire the calibration parameters of the camera; A real-time position information determining unit, used to determine the real-time position information of the target face in the real-time video; A disparity calculation unit, used to calculate the disparity using a binocular vision method according to the real-time position information; The real-time distance calculation unit is used to obtain the real-time distance according to the parallax and the calibration parameter.
[0080] In some embodiments, the real-time distance calculation unit specifically includes: The distance calculation function subunit is used to input the focal length, the baseline length and the parallax into the distance calculation function to obtain the real-time distance.
[0081] Among them: the distance calculation function is: In the formula, S is the real-time distance, l is the baseline length, n is the focal length, and a is the parallax.
[0082] The recorder in the embodiment of the present application is described above from the perspective of modular functional entities. The recorder in the embodiment of the present application is described below from the perspective of hardware processing. Figure 4 , which is a schematic diagram of the physical device structure of a danger warning recorder suitable for a recorder provided in an embodiment of the present application.
[0083] It should be noted that Figure 4 The structure of the recorder shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0084] like Figure 4 As shown, the server includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage part 408 to the random access memory (RAM) 403, such as executing the method in the above embodiment. In RAM 403, various programs and data required for system operation are also stored. CPU 401, ROM 402 and RAM 403 are connected to each other through bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0085] The following components are connected to the I / O interface 405: an input section 406 including a camera, an infrared sensor, etc.; an output section 407 including a liquid crystal display (LCD) and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed so that a computer program read therefrom is installed into the storage section 408 as needed.
[0086] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 409, and / or installed from the removable medium 411. When the computer program is executed by the central processing unit (CPU) 401, various functions defined in the present invention are performed.
[0087] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
[0088] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the recorder, method and computer program product according to various embodiments of the present invention. Among them, each box in the flow chart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of boxes in the block diagram or flow chart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0089] As another aspect, the present invention further provides a computer-readable storage medium, which may be included in the recorder described in the above embodiment; or may exist independently without being assembled into the recorder. The above storage medium carries one or more computer programs, and when the above one or more computer programs are executed by a processor of a recorder, the recorder implements the method provided in the above embodiment.
[0090] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0091] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0092] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0093] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. A danger warning method applicable to a recorder, characterized in that: include: The recorder determines a target face in a real-time video, wherein the target face is a face that appears in the real-time video and lasts for more than a preset time threshold, and the real-time video is a video captured by a camera of the recorder; The recorder determines the target person according to the target face, and extracts the facial information and body information of the target person; the recorder inputs the facial information into a facial recognition model to obtain the real-time emotion value of the target person; The recorder compares the limb information with preset abnormal behavior information to obtain a similarity value; The recorder turns on a preset first alarm mode when it is determined that the real-time emotion value is greater than a preset emotion threshold and the similarity value is not greater than a preset danger threshold; When the recorder determines that the real-time emotion value is greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, it switches to the preset second alarm mode, and the set of functions included in the preset first alarm mode is a subset of the set of functions included in the preset second alarm mode; When determining that the real-time emotion value is not greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, the recorder maintains the preset second alarm mode.
2. The method according to claim 1, characterized in that The recorder inputs the facial information into a facial recognition model to obtain a real-time emotional value of the target person, specifically including: The recorder adjusts all facial images in the facial information to a preset size to obtain a pre-processed facial image group; The recorder marks the target face in the pre-processed facial image group to obtain a facial contour; The recorder crops the pre-processed facial image according to the facial contour to obtain a facial image group; The recorder grayscales the face image group to obtain a grayscale image group; The recorder extracts features from the grayscale image group to obtain a facial feature group; The recorder updates the facial information and inputs the updated facial information into a facial recognition model to obtain a real-time emotion value of the target person, wherein the updated facial information only includes the facial feature group.
3. The method according to claim 1, characterized in that After the recorder determines the target face in the real-time video, the method further includes: The recorder determines the real-time distance to the target person according to the real-time video; When the recorder determines that the real-time distance is not greater than the preset safety distance, the preset third alarm mode is activated, and the preset third alarm mode and the preset first alarm mode or the preset second alarm mode can be activated at the same time; When the recorder determines that the real-time distance is greater than the preset safety distance and not greater than the preset warning distance, the recorder determines the target person according to the target face and extracts the facial information and body information of the target person.
4. The method according to claim 3, characterized in that After the recorder determines that the real-time distance is greater than the preset safety distance and not greater than the preset warning distance, determines the target person according to the target face, and extracts the facial information and body information of the target person, the method further includes: The recorder calculates the change value of the real-time distance; When the recorder determines that the change value is greater than the preset change value, it switches to the preset fourth alarm mode, the set of functions included in the preset third alarm mode is a subset of the set of functions included in the preset fourth alarm mode, and the number of functions included in the preset fourth alarm mode is less than the number of functions included in the preset first alarm mode.
5. The method according to claim 3, characterized in that: The recorder determines the real-time distance to the target person according to the real-time video, specifically including: The recorder obtains calibration parameters of the camera; The recorder determines the real-time position information of the target face in the real-time video; The recorder calculates the parallax using a binocular vision method according to the real-time position information; The recorder obtains the real-time distance according to the parallax and the calibration parameters.
6. The method according to claim 5, characterized in that The recorder obtains the real-time distance according to the parallax and the calibration parameter, specifically including: The calibration parameters include focal length and baseline length; The recorder inputs the focal length, the baseline length and the parallax into a distance calculation function to obtain the real-time distance; the distance calculation function is: In the formula, S is the real-time distance, l is the baseline length, n is the focal length, and a is the parallax.
7. The method according to claim 1, characterized in that The facial recognition model is an intelligent model obtained by inputting the facial information into a deep learning algorithm and training with all historical facial information as training data. The facial information is input into the facial recognition model to obtain the real-time emotion value of the target person.
8. A danger warning recorder suitable for a recorder, characterized in that: include: A face determination module, used to determine a target face in a real-time video, wherein the target face is a face that appears in the real-time video and lasts for more than a preset time threshold, and the real-time video is a video captured by a camera of the recorder; An information extraction module, used to determine a target person according to the target face, and extract facial information and body information of the target person; An emotion value calculation module, used for inputting the facial information into a facial recognition model to obtain a real-time emotion value of the target person; A similarity value calculation module, used for comparing the limb information with preset abnormal behavior information to obtain a similarity value; A first alarm mode activation module, configured to activate a preset first alarm mode when it is determined that the real-time emotion value is greater than a preset emotion threshold and the similarity value is not greater than a preset danger threshold; A second alarm mode switching module, configured to switch to a preset second alarm mode when it is determined that the real-time emotion value is greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold, wherein the set of functions included in the preset first alarm mode is a subset of the set of functions included in the preset second alarm mode; The execution module is used to maintain the preset second alarm mode when it is determined that the real-time emotion value is not greater than the preset emotion threshold and the similarity value is greater than the preset danger threshold.
9. A danger warning recorder suitable for a recorder, characterized in that: include: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the recorder to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on the recorder, the recorder is caused to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Alarm processing process intelligent support method and system based on end side AI
CN122176600A
