A method and device for predicting traffic accident risk based on streaming traffic flow data

By acquiring and processing detailed traffic data, using algorithms such as random forest and XGBoost to build a traffic accident risk prediction model, the existing methods have poor prediction results and high false alarm rate, and the traffic accident risk prediction with higher accuracy and lower false alarm rate is achieved.

CN119495196BActive Publication Date: 2025-04-01SOUTH CHINA UNIV OF TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510082872.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-04-01
Estimated Expiration
2045-01-20

AI Technical Summary

Technical Problem

Existing traffic accident risk prediction methods are difficult to capture the potential correlation in traffic data, the prediction effect is poor, and the false alarm rate is high.

Method used

By obtaining accident data sets, streaming traffic flow data sets and road section information data sets, a random forest algorithm is used to sort and filter traffic characteristics with importance, and a real-time traffic accident risk prediction model based on XGBoost is constructed, and a variety of resampling methods and hyperparameter optimization are adopted to improve model accuracy.

Benefits of technology

It improves the accuracy of real-time traffic accident risk prediction at highway section level, reduces the false alarm rate, and enhances the monitoring ability of highway traffic safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119495196B_ABST
    Figure CN119495196B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for predicting traffic accident risks based on streaming traffic flow data, which belongs to the technical field of traffic accident risk prediction, and includes the following steps: S1, obtaining an accident data set, a streaming traffic flow data set, and a road section information data set; S2, forming an accident data set and a non-accident data set containing multiple traffic characteristics; S3, sorting and screening traffic characteristics by importance; S4, constructing a real-time traffic accident risk prediction model based on XGBoost; S5, resampling and hyperparameter optimization of the traffic accident risk prediction model; S6, evaluating the traffic accident risk prediction model, and accessing real-time data to output real-time prediction results. The present invention adopts the above-mentioned method and device for predicting traffic accident risks based on streaming traffic flow data, which can improve the accuracy of real-time traffic accident risk prediction at the highway section level, and is of great significance for improving highway traffic safety.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of traffic accident risk prediction, and in particular to a traffic accident risk prediction method and device based on streaming traffic flow data. Background Art

[0002] Real-time traffic accident risk prediction is mainly achieved by analyzing and learning the characteristics of historical accident data, traffic flow data, etc., and predicting in real time the possibility of a traffic accident occurring on a specific road section or in an area at a certain moment in the future. Real-time traffic accident risk prediction is a prerequisite for carrying out active traffic safety management and control, and is of great significance to improving highway traffic safety.

[0003] Traditional traffic accident risk assessment methods are mainly based on statistical data. By conducting statistical analysis on historical traffic accident data and related factors, the possibility of traffic accidents occurring in a certain period of time or area in the future is predicted. However, this method is difficult to capture the potential correlations in traffic data and the prediction effect is often poor.

[0004] With the development of computer technology, more and more machine learning models are being used for real-time traffic accident risk prediction and can also be implemented at the road section level. Compared with traditional statistical models, these models can handle more complex nonlinear relationships and large-scale data sets, thereby improving the accuracy and timeliness of predictions.

[0005] But more practically speaking, there are still some problems, mainly reflected in: 1) The existing commonly used detectors are mainly geomagnetic coils and microwave radars, etc. The traffic features obtained for modeling are mainly flow, speed, density or occupancy rate and their standard deviation, variance, etc., which are often only roughly aggregated in the time dimension, lacking more detailed traffic flow information; 2) Most applications always preconceivedly use a data set with a ratio of 1:4 between accident and non-accident data for training and prediction. Once the model is connected to real-time data, there are still a large number of false alarms. The present invention starts from the data source and modeling method, obtains more refined indicator features from streaming traffic data, and uses multiple resampling methods to train the model, which can be combined with a larger accident and non-accident data set to further improve the model accuracy and reduce the false alarm rate. Summary of the invention

[0006] The purpose of the present invention is to provide a traffic accident risk prediction method and device based on streaming traffic flow data, which can improve the accuracy of real-time traffic accident risk prediction at the highway section level, and is of great significance for improving highway traffic safety.

[0007] To achieve the above object, the present invention provides a method for predicting traffic accident risks based on streaming traffic flow data, comprising the following steps:

