A method and device for identifying dangerous traffic behaviors on highways based on machine learning
By applying machine learning-based traffic behavior recognition methods on highways, and using video surveillance and image processing technology to automatically identify and analyze vehicle traffic behavior, the problems of low efficiency and high false alarm rate of traditional methods are solved, and more efficient and accurate traffic safety monitoring is achieved.
Patent Information
- Application Number
- CN202411187323.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-08-28
AI Technical Summary
Traditional methods are inefficient in identifying dangerous traffic behaviors on highways and are susceptible to human factors, and data processing and analysis cannot fully utilize advanced image processing technologies and machine learning models, resulting in false positives or missed reports.
Using machine learning-based highway hazardous traffic behavior recognition method, videos of highway sections are collected through video surveillance cameras, color enhancement and target detection are performed, the angle between the vehicle and the center line is calculated, the vehicle's pre-driving direction is judged, and the vehicle's traffic behavior is analyzed through the brightness changes of taillights.
It realizes automated monitoring of traffic behavior on highways, improves detection efficiency and accuracy, reduces false alarms, and can promptly identify and predict potential dangerous behaviors, thereby improving traffic safety.
Smart Images

Figure CN119131752B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic behavior recognition, and in particular to a method and device for identifying dangerous traffic behaviors on highways based on machine learning. Background Art
[0002] Machine learning is a subfield of artificial intelligence that focuses on enabling computer systems to learn and improve their performance autonomously through data and algorithms without explicit programming instructions. In short, machine learning enables computers to extract patterns and knowledge from data and then make predictions or decisions based on these patterns.
[0003] Vehicles on the highway travel at a higher speed. Not using a turn signal will cause other drivers to be unable to predict your lane change or exit action, increasing the risk of a collision. Other drivers may not have enough time or space to respond appropriately, such as avoiding or slowing down, thus triggering a chain reaction accident.
[0004] Traditional methods often rely on manual observation and judgment, such as on-site monitoring by traffic police or manual analysis of camera recordings. This method is inefficient and easily affected by human factors, such as fatigue and subjective judgment errors. Traditional methods usually require a lot of equipment and maintenance, involving high capital investment and operating costs, including installation, maintenance and personnel costs. Traditional methods’ data processing and analysis are usually basic and cannot fully utilize advanced image processing technology and machine learning models, which may miss key behavioral patterns and abnormal situations. Traditional systems often rely on simple threshold settings and may not be able to effectively distinguish between normal driving and dangerous driving behaviors, and are prone to false alarms or missed alarms. Summary of the invention
[0005] The purpose of the present invention is to address the problems existing in the background technology and to propose a method and device for identifying dangerous traffic behaviors on highways based on machine learning.
[0006] The technical solution of the present invention is a method for identifying dangerous traffic behaviors on highways based on machine learning, comprising:
[0007] The target highway section is video-captured by a video surveillance camera to obtain a highway section surveillance video, and the highway section surveillance video is video-intercepted by a preset image sampling period to obtain a highway section image sequence;
[0008] Performing color enhancement on the highway section image sequence to obtain a standard highway section image sequence, and detecting a center line and a vehicle in the standard highway section image sequence based on a trained target detection model to obtain a standard highway section image sequence with a center line detection frame and a vehicle detection frame;
[0009] Calculating the angle between the centerline detection frame and the vehicle detection frame to obtain an angle sequence, comparing the angle sequence with a preset angle threshold one by one, and recording the number of angles that are continuously greater than the preset angle threshold;
[0010] Acquire the number of the corresponding standard highway section images based on the number of angles, and acquire the vehicle angle deviation time based on the number of the standard highway section images and the preset image sampling period;
[0011] The vehicle angle deviation time is compared with a preset time threshold. If it is greater than the preset time threshold, the corresponding standard highway section image sequence is obtained, and the left and right tail lights of the vehicle in the standard highway section image sequence are segmented based on the trained image segmentation model to obtain the left and right tail lights image sequence of the vehicle;
[0012] The image brightness of the left and right taillight images of the vehicle is extracted to obtain the average brightness sequences of the left and right taillight images respectively, the difference between the average brightness of the left and right taillight images is calculated, the pre-travel direction of the vehicle is determined based on the difference between the average brightness of the left and right taillight images, and the pre-travel direction of the vehicle is matched with the angle to obtain the traffic behavior of the vehicle.
[0013] Preferably, color enhancement is performed on the expressway section image sequence to obtain a standard expressway section image sequence, including:
[0014] The center distance of the highway section image is calculated. The center distance calculation formula of the highway section image is as follows:
[0015]
[0016] Among them, u it represents the i+t-order center distance of the highway image, M and N represent the length and width of the highway image, f(x,y) represents the highway image function, (x0,y0) represents the center of gravity of the highway image, and M 10 represents the 1+0 order origin moment of the highway section image, M 00 represents the 0+0 order origin moment of the highway section image, and And M ab represents the a+b-order origin moment of the highway section image, and
[0017] The center distance of the highway section image is standardized to obtain a standardized center distance of the highway section image. The standardized center distance calculation formula of the highway section image is as follows:
[0018]
[0019] Among them, I it Represents the i+t-order normalized center distance of the highway section image;
[0020] A first invariant moment set is obtained based on the standardized center distance of the highway section image. The first invariant moment set is expressed as follows:
[0021]
[0022] Among them, (C1, C2, C3, C4) represents the first invariant moment set.
[0023] Preferably, color enhancement is performed on the expressway section image sequence to obtain a standard expressway section image sequence, further comprising:
[0024] A second invariant moment set is obtained based on the center distance of the highway section image, and the first invariant moment set and the second invariant moment set are combined to obtain a combined invariant moment. The expression of the second invariant moment set is as follows:
[0025]
[0026] Among them, (I1, I2, I3) represents the second invariant moment set;
[0027] The combined invariant moment expression is as follows:
[0028] C=(C1,C2,C3,C4,I1,I2,I3);
[0029] Where C represents the combined invariant moment;
[0030] The highway section image is color enhanced based on the combined invariant moment to obtain a standard highway section image sequence. The color enhancement formula is as follows:
[0031]
[0032] Among them, g(x, y) represents the standard highway section image, c and d represent the upper and lower limits of the grayscale range of the standard highway section image, respectively, and e and f represent the upper and lower limits of the grayscale range of the highway section image, respectively.
[0033] Preferably, the target detection model adopts FasterR-CNN.
[0034] Preferably, calculating the angle between the centerline detection frame and the vehicle detection frame to obtain an angle sequence includes:
[0035] Obtaining the center point of the center line detection frame and the center point of the vehicle detection frame, and obtaining the pixel coordinates of the center point of the center line detection frame and the center point of the vehicle detection frame;
[0036] Based on the pixel coordinates of the center point of the center line detection frame and the center point of the vehicle detection frame, the angle between the center point of the center line detection frame and the center point of the vehicle detection frame is obtained through inverse trigonometric functions. The angle between the center point of the center line detection frame and the center point of the vehicle detection frame is the angle between the center line detection frame and the vehicle detection frame.
[0037] Preferably, the image segmentation model adopts U-Net.
[0038] Preferably, performing image brightness extraction on the left and right taillight images of the vehicle to obtain average brightness sequences of the left and right taillight images respectively includes:
[0039] The color values in the left and right taillight images of the vehicle are normalized, and the normalization formula is as follows:
[0040]
[0041] Among them, R′, G′ and B′ represent the normalized color values of the left and right taillight images of the vehicle, and R, G and B represent the color values of the left and right taillight images of the vehicle, respectively;
[0042] The vehicle left and right taillight images are converted from RGB images to HSV images based on the normalized color values in the vehicle left and right taillight images. The H channel conversion formula of the HSV image is as follows:
[0043]
[0044] The S channel conversion formula of the HSV image is as follows:
[0045]
[0046] The V channel conversion formula of the HSV image is as follows:
[0047] V = max(R′, G′, B′);
[0048] Among them, R′, G′ and B′ respectively represent the normalized color values of the left and right taillight images of the vehicle, and R, G and B respectively represent the color values of the left and right taillight images of the vehicle.
[0049] Preferably, performing image brightness extraction on the left and right taillight images of the vehicle to obtain average brightness sequences of the left and right taillight images respectively, further comprises:
[0050] The HSV segmentation threshold of the left and right taillight images of the vehicle is preset, the left and right taillight images of the vehicle are segmented based on the HSV segmentation threshold, and a morphological dilation operation is performed on the segmented left and right taillight images of the vehicle to obtain enhanced images of the left and right taillights of the vehicle. The HSV segmentation threshold is as follows:
[0051]
[0052] The HSV values of the enhanced images of the left and right taillights of the vehicle are respectively obtained, and the HSV values of the enhanced images of the left and right taillights of the vehicle are averaged to obtain an average brightness sequence of the enhanced images of the left and right taillights, that is, an average brightness sequence of the left and right taillight images.
[0053] Preferably, judging the vehicle's predicted driving direction based on the difference in average brightness of the left and right taillight images, and matching the vehicle's predicted driving direction with an angle to obtain the vehicle's traffic behavior includes:
[0054] If the difference between the average brightness of the left and right taillight images is a positive value, it indicates that the vehicle is expected to travel in the left direction; if the difference between the average brightness of the left and right taillight images is a negative value, it indicates that the vehicle is expected to travel in the right direction; if the difference between the average brightness of the left and right taillight images is zero, it indicates that the vehicle is expected to travel in the straight direction;
[0055] If the angle is a positive value, it means that the vehicle is traveling in the left direction; if the angle is a negative value, it means that the vehicle is traveling in the right direction; if the angle is zero, it means that the vehicle is traveling in the straight direction;
[0056] The vehicle's predicted driving direction is matched with the vehicle's driving direction. If the vehicle's predicted driving direction is consistent with the vehicle's driving direction, the vehicle's traffic behavior is normal; otherwise, the vehicle's traffic behavior is abnormal.
[0057] The technical solution of the present invention is a device for identifying dangerous traffic behaviors on highways based on machine learning, which is applicable to the method for identifying dangerous traffic behaviors on highways based on machine learning, comprising:
[0058] A video acquisition module, the video acquisition module is used to acquire video of a target expressway section through a video surveillance camera to obtain an expressway section surveillance video, and to intercept the expressway section surveillance video through a preset image sampling period to obtain an expressway section image sequence;
[0059] A target detection module, the target detection module is used to perform color enhancement on the highway section image sequence to obtain a standard highway section image sequence, and detect the center line and vehicles in the standard highway section image sequence based on the trained target detection model to obtain a standard highway section image sequence with a center line detection frame and a vehicle detection frame;
[0060] An angle calculation module, the angle calculation module is used to calculate the angle between the centerline detection frame and the vehicle detection frame to obtain an angle sequence, compare the angle sequence with a preset angle threshold one by one, and record the number of angles that are continuously greater than the preset angle threshold;
[0061] A time calculation module, the time calculation module is used to obtain the number of the corresponding standard highway section images based on the number of angles, and obtain the vehicle angle deviation time based on the number of the standard highway section images and the preset image sampling period;
[0062] An image segmentation module, the image segmentation module is used to compare the vehicle angle deviation time with a preset time threshold, if it is greater than the preset time threshold, then obtain the corresponding standard highway section image sequence, and perform image segmentation on the left and right tail lights of the vehicle in the standard highway section image sequence based on the trained image segmentation model to obtain the left and right tail lights image sequence of the vehicle;
[0063] A behavior judgment module is used to extract the image brightness of the left and right taillight images of the vehicle to obtain the average brightness sequences of the left and right taillight images respectively, calculate the difference between the average brightness of the left and right taillight images, judge the vehicle's pre-travel direction based on the difference between the average brightness of the left and right taillight images, and match the vehicle's pre-travel direction with the angle to obtain the vehicle's traffic behavior.
[0064] Compared with the prior art, the above technical solution of the present invention has the following beneficial technical effects:
[0065] 1. The present invention utilizes a video surveillance camera to collect real-time video and automatically processes image sequences, thereby realizing automated monitoring of traffic behavior on highways, thereby reducing reliance on manual intervention and improving detection efficiency and accuracy. Furthermore, through color enhancement and target detection models, the center line and vehicle in the image sequence are accurately detected, and then angle calculation and analysis are performed based on these detection results, which helps to accurately capture the vehicle's behavior patterns and driving anomalies. Furthermore, by setting angle thresholds and time thresholds to determine whether the vehicle has dangerous behavior, false alarms can be effectively reduced. Only when the vehicle's angle deviation time continues to exceed the preset time threshold will the vehicle's taillight brightness changes be further analyzed, thereby reducing misjudgments.
[0066] 2. The present invention can accurately predict the direction of vehicle travel by combining the brightness extraction and direction judgment of the taillight image, thereby facilitating a deeper understanding of the vehicle's driving behavior and predicting potential dangerous behaviors. By real-time monitoring and accurate identification of dangerous driving behaviors, alarms can be issued in a timely manner or intervention measures can be taken to help reduce the occurrence of traffic accidents and improve traffic safety on highways. Moreover, by calculating the vehicle's angular deviation and the difference in taillight brightness, it can accurately identify whether the vehicle has abnormal driving behavior. This method combines the vehicle's angular information and the change in taillight brightness, and can effectively distinguish between normal driving and dangerous driving behaviors. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 A schematic flow chart of an overall method in an embodiment of the present invention;
[0068] Figure 2 A schematic diagram of the overall system flow in an embodiment of the present invention.
[0069] Figure numerals: 1. Video acquisition module; 2. Target detection module; 3. Angle calculation module; 4. Time calculation module; 5. Image segmentation module; 6. Behavior judgment module. DETAILED DESCRIPTION
[0070] Embodiment 1, as Figure 1 As shown, the present invention proposes a method for identifying dangerous traffic behaviors on highways based on machine learning, comprising:
[0071] S1. Capturing a video of a target highway section through a video surveillance camera to obtain a highway section surveillance video, and intercepting the highway section surveillance video through a preset image sampling period to obtain a highway section image sequence;
[0072] S2, performing color enhancement on the highway section image sequence to obtain a standard highway section image sequence, and detecting the center line and vehicles in the standard highway section image sequence based on the trained target detection model to obtain a standard highway section image sequence with a center line detection frame and a vehicle detection frame;
[0073] S3, calculating the angle between the centerline detection frame and the vehicle detection frame to obtain an angle sequence, comparing the angle sequence with a preset angle threshold one by one, and recording the number of angles that are continuously greater than the preset angle threshold;
[0074] S4, acquiring the number of corresponding standard highway section images based on the number of angles, and acquiring the vehicle angle deviation time based on the number of standard highway section images and a preset image sampling period;
[0075] S5, comparing the vehicle angle deviation time with a preset time threshold, if it is greater than the preset time threshold, obtaining the corresponding standard highway section image sequence, and performing image segmentation on the left and right tail lights of the vehicle in the standard highway section image sequence based on the trained image segmentation model to obtain the left and right tail lights image sequence of the vehicle;
[0076] S6. Perform image brightness extraction on the left and right taillight images of the vehicle to obtain average brightness sequences of the left and right taillight images respectively, calculate the difference between the average brightness of the left and right taillight images, determine the vehicle's pre-travel direction based on the difference between the average brightness of the left and right taillight images, and match the vehicle's pre-travel direction with the angle to obtain the vehicle's traffic behavior.
[0077] In the present invention, the image sampling period represents the time interval for extracting images from a video; the target detection model is a machine learning model used to identify specific objects in an image, such as a vehicle or a center line; the detection frame represents a rectangular frame marking the location of the object detected in the image; the image segmentation model is a machine learning model used to separate specific parts in an image, such as the taillights of a vehicle.
[0078] Embodiment 2, a method for identifying dangerous traffic behaviors on highways based on machine learning proposed by the present invention, compared with embodiment 1, this embodiment further includes: color enhancement of the highway section image sequence to obtain a standard highway section image sequence, including:
[0079] A1. Calculate the center distance of the highway section image. The calculation formula for the center distance of the highway section image is as follows:
[0080]
[0081] Among them, u it represents the i+t-order center distance of the highway image, M and N represent the length and width of the highway image, f(x,y) represents the highway image function, (x0,y0) represents the center of gravity of the highway image, and M 10 represents the 1+0 order origin moment of the highway section image, M 00 represents the 0+0 order origin moment of the highway section image, and And M ab represents the a+b-order origin moment of the highway section image, and
[0082] A2. Standardize the center distance of the highway section image to obtain the standardized center distance of the highway section image. The calculation formula of the standardized center distance of the highway section image is as follows:
[0083]
[0084] Among them, Iit Represents the i+t-order normalized center distance of the highway section image;
[0085] A3. Obtain the first invariant moment set based on the standardized center distance of the highway section image. The first invariant moment set expression is as follows:
[0086]
[0087] Among them, (C1, C2, C3, C4) represents the first invariant moment set.
[0088] In this embodiment, color enhancement is an image processing technology used to improve the color contrast and details of an image so as to better analyze and identify features in the image; center distance is a measure of the distribution of objects in an image, and calculating the center distance of an image helps to understand the geometric features of the objects; the order center distance is the center distance of an image, which is used to describe the distribution of objects in an image relative to their center of gravity; the order origin moment is a statistic in an image, which is used to describe the distribution of objects in an image; invariant moments are invariant features obtained by normalizing the center distance of an image, and these moments are invariant to scaling, rotation, and translation of the image.
[0089] In an optional embodiment, color enhancement is performed on the highway section image sequence to obtain a standard highway section image sequence, further comprising:
[0090] A4. Obtain a second invariant moment set based on the center distance of the highway section image, and combine the first invariant moment set and the second invariant moment set to obtain a combined invariant moment. The expression of the second invariant moment set is as follows:
[0091]
[0092] Among them, (I1, I2, I3) represents the second invariant moment set;
[0093] The combined invariant moment expression is as follows:
[0094] C=(C1,C2,C3,C4,I1,I2,I3);
[0095] Where C represents the combined invariant moment;
[0096] A5. Based on the combined invariant moment, the color of the highway section image is enhanced to obtain a standard highway section image sequence. The color enhancement formula is as follows:
[0097]
[0098] Among them, g(x, y) represents the standard highway section image, c and d represent the upper and lower limits of the grayscale range of the standard highway section image, respectively, and e and f represent the upper and lower limits of the grayscale range of the highway section image, respectively.
[0099] In an optional embodiment, the target detection model adopts FasterR-CNN.
[0100] It should be noted that FasterR-CNN is an efficient and accurate target detection model, which is mainly used to detect and locate objects in images.
[0101] In an optional embodiment, calculating the angle between the centerline detection frame and the vehicle detection frame to obtain an angle sequence includes:
[0102] B1. Obtain the center point of the center line detection frame and the center point of the vehicle detection frame, and obtain the pixel coordinates of the center point of the center line detection frame and the center point of the vehicle detection frame;
[0103] B2. Based on the pixel coordinates of the center point of the center line detection frame and the center point of the vehicle detection frame, the angle between the center point of the center line detection frame and the center point of the vehicle detection frame is obtained through inverse trigonometric functions. The angle between the center point of the center line detection frame and the center point of the vehicle detection frame is the angle between the center line detection frame and the vehicle detection frame.
[0104] It should be noted that the center point of the detection box is the coordinate of the middle point of the detection box, which is usually obtained by calculating the average value of the coordinates of the upper left corner and the lower right corner of the detection box; the position of each point in the image is determined by its coordinate values on the x-axis and y-axis; inverse trigonometric functions are used to calculate angles from known side lengths of a triangle.
[0105] In an optional embodiment, the image segmentation model adopts U-Net.
[0106] It should be noted that U-Net is a deep learning model for image segmentation. The structural design of U-Net is particularly suitable for tasks such as image segmentation. Its core features include symmetrical encoder-decoder structure and skip connections.
[0107] In an optional embodiment, image brightness extraction is performed on the left and right taillight images of the vehicle to obtain average brightness sequences of the left and right taillight images, respectively, including:
[0108] C1. Normalize the color values in the left and right taillight images of the vehicle. The normalization formula is as follows:
[0109]
[0110] Among them, R′, G′ and B′ represent the normalized color values of the left and right taillight images of the vehicle, and R, G and B represent the color values of the left and right taillight images of the vehicle, respectively;
[0111] C2. Based on the color values in the normalized left and right taillight images of the vehicle, the left and right taillight images of the vehicle are converted from RGB images to HSV images. The H channel conversion formula of the HSV image is as follows:
[0112]
[0113] The S channel conversion formula of the HSV image is as follows:
[0114]
[0115] The V channel conversion formula of the HSV image is as follows:
[0116] V = max(R′, G′, B′);
[0117] Among them, R′, G′ and B′ respectively represent the normalized color values of the left and right taillight images of the vehicle, and R, G and B respectively represent the color values of the left and right taillight images of the vehicle.
[0118] In an optional embodiment, performing image brightness extraction on the left and right taillight images of the vehicle to obtain average brightness sequences of the left and right taillight images respectively, further includes:
[0119] C3. Preset the HSV segmentation threshold of the left and right taillight images of the vehicle, segment the left and right taillight images of the vehicle based on the HSV segmentation threshold, and perform morphological dilation operation on the segmented left and right taillight images of the vehicle to obtain enhanced images of the left and right taillights of the vehicle. The HSV segmentation threshold is as follows:
[0120]
[0121] C4. Obtain the HSV values of the enhanced images of the left and right taillights of the vehicle respectively, and average the HSV values of the enhanced images of the left and right taillights of the vehicle to obtain an average brightness sequence of the enhanced images of the left and right taillights, that is, an average brightness sequence of the left and right taillight images.
[0122] In an optional embodiment, the vehicle's predicted driving direction is determined based on the difference in average brightness of the left and right taillight images, and the vehicle's predicted driving direction is matched with the angle to obtain the vehicle's traffic behavior, including:
[0123] D1. If the difference between the average brightness of the left and right taillight images is a positive value, it indicates that the vehicle is expected to travel in the left direction. If the difference between the average brightness of the left and right taillight images is a negative value, it indicates that the vehicle is expected to travel in the right direction. If the difference between the average brightness of the left and right taillight images is zero, it indicates that the vehicle is expected to travel in the straight direction.
[0124] D2. If the angle is a positive value, it means that the vehicle is traveling to the left; if the angle is a negative value, it means that the vehicle is traveling to the right; if the angle is zero, it means that the vehicle is traveling straight;
[0125] D3. Match the vehicle's predicted driving direction with the vehicle's driving direction. If the vehicle's predicted driving direction is consistent with the vehicle's driving direction, the vehicle's traffic behavior is normal; otherwise, the vehicle's traffic behavior is abnormal.
[0126] Embodiment three, as Figure 2 As shown, the present invention proposes a device for identifying dangerous traffic behaviors on highways based on machine learning, which is applicable to the method for identifying dangerous traffic behaviors on highways based on machine learning, including:
[0127] The video acquisition module 1 is used to acquire video of the target expressway section through a video surveillance camera to obtain an expressway section surveillance video, and to intercept the expressway section surveillance video through a preset image sampling period to obtain an expressway section image sequence;
[0128] The target detection module 2 is used to perform color enhancement on the highway section image sequence to obtain a standard highway section image sequence, and detect the center line and vehicles in the standard highway section image sequence based on the trained target detection model to obtain a standard highway section image sequence with a center line detection frame and a vehicle detection frame;
[0129] Angle calculation module 3, which is used to calculate the angle between the centerline detection frame and the vehicle detection frame to obtain an angle sequence, compare the angle sequence with a preset angle threshold one by one, and record the number of angles that are continuously greater than the preset angle threshold;
[0130] A time calculation module 4, which is used to obtain the number of corresponding standard highway section images based on the number of angles, and obtain the vehicle angle deviation time based on the number of standard highway section images and a preset image sampling period;
[0131] The image segmentation module 5 is used to compare the vehicle angle deviation time with a preset time threshold. If it is greater than the preset time threshold, the corresponding standard highway section image sequence is obtained, and the left and right tail lights of the vehicle in the standard highway section image sequence are image segmented based on the trained image segmentation model to obtain the left and right tail lights image sequence of the vehicle;
[0132] The behavior judgment module 6 is used to extract the image brightness of the left and right taillight images of the vehicle to obtain the average brightness sequences of the left and right taillight images respectively, calculate the difference between the average brightness of the left and right taillight images, judge the vehicle's pre-travel direction based on the difference between the average brightness of the left and right taillight images, and match the vehicle's pre-travel direction with the angle to obtain the vehicle's traffic behavior.
[0133] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited thereto, and various changes can be made within the knowledge scope of technicians in the relevant technical field without departing from the purpose of the present invention.
Claims
1. A method for identifying dangerous traffic behaviors on highways based on machine learning, characterized in that: include: The target highway section is video-captured by a video surveillance camera to obtain a highway section surveillance video, and the highway section surveillance video is video-intercepted by a preset image sampling period to obtain a highway section image sequence; Performing color enhancement on the highway section image sequence to obtain a standard highway section image sequence, and detecting a center line and a vehicle in the standard highway section image sequence based on a trained target detection model to obtain a standard highway section image sequence with a center line detection frame and a vehicle detection frame; Calculating the angle between the centerline detection frame and the vehicle detection frame to obtain an angle sequence, comparing the angle sequence with a preset angle threshold one by one, and recording the number of angles that are continuously greater than the preset angle threshold; Acquire the number of the corresponding standard highway section images based on the number of angles, and acquire the vehicle angle deviation time based on the number of the standard highway section images and the preset image sampling period; The vehicle angle deviation time is compared with a preset time threshold. If it is greater than the preset time threshold, the corresponding standard highway section image sequence is obtained, and the left and right tail lights of the vehicle in the standard highway section image sequence are segmented based on the trained image segmentation model to obtain the left and right tail lights image sequence of the vehicle; The image brightness of the left and right taillight images of the vehicle is extracted to obtain the average brightness sequences of the left and right taillight images respectively, the difference between the average brightness of the left and right taillight images is calculated, the pre-travel direction of the vehicle is determined based on the difference between the average brightness of the left and right taillight images, and the pre-travel direction of the vehicle is matched with the angle to obtain the traffic behavior of the vehicle.
2. The method for identifying dangerous traffic behaviors on highways based on machine learning according to claim 1, characterized in that: Performing color enhancement on the expressway section image sequence to obtain a standard expressway section image sequence, including: The center distance of the highway section image is calculated. The center distance calculation formula of the highway section image is as follows: Among them, u it represents the i+t-order center distance of the highway image, M and N represent the length and width of the highway image, f(x,y) represents the highway image function, (x0,y0) represents the center of gravity of the highway image, and M 10 represents the 1+0 order origin moment of the highway section image, M 00 represents the 0+0 order origin moment of the highway section image, and And M ab represents the a+b-order origin moment of the highway section image, and The center distance of the highway section image is standardized to obtain a standardized center distance of the highway section image. The standardized center distance calculation formula of the highway section image is as follows: Among them, I it Represents the i+t-order normalized center distance of the highway section image; A first invariant moment set is obtained based on the standardized center distance of the highway section image. The first invariant moment set is expressed as follows: Among them, (C1, C2, C3, C4) represents the first invariant moment set.
3. The method for identifying dangerous highway traffic behaviors based on machine learning according to claim 2 is characterized in that: Performing color enhancement on the expressway section image sequence to obtain a standard expressway section image sequence also includes: A second invariant moment set is obtained based on the center distance of the highway section image, and the first invariant moment set and the second invariant moment set are combined to obtain a combined invariant moment. The expression of the second invariant moment set is as follows: Among them, (I1, I2, I3) represents the second invariant moment set; The combined invariant moment expression is as follows: C=(C1,C2,C3,C4,I1,I2,I3); Where C represents the combined invariant moment; The highway section image is color enhanced based on the combined invariant moment to obtain a standard highway section image sequence. The color enhancement formula is as follows: Among them, g(x, y) represents the standard highway section image, c and d represent the upper and lower limits of the grayscale range of the standard highway section image, respectively, and e and f represent the upper and lower limits of the grayscale range of the highway section image, respectively.
4. The method for identifying dangerous highway traffic behaviors based on machine learning according to claim 1 is characterized in that: The target detection model adopts FasterR-CNN.
5. The method for identifying dangerous traffic behaviors on highways based on machine learning according to claim 1 is characterized in that: Calculating the angle between the centerline detection frame and the vehicle detection frame to obtain an angle sequence, including: Obtaining the center point of the center line detection frame and the center point of the vehicle detection frame, and obtaining the pixel coordinates of the center point of the center line detection frame and the center point of the vehicle detection frame; Based on the pixel coordinates of the center point of the center line detection frame and the center point of the vehicle detection frame, the angle between the center point of the center line detection frame and the center point of the vehicle detection frame is obtained through inverse trigonometric functions. The angle between the center point of the center line detection frame and the center point of the vehicle detection frame is the angle between the center line detection frame and the vehicle detection frame.
6. The method for identifying dangerous highway traffic behaviors based on machine learning according to claim 1 is characterized in that: The image segmentation model adopts U-Net.
7. The method for identifying dangerous highway traffic behaviors based on machine learning according to claim 1 is characterized in that: Performing image brightness extraction on the left and right taillight images of the vehicle to obtain average brightness sequences of the left and right taillight images respectively includes: The color values in the left and right taillight images of the vehicle are normalized, and the normalization formula is as follows: Among them, R′, G′ and B′ represent the normalized color values of the left and right taillight images of the vehicle, and R, G and B represent the color values of the left and right taillight images of the vehicle, respectively; The vehicle left and right taillight images are converted from RGB images to HSV images based on the normalized color values in the vehicle left and right taillight images. The H channel conversion formula of the HSV image is as follows: The S channel conversion formula of the HSV image is as follows: The V channel conversion formula of the HSV image is as follows: V = max(R′, G′, B′); Among them, R′, G′ and B′ respectively represent the normalized color values of the left and right taillight images of the vehicle, and R, G and B respectively represent the color values of the left and right taillight images of the vehicle.
8. The method for identifying dangerous highway traffic behaviors based on machine learning according to claim 7 is characterized in that: Performing image brightness extraction on the left and right taillight images of the vehicle to obtain average brightness sequences of the left and right taillight images respectively, further comprising: The HSV segmentation threshold of the left and right taillight images of the vehicle is preset, the left and right taillight images of the vehicle are segmented based on the HSV segmentation threshold, and a morphological dilation operation is performed on the segmented left and right taillight images of the vehicle to obtain enhanced images of the left and right taillights of the vehicle. The HSV segmentation threshold is as follows: The HSV values of the enhanced images of the left and right taillights of the vehicle are respectively obtained, and the HSV values of the enhanced images of the left and right taillights of the vehicle are averaged to obtain an average brightness sequence of the enhanced images of the left and right taillights, that is, an average brightness sequence of the left and right taillight images.
9. The method for identifying dangerous highway traffic behaviors based on machine learning according to claim 1, characterized in that: The method comprises: determining the predicted driving direction of the vehicle based on the difference in average brightness of the left and right taillight images, and matching the predicted driving direction of the vehicle with the angle to obtain the traffic behavior of the vehicle, including: If the difference between the average brightness of the left and right taillight images is a positive value, it indicates that the vehicle is expected to travel in the left direction; if the difference between the average brightness of the left and right taillight images is a negative value, it indicates that the vehicle is expected to travel in the right direction; if the difference between the average brightness of the left and right taillight images is zero, it indicates that the vehicle is expected to travel in the straight direction; If the angle is a positive value, it means that the vehicle is traveling in the left direction; if the angle is a negative value, it means that the vehicle is traveling in the right direction; if the angle is zero, it means that the vehicle is traveling in the straight direction; The vehicle's predicted driving direction is matched with the vehicle's driving direction. If the vehicle's predicted driving direction is consistent with the vehicle's driving direction, the vehicle's traffic behavior is normal; otherwise, the vehicle's traffic behavior is abnormal.
10. A device for identifying dangerous traffic behaviors on highways based on machine learning, which is applicable to a method for identifying dangerous traffic behaviors on highways based on machine learning according to any one of claims 1 to 9, characterized in that: include: A video acquisition module (1), the video acquisition module (1) being used to acquire video of a target expressway section through a video surveillance camera to obtain an expressway section surveillance video, and to intercept the expressway section surveillance video through a preset image sampling period to obtain an expressway section image sequence; An object detection module (2), the object detection module (2) is used to perform color enhancement on the highway section image sequence to obtain a standard highway section image sequence, and detect the center line and vehicles in the standard highway section image sequence based on a trained object detection model to obtain a standard highway section image sequence with a center line detection frame and a vehicle detection frame; An angle calculation module (3), the angle calculation module (3) is used to calculate the angle between the center line detection frame and the vehicle detection frame to obtain an angle sequence, compare the angle sequence with a preset angle threshold one by one, and record the number of angles that are continuously greater than the preset angle threshold; A time calculation module (4), the time calculation module (4) is used to obtain the number of the corresponding standard highway section images based on the number of angles, and to obtain the vehicle angle deviation time based on the number of the standard highway section images and the preset image sampling period; An image segmentation module (5), the image segmentation module (5) is used to compare the vehicle angle deviation time with a preset time threshold, if it is greater than the preset time threshold, obtain the corresponding standard highway section image sequence, and perform image segmentation on the left and right tail lights of the vehicle in the standard highway section image sequence based on the trained image segmentation model to obtain the left and right tail lights of the vehicle image sequence; A behavior judgment module (6), the behavior judgment module (6) is used to extract the image brightness of the left and right taillight images of the vehicle to obtain the average brightness sequences of the left and right taillight images respectively, calculate the difference between the average brightness of the left and right taillight images, judge the vehicle's pre-travel direction based on the difference between the average brightness of the left and right taillight images, and match the vehicle's pre-travel direction with the angle to obtain the vehicle's traffic behavior.
Citation Information
Patent Citations
Highway illegal parking detection method
CN106127143A
Danger early warning method and device, equipment and storage medium
CN110688877A