Safety detection method and system based on camera at automotive trim and storage medium
By using three-dimensional feature processing and dual-head camera data in the safety detection method of cameras at the interior of the car, the driver's feature point spacing is solved, and the problem of misjudgment of attention detection in the prior art is improved, and the accuracy of detection is improved and security.
Patent Information
- Application Number
- CN202411730700.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2024-12-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, driver attention detection only performs facial recognition in one plane dimension, resulting in misjudgment when the driver makes behaviors similar to those in distraction states and frequently and incorrectly issue distraction reminders.
Using the safety detection method based on the camera in the interior of the car, by collecting and processing three-dimensional feature pictures, using attention detection models for feature extraction and ranging, combining the data of the double-headed camera, a three-dimensional stereo algorithm is used to identify the spacing of feature points, and optimize the detection. Logic to reduce misjudgment.
It effectively avoids false reminders caused by situations that are not distracted, and improves the accuracy and safety of cameras in the interior of the car for driver behavior detection.
Smart Images

Figure CN119206680A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automobile hardware and software control, and in particular to a safety detection method, system and storage medium based on a camera at an automobile interior. Background Art
[0002] Currently, smart cars account for a large proportion of the market. Their high degree of intelligence allows car owners to have a good user experience. There are multiple high-precision cameras on the outside of the smart car to monitor the car's driving safety. At the same time, there are also multiple cameras inside the car to detect the vehicle's interior environment, such as the situation of the rear passengers, to determine whether the passengers are wearing seat belts. Later, someone proposed the idea of detecting the driver's eye closure status, head position and other behavioral characteristics while conducting interior inspections, and whether the driver is in a distracted driving state. If the driver is in a distracted state, the user will be prompted by traditional instrument alarm sounds and other means.
[0003] In the prior art, the driver's attention detection is generally carried out through a model training method to train a detection model for recognizing the driver's facial expression, and the detection model is used to detect the driver's real-time facial state to issue an attention reminder. There is a problem with this method: facial recognition can only be performed in one plane dimension. When the driver performs regular behaviors similar to those in a distracted state, it is easy to cause system misjudgment, and then frequently and erroneously issue distraction reminders. Therefore, it is necessary to optimize the detection logic of the camera in the car dashboard for the driver's behavior at the main driver's seat to improve the driving safety of the car. Summary of the invention
[0004] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a safety detection method based on a camera in the car interior, aiming to solve the technical problem that in the prior art, facial recognition can only be performed in one plane dimension, which easily causes the system to misjudge when the driver performs routine behaviors similar to those in a distracted state, and then frequently and erroneously issues distraction reminders.
[0005] In order to achieve the above object, the present invention is implemented by the following technical solutions: A safety detection method based on a camera at an automobile interior comprises the following steps: Collect pictures of drivers at the driver's seat, use pictures marked as potential safety hazards as model training pictures, and build an attention detection model; Inputting the model training picture into the attention detection model, performing three-dimensional feature extraction and feature distance measurement on the model training picture to train the attention detection model; A three-dimensional feature image of the driver at the main driving position is collected in real time by a camera on the instrument panel, and the three-dimensional feature image is input into the trained attention detection model for feature detection; wherein the camera is a left and right dual-head camera; When the result of the feature detection meets the reminder condition, the driver is reminded to drive safely through the reminder module; The step of inputting the three-dimensional feature image into the trained attention detection model for feature detection specifically includes: Input the three-dimensional feature image into the trained attention detection model, and perform feature similarity comparison in the plane dimension, regard the three-dimensional feature image that passes the feature similarity comparison as a suspicious image, and mark the suspicious behavior; Based on the suspicious behavior, feature points in the suspicious picture are extracted, and spacing comparison is performed on each of the feature points. The suspicious picture that passes the spacing comparison is determined as a distracting picture.
[0006] According to one aspect of the above technical solution, the model training picture is input into the attention detection model, and three-dimensional feature extraction and feature ranging are performed on the model training picture to train the attention detection model. The specific steps include: Inputting the model training picture into the attention detection model and performing preprocessing to improve the image quality of the model training picture; Extracting feature points from key parts of the face in the preprocessed model training image to obtain a preliminary feature map, wherein the key parts include pupils, eye sockets, upper lip, lower lip, and neck; Mapping the preliminary feature graph into a feature vector G, wherein the feature vector has a query vector Q, a key vector K, and a value vector V; in, , H, W, and C represent the height, width, and number of channels of the preliminary feature map, respectively; Convolution operation is performed on the adjacent key vectors K in the attention detection model to obtain the silent surrounding point environment O1, and convolution operation is performed on the silent surrounding point environment and the query vector Q to obtain a weight matrix E; ; in, denotes the participation of activation parameters in the convolution operation, Indicates that there is no participation of activation parameters in the convolution operation; The weight matrix E is fused element by element with the value vector V to obtain a real-time surrounding point environment O2, and the silent surrounding point environment O1 is feature-fused with the real-time surrounding point environment O2 to obtain an optimized feature map T1; ; T1=O1·O2; in, represents the element-by-element fusion algorithm; Performing spatial three-dimensional processing on the optimized feature map T to obtain a global output feature map; Extracting pixels from the global output feature map and performing cost calculation on the pixels to obtain the disparity of the feature points; Based on the parallax of the feature points, a three-dimensional algorithm is used to identify the distance between the feature points corresponding to each of the key parts to train the attention detection model.
[0007] According to one aspect of the above technical solution, the optimized feature map is subjected to spatial three-dimensional processing to obtain a global output feature map, and the specific steps include: The optimized feature map T1 is subjected to maximum pooling processing and average pooling processing in its channel dimension to obtain a first feature representation H1 and a second feature representation H2 respectively; The first feature representation H1 and the second feature representation H2 are fused by using a multi-layer perception mechanism, and the channel weight coefficient Y1 is obtained by processing the activation function; Combining the channel weight coefficient Y1 with the optimized feature map T1 to obtain an intermediate feature map T2; ; Among them, MLP represents the multi-layer perception mechanism, and Tanh is the activation function; Using the spatial attention mechanism, the intermediate feature map T2 is subjected to maximum pooling processing and average pooling processing in its spatial dimension, so as to obtain a third feature representation H3 and a fourth feature representation H4 with spatial dimensions; The third feature representation H3 and the fourth feature representation H4 are fused, and a convolution operation is performed, and finally the spatial attention weight coefficient Y2 is obtained by activation function processing; Combining the spatial attention weight coefficient Y2 with the intermediate feature map T2 to obtain a global output feature map T3; ; Among them, Conv7*7 represents the convolution layer, and its convolution kernel size is 7×7.
[0008] According to one aspect of the above technical solution, the step of extracting pixels from the global output feature map and performing cost calculation on the pixels to obtain the disparity of the feature points specifically includes: Traversing the pixel points in the global output feature map T3, combining the global output feature map T3 with the pixel points to obtain pixel point information SL; ; The pixel information SL is represented by a mapping function to obtain a pixel map U; ; Wherein, x represents the abscissa in the global output feature map T3, and y represents the ordinate in the global output feature map T3. is a constant parameter; Find a first pixel point group that has been traversed and a second pixel point group that has not been traversed in the pixel point map U, add the cost values of the first pixel point group and the second pixel point group, and replace the sum of the cost values of the area around a single pixel point in the pixel point map with the cost value of the original single pixel point to perform cost calculation; ; Wherein, μ represents the parallax error, B represents the matching sequence in the pixel point map U, and F occ Indicates the number of unmatched pixels, h occ Indicates the penalty coefficient when no match is found, F m Indicates the number of matched pixels, h r Indicates the reward coefficient when a match is made, K L represents the pixel value in the first pixel point group, K R represents the pixel value in the second pixel point group, and d represents the disparity; The disparity corresponding to the minimum value of the disparity error is taken as the starting disparity d b , and then obtain the pixel disparity map T d ; ; Among them, d max is the maximum value of the parallax; In the pixel disparity map T d Find the feature point disparity d corresponding to the feature point c .
[0009] According to one aspect of the above technical solution, based on the parallax of the feature points, a three-dimensional algorithm is used to identify the distance between the feature points corresponding to each of the key parts to train the attention detection model, specifically including: Obtain standard parameters of the left and right dual-head cameras, wherein the left and right dual-head cameras include a left camera and a right camera; Based on the principle of similar triangles, a vertical distance γ between the feature points corresponding to each of the key parts and the left and right dual-head cameras is obtained; ; Wherein, η is the focal length of the left and right dual-head cameras, φ is the distance between the optical center of the left camera and the optical center of the right camera, and X a is the horizontal coordinate of the feature point in the image displayed by the left camera, X β is the horizontal coordinate of the feature point in the image displayed by the right camera; Based on the vertical distance between the feature points corresponding to each of the key parts and the left and right dual-head cameras, the distance between the feature points corresponding to each of the key parts is obtained to obtain a feature point distance map; The feature point distance map is input into the attention detection model to train the attention detection model.
[0010] According to one aspect of the above technical solution, the three-dimensional feature image is input into the trained attention detection model, and feature similarity comparison is performed in the plane dimension, the three-dimensional feature image that passes the feature similarity comparison is regarded as a suspicious image, and the suspicious behavior is marked, and the specific steps include: The combination of the characteristic points of each of the key parts is defined as different suspicious behaviors; Inputting the three-dimensional feature image into the trained attention detection model; Preset a determination period, obtain the ratio of the number of frames m of the three-dimensional feature image corresponding to the suspected behavior in the determination period to the total number of frames M in the determination period, so as to obtain a degree of suspicion Doubt; ; A suspicion threshold is preset, the determination period in which the suspicion is greater than the suspicion threshold is marked as a reminder period, a three-dimensional feature image of each frame in the reminder period is collected and marked as a suspicion image, and the suspicion behavior corresponding to the suspicion image is marked.
[0011] According to one aspect of the above technical solution, based on the suspicious behavior, feature points in the suspicious picture are extracted, spacing comparison is performed on each of the feature points, and the suspicious picture after the spacing comparison passes is determined as a distracting picture, specifically including: Based on the suspected behavior, extracting feature points of each of the key parts corresponding to the suspected behavior in the suspected image; Calculating the distances between the feature points of the key parts corresponding to the suspected behavior in the suspected image; A distance threshold is preset, and the suspected picture whose distance is smaller than the distance threshold is determined as a distracting picture.
[0012] The present invention also provides a safety detection system based on a camera at an automobile interior, comprising: Building module: used to collect pictures of drivers at the main driving position, use pictures marked as potential safety hazards as model training pictures, and build an attention detection model; Training module: used for inputting the model training picture into the attention detection model, performing three-dimensional feature extraction and feature distance measurement on the model training picture, so as to train the attention detection model; The training module is specifically used to: input the model training picture into the attention detection model and perform preprocessing to improve the image quality of the model training picture; Extracting feature points from key parts of the face in the preprocessed model training image to obtain a preliminary feature map, wherein the key parts include pupils, eye sockets, upper lip, lower lip, and neck; Mapping the preliminary feature graph into a feature vector G, wherein the feature vector has a query vector Q, a key vector K, and a value vector V; in, , H, W, and C represent the height, width, and number of channels of the preliminary feature map, respectively; Convolution operation is performed on the adjacent key vectors K in the attention detection model to obtain the silent surrounding point environment O1, and convolution operation is performed on the silent surrounding point environment and the query vector Q to obtain a weight matrix E; ; in, denotes the participation of activation parameters in the convolution operation, Indicates that there is no participation of activation parameters in the convolution operation; The weight matrix E is fused element by element with the value vector V to obtain a real-time surrounding point environment O2, and the silent surrounding point environment O1 is feature-fused with the real-time surrounding point environment O2 to obtain an optimized feature map T1; ; T1=O1·O2; in, represents the element-by-element fusion algorithm; Performing spatial three-dimensional processing on the optimized feature map T to obtain a global output feature map; The optimized feature map T1 is subjected to maximum pooling processing and average pooling processing in its channel dimension to obtain a first feature representation H1 and a second feature representation H2 respectively; The first feature representation H1 and the second feature representation H2 are fused by using a multi-layer perception mechanism, and the channel weight coefficient Y1 is obtained by processing the activation function; Combining the channel weight coefficient Y1 with the optimized feature map T1 to obtain an intermediate feature map T2; ; Among them, MLP represents the multi-layer perception mechanism, and Tanh is the activation function; Using the spatial attention mechanism, the intermediate feature map T2 is subjected to maximum pooling processing and average pooling processing in its spatial dimension, so as to obtain a third feature representation H3 and a fourth feature representation H4 with spatial dimensions; The third feature representation H3 and the fourth feature representation H4 are fused, and a convolution operation is performed, and finally the spatial attention weight coefficient Y2 is obtained by activation function processing; Combining the spatial attention weight coefficient Y2 with the intermediate feature map T2 to obtain a global output feature map T3; ; Among them, Conv7*7 represents the convolution layer, and its convolution kernel size is 7×7; Extracting pixels from the global output feature map and performing cost calculation on the pixels to obtain the disparity of the feature points; Traversing the pixel points in the global output feature map T3, combining the global output feature map T3 with the pixel points to obtain pixel point information SL; ; The pixel information SL is represented by a mapping function to obtain a pixel map U; ; Wherein, x represents the abscissa in the global output feature map T3, and y represents the ordinate in the global output feature map T3. is a constant parameter; Find a first pixel point group that has been traversed and a second pixel point group that has not been traversed in the pixel point map U, add the cost values of the first pixel point group and the second pixel point group, and replace the sum of the cost values of the area around a single pixel point in the pixel point map with the cost value of the original single pixel point to perform cost calculation; ; Wherein, μ represents the parallax error, B represents the matching sequence in the pixel point map U, and F occ Indicates the number of unmatched pixels, h occ Indicates the penalty coefficient when no match is found, F m Indicates the number of matched pixels, h r Indicates the reward coefficient when a match is made, K L represents the pixel value in the first pixel point group, K R represents the pixel value in the second pixel point group, and d represents the disparity; The disparity corresponding to the minimum value of the disparity error is taken as the starting disparity d b , and then obtain the pixel disparity map T d ; ; Among them, d max is the maximum value of the parallax; In the pixel disparity map T d Find the feature point disparity d corresponding to the feature point c ; Based on the parallax of the feature points, a three-dimensional algorithm is used to identify the distance between the feature points corresponding to each of the key parts, so as to train the attention detection model; Obtain standard parameters of the left and right dual-head cameras, wherein the left and right dual-head cameras include a left camera and a right camera; Based on the principle of similar triangles, a vertical distance γ between the feature points corresponding to each of the key parts and the left and right dual-head cameras is obtained; ; Wherein, η is the focal length of the left and right dual-head cameras, φ is the distance between the optical center of the left camera and the optical center of the right camera, and X a is the horizontal coordinate of the feature point in the image displayed by the left camera, X β is the horizontal coordinate of the feature point in the image displayed by the right camera; Based on the vertical distance between the feature points corresponding to each of the key parts and the left and right dual-head cameras, the distance between the feature points corresponding to each of the key parts is obtained to obtain a feature point distance map; Inputting the feature point distance map into the attention detection model to train the attention detection model; Detection module: used to collect the three-dimensional feature image of the driver at the main driving position in real time through the camera on the instrument panel, and input the three-dimensional feature image into the trained attention detection model for feature detection; wherein the camera is a left and right dual-head camera; The detection module comprises: A feature comparison unit is used to input the three-dimensional feature image into the trained attention detection model, and perform feature similarity comparison in the plane dimension, regard the three-dimensional feature image that passes the feature similarity comparison as a suspicious image, and mark the suspicious behavior; The feature comparison unit is specifically used for: The combination of the characteristic points of each of the key parts is defined as different suspicious behaviors; Inputting the three-dimensional feature image into the trained attention detection model; Preset a determination period, obtain the ratio of the number of frames m of the three-dimensional feature image corresponding to the suspected behavior in the determination period to the total number of frames M in the determination period, so as to obtain a degree of suspicion Doubt; ; Preset a suspicion threshold, mark the determination period when the suspicion is greater than the suspicion threshold as a reminder period, collect the three-dimensional feature image of each frame in the reminder period, mark it as a suspicion image, and mark the suspicion behavior corresponding to the suspicion image; A spacing comparison unit is used to extract feature points in the suspected picture based on the suspected behavior, perform spacing comparison on each of the feature points, and determine the suspected picture that passes the spacing comparison as a distracting picture; The spacing comparison unit is specifically used for: Based on the suspected behavior, extracting feature points of each of the key parts corresponding to the suspected behavior in the suspected image; Calculating the distances between the feature points of the key parts corresponding to the suspected behavior in the suspected image; Preset a distance threshold, and determine the suspected picture whose distance is smaller than the distance threshold as a distracting picture; Alarm module: used to remind the driver to drive safely through the reminder module when the result of feature detection meets the reminder condition.
[0013] The present invention also provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the safety detection method based on a camera at an automobile interior is implemented as described above.
[0014] Compared with the prior art, the present invention has the following beneficial effects: By establishing an attention detection model, and inputting the distracted driver and easily misjudged distracted pictures as model training pictures into the attention detection model for training, the training projects mainly include feature training for the driver's distracted situation on a two-dimensional plane, and feature training for the driver's distracted situation in a three-dimensional environment. After the training is completed, the driver's distraction is monitored in real time during driving. First, the trained attention detection model is used to monitor the driver's photos in real time. When the feature comparison on the two-dimensional plane meets the distracted condition, the distance between the driver's feature points is detected in a three-dimensional environment. For example, if the plane distance between the feature points of the driver's upper lip and lower lip is not large, and at the same time, the plane distance between the feature points of the driver's pupil and the feature points of the eye socket is not small, then the behavior is not the driver's yawning behavior, but may be eating or talking. For another example, if the vertical distance between the feature points of the driver's left pupil and the right pupil is large, it means that the driver may be talking with his head tilted, which is distraction. If the vertical distance is not large, it means that the driver may be driving on a narrow road and needs to pay attention to the left and right situations of the vehicle body at all times, which is not distraction. When it meets the alarm condition of distraction detection, the driver is reminded to drive safely through the reminder module of the vehicle. The present invention fully considers the influence of the feature point spacing on distraction detection, greatly avoids false reminders caused by situations that do not meet the distraction conditions, and further optimizes the detection logic of the camera at the car interior for the driver's behavior. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is a flow chart of a safety detection method based on a camera at an automobile interior in a first embodiment of the present invention; Figure 2 It is a structural block diagram of a safety detection system based on a camera at an automobile interior in a second embodiment of the present invention; Figure 3 is a structural block diagram of an electronic device in a third embodiment of the present invention; The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0016] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0017] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0019] Embodiment 1 See also Figure 1 , shown is a safety detection method based on a camera at an automobile interior in a first embodiment of the present invention, comprising the following steps: S10, collecting pictures of the driver at the main driving position of the car, using pictures marked as safety hazards as model training pictures, and establishing an attention detection model; S20, inputting the model training picture into the attention detection model, performing three-dimensional feature extraction and feature distance measurement on the model training picture to train the attention detection model; S30, collecting a three-dimensional feature image of the driver at the main driving position in real time through a camera on the instrument panel, and inputting the three-dimensional feature image into the trained attention detection model for feature detection; wherein the camera is a left and right dual-head camera; S40, when the result of the feature detection meets the reminder condition, reminding the driver to drive safely through the reminder module; The step of inputting the three-dimensional feature image into the trained attention detection model for feature detection specifically includes: S31, inputting the three-dimensional feature image into the trained attention detection model, and performing feature similarity comparison in the plane dimension, treating the three-dimensional feature image that passes the feature similarity comparison as a suspicious image, and marking the suspicious behavior; S32, based on the suspicious behavior, extracting feature points in the suspicious picture, performing distance comparison on each of the feature points, and determining the suspicious picture that passes the distance comparison as a distracting picture.
[0020] It can be understood that the present invention establishes an attention detection model, and inputs the distracted driver and the pictures that are easily misjudged as distracted as model training pictures into the attention detection model for training. The training items mainly include feature training for the driver's distracted situation on a two-dimensional plane, and feature training for the driver's distracted situation in a three-dimensional environment. After the training is completed, the driver's distracted situation is monitored in real time during driving. First, the photos of the driver taken are monitored in real time through the trained attention detection model. When the feature comparison on the two-dimensional plane meets the distracted condition, the driver's feature comparison is then detected in a three-dimensional environment. The spacing of feature points, for example, if the plane spacing between the driver's upper lip feature points and the lower lip feature points is not large, and at the same time, the plane spacing between the driver's pupil feature points and the eye socket feature points is not small, then the driver is not yawning, but may be eating or talking. For another example, if the vertical spacing between the driver's left pupil feature points and the right pupil feature points is large, it means that the driver may be talking with his head tilted, which is distraction. If the vertical spacing is not large, it means that the driver may be passing other vehicles on a narrow road and needs to pay attention to the left and right situations of the vehicle body at all times, which is not distraction. When it meets the alarm condition of distraction detection, the driver is reminded to drive safely through the reminder module provided by the vehicle. The present invention fully considers the influence of the feature point spacing on distraction detection, greatly avoids false reminders caused by situations that do not meet the distraction conditions, and further optimizes the detection logic of the camera at the car interior for the driver's behavior.
[0021] Furthermore, the step of inputting the model training picture into the attention detection model, performing three-dimensional feature extraction and feature distance measurement on the model training picture to train the attention detection model includes: Inputting the model training picture into the attention detection model and performing preprocessing to improve the image quality of the model training picture; Extracting feature points from key parts of the face in the preprocessed model training image to obtain a preliminary feature map, wherein the key parts include pupils, eye sockets, upper lip, lower lip, and neck; Mapping the preliminary feature graph into a feature vector G, wherein the feature vector has a query vector Q, a key vector K, and a value vector V; in, , H, W, and C represent the height, width, and number of channels of the preliminary feature map, respectively; Convolution operation is performed on the adjacent key vectors K in the attention detection model to obtain the silent surrounding point environment O1, and convolution operation is performed on the silent surrounding point environment and the query vector Q to obtain a weight matrix E; ; in, denotes the participation of activation parameters in the convolution operation, Indicates that there is no participation of activation parameters in the convolution operation; The weight matrix E is fused element by element with the value vector V to obtain a real-time surrounding point environment O2, and the silent surrounding point environment O1 is feature-fused with the real-time surrounding point environment O2 to obtain an optimized feature map T1; ; T1=O1·O2; in, represents the element-by-element fusion algorithm; Performing spatial three-dimensional processing on the optimized feature map T to obtain a global output feature map; Extracting pixels from the global output feature map and performing cost calculation on the pixels to obtain the disparity of the feature points; Based on the parallax of the feature points, a three-dimensional algorithm is used to identify the distance between the feature points corresponding to each of the key parts to train the attention detection model.
[0022] It can be understood that the preprocessing of the model training image is to remove the noise of the image and make the image cleaner, which can avoid the reduction of the training effect caused by the quality problem of the image itself in the subsequent training process. The preprocessing includes flipping, scaling, histogram equalization and other operations of the image; the extraction of feature points is to determine whether they are similar on the plane based on the similarity between the feature points of the real-time monitoring image and the model training image in the process of plane feature comparison, and at the same time, determine the distance between the feature points at the three-dimensional level to determine whether the distraction reminder standard is met; the model training image is converted into a preliminary feature map through feature point extraction, and then the preliminary feature map is vectorized. Based on the self-attention mechanism, the relationship between the feature points can be better analyzed. The information of the silent surrounding point environment O1 is analyzed first, and then the information of the real-time surrounding point environment O2 is analyzed. Finally, the silent surrounding point environment O1 and the real-time surrounding point environment O2 are combined to obtain the optimized feature map T1. This image processing method better enhances the information of the feature points extracted from the model network, and does not only analyze the static feature points, which provides a good foundation for the subsequent plane and three-dimensional analysis through feature points. In addition, this step completes the training of the model training image for plane feature recognition function.
[0023] Furthermore, the optimized feature map is subjected to spatial three-dimensional processing to obtain a global output feature map, and the specific steps include: The optimized feature map T1 is subjected to maximum pooling processing and average pooling processing in its channel dimension to obtain a first feature representation H1 and a second feature representation H2 respectively; The first feature representation H1 and the second feature representation H2 are fused by using a multi-layer perception mechanism, and the channel weight coefficient Y1 is obtained by processing the activation function; Combining the channel weight coefficient Y1 with the optimized feature map T1 to obtain an intermediate feature map T2; ; Among them, MLP represents the multi-layer perception mechanism, and Tanh is the activation function; Using the spatial attention mechanism, the intermediate feature map T2 is subjected to maximum pooling processing and average pooling processing in its spatial dimension, so as to obtain a third feature representation H3 and a fourth feature representation H4 with spatial dimensions; The third feature representation H3 and the fourth feature representation H4 are fused, and a convolution operation is performed, and finally the spatial attention weight coefficient Y2 is obtained by activation function processing; Combining the spatial attention weight coefficient Y2 with the intermediate feature map T2 to obtain a global output feature map T3; ; Among them, Conv7*7 represents the convolution layer, and its convolution kernel size is 7×7.
[0024] It is understandable that since the images captured by the left and right dual-head cameras include not only feature points but also other factors such as faces and backgrounds, in order to highlight the attention of feature points, we need to link the network channel with the spatial features. The main idea is to extract features from the two dimensions of network channels and spatial features, and introduce a multi-layer perception mechanism to fuse the two to improve the spatial attention of feature points; specifically, the channel weight coefficient Y1 is first combined with the optimized feature map T1 to obtain the intermediate feature map T2, which takes the dimension of network channels into consideration, and then the spatial attention weight coefficient Y2 is combined with the intermediate feature map T2 to obtain the global output feature map T3, which takes the dimension of spatial features into consideration, thereby improving the spatial attention of feature points and providing a basis for the subsequent accurate recognition of the spacing between feature points on a three-dimensional level.
[0025] Furthermore, the extracting pixels from the global output feature map and performing cost calculation on the pixels to obtain the disparity of the feature points specifically includes: Traversing the pixel points in the global output feature map T3, combining the global output feature map T3 with the pixel points to obtain pixel point information SL; ; The pixel information SL is represented by a mapping function to obtain a pixel map U; ; Wherein, x represents the abscissa in the global output feature map T3, and y represents the ordinate in the global output feature map T3. is a constant parameter; Find a first pixel point group that has been traversed and a second pixel point group that has not been traversed in the pixel point map U, add the cost values of the first pixel point group and the second pixel point group, and replace the sum of the cost values of the area around a single pixel point in the pixel point map with the cost value of the original single pixel point to perform cost calculation; ; Wherein, μ represents the parallax error, B represents the matching sequence in the pixel point map U, and F occ Indicates the number of unmatched pixels, h occ Indicates the penalty coefficient when no match is found, F m Indicates the number of matched pixels, h r Indicates the reward coefficient when a match is made, K L represents the pixel value in the first pixel point group, K R represents the pixel value in the second pixel point group, and d represents the disparity; The disparity corresponding to the minimum value of the disparity error is taken as the starting disparity d b , and then obtain the pixel disparity map T d ; ; Among them, d max is the maximum value of the disparity; In the pixel disparity map T d Find the feature point disparity d corresponding to the feature point c .
[0026] It can be understood that in order to analyze the position of the feature points in the three-dimensional space, the vertical spacing can be determined by searching for disparity. The specific steps of searching for disparity are to find the pixel points in the global output feature map T3, concatenate the pixel points to obtain the pixel point map U, and combine the global output feature map T3 with the pixel points to obtain the pixel point information SL. The pixel point map U is obtained by the mapping function, and then the matching cost of the disparity is calculated. The matching cost indicates whether the feature points of the left camera and the right camera of the left and right dual-head cameras correspond to each other. The smaller the cost, the higher the degree of correspondence, and the smaller the disparity error μ. Then, the pixel point disparity map T is obtained by analyzing the disparity error. d , pixel disparity map T d It is used to represent the minimum parallax error μ of the left and right cameras at each point, and from the pixel disparity map T d Find the feature point disparity d with the smallest disparity error μ c .
[0027] Furthermore, based on the parallax of the feature points, a three-dimensional algorithm is used to identify the distance between the feature points corresponding to each of the key parts to train the attention detection model, specifically including: Obtain standard parameters of the left and right dual-head cameras, wherein the left and right dual-head cameras include a left camera and a right camera; Based on the principle of similar triangles, a vertical distance γ between the feature points corresponding to each of the key parts and the left and right dual-head cameras is obtained; ; Wherein, η is the focal length of the left and right dual-head cameras, φ is the distance between the optical center of the left camera and the optical center of the right camera, and X a is the horizontal coordinate of the feature point in the image displayed by the left camera, X β is the horizontal coordinate of the feature point in the image displayed by the right camera; Based on the vertical distance between the feature points corresponding to each of the key parts and the left and right dual-head cameras, the distance between the feature points corresponding to each of the key parts is obtained to obtain a feature point distance map; The feature point distance map is input into the attention detection model to train the attention detection model.
[0028] It is understandable that the feature point disparity d is obtained c , the vertical distance from each feature point to the left and right dual-head camera lenses can be calculated by the formula. According to the vertical distance from each feature point to the left and right dual-head camera lenses, the relative vertical distance of each feature point can be calculated. The vertical distance can effectively avoid misjudgment in some non-distracted behaviors. For example, the driver observes left and right, but the amplitude is not large, and the distance between the left and right pupils is not much different, which belongs to non-distracted behavior. In some cases, it is also necessary to identify the plane distance of each feature point on a two-dimensional plane, such as talking, looking forward and simple eating behavior. The plane distance of the upper and lower lips, and the plane distance between the pupil and the eye socket can determine whether it is distracted. Sometimes the plane distance and the vertical distance need to be combined. For example, when meeting on a narrow road, the driver stretches his neck to look at the front of the car. The vertical distance between the neck and the pupil is large, and the plane distance between the neck and the pupil is also large. It belongs to non-distracted behavior. If it is dozing off, the vertical distance between the neck and the pupil is large, but the plane distance between the neck and the pupil is small, which belongs to distracted behavior. By inputting these data into the attention detection model to complete the judgment and recognition of these behaviors, the subsequent real-time monitoring pictures can be directly judged by the trained attention detection model.
[0029] Furthermore, the three-dimensional feature image is input into the trained attention detection model, and feature similarity comparison is performed in the plane dimension, the three-dimensional feature image that passes the feature similarity comparison is regarded as a suspicious image, and the suspicious behavior is marked, and the specific steps include: The combination of the characteristic points of each of the key parts is defined as different suspicious behaviors; Inputting the three-dimensional feature image into the trained attention detection model; Preset a determination period, obtain the ratio of the number of frames m of the three-dimensional feature image corresponding to the suspected behavior in the determination period to the total number of frames M in the determination period, so as to obtain a degree of suspicion Doubt; ; A suspicion threshold is preset, the determination period in which the suspicion is greater than the suspicion threshold is marked as a reminder period, a three-dimensional feature image of each frame in the reminder period is collected and marked as a suspicion image, and the suspicion behavior corresponding to the suspicion image is marked.
[0030] It is understandable that after the model is trained, it can be used. The left and right dual-head cameras are used to collect the driver's three-dimensional feature images in real time, and the trained attention detection model is used to perform plane feature comparison on the three-dimensional feature images to obtain the degree of suspicion Doubt. The higher the degree of suspicion, the more likely it is that the driver is distracted. When the degree of suspicion is greater than the suspicion threshold, the picture of the distracted driver is determined to be a suspicious picture, and the suspicious behavior (drowsiness, turning the head to communicate with passengers, etc.) is marked.
[0031] Further, based on the suspicious behavior, extracting feature points in the suspicious picture, performing distance comparison on each of the feature points, and determining the suspicious picture after the distance comparison passes as a distracting picture specifically includes: Based on the suspected behavior, extracting feature points of each of the key parts corresponding to the suspected behavior in the suspected image; Calculating the distances between the feature points of the key parts corresponding to the suspected behavior in the suspected image; A distance threshold is preset, and the suspected picture whose distance is smaller than the distance threshold is determined as a distracting picture.
[0032] It can be understood that after determining the suspicious picture and suspicious behavior, the feature points to be studied are determined according to the suspicious behavior. For example, if the driver turns his head to communicate with other passengers, the vertical distance between the left and right pupils and the plane distance between the upper and lower lips are studied. This can be identified through the trained attention detection model. When the vertical distance or the plane distance exceeds the preset spacing threshold, the suspicious picture is determined to be a distracting picture, and the reminder module can be used to sound an alarm to remind the driver to drive safely.
[0033] In summary, the safety detection method based on the camera at the car interior in the above embodiment of the present invention takes into account the influence of the feature point spacing on distraction detection, greatly avoids false alerts caused by situations that do not meet the distraction conditions, and further optimizes the detection logic of the car interior. Embodiment 2 Please refer to Figure 2 , which is a safety detection system based on a camera at an automobile interior in a second embodiment of the present invention, comprising: Establishing module 11: for collecting pictures of the driver at the main driving position of the car, using pictures marked as safety hazards as model training pictures, and establishing an attention detection model; Training module 12: used for inputting the model training picture into the attention detection model, performing three-dimensional feature extraction and feature distance measurement on the model training picture, so as to train the attention detection model; The training module 12 is specifically used to: input the model training picture into the attention detection model and perform preprocessing to improve the image quality of the model training picture; Extracting feature points from key parts of the face in the preprocessed model training image to obtain a preliminary feature map, wherein the key parts include pupils, eye sockets, upper lip, lower lip, and neck; Mapping the preliminary feature graph into a feature vector G, wherein the feature vector has a query vector Q, a key vector K, and a value vector V; in, , H, W, and C represent the height, width, and number of channels of the preliminary feature map, respectively; Convolution operation is performed on the adjacent key vectors K in the attention detection model to obtain the silent surrounding point environment O1, and convolution operation is performed on the silent surrounding point environment and the query vector Q to obtain a weight matrix E; ; in, denotes the participation of activation parameters in the convolution operation, Indicates that there is no participation of activation parameters in the convolution operation; The weight matrix E is fused element by element with the value vector V to obtain a real-time surrounding point environment O2, and the silent surrounding point environment O1 is feature-fused with the real-time surrounding point environment O2 to obtain an optimized feature map T1; ; T1=O1·O2; in, represents the element-by-element fusion algorithm; Performing spatial three-dimensional processing on the optimized feature map T to obtain a global output feature map; The optimized feature map T1 is subjected to maximum pooling processing and average pooling processing in its channel dimension to obtain a first feature representation H1 and a second feature representation H2 respectively; The first feature representation H1 and the second feature representation H2 are fused by using a multi-layer perception mechanism, and the channel weight coefficient Y1 is obtained by processing the activation function; Combining the channel weight coefficient Y1 with the optimized feature map T1 to obtain an intermediate feature map T2; ; Among them, MLP represents the multi-layer perception mechanism, and Tanh is the activation function; Using the spatial attention mechanism, the intermediate feature map T2 is subjected to maximum pooling processing and average pooling processing in its spatial dimension, so as to obtain a third feature representation H3 and a fourth feature representation H4 with spatial dimensions; The third feature representation H3 and the fourth feature representation H4 are fused, and a convolution operation is performed, and finally the spatial attention weight coefficient Y2 is obtained by activation function processing; Combining the spatial attention weight coefficient Y2 with the intermediate feature map T2 to obtain a global output feature map T3; ; Among them, Conv7*7 represents the convolution layer, and its convolution kernel size is 7×7; Extracting pixels from the global output feature map and performing cost calculation on the pixels to obtain the disparity of the feature points; Traversing the pixel points in the global output feature map T3, combining the global output feature map T3 with the pixel points to obtain pixel point information SL; ; The pixel information SL is represented by a mapping function to obtain a pixel map U; ; Wherein, x represents the abscissa in the global output feature map T3, and y represents the ordinate in the global output feature map T3. is a constant parameter; Find a first pixel point group that has been traversed and a second pixel point group that has not been traversed in the pixel point map U, add the cost values of the first pixel point group and the second pixel point group, and replace the sum of the cost values of the area around a single pixel point in the pixel point map with the cost value of the original single pixel point to perform cost calculation; ; Wherein, μ represents the parallax error, B represents the matching sequence in the pixel point map U, and Focc Indicates the number of unmatched pixels, h occ Indicates the penalty coefficient when no match is found, F m Indicates the number of matched pixels, h r Indicates the reward coefficient when a match is made, K L represents the pixel value in the first pixel point group, K R represents the pixel value in the second pixel point group, and d represents the disparity; The disparity corresponding to the minimum value of the disparity error is taken as the starting disparity d b , and then obtain the pixel disparity map T d ; ; Among them, d max is the maximum value of the disparity; In the pixel disparity map T d Find the feature point disparity d corresponding to the feature point c ; Based on the parallax of the feature points, a three-dimensional algorithm is used to identify the distance between the feature points corresponding to each of the key parts, so as to train the attention detection model; Obtain standard parameters of the left and right dual-head cameras, wherein the left and right dual-head cameras include a left camera and a right camera; Based on the principle of similar triangles, a vertical distance γ between the feature points corresponding to each of the key parts and the left and right dual-head cameras is obtained; ; Wherein, η is the focal length of the left and right dual-head cameras, φ is the distance between the optical center of the left camera and the optical center of the right camera, and X a is the horizontal coordinate of the feature point in the image displayed by the left camera, X β is the horizontal coordinate of the feature point in the image displayed by the right camera; Based on the vertical distance between the feature points corresponding to each of the key parts and the left and right dual-head cameras, the distance between the feature points corresponding to each of the key parts is obtained to obtain a feature point distance map; Inputting the feature point distance map into the attention detection model to train the attention detection model; Detection module 13: used to collect the three-dimensional feature image of the driver at the main driving position in real time through the camera on the instrument panel, and input the three-dimensional feature image into the trained attention detection model for feature detection; wherein the camera is a left and right dual-head camera; The detection module 13 includes: Feature comparison unit 131: used for inputting the three-dimensional feature image into the trained attention detection model, and performing feature similarity comparison in the plane dimension, treating the three-dimensional feature image that passes the feature similarity comparison as a suspicious image, and marking the suspicious behavior; The feature comparison unit 131 is specifically used for: The combination of the characteristic points of each of the key parts is defined as different suspicious behaviors; Inputting the three-dimensional feature image into the trained attention detection model; Preset a determination period, obtain the ratio of the number of frames m of the three-dimensional feature image corresponding to the suspected behavior in the determination period to the total number of frames M in the determination period, so as to obtain a degree of suspicion Doubt; ; Preset a suspicion threshold, mark the determination period when the suspicion is greater than the suspicion threshold as a reminder period, collect the three-dimensional feature image of each frame in the reminder period, mark it as a suspicion image, and mark the suspicion behavior corresponding to the suspicion image; The spacing comparison unit 132 is used to extract feature points in the suspected image based on the suspected behavior, perform spacing comparison on each of the feature points, and determine the suspected image that passes the spacing comparison as a distracting image; The spacing comparison unit 132 is specifically used for: Based on the suspected behavior, extracting feature points of each of the key parts corresponding to the suspected behavior in the suspected image; Calculating the distances between the feature points of the key parts corresponding to the suspected behavior in the suspected image; Preset a distance threshold, and determine the suspected picture whose distance is smaller than the distance threshold as a distracting picture; Alarm module 14: used to remind the driver to drive safely through the reminder module when the result of the feature detection meets the reminder condition.
[0034] Embodiment 3 The third embodiment of the present invention further provides an electronic device, see Figure 3 , shown is an electronic device in the third embodiment of the present invention, including a memory 10, a processor 20, and a computer program 30 stored in the memory 10 and executable on the processor 20. When the processor 20 executes the computer program 30, the above-mentioned safety detection method based on the camera at the automobile interior is implemented.
[0035] Among them, the memory 10 includes at least one type of storage medium, and the storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10 can be an internal storage unit of an electronic device, such as a hard disk of the electronic device. In other embodiments, the memory 10 can also be an external storage device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Further, the memory 10 can also include both an internal storage unit of the electronic device and an external storage device. The memory 10 can not only be used to store application software and various types of data installed in the electronic device, but also can be used to temporarily store data that has been output or is to be output.
[0036] Among them, in some embodiments, the processor 20 can be an electronic control unit (Electronic Control Unit, abbreviated as ECU, also known as a vehicle computer), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor or other data processing chip, used to run the program code stored in the memory 10 or process data, such as executing access restriction programs, etc.
[0037] It should be pointed out that Figure 3 The structure shown does not constitute a limitation on the electronic device. In other embodiments, the electronic device may include fewer or more components than those shown in the figure, or combine certain components, or arrange the components differently.
[0038] The embodiment of the present invention further provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the safety detection method based on a camera at the interior of a car as described above is implemented.
[0039] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0040] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0041] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0042] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0043] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A safety detection method based on a camera at an automobile interior, characterized in that: The steps include: Collect pictures of drivers at the driver's seat, use pictures marked as potential safety hazards as model training pictures, and build an attention detection model; Inputting the model training picture into the attention detection model, performing three-dimensional feature extraction and feature distance measurement on the model training picture to train the attention detection model; Collecting a three-dimensional feature image of the driver at the main driving position in real time through a camera on the dashboard, and inputting the three-dimensional feature image into the trained attention detection model for feature detection; The camera is a left and right dual-head camera; When the result of the feature detection meets the reminder condition, the driver is reminded to drive safely through the reminder module; The step of inputting the three-dimensional feature image into the trained attention detection model for feature detection specifically includes: Input the three-dimensional feature image into the trained attention detection model, and perform feature similarity comparison in the plane dimension, regard the three-dimensional feature image that passes the feature similarity comparison as a suspicious image, and mark the suspicious behavior; Based on the suspicious behavior, feature points in the suspicious picture are extracted, and spacing comparison is performed on each of the feature points. The suspicious picture that passes the spacing comparison is determined as a distracting picture.
2. The safety detection method based on the camera at the automobile interior according to claim 1 is characterized in that: The step of inputting the model training picture into the attention detection model, performing three-dimensional feature extraction and feature distance measurement on the model training picture to train the attention detection model comprises: Inputting the model training picture into the attention detection model and performing preprocessing to improve the image quality of the model training picture; Extracting feature points from key parts of the face in the preprocessed model training image to obtain a preliminary feature map, wherein the key parts include pupils, eye sockets, upper lip, lower lip, and neck; Mapping the preliminary feature graph into a feature vector G, wherein the feature vector has a query vector Q, a key vector K, and a value vector V; in, , H, W, and C represent the height, width, and number of channels of the preliminary feature map, respectively; Performing a convolution operation on the adjacent key vectors K in the attention detection model to obtain a silent surrounding point environment O1, and performing a convolution operation on the silent surrounding point environment O1 and the query vector Q to obtain a weight matrix E; ; in, denotes the participation of activation parameters in the convolution operation, Indicates that there is no participation of activation parameters in the convolution operation; The weight matrix E is fused element by element with the value vector V to obtain a real-time surrounding point environment O2, and the silent surrounding point environment O1 is feature-fused with the real-time surrounding point environment O2 to obtain an optimized feature map T1; ; T1=O1·O2; in, represents the element-by-element fusion algorithm; Performing spatial three-dimensional processing on the optimized feature map T to obtain a global output feature map; Extracting pixels from the global output feature map and performing cost calculation on the pixels to obtain the disparity of the feature points; Based on the parallax of the feature points, a three-dimensional algorithm is used to identify the distance between the feature points corresponding to each of the key parts to train the attention detection model.
3. The safety detection method based on the camera at the automobile interior according to claim 2 is characterized in that: The step of performing spatial three-dimensional processing on the optimized feature map to obtain a global output feature map specifically includes: The optimized feature map T1 is subjected to maximum pooling processing and average pooling processing in its channel dimension to obtain a first feature representation H1 and a second feature representation H2 respectively; The first feature representation H1 and the second feature representation H2 are fused by using a multi-layer perception mechanism, and the channel weight coefficient Y1 is obtained by processing the activation function; Combining the channel weight coefficient Y1 with the optimized feature map T1 to obtain an intermediate feature map T2; ; Among them, MLP represents the multi-layer perception mechanism, and Tanh is the activation function; Using the spatial attention mechanism, the intermediate feature map T2 is subjected to maximum pooling processing and average pooling processing in its spatial dimension, so as to obtain a third feature representation H3 and a fourth feature representation H4 with spatial dimensions; The third feature representation H3 and the fourth feature representation H4 are fused, and a convolution operation is performed, and finally the spatial attention weight coefficient Y2 is obtained by activation function processing; Combining the spatial attention weight coefficient Y2 with the intermediate feature map T2 to obtain a global output feature map T3; ; Among them, Conv7*7 represents the convolution layer, and its convolution kernel size is 7×7.
4. The safety detection method based on the camera at the automobile interior according to claim 3 is characterized in that: The extracting pixels from the global output feature map and performing cost calculation on the pixels to obtain the disparity of the feature points specifically includes: Traversing the pixel points in the global output feature map T3, combining the global output feature map T3 with the pixel points to obtain pixel point information SL; ; The pixel information SL is represented by a mapping function to obtain a pixel map U; ; Wherein, x represents the abscissa in the global output feature map T3, and y represents the ordinate in the global output feature map T3. is a constant parameter; Find a first pixel point group that has been traversed and a second pixel point group that has not been traversed in the pixel point map U, add the cost values of the first pixel point group and the second pixel point group, and replace the sum of the cost values of the area around a single pixel point in the pixel point map with the cost value of the original single pixel point to perform cost calculation; ; Wherein, μ represents the parallax error, B represents the matching sequence in the pixel point map U, and F occ Indicates the number of unmatched pixels, h occ Indicates the penalty coefficient when no match is found, F m Indicates the number of matched pixels, h r Indicates the reward coefficient when a match is made, K L represents the pixel value in the first pixel point group, K R represents the pixel value in the second pixel point group, d represents the disparity, x i and i Respectively represent the horizontal coordinate and vertical coordinate of the i-th matched pixel point in the pixel point map U; The disparity corresponding to the minimum value of the disparity error is taken as the starting disparity d b , and then obtain the pixel disparity map T d ; ; Among them, d max is the maximum value of the disparity; In the pixel disparity map T d Find the feature point disparity d corresponding to the feature point c .
5. The safety detection method based on the camera at the automobile interior according to claim 4 is characterized in that: The method of using a three-dimensional algorithm to identify the distance between the feature points corresponding to each of the key parts based on the parallax of the feature points to train the attention detection model specifically includes: Obtain standard parameters of the left and right dual-head cameras, wherein the left and right dual-head cameras include a left camera and a right camera; Based on the principle of similar triangles, a vertical distance γ between the feature points corresponding to each of the key parts and the left and right dual-head cameras is obtained; ; Wherein, η is the focal length of the left and right dual-head cameras, φ is the distance between the optical center of the left camera and the optical center of the right camera, and X a is the horizontal coordinate of the feature point in the image displayed by the left camera, X β is the horizontal coordinate of the feature point in the image displayed by the right camera; Based on the vertical distance between the feature points corresponding to each of the key parts and the left and right dual-head cameras, the distance between the feature points corresponding to each of the key parts is obtained to obtain a feature point distance map; The feature point distance map is input into the attention detection model to train the attention detection model.
6. The safety detection method based on the camera at the automobile interior according to claim 5 is characterized in that: The three-dimensional feature image is input into the trained attention detection model, and feature similarity comparison is performed in the plane dimension, the three-dimensional feature image that passes the feature similarity comparison is regarded as a suspicious image, and the suspicious behavior is marked, and the specific steps include: The combination of the characteristic points of each of the key parts is defined as different suspicious behaviors; Inputting the three-dimensional feature image into the trained attention detection model; Preset a determination period, obtain the ratio of the number of frames m of the three-dimensional feature image corresponding to the suspected behavior in the determination period to the total number of frames M in the determination period, so as to obtain a degree of suspicion Doubt; ; A suspicion threshold is preset, the determination period in which the suspicion is greater than the suspicion threshold is marked as a reminder period, a three-dimensional feature image of each frame in the reminder period is collected and marked as a suspicion image, and the suspicion behavior corresponding to the suspicion image is marked.
7. The safety detection method based on the camera at the automobile interior according to claim 6 is characterized in that: The extracting feature points in the suspicious picture based on the suspicious behavior, performing spacing comparison on each of the feature points, and determining the suspicious picture as a distracting picture after the spacing comparison passes, specifically includes: Based on the suspected behavior, extracting feature points of each of the key parts corresponding to the suspected behavior in the suspected image; Calculating the distances between the feature points of the key parts corresponding to the suspected behavior in the suspected image; A distance threshold is preset, and the suspected picture whose distance is smaller than the distance threshold is determined as a distracting picture.
8. A safety detection system based on a camera at the interior of a car, characterized in that: include: Building module: used to collect pictures of the driver at the main driving position of the car, use the pictures marked as safety hazards as model training pictures, and build an attention detection model; Training module: used for inputting the model training picture into the attention detection model, performing three-dimensional feature extraction and feature distance measurement on the model training picture, so as to train the attention detection model; Detection module: used to collect the three-dimensional feature image of the driver at the main driving position in real time through the camera on the instrument panel, and input the three-dimensional feature image into the trained attention detection model for feature detection; The camera is a left and right dual-head camera; The detection module comprises: A feature comparison unit is used to input the three-dimensional feature image into the trained attention detection model, and perform feature similarity comparison in the plane dimension, regard the three-dimensional feature image that passes the feature similarity comparison as a suspicious image, and mark the suspicious behavior; A spacing comparison unit is used to extract feature points in the suspected picture based on the suspected behavior, perform spacing comparison on each of the feature points, and determine the suspected picture that passes the spacing comparison as a distracting picture; Alarm module: used to remind the driver to drive safely through the reminder module when the result of feature detection meets the reminder condition.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the safety detection method based on a camera at an automobile interior as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Fatigue driving prevention method and device based on TOF imaging, storage medium and equipment
CN114299474A
Two-hand attitude estimation method based on self-attention mechanism neural network
CN116453203A
Learning attention state evaluation method based on multi-dimensional feature fusion network
CN117173758A
Real-time state monitoring method for elderly living at home based on time deformable attention mechanism
CN117218709A
Driver attention detection method based on double-branch fine-grained mapping structure
CN117333849A