[0008] S1. Obtain accident dataset, streaming traffic flow dataset, and road section information dataset;

[0009] The accident data set includes: the time of the accident, the location of the accident, the severity of the accident, the duration of the accident rescue, the number of vehicles involved in the accident, the type of vehicles involved in the accident, and the license plates involved in the accident;

[0010] The streaming traffic flow dataset is obtained from the highway ETC gantry toll collection system, including vehicle passing record time, vehicle license plate number, vehicle type, number of the ETC gantry through which the vehicle passes, and vehicle model information;

[0011] The road section information data set includes the length of the road section, the line type of the road section, the location information of the ETC gantry on the road section, the number of lanes of the road section and the direction of the road section;

[0012] S2, dividing the streaming traffic data according to the accident data and the road section information data to respectively form an accident data set and a non-accident data set containing multiple traffic characteristics;

[0013] S3, sort and filter the traffic features by importance based on the random forest algorithm, and retain the important traffic features;

[0014] S4, using the traffic features filtered in S3 as input, building a real-time traffic accident risk prediction model based on XGBoost;

[0015] S5. The real-time traffic accident risk prediction model is resampled using three methods: SMOTE oversampling, NearMiss undersampling, and SMOTE-Tomek hybrid sampling. The hyperparameters of the real-time traffic accident risk prediction model are optimized based on Optuna.

[0016] S6. Evaluate and compare real-time traffic accident risk prediction models, and access real-time data to output real-time prediction results.

[0017] Preferably, step S2 includes the following sub-steps:

[0018] S201, dividing the road section, according to the relative position of the ETC gantries and the road section, dividing the part between any two gantries into a separate road section unit as a basic unit for traffic feature extraction;

[0019] S202: Based on each road segment unit, the traffic characteristics of the upstream road segment unit and the downstream road segment unit of each predicted road segment unit are extracted in combination with the streaming traffic flow data. The minimum statistical calculation time of the traffic characteristics is 1 minute. Under the premise of a determined aggregation time interval, a total of 28 traffic characteristics are obtained, which are:

[0020] 1) Average traffic volume of upstream road section unit , Average traffic volume of downstream road section unit , the absolute value of the difference in traffic volume between upstream and downstream sections , the coefficient of variation of vehicle flow in upstream and downstream sections , the formula is as follows:

[0021] ;

[0022] ;

[0023] ;

[0024] , ;

[0025] in, It is the upstream section unit gantry U 1. Traffic volume passing through; It is the upstream section unit gantry U 2. Traffic volume passing through; It is the downstream section unit gantry D 1. Traffic volume passing through; It is the downstream section unit gantry D 2. Traffic volume passing through; abs Indicates taking the absolute value;

[0026] 2) Average vehicle speed of upstream section unit , average vehicle speed of downstream section unit , the absolute value of the average speed difference between the upstream and downstream sections , the average vehicle speed variation coefficient of upstream and downstream sections , the formula is as follows:

[0027] , ;

[0028] , ;

[0029] ;

[0030] , ;

[0031] in, It is the upstream section unit The speed of vehicles passing through; It is the upstream section unit Car on upstream gantry U 2. The travel time at each location; It is the upstream section unit Car on upstream gantry U 1. The travel time of a place; m is the number of vehicles with travel time records in the upstream road segment unit; It is the downstream section unit j The speed of vehicles passing through; It is the downstream section unit j Vehicle on downstream gantry D 2. The travel time at each location; It is the downstream section unit j Vehicle on downstream gantry D 1. The travel time of a place; n is the number of vehicles with travel time records in the downstream road segment unit; is the length of the upstream segment; is the length of the downstream segment;

[0032] 3) Upstream section unit time occupancy rate , Downstream section unit time occupancy rate , the absolute value of the difference in unit time occupancy rate between the upstream and downstream sections , Coefficient of variation of unit time occupancy rate of upstream and downstream sections , the formula is as follows:

[0033] ;

[0034] ;

[0035] ;

[0036] , ;

[0037] in, It is the upstream section unit gantry U 1 time occupancy rate; It is the upstream section unit gantry U 2 time occupancy rate; It is the downstream section unit gantry D 1 time occupancy rate; It is the downstream section unit gantry D 2 time occupancy rate;

