A seat belt detection method, device, electronic equipment and storage medium
The pre-trained seat belt detection model determines the position of the seat belt corner in the car window image and determines whether the person in the car window is wearing a seat belt. This solves the problems of low detection accuracy and low efficiency in the existing technology and achieves low-voltage detection. High-accuracy detection under clarity or environmental interference.
Patent Information
- Application Number
- CN202010651048.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-08
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2040-07-08
AI Technical Summary
Existing seat belt detection methods have low detection accuracy when the clarity is low or there is environmental interference, and the algorithm used is complex and low-efficiency.
Using a pre-trained seat belt detection model, the vehicle window image is obtained to determine the position information of the two corner points of the seat belt, and based on the position information of the line segments connecting the corner points, it is judged whether to wear the seat belt, which simplifies the detection process and reduces the risk of errors. Image clarity and environmental interference requirements.
It improves the accuracy and efficiency of seat belt detection and can maintain high accuracy even when the clarity is low or there is environmental interference, without the need for complex image processing algorithms.
Smart Images

Figure CN111914671B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a seat belt detection method, device, electronic equipment and storage medium. Background Art
[0002] As the number of vehicles increases, the number of people who fail to wear seat belts as required, which endangers the safety of drivers, passengers and the public, is also increasing. With the rapid development of image processing, the technology of image-based detection of whether seat belts are worn is becoming more and more mature. For this reason, various intelligent traffic violation capture systems have begun to appear in the streets. After the capture system collects the vehicle image, it detects whether the person in the vehicle is wearing a seat belt based on the image.
[0003] When detecting seat belts, the prior art generally adopts a method of determining a target area in the image that contains the influence of the driver and passengers, selecting a parallel straight line area that meets the preset standards from the target area as the area to be detected, and using a region growing algorithm to determine whether the area to be detected has regional consistency. If so, it means that the driver and passengers are wearing seat belts, otherwise it is determined that the driver and passengers are not wearing seat belts.
[0004] The problem with the existing technology is that the process of determining the area to be detected and judging whether there is regional consistency has high requirements for image clarity and environmental interference. In images with high clarity and low environmental interference, the accuracy of seat belt detection is high, but in images with low clarity or environmental interference, the accuracy of seat belt detection is low. In addition, the algorithm used in the existing seat belt detection process is relatively complex, and the detection efficiency is low. Summary of the invention
[0005] The embodiments of the present invention provide a seat belt detection method, device, electronic device and storage medium, which are used to improve the accuracy and efficiency of seat belt detection.
[0006] An embodiment of the present invention provides a seat belt detection method, the method comprising:
[0007] Acquire the vehicle window image to be detected;
[0008] Inputting the vehicle window image into a pre-trained seat belt detection model, and determining position information of two corner points of the seat belt based on the seat belt detection model;
[0009] According to the position information of the two corner points, the position information of the line segment connecting the two corner points is determined, and according to the position information of the line segment, it is determined whether the person in the vehicle window is wearing a seat belt.
[0010] Furthermore, the step of acquiring the vehicle window image to be detected includes:
[0011] Acquire an image acquired by an image acquisition device, input the image into a pre-trained vehicle detection model, and determine a vehicle sub-image;
[0012] Inputting the vehicle sub-image into a pre-trained vehicle window detection model to determine the vehicle window sub-image;
[0013] A first main driver's window image and a first assistant driver's window image are determined according to the window sub-image, and the first main driver's window image and the first assistant driver's window image are respectively determined as the window images to be detected.
[0014] Furthermore, inputting the vehicle window image into a pre-trained seat belt detection model, and determining the position information of two corner points of the seat belt based on the seat belt detection model includes:
[0015] Inputting the first main driver's window image into a pre-trained main driver's seat belt detection model, and determining two corner point position information of the main driver's seat belt based on the main driver's seat belt detection model;
[0016] The first passenger window image is input into a pre-trained passenger seat belt detection model, and the position information of two corner points of the passenger seat belt is determined based on the passenger seat belt detection model.
[0017] Furthermore, the training process of the main driver's seat belt detection model includes:
[0018] For each second main driver window image in the first training set, the second main driver window image and the first annotated image corresponding to the second main driver window image are input into the main driver seat belt detection model to train the main driver seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second main driver window image, and the second main driver window image is mirror-flipped along the vertical center line to obtain the first annotated image corresponding to the second main driver window image, or the second main driver window image is mirror-flipped along the vertical center line, and the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the flipped second main driver window image to obtain the first annotated image corresponding to the second main driver window image.
[0019] Furthermore, the training process of the co-pilot seat belt detection model includes:
[0020] For each second passenger window image in the second training set, the second passenger window image and the second annotated image corresponding to the second passenger window image are input into the passenger seat belt detection model to train the passenger seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second passenger window image to obtain the second annotated image corresponding to the second passenger window image.
[0021] Further, determining whether a person in the vehicle window wears a seat belt according to the position information of the line segment includes:
[0022] Determine the slope of the line segment according to the position information of the line segment, and judge whether the slope is within a preset slope range. If so, determine that the person in the vehicle window is wearing a seat belt; if not, determine that the person in the vehicle window is not wearing a seat belt; or determine the target area where the person in the vehicle window is located, and judge whether the number of pixel points where the line segment overlaps with the target area is greater than a preset number threshold; if so, determine that the person in the vehicle window is wearing a seat belt; if not, determine that the person in the vehicle window is not wearing a seat belt.
[0023] Further, the determining the target area where the person in the vehicle window is located includes:
[0024] The vehicle window image to be detected is input into a pre-trained target segmentation model, and based on the target segmentation model, a target area where the person in the vehicle window is located is determined.
[0025] Furthermore, if it is determined that the person in the vehicle window is wearing a seat belt, the method further includes:
[0026] If the vehicle window image to be detected is a first main driver's vehicle window image, the position information of two target corner points is determined according to the position information of the two corner points, the position information of the central pixel point of the vehicle window image to be detected, and the length and width information of the vehicle window image to be detected, and the position information of the line segment formed by the two target corner points is determined as the position information of the seat belt;
[0027] If the vehicle window image to be detected is the first passenger vehicle window image, the position information of the line segment formed by the two corner points is determined as the position information of the seat belt.
[0028] On the other hand, an embodiment of the present invention provides a seat belt detection device, the device comprising:
[0029] An acquisition module, used for acquiring a vehicle window image to be detected;
[0030] A first determination module is used to input the vehicle window image into a pre-trained seat belt detection model, and determine the position information of two corner points of the seat belt based on the seat belt detection model;
[0031] The second determination module is used to determine the position information of the line segment connecting the two corner points according to the position information of the two corner points, and determine whether the person in the vehicle window wears a seat belt according to the position information of the line segment.
[0032] Furthermore, the acquisition module is specifically used to acquire an image captured by an image acquisition device, input the image into a pre-trained vehicle detection model, and determine a vehicle sub-image; input the vehicle sub-image into a pre-trained window detection model to determine a window sub-image; determine a first main driver's window image and a first co-driver's window image according to the window sub-image, and respectively determine the first main driver's window image and the first co-driver's window image as window images to be detected.
[0033] Furthermore, the acquisition module is specifically used to input the first main driver's window image into a pre-trained main driver's seat belt detection model, and determine the two corner point position information of the main driver's seat belt based on the main driver's seat belt detection model; input the first co-driver's window image into a pre-trained co-driver's seat belt detection model, and determine the two corner point position information of the co-driver's seat belt based on the co-driver's seat belt detection model.
[0034] Furthermore, the device also includes:
[0035] The first training module is used to input the second main driving window image and the first annotated image corresponding to the second main driving window image into the main driving seat belt detection model for each second main driving window image in the first training set, and train the main driving seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second main driving window image, and the second main driving window image is mirror-flipped along the vertical center line to obtain the first annotated image corresponding to the second main driving window image, or the second main driving window image is mirror-flipped along the vertical center line, and the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the flipped second main driving window image to obtain the first annotated image corresponding to the second main driving window image.
[0036] Furthermore, the device also includes:
[0037] The second training module is used to input the second passenger window image and the second annotated image corresponding to the second passenger window image into the passenger seat belt detection model for each second passenger window image in the second training set, and train the passenger seat belt detection model; wherein the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second passenger window image to obtain the second annotated image corresponding to the second passenger window image.
[0038] Furthermore, the second determination module is specifically used to determine the slope of the line segment according to the position information of the line segment, and determine whether the slope is within a preset slope range. If so, it is determined that the person in the vehicle window is wearing a seat belt; if not, it is determined that the person in the vehicle window is not wearing a seat belt; or determine the target area where the person in the vehicle window is located, and determine whether the number of pixel points where the line segment overlaps with the target area is greater than a preset number threshold; if so, it is determined that the person in the vehicle window is wearing a seat belt; if not, it is determined that the person in the vehicle window is not wearing a seat belt.
[0039] Furthermore, the second determination module is specifically used to input the vehicle window image to be detected into a pre-trained target segmentation model, and determine the target area where the person in the vehicle window is located based on the target segmentation model.
[0040] Furthermore, the device also includes:
[0041] The third determination module is used to determine the position information of two target corner points according to the position information of the two corner points, the position information of the central pixel point of the window image to be detected and the length and width information of the window image to be detected if the window image to be detected is the first main driver's window image, and determine the position information of the line segment formed by the two target corner points as the position information of the seat belt; if the window image to be detected is the first co-driver's window image, determine the position information of the line segment formed by the two corner points as the position information of the seat belt.
[0042] On the other hand, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0043] Memory, used to store computer programs;
[0044] The processor is used to implement any of the method steps described above when executing the program stored in the memory.
[0045] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the method steps described above is implemented.
[0046] An embodiment of the present invention provides a seat belt detection method, device, electronic device and storage medium. The method includes: obtaining a vehicle window image to be detected; inputting the vehicle window image into a pre-trained seat belt detection model, and determining the position information of two corner points of the seat belt based on the seat belt detection model; determining the position information of a line segment connecting the two corner points according to the position information of the two corner points, and determining whether a person in the vehicle window is wearing a seat belt according to the position information of the straight line.
[0047] The above technical solution has the following advantages or beneficial effects:
[0048] In an embodiment of the present invention, a pre-trained seat belt detection model is stored in the electronic device, and the seat belt detection model is used to perform corner point detection on the input image, that is, after the electronic device obtains the window image to be detected, it determines the position information of the two corner points of the seat belt in the window image to be detected based on the seat belt detection model, and then determines whether the person in the window is wearing a seat belt based on the position information of the two corner points. The seat belt detection based on the seat belt detection model has low requirements on the clarity of the image and environmental interference. Therefore, even in the case of low clarity or environmental interference, the accuracy of the seat belt detection can be guaranteed. In addition, the embodiment of the present invention does not require complex image processing algorithms, thereby improving the efficiency of seat belt detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 A schematic diagram of a seat belt detection process provided in Example 1 of the present invention;
[0051] Figure 2 A schematic diagram of a seat belt detection process provided by Embodiment 6 of the present invention;
[0052] Figure 3 A schematic diagram of a whole frame image provided by Embodiment 6 of the present invention;
[0053] Figure 4 A schematic diagram of a vehicle sub-image determined based on a vehicle detection model provided in Embodiment 6 of the present invention;
[0054] Figure 5 A schematic diagram of a vehicle window sub-image determined based on a vehicle window detection model provided in Embodiment 6 of the present invention;
[0055] Figure 6 A schematic diagram of key points in an image provided by Example 6 of the present invention;
[0056] Figure 7 The vehicle window image before flipping provided by Embodiment 6 of the present invention;
[0057] Figure 8 The flipped vehicle window image provided by Embodiment 6 of the present invention;
[0058] Fig. 9 Embodiment 6 of the present invention provides a schematic diagram for calculating and obtaining the upper left corner point A (L) and the lower right corner point C (M) of the safety belt after flipping;
[0059] Fig.10 A schematic diagram of calculating and obtaining the center point B (M) of the safety belt after flipping provided in Embodiment 6 of the present invention;
[0060] Fig.11 A schematic diagram of calculating target corner points provided in Example 6 of the present invention;
[0061] Fig.12 A schematic diagram of the target area where the driver is located provided in Example 6 of the present invention;
[0062] Fig.13 A schematic diagram of the structure of a seat belt detection device provided in Example 7 of the present invention;
[0063] Fig.14 This is a schematic diagram of the structure of a seat belt detection device provided in Example 8 of the present invention. DETAILED DESCRIPTION
[0064] The present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] Embodiment 1:
[0066] Figure 1 A schematic diagram of a seat belt detection process provided by an embodiment of the present invention, the process includes the following steps:
[0067] S101: Acquire a vehicle window image to be detected.
[0068] S102: Inputting the vehicle window image into a pre-trained seat belt detection model, and determining position information of two corner points of the seat belt based on the seat belt detection model.
[0069] S103: Determine the position information of the line segment connecting the two corner points according to the position information of the two corner points, and determine whether the person in the vehicle window is wearing a seat belt according to the position information of the line segment.
[0070] The seat belt detection method provided by the embodiment of the present invention is applied to an electronic device, which includes a PC, a tablet computer and other devices, and the electronic device can also be an image device. The image acquisition device is used to acquire the window image to be detected. If the electronic device is an image acquisition device, after the image acquisition device acquires the window image to be detected, the subsequent seat belt detection process is directly performed. If the electronic device is a PC, a tablet computer and other devices, after the image acquisition device acquires the window image, the window image is sent to the electronic device, and the electronic device acquires the window image and performs the subsequent seat belt detection process.
[0071] A pre-trained seat belt detection model is stored in the electronic device. The function of the seat belt detection model is to perform relevant processing on the input image and output the position information of the two corner points of the seat belt. Because the seat belt has two obvious corner point features, these two corner points are the corner points at both ends of the seat belt when the driver and passengers wear the seat belt, and there is a corner point at each end. The seat belt detection model of the embodiment of the present invention includes a Centernet detection model. When the Centernet detection model is trained, the annotated information is the key point information in the image, that is, the two corner point information in this application. Based on the trained Centernet detection model, the position information of the two corner points of the seat belt can be determined.
[0072] After the electronic device determines the position information of the two corner points, it determines the position information of the line segment connecting the two corner points, and determines whether the person in the vehicle window is wearing a seat belt according to the position information of the line segment. The electronic device can determine the length of the line segment according to the position information of the line segment, and then determine whether the length of the line segment is within a preset length range. If yes, it is determined that the person in the vehicle window is wearing a seat belt, and if no, it is determined that the person in the vehicle window is not wearing a seat belt.
[0073] In an embodiment of the present invention, a pre-trained seat belt detection model is stored in the electronic device, and the seat belt detection model is used to perform corner point detection on the input image, that is, after the electronic device obtains the window image to be detected, it determines the position information of the two corner points of the seat belt in the window image to be detected based on the seat belt detection model, and then determines whether the person in the window is wearing a seat belt based on the position information of the two corner points. The seat belt detection based on the seat belt detection model has low requirements on the clarity of the image and environmental interference. Therefore, even in the case of low clarity or environmental interference, the accuracy of the seat belt detection can be guaranteed. In addition, the embodiment of the present invention does not require complex image processing algorithms, thereby improving the efficiency of seat belt detection.
[0074] Embodiment 2:
[0075] The image captured by the image acquisition device is generally an environmental image including the vehicle window image to be detected, wherein in addition to the vehicle window image to be detected, there is other scene information. In order to avoid the adverse effects of other scene information in the image on the seat belt detection, based on the above embodiment, in the embodiment of the present invention, the acquisition of the vehicle window image to be detected includes:
[0076] Acquire an image acquired by an image acquisition device, input the image into a pre-trained vehicle detection model, and determine a vehicle sub-image;
[0077] Inputting the vehicle sub-image into a pre-trained vehicle window detection model to determine the vehicle window sub-image;
[0078] A first main driver's window image and a first assistant driver's window image are determined according to the window sub-image, and the first main driver's window image and the first assistant driver's window image are respectively determined as the window images to be detected.
[0079] In an embodiment of the present invention, an image captured by an image acquisition device is obtained, which is an environmental image captured by the image acquisition device and includes a vehicle window image to be detected. A pre-trained vehicle detection model is stored in the electronic device. The function of the vehicle detection model is to perform relevant processing on the input image and output a vehicle sub-image in the image.
[0080] Specifically, after the electronic device obtains the image captured by the image acquisition device, the image is input into the pre-trained vehicle detection model, and the vehicle detection model performs relevant processing on the image to determine the vehicle sub-image in the image. It should be noted that if the image contains only one vehicle, there is only one vehicle sub-image to be determined, and if the image contains multiple vehicles, there are multiple corresponding vehicle sub-images to be determined.
[0081] The electronic device also stores a pre-trained vehicle window detection model. The function of the vehicle window detection model is to perform correlation processing on the input vehicle sub-image and output the vehicle window sub-image in the vehicle sub-image.
[0082] Specifically, after the electronic device determines the vehicle sub-image, it inputs the vehicle sub-image into a pre-trained vehicle window detection model, and the vehicle window detection model performs correlation processing on the vehicle sub-image to determine the vehicle window sub-image in the vehicle sub-image. For each vehicle sub-image, the vehicle window sub-image corresponding to the vehicle sub-image can be determined.
[0083] In the embodiment of the present invention, after the vehicle window sub-image is determined, the first main driver's window image and the first co-driver's window image are determined according to the vehicle window sub-image, wherein the vehicle window sub-image can be equally divided left and right to obtain two images, the right side is the first main driver's window image, and the left side is the first co-driver's window image. Then, the first main driver's window image and the first co-driver's window image are respectively determined as the vehicle window images to be detected.
[0084] The training process of the vehicle detection model includes:
[0085] For each scene image in the first sample set, the scene image and the annotated image corresponding to the scene image are input into the vehicle detection model to train the vehicle detection model; wherein the annotated image is annotated with position information of a vehicle sub-image in the scene image.
[0086] The training process of the vehicle window detection model includes:
[0087] For each vehicle sub-image in the second sample set, the vehicle sub-image and the annotated image corresponding to the vehicle sub-image are input into the vehicle window detection model to train the vehicle window detection model; wherein the annotated image is annotated with position information of the vehicle window sub-image in the vehicle sub-image.
[0088] In the embodiment of the present invention, after the electronic device acquires the image captured by the image acquisition device, it determines the window sub-image based on the vehicle detection model and the window detection model, and then determines the first main driver's window image and the first assistant driver's window image as the window images to be detected. In this way, the environmental interference around the window images to be detected can be removed, and after the window images to be detected are input into the pre-trained seat belt detection model, the detection result of the seat belt detection model can be more accurate.
[0089] Embodiment 3:
[0090] In order to realize the seat belt detection of the main driver's cab occupant and the seat belt detection of the co-driver's cab occupant, the window images to be detected in the embodiment of the present invention include the first main driver's window image and the first co-driver's window image, because the three key points required for the Centernet detection model training are the upper left corner point, the lower right corner point and the center point between the two corner points, wherein the upper left and the upper right are the positional relationship in the image coordinate system. When wearing a seat belt in the first main driver's window image, the two corner points are the lower left corner point and the upper right corner point, respectively, and when wearing a seat belt in the first co-driver's window image, the two corner points are the upper left corner point and the lower right corner point, respectively. Since the positions of the corner points in the first main driver's window image and the first co-driver's window image are different, the main driver's seat belt detection model can be used to detect the two corner point position information of the main driver's seat belt, and the co-driver's seat belt detection model can be used to detect the two corner point position information of the co-driver's seat belt. Therefore, on the basis of the above embodiments, in an embodiment of the present invention, the inputting of the window image into a pre-trained seat belt detection model, and determining the two corner point position information of the seat belt based on the seat belt detection model includes:
[0091] Inputting the first main driver's window image into a pre-trained main driver's seat belt detection model, and determining two corner point position information of the main driver's seat belt based on the main driver's seat belt detection model;
[0092] The first passenger window image is input into a pre-trained passenger seat belt detection model, and the position information of two corner points of the passenger seat belt is determined based on the passenger seat belt detection model.
[0093] The training process of the main driver's seat belt detection model includes:
[0094] For each second main driver window image in the first training set, the second main driver window image and the first annotated image corresponding to the second main driver window image are input into the main driver seat belt detection model to train the main driver seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second main driver window image, and the second main driver window image is mirror-flipped along the vertical center line to obtain the first annotated image corresponding to the second main driver window image, or the second main driver window image is mirror-flipped along the vertical center line, and the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the flipped second main driver window image to obtain the first annotated image corresponding to the second main driver window image.
[0095] The electronic device stores a first training set, which includes a second main driver's window image, and each second main driver's window image has a corresponding first annotated image. The main driver's seat belt detection model is trained according to each second main driver's window image in the first training set and the first annotated image corresponding to each second main driver's window image.
[0096] Considering the three key points required for the training of the Centernet detection model, they are the upper left corner point, the lower right corner point and the center point between the two corner points. In the first main driving window image, when wearing a seat belt, the two corner points are the lower left corner point and the upper right corner point, respectively. Therefore, when determining the first annotated image, it is necessary to adjust the two corner points of the seat belt in the second main driving window image accordingly. The specific implementation methods include the following two: the first is to annotate the position information of the two corner points of the seat belt and the position information of the center point of the seat belt in the second main driving window image for each second main driving window image, and mirror-flip the second main driving window image with the vertical center line to obtain the first annotated image corresponding to the second main driving window image. The second is to mirror-flip the second main driving window image with the vertical center line, and annotate the position information of the two corner points of the seat belt and the position information of the center point of the seat belt in the flipped second main driving window image to obtain the first annotated image corresponding to the second main driving window image.
[0097] Through any of the above two methods, it can be ensured that the positions of the two corner points in the first annotated image corresponding to the second main driver's window image are the upper left corner point and the lower right corner point, which meets the needs of Centernet detection model training. Therefore, the accuracy of the trained main driver's seat belt detection model is better, and the two corner point position information of the main driver's seat belt determined based on the main driver's seat belt detection model is also more accurate.
[0098] The training process of the co-pilot seat belt detection model includes:
[0099] For each second passenger window image in the second training set, the second passenger window image and the second annotated image corresponding to the second passenger window image are input into the passenger seat belt detection model to train the passenger seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second passenger window image to obtain the second annotated image corresponding to the second passenger window image.
[0100] The electronic device stores a second training set, which includes second passenger window images, and each second passenger window image has a corresponding second annotated image. The passenger seat belt detection model is trained based on each second passenger window image in the second training set and the second annotated image corresponding to each second passenger window image.
[0101] When wearing a seat belt in the first passenger window image, the two corner points are the upper left corner point and the lower right corner point, respectively, which meets the needs of Centernet detection model training. Therefore, when determining the second annotated image, for each second passenger window image, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second passenger window image, and the second annotated image corresponding to the second passenger window image can be obtained. Because the positions of the two corner points in the second annotated image corresponding to the second passenger window image are the upper left corner point and the lower right corner point, which meets the needs of Centernet detection model training, the accuracy of the passenger seat belt detection model obtained by training is better, and the position information of the two corner points of the passenger seat belt determined based on the passenger seat belt detection model is also more accurate.
[0102] Embodiment 4:
[0103] In order to make it more accurate to determine whether the person in the vehicle window is wearing a seat belt, based on the above embodiments, in an embodiment of the present invention, determining whether the person in the vehicle window is wearing a seat belt according to the position information of the line segment includes:
[0104] Determine the slope of the line segment according to the position information of the line segment, and judge whether the slope is within a preset slope range. If so, determine that the person in the vehicle window is wearing a seat belt; if not, determine that the person in the vehicle window is not wearing a seat belt; or determine the target area where the person in the vehicle window is located, and judge whether the number of pixel points where the line segment overlaps with the target area is greater than a preset number threshold; if so, determine that the person in the vehicle window is wearing a seat belt; if not, determine that the person in the vehicle window is not wearing a seat belt.
[0105] In an embodiment of the present invention, after determining the position information of the line segment connected by the two corner points according to the position information of the two corner points, the slope of the line segment is determined according to the position information of the line segment, wherein the slope of the line segment is the slope of the line segment determined in the image coordinate system. The electronic device stores a preset slope range, and determines whether the slope of the line segment is within the preset slope range. If yes, it is determined that the person in the window is wearing a seat belt, and if not, it is determined that the person in the window is not wearing a seat belt.
[0106] Alternatively, the following scheme may be used to detect whether the person in the car window is wearing a seat belt. The electronic device determines the target area where the person in the car window is located, wherein the target area where the person in the car window is located may be determined by a template matching algorithm. Then the number of pixels where the line segment overlaps with the target area is determined. The electronic device stores a preset number threshold, and determines whether the number of pixels where the line segment overlaps with the target area is greater than the preset number threshold. If so, it is determined that the person in the car window is wearing a seat belt, and if not, it is determined that the person in the car window is not wearing a seat belt.
[0107] In the embodiment of the present invention, whether the person in the car window is wearing a seat belt is detected according to the slope of the line segment or the number of pixels where the line segment overlaps with the target area. This is more accurate than the method of detecting whether the person in the car window is wearing a seat belt according to the length of the line segment.
[0108] Embodiment 5:
[0109] In order to make it more convenient and accurate to determine the target area where the person in the vehicle window is located, on the basis of the above embodiments, in an embodiment of the present invention, the determining the target area where the person in the vehicle window is located includes:
[0110] The vehicle window image to be detected is input into a pre-trained target segmentation model, and based on the target segmentation model, a target area where the person in the vehicle window is located is determined.
[0111] A pre-trained target segmentation model is stored in the electronic device. The target segmentation model performs relevant processing on the input window image and outputs the target area where the person in the window is located.
[0112] The training process of the target segmentation model includes:
[0113] For each car window image in the third sample set, the car window image and the annotated image corresponding to the car window image are input into the target segmentation model to train the target segmentation model; wherein the annotated image is annotated with location information of a target area where a person in the car window image is located.
[0114] Since in the embodiment of the present invention, the electronic device determines the target area where the person in the car window is located based on the target segmentation model, no complex template matching algorithm is required, so the process of determining the target area where the person in the car window is located is simple, and the target area where the person in the car window is located is determined based on the trained target segmentation model, so that the accuracy of the determined target area is high.
[0115] Embodiment 6:
[0116] In order to accurately determine the position information of the seat belt, based on the above embodiments, in an embodiment of the present invention, if it is determined that the person in the vehicle window is wearing a seat belt, the method further includes:
[0117] If the vehicle window image to be detected is a first main driver's vehicle window image, the position information of two target corner points is determined according to the position information of the two corner points, the position information of the central pixel point of the vehicle window image to be detected, and the length and width information of the vehicle window image to be detected, and the position information of the line segment formed by the two target corner points is determined as the position information of the seat belt;
[0118] If the vehicle window image to be detected is the first passenger vehicle window image, the position information of the line segment formed by the two corner points is determined as the position information of the seat belt.
[0119] In the embodiment of the present invention, if the vehicle window image to be detected is the first main driver's window image, since the two corner points in the first main driver's window image are not the two corner points on the seat belt, the position information of the two corner points needs to be adjusted to obtain the two target corner points on the seat belt. The position information of the two target corner points is determined based on the position information of the two corner points, the position information of the central pixel point of the vehicle window image to be detected, and the length and width information of the vehicle window image to be detected.
[0120] Specifically, let point A(xa, ya) be a corner point in the first main driving window image, and C(xc, yc) be another corner point in the first main driving window image. P(xp, yp) is the central pixel point of the window image to be detected, points L(xl, yl) and N(xn, yn) are two target corner points to be solved, and the length of the window image to be detected is w and the width is h, then:
[0121] xp=1 / (2h), yp=1 / (2w);
[0122] x1=2*xp-xa,y1=ya;
[0123] xn=2*xp-xc,yn=yc.
[0124] According to the above formula, the position information of the two target corner points can be determined, and the position information of the line segment formed by the two target corner points can be determined as the position information of the seat belt.
[0125] If the vehicle window image to be detected is the first passenger window image, because the two corner points in the first passenger window image are determined to be the two corner points on the seat belt, the position information of the line segment formed by the two corner points is directly determined as the position information of the seat belt.
[0126] The following is a detailed description of the seat belt detection method provided by an embodiment of the present invention, wherein the description is mainly based on detecting whether the occupant in the main driving cabin is wearing a seat belt.
[0127] Since the positions of the main driver and the co-driver in the cab are basically symmetrical in the monitoring scenario, in this seat belt detection scheme, the seat belt detection scheme is described in detail based on the right half of the cab window (main driver's position). Figure 2 A schematic diagram of a seat belt detection process provided by an embodiment of the present invention, such as Figure 2 As shown, the main implementation process of the embodiment of the present invention is: 1. Based on the vehicle detection model, the vehicle sub-image is determined by locating the vehicle of the full-frame image containing the target vehicle. 2. Based on the window detection model, the vehicle sub-image is located by locating the window, and the window sub-image is determined. 3. The main driver's window image is determined based on the window sub-image. 4. Based on the seat belt detection model, the position information of the two corner points of the seat belt is determined for the main driver's window image. 5. Based on the position information of the two corner points, the position information of the line segment connecting the two corner points is determined, and based on the position information of the line segment, it is determined whether the person in the window is wearing a seat belt.
[0128] When performing vehicle detection and window detection, since the cab information of the vehicle in the monitoring scene is interrelated with the vehicle itself, it is necessary to detect the cab window on the basis of vehicle detection on the whole frame image. At the same time, in the embodiment of the present invention, the scene of vehicle detection is relatively single, and the size of the vehicle accounts for a relatively fixed proportion in the whole image, so it is preferred to use the YOLO vehicle detection model. The main process is: marking the vehicle position on the existing monitoring scene full-frame image data set, and calculating the corresponding prediction frame related information. By training on the full-frame image data set with the vehicle position already marked, the vehicle detection model can correctly segment the position of the moving vehicle on the whole frame image and complete the vehicle detection function.
[0129] The window detection method is similar to the vehicle detection method. It should be noted that the window detection model can mark and train the window positions on the vehicle sub-image based on the vehicle sub-image segmented by the vehicle detection model, so that the window detection model can correctly segment the window image on the vehicle sub-image. Figure 3 A schematic diagram of a whole frame image provided by an embodiment of the present invention, Figure 4 is a schematic diagram of a vehicle sub-image determined based on a vehicle detection model. Figure 5 Schematic diagram of a vehicle window sub-image determined based on a vehicle window detection model.
[0130] When detecting seat belts, since the seat belts have very obvious geometric features, they can be approximately considered as a straight line segment. At the same time, the two ends of the seat belts have the most obvious corner features, and the center point area also has obvious seat belt features. Therefore, the target detection method of the Centernet detection model based on the Anchor Free concept is adopted in the seat belt detection scheme. The Centernet detection model adds the center point features based on the upper left and lower right key points required by the Cornernet detection model. In the car window image, the endpoints of the driver's seat belt are located in the upper right corner and the lower left corner, such as Figure 6 As shown, points A, B, and C are the key points required for the Centernet detection model (two corner points and one center point), points L, M, and N are the key points on the seat belt (two corner points and one center point), and only the center point B coincides with point M, as shown in Figure 6 shown.
[0131] In order to maximize the overlap of the key points of the seat belt with the key points required by the Centernet detection model, so as to improve the accuracy of the Centernet detection model and ensure the accuracy of the seat belt detection, before performing seat belt detection on the main driving position, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are marked in the main driving window image, and the main driving window image is mirrored and flipped along the vertical center line to obtain the marked image corresponding to the main driving window image, or the main driving window image is mirrored and flipped along the vertical center line, and the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are marked in the flipped main driving window image to obtain the marked image corresponding to the main driving window image. Figure 7 The vehicle window image before flipping provided by the embodiment of the present invention, Figure 8 This is a flipped vehicle window image provided by an embodiment of the present invention.
[0132] The main process of detecting seat belts based on the Centernet detection model is as follows: First, the Centernet detection model calculates the upper left corner point A(L) and the lower right corner point C(M) of the flipped seat belt through cascade corner pooling. Then, the center point B(M) is calculated through center pooling. Fig. 9 To calculate the upper left corner point A(L) and lower right corner point C(M) of the safety belt after flipping, Fig.10 The schematic diagram of calculating the center point B(M) of the safety belt after the rollover is shown in FIG. The process of calculating the upper left corner point A(L) and the lower right corner point C(M) of the safety belt after the rollover by cascade corner pooling and the process of calculating the center point B(M) by center pooling belongs to the prior art and will not be described in detail here.
[0133] Among them, "YOLO" is understood as "a detection method". "Anchor free" is understood as "no anchor point". "Centernet detection model" is understood as "a key point detection method based on center points and corner points". "Cascadecorner pooling" is understood as "cascade corner pooling". "Center pooling" is understood as "center point pooling". "Embeddings" is understood as "a data mapping method".
[0134] Then, the three key points are mapped to the corresponding positions of the input image as accurately as possible through offset calculation. Finally, after the three points are determined to belong to the same target through embedding calculation, the specific position of the seat belt target after flipping is obtained, which also includes the actual position of the key points A(L) and C(M). Since the width w and height h of the image are known parameters, the relevant calculations can be performed on the seat belt position points L, M, and N before the image is flipped. Fig.11 The schematic diagram of calculating the target corner point provided by the embodiment of the present invention, the calculation process is as follows:
[0135] Assume point A(xa, ya) is a corner point in the main driver's window image, and C(xc, yc) is another corner point in the main driver's window image. P(xp, yp) is the central pixel point of the window image to be detected, point L(xl, yl) and N(xn, yn) are two target corner points to be solved, the length of the window image to be detected is w, and the width is h, then:
[0136] xp=1 / (2h), yp=1 / (2w);
[0137] x1=2*xp-xa,y1=ya;
[0138] xn=2*xp-xc,yn=yc.
[0139] According to the above formula, the position information of the two target corner points can be determined, and the position information of the line segment formed by the two target corner points can be determined as the position information of the seat belt.
[0140] There are two ways to determine whether a person in a vehicle window is wearing a seat belt based on the position information of a line segment.
[0141] The first method: determine whether the person in the car window is wearing a seat belt based on the slope of the seat belt. Although the seat belt detection based on key points can already output the detection results, in order to reduce false detections, the detected seat belt related information needs to be further filtered. First, the seat belt slope information of the existing main driver's seat belt annotation data is counted to obtain a preset slope range. Determine the slope of the line segment based on the position information of the line segment, and judge whether the slope is within the preset slope range. If yes, determine that the person in the car window is wearing a seat belt. If not, determine that the person in the car window is not wearing a seat belt.
[0142] The second method is to determine whether the person in the car window is wearing a seat belt based on the number of overlapping pixels between the seat belt and the driver's area. Determine the pixel distribution position on the line connecting the key points of the seat belt: Use the target segmentation model to segment the target area where the driver is located, such as Fig.12 Then determine whether the number of pixel points where the line segment overlaps with the target area is greater than a preset number threshold, if yes, determine that the person in the window is wearing a seat belt, if no, determine that the person in the window is not wearing a seat belt.
[0143] Embodiment 7:
[0144] Fig.13 A schematic diagram of the structure of a seat belt detection device provided by an embodiment of the present invention, the device comprises:
[0145] An acquisition module 131 is used to acquire a vehicle window image to be detected;
[0146] A first determination module 132 is used to input the vehicle window image into a pre-trained seat belt detection model, and determine the position information of two corner points of the seat belt based on the seat belt detection model;
[0147] The second determination module 133 is used to determine the position information of the line segment connecting the two corner points according to the position information of the two corner points, and determine whether the person in the vehicle window wears a seat belt according to the position information of the line segment.
[0148] The acquisition module 131 is specifically used to acquire an image captured by an image acquisition device, input the image into a pre-trained vehicle detection model, and determine a vehicle sub-image; input the vehicle sub-image into a pre-trained window detection model to determine a window sub-image; determine a first main driver's window image and a first co-driver's window image according to the window sub-image, and respectively determine the first main driver's window image and the first co-driver's window image as window images to be detected.
[0149] The acquisition module 131 is specifically used to input the first main driver's window image into a pre-trained main driver's seat belt detection model, and determine the two corner point position information of the main driver's seat belt based on the main driver's seat belt detection model; input the first co-driver's window image into a pre-trained co-driver's seat belt detection model, and determine the two corner point position information of the co-driver's seat belt based on the co-driver's seat belt detection model.
[0150] The device also includes:
[0151] The first training module 134 is used to input the second main driving window image and the first annotated image corresponding to the second main driving window image into the main driving seat belt detection model for each second main driving window image in the first training set, and train the main driving seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second main driving window image, and the second main driving window image is mirror-flipped along the vertical center line to obtain the first annotated image corresponding to the second main driving window image, or the second main driving window image is mirror-flipped along the vertical center line, and the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the flipped second main driving window image to obtain the first annotated image corresponding to the second main driving window image.
[0152] The device also includes:
[0153] The second training module 135 is used to input the second passenger window image and the second annotated image corresponding to the second passenger window image into the passenger seat belt detection model for each second passenger window image in the second training set, and train the passenger seat belt detection model; wherein the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second passenger window image to obtain the second annotated image corresponding to the second passenger window image.
[0154] The second determination module 133 is specifically used to determine the slope of the line segment according to the position information of the line segment, and determine whether the slope is within a preset slope range. If so, it is determined that the person in the vehicle window is wearing a seat belt; if not, it is determined that the person in the vehicle window is not wearing a seat belt; or determine the target area where the person in the vehicle window is located, and determine whether the number of pixel points where the line segment overlaps with the target area is greater than a preset number threshold; if so, it is determined that the person in the vehicle window is wearing a seat belt; if not, it is determined that the person in the vehicle window is not wearing a seat belt.
[0155] The second determination module 133 is specifically configured to input the vehicle window image to be detected into a pre-trained target segmentation model, and determine the target area where the person in the vehicle window is located based on the target segmentation model.
[0156] The device also includes:
[0157] The third determination module 136 is used to determine the position information of the two target corner points according to the position information of the two corner points, the position information of the central pixel point of the window image to be detected and the length and width information of the window image to be detected if the window image to be detected is the first main driver's window image, and determine the position information of the line segment formed by the two target corner points as the position information of the seat belt; if the window image to be detected is the first co-driver's window image, determine the position information of the line segment formed by the two corner points as the position information of the seat belt.
[0158] Embodiment 8:
[0159] Based on the above embodiments, an electronic device is also provided in an embodiment of the present invention, such as Fig.14 As shown, it includes: a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304;
[0160] The memory 303 stores a computer program. When the program is executed by the processor 301, the processor 301 performs the following steps:
[0161] Acquire a vehicle window image to be detected; input the vehicle window image into a pre-trained seat belt detection model, and determine the position information of two corner points of the seat belt based on the seat belt detection model; determine the position information of the line segment connecting the two corner points according to the position information of the two corner points, and determine whether the person in the vehicle window is wearing a seat belt according to the position information of the straight line.
[0162] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present invention. Since the principle of solving the problem by the above electronic device is similar to that of the seat belt detection method, the implementation of the above electronic device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0163] The electronic device provided in the embodiment of the present invention may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), a network side device, etc.
[0164] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0165] The communication interface 302 is used for communication between the electronic device and other devices.
[0166] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0167] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0168] In the embodiment of the present invention, when the processor executes the program stored in the memory, it realizes obtaining the vehicle window image to be detected; inputting the vehicle window image into a pre-trained seat belt detection model, and determining the position information of two corner points of the seat belt based on the seat belt detection model; according to the position information of the two corner points, determining the position information of the line segment connecting the two corner points, and determining whether the person in the vehicle window is wearing a seat belt according to the position information of the straight line.
[0169] In an embodiment of the present invention, a pre-trained seat belt detection model is stored in the electronic device, and the seat belt detection model is used to perform corner point detection on the input image, that is, after the electronic device obtains the window image to be detected, it determines the position information of the two corner points of the seat belt in the window image to be detected based on the seat belt detection model, and then determines whether the person in the window is wearing a seat belt based on the position information of the two corner points. The seat belt detection based on the seat belt detection model has low requirements on the clarity of the image and environmental interference. Therefore, even in the case of low clarity or environmental interference, the accuracy of the seat belt detection can be guaranteed. In addition, the embodiment of the present invention does not require complex image processing algorithms, thereby improving the efficiency of seat belt detection.
[0170] Embodiment 9:
[0171] On the basis of the above embodiments, an embodiment of the present invention further provides a computer storage readable storage medium, wherein the computer readable storage medium stores a computer program executable by an electronic device, and when the program is run on the electronic device, the electronic device implements the following steps when executing:
[0172] Acquire a vehicle window image to be detected; input the vehicle window image into a pre-trained seat belt detection model, and determine the position information of two corner points of the seat belt based on the seat belt detection model; determine the position information of the line segment connecting the two corner points according to the position information of the two corner points, and determine whether the person in the vehicle window is wearing a seat belt according to the position information of the straight line.
[0173] Based on the same inventive concept, a computer-readable storage medium is also provided in an embodiment of the present invention. Since the principle of solving the problem when the processor executes the computer program stored on the above-mentioned computer-readable storage medium is similar to that of the seat belt detection method, the implementation of the processor when executing the computer program stored on the above-mentioned computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0174] The above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in the electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical storage such as CD, DVD, BD, HVD, etc., and semiconductor storage such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD), etc.
[0175] A computer program is stored in a computer-readable storage medium provided in an embodiment of the present invention. When the computer program is executed by a processor, it is implemented to obtain a vehicle window image to be detected; input the vehicle window image into a pre-trained seat belt detection model, and determine the position information of two corner points of the seat belt based on the seat belt detection model; determine the position information of the line segment connecting the two corner points based on the position information of the two corner points, and determine whether the person in the vehicle window is wearing a seat belt based on the position information of the straight line.
[0176] In an embodiment of the present invention, a pre-trained seat belt detection model is stored in the electronic device, and the seat belt detection model is used to perform corner point detection on the input image, that is, after the electronic device obtains the window image to be detected, it determines the position information of the two corner points of the seat belt in the window image to be detected based on the seat belt detection model, and then determines whether the person in the window is wearing a seat belt based on the position information of the two corner points. The seat belt detection based on the seat belt detection model has low requirements on the clarity of the image and environmental interference. Therefore, even in the case of low clarity or environmental interference, the accuracy of the seat belt detection can be guaranteed. In addition, the embodiment of the present invention does not require complex image processing algorithms, thereby improving the efficiency of seat belt detection.
[0177] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0178] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0179] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0180] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0181] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A seat belt detection method, characterized in that: The method comprises: Acquire a vehicle window image to be detected; the vehicle window image includes a first main driver's window image or a first co-driver's window image; Inputting the vehicle window image into a pre-trained seat belt detection model, and determining position information of two corner points corresponding to the seat belt based on the seat belt detection model; Determine the position information of the line segment connecting the two corner points according to the position information of the two corner points, and determine whether the person in the vehicle window is wearing a seat belt according to the position information of the line segment; If it is determined that the person inside the vehicle window is wearing a seat belt, the method further includes: If the vehicle window image to be detected is a first main driver's vehicle window image, the position information of two target corner points is determined according to the position information of the two corner points, the position information of the central pixel point of the vehicle window image to be detected, and the length and width information of the vehicle window image to be detected, and the position information of the line segment formed by the two target corner points is determined as the position information of the seat belt; If the vehicle window image to be detected is the first passenger vehicle window image, the position information of the line segment formed by the two corner points is determined as the position information of the seat belt.
2. The method according to claim 1, characterized in that The step of acquiring the vehicle window image to be detected comprises: Acquire an image acquired by an image acquisition device, input the image into a pre-trained vehicle detection model, and determine a vehicle sub-image; Inputting the vehicle sub-image into a pre-trained vehicle window detection model to determine the vehicle window sub-image; A first main driver's window image and a first assistant driver's window image are determined according to the window sub-image, and the first main driver's window image and the first assistant driver's window image are respectively determined as the window images to be detected.
3. The method according to claim 2, characterized in that Inputting the vehicle window image into a pre-trained seat belt detection model, and determining the position information of two corner points of the seat belt based on the seat belt detection model comprises: Inputting the first main driver's window image into a pre-trained main driver's seat belt detection model, and determining two corner point position information of the main driver's seat belt based on the main driver's seat belt detection model; The first passenger window image is input into a pre-trained passenger seat belt detection model, and the position information of two corner points of the passenger seat belt is determined based on the passenger seat belt detection model.
4. The method according to claim 3, characterized in that The training process of the main driver's seat belt detection model includes: For each second main driver window image in the first training set, the second main driver window image and the first annotated image corresponding to the second main driver window image are input into the main driver seat belt detection model to train the main driver seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second main driver window image, and the second main driver window image is mirror-flipped along the vertical center line to obtain the first annotated image corresponding to the second main driver window image, or the second main driver window image is mirror-flipped along the vertical center line, and the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the flipped second main driver window image to obtain the first annotated image corresponding to the second main driver window image.
5. The method according to claim 3, characterized in that The training process of the co-pilot seat belt detection model includes: For each second passenger window image in the second training set, the second passenger window image and the second annotated image corresponding to the second passenger window image are input into the passenger seat belt detection model to train the passenger seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second passenger window image to obtain the second annotated image corresponding to the second passenger window image.
6. The method according to claim 1, characterized in that Determining whether a person in the vehicle window wears a seat belt according to the position information of the line segment comprises: Determine the slope of the line segment according to the position information of the line segment, and judge whether the slope is within a preset slope range. If so, determine that the person in the vehicle window is wearing a seat belt; if not, determine that the person in the vehicle window is not wearing a seat belt; or determine the target area where the person in the vehicle window is located, and judge whether the number of pixel points where the line segment overlaps with the target area is greater than a preset number threshold; if so, determine that the person in the vehicle window is wearing a seat belt; if not, determine that the person in the vehicle window is not wearing a seat belt.
7. The method according to claim 6, characterized in that Determining the target area where the person in the vehicle window is located includes: The vehicle window image to be detected is input into a pre-trained target segmentation model, and based on the target segmentation model, a target area where the person in the vehicle window is located is determined.
8. A seat belt detection device, characterized in that: The device comprises: An acquisition module, used for acquiring a vehicle window image to be detected; the vehicle window image includes a first main driver's window image or a first co-driver's window image; A first determination module is used to input the vehicle window image into a pre-trained seat belt detection model, and determine the position information of two corner points corresponding to the seat belt based on the seat belt detection model; A second determination module is used to determine the position information of the line segment connecting the two corner points according to the position information of the two corner points, and determine whether the person in the vehicle window is wearing a seat belt according to the position information of the line segment; The device also includes: The third determination module is used to determine the position information of two target corner points according to the position information of the two corner points, the position information of the central pixel point of the window image to be detected and the length and width information of the window image to be detected if the window image to be detected is the first main driver's window image, and determine the position information of the line segment formed by the two target corner points as the position information of the seat belt; if the window image to be detected is the first co-driver's window image, determine the position information of the line segment formed by the two corner points as the position information of the seat belt.
9. The device according to claim 8, characterized in that The acquisition module is specifically used to acquire an image acquired by an image acquisition device, input the image into a pre-trained vehicle detection model, and determine a vehicle sub-image; input the vehicle sub-image into a pre-trained vehicle window detection model, and determine a vehicle window sub-image; A first main driver's window image and a first assistant driver's window image are determined according to the window sub-image, and the first main driver's window image and the first assistant driver's window image are respectively determined as the window images to be detected.
10. The device according to claim 9, characterized in that The acquisition module is specifically used to input the first main driver's window image into a pre-trained main driver's seat belt detection model, and determine the position information of two corner points of the main driver's seat belt based on the main driver's seat belt detection model; The first passenger window image is input into a pre-trained passenger seat belt detection model, and the position information of two corner points of the passenger seat belt is determined based on the passenger seat belt detection model.
11. The device according to claim 10, characterized in that The device also includes: The first training module is used to input the second main driving window image and the first annotated image corresponding to the second main driving window image into the main driving seat belt detection model for each second main driving window image in the first training set, and train the main driving seat belt detection model; wherein, the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second main driving window image, and the second main driving window image is mirror-flipped along the vertical center line to obtain the first annotated image corresponding to the second main driving window image, or the second main driving window image is mirror-flipped along the vertical center line, and the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the flipped second main driving window image to obtain the first annotated image corresponding to the second main driving window image.
12. The device according to claim 10, characterized in that The device also includes: The second training module is used to input the second passenger window image and the second annotated image corresponding to the second passenger window image into the passenger seat belt detection model for each second passenger window image in the second training set, and train the passenger seat belt detection model; wherein the position information of the two corner points of the seat belt and the position information of the center point of the seat belt are annotated in the second passenger window image to obtain the second annotated image corresponding to the second passenger window image.
13. The device according to claim 8, characterized in that The second determination module is specifically used to determine the slope of the line segment according to the position information of the line segment, and determine whether the slope is within a preset slope range. If so, it is determined that the person in the vehicle window is wearing a seat belt; if not, it is determined that the person in the vehicle window is not wearing a seat belt; or determine the target area where the person in the vehicle window is located, and determine whether the number of pixel points where the line segment overlaps with the target area is greater than a preset number threshold; if so, it is determined that the person in the vehicle window is wearing a seat belt; if not, it is determined that the person in the vehicle window is not wearing a seat belt.
14. The device according to claim 13, characterized in that The second determination module is specifically used to input the vehicle window image to be detected into a pre-trained target segmentation model, and determine the target area where the person in the vehicle window is located based on the target segmentation model.
15. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.
