Dangerous behavior detection method and device, computer equipment and storage medium
The on-board camera collects cabin images and performs face recognition and key point positioning. Combined with historical trigger states and action detection models, it achieves efficient detection of dangerous behaviors of cabin occupants and solves the system complexity and high cost problems in the existing technology. problem, improving the accuracy and reliability of detection.
Patent Information
- Application Number
- CN202410886510.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-10-29
AI Technical Summary
In the existing technology, the installation of multiple sensors in the vehicle cockpit results in system complexity and high cost, and sensor failure may lead to misjudgment, reducing the accuracy and reliability of dangerous behavior detection.
Collect cabin images in real time through on-board cameras, perform face recognition and key point positioning, determine dangerous behavior detection areas, use historical trigger states and action detection model scheduling, and conduct dangerous behavior detection based on target detection models to reduce computing resources and improve detection accuracy. performance and reliability.
It reduces the cost of cockpit occupant behavior detection, improves the accuracy and reliability of dangerous behavior detection, reduces misjudgments, and improves the pertinence and efficiency of the system.
Smart Images

Figure CN118865335A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of smart cockpits, and in particular to a dangerous behavior detection method, device, computer equipment and storage medium. Background Art
[0002] As cars gradually become an indispensable means of transportation in people's daily lives, the penetration rate of vehicles continues to rise. This trend has not only brought about a significant improvement in travel convenience, but also put forward higher requirements for vehicle internal safety management. In this context, in order to ensure driving safety and improve the safety of the traffic driving environment, it is necessary to identify and detect the behavior of occupants in the vehicle cabin so that dangerous behaviors that may cause driving safety problems can be intervened in time to avoid traffic accidents.
[0003] In the prior art, a variety of sensors are usually installed in the vehicle, and the status of the cabin occupants is identified by each sensor, and then the behavior of the cabin occupants is identified and detected. However, it is found in the study that due to the diversity and complexity of behavior, the installation of multiple sensors, the connection between different sensors, and the data transmission between sensors will cause the system to be complicated and incur high costs. In addition, if any sensor fails, it will not be able to accurately sense the changes in the occupant's status, and it is likely to misjudge the behavior of the cabin occupants. In the case of being unable to accurately identify the behavior of the cabin occupants, the accuracy of the detected dangerous behavior and the reliability of the dangerous behavior detection results are further reduced. Summary of the invention
[0004] In view of this, an object of the present invention is to provide a dangerous behavior detection method, apparatus, computer equipment and storage medium to reduce the cost of cabin passenger behavior detection and improve the accuracy and reliability of dangerous behavior detection results.
[0005] In a first aspect, an embodiment of the present application provides a dangerous behavior detection method, the method comprising:
[0006] The vehicle cabin image is collected in real time by a vehicle-mounted camera, wherein the vehicle cabin image includes the face of the cabin occupant;
[0007] Performing face recognition on the current cabin image to obtain a face detection frame, and performing face key point positioning on the face in the face detection frame to obtain actual face key points of the cabin occupant;
[0008] Determining detection areas for various dangerous behaviors of the cabin occupant based on the actual facial key points, wherein the dangerous behaviors include smoking, drinking, and making phone calls;
[0009] Determine a target dangerous behavior detection model for dangerous behavior detection on the current cabin image according to the historical triggering state of each dangerous behavior and the historical calling state of the action detection model configured for each dangerous behavior;
[0010] Based on the target dangerous behavior detection model, dangerous behavior detection is performed on a target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image.
[0011] Optionally, when the target dangerous behavior is smoking, performing dangerous behavior detection on a target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes:
[0012] Inputting the target detection area of smoking behavior into the target dangerous behavior detection model configured for smoking behavior to obtain a smoking detection result of whether smoking behavior is triggered within the target detection area of smoking behavior;
[0013] If the smoking detection result indicates that smoking behavior is triggered in the target detection area of smoking behavior, then based on the dangerous behavior detection model configured for drinking behavior, dangerous behavior detection is performed on the detection area of drinking behavior in the current cabin image to obtain a drinking detection result indicating whether drinking behavior is triggered in the target detection area;
[0014] If the drinking water detection result is that the drinking water behavior is not triggered in the target detection area, then based on the dangerous behavior detection model configured for the phone call behavior, the dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image to obtain a phone call detection result of whether the phone call behavior is triggered in the target detection area;
[0015] If the calling detection result is that no calling behavior is triggered in the target detection area, a smoking risk behavior alarm is issued.
[0016] Optionally, performing dangerous behavior detection on a target detection area of a target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes:
[0017] When the target dangerous behavior is drinking behavior, a dangerous behavior detection is performed on the detection area of drinking behavior in the current cabin image based on the dangerous behavior detection model configured for drinking behavior, and a drinking detection result is obtained to determine whether drinking behavior is triggered in the target detection area; if the drinking detection result indicates that drinking behavior is triggered in the target detection area, a drinking dangerous behavior alarm is issued;
[0018] When the target dangerous behavior is making a phone call, a dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image based on the dangerous behavior detection model configured for the phone call behavior, and a phone call detection result is obtained to determine whether the phone call behavior is triggered in the target detection area; if the phone call detection result indicates that the phone call behavior is triggered in the target detection area, an alarm for dangerous phone behavior is issued.
[0019] Optionally, determining the detection area of each dangerous behavior of the cabin occupant according to the actual facial key points includes:
[0020] Determine the head posture of the cabin occupant according to the actual facial key points, and project the actual facial key points combined with the head posture into an image screen;
[0021] Determine the vertical direction of the head in the image and the horizontal direction of the head in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the head posture, and determine the two-dimensional center point of the mouth in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the three-dimensional center point of the mouth;
[0022] For smoking behavior, the two-dimensional center point of the mouth in the image is taken as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area of the smoking behavior;
[0023] For drinking water behavior or making phone calls, the face detection frame in the image is taken as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area for drinking water behavior or making phone calls.
[0024] Optionally, taking the two-dimensional center point of the mouth in the image as the center of the detection area, and expanding the area along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area of the smoking behavior includes:
[0025] Generate a square area with the two-dimensional center point of the mouth in the image as the center and the long side of the outer frame of the mouth as the side length;
[0026] Expand the square area along the vertical direction of the head of the person in the image by a first preset multiple to both ends, and expand the square area along the horizontal direction of the head of the person in the image by a second preset multiple to both ends, to obtain the detection area of the smoking behavior;
[0027] The detection area for drinking water behavior or making phone calls is obtained by taking the face detection frame in the image as the center of the detection area and expanding the area along the vertical direction of the head in the image and the horizontal direction of the head in the image, respectively, including:
[0028] The area to be expanded where the face detection frame in the image is located is expanded outwards by a third preset multiple along the vertical direction of the head in the image by a third preset multiple, and the area to be expanded outwards by a fourth preset multiple along the horizontal direction of the head in the image by a fourth preset multiple, to obtain a suspicious area of the drinking behavior or the phone call behavior;
[0029] The suspicious area is expanded outwards by a fifth preset multiple toward both ends along its height direction, and the suspicious area is expanded outwards by a sixth preset multiple toward both ends along its width direction, to obtain a detection area for the drinking behavior or the phone call behavior.
[0030] Optionally, determining a target dangerous behavior detection model for performing dangerous behavior detection on the current cabin image according to the historical triggering state of each dangerous behavior and the historical calling state of the action detection model configured for each dangerous behavior includes:
[0031] For each dangerous behavior, determining whether the scheduling time interval between the time when the action detection model configured for the dangerous behavior was last scheduled and the time when the cabin image was collected exceeds a preset time interval, or whether the dangerous behavior was triggered within a preset time period before the cabin image was collected;
[0032] If the scheduling time interval between the time of the most recent scheduling of the action detection model configured for the dangerous behavior and the time of collecting the cabin image exceeds the preset time interval, or the dangerous behavior is triggered within the preset time length before collecting the cabin image, the action detection model configured for the dangerous behavior will be determined as the target dangerous behavior detection model.
[0033] Optionally, the method further comprises:
[0034] Obtaining several regional images of the detection area of smoking behavior, segmenting and annotating the regional images with smoke and being ignited in each regional image, and constructing a model training set;
[0035] Using the model training set to perform model training on a dual-branch convolutional neural network to obtain a target risk behavior detection model configured for smoking behavior;
[0036] Among them, the model input of the target dangerous behavior detection model configured for smoking behavior is the detection area of smoking behavior, and its model output includes the output performed by the classification branch and the output performed by the segmentation branch, the classification branch outputs the smoking behavior trigger probability, and the segmentation branch outputs the pixel-level category probability; when the classification branch output probability is greater than the preset smoking behavior probability threshold, and the segmentation branch outputs that the segmentation shape of the smoke in the detection area is an ellipse and the proportion of the ellipse area in the detection area exceeds the preset area threshold, the smoking detection result of the detection area is output as triggering smoking behavior.
[0037] In a second aspect, an embodiment of the present application provides a dangerous behavior detection device, the device comprising:
[0038] A vehicle cabin image acquisition model, used to collect vehicle cabin images in real time through a vehicle-mounted camera, wherein the cabin images include faces of cabin occupants;
[0039] A face recognition module is used to perform face recognition on the current cabin image to obtain a face detection frame, and to locate face key points of the face in the face detection frame to obtain actual face key points of the cabin occupant;
[0040] A detection area determination module, used to determine the detection area of each dangerous behavior of the cabin occupant according to the actual facial key points, wherein the dangerous behavior includes smoking, drinking and making phone calls;
[0041] A detection model calling module, used to determine a target dangerous behavior detection model for dangerous behavior detection on a current cabin image according to a historical trigger state of each dangerous behavior and a historical calling state of an action detection model configured for each dangerous behavior;
[0042] The dangerous behavior detection module is used to perform dangerous behavior detection on a target detection area of a target dangerous behavior corresponding to the target dangerous behavior detection model in a current cabin image based on the target dangerous behavior detection model.
[0043] Optionally, when the target dangerous behavior is smoking, performing dangerous behavior detection on a target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes:
[0044] Inputting the target detection area of smoking behavior into the target dangerous behavior detection model configured for smoking behavior to obtain a smoking detection result of whether smoking behavior is triggered within the target detection area of smoking behavior;
[0045] If the smoking detection result indicates that smoking behavior is triggered in the target detection area of smoking behavior, then based on the dangerous behavior detection model configured for drinking behavior, dangerous behavior detection is performed on the detection area of drinking behavior in the current cabin image to obtain a drinking detection result indicating whether drinking behavior is triggered in the target detection area;
[0046] If the drinking water detection result is that the drinking water behavior is not triggered in the target detection area, then based on the dangerous behavior detection model configured for the phone call behavior, the dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image to obtain a phone call detection result of whether the phone call behavior is triggered in the target detection area;
[0047] If the calling detection result is that no calling behavior is triggered in the target detection area, a smoking risk behavior alarm is issued.
[0048] Optionally, performing dangerous behavior detection on a target detection area of a target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes:
[0049] When the target dangerous behavior is drinking behavior, a dangerous behavior detection is performed on the detection area of drinking behavior in the current cabin image based on the dangerous behavior detection model configured for drinking behavior, and a drinking detection result is obtained to determine whether drinking behavior is triggered in the target detection area; if the drinking detection result indicates that drinking behavior is triggered in the target detection area, a drinking dangerous behavior alarm is issued;
[0050] When the target dangerous behavior is making a phone call, a dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image based on the dangerous behavior detection model configured for the phone call behavior, and a phone call detection result is obtained to determine whether the phone call behavior is triggered in the target detection area; if the phone call detection result indicates that the phone call behavior is triggered in the target detection area, an alarm for dangerous phone behavior is issued.
[0051] Optionally, determining the detection area of each dangerous behavior of the cabin occupant according to the actual facial key points includes:
[0052] Determine the head posture of the cabin occupant according to the actual facial key points, and project the actual facial key points combined with the head posture into an image screen;
[0053] Determine the vertical direction of the head in the image and the horizontal direction of the head in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the head posture, and determine the two-dimensional center point of the mouth in the image based on the three-dimensional center point of the mouth of the vehicle-mounted camera intrinsic parameters;
[0054] For smoking behavior, the two-dimensional center point of the mouth in the image is taken as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area of the smoking behavior;
[0055] For drinking water behavior or making phone calls, the face detection frame in the image is taken as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area for drinking water behavior or making phone calls.
[0056] Optionally, taking the two-dimensional center point of the mouth in the image as the center of the detection area, and expanding the area along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area of the smoking behavior includes:
[0057] Generate a square area with the two-dimensional center point of the mouth in the image as the center and the long side of the outer frame of the mouth as the side length;
[0058] Expand the square area along the vertical direction of the head of the person in the image by a first preset multiple to both ends, and expand the square area along the horizontal direction of the head of the person in the image by a second preset multiple to both ends, to obtain the detection area of the smoking behavior;
[0059] The detection area for drinking water behavior or making phone calls is obtained by taking the face detection frame in the image as the center of the detection area and expanding the area along the vertical direction of the head in the image and the horizontal direction of the head in the image, respectively, including:
[0060] The area to be expanded where the face detection frame in the image is located is expanded outwards by a third preset multiple along the vertical direction of the head in the image by a third preset multiple, and the area to be expanded outwards by a fourth preset multiple along the horizontal direction of the head in the image by a fourth preset multiple, to obtain a suspicious area of the drinking behavior or the phone call behavior;
[0061] The suspicious area is expanded outwards by a fifth preset multiple toward both ends along its height direction, and the suspicious area is expanded outwards by a sixth preset multiple toward both ends along its width direction, to obtain a detection area for the drinking behavior or the phone call behavior.
[0062] Optionally, determining a target dangerous behavior detection model for performing dangerous behavior detection on the current cabin image according to the historical triggering state of each dangerous behavior and the historical calling state of the action detection model configured for each dangerous behavior includes:
[0063] For each dangerous behavior, determining whether the scheduling time interval between the time when the action detection model configured for the dangerous behavior was last scheduled and the time when the cabin image was collected exceeds a preset time interval, or whether the dangerous behavior was triggered within a preset time period before the cabin image was collected;
[0064] If the scheduling time interval between the time of the most recent scheduling of the action detection model configured for the dangerous behavior and the time of collecting the cabin image exceeds the preset time interval, or the dangerous behavior is triggered within the preset time length before collecting the cabin image, the action detection model configured for the dangerous behavior will be determined as the target dangerous behavior detection model.
[0065] Optionally, the device further comprises:
[0066] A model training set construction module is used to obtain regional images of several smoking behavior detection areas, segment and annotate the regional images with smoke and ignition in each regional image, and construct a model training set;
[0067] A behavior detection model training module, used to perform model training on a dual-branch convolutional neural network using the model training set to obtain a target dangerous behavior detection model configured for smoking behavior;
[0068] Among them, the model input of the target dangerous behavior detection model configured for smoking behavior is the detection area of smoking behavior, and its model output includes the output performed by the classification branch and the output performed by the segmentation branch, the classification branch outputs the smoking behavior trigger probability, and the segmentation branch outputs the pixel-level category probability; when the classification branch output probability is greater than the preset smoking behavior probability threshold, and the segmentation branch outputs that the segmentation shape of the smoke in the detection area is an ellipse and the proportion of the ellipse area in the detection area exceeds the preset area threshold, the smoking detection result of the detection area is output as triggering smoking behavior.
[0069] In a third aspect, an embodiment of the present application provides a computer device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the dangerous behavior detection method described in any optional implementation manner of the first aspect are performed.
[0070] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the dangerous behavior detection method described in any optional implementation manner in the above-mentioned first aspect are executed.
[0071] The technical solution provided by this application includes but is not limited to the following beneficial effects:
[0072] The present application uses a vehicle-mounted camera to collect vehicle cabin images in real time, and performs subsequent behavior recognition detection of cabin occupants based on the collected cabin images. It can detect dangerous behaviors of cabin occupants without the need to deploy multiple sensors in the cabin, thereby reducing the cost of behavior recognition.
[0073] When performing subsequent behavior recognition detection of cabin occupants based on the collected cabin image, the present application obtains a face detection frame by performing face recognition on the current cabin image, and locates the face key points of the face within the face detection frame to obtain the actual face key points of the cabin occupant, and then determines the detection area of each dangerous behavior of the cabin occupant based on the actual face key points. The detection area of different dangerous behaviors in the image can be determined according to the behavioral characteristics of different dangerous behaviors, and image detection in a global range can be narrowed down to image detection in a local range. The detection area can be focused, thereby improving the targeted detection of each dangerous behavior, thereby improving the accuracy of the detection result, while reducing the amount of calculation in the image detection process and saving system computing power.
[0074] Finally, the present application determines a target dangerous behavior detection model for performing dangerous behavior detection on the current cabin image based on the historical trigger status of each dangerous behavior and the historical calling status of the action detection model configured for each dangerous behavior, and then performs dangerous behavior detection on the target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model. For dangerous behaviors with a higher probability of occurrence, the action detection model configured for them can be called to detect the dangerous behaviors, thereby improving the adaptability between the data to be processed and the model for processing the data, thereby improving the accuracy and reliability of the obtained dangerous action detection results.
[0075] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0077] Figure 1 A flowchart of a dangerous behavior detection method provided by Embodiment 1 of the present invention is shown;
[0078] Figure 2 A flowchart of a smoking behavior detection method provided by the first embodiment of the present invention is shown;
[0079] Figure 3 A flow chart of a method for determining a detection area provided in Embodiment 1 of the present invention is shown;
[0080] Figure 4 A flow chart of a method for determining a detection area for smoking behavior provided in Embodiment 1 of the present invention is shown;
[0081] Figure 5 A flow chart of a method for determining a detection area for drinking water or making a phone call provided in the first embodiment of the present invention is shown;
[0082] Figure 6 A flow chart of a method for determining a target dangerous behavior detection model provided by the first embodiment of the present invention is shown;
[0083] Figure 7 A flowchart of a dangerous behavior detection program based on model calling provided by the first embodiment of the present invention is shown;
[0084] Figure 8 A flowchart of a smoking behavior detection model training method provided by the first embodiment of the present invention is shown;
[0085] Fig. 9 A schematic diagram of the structure of a dangerous behavior detection device provided by Embodiment 2 of the present invention is shown;
[0086] Fig.10 A schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention is shown. DETAILED DESCRIPTION
[0087] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.
[0088] Embodiment 1
[0089] To facilitate understanding of this application, Figure 1 The flowchart of a dangerous behavior detection method provided in the first embodiment of the present invention is shown to describe the contents of the first embodiment of the present application in detail.
[0090] See also Figure 1 As shown, Figure 1 A flowchart of a dangerous behavior detection method provided in Embodiment 1 of the present invention is shown, wherein the method comprises steps S101 to S105:
[0091] S101: Capturing a vehicle cabin image in real time through a vehicle-mounted camera, wherein the cabin image includes faces of cabin occupants.
[0092] Specifically, the onboard camera is an OMS (Occupancy Monitoring System) RGB color camera or a DMS (Driver Monitoring System) IR infrared camera, wherein the DMSIR camera is arranged at the A-pillar position to collect cabin images of the driver's area, and the OMS RGB camera is arranged at the rearview mirror position to collect cabin images of the front and rear seat areas. The cabin occupants can be the driver in the driver's area or the cabin passengers in the front and rear seat areas.
[0093] S102: performing face recognition on the current cabin image to obtain a face detection frame, and performing facial key point positioning on the face in the face detection frame to obtain actual facial key points of the cabin occupant.
[0094] Specifically, the current frame cabin image is input into the trained face recognition model to obtain the face detection frame; the face recognition model is based on a deep learning detection framework, uses a convolutional neural network model as a feature extraction network, collects cabin image data in real time through the DMS IR camera and OMS RGB camera in the cabin, annotates the face detection frame to form a data set, and uses the data set to train the face recognition model.
[0095] The regional image contained in the face detection frame is cut and input into the trained face key point location model to obtain the actual face key points of the face contained in the face detection frame; the face key point location model is based on a deep learning regression network, uses a convolutional neural network model as a feature extraction network, and forms a face key point location data set by marking the key points of the face area. The face key point location model is trained using the data set.
[0096] S103: Determine detection areas for various dangerous behaviors of the cabin occupant based on the actual facial key points, wherein the dangerous behaviors include smoking, drinking, and making phone calls.
[0097] Specifically, the head posture of the cabin occupant is determined according to the actual face key points, and the detection area of each dangerous behavior is determined according to the head posture and the face detection frame; for different dangerous behaviors, the behavior position and range when they occur are different. For example, for smoking behavior, smoking is to put the cigarette butt into the mouth, and the cigarette butt extends outward along the mouth, so the location and range of the smoking behavior are around the occupant's mouth; and for the phone call behavior, the occupant needs to hold the phone to the ear, so the location and range of the phone call behavior are around the occupant's ear. The location and range where the above-mentioned dangerous behaviors may occur are usually local areas within the face area, which only occupy a small part of the face area, and some dangerous behaviors will not occur in the remaining areas, so it is unnecessary to detect these dangerous behaviors in these remaining areas, and it is only necessary to detect the dangerous behavior in the area where a certain dangerous behavior may occur. Therefore, the detection areas of different dangerous behaviors are determined respectively according to the head posture of the occupant and the face detection frame of the occupant, so that different dangerous behaviors can be detected in different detection areas later, reducing the consumption of computing power.
[0098] At the same time, if multiple dangerous behaviors are detected globally, false detection of dangerous behaviors may occur due to the similarity of the actions of some dangerous behaviors. Therefore, before doing so, the detection area where each dangerous behavior may occur is deducted, which can focus more on the dangerous behavior when detecting different dangerous behaviors, suppress the occurrence of false detection, and improve the accuracy of recognition.
[0099] S104: Determine a target dangerous behavior detection model for performing dangerous behavior detection on the current cabin image according to the historical triggering status of each dangerous behavior and the historical calling status of the action detection model configured for each dangerous behavior.
[0100] Specifically, an action detection model is pre-configured for each dangerous behavior, and the historical calling status of the action detection model configured for each dangerous behavior is monitored in real time, the historical calling status includes but is not limited to the historical calling frequency, historical calling time, etc.; and the historical triggering status of each dangerous behavior is monitored in real time, the historical triggering status includes but is not limited to the historical triggering frequency, historical triggering time, etc.
[0101] The dynamic frequency rotation calling strategy is adopted. According to the historical triggering status of each dangerous behavior and the historical calling status of the action detection model configured for each dangerous behavior, the action detection model that has not been called for the longest time or has not been triggered for the corresponding dangerous action for the longest time is determined as the target dangerous behavior detection model for detecting the current cockpit image. In this way, when there is no need to call all action detection models, only the action detection model of the most likely dangerous behavior is called for calculation, thereby reducing the computing resources for dangerous behavior inspection.
[0102] S105: Performing dangerous behavior detection on a target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model.
[0103] Specifically, after determining the target dangerous behavior detection model for dangerous behavior detection on the current cabin image, the detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model is input into the target dangerous behavior detection model to obtain a detection result of whether the detection area triggers the target dangerous behavior.
[0104] In an alternative embodiment, see Figure 2 As shown, Figure 2 A flowchart of a smoking behavior detection method provided in the first embodiment of the present invention is shown, wherein when the target dangerous behavior is smoking behavior, the target dangerous behavior detection model is used to detect the target dangerous behavior in the target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image, including steps S201 to S204:
[0105] S201: Inputting the target detection area of smoking behavior into the target dangerous behavior detection model configured for smoking behavior to obtain a smoking detection result of whether smoking behavior is triggered within the target detection area of smoking behavior.
[0106] Specifically, when the target dangerous behavior detection model determined in step S104 is an action detection model configured for smoking behavior, the detection area of the smoking behavior is input into the action detection model configured for the smoking behavior to obtain a smoking detection result of whether the smoking behavior is triggered in the target detection area of the smoking behavior. The smoking detection result is a preliminary detection result of the smoking behavior. In order to avoid interference of other similar behaviors on the identification of the smoking behavior, after obtaining the preliminary detection result, the identification of other similar dangerous behaviors can be performed as an auxiliary detection of the smoking behavior.
[0107] S202: If the smoking detection result shows that smoking behavior is triggered within the target detection area for smoking behavior, dangerous behavior detection is performed on the detection area for drinking behavior in the current cabin image based on the dangerous behavior detection model configured for drinking behavior to obtain a drinking detection result of whether drinking behavior is triggered within the target detection area.
[0108] Specifically, if the smoking detection result shows that smoking behavior is triggered in the target detection area of smoking behavior, then the recognition detection of drinking behavior is performed, that is, the detection area of drinking behavior in the current cabin image is input into the dangerous behavior detection model configured for drinking behavior to obtain the drinking detection result of whether drinking behavior is triggered. If the smoking detection result shows that smoking behavior is not triggered in the target detection area of smoking behavior, then the current cabin image is determined as not having dangerous behavior triggered.
[0109] S203: If the drinking water detection result is that the drinking water behavior is not triggered in the target detection area, a dangerous behavior detection is performed on the detection area of the calling behavior in the current cabin image based on the dangerous behavior detection model configured for the calling behavior, and a calling detection result is obtained to determine whether the calling behavior is triggered in the target detection area.
[0110] Specifically, since smoking and drinking are mutually exclusive behaviors, that is, a person cannot drink water while smoking, or smoke while drinking water, if the drinking detection result is that the drinking behavior is not triggered, it means that the occupant may indeed be smoking at this time, but there are similar dangerous behaviors (making phone calls) that may cause the smoking behavior to be misidentified, so it is necessary to perform recognition detection of the making phone calls, that is, the detection area of the making phone calls in the current cabin image is input into the dangerous behavior detection model configured for the making phone calls, to obtain the making phone calls detection result of whether the making phone calls are triggered.
[0111] If the drinking water detection result shows that drinking water behavior is triggered in the target detection area, it means that the detection result of smoking behavior is a false detection, and the final dangerous behavior detection result is determined as triggering drinking water behavior, and a drinking water dangerous behavior alarm is issued.
[0112] S204: If the calling detection result is that the calling behavior is not triggered in the target detection area, a smoking risk behavior alarm is issued.
[0113] Specifically, since the driver in the car needs to hold the steering wheel with at least one hand, it is impossible to make a phone call and smoke at the same time. Therefore, smoking and making a phone call are mutually exclusive behaviors, that is, it is impossible for a person to make a phone call while smoking, or to smoke while making a phone call. Therefore, if the detection results of making a phone call and drinking water are both not triggered, it means that the occupant is indeed smoking, and the final detection result can be obtained, that is, smoking. At this time, an alarm for dangerous smoking behavior is issued, and a high-level warning signal is issued.
[0114] If the calling detection result is that the calling behavior is triggered in the target detection area, then it means that the detection result of the smoking behavior is a false detection, and the final dangerous behavior detection result is determined to be the triggering of the calling behavior, and an alarm for dangerous calling behavior is issued.
[0115] In an optional implementation, the step of performing dangerous behavior detection on a target detection area of a target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes:
[0116] When the target dangerous behavior is drinking water, a dangerous behavior detection is performed on the detection area of the drinking water behavior in the current cabin image based on the dangerous behavior detection model configured for the drinking water behavior, and a drinking water detection result is obtained to determine whether the drinking water behavior is triggered in the target detection area; if the drinking water detection result indicates that the drinking water behavior is triggered in the target detection area, a drinking water dangerous behavior alarm is issued.
[0117] Specifically, if the target dangerous behavior detection model determined by step S104 is an action detection model configured for drinking behavior, then the detection area of the drinking behavior is directly input into the action detection model configured for drinking behavior to obtain a detection result of whether the cockpit image triggers the drinking behavior.
[0118] When the target dangerous behavior is making a phone call, a dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image based on the dangerous behavior detection model configured for the phone call behavior, and a phone call detection result is obtained to determine whether the phone call behavior is triggered in the target detection area; if the phone call detection result indicates that the phone call behavior is triggered in the target detection area, an alarm for dangerous phone behavior is issued.
[0119] Specifically, if the target dangerous behavior detection model determined by step S104 is an action detection model configured for phone calling behavior, then the detection area of the phone calling behavior is directly input into the action detection model configured for the phone calling behavior to obtain a detection result of whether the cockpit image triggers the phone calling behavior.
[0120] In an alternative embodiment, see Figure 3 As shown, Figure 3 A flow chart of a detection area determination method provided in Embodiment 1 of the present invention is shown, wherein the detection area of each dangerous behavior of the cabin occupant is determined according to the actual facial key points, including steps S301 to S303:
[0121] S301: Determine the head posture of the cabin occupant according to the actual facial key points, and project the actual facial key points combined with the head posture into an image screen.
[0122] Specifically, the head posture of the cabin occupant is determined according to the actual facial key points, including: pre-generating a standard three-dimensional facial key point, whose three-dimensional coordinates correspond one-to-one to the coordinates of the actual facial key points; according to the coordinates of the preset three-dimensional facial key points and the coordinates of the actual facial key points, using the solvePnP (monocular relative pose estimation function) algorithm to calculate the head posture in the vehicle-mounted camera coordinate system.
[0123] Project the vertical downward direction in the vehicle camera coordinate system to the pixel plane to obtain the vertical direction V of the head in the image. downward , the horizontal direction V of the head in the image can be calculated accordingly leftward . Set the mouth's 3D center point V mouth_center_3d Projected onto the pixel plane, we get the two-dimensional center point V of the mouth in the image. mouth_center_2d .
[0124] S302: Determine the vertical direction of the human head in the image and the horizontal direction of the human head in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the head posture, and determine the two-dimensional center point of the mouth in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the three-dimensional center point of the mouth.
[0125] Specifically, the vertical direction V of the head in the image is determined by the following expression: downward , the horizontal direction V of the head in the image leftward and the two-dimensional center point V of the mouth in the image mouth_center_2d :
[0126]
[0127]
[0128] Among them, M intrinsic is the intrinsic parameter matrix of the camera intrinsic parameters of the vehicle-mounted camera, R is the rotation matrix of the head posture in the vehicle-mounted camera coordinate system, T is the translation vector of the head posture in the vehicle-mounted camera coordinate system, x is the x-axis coordinate value of the three-dimensional center point of the mouth, y is the y-axis coordinate value of the three-dimensional center point of the mouth, and z is the z-axis coordinate value of the three-dimensional center point of the mouth.
[0129] S303: For smoking behavior, the two-dimensional center point of the mouth in the image is used as the center of the detection area, and the area is expanded along the vertical direction of the human head in the image and the horizontal direction of the human head in the image to obtain the detection area of the smoking behavior.
[0130] Specifically, since smoking usually occurs around the mouth and the size of the cigarette is small, the range in which smoking may occur is small. Therefore, when determining the detection area for smoking behavior, the two-dimensional center point of the mouth is used as the center of the detection area to expand the area to obtain the detection area for smoking behavior.
[0131] S304: For drinking water behavior or making phone calls, the face detection frame in the image is used as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area of the drinking water behavior or the phone calls behavior.
[0132] Specifically, since drinking water or making phone calls usually occurs in a large area and may occur in the entire face area, when determining the detection area for drinking water or making phone calls, the area is expanded with the face detection frame in the image as the center of the detection area to obtain the detection area for drinking water or making phone calls.
[0133] In an alternative embodiment, see Figure 4 As shown, Figure 4 A flow chart of a method for determining a detection area for smoking behavior provided in the first embodiment of the present invention is shown, wherein the two-dimensional center point of the mouth in the image is used as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area for smoking behavior, including steps S401 to S402:
[0134] S401: Generate a square area with the two-dimensional center point of the mouth in the image as the center and the long side of the mouth circumscribed frame as the side length.
[0135] S402: Expand the square area vertically to both ends of the head in the image by a first preset multiple, and expand the square area horizontally to both ends of the head in the image by a second preset multiple, to obtain a detection area for the smoking behavior.
[0136] Specifically, the side length of a square area with the same area as the face detection frame is recorded as L. The center point V of the mouth in the image is mouth_center_2d The center is a*L, and the vertical direction of the head in the image is expanded to both ends by a*L, and the horizontal direction of the head in the image is expanded to both ends by b*L, a and b are the first preset multiples and the second preset multiples respectively, and the rectangle obtained after expansion is the detection area of smoking behavior. a and b are obtained by statistically obtaining the distribution of mouth data.
[0137] See also Figure 5 As shown, Figure 5A flow chart of a method for determining a detection area for drinking behavior or making a phone call provided in the first embodiment of the present invention is shown, wherein the method takes the face detection frame in the image as the center of the detection area, and expands the area along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area for drinking behavior or making a phone call, including steps S501 to S502:
[0138] S501: Expand the area to be expanded where the face detection frame in the image is located by a third preset multiple in the vertical direction of the head in the image, and expand the area to be expanded by a fourth preset multiple in the horizontal direction of the head in the image, to obtain a suspicious area of the drinking behavior or the phone call behavior.
[0139] Specifically, taking the area to be expanded where the face detection frame in the image is located as the center, expand outwards by a third preset multiple to both ends along the vertical direction of the head in the image, and expand outwards by a fourth preset multiple to both ends along the horizontal direction of the head in the image, so that the area after the first expansion just contains all the actual facial key points, and the area after the first expansion is taken as a suspicious area, recorded as face_bounding_box.
[0140] S502: Expand the suspicious area along its height direction outward by a fifth preset multiple to both ends, and expand the suspicious area along its width direction outward by a sixth preset multiple to both ends, to obtain a detection area for the drinking behavior or the phone call behavior.
[0141] Specifically, the width and height of the suspicious area face_bounding_box are recorded as face_width and face_height respectively. In order to ensure that the area can capture more abnormal areas, the face_bounding_box is expanded upward and downward by c*face_height, and expanded left and right by d*face_width, where c is the fifth preset multiple and d is the sixth preset multiple, and the area is expanded for the second time. The rectangle obtained after the second expansion is used as the detection area for the drinking behavior or the calling behavior. c and d are obtained by statistically analyzing the distribution of the head data.
[0142] In an alternative embodiment, see Figure 6 As shown, Figure 6 A flow chart of a method for determining a target dangerous behavior detection model provided by the first embodiment of the present invention is shown, wherein the method for determining a target dangerous behavior detection model for performing dangerous behavior detection on a current cabin image according to the historical triggering state of each dangerous behavior and the historical calling state of the action detection model configured for each dangerous behavior comprises steps S601 to S602:
[0143] S601: For each dangerous behavior, determine whether the scheduling time interval between the time when the action detection model configured for this dangerous behavior was last scheduled and the time when the cabin image was collected exceeds a preset time interval, or whether this dangerous behavior was triggered within a preset duration before the cabin image was collected.
[0144] S602: If the scheduling time interval between the time when the action detection model configured for this dangerous behavior was last scheduled and the time when the cabin image was collected exceeds the preset time interval, or this dangerous behavior was triggered within a preset duration before the cabin image was collected, then determine the action detection model configured for this dangerous behavior as the target dangerous behavior detection model.
[0145] Specifically, obtain the historical trigger status (the most recent trigger time) of each dangerous behavior and the historical call status (the most recent call time) of the action detection model configured for each dangerous behavior. At the same time, obtain the preset scheduling timeout threshold expired_ms and the activation state duration window active_window_ms.
[0146] Let the current frame cabin image collection time be current_ms. For the action detection model configured for a certain dangerous behavior, record the most recent call time of this action detection model as last_invoke_ms. If the time interval between the current frame cabin image collection time and the most recent call time of this action detection model exceeds the scheduling timeout threshold (i.e., when current_ms - last_invoke_ms > expired_ms), then the call of this action detection model times out; record the most recent trigger time of the dangerous action corresponding to this action detection model as last_detected_millis. If it was triggered within the activation state duration window (current_ms - last_detected_ms < active_window_ms), it means that this dangerous behavior is activated.
[0147] When the call of the action detection model for a certain dangerous behavior times out, or this dangerous behavior is activated, then determine the action detection model configured for this dangerous behavior as the target dangerous behavior detection model, regard this dangerous action as the dangerous action to be detected in the current frame cabin image, and use this action detection model as the target dangerous behavior detection model to detect whether this dangerous behavior is triggered.
[0148] Alternatively, dangerous behavior detection can also be performed through the following dangerous behavior detection program based on model calls. See Figure 7 as shown Figure 7A flow chart of a dangerous behavior detection program based on model calling provided by the first embodiment of the present invention is shown, wherein before detecting the current frame cockpit image, the model calling program is started to determine whether the scheduling of any action has timed out (i.e., determine whether the call of the action detection model of any dangerous behavior has timed out). If the result of the scheduling timeout judgment is "Y", i.e., timeout, the action that has not been recognized for the longest time (i.e., dangerous behavior) is selected from the timed-out actions, and it is identified whether the dangerous action exists in the current frame, and the recognition result is stored in the judgment window. If the result of the scheduling timeout judgment is "N", it is determined whether any action is activated (i.e., whether it is triggered); if the activation judgment result is "Y", the action that has not been recognized for the longest time is selected from the activated actions, and it is identified whether the dangerous action exists in the current frame, and the recognition result is stored in the judgment window; if the activation judgment result is "N", no dangerous action recognition is performed on the current frame, and dangerous behavior detection is performed on the next frame cockpit image of the current cockpit image.
[0149] In an alternative embodiment, see Figure 8 As shown, Figure 8 The flowchart of a smoking behavior detection model training method provided in the first embodiment of the present invention is shown, wherein the method further includes steps S801 to S802:
[0150] S801: Acquire several regional images of the detection area of smoking behavior, segment and annotate the regional images with smoke and lighted in each regional image, and construct a model training set.
[0151] Specifically, the regional images of the detection areas of each smoking behavior are annotated into four categories: images with smoke and lit, images with smoke but not lit, images with other tubular objects, and images without anything. For images with smoke and lit, the lit areas of the cigarette butts in the images are segmented and annotated to obtain the model training set. When constructing the model training set, try to ensure that the number of the four categories of images is evenly distributed.
[0152] S802: Using the model training set to perform model training on the dual-branch convolutional neural network to obtain a target dangerous behavior detection model configured for smoking behavior; wherein, the model input of the target dangerous behavior detection model configured for smoking behavior is the detection area of smoking behavior, and its model output includes the output of the classification branch and the output of the segmentation branch, the classification branch outputs the smoking behavior trigger probability, and the segmentation branch outputs the pixel-level category probability; when the classification branch output probability is greater than a preset smoking behavior probability threshold, and the segmentation branch outputs that the segmentation shape of the smoke in the detection area is an ellipse and the proportion of the ellipse area in the detection area exceeds the preset area threshold, the smoking detection result of the detection area is output as triggering smoking behavior.
[0153] Specifically, when training the action detection model for smoking behavior, a convolutional neural network model is used as the feature extraction network based on the deep learning framework. At the same time, in order to make the network pay more attention to the head position of the tubular object in the detection area, a multi-head design method is adopted, with a double-branch convolutional neural network as the model structure, and two heads are introduced after the feature extraction network. The left head is used for the detection area classification task, and the right head is used for the detection area segmentation task.
[0154] In order to meet the training requirements of multi-head networks, a loss function combining classification and segmentation is used to train the network. At the same time, in order to make the model more robust to illumination and deformation, a data enhancement method combining color domain and geometry is used to expand the training samples in the model training set. In addition, the training samples can be randomly jittered to increase the generalization ability of the model.
[0155] The model output consists of two parts. The first part is the output of the category probability by the classification branch, and the second part is the output of the pixel-level category probability by the segmentation branch. When the first part outputs that there is smoke in the detection area and it is ignited and the probability exceeds the preset probability threshold, and the second part outputs that the segmented shape of the smoke in the detection area is an ellipse and the proportion of the ellipse area in the detection area exceeds the preset area threshold, it is determined that there is smoking behavior in the detection area, and the smoking detection result is output as triggering smoking behavior, and steps S202 to S204 are continued. If the final detection result obtained by step S204 is smoking, a smoking risk behavior alarm is issued and a high-level warning signal is issued. If the first part outputs that there is smoke in the detection area and it is ignited and the probability exceeds the preset probability threshold, and the second part outputs that the segmented shape of the smoke in the detection area is an ellipse and the proportion of the ellipse area in the detection area exceeds the preset area threshold, the smoking detection result is determined as not triggering smoking behavior. When the first part outputs that there is smoke in the detection area but it is not ignited, a low-level warning signal is issued.
[0156] The dangerous behavior detection method provided by the present application can be used in a smart cockpit to monitor cockpit members in real time, divide the suspicious detection areas of each dangerous behavior of the cockpit members, analyze and judge their dangerous behaviors, and use the joint judgment of multiple dangerous behaviors to accurately detect the smoking behavior of the cockpit members. Furthermore, the present application adopts the scheduling and joint judgment between multiple models to realize the judgment of smoking behavior, avoiding false alarms and missed alarms caused by the instability of a single model. On the other hand, the present application adopts the method of cigarette butt segmentation in suspicious areas, focusing the model's attention on the cigarette butt part of the cigarette, and judging the smoking behavior by judging whether there are lit cigarette butts in the suspicious area, avoiding false alarms caused by other tubular objects.
[0157] Embodiment 2
[0158] See also Fig. 9 As shown, Fig. 9 A schematic diagram of the structure of a dangerous behavior detection device provided by Embodiment 2 of the present invention is shown, wherein the device comprises:
[0159] A vehicle cabin image acquisition model 901 is used to collect a vehicle cabin image in real time through a vehicle-mounted camera, wherein the vehicle cabin image includes the faces of cabin occupants;
[0160] The face recognition module 902 is used to perform face recognition on the current cabin image to obtain a face detection frame, and locate the face key points of the face in the face detection frame to obtain the actual face key points of the cabin occupant;
[0161] A detection area determination module 903 is used to determine the detection area of each dangerous behavior of the cabin occupant according to the actual facial key points, wherein the dangerous behavior includes smoking, drinking and making phone calls;
[0162] The detection model calling module 904 is used to determine a target dangerous behavior detection model for dangerous behavior detection on the current cabin image according to the historical triggering state of each dangerous behavior and the historical calling state of the action detection model configured for each dangerous behavior;
[0163] The dangerous behavior detection module 905 is used to perform dangerous behavior detection on a target detection area of a target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model.
[0164] In an optional implementation, when the target dangerous behavior is smoking, performing dangerous behavior detection on a target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes:
[0165] Inputting the target detection area of smoking behavior into the target dangerous behavior detection model configured for smoking behavior to obtain a smoking detection result of whether smoking behavior is triggered within the target detection area of smoking behavior;
[0166] If the smoking detection result indicates that smoking behavior is triggered in the target detection area of smoking behavior, then based on the dangerous behavior detection model configured for drinking behavior, dangerous behavior detection is performed on the detection area of drinking behavior in the current cabin image to obtain a drinking detection result indicating whether drinking behavior is triggered in the target detection area;
[0167] If the drinking water detection result is that the drinking water behavior is not triggered in the target detection area, then based on the dangerous behavior detection model configured for the phone call behavior, the dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image to obtain a phone call detection result of whether the phone call behavior is triggered in the target detection area;
[0168] If the calling detection result is that no calling behavior is triggered in the target detection area, a smoking risk behavior alarm is issued.
[0169] In an optional implementation, the step of performing dangerous behavior detection on a target detection area of a target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes:
[0170] When the target dangerous behavior is drinking behavior, a dangerous behavior detection is performed on the detection area of drinking behavior in the current cabin image based on the dangerous behavior detection model configured for drinking behavior, and a drinking detection result is obtained to determine whether drinking behavior is triggered in the target detection area; if the drinking detection result indicates that drinking behavior is triggered in the target detection area, a drinking dangerous behavior alarm is issued;
[0171] When the target dangerous behavior is making a phone call, a dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image based on the dangerous behavior detection model configured for the phone call behavior, and a phone call detection result is obtained to determine whether the phone call behavior is triggered in the target detection area; if the phone call detection result indicates that the phone call behavior is triggered in the target detection area, an alarm for dangerous phone behavior is issued.
[0172] In an optional implementation, the step of determining the detection area of each dangerous behavior of the cabin occupant based on the actual facial key points includes:
[0173] Determine the head posture of the cabin occupant according to the actual facial key points, and project the actual facial key points combined with the head posture into an image screen;
[0174] Determine the vertical direction of the head in the image and the horizontal direction of the head in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the head posture, and determine the two-dimensional center point of the mouth in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the three-dimensional center point of the mouth;
[0175] For smoking behavior, the two-dimensional center point of the mouth in the image is taken as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area of the smoking behavior;
[0176] For drinking water behavior or making phone calls, the face detection frame in the image is taken as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area for drinking water behavior or making phone calls.
[0177] In an optional embodiment, the two-dimensional center point of the mouth in the image is used as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area of the smoking behavior, including:
[0178] Generate a square area with the two-dimensional center point of the mouth in the image as the center and the long side of the outer frame of the mouth as the side length;
[0179] Expand the square area along the vertical direction of the head of the person in the image by a first preset multiple to both ends, and expand the square area along the horizontal direction of the head of the person in the image by a second preset multiple to both ends, to obtain the detection area of the smoking behavior;
[0180] The detection area for drinking water behavior or making phone calls is obtained by taking the face detection frame in the image as the center of the detection area and expanding the area along the vertical direction of the head in the image and the horizontal direction of the head in the image, respectively, including:
[0181] The area to be expanded where the face detection frame in the image is located is expanded outwards by a third preset multiple along the vertical direction of the head in the image by a third preset multiple, and the area to be expanded outwards by a fourth preset multiple along the horizontal direction of the head in the image by a fourth preset multiple, to obtain a suspicious area of the drinking behavior or the phone call behavior;
[0182] The suspicious area is expanded outwards by a fifth preset multiple toward both ends along its height direction, and the suspicious area is expanded outwards by a sixth preset multiple toward both ends along its width direction, to obtain a detection area for the drinking behavior or the phone call behavior.
[0183] In an optional implementation, determining a target dangerous behavior detection model for performing dangerous behavior detection on the current cabin image according to the historical triggering state of each dangerous behavior and the historical calling state of the action detection model configured for each dangerous behavior includes:
[0184] For each dangerous behavior, determining whether the scheduling time interval between the time when the action detection model configured for the dangerous behavior was last scheduled and the time when the cabin image was collected exceeds a preset time interval, or whether the dangerous behavior was triggered within a preset time period before the cabin image was collected;
[0185] If the scheduling time interval between the time of the most recent scheduling of the action detection model configured for the dangerous behavior and the time of collecting the cabin image exceeds the preset time interval, or the dangerous behavior is triggered within the preset time length before collecting the cabin image, the action detection model configured for the dangerous behavior will be determined as the target dangerous behavior detection model.
[0186] In an optional embodiment, the device further comprises:
[0187] A model training set construction module is used to obtain regional images of several smoking behavior detection areas, segment and annotate the regional images with smoke and ignition in each regional image, and construct a model training set;
[0188] A behavior detection model training module, used to perform model training on a dual-branch convolutional neural network using the model training set to obtain a target dangerous behavior detection model configured for smoking behavior;
[0189] Among them, the model input of the target dangerous behavior detection model configured for smoking behavior is the detection area of smoking behavior, and its model output includes the output performed by the classification branch and the output performed by the segmentation branch, the classification branch outputs the smoking behavior trigger probability, and the segmentation branch outputs the pixel-level category probability; when the classification branch output probability is greater than the preset smoking behavior probability threshold, and the segmentation branch outputs that the segmentation shape of the smoke in the detection area is an ellipse and the proportion of the ellipse area in the detection area exceeds the preset area threshold, the smoking detection result of the detection area is output as triggering smoking behavior.
[0190] Embodiment 3
[0191] Based on the same application concept, see Fig.10 As shown, Fig.10 FIG. 4 shows a schematic diagram of the structure of a computer device provided by Embodiment 3 of the present invention, wherein: Fig.10 As shown, a computer device 1000 provided in Embodiment 3 of the present application includes:
[0192] A processor 1001, a memory 1002 and a bus 1003, wherein the memory 1002 stores machine-readable instructions executable by the processor 1001. When the computer device 1000 is running, the processor 1001 communicates with the memory 1002 via the bus 1003, and the machine-readable instructions are executed by the processor 1001 to execute the steps of the dangerous behavior detection method shown in the above-mentioned embodiment 1.
[0193] Embodiment 4
[0194] Based on the same application concept, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the dangerous behavior detection method described in any one of the above embodiments are executed.
[0195] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0196] The computer program product for dangerous behavior detection provided in the embodiment of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0197] The dangerous behavior detection device provided in the embodiment of the present invention can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in the embodiment of the present invention are the same as those of the aforementioned method embodiment. For the sake of brief description, the parts not mentioned in the device embodiment can refer to the corresponding contents in the aforementioned method embodiment. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here.
[0198] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0199] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0200] In addition, each functional unit in the embodiment provided by the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0201] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0202] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.
[0203] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions described in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or perform equivalent replacements on some of the technical features thereof; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. They should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A dangerous behavior detection method, It is characterized in that The method comprises: The vehicle cabin image is collected in real time by a vehicle-mounted camera, wherein the vehicle cabin image includes the face of the cabin occupant; Performing face recognition on the current cabin image to obtain a face detection frame, and performing face key point positioning on the face in the face detection frame to obtain actual face key points of the cabin occupant; Determining detection areas for various dangerous behaviors of the cabin occupant based on the actual facial key points, wherein the dangerous behaviors include smoking, drinking, and making phone calls; Determine a target dangerous behavior detection model for dangerous behavior detection on the current cabin image according to the historical triggering state of each dangerous behavior and the historical calling state of the action detection model configured for each dangerous behavior; Based on the target dangerous behavior detection model, dangerous behavior detection is performed on a target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image.
2. The method according to claim 1, It is characterized in that When the target dangerous behavior is smoking, performing dangerous behavior detection on a target detection area of the target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes: Inputting the target detection area of smoking behavior into the target dangerous behavior detection model configured for smoking behavior to obtain a smoking detection result of whether smoking behavior is triggered within the target detection area of smoking behavior; If the smoking detection result indicates that smoking behavior is triggered in the target detection area of smoking behavior, then based on the dangerous behavior detection model configured for drinking behavior, dangerous behavior detection is performed on the detection area of drinking behavior in the current cabin image to obtain a drinking detection result indicating whether drinking behavior is triggered in the target detection area; If the drinking water detection result is that the drinking water behavior is not triggered in the target detection area, then based on the dangerous behavior detection model configured for the phone call behavior, the dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image to obtain a phone call detection result of whether the phone call behavior is triggered in the target detection area; If the calling detection result is that no calling behavior is triggered in the target detection area, a smoking risk behavior alarm is issued.
3. The method according to claim 1, It is characterized in that The performing dangerous behavior detection on a target detection area of a target dangerous behavior corresponding to the target dangerous behavior detection model in the current cabin image based on the target dangerous behavior detection model includes: When the target dangerous behavior is drinking behavior, a dangerous behavior detection is performed on the detection area of drinking behavior in the current cabin image based on the dangerous behavior detection model configured for drinking behavior, and a drinking detection result is obtained to determine whether drinking behavior is triggered in the target detection area; if the drinking detection result indicates that drinking behavior is triggered in the target detection area, a drinking dangerous behavior alarm is issued; When the target dangerous behavior is making a phone call, a dangerous behavior detection is performed on the detection area of the phone call behavior in the current cabin image based on the dangerous behavior detection model configured for the phone call behavior, and a phone call detection result is obtained to determine whether the phone call behavior is triggered in the target detection area; if the phone call detection result indicates that the phone call behavior is triggered in the target detection area, an alarm for dangerous phone behavior is issued.
4. The method according to claim 1, It is characterized in that The step of determining the detection area of each dangerous behavior of the cabin occupant according to the actual facial key points includes: Determine the head posture of the cabin occupant according to the actual facial key points, and project the actual facial key points combined with the head posture into an image screen; Determine the vertical direction of the head in the image and the horizontal direction of the head in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the head posture, and determine the two-dimensional center point of the mouth in the image based on the camera intrinsic parameters of the vehicle-mounted camera and the three-dimensional center point of the mouth; For smoking behavior, the two-dimensional center point of the mouth in the image is taken as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area of the smoking behavior; For drinking water behavior or making phone calls, the face detection frame in the image is taken as the center of the detection area, and the area is expanded along the vertical direction of the head in the image and the horizontal direction of the head in the image to obtain the detection area for drinking water behavior or making phone calls.
5. The method according to claim 4, It is characterized in that The detection area for smoking behavior is obtained by taking the two-dimensional center point of the mouth in the image as the center of the detection area and expanding the area along the vertical direction of the head in the image and the horizontal direction of the head in the image, respectively, including: Generate a square area with the two-dimensional center point of the mouth in the image as the center and the long side of the outer frame of the mouth as the side length; Expand the square area along the vertical direction of the head of the person in the image by a first preset multiple to both ends, and expand the square area along the horizontal direction of the head of the person in the image by a second preset multiple to both ends, to obtain the detection area of the smoking behavior; The detection area for drinking water behavior or making phone calls is obtained by taking the face detection frame in the image as the center of the detection area and expanding the area along the vertical direction of the head in the image and the horizontal direction of the head in the image, respectively, including: The area to be expanded where the face detection frame in the image is located is expanded outwards by a third preset multiple along the vertical direction of the head in the image by a third preset multiple, and the area to be expanded outwards by a fourth preset multiple along the horizontal direction of the head in the image by a fourth preset multiple, to obtain a suspicious area of the drinking behavior or the phone call behavior; The suspicious area is expanded outwards by a fifth preset multiple toward both ends along its height direction, and the suspicious area is expanded outwards by a sixth preset multiple toward both ends along its width direction, to obtain a detection area for the drinking behavior or the phone call behavior.
6. The method according to claim 1, It is characterized in that The method of determining a target dangerous behavior detection model for performing dangerous behavior detection on the current cabin image according to the historical triggering state of each dangerous behavior and the historical calling state of the action detection model configured for each dangerous behavior includes: For each dangerous behavior, determining whether the scheduling time interval between the time when the action detection model configured for the dangerous behavior was last scheduled and the time when the cabin image was collected exceeds a preset time interval, or whether the dangerous behavior was triggered within a preset time period before the cabin image was collected; If the scheduling time interval between the time of the most recent scheduling of the action detection model configured for the dangerous behavior and the time of collecting the cabin image exceeds the preset time interval, or the dangerous behavior is triggered within the preset time length before collecting the cabin image, the action detection model configured for the dangerous behavior will be determined as the target dangerous behavior detection model.
7. The method according to claim 1, It is characterized in that The method further comprises: Obtaining several regional images of the detection area of smoking behavior, segmenting and annotating the regional images with smoke and being ignited in each regional image, and constructing a model training set; Using the model training set to perform model training on a dual-branch convolutional neural network to obtain a target risk behavior detection model configured for smoking behavior; Among them, the model input of the target dangerous behavior detection model configured for smoking behavior is the detection area of smoking behavior, and its model output includes the output performed by the classification branch and the output performed by the segmentation branch, the classification branch outputs the smoking behavior trigger probability, and the segmentation branch outputs the pixel-level category probability; when the classification branch output probability is greater than the preset smoking behavior probability threshold, and the segmentation branch outputs that the segmentation shape of the smoke in the detection area is an ellipse and the proportion of the ellipse area in the detection area exceeds the preset area threshold, the smoking detection result of the detection area is output as triggering smoking behavior.
8. A dangerous behavior detection device, It is characterized in that The device comprises: A vehicle cabin image acquisition model, used to collect vehicle cabin images in real time through a vehicle-mounted camera, wherein the cabin images include faces of cabin occupants; A face recognition module is used to perform face recognition on the current cabin image to obtain a face detection frame, and to locate face key points of the face in the face detection frame to obtain actual face key points of the cabin occupant; A detection area determination module, used to determine the detection area of each dangerous behavior of the cabin occupant according to the actual facial key points, wherein the dangerous behavior includes smoking, drinking and making phone calls; A detection model calling module, used to determine a target dangerous behavior detection model for dangerous behavior detection on a current cabin image according to a historical trigger state of each dangerous behavior and a historical calling state of an action detection model configured for each dangerous behavior; The dangerous behavior detection module is used to perform dangerous behavior detection on a target detection area of a target dangerous behavior corresponding to the target dangerous behavior detection model in a current cabin image based on the target dangerous behavior detection model.
9. A computer device, It is characterized in that include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the dangerous behavior detection method as described in any one of claims 1 to 7 are performed.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the dangerous behavior detection method according to any one of claims 1 to 7 are executed.