[0038] 4) Extreme speed difference of upstream section unit , the speed difference of the downstream section unit , the absolute value of the speed difference between the upstream and downstream sections , the coefficient of variation of the speed range of the upstream and downstream sections , the formula is as follows:

[0039] ;

[0040] ;

[0041] ;

[0042] ;

[0043] ;

[0044] in, is the maximum vehicle speed of the upstream segment unit; is the minimum vehicle speed of the upstream road segment unit; is the maximum vehicle speed of the downstream segment unit; is the minimum vehicle speed of the downstream road segment unit;

[0045] 5) Ratio of unit truck traffic in upstream section , the proportion of unit truck traffic in the downstream section , the absolute value of the difference in truck traffic volume between upstream and downstream sections , Coefficient of variation of unit truck flow ratio in upstream and downstream sections , the formula is as follows:

[0046] ;

[0047] ;

[0048] ;

[0049] ;

[0050] ;

[0051] in, TF U2 It is the upstream section unit gantry U 2. The amount of truck traffic passing through; TF U1 It is the upstream section unit gantry U 1. The amount of truck traffic passing through; TF D2 It is the downstream section unit gantry D 2. The amount of truck traffic passing through; TF D1 It is the downstream section unit gantry D 1. The amount of truck traffic passing through;

[0052] 6) Proportion of merging traffic volume in upstream sections , the proportion of merging traffic volume in the downstream section , the absolute value of the difference in the proportion of merging traffic volume of upstream and downstream sections , Coefficient of variation of the proportion of unit merging traffic in upstream and downstream sections , the formula is as follows:

[0053] ;

[0054] ;

[0055] ;

[0056] ;

[0057] ;

[0058] in, is the merging traffic volume of the upstream section unit; is the merging traffic volume of the downstream section unit;

[0059] 7) The upstream section unit vehicle arrival imbalance coefficient, also known as GINI Gini coefficient, vehicle arrival rate of upstream section GINI coefficient , the downstream section unit vehicle arrives GINI coefficient , Upstream and downstream section unit vehicles arrive GINI The absolute value of the coefficient difference , Upstream and downstream section unit vehicles arrive GINI Coefficient of variation , the formula is as follows:

[0060] ;

[0061] ;

[0062] ;

[0063] ;

[0064] ;

[0065] in, It is the upstream section unit gantry U 1 GINI coefficient; It is the upstream section unit gantry U 2 GINI coefficient; It is the downstream section unit gantry D 1 GINI coefficient; It is the downstream section unit gantry D 2 GINI coefficient;

[0066] S203: Divide the traffic features extracted at the accident time into an accident data set, and divide the traffic features extracted at the non-accident time into a non-accident data set.

[0067] Preferably, the accident data set and the non-accident data set in step S3 are merged and input into the random forest algorithm, and the traffic characteristics are sorted using the MGD average Gini coefficient value provided by the random forest algorithm to screen out important variables that affect the risk of traffic accidents.

[0068] Preferably, in step S4, the traffic features sorted in S3 are divided into a training set and a test set in a ratio of 7:3.

[0069] Preferably, in step S5, the optimized hyperparameters are:

[0070] Number of trees , Tree Depth , learning rate , the minimum sample weight in the child node and , the minimum loss function drop required for node splitting , sub-sample ratio , the proportion of features randomly sampled by each tree , the weight of the L2 regularization term , the weight of the L1 regularization term ;

[0071] Then the real-time traffic accident risk prediction model based on XGBoost was used to The value is the final optimization goal of the model, and it is trained under different ratios of accident data sets to non-accident data sets.

[0072] Preferably, in step S6, the accuracy , Sensitivity and false positive rate The performance of the model is evaluated and compared using the following indicators:

[0073] ;

[0074] ;

[0075] ;

[0076] in, is the number of samples where no accident actually occurred and no accident was predicted to occur, is the number of samples where no accident actually occurred but an accident was predicted to occur, is the number of samples where an accident actually occurred and was predicted to occur, is the number of samples where an accident actually occurred but was predicted not to occur.

[0077] A traffic accident risk prediction device based on streaming traffic flow data, comprising:

[0078] Data preprocessing module: used to collect original accident data sets, streaming traffic flow data sets, and road section information data sets, and process them into standard CSV format, while performing data segmentation and data fusion to retain data with complete validity in the fields;

