A method, device and storage medium for identifying road traffic collision risks
By combining angular outlier detection and a sliding window mechanism, the problems of sample imbalance and road heterogeneity in traffic collision risk identification are solved, achieving high-precision and stable road-level traffic collision risk identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2026-03-06
AI Technical Summary
Existing traffic collision risk identification methods suffer from decreased accuracy under imbalanced sample conditions and fail to fully utilize unsupervised learning and road heterogeneity, resulting in poor identification performance.
An unsupervised learning method based on angle outlier detection is adopted, combined with a sliding window mechanism, to construct a road-level traffic collision risk identification model. Considering the spatial and temporal heterogeneity of roads, the identification accuracy and stability are improved by using angle outlier detection algorithm and sliding window mechanism.
Achieving high-precision traffic collision risk identification under imbalanced sample conditions improves the model's recognition accuracy and stability, and adapts to the dynamic characteristics and spatial heterogeneity of roads.
Smart Images

Figure CN115510985B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic safety, and in particular to a method, apparatus and storage medium for identifying road traffic collision risks. Background Technology
[0002] In proactive traffic safety management systems, real-time expressway traffic collision risk identification refers to developing a real-time expressway traffic collision risk model by exploring the relationship between pre-collision traffic flow characteristics and collision probability. This model estimates the collision probability over a relatively short period (e.g., 15 or 20 minutes) and outputs triggerable proactive safety control strategies aimed at preventing traffic collisions. It is considered a key means of improving traffic safety. Currently, with the development of various advanced traffic sensing and management technologies, real-time traffic data is becoming increasingly widely available, and real-time expressway traffic collision risk analysis is receiving increasing attention.
[0003] Current research primarily focuses on developing traffic collision risk models using supervised learning methods, including logistic regression, random forests, support vector machines, and MLPs. While supervised learning models achieve good accuracy, they are highly sensitive to imbalanced samples. Studies show that when historical collision samples are insufficient, the performance of supervised learning models significantly decreases, or even fails completely, as the imbalance ratio increases, thus being limited by sample quality and quantity. To address the imbalance problem, the paper "Examining Imbalanced Classification Algorithms in Predicting Real-time Traffic Crash Risk" employs a random undersampling method, and the paper "Real-timecrash risk prediction using long short-term memory recurrent neural network" uses the SMOTE method for sample refinement. Traditional undersampling rates are typically set to 1:4 or 1:5, and recent research has begun to explore even more imbalanced ratios such as 1:10. Overall, although supervised learning methods have achieved good performance, they are limited by their sensitivity to imbalanced samples and their large sample size requirements. Therefore, a new method less reliant on historical traffic collision risk samples is crucial for identification.
[0004] Meanwhile, information about specific locations and road characteristics is valuable for collision identification and designing safety countermeasures. Existing traffic collision risk identification methods do not consider road heterogeneity, i.e., they do not consider the empirical correlation between road characteristics and risk. This is because modeling road heterogeneity would exacerbate sample imbalance. Compared to widely adopted supervised modeling methods, unsupervised learning methods are generally insensitive to imbalanced samples and can be used for road-level heterogeneity modeling when sufficient samples are lacking. However, most existing traffic-related research only uses unsupervised learning methods for data clustering and dimensionality reduction, failing to fully utilize the advantages of unsupervised learning. Summary of the Invention
[0005] The purpose of this invention is to provide a road traffic collision risk identification method, device, and storage medium based on angle outlier detection. It fully utilizes the advantages of unsupervised learning to fundamentally solve the problem of imbalanced collision samples. At the same time, it establishes a road-level traffic collision risk identification model based on the heterogeneity of road space and introduces a sliding window mechanism to further improve the identification accuracy and stability of the identification model.
[0006] The objective of this invention can be achieved through the following technical solutions:
[0007] A road traffic collision risk identification method based on angle outlier detection includes the following steps:
[0008] Step 1) Collect and preprocess traffic flow data: Use loop detectors pre-installed on urban expressways to collect and preprocess traffic flow data for each road segment.
[0009] Step 2) Constructing a training sample set: Extract features from traffic flow data according to pre-configured rules to obtain feature sets for each road segment, which will serve as the training sample set;
[0010] Step 3) Construct road-level traffic collision risk identification models for each road segment: The input of the road-level traffic collision risk identification model is the feature of traffic flow data for each road segment. An angle-based outlier detection algorithm is used to detect outliers in the feature data at the moment of traffic collision risk, and the identified collision samples are output.
[0011] Step 4) Initially train traffic collision risk identification models for each road level based on the training sample set;
[0012] Step 5) Introduce a sliding window mechanism to construct a dynamic training sample set, and retrain the model based on the dynamic training sample set;
[0013] Step 6) Based on the trained model, identify the traffic collision risk of each road segment.
[0014] Step 1) includes the following steps:
[0015] Step 1-1) Collect traffic flow data: Divide the urban expressway into multiple segments according to the distribution of entrance and exit ramps, and further divide each segment into upper, middle, and lower sections. At different locations within each segment, L = {L U ,L C ,L D} Install one or more loop detectors for collecting traffic flow data, and use the loop detectors to collect traffic flow data, wherein L U Indicates the upstream section, L C Indicates the current road segment, L D This indicates the downstream road segment, and the traffic flow data includes vehicle speed S, traffic volume F, and occupancy rate O;
[0016] Steps 1-2) Traffic flow data preprocessing;
[0017] Steps 1-3) Extract and segment data: To predict the road traffic collision risk at a certain time point, traffic flow data for a pre-configured time interval before the time point is extracted and divided into multiple data segments according to the pre-configured segment intervals, named Segment sequentially. i (1i≤N), where N is the number of data segments, and Segment1 is the data segment closest to the current time.
[0018] The traffic flow data preprocessing includes the following steps:
[0019] Step 1-2-1) Delete duplicate, unknown, or invalid traffic flow data;
[0020] Step 1-2-2) Set pre-configured threshold ranges for vehicle speed S, traffic flow F, and occupancy rate O respectively. min ,S max ]、[F min ,F max ]、[O min O max Traffic flow data exceeding the threshold range will be removed.
[0021] Steps 1-2-3) Check data consistency: If a sample meets any of the following four rules, it is considered outlier and removed:
[0022] a: F = 0, S = 0, and O > 0;
[0023] b: F > 0, and S = 0;
[0024] c: F = 0, and S > 0;
[0025] d: F > 0, S > 0, and O = 0;
[0026] Step 1-2-4) Add the traffic flow data deleted in Step 1-2-1)-1-2-3) using spatial linear interpolation: Determine the upstream and downstream road segments with the closest spatial distance to the coil detectors corresponding to the deleted data, and obtain the vehicle speed S of these two road segments respectively. U and S D Traffic flow F U and F D O% market share U and O D Replace the deleted data using the following formula:
[0027]
[0028]
[0029]
[0030] in, For the added data;
[0031] Steps 1-2-5) Match traffic flow data with road segments based on the coil detector numbers;
[0032] Steps 1-2-6) Delete traffic flow data before and after the pre-configured time interval of the accident to eliminate data noise caused by the accident.
[0033] The characteristics of the traffic flow data include data segments. i Under (1i≤N), located in road segment L j The average speed S of the traffic flow data corresponding to the coil detector (j=U|C|D) is AS. ij Standard deviation SS ij Total TS ij and the average value AF of traffic flow F. ij Standard deviation SF ij Total TF ij There are a total of N×3×6 features.
[0034] The road-level traffic collision risk identification model represents the space formed by the input sample set as follows: A sample corresponds to a point in a high-dimensional space. For two of them, Represents the difference vector Then for any point Calculate the variance of the angles between the difference vectors of all pairs of points. The ABOF value, or ABOF score, is used to determine whether a traffic collision has occurred.
[0035]
[0036] The road-level traffic collision risk identification model is based on an anomaly threshold th. abnornal To determine whether a collision has occurred, the ABOF value of the predicted sample is less than that of the sample set (1-th). abnormal When the ABOF value is 100% (1 / 2) × 100%, it indicates a collision and the sample is identified as a collision sample; otherwise, it is identified as a non-collision sample.
[0037] The sliding window mechanism determines the number of training samples by the window size and updates the sample set data at fixed time intervals. During the update, the data is arranged in chronological order, and the window slides from front to back. The data in the first window of the previous update cycle is discarded, and new data is added from the last newly added window.
[0038] The window size of the sliding window is determined based on the sensitivity and false alarm rate of the recognition results of the road-level traffic collision risk recognition model under different window sizes after initial training.
[0039] A road traffic collision risk identification device based on angular outlier detection includes a memory, a processor, and a program stored in the memory. When the processor executes the program, it implements the method described above.
[0040] A storage medium having a program stored thereon, which, when executed, implements the method described above.
[0041] Compared with the prior art, the present invention has the following beneficial effects:
[0042] (1) The present invention adopts an angle-based outlier detection algorithm, which makes full use of the advantages of unsupervised learning. It can achieve high-precision risk identification when the sample data is unbalanced, and does not require expanding the sample through other means, thus providing a foundation for the establishment and training of road-level traffic collision risk identification models.
[0043] (2) This invention takes into account the dynamic characteristics of traffic and introduces a sliding window mechanism to construct a dynamic training set to reflect the dynamic and concentrated characteristics of traffic flow, thereby improving the recognition accuracy of the model.
[0044] (3) In view of the spatial heterogeneity of roads, the present invention establishes a traffic collision risk identification model for each road segment, so that the model can more accurately express the road characteristics of the road segment and further improve the stability of the model's identification accuracy. Attached Figure Description
[0045] Figure 1 This is a flowchart of the method of the present invention;
[0046] Figure 2This refers to the naming rules for model input features in one embodiment;
[0047] Figure 3 This is a schematic diagram of a data processing method using a sliding window mechanism. Detailed Implementation
[0048] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. These embodiments are based on the technical solution of the present invention and provide detailed implementation methods and specific operating procedures. However, the scope of protection of the present invention is not limited to the following embodiments.
[0049] A road traffic collision risk identification method based on angle outlier detection, such as Figure 1 As shown, it includes the following steps:
[0050] Step 1) Collect and preprocess traffic flow data: Use loop detectors pre-installed on urban expressways to collect and preprocess traffic flow data for each road segment.
[0051] Step 1-1) Collect traffic flow data: Divide the urban expressway into multiple segments according to the distribution of entrance and exit ramps, and further divide each segment into upper, middle, and lower sections. At different locations within each segment, L = {L U ,L C ,L D} Install one or more loop detectors for collecting traffic flow data, and use the loop detectors to collect traffic flow data, wherein L U Indicates the upstream section, L C Indicates the current road segment, L D The downstream section is indicated by the traffic flow data, which includes vehicle speed S, traffic volume F, and occupancy rate O.
[0052] In this embodiment, the data collection target is a city's expressway system in May 2014, which includes 6 city expressways, divided into 237 segments according to the distribution of entrance and exit ramps, with an average segment length of 949.2m, and the data collection interval is 20s.
[0053] Steps 1-2) Traffic flow data preprocessing;
[0054] Step 1-2-1) Delete duplicate, unknown, or invalid traffic flow data;
[0055] Step 1-2-2) Set pre-configured threshold ranges for vehicle speed S, traffic flow F, and occupancy rate O respectively. min ,S max ]、[F min ,F max ]、[O min O maxIn this embodiment, the speeds are set to [0,120] km / h, [0,LQ], and [0,100] respectively to remove traffic flow data that exceed the threshold range. Here, L is the number of lanes in the coil detector section, and Q is the upper limit of the flow rate of a single lane within the data collection interval of 20 seconds. In this embodiment, the upper limit threshold Q = 10 is set.
[0056] Steps 1-2-3) Check data consistency: If a sample meets any of the following four rules, it is considered outlier and removed:
[0057] a: F = 0, S = 0, and O > 0;
[0058] b: F > 0, and S = 0;
[0059] c: F = 0, and S > 0;
[0060] d: F > 0, S > 0, and O = 0;
[0061] Step 1-2-4) Add the traffic flow data deleted in Step 1-2-1)-1-2-3) using spatial linear interpolation: Determine the upstream and downstream road segments with the closest spatial distance to the coil detectors corresponding to the deleted data, and obtain the vehicle speed S of these two road segments respectively. U and S D Traffic flow F U and F D O% market share U and O D Replace the deleted data using the following formula:
[0062]
[0063]
[0064]
[0065] in, For the added data;
[0066] Steps 1-2-5) Match traffic flow data with road segments based on the coil detector numbers;
[0067] Steps 1-2-6) Delete traffic flow data before and after the pre-configured time interval of the accident to eliminate data noise caused by the accident.
[0068] Steps 1-3) Extract and segment the data: To predict the road traffic collision risk at a certain time point, extract the traffic flow data for the 20 minutes preceding that time point, and divide it into 4 data segments at 5-minute intervals, named Segment after each segment. i(1i≤4), where Segment1 is the data segment closest to the current time.
[0069] Step 2) Constructing a training sample set: Extract features from traffic flow data according to pre-configured rules to obtain feature sets for each road segment, which will serve as the training sample set;
[0070] The characteristics of the traffic flow data include data segments. i Under (1i≤4), located in road segment L j The average speed S of the traffic flow data corresponding to the coil detector (j=U|C|D) is AS. ij Standard deviation SS ij Total TS ij and the average value AF of traffic flow F. ij Standard deviation SF ij Total TF ij There are a total of 4*3*6=72 features.
[0071] The naming rules for the model input features in this embodiment are as follows: Figure 2 As shown.
[0072] Step 3) Construct road-level traffic collision risk identification models for each road segment: The input of the road-level traffic collision risk identification model is the feature of traffic flow data for each road segment. The Angle-Based Outlier Detection (ABOD) algorithm is used to detect outliers at the moment of traffic collision risk in the feature data, and the identified collision samples are output.
[0073] The road-level traffic collision risk identification model represents the space formed by the input sample set as follows: A sample corresponds to a point in a high-dimensional space. For two of them, Represents the difference vector Then for any point Calculate the variance of the angles between the difference vectors of all pairs of points.
[0074]
[0075] Based on the anomaly threshold th abnormal To determine whether a collision has occurred, the ABOF value of the predicted sample is less than that of the sample set (1-th). abnormalA collision is indicated when the ABOF value reaches 100% (3) times the initial value, and the sample is identified as a collided sample; otherwise, it is identified as a non-collision sample. In other words, the ABOF values of all samples in the sample set are sorted from smallest to largest; the smaller the ABOF value, the higher the collision risk, and the sample with the highest ABOF value is selected. abnormal ×100% of the samples are identified as collision samples.
[0076] The abnormal threshold value is determined based on the false alarm rate and sensitivity obtained from the detection. In this embodiment, the abnormal threshold th... abnormal =0.25.
[0077] Step 4) Initially train traffic collision risk identification models for each road level based on the training sample set;
[0078] Step 5) Introduce a sliding window mechanism to construct a dynamic training sample set, and retrain the model based on the dynamic training sample set;
[0079] The sliding window mechanism determines the number of training samples based on the window size and updates the sample set data at fixed time intervals. During updates, the data is arranged chronologically, and the window slides from front to back. Data from the first window in the previous update cycle is discarded, and new data is added from the last newly added window. When the window size is 30, the data processing method of the sliding window mechanism is as follows: Figure 3 As shown.
[0080] The size of the sliding window is determined based on the sensitivity and false alarm rate of the road-level traffic collision risk identification model under different window sizes, which were initially trained. With other factors kept constant, different window sizes are set, and the training sample set is dynamically updated at fixed time intervals T1. The initially trained traffic collision risk detection model is used to detect the training sample set. Based on the model's sensitivity and false alarm rate, the optimal window size WS is selected. Higher sensitivity and lower false alarm rate indicate a more suitable window size.
[0081] In this embodiment, the window size is preset to 10, 20, 30, 40, and 50, and T1 is set to 1 minute. Table 1 shows the false alarm rate and sensitivity results for different window sizes in this embodiment.
[0082] Table 1
[0083]
[0084] Experimental results show that when the window size is 30, the sensitivity is 0.867 and the false alarm rate is 0.173, indicating that the window size is optimal. Increasing the window size further negatively impacts the sensitivity; conversely, decreasing the window size makes the dynamic model overly sensitive to changes in traffic flow, leading to more false alarms. Therefore, the optimal window size is determined to be WS = 30.
[0085] Table 2 shows the difference in recognition results between the models trained on static samples and those trained on dynamic samples. It's important to note that the results shown in Tables 1 and 2 do not consider road spatial heterogeneity; that is, the established model is a city-level traffic collision risk identification model (i.e., a unified model for all roads), and the training set is all data not divided by road segment. As can be seen from the tables, using a sliding window further fully considers the temporal heterogeneity of road traffic flow, significantly improving model performance.
[0086] Table 2
[0087]
[0088] Step 6) Based on the trained model, identify the traffic collision risk of each road segment.
[0089] For road segment R, the trained road-level traffic collision risk identification model is Model. R According to Model R The ABOF value is calculated from real-time traffic flow data, and then based on the anomaly threshold. Collision samples are identified, collision judgment results are obtained, and traffic collision risk identification is completed. Compared with the city-level model, the sensitivity of the road-level model, which considers road heterogeneity, has increased from 0.867 to 0.925, and the false alarm rate has decreased from 0.173 to 0.058, indicating that the recognition accuracy of the road-level model has improved and initially meets the basic needs of current traffic safety management.
[0090] A road traffic collision risk identification device based on angular outlier detection includes a memory, a processor, and a program stored in the memory. When the processor executes the program, it implements the method described above.
[0091] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0092] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.
Claims
1. A method for road traffic collision risk identification based on angle outlier detection, characterized in that, The method comprises the following steps: Step 1) collecting traffic flow data and preprocessing: collecting traffic flow data of each road section using a coil detector pre-laid on an urban expressway and preprocessing the data; Step 2) constructing a training sample set: extracting features of the traffic flow data according to pre-configured rules to obtain a feature set of each road section as a training sample set; Step 3) constructing a road-level traffic collision risk identification model for each road section: the input of the road-level traffic collision risk identification model is the features of the traffic flow data of each road section, the feature data is subjected to abnormal value detection of a traffic collision risk moment using an angle-based outlier detection algorithm, and the identified collision samples are output; Step 4) preliminarily training each road-level traffic collision risk identification model based on the training sample set; Step 5) introducing a sliding window mechanism to construct a dynamic training sample set, and retraining the model based on the dynamic training sample set; Step 6) identifying the traffic collision risk of each road section based on the trained model.
2. The method of claim 1, wherein, The step 1) comprises the following steps: Step 1-1) Collecting traffic flow data: The urban expressway is divided into multiple sections according to the distribution of on-ramp and off-ramp, and each section is divided into upper, middle and lower three sections. One or more coil detectors are set at different positions L = {L U ,L C ,L D} of each section to collect traffic flow data, wherein L U represents an upstream section, L C represents a current section, and L D represents a downstream section. The traffic flow data includes vehicle speed S, traffic flow F and occupancy O. Step 1-2) traffic flow data preprocessing; Step 1-3) Extract and divide data: in order to predict the road traffic collision risk at a certain time point, the traffic flow data of a pre-configured time interval before the time point is extracted, and divided into multiple data segments according to a pre-configured segment interval, sequentially named as Segment i (1≤i≤N), wherein N is the number of divided data segments, and Segment1 is the data segment closest to the current time.
3. The method of claim 2, wherein, The traffic flow data preprocessing comprises the following steps: Step 1-2-1) deleting repeated, unknown or invalid traffic flow data; Step 1-2-2) setting preconfigured threshold ranges [S min ,S max ], [F min ,F max ], [O min ,O max ] for the vehicle speed S, the traffic flow F and the occupancy O respectively, and eliminating the traffic flow data beyond the threshold ranges; Step 1-2-3) checking data consistency: if the sample meets any one of the following four rules, it is considered as abnormal data and is removed: a: F=0, and S=0, and O>0; b: F>0, and S=0; c: F=0, and S>0; d: F>0, and S>0, and O=0; Step 1-2-4) Adding traffic flow data deleted in Step 1-2-1) to Step 1-2-3) using spatial linear interpolation method: determining the upstream and downstream road sections closest in spatial distance to the deleted data from the loop detector, respectively, and obtaining the vehicle speed S U and S D , the traffic volume F U and F D , the occupancy O U and O D , and supplementing the deleted data according to the following formula: wherein is the added data; Step 1-2-5) matching the traffic flow data with the road section according to the coil detector number; Step 1-2-6) deleting traffic flow data before and after a pre-configured time interval of an accident to eliminate data noise caused by the accident.
4. The method of claim 2, wherein, The features of the traffic flow data include the average value AS i of the speed S of the traffic flow data corresponding to the coil detector on the road segment L j under the condition of (1≤i≤N) ij , the standard deviation SS ij , the total TS ij , and the average value AF ij , the standard deviation SF ij , and the total TF ij of the traffic flow F, totaling N×3×6 features.
5. The method of claim 1, wherein, The road-level traffic collision risk identification model represents a space formed by the input sample set as One sample corresponds to a point in a high-dimensional space, For two points, The difference vector is represented as Then for any point Calculate the variance of the angle between the difference vectors of all point pairs That is, the ABOF value, which is used to determine whether a traffic collision occurs, wherein, 6. The method of claim 5, wherein the method further comprises: The road-level traffic collision risk identification model is based on an abnormal threshold value th abnormal determining whether a collision occurs, when the ABOF value of the prediction sample is less than the ABOF value of 1-th abnormal ) x 100% in the sample set, it is indicated that a collision occurs, the sample is identified as a collision sample, otherwise it is identified as a non-collision sample.
7. The method of claim 1, wherein, The sliding window mechanism determines the number of training samples with the window size, and updates the sample set data at a fixed time interval. When updating, the data is arranged in chronological order, and the window slides from front to back. The data in the first window in the last update cycle is discarded, and new data is added from the last newly added window.
8. The method of claim 7, wherein, The window size of the sliding window is determined based on the sensitivity and false positive rate of the road-level traffic collision risk identification model in the preliminary training under different window sizes. 9.A device for road traffic collision risk identification based on angle outlier detection, comprising a memory, a processor, and a program stored in the memory, characterized in that, The processor implements the method of any one of claims 1-8 when executing the program.
10. A storage medium having stored thereon a program, characterized by The program implements the method of any one of claims 1-8 when executed.
Citation Information
Patent Citations
Outlier detection method based on mass center
CN107679215A
Deep learning based urban expressway accident prediction method
CN108198415A