A safety belt wearing detection method, device, electronic equipment and storage medium
By detecting the combination of human bone points and seat belt areas, using straight line fitting and matching value calculation, the problem of low seat belt detection accuracy and poor robustness in the existing technology is solved, and higher detection accuracy and stability are achieved. sex.
Patent Information
- Application Number
- CN202111101688.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-18
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-09-18
AI Technical Summary
Existing seat belt wearing detection methods rely on the shape and texture characteristics of the seat belt and are easily interfered by other objects, resulting in low detection accuracy and poor robustness.
The key points are determined by detecting human skeleton points, and combined with the seat belt area to perform straight line fitting and matching value calculations to determine whether the passengers are wearing seat belts, thereby improving the accuracy and robustness of the detection.
It improves the accuracy and robustness of seat belt wearing detection, reduces the dependence on the quality of the image to be detected and changes in camera position and angle, and enhances the stability of detection.
Smart Images

Figure CN113870205B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information detection technology, and in particular to a seat belt wearing detection method, device, electronic device and storage medium. Background Art
[0002] In order to ensure the safety of passengers (such as drivers) in the vehicle, it is necessary to detect whether the passengers are wearing seat belts. The current seat belt wearing detection method usually first collects the image to be detected including the passengers; then detects the seat belt area in the image to be detected based on the shape and texture of the seat belt; finally, based on the detected seat belt area, it is determined whether the passenger is wearing the seat belt.
[0003] However, since the shape and texture of seat belts are not representative, some other common objects also have the same shape and texture as seat belts. These other objects in the image to be detected will interfere with the detection of seat belts, resulting in low accuracy and poor robustness of the detection method. Summary of the invention
[0004] The present application provides a seat belt wearing detection method, device, electronic device and storage medium to at least improve the accuracy and robustness of seat belt wearing detection. The technical solution of the present application is as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for detecting seat belt wearing, the method comprising: first acquiring an image to be detected; then detecting human skeleton points on the image to be detected to obtain the position of at least one human skeleton point of a first person; then, determining at least one key point from at least one human skeleton point; further detecting a seat belt on the image to be detected to obtain a seat belt area corresponding to the first person; finally, judging whether the first person is wearing a seat belt based on the position of at least one key point and the seat belt area corresponding to the first person.
[0006] The image to be detected includes one or more persons, and the first person is a person in the image to be detected. The at least one key point is used to characterize at least one of the position, direction and length of the safety belt worn by the first person.
[0007] In one possible design, the above-mentioned determining whether the first person is wearing a seat belt based on the position of at least one key point and the seat belt area corresponding to the first person includes: performing straight line fitting and straight line interception on the seat belt area corresponding to the first person to obtain a target line segment; the target line segment is used to characterize the position, direction and length of the seat belt area; and determining whether the first person is wearing a seat belt based on the position of the target line segment in the image to be detected and the position of at least one key point.
[0008] In another possible design, the above-mentioned judging whether the first person wears a seat belt based on the position of the target line segment in the image to be detected and the position of at least one key point includes: obtaining a line segment vector representing the target line segment and the position of the midpoint of the target line segment based on the position of the target line segment in the image to be detected; obtaining a key point vector based on the position of at least one key point; the key point vector is used to represent the direction and length of the seat belt worn by the first person; obtaining a first distance between the target key point and the midpoint of the target line segment based on the position of the midpoint of the target line segment and the position of the target key point among at least one key point; obtaining a matching value between at least one key point and the target line segment based on the key point vector, the line segment vector, and the first distance; judging whether the first person wears a seat belt based on the matching value and a preset value range.
[0009] The first distance is the distance between the target key point and the midpoint of the target line segment. The target key point is selected from at least one key point according to a preset rule. The distance between the target key point and the safety belt worn by the first person is smaller than the distance between the other key points of the at least one key point except the target key point and the safety belt worn by the first person.
[0010] In another possible design, the above-mentioned matching value between at least one key point and the target line segment is obtained based on the key point vector, the line segment vector, and the first distance, including: obtaining angle information of the angle between the key point vector and the line segment vector, and the absolute value of the difference between the modulus of the key point vector and the modulus of the line segment vector based on the key point vector and the line segment vector; obtaining the matching value based on the angle information, the absolute value of the difference, and the first distance.
[0011] In another possible design, the at least one key point includes: a first key point, a second key point, a third key point and a fourth key point. The first key point is a point on the nose, the second key point is a connection point between the neck and the body, the third key point is a point on the right shoulder, and the fourth key point is a point on the left shoulder; the position of each key point is the coordinate of each key point in the image to be detected.
[0012] Among them, the above-mentioned key point vector is obtained according to the position of at least one key point, including: generating a first contribution vector with the second key point as the starting point and the first key point as the end point according to the coordinates of the first key point and the coordinates of the second key point; generating a second contribution vector with the third key point as the starting point and the fourth key point as the end point according to the coordinates of the third key point and the coordinates of the fourth key point; and obtaining the key point vector by summing twice the first contribution vector and the second contribution vector.
[0013] In another possible design, the position of the target line segment in the image to be detected includes: the coordinates of the two endpoints of the target line segment; the position of the midpoint of the target line segment is the coordinates of the midpoint. Wherein, the above-mentioned obtaining the line segment vector representing the target line segment and the position of the midpoint of the target line segment according to the position of the target line segment in the image to be detected includes: determining the starting point and the end point of the two end points, and subtracting the coordinates of the starting point from the coordinates of the end point to obtain the line segment vector; the horizontal coordinate of the starting point is smaller than the horizontal coordinate of the end point; and obtaining the coordinates of the midpoint according to the coordinates of the two end points.
[0014] In another possible design, the above-mentioned detecting seat belts from the image to be detected to obtain the seat belt area corresponding to the first person includes: detecting seat belts from the image to be detected to obtain a binary image; at least one connected domain in the binary image represents a seat belt area to be selected; filtering the connected domains in at least one connected domain in the binary image whose area is smaller than a preset area threshold to obtain at least one filtered connected domain; at least one filtered connected domain is at least one seat belt area, and the at least one seat belt area includes the seat belt area corresponding to the first person.
[0015] In another possible design, the method also includes: when it is determined that the first person is not wearing a seat belt, issuing a prompt message; the prompt information is used to characterize that the first person is not wearing a seat belt; obtaining acquisition information of the image to be detected, and storing the image to be detected, the acquisition information and the prompt information.
[0016] In a second aspect, an embodiment of the present application provides a seat belt wearing detection device, which includes: an acquisition module, used to acquire an image to be detected, wherein the image to be detected includes one or more persons; a first detection module, used to detect human skeleton points in the image to be detected, and obtain the position of at least one human skeleton point of a first person; wherein the first person is a person in the image to be detected; a processing module, used to determine at least one key point from at least one human skeleton point; at least one key point is used to characterize at least one of the position, direction and length of the seat belt worn by the first person; a second detection module, used to detect the seat belt in the image to be detected, and obtain the seat belt area corresponding to the first person; the processing module is also used to determine whether the first person is wearing a seat belt based on the position of at least one key point and the seat belt area corresponding to the first person.
[0017] In one possible design, the processing module is specifically used to: perform straight line fitting and straight line interception on the seat belt area corresponding to the first person to obtain a target line segment; the target line segment is used to characterize the position, direction and length of the seat belt area; and determine whether the first person is wearing a seat belt based on the position of the target line segment in the image to be detected and the position of at least one key point.
[0018] In another possible design, the processing module is specifically used to: obtain a line segment vector representing the target line segment and the position of the midpoint of the target line segment according to the position of the target line segment in the image to be detected; obtain a key point vector according to the position of at least one key point; the key point vector is used to characterize the direction and length of the safety belt worn by the first person; obtain a first distance according to the position of the midpoint of the target line segment and the position of the target key point in at least one key point; obtain a matching value between at least one key point and the target line segment according to the key point vector, the line segment vector, and the first distance; and determine whether the first person is wearing a safety belt based on the matching value and a preset value range.
[0019] The first distance is the distance between the target key point and the midpoint of the target line segment. The target key point is selected from at least one key point according to a preset rule; the distance between the target key point and the safety belt worn by the first person is smaller than the distance between other key points in the at least one key point except the target key point and the safety belt worn by the first person.
[0020] In another possible design method, the processing module is specifically used to: obtain the angle information of the angle between the key point vector and the line segment vector, and the absolute value of the difference between the modulus of the key point vector and the modulus of the line segment vector based on the key point vector and the line segment vector; obtain the matching value based on the angle information, the absolute value of the difference, and the first distance.
[0021] In another possible design method, at least one key point includes: a first key point, a second key point, a third key point and a fourth key point; the first key point is a point on the nose, the second key point is a connection point between the neck and the body, the third key point is a point on the right shoulder, and the fourth key point is a point on the left shoulder; the position of each key point is the coordinate of each key point in the image to be detected.
[0022] Among them, the processing module is specifically used to: generate a first contribution vector with the second key point as the starting point and the first key point as the end point according to the coordinates of the first key point and the coordinates of the second key point; generate a second contribution vector with the third key point as the starting point and the fourth key point as the end point according to the coordinates of the third key point and the coordinates of the fourth key point; sum the second contribution vector with twice the first contribution vector to obtain a key point vector.
[0023] In another possible design, the position of the target line segment in the image to be detected includes: the coordinates of the two endpoints of the target line segment; the position of the midpoint of the target line segment is the coordinates of the midpoint. The processing module is specifically used to: determine the starting point and the end point of the two endpoints, and subtract the coordinates of the starting point from the coordinates of the end point to obtain the line segment vector; the horizontal coordinate of the starting point is less than the horizontal coordinate of the end point; and the coordinates of the midpoint are obtained according to the coordinates of the two endpoints.
[0024] In another possible design, the second detection module is specifically used to: detect seat belts in the image to be detected to obtain a binary image; at least one connected domain in the binary image represents a seat belt area to be selected; filter the connected domains in at least one connected domain in the binary image whose area is smaller than a preset area threshold to obtain at least one filtered connected domain; at least one filtered connected domain is at least one seat belt area, and the at least one seat belt area includes the seat belt area corresponding to the first person.
[0025] In another possible design, the device also includes: a prompt module, which is used to issue a prompt message when it is determined that the first person is not wearing a seat belt; the prompt information is used to characterize that the first person is not wearing a seat belt; a storage module, which is used to obtain acquisition information of the image to be detected, and store the image to be detected, the acquisition information and the prompt information.
[0026] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor and a memory for storing instructions executable by the processor; wherein the processor is configured to execute instructions so that the electronic device performs a seat belt wearing detection method as in the first aspect and any possible implementation manner thereof.
[0027] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes a seat belt wearing detection method as in the first aspect and any possible implementation manner thereof.
[0028] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:
[0029] The electronic device first detects human skeleton points from the image to be detected to obtain at least one human skeleton point of the first person, and then determines at least one key point from the at least one human skeleton point. The electronic device also detects a safety belt from the image to be detected to obtain a safety belt area corresponding to the first person. Wherein, at least one key point can characterize at least one of the position, direction and length of the safety belt when the first person is wearing the safety belt. The electronic device can determine that the first person is wearing a safety belt when any of the following items is satisfied: the direction represented by the at least one key point is similar to the direction of the safety belt area detected from the image to be detected, the length represented by the at least one key point is similar to the length of the safety belt area detected from the image to be detected, and the position represented by the at least one key point is similar to the position of the safety belt area detected from the image to be detected.
[0030] In summary, the electronic device determines whether the first person is wearing a seat belt based on the correlation between the information of the seat belt (i.e., at least one of the position, direction, and length) of the first person when the first person is wearing the seat belt represented by at least one key point of the first person and the seat belt area detected from the image to be detected. This method is more accurate and more robust than the related art of determining whether the first person is wearing a seat belt by simply determining whether the image to be detected includes a seat belt based on the characteristics of the seat belt.
[0031] Secondly, the change in the distance between the first person and the camera that collects the image to be detected and / or the change in the angle between the first person and the camera that collects the image to be detected may cause the seat belt area detected in the image to be detected to change. Then, judging whether the first person wears a seat belt only based on the seat belt area detected in the image to be detected may be subject to the change in the position of the camera, resulting in an error in judgment, and the robustness is poor. In the embodiment of the present application, considering the change in the distance between the first person and the camera that collects the image to be detected and / or the change in the angle between the first person and the camera that collects the image to be detected, the position of the human skeleton point of the first person may also change, and at least one key point of the first person can characterize the information of the seat belt when the first person wears a seat belt, then the electronic device compares at least one key point of the first person with the seat belt area detected in the image to be detected to judge whether the first person wears a seat belt, which can eliminate the judgment error caused by the change in the seat belt area detected in the image to be detected due to the influence of certain factors. In other words, the accuracy and robustness of the seat belt wearing detection are improved.
[0032] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application, and do not constitute an improper limitation on the present application.
[0034] Figure 1 is a schematic diagram showing the composition of a seat belt wearing detection system according to an exemplary embodiment;
[0035] Figure 2 The following is a flow chart of a seat belt wearing detection method according to an exemplary embodiment. Figure 1 ;
[0036] Figure 3 is a schematic diagram showing the distribution of human skeleton points according to an exemplary embodiment;
[0037] Figure 4 is a schematic diagram showing a safety belt represented by multiple key points of a first person according to an exemplary embodiment;
[0038] Figure 5 is a schematic diagram showing an image of a seat belt for detecting an image to be detected according to an exemplary embodiment;
[0039] Figure 6 is a schematic diagram showing a method of extracting a target line segment corresponding to a seat belt area according to an exemplary embodiment;
[0040] Figure 7 The following is a flow chart of a seat belt wearing detection method according to an exemplary embodiment. Figure 2 ;
[0041] Figure 8 The following is a flow chart of a seat belt wearing detection method according to an exemplary embodiment. Figure 3 ;
[0042] Fig. 9 is a structural schematic diagram of a seat belt wearing detection device according to an exemplary embodiment;
[0043] Fig.10 The diagram is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0044] The terms "first", "second", etc. in the embodiments of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0045] In order to ensure the safety of vehicle passengers (such as the driver and the co-pilot), it is necessary to detect whether the passengers are wearing seat belts. Some current applications have also begun to provide related functions, such as detecting whether the passengers are wearing seat belts and reminding the passengers who are not wearing seat belts to wear seat belts to ensure the safety of the passengers.
[0046] At present, there are two main methods for detecting seat belt wearing:
[0047] The first is a seat belt wearing detection method based on a neural network. First, the seat belt area in the sample image is marked using a bounding box. The marked sample image is then used to train the initial detection model (e.g., a convolutional neural network). Then, the trained detection model is used to identify the seat belt area in the image to be detected captured by the camera to obtain the seat belt area in the image to be detected. Then, it is determined whether the area where the passenger in the image to be detected is overlapped with the seat belt area to determine whether the passenger is wearing a seat belt.
[0048] Among them, the seat belt wearing detection method based on neural network mainly identifies the seat belt area in the image to be detected based on the shape and color of the seat belt. Since the shape and color of the seat belt are not representative, some other common objects also have the same shape and color as the seat belt. Then, once the image to be detected includes other objects with the same shape and color as the seat belt, the detection method will have the problem of false detection. In other words, the accuracy of the detection method is reduced and the robustness is poor.
[0049] The second is a seat belt wearing detection method based on traditional visual algorithms. First, edge detection technology is used to detect the edge information of the seat belt from the image to be detected captured by the camera, and then the suspected seat belt area is extracted. Then, the extracted suspected seat belt area is filtered according to conditions such as area size, position direction, etc. Based on the positional relationship between the camera and the passenger, and the filtered seat belt area, it is determined whether the passenger in the image to be detected is wearing a seat belt. Among them, the camera can be an external camera (such as a camera installed at a road checkpoint) or an internal camera.
[0050] Among them, the seat belt wearing detection method based on traditional visual algorithms has high requirements on the quality of the image to be detected in order to accurately detect the edge information of the seat belt. If high-quality images to be detected are to be collected, there are also high requirements on the position and angle of the camera installed in public areas (such as public road entrances and exits, highway intersections), which is difficult to achieve. In addition to the installation position of the camera, changes in factors such as the ambient lighting where the camera is located will also affect the detection effect of the edge information of the seat belt, which will lead to poor robustness of the detection method.
[0051] In view of the problems of low accuracy and poor robustness in the above-mentioned related methods, the embodiment of the present application proposes a seat belt wearing detection method, which utilizes the correlation between the position of the human skeleton point and the seat belt wearing position to detect whether the passengers are wearing seat belts. Since the human skeleton point is a representative and fixed reference object, judging whether the seat belt wearing position is correct by referring to the position of the human skeleton point can improve the accuracy and robustness of seat belt wearing detection. Secondly, the detection method does not have high requirements on the quality of the image to be detected, and does not have too many requirements on the position and angle of the camera, and is applicable to both the camera outside the car and the camera inside the car. In other words, the detection method is simple to implement and has a wide range of applications.
[0052] In order to enable ordinary persons in the art to better understand the technical solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0053] A seat belt wearing detection method provided in the embodiment of the present application can be applied to Figure 1 In the seat belt wearing detection system shown in the figure, the detection system 10 may include: a multimedia acquisition module 11, a seat belt wearing detection device 12, and a cloud data management module 13. The detection system 10 may also include a positioning module 14.
[0054] The multimedia acquisition module 11 and the positioning module 14 can be installed in the vehicle or at a road checkpoint. The multimedia acquisition module 11 acquires the image to be detected including the passenger from the front of the passenger, and sends the image to be detected to the seat belt wearing detection device 12. While acquiring the image to be detected, the positioning module 14 can acquire the position of the multimedia acquisition module 11 (which can be referred to as the acquisition position of the image to be detected), and send the acquisition position to the seat belt wearing detection device 12.
[0055] Then, the seat belt wearing detection device 12 detects whether the passenger is wearing a seat belt from the image to be detected. If it is determined that the passenger is not wearing a seat belt, the seat belt wearing detection device 12 can send the image to be detected and the information such as the acquisition position to the cloud data management module 13. The cloud data management module 13 saves the information sent by the seat belt wearing detection device 12.
[0056] Exemplarily, the multimedia acquisition module 11 may be a camera, and the cloud data management module 13 may be a cloud server.
[0057] In practical applications, in addition to Figure 1 The multimedia acquisition module 11 and the positioning module 14 shown are both independently provided with the seat belt wearing detection device 12 . The multimedia acquisition module 11 and the positioning module 14 may also be integrated into the seat belt wearing detection device 12 .
[0058] It should be noted that the seat belt wearing detection method provided in the embodiment of the present application can be applied to a seat belt wearing detection device. The seat belt wearing detection device can be an electronic device, such as, Figure 1 The desktop computer shown. The seat belt wearing detection device can also be an application (application, APP) installed in the electronic device that provides the seat belt wearing detection function; or, it can be a central processing unit (Central Processing Unit, CPU) in the electronic device; or, it can be a control module in the electronic device for executing the seat belt wearing detection method. The following takes an electronic device as an example to specifically introduce the seat belt wearing detection method provided in the embodiment of the present application.
[0059] Please refer to Figure 2 , is a flow chart of a seat belt wearing detection method provided in an embodiment of the present application. Figure 2 As shown, the method may include S21-S25.
[0060] S21. The electronic device obtains an image to be detected, where the image to be detected includes one or more persons.
[0061] The electronic device can obtain multimedia information (such as an image to be detected or a video to be detected) collected by the camera in real time or periodically. After the electronic device obtains the video to be detected, a frame of image, i.e., the image to be detected, can be obtained from the video to be detected. The image to be detected includes one or more persons, who can be referred to as passengers.
[0062] The image to be detected may include the upper body of the passenger, including the face, neck, shoulders, etc.
[0063] Exemplarily, the camera is located in front of the driver in the vehicle, or the camera is located at a road checkpoint, then the passengers in the image to be detected captured by the camera may include the driver and the co-driver.
[0064] Exemplarily, the camera is located in front of rear passengers in the vehicle, and the passengers in the image to be detected captured by the camera may include rear passengers.
[0065] In some embodiments, the electronic device may obtain information such as a collection location and a collection time corresponding to the collection location while acquiring multimedia information.
[0066] S22. The electronic device detects human skeleton points in the image to be detected, and obtains the position of at least one human skeleton point of a first person; wherein the first person is a person in the image to be detected.
[0067] The electronic device can detect human skeleton points on the image to be detected, and obtain the position of the human skeleton points of at least one person in the image to be detected. The electronic device can determine the position of at least one human skeleton point of a first person from the position of the human skeleton points of at least one person according to the position of each person in the image to be detected in the vehicle. The first person is a passenger in the image to be detected. The position of each human skeleton point can be the coordinates of each human skeleton point in the image to be detected.
[0068] Exemplarily, the first person may be a driver or a co-driver in the image to be detected. Assuming that the first person is a driver, the first person is on the left side of the front row in the vehicle, and then the electronic device may determine that all human skeleton points of the passenger on the left side of the front row are at least one human skeleton point of the first person.
[0069] For example, the electronic device can use a skeleton point detection algorithm to detect human skeleton points in the image to be detected. The skeleton point detection algorithm has the function of detecting 18 skeleton points of a person. Figure 3 As shown, the 18 bone points may include: a point 30 on the nose, a point 31 on the connection between the neck and the body, a point 32 on the right shoulder, a point 33 on the right elbow, a point 34 on the right wrist, a point 35 on the left shoulder, a point 36 on the left elbow, a point 37 on the left wrist, a point 38 on the right hip, a point 39 on the right knee, a point 310 on the right ankle, a point 311 on the left hip, a point 312 on the left knee, a point 313 on the left ankle, a point 314 on the right eye, a point 315 on the left eye, a point 316 on the right ear, and a point 317 on the left ear.
[0070] It should be noted that since the image to be detected acquired by the electronic device usually includes the upper body of the first person; therefore, the electronic device detects human skeleton points on the image to be detected, and at least one human skeleton point of the first person obtained can be a human skeleton point in the upper body of the first person.
[0071] Exemplarily, at least one human skeleton point of the first person may include: a point 30 on the nose, a point 31 at which the neck connects to the body, a point 32 on the right shoulder, a point 33 on the right elbow, a point 35 on the left shoulder, a point 36 on the left elbow, a point 314 on the right eye, a point 315 on the left eye, a point 316 on the right ear, and a point 317 on the left ear.
[0072] S23. When the image to be detected includes the first person, the electronic device determines at least one key point from at least one human skeleton point; the at least one key point is used to characterize at least one of the position, direction and length of the safety belt worn by the first person.
[0073] The electronic device can determine at least one key point from at least one human skeleton point according to at least one of the position, direction and length of the safety belt worn by the first person. The at least one key point can characterize at least one of the position, direction and length of the safety belt when the first person wears the safety belt correctly.
[0074] In some embodiments, the electronic device may first determine whether the first person in the image to be detected meets the detection condition. If the first person in the image to be detected meets the detection condition, the electronic device may determine at least one key point from at least one human skeleton point of the first person. If the first person in the image to be detected does not meet the detection condition, the electronic device may stop determining whether the first person wears a seat belt.
[0075] Among them, the electronic device can determine whether the first person in the image to be detected meets the detection condition based on at least one human skeleton point of the first person; the detection condition may include that the image to be detected includes a specified human skeleton point of the first person. Alternatively, the electronic device detects whether the image to be detected includes the face of the first person to determine whether the first person in the image to be detected meets the detection condition; the detection condition may include that the image to be detected includes the face of the first person.
[0076] Exemplarily, the detection condition may include that the image to be detected includes specified human skeleton points of the first person, and the specified human skeleton points may include points on the nose, points on the right eye, points on the left eye, points on the right ear, and points on the left ear.
[0077] In some embodiments, when the first person normally wears the safety belt, the position of the safety belt is on the straight line from the left waist to the right shoulder of the first person, the length of the safety belt is approximately equal to the straight line length from the left waist to the right shoulder of the first person, and the direction of the safety belt is also close to the direction of the straight line from the left waist to the right shoulder of the first person. Therefore, the electronic device can determine at least one key point from at least one human skeleton point of the first person, and the at least one key point is used to characterize the straight line from the right shoulder to the left waist of the first person. Furthermore, the at least one key point can characterize the position, direction and length of the safety belt worn by the first person.
[0078] For example, Figure 4 As shown in (a) in the figure, at least one key point may include: a first key point, a second key point, a third key point and a fourth key point. The first key point is point 30 on the nose, the second key point is the connection point 31 between the neck and the body, the third key point is point 32 on the right shoulder, and the fourth key point is point 35 on the left shoulder. Among them, the directed vector 41 is from the second key point 31 to the first key point 30, and the directed vector 42 is from the third key point 32 to the fourth key point 35. The directed vector 41 is perpendicular to the directed vector 42.
[0079] Then, if Figure 4 As shown in (b), directed vector 41 is multiplied by 2 to obtain directed vector 41'. The sum of directed vector 41' and directed vector 42 is equal to directed vector 43. Directed vector 43 can represent a straight line from the right shoulder to the left waist of the first person, and directed vector 43 can represent the position, direction and length of the safety belt when the first person wears the safety belt normally.
[0080] It can be understood that the position of the at least one key point is fixed, is not affected by the posture of the human body, and is also easy to detect.
[0081] S24. The electronic device detects a seat belt from the image to be detected, and obtains a seat belt area corresponding to the first person.
[0082] The electronic device can detect the seat belt of the image to be detected and obtain at least one seat belt area in the image to be detected. Then, the electronic device can determine the seat belt area of the first person according to the position of the first person in the vehicle. For example, if the first person is a driver, the first person is on the left side of the front row in the vehicle; then the electronic device can determine that the seat belt area corresponding to the position of the person on the left side of the front row in the image to be detected is the seat belt area of the first person.
[0083] In some embodiments, the electronic device can detect the seat belt of the image to be detected to obtain a binary image; at least one connected domain in the binary image represents the seat belt area to be selected. Then, the electronic device filters the connected domains whose area is less than a preset area threshold in at least one connected domain in the binary image to obtain at least one filtered connected domain. Among them, at least one filtered connected domain is at least one seat belt area, and at least one seat belt area includes the seat belt area corresponding to the first person.
[0084] The preset area threshold is an area threshold corresponding to the seating position of the first person. The electronic device may detect whether different persons are wearing seat belts, and may use different preset area thresholds. The binary image may include at least one suspected seat belt area.
[0085] Exemplarily, the electronic device may obtain a sample image captured by a camera. The sample image is marked with an area where the safety belt worn by the second person is located. The camera is the same as the camera that captures the image to be detected. The image size of the sample image is equal to the image size of the image to be detected. The second person and the first person are in the same seating position. Then, the electronic device may determine that the area of the safety belt area worn by the second person in the sample image is the preset area threshold corresponding to the first person.
[0086] For example, Figure 5As shown, for an image to be detected, the image to be detected includes a driver wearing a seat belt, and the first person is the driver. The electronic device can use semantic segmentation technology to detect the seat belt of the image to be detected to obtain a binary image 51. The binary image 51 includes multiple connected domains. Then, the electronic device filters the connected domains whose areas are less than a preset area threshold among the multiple connected domains to obtain a filtered connected domain 52. Among them, the filtered connected domain is the seat belt area corresponding to the first person.
[0087] It is understandable that at least one connected domain obtained by the electronic device for detecting the seat belt in the image to be detected may include a non-seat belt area that is falsely detected. Therefore, the electronic device then filters the at least one connected domain according to a preset area threshold to remove the non-seat belt area.
[0088] S25. The electronic device determines whether the first person is wearing a seat belt according to the position of the at least one key point and the seat belt area corresponding to the first person.
[0089] The electronic device can compare the information of the seat belt worn by the first person represented by the position of at least one key point (i.e., at least one of the position, direction and length of the seat belt) with the seat belt area corresponding to the first person detected from the image to be detected to determine whether the first person is wearing the seat belt.
[0090] In some embodiments, the electronic device may perform straight line fitting and straight line interception on the seat belt area corresponding to the first person to obtain a target line segment. The target line segment is used to characterize the position, direction, and length of the seat belt area. Then, the electronic device determines whether the first person is wearing a seat belt based on the position of the target line segment in the image to be detected and the position of at least one key point.
[0091] The electronic device may use a least square method to perform straight line fitting on the seat belt area corresponding to the first person to obtain a target straight line corresponding to the seat belt area. Then, the electronic device uses a minimum bounding box of the seat belt area to intercept the target straight line to obtain a target line segment.
[0092] For example, continuing with the above Figure 5 Taking the seat belt area 52 corresponding to the first person in the image to be detected as an example, Figure 6 As shown, the electronic device performs straight line fitting on the seat belt area 52 corresponding to the first person to obtain a target straight line 61 corresponding to the seat belt area 52. Then, the electronic device uses the minimum bounding box 62 of the seat belt area to intercept the target straight line 61 to obtain a target line segment 63. The two endpoints of the target line segment 63 are 631 and 632 respectively.
[0093] In some embodiments, after the electronic device obtains the target line segment, it can obtain a line segment vector Ls representing the target line segment according to the position of the target line segment in the image to be detected. vector , the position of the midpoint of the target line segment. Then, the electronic device obtains the key point vector Base according to the position of at least one key point vector The key point vector Base vector The electronic device can also obtain the first distance S according to the position of the midpoint of the target line segment and the position of the target key point in the at least one key point. distance ; The first distance S distance is the distance between the target key point and the midpoint of the target line segment. The electronic device then calculates the key point vector Base vector , the line segment vector Ls vector , and the first distance S distance , obtaining a matching value between at least one key point and the target line segment. Finally, the electronic device determines whether the first person is wearing a safety belt according to the matching value and a preset value range.
[0094] The position of the midpoint of the target line segment may be the coordinates of the midpoint of the target line segment in the image to be detected. The position of each key point may be the coordinates of each key point in the image to be detected. The target key point is selected from at least one key point according to a preset rule. The distance between the target key point and the safety belt worn by the first person is less than the distance between other key points other than the target key point in the at least one key point and the safety belt worn by the first person.
[0095] The preset rule may include: the key point of at least one key point that is closer to the safety belt worn by the first person is the target key point. For example, the preset rule includes: the second key point (i.e., the connection point 31 between the neck and the body) is the target key point.
[0096] Exemplarily, if the electronic device determines that the matching value is within a preset value range, it can be determined that the first person is wearing a seat belt. If the electronic device determines that the matching value is not within the preset value range, it can be determined that the first person is not wearing a seat belt.
[0097] It should be noted that the electronic device can also use the key point vector Base vector and the line segment vector Ls vector , obtain the matching value between at least one key point and the target line segment; in this case, the electronic device may not perform the step of obtaining the first distance. Similarly, the electronic device may also obtain the matching value between at least one key point and the target line segment according to the first distance; in this case, the electronic device may not perform the step of obtaining the key point vector Base vectorand the line segment vector Ls vector steps.
[0098] It can be understood that at least one key point can represent at least one of the position, direction and length of the safety belt when the first person wears the safety belt, and the key point vector Base obtained according to the at least one key point vector It can also represent at least one of the position, direction and length of the seat belt. Secondly, the target line segment can represent the seat belt detected from the image to be detected, and the line segment vector Ls representing the target line segment is vector It can also represent the seat belt detected from the image to be detected. vector Characterize the direction and length of the seat belt, then the electronic device can be at the key point vector Base vector The direction and the line segment vector Ls vector The direction is similar, and the key point vector Base vector The length of the line segment vector Ls vector When the lengths are similar, it can be determined that the first person is wearing a seat belt.
[0099] The change in the distance between the first person and the camera that collects the image to be detected and / or the change in the angle between the first person and the camera that collects the image to be detected may cause the length and / or direction of the seat belt detected in the image to be detected to change (i.e., the above-mentioned line segment vector Ls vector Then, judging whether the first person is wearing a safety belt only based on the length and / or direction of the safety belt detected in the image to be detected may be subject to the change in the position of the camera, resulting in an error in judgment and poor robustness. In the embodiment of the present application, considering the change in the distance between the first person and the camera that collects the image to be detected and / or the change in the angle between the first person and the camera that collects the image to be detected, the position of the human skeleton point of the first person will also change (that is, the key point vector Base vector changes), and the above key point vector Base vector can characterize the length and / or direction of the safety belt when the first person is wearing the safety belt, then the electronic device compares the key point vector Base vector and the line segment vector Ls vector , to determine whether the first person is wearing a seat belt, it is possible to eliminate the judgment error caused by the change of the length and / or direction of the seat belt detected in the image to be detected due to certain factors. In other words, the accuracy and robustness of the seat belt wearing detection are improved.
[0100] In addition, since the image to be detected may include multiple persons, the electronic device can detect seat belts on the image to be detected and obtain seat belt areas of multiple persons (including the seat belt area of the first person); and can detect human skeleton points on the image to be detected and obtain human skeleton points of multiple persons (including at least one human skeleton point of the first person). In order to ensure that the seat belt area of the first person and the at least one human skeleton point of the first person determined by the electronic device based on the position of the first person in the vehicle are of the same person (i.e., the first person), the electronic device can calculate a first distance S between the target key point and the midpoint of the target line segment. distance The target line segment represents the seat belt area detected in the image to be detected, and the target key point is a point in at least one human skeleton point (including at least one key point) of the first person that is closer to the seat belt correctly worn by the first person. Then, the first distance S distance If it is smaller, it means that the seat belt area represented by the target line segment and at least one human skeleton point of the determined first person belong to the same person (ie, the first person).
[0101] In addition, the key point vector Base vector The length of the line segment vector Ls vector The closer the lengths are, the more it can be indicated that the seat belt area represented by the target line segment and at least one human skeleton point of the determined first person belong to the same person (ie, the first person).
[0102] In some embodiments, the position of the target line segment in the image to be detected may include: coordinates of two endpoints of the target line segment.
[0103] Then, the electronic device can determine the starting point and the end point of the target line segment, and subtract the coordinates of the starting point from the coordinates of the end point to obtain the line segment vector Ls. vector Then, the electronic device can obtain the coordinates of the midpoint according to the coordinates of the two endpoints. In the case where the preset coordinate system corresponding to the image to be detected takes the upper left corner of the image to be detected as the starting point, the direction from the upper left corner to the lower left corner as the positive direction of the y-axis, and the direction from the upper left corner to the upper right corner as the positive direction of the x-axis, the horizontal coordinate of the starting point is smaller than the horizontal coordinate of the end point.
[0104] For example, Figure 6 The target line segment 63 shown has endpoints 631 and 632. Endpoint 631 is the starting point, and endpoint 632 is the end point. The position of the midpoint of the target line segment is the coordinates of the midpoint between endpoints 631 and 632. The line segment vector Ls representing the target line segment 63 vector The direction is from endpoint 631 to endpoint 632.
[0105] It should be noted that the above coordinates are all in the same coordinate system (eg, the above preset coordinate system).
[0106] In some embodiments, the electronic device may generate a first contribution vector with the second key point as the starting point and the first key point as the end point based on the coordinates of the first key point and the coordinates of the second key point. Then, the electronic device may generate a second contribution vector with the third key point as the starting point and the fourth key point as the end point based on the coordinates of the third key point and the coordinates of the fourth key point. Finally, the electronic device may sum the second contribution vector with twice the first contribution vector to obtain the key point vector Base vector .
[0107] The electronic device may subtract the coordinates of the second key point from the coordinates of the first key point to obtain the first contribution vector. The electronic device may subtract the coordinates of the third key point from the coordinates of the fourth key point to obtain the second contribution vector.
[0108] It can be understood that the double of the first contribution vector (i.e., the product of the first contribution vector and two) is also a vector, which can represent the length and direction of a straight line from the waist to the shoulder on the same side of the first person. The second contribution vector can represent the length and direction of a straight line from the left shoulder to the right shoulder of the first person. Then, the key point vector Base obtained by summing this vector and the second contribution vector is vector The direction and length of the straight line from the left waist to the right shoulder of the first person may be characterized.
[0109] Usually, when the first person wears the safety belt normally, the position of the safety belt is on the straight line from the left waist to the right shoulder of the first person, the length of the safety belt is approximately equal to the length of the straight line from the left waist to the right shoulder of the first person, and the direction of the safety belt is also close to the direction of the straight line from the left waist to the right shoulder of the first person.
[0110] It should be noted that, in addition to twice the first contribution vector, the electronic device may also use a vector formed by two other key points to represent the length and direction of a straight line from the waist to the shoulder on the same side of the first person. Similarly, in addition to the second contribution vector, the electronic device may also use a vector formed by two other key points to represent the length and direction of a straight line from the left shoulder to the right shoulder of the first person. The embodiments of the present application are not limited to this.
[0111] For example, Figure 4 The directed vector 41 shown in (b) is the first contribution vector. The directed vector 41 is multiplied by 2 to obtain the directed vector 41'; the directed vector 42 is the second contribution vector. The electronic device sums the directed vector 41' and the directed vector 42 to obtain the directed vector 43. The directed vector 43 is the key point vector Base vector .
[0112] In some embodiments, the electronic device obtains the key point vector Base vector , line segment vector Ls vector , and the first distance S between the target key point and the midpoint of the target segment distance After that, we can use the key point vector Base vector and the line segment vector Ls vector , get the key point vector Base vector and the line segment vector Ls vector The angle information between the angles and the key point vector Base vector The modulus and line segment vector Ls vector Then, the electronic device calculates the absolute value of the difference between the module lengths according to the angle information, the absolute value of the difference, and the first distance S distance , get the matching value between at least one key point and the target segment.
[0113] Among them, the key point vector Base vector and the line segment vector Ls vector The smaller the angle between (e.g., the closer it is to 0), the smaller the key point vector Base vector The direction and line segment vector Ls vector The more similar the direction is. The key point vector Base vector The modulus and line segment vector Ls vector The smaller the absolute value of the difference between the modulus lengths (e.g., the closer it is to 0), the smaller the key point vector Base vector The length and line segment vector Ls vector The first distance S distance The smaller it is (e.g., the closer it is to 0), the higher the accuracy of the determined safety belt area of the first person and at least one human skeleton point of the first person being the same person (i.e., the first person). vector , determine the key point vector Base according to at least one human skeleton point of the first person vector , therefore, the first distance S distance The smaller it is, the more it can represent the line segment vector Ls vector and key point vector Base vector Both reflect that the higher the accuracy of the safety belt worn by the same person (ie the first person).
[0114] Among them, the key point vector Base vector and the line segment vector Ls vector The angle information of the angle between can be the cosine value or sine value of the angle, etc.
[0115] It should be noted that the electronic device may also calculate the matching value between the at least one key point and the target line segment according to at least one of the angle information, the absolute value of the difference, and the first distance Sdistance. This embodiment of the application does not limit this.
[0116] For example, the coordinates of the target key points can be expressed as (x m ,y m ), the coordinates of the midpoint of the target line segment can be expressed as (x n ,y n ). The electronic device can calculate the first distance S between the target key point and the midpoint of the target line segment according to formula (1). distance . Formula (1) is as follows:
[0117]
[0118] For example, the key point vector Base vector and the line segment vector Ls vector The angle information between the angles is the cosine value of the angle. For example, the key point vector Base vector It can be expressed as (x 1 ,y 1 ), line segment vector Ls vector It can be expressed as (x 2 ,y 3 ). The electronic device can calculate the cosine value cosθ of the angle according to formula (2). Formula (2) is as follows:
[0119]
[0120] Secondly, the electronic device can calculate the absolute value S of the difference between the modulus of the key point vector Basevector and the modulus of the line segment vector Lsvector according to formula (3): length . Formula (3) is as follows:
[0121]
[0122] Exemplarily, the electronic device can calculate the angle information (eg, cosine value cosθ) and the absolute value S of the difference. length , the first distance S distance , and preset weights to obtain a matching value S between at least one key point and the target segment total The preset weights include: a first weight α corresponding to the angle information, a second weight β corresponding to the first distance, and a third weight γ corresponding to the absolute value of the difference.
[0123] For example, when the weight in the preset weight can be a positive number, the electronic device can calculate the matching value S according to formula (4): total . Formula (4) is as follows:
[0124] S total =α*cosθ-β*S distance -γ*S length (4)
[0125] Among them, the key point vector Base vector and the line segment vector Ls vector The closer the angle between them is to 0, the closer the cosine value cosθ of the angle is to 1, indicating that the key point vector Base vector The direction and line segment vector Ls vector The absolute value of the difference S length The smaller it is, the more important the key point vector Base is. vector The length and line segment vector Ls vector The first distance S distance The smaller it is, the line segment vector Ls vector and key point vector Base vector Both reflect that the higher the accuracy of the safety belt worn by the same person (ie the first person).
[0126] In summary, electronic devices can be based on the fact that the closer cosθ is to 1, the better, and the absolute value of the difference S length The smaller the better, the first distance S distance The smaller the better, and the value of the preset weight, set the preset value range. Then, if the electronic device determines that the matching value S total If the electronic device determines that the matching value S total If it is not within the preset value range, it is determined that the first person is not wearing a seat belt.
[0127] It should be noted that the electronic device can flexibly set preset weights and preset value ranges in different usage scenarios (such as using an external camera to collect images to be detected, or using an internal camera to collect images to be detected) to adapt to different usage scenarios, so as to further improve the accuracy and robustness of seat belt wearing detection.
[0128] Secondly, the electronic device uses multiple parameters (including the angle information of the angle, the absolute value of the difference, and the first distance) to generate a matching value, which is used to determine whether the first person is wearing a seat belt. In other words, the multiple parameters are used to determine whether the first person is wearing a seat belt. Compared with the related art of only determining whether the image to be detected includes a seat belt based on the characteristics of the seat belt, this method has higher accuracy and stronger robustness.
[0129] In some embodiments, when the electronic device determines that the first person is not wearing a seat belt, the electronic device may also record and store relevant information of the first person. Figure 7 As shown, a seat belt wearing detection method provided in an embodiment of the present application may further include S71-S72 after S25.
[0130] S71. When it is determined that the first person is not wearing a seat belt, the electronic device sends a prompt message; the prompt message is used to indicate that the first person is not wearing a seat belt.
[0131] The electronic device may send the prompt information by any method such as voice broadcast, text message prompt or display screen display, etc. The prompt information may also include information about the vehicle taken by the first person.
[0132] Exemplarily, the electronic device is installed in the vehicle, and the electronic device may further include a voice module. The electronic device may play the prompt information through the voice module.
[0133] S72. The electronic device obtains the acquisition time and acquisition position of the image to be detected, and stores the image to be detected, acquisition information and prompt information.
[0134] The electronic device may obtain the acquisition information of the image to be detected, such as the acquisition time, acquisition location, and camera identification of the image to be detected. Then, the electronic device may store the image to be detected, the acquisition information, and the prompt information in correspondence, or store the image to be detected and the acquisition information in correspondence.
[0135] Exemplarily, the acquisition information may include at least one of the following: acquisition time, acquisition location (e.g., latitude and longitude information of the camera that acquired the image to be detected at the acquisition time), and camera identification of the camera that acquired the image to be detected, etc.
[0136] It should be noted that, when determining that the first person is not wearing a safety belt, the electronic device may directly execute S72, or execute S72 first and then S71. The embodiment of the present application does not limit the order in which the electronic device executes S72.
[0137] In some embodiments, the electronic device can upload the image to be detected, the collected information and the prompt information to a background server (eg, the cloud data management module 13 mentioned above).
[0138] It is understandable that the electronic device detects the behavior of the first person not wearing a seat belt in a manner without human intervention, and can also prompt the first person in real time and record the behavior of the first person not wearing a seat belt.
[0139] For example, the electronic device uses the key point vector Base vector , the above line segment vector Ls vector , and the first distance S distance Take the above matching value as an example, Figure 8 As shown, a seat belt wearing detection method provided in an embodiment of the present application may include S81 before S23, S23 may include S82, S25 may include S83-S810, and S72 may include S811.
[0140] S81. The electronic device determines whether the first person in the image to be detected meets the detection condition based on at least one human skeleton point of the first person.
[0141] The electronic device executes S82 when it is determined that the first person in the image to be detected meets the detection condition. The electronic device continues to execute S21 to obtain a new image to be detected when it is determined that the first person in the image to be detected does not meet the detection condition.
[0142] S82. When the first person in the image to be detected meets the detection conditions, the electronic device determines at least one key point from at least one human skeleton point; the at least one key point is used to characterize the position, direction and length of the safety belt worn by the first person.
[0143] S83. The electronic device obtains a key point vector according to the position of at least one key point.
[0144] It should be noted that the embodiment of the present application does not limit the order in which the electronic device executes S82-S83 and S24. For example, the electronic device may execute S82-S83 and S24 simultaneously; or, the electronic device may execute S24 first and then execute S82-S83.
[0145] S84. The electronic device uses a least square method to perform straight line fitting and interception on the seat belt area corresponding to the first person to obtain a target line segment.
[0146] S85. The electronic device obtains a line segment vector representing the target line segment and the coordinates of the midpoint of the target line segment according to the position of the target line segment in the image to be detected.
[0147] S86. The electronic device obtains a first distance between the target key point and the midpoint of the target line segment according to the position of the midpoint of the target line segment and the position of the target key point among the at least one key point.
[0148] S87: The electronic device obtains a matching value between at least one key point and a target line segment according to the key point vector, the line segment vector, and the first distance.
[0149] S88. The electronic device determines whether the matching value is within a preset value range.
[0150] If it is determined that the matching value is within the preset value range, the electronic device may execute S89. If it is determined that the matching value is not within the preset value range, the electronic device may execute S810.
[0151] S89. The electronic device determines that the first person is wearing a seat belt.
[0152] S810. The electronic device determines that the first person is not wearing a seat belt.
[0153] S811. The electronic device obtains the acquisition time and acquisition position of the image to be detected, and uploads the image to be detected, acquisition information and prompt information to the background server.
[0154] It is understandable that the above method can be implemented by a seat belt wearing detection device. In order to realize the above functions, the seat belt wearing detection device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0155] The embodiment of the present application can divide the functional modules of the above-mentioned safety belt wearing detection device etc. according to the above-mentioned method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0156] In the case of dividing each functional module into corresponding functional modules, Fig. 9 A possible structural diagram of the seat belt wearing detection device involved in the above embodiment is shown. The seat belt wearing detection device 90 includes: an acquisition module 91, a first detection module 92, a processing module 93 and a second detection module 94.
[0157] Among them, the acquisition module 91 is used to acquire the image to be detected; the image to be detected includes one or more persons. The first detection module 92 is used to detect human skeleton points in the image to be detected, and obtain the position of at least one human skeleton point of the first person. Among them, the first person is a person in the image to be detected. The processing module 93 is used to determine at least one key point from at least one human skeleton point. At least one key point is used to characterize at least one of the position, direction and length of the seat belt worn by the first person. The second detection module 94 is used to detect the seat belt in the image to be detected, and obtain the seat belt area corresponding to the first person. The processing module 93 is also used to determine whether the first person is wearing a seat belt based on the position of at least one key point and the seat belt area corresponding to the first person.
[0158] In one possible design, the processing module 93 is specifically used to: perform straight line fitting and straight line interception on the seat belt area corresponding to the first person to obtain a target line segment; the target line segment is used to characterize the position, direction and length of the seat belt area; based on the position of the target line segment in the image to be detected and the position of at least one key point, determine whether the first person is wearing a seat belt.
[0159] In another possible design, the processing module 93 is specifically used to: obtain a line segment vector representing the target line segment and the position of the midpoint of the target line segment according to the position of the target line segment in the image to be detected; obtain a key point vector according to the position of at least one key point; the key point vector is used to characterize the direction and length of the seat belt worn by the first person; obtain a first distance according to the position of the midpoint of the target line segment and the position of the target key point in at least one key point; obtain a matching value between at least one key point and the target line segment according to the key point vector, the line segment vector, and the first distance; and determine whether the first person is wearing a seat belt based on the matching value and a preset value range.
[0160] The first distance is the distance between the target key point and the midpoint of the target line segment. The target key point is selected from at least one key point according to a preset rule; the distance between the target key point and the safety belt worn by the first person is smaller than the distance between other key points in the at least one key point except the target key point and the safety belt worn by the first person.
[0161] In another possible design, the processing module 93 is specifically used to: obtain the angle information of the angle between the key point vector and the line segment vector, and the absolute value of the difference between the modulus of the key point vector and the modulus of the line segment vector based on the key point vector and the line segment vector; and obtain the matching value based on the angle information, the absolute value of the difference, and the first distance.
[0162] In another possible design method, at least one key point includes: a first key point, a second key point, a third key point and a fourth key point; the first key point is a point on the nose, the second key point is a connection point between the neck and the body, the third key point is a point on the right shoulder, and the fourth key point is a point on the left shoulder; the position of each key point is the coordinate of each key point in the image to be detected.
[0163] Among them, the processing module 93 is specifically used to: generate a first contribution vector with the second key point as the starting point and the first key point as the end point according to the coordinates of the first key point and the coordinates of the second key point; generate a second contribution vector with the third key point as the starting point and the fourth key point as the end point according to the coordinates of the third key point and the coordinates of the fourth key point; sum the second contribution vector with twice the first contribution vector to obtain a key point vector.
[0164] In another possible design, the position of the target line segment in the image to be detected includes: the coordinates of the two endpoints of the target line segment; the position of the midpoint of the target line segment is the coordinates of the midpoint. The processing module 93 is specifically used to: determine the starting point and the end point of the two endpoints, and subtract the coordinates of the starting point from the coordinates of the end point to obtain the line segment vector; the horizontal coordinate of the starting point is less than the horizontal coordinate of the end point; and the coordinates of the midpoint are obtained according to the coordinates of the two endpoints.
[0165] In another possible design, the second detection module 94 is specifically used to: detect seat belts in the image to be detected to obtain a binary image; at least one connected domain in the binary image represents a seat belt area to be selected; filter the connected domains in at least one connected domain in the binary image whose area is less than a preset area threshold to obtain at least one filtered connected domain; at least one filtered connected domain is at least one seat belt area, and at least one seat belt area includes the seat belt area corresponding to the first person.
[0166] In another possible design, the device 90 also includes: a prompt module 95, which is used to issue a prompt message when it is determined that the first person is not wearing a seat belt; the prompt information is used to characterize that the first person is not wearing a seat belt; a storage module 96, which is used to obtain the acquisition information of the image to be detected, and store the image to be detected, the acquisition information and the prompt information.
[0167] Of course, the seat belt wearing detection device 90 includes but is not limited to the unit modules listed above. Moreover, the specific functions that can be realized by the above functional units also include but are not limited to the functions corresponding to the method steps described in the above examples. The detailed description of other modules of the seat belt wearing detection device 90 can refer to the detailed description of the corresponding method steps, and the embodiments of the present application will not be repeated here.
[0168] In the case of an integrated unit, Fig.10 A possible structural diagram of an electronic device involved in the above embodiment is shown. The electronic device 100 may include a processor 101 and a memory 102. The memory 102 is a memory for storing instructions executable by the processor 101. The processor 101 is configured to execute the instructions so that the electronic device performs each function or step in the above method embodiment.
[0169] Specifically, the processor 101 is used to control and manage the actions of the electronic device. The memory 102 is used to store program codes and data of the electronic device, such as a seat belt wearing detection method, a preset weight, a preset value range, and the like.
[0170] Furthermore, the device 100 may also include a communication module. The communication module is used to support the communication between the electronic device and other network entities to implement functions such as data interaction, such as supporting the communication between the electronic device and a background server to implement data interaction.
[0171] The processor 101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 101 may include an AP, a modem processor, a GPU, an ISP, a controller, a memory, a video codec, a DSP, a baseband processor, and / or an NPU, etc.
[0172] The memory 102 may include one or more computer-readable storage media, which may be non-transitory. The memory 102 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 102 is used to store at least one instruction, which is used to be executed by the processor 101 to implement the seat belt wearing detection method provided in the embodiment of the present application.
[0173] The embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above electronic device, the electronic device performs each function or step in the above method embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device.
[0174] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0175] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, 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 interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0176] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0177] In addition, each functional unit in each embodiment of the present application 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. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0178] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.
[0179] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A seat belt wearing detection method, characterized in that: The method comprises: Acquire an image to be detected; the image to be detected includes one or more persons; Detecting human skeleton points in the image to be detected to obtain the position of at least one human skeleton point of a first person; wherein the first person is a person in the image to be detected; Determine at least one key point from the at least one human skeleton point; the at least one key point is used to characterize at least one of the position, direction and length of the safety belt worn by the first person; Detecting a seat belt on the image to be detected to obtain a seat belt area corresponding to the first person; Performing straight line fitting and straight line interception on the seat belt area corresponding to the first person to obtain a target line segment; the target line segment is used to characterize the position, direction and length of the seat belt area; According to the position of the target line segment in the image to be detected, a line segment vector representing the target line segment and the position of the midpoint of the target line segment are obtained; Obtaining a key point vector according to the position of the at least one key point; the key point vector is used to characterize the direction and length of the safety belt worn by the first person; A first distance is obtained according to the position of the midpoint of the target line segment and the position of the target key point in the at least one key point; wherein the first distance is the distance between the target key point and the midpoint of the target line segment; the target key point is selected from the at least one key point according to a preset rule; and the distance between the target key point and the safety belt worn by the first person is smaller than the distance between other key points in the at least one key point except the target key point and the safety belt worn by the first person; Obtaining a matching value between the at least one key point and the target line segment according to the key point vector, the line segment vector, and the first distance; Whether the first person is wearing a seat belt is determined based on the matching value and the preset value range.
2. The method according to claim 1, characterized in that The obtaining, according to the key point vector, the line segment vector, and the first distance, a matching value between the at least one key point and the target line segment includes: According to the key point vector and the line segment vector, angle information of the angle between the key point vector and the line segment vector and an absolute value of a difference between a modulus of the key point vector and a modulus of the line segment vector are obtained; The matching value is obtained according to the angle information, the absolute value of the difference, and the first distance.
3. The method according to claim 1, characterized in that The at least one key point includes: a first key point, a second key point, a third key point and a fourth key point; the first key point is a point on the nose, the second key point is a connection point between the neck and the body, the third key point is a point on the right shoulder, and the fourth key point is a point on the left shoulder; the position of each key point is the coordinate of each key point in the image to be detected; Wherein, obtaining a key point vector according to the position of the at least one key point includes: Generate a first contribution vector with the second key point as a starting point and the first key point as an end point according to the coordinates of the first key point and the coordinates of the second key point; Generate a second contribution vector with the third key point as a starting point and the fourth key point as an end point according to the coordinates of the third key point and the coordinates of the fourth key point; The key point vector is obtained by summing twice the first contribution vector and the second contribution vector.
4. The method according to claim 1, characterized in that: The position of the target line segment in the image to be detected includes: the coordinates of the two endpoints of the target line segment; the position of the midpoint of the target line segment is the coordinates of the midpoint; Wherein, obtaining the line segment vector representing the target line segment and the position of the midpoint of the target line segment according to the position of the target line segment in the image to be detected includes: Determine a starting point and an end point of the two endpoints, and subtract the coordinates of the starting point from the coordinates of the end point to obtain the line segment vector; the abscissa of the starting point is smaller than the abscissa of the end point; The coordinates of the midpoint are obtained according to the coordinates of the two endpoints.
5. The method according to any one of claims 1 to 4, characterized in that The detecting a seat belt from the image to be detected to obtain a seat belt area corresponding to the first person includes: Detecting seat belts on the image to be detected to obtain a binary image; at least one connected domain in the binary image represents a seat belt area to be selected; Filter the connected domains whose area is smaller than a preset area threshold in at least one connected domain in the binary image to obtain at least one filtered connected domain; the at least one filtered connected domain is at least one seat belt area, and the at least one seat belt area includes the seat belt area corresponding to the first person.
6. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When it is determined that the first person is not wearing a seat belt, a prompt message is issued; the prompt message is used to indicate that the first person is not wearing a seat belt; Acquire the acquisition information of the image to be detected, and store the image to be detected, the acquisition information and the prompt information.
7. A seat belt wearing detection device, characterized in that: The device comprises: An acquisition module, used for acquiring an image to be detected; the image to be detected includes one or more persons; A first detection module is used to detect human skeleton points in the image to be detected, and obtain the position of at least one human skeleton point of a first person; wherein the first person is a person in the image to be detected; A processing module, configured to determine at least one key point from the at least one human skeleton point; the at least one key point is used to characterize at least one of the position, direction and length of the safety belt worn by the first person; A second detection module is used to detect a seat belt from the image to be detected, and obtain a seat belt area corresponding to the first person; The processing module is further used to perform straight line fitting and straight line interception on the safety belt area corresponding to the first person to obtain a target line segment; the target line segment is used to characterize the position, direction and length of the safety belt area; The processing module is further used to obtain a line segment vector representing the target line segment and a position of a midpoint of the target line segment according to the position of the target line segment in the image to be detected; The processing module is further used to obtain a key point vector according to the position of the at least one key point; the key point vector is used to characterize the direction and length of the safety belt worn by the first person; The processing module is further used to obtain a first distance according to the position of the midpoint of the target line segment and the position of the target key point in the at least one key point; wherein the first distance is the distance between the target key point and the midpoint of the target line segment; the target key point is selected from the at least one key point according to a preset rule; the distance between the target key point and the safety belt worn by the first person is smaller than the distance between other key points in the at least one key point except the target key point and the safety belt worn by the first person; The processing module is further used to obtain a matching value between the at least one key point and the target line segment according to the key point vector, the line segment vector, and the first distance; The processing module is further used to determine whether the first person is wearing a seat belt based on the matching value and a preset value range.
8. The device according to claim 7, characterized in that The processing module is specifically used for: According to the key point vector and the line segment vector, angle information of the angle between the key point vector and the line segment vector and an absolute value of a difference between a modulus of the key point vector and a modulus of the line segment vector are obtained; The matching value is obtained according to the angle information, the absolute value of the difference, and the first distance.
9. The device according to claim 7, characterized in that The at least one key point includes: a first key point, a second key point, a third key point and a fourth key point; the first key point is a point on the nose, the second key point is a connection point between the neck and the body, the third key point is a point on the right shoulder, and the fourth key point is a point on the left shoulder; the position of each key point is the coordinate of each key point in the image to be detected; Wherein, the processing module is specifically used for: Generate a first contribution vector with the second key point as a starting point and the first key point as an end point according to the coordinates of the first key point and the coordinates of the second key point; Generate a second contribution vector with the third key point as a starting point and the fourth key point as an end point according to the coordinates of the third key point and the coordinates of the fourth key point; The key point vector is obtained by summing twice the first contribution vector and the second contribution vector.
10. The device according to claim 7, characterized in that The position of the target line segment in the image to be detected includes: the coordinates of the two endpoints of the target line segment; the position of the midpoint of the target line segment is the coordinates of the midpoint; Wherein, the processing module is specifically used for: Determine a starting point and an end point of the two endpoints, and subtract the coordinates of the starting point from the coordinates of the end point to obtain the line segment vector; the abscissa of the starting point is smaller than the abscissa of the end point; The coordinates of the midpoint are obtained according to the coordinates of the two endpoints.
11. The device according to any one of claims 7 to 10, characterized in that The second detection module is specifically used for: Detecting seat belts on the image to be detected to obtain a binary image; at least one connected domain in the binary image represents a seat belt area to be selected; Filter the connected domains whose area is smaller than a preset area threshold in at least one connected domain in the binary image to obtain at least one filtered connected domain; the at least one filtered connected domain is at least one seat belt area, and the at least one seat belt area includes the seat belt area corresponding to the first person.
12. The device according to any one of claims 7 to 10, characterized in that The device also includes: a prompting module, configured to issue a prompting message when it is determined that the first person is not wearing a seat belt; the prompting message is used to indicate that the first person is not wearing a seat belt; The storage module is used to obtain the acquisition information of the image to be detected, and store the image to be detected, the acquisition information and the prompt information.
13. An electronic device, characterized in that: The electronic device comprises: a processor and a memory for storing instructions executable by the processor; The processor is configured to execute the instruction so that the electronic device performs the seat belt wearing detection method as described in any one of claims 1-6.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the seat belt wearing detection method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Safety belt wearing recognition method and device and electronic equipment
CN110795969A
Deep learning-based violation detection method for low hanging and high use of safety belt
CN112215138A
Vehicle safety belt detection method and device, electronic equipment and storage medium
CN112232136A
Occupant attitude estimation device
JP2010211705A