[0079] Feature extraction and screening module: used to extract features from fused data, screen features, and retain important features;

[0080] Model training module: input the features processed by the feature extraction and screening modules, adjust the number of trees, tree depth, and learning rate of the model, train each model, and save the best model;

[0081] Model comparison module: compares the accuracy, sensitivity and false alarm rate of the training model under different numbers of trees, tree depths and learning rates;

[0082] Real-time accident risk prediction module: Based on the real-time traffic data connected, the module runs the selected best model to predict the traffic safety risk on a certain highway section unit in the future.

[0083] Therefore, the present invention adopts the above-mentioned traffic accident risk prediction method and device based on streaming traffic flow data, which can improve the accuracy of real-time traffic accident risk prediction at the highway section level, which is of great significance for improving highway traffic safety.

[0084] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] Figure 1 It is a flow chart of an embodiment of a method for predicting traffic accident risks based on streaming traffic flow data of the present invention;

[0086] Figure 2 It is a schematic diagram of highway section unit division according to an embodiment of a method for predicting traffic accident risks based on streaming traffic flow data of the present invention;

[0087] Figure 3 It is a schematic diagram of importance ranking of traffic characteristic variables in an embodiment of a method for predicting traffic accident risks based on streaming traffic flow data of the present invention;

[0088] Figure 4It is a schematic diagram of importance screening of traffic characteristic variables according to an embodiment of a method for predicting traffic accident risks based on streaming traffic flow data of the present invention;

[0089] Figure 5 It is a structural schematic diagram of an embodiment of a traffic accident risk prediction device based on streaming traffic flow data of the present invention. DETAILED DESCRIPTION

[0090] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.

[0091] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.

[0092] Embodiment 1

[0093] The present invention provides a real-time traffic accident risk prediction method based on streaming traffic flow data. Figure 1 As shown, including but not limited to the following steps:

[0094] Step 1: Obtain the accident dataset, streaming traffic flow dataset, and road section information dataset, as follows:

[0095] The collected accident data sets include: accident time, accident location, accident severity, accident rescue duration, number of vehicles involved in the accident, type of vehicles involved in the accident, license plate information involved in the accident, etc.

[0096] The collected streaming traffic flow dataset is obtained from the highway ETC gantry toll collection system, including vehicle passing record time, vehicle license plate number, vehicle type, number of the ETC gantry that the vehicle passes through, vehicle model information, etc.

[0097] The collected road section information data set includes the length of the road section, the line type of the road section, the location information of the ETC gantry on the road section, the number of lanes on the road section, the direction of the road section, etc.

[0098] The road section information, streaming traffic flow information and accident data information are integrated through the time and location of the accident, the road section and the location of the ETC gantry.

[0099] Step 2: Split the streaming traffic data according to the accident data and the road section information data to form an accident data set and a non-accident data set containing multiple traffic characteristics, as follows:

[0100] First, if Figure 2 As shown, the road section is divided, and according to the relative position relationship between the ETC gantry and the road section, the part between any two gantries is divided into a separate road section unit as the basic unit for traffic feature extraction;

[0101] Secondly, based on each road section unit, combined with the streaming traffic flow data, the traffic characteristics of the upstream road section unit and the downstream road section unit of each predicted road section unit are extracted respectively. The minimum statistical calculation time of the traffic characteristics is 1 minute, and the aggregation time interval is formulated according to the needs. In this embodiment, 5 minutes is selected as the time interval, that is, the indicator is calculated by 5 1-minute indicators, and the accident traffic characteristics and non-accident traffic characteristics are both 5-10 minutes before the accident record. For example, a traffic accident occurs at 17:10 on January 1, 2024. Then the time interval of an extracted accident traffic feature is from 17:00 on January 1, 2024 to 17:05 on January 1, 2024. The time interval for extracting a non-accident traffic feature is matched on this basis. The principle is the same time interval of the same season and the same day, and the accident time cannot be included in the hour before and after the time interval.

[0102] A total of 28 traffic characteristics were selected, namely: the average traffic flow of the upstream section unit, the average traffic flow of the downstream section unit, the absolute value of the difference between the upstream and downstream section unit traffic flow, and the coefficient of variation of the upstream and downstream section unit traffic flow; the average vehicle speed of the upstream section unit, the average vehicle speed of the downstream section unit, the absolute value of the difference between the upstream and downstream section unit average vehicle speed, and the coefficient of variation of the upstream and downstream section unit average vehicle speed; the unit time occupancy rate of the upstream section unit, the unit time occupancy rate of the downstream section, the absolute value of the difference between the upstream and downstream section unit time occupancy rate, and the coefficient of variation of the upstream and downstream section unit time occupancy rate; the upstream section unit The extreme difference of unit vehicle speed, the extreme difference of unit vehicle speed in the downstream section, the absolute value of the difference of the extreme difference of unit vehicle speed in the upstream and downstream sections, and the coefficient of variation of the extreme difference of unit vehicle speed in the upstream and downstream sections; the proportion of unit truck flow in the upstream section, the proportion of unit truck flow in the downstream section, the absolute value of the difference of the proportion of truck flow in the upstream and downstream sections, and the coefficient of variation of the proportion of unit truck flow in the upstream and downstream sections; the proportion of unit merging traffic volume in the upstream section, the proportion of unit merging traffic volume in the downstream section, the absolute value of the difference of the proportion of unit merging traffic volume in the upstream and downstream sections, and the coefficient of variation of the proportion of unit merging traffic volume in the upstream section; the proportion of unit vehicle arrival in the upstream section GINI Coefficient, downstream section unit vehicle arrival GINI Coefficient, upstream and downstream road unit vehicle arrival GINI The absolute value of the coefficient difference, the arrival time of the vehicle in the upstream and downstream sections GINI coefficient of variation;

[0103] Step 3: Use the random forest algorithm to sort and filter the traffic features in S2, and retain the important traffic features for subsequent modeling, as follows:

[0104] The accident data set and non-accident data set divided in S2 are merged and input into the random forest algorithm. The constructed variables are sorted using the MGD average Gini coefficient reduction value provided by the random forest algorithm. The larger the variable MDG, the more important the variable is. That is, the important variables that affect the risk of traffic accidents are screened out with the help of MDG sorting, and only the variables with MGD values ​​above the average are retained for subsequent modeling.

[0105] like Figure 3 As shown in Figure 2, the 28 selected traffic characteristic variables were ranked according to their MGD importance. Figure 4 As shown in the figure, there are 12 traffic characteristics above the MGD average line, namely: the average vehicle flow of the upstream section unit, the average vehicle flow of the downstream section unit, the proportion of truck flow of the downstream section unit, the average vehicle speed of the downstream section unit, the average vehicle speed of the upstream section unit, the proportion of truck flow of the upstream section unit, the coefficient of variation of the average vehicle speed of the upstream and downstream sections unit, the extreme difference of the vehicle speed of the downstream section unit, the time occupancy rate of the upstream section unit, the time occupancy rate of the downstream section unit, the absolute value of the difference of the extreme difference of the vehicle speed of the upstream and downstream sections unit, and the absolute value of the difference of the vehicle flow of the upstream and downstream sections unit. These 12 traffic characteristics are retained for subsequent modeling.

[0106] Step 4: Using the traffic features filtered by S3 as input, a real-time traffic accident risk prediction model based on XGBoost is constructed as follows:

[0107] The S3 merged dataset is divided into a training set and a test set with a ratio of 7:3. The 12 important traffic features after screening are used as input to build a real-time traffic accident risk prediction model based on XGBoost. The prediction labels are 1 and 0, that is, whether there is a traffic accident risk or not.

[0108] Step 5: Resample the model using SMOTE oversampling, NearMiss undersampling, and SMOTE-Tomek hybrid sampling, and optimize the model hyperparameters based on Optuna, as follows:

[0109] When modeling, the ratio of the accident data set and the non-accident data set is also specifically distinguished, using different ratios of 1:1, 1:2, 1:3, 1:4, 1:5, 1:7, and 1:10.

[0110] During the modeling process, SMOTE oversampling, NearMiss undersampling and SMOTE-Tomek hybrid sampling methods were introduced to the training set, while the test set remained unchanged, in order to judge and select the optimal training model.

[0111] Based on the python Optuna library, the hyperparameters of the constructed XGBoost real-time traffic accident risk prediction model are optimized. The optimized hyperparameters are: number of trees , Tree Depth , learning rate , the minimum sample weight in the child node and , the minimum loss function drop required for node splitting , sub-sample ratio , the proportion of features randomly sampled by each tree , the weight of the L2 regularization term , the weight of the L1 regularization term .

[0112] Then the real-time traffic accident risk prediction model based on XGBoost was used to The value is the final optimization goal of the model, and the models at different scales are trained.

[0113] Step 6: Compare the model performance and select the corresponding model according to the actual application requirements for accuracy, sensitivity and false alarm rate. Access real-time data and output real-time traffic safety risks. The specific performance of the model is as follows:

[0114] Table 1 Specific performance of models with different scales

[0115] ;

[0116] Embodiment 2

[0117] This embodiment provides a real-time traffic accident risk prediction device based on streaming traffic flow data, such as Figure 5 As shown, it includes the following modules:

[0118] Data preprocessing module: used to collect original accident information, streaming traffic flow information, and road section information data sets, and process them into standard CSV format, while performing data segmentation and data fusion, and retaining data with complete validity in the field. In a preferred embodiment, the data preprocessing module includes a data receiver, a first data processor unit, and a data storage unit.

[0119] The data receiver is used to input various raw data in csv format into the data processor, and the data processor cleans, calculates, and counts the raw data according to the rules in the embodiment. A total of 2843 accident traffic feature set data and 28430 non-accident traffic feature set data are used. The accident traffic feature sets are all from 5-10 minutes before the traffic accident. The data storage unit is used to store the data processed by the data processor for subsequent use.

[0120] Feature extraction and screening module: used to extract features from fused data, and screen the features to retain important features for subsequent machine learning modeling. In a preferred embodiment, feature extraction includes: a second data processor unit and a third data processor unit, which are used to convert the processed data into traffic features that can be used for learning. The second processing unit is responsible for inputting traffic features into the random forest to obtain the importance ranking of traffic features; the third processing unit is responsible for determining whether the variable importance is higher than the average importance, and if it is higher than the average importance, it is retained.

[0121] Model training module: input the features processed by the feature extraction and screening module, adjust the model's hyperparameters such as the number of trees, tree depth, and learning rate, and then train each model and save the best model. In a preferred embodiment, the model training module includes: a fourth data processor unit, a fifth data processor unit, and a model memory. The fourth data processor unit is responsible for constructing models with different ratios of accident data to non-accident data sets; the fifth data processor unit is responsible for training the model with optimal parameters; the model memory is used to store the optimal hyperparameters and the corresponding model.

[0122] Model comparison module: The models under the above-mentioned various proportions have different accuracy, sensitivity and false alarm rate effects. In a preferred embodiment, the corresponding model can be selected according to the actual accuracy, sensitivity and false alarm rate requirements according to actual needs.

[0123] Real-time accident risk prediction module: Based on the real-time traffic data accessed, the optimal model is run to predict the traffic safety risk on a certain highway section unit in the future. In a preferred embodiment, the real-time accident risk prediction module includes a data receiver, a model reader, a model processor, and a data outputter. The data receiver is used to input the real-time traffic data into the model processor; after the model processor reads the optimal model through the model reader and runs the entire program of the model, it transmits the result to the data outputter, and the data outputter outputs the final result.

[0124] The ETC toll gantries widely deployed on highways today can generate a large amount of historical and real-time streaming traffic flow big data. Since such streaming big data can record the passage information of each vehicle in detail, more traffic features can be obtained for the construction of real-time traffic accident risk prediction models. Therefore, the present invention proposes a method that can combine streaming traffic flow data to obtain more refined traffic flow features to improve the performance of real-time traffic accident risk prediction models.

[0125] Therefore, the present invention adopts the above-mentioned traffic accident risk prediction method and device based on streaming traffic flow data, which can improve the accuracy of real-time traffic accident risk prediction at the highway section level, which is of great significance for improving highway traffic safety.

[0126] It is worth noting that the contents not elaborated in detail in the present invention are all prior art and are well known to those skilled in the art.

[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A traffic accident risk prediction method based on streaming traffic flow data, characterized in that: The following steps are involved: S1. Obtain accident dataset, streaming traffic flow dataset, and road section information dataset; The accident data set includes: the time of the accident, the location of the accident, the severity of the accident, the duration of the accident rescue, the number of vehicles involved in the accident, the type of vehicles involved in the accident, and the license plate information involved in the accident; The streaming traffic flow dataset is obtained from the highway ETC gantry toll collection system, including vehicle passing record time, vehicle license plate number, vehicle type, number of the ETC gantry through which the vehicle passes, and vehicle model information; The road section information data set includes the length of the road section, the line type of the road section, the location information of the ETC gantry on the road section, the number of lanes of the road section and the direction of the road section; S2, dividing the streaming traffic data according to the accident data and the road section information data to respectively form an accident data set and a non-accident data set containing multiple traffic characteristics; Step S2 includes the following sub-steps: S201, dividing the road section, according to the relative position of the ETC gantries and the road section, dividing the part between any two gantries into a separate road section unit as a basic unit for traffic feature extraction; S202: Based on each road segment unit, the traffic characteristics of the upstream road segment unit and the downstream road segment unit of each predicted road segment unit are extracted in combination with the streaming traffic flow data. The minimum statistical calculation time of the traffic characteristics is 1 minute. Under the premise of a determined aggregation time interval, a total of 28 traffic characteristics are obtained, which are: 1) Average traffic volume of upstream road section unit , Average traffic volume of downstream road section unit , the absolute value of the difference in traffic volume between upstream and downstream sections , the coefficient of variation of unit traffic volume of upstream and downstream sections , the formula is as follows: ; ; ; , ; in, It is the upstream section unit gantry U 1. Traffic volume passing through; It is the upstream section unit gantry U 2. Traffic volume passing through; It is the downstream section unit gantry D 1. Traffic volume passing through; It is the downstream section unit gantry D 2. Traffic volume passing through; Indicates taking the absolute value; 2) Average vehicle speed of upstream section unit , average vehicle speed of downstream section unit , the absolute value of the average speed difference between the upstream and downstream sections , the average vehicle speed variation coefficient of upstream and downstream sections , the formula is as follows: , ; , ; ; , ; in, It is the upstream section unit The speed of vehicles passing through; It is the upstream section unit Car on upstream gantry U 2. The travel time at each location; It is the upstream section unit Car on upstream gantry U 1. The travel time of a place; m is the number of vehicles with travel time records in the upstream road segment unit; It is the downstream section unit j The speed of vehicles passing through; It is the downstream section unit j Vehicle on downstream gantry D 2. The travel time at each location; It is the downstream section unit j Vehicle on downstream gantry D 1. The travel time of a place; n is the number of vehicles with travel time records in the downstream road segment unit; is the length of the upstream segment; is the length of the downstream segment; 3) Unit time occupancy rate of upstream section , Downstream section unit time occupancy rate , the absolute value of the difference in unit time occupancy rate between the upstream and downstream sections , Coefficient of variation of unit time occupancy rate of upstream and downstream sections , the formula is as follows: ; ; ; , ; in, It is the upstream section unit gantry U 1 time occupancy rate; It is the upstream section unit gantry U 2 time occupancy rate; It is the downstream section unit gantry D 1 time occupancy rate; It is the downstream section unit gantry D 2 time occupancy rate; 4) Extreme speed difference of upstream section unit , the speed difference of the downstream section unit , the absolute value of the speed difference between the upstream and downstream sections , the coefficient of variation of the speed range of the upstream and downstream sections , the formula is as follows: ; ; ; ; ; in, is the maximum vehicle speed of the upstream segment unit; is the minimum vehicle speed of the upstream road segment unit; is the maximum vehicle speed of the downstream segment unit; is the minimum vehicle speed of the downstream road segment unit; 5) Ratio of unit truck traffic in upstream section , the proportion of unit truck traffic in the downstream section , the absolute value of the difference in truck traffic proportion between upstream and downstream sections , Coefficient of variation of unit truck flow ratio in upstream and downstream sections , the formula is as follows: ; ; ; ; ; in, TF U2 It is the upstream section unit gantry U 2. The amount of truck traffic passing through; TF U1 It is the upstream section unit gantry U 1. The amount of truck traffic passing through; TF D2 It is the downstream section unit gantry D 2. The amount of truck traffic passing through; TF D1 It is the downstream section unit gantry D 1. The amount of truck traffic passing through; 6) Proportion of merging traffic volume in upstream sections , the proportion of merging traffic volume in the downstream section , the absolute value of the difference in the proportion of merging traffic volume of upstream and downstream sections , Coefficient of variation of the proportion of unit merging traffic in upstream and downstream sections , the formula is as follows: ; ; ; ; ; in, is the merging traffic volume of the upstream section unit; is the merging traffic volume of the downstream section unit; 7) The upstream section unit vehicle arrival imbalance coefficient, also known as GINI Gini coefficient, vehicle arrival rate of upstream section GINI coefficient , the downstream section unit vehicle arrives GINI coefficient , Upstream and downstream section unit vehicles arrive GINI The absolute value of the coefficient difference , Upstream and downstream section unit vehicles arrive GINI Coefficient of variation , the formula is as follows: ; ; ; ; ; in, It is the upstream section unit gantry U 1 GINI coefficient; It is the upstream section unit gantry U 2 GINI coefficient; It is the downstream section unit gantry D 1 GINI coefficient; It is the downstream section unit gantry D 2 GINI coefficient; S203, dividing the traffic features extracted at the accident time into an accident data set, and dividing the traffic features extracted at the non-accident time into a non-accident data set; S3, sort and filter the traffic features by importance based on the random forest algorithm, and retain the important traffic features; S4, using the traffic features filtered in S3 as input, building a real-time traffic accident risk prediction model based on XGBoost; S5. The real-time traffic accident risk prediction model is resampled using three methods: SMOTE oversampling, NearMiss undersampling, and SMOTE-Tomek hybrid sampling. The hyperparameters of the real-time traffic accident risk prediction model are optimized based on Optuna. S6. Evaluate and compare real-time traffic accident risk prediction models, and access real-time data to output real-time prediction results.

2. A traffic accident risk prediction method based on streaming traffic flow data according to claim 1, characterized in that: The accident data set and the non-accident data set in step S3 are combined and input into the random forest algorithm. The MGD average Gini coefficient value provided by the random forest algorithm is used to sort the traffic characteristics and screen out the important variables that affect the risk of traffic accidents.

3. The method for predicting traffic accident risk based on streaming traffic flow data according to claim 2, characterized in that: In step S4, the traffic features sorted in S3 are divided into a training set and a test set with a ratio of 7:

3.

4. The method for predicting traffic accident risk based on streaming traffic flow data according to claim 1, characterized in that: In step S5, the optimized hyperparameters are: Number of trees , Tree Depth , learning rate , the minimum sample weight in the child node and , the minimum loss function drop required for node splitting , sub-sample proportion , the proportion of features randomly sampled by each tree , the weight of the L2 regularization term , the weight of the L1 regularization term ; Then the real-time traffic accident risk prediction model based on XGBoost was used to The value is the final optimization goal of the model, and it is trained under different ratios of accident data sets to non-accident data sets.

5. The method for predicting traffic accident risk based on streaming traffic flow data according to claim 4, characterized in that: In step S6, the accuracy , Sensitivity and false positive rate The performance of the model is evaluated and compared using the following indicators: ; ; ; in, is the number of samples where no accident actually occurred and no accident was predicted to occur, is the number of samples where no accident actually occurred but an accident was predicted to occur, is the number of samples where an accident actually occurred and was predicted to occur, is the number of samples where an accident actually occurred but was predicted not to occur.

6. A device for predicting traffic accident risk based on streaming traffic flow data according to any one of claims 1 to 5, characterized in that: include: Data preprocessing module: used to collect original accident data sets, streaming traffic flow data sets, and road section information data sets, and process them into standard CSV format, while performing data segmentation and data fusion to retain data with complete validity in the fields; Feature extraction and screening module: used to extract features from fused data, screen features, and retain important features; Model training module: input the features processed by the feature extraction and screening modules, adjust the number of trees, tree depth, and learning rate of the model, train each model, and save the best model; Model comparison module: compares the accuracy, sensitivity and false alarm rate of the training model under different numbers of trees, tree depths and learning rates; Real-time accident risk prediction module: Based on the real-time traffic data connected, the module runs the selected best model to predict the traffic safety risk on a certain highway section unit in the future.

Citation Information

Patent Citations

  • Mountain area highway real-time accident risk prediction method based on incomplete data

    CN117275220A