Road traffic safety prediction method and prediction system based on risk intelligent perception model
By combining K-means clustering and XGBoost algorithm, a road traffic safety prediction model is constructed, which solves the problem of low accuracy in existing technologies and achieves higher accuracy road risk assessment and real-time update capabilities.
Patent Information
- Application Number
- CN202310859133.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-13
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2043-07-13
AI Technical Summary
Existing methods have low accuracy in predicting road traffic safety and cannot finely distinguish data differences under different traffic conditions, resulting in low model evaluation accuracy.
A risk assessment algorithm combining K-means clustering and XGBoost is adopted. The algorithm performs offline clustering on the original traffic flow parameter data, uses a base server for real-time data classification, and dynamically updates the model to improve prediction accuracy.
This improved the model's training and prediction accuracy, reduced errors, enhanced its ability to distinguish between different traffic conditions, and enabled a more refined road risk assessment.
Smart Images

Figure CN117009772B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and system for predicting road traffic safety, and belongs to the field of traffic information engineering and control. Background Technology
[0002] Developing an intelligent perception model for traffic safety risks on national and provincial highways is of great significance for traffic safety management on these highways. However, due to the complex and diverse traffic operation scenarios on national and provincial highways, and the dynamic and ever-changing road conditions and traffic status, the actual collected data is insufficient to cover all road scenarios and traffic statuses, thus failing to meet the requirements for multi-scenario testing and universality analysis of the intelligent perception and assessment model for traffic safety risks.
[0003] Because of the complex and ever-changing road environment of national and provincial highways, assessing the road traffic risk status of these highways requires comprehensive consideration of various traffic factors. Therefore, the model constructed to address this issue needs to be computationally simple, accurate, and provide clear conclusions. A decision tree model based on a tree structure can extract a series of rules from known historical traffic flow data to classify newly input traffic flow data. Its structure is relatively simple and highly interpretable, which aligns well with the requirements of project risk assessment.
[0004] Among decision tree models, the XGBoost model demonstrates significant advantages in intelligent perception of traffic safety risks. Meng used the XGBoost method to predict the occurrence and duration of accidents from multiple data sources. The model evaluation metrics were accuracy, sensitivity, and precision. [1] Furthermore, Hamiltonl and Schlog demonstrate that XGBoost outperforms several other machine learning techniques, including logistic regression, Bayesian regularized neural networks, SVM, and deep neural networks, in predicting accident probabilities. [2-3] .
[0005] Although XGBoost is a learning algorithm that improves upon the gradient boosting algorithm, if the conventional XGBoost method is used directly to train traffic data, the resulting model cannot distinguish the differences in data under different traffic conditions in a refined manner. Therefore, the accuracy of this model in assessing traffic risk status is relatively low. Summary of the Invention
[0006] The purpose of this invention is to address the problem of low accuracy in road traffic safety prediction using existing methods, and to propose a road traffic safety prediction method and system based on a risk intelligent perception model.
[0007] The specific process of the road traffic safety prediction method based on the risk intelligent perception model is as follows:
[0008] Step 1: Perform initial setup and information collection;
[0009] Step 2: Obtain the historical traffic flow data required for building the intelligent perception model of road traffic safety risks, preprocess the data and label the risk status;
[0010] Select combinations of traffic flow parameters related to intelligent perception of road traffic safety risks from all traffic flow data;
[0011] Step 3: Use K+XGBoost to build a road traffic safety risk intelligent perception model and obtain the trained road traffic safety risk intelligent perception model;
[0012] Step 4: Distribute the trained intelligent perception model for road traffic safety risks to the base server. Use the base server to perform traffic risk analysis on the real-time traffic flow data detected by the road detectors, visualize the analysis results, and dynamically update the intelligent perception model for road traffic safety risks over time.
[0013] The beneficial effects of this invention are as follows:
[0014] To refine the prediction process of the model, improve the training accuracy, and obtain more precise results, this invention proposes an improved risk assessment model that integrates K-means and XGBoost.
[0015] The K-XGBoost risk assessment model essentially involves first performing offline clustering of raw traffic flow parameter data on the main server using the K-means clustering method. The offline clustering results are then used as the standard for risk assessment and transmitted to each grassroots server. After the road detectors detect real-time traffic flow parameter data, the real-time data is input into the grassroots servers. The XGBoost method is then used to classify each data point online, determining the current road risk level of the road segment and whether there are any traffic accidents on that segment. The results are then visualized to facilitate real-time monitoring of road risk status.
[0016] Due to the low generalization and low precision of traditional XGBoost models, this paper proposes a K-XGBoost optimized risk assessment algorithm. To determine the advantages of the K-XGBoost risk assessment algorithm compared to the traditional XGBoost classification method, the source data is first classified using ordinary XGBoost. The specific process is as follows: After the traffic flow data is labeled with risk status, it is input into MATLAB for traditional XGBoost training. Then, the model trained by the traditional XGBoost algorithm is used to predict data with known risk status. The model's prediction performance is evaluated using parameters such as root mean square error, mean square error, residual prediction, mean absolute error, and prediction accuracy. Then, the same set of data is trained using the K-XGBoost optimized risk assessment algorithm, and the prediction effect is evaluated. The comparison shows that in the model evaluation of regular road sections, long downhill road sections, tunnel sections, and road sections affected by severe weather, the improved model has lower errors and improved prediction accuracy to varying degrees when perceiving traffic risks compared to the traditional XGBoost model. Attached Figure Description
[0017] Figure 1 This is a flowchart of the present invention;
[0018] Figure 2 A flowchart for establishing an intelligent perception model of road traffic safety risks using K+XGBoost;
[0019] Figure 3 This is a schematic diagram of a traffic simulation environment (normal state) for a regular road section;
[0020] Figure 4 This is a schematic diagram of a traffic simulation environment (accident state) on a regular road section;
[0021] Figure 5 This is a schematic diagram of a traffic simulation environment (normal state) for a tunnel section;
[0022] Figure 6 This is a schematic diagram of a traffic simulation environment (accident state) for a tunnel section. Detailed Implementation
[0023] Specific Implementation Method 1: The specific process of the road traffic safety prediction method based on the risk intelligent perception model in this implementation method is as follows:
[0024] Step 1: Perform initial setup and information collection;
[0025] Step 2: Obtain the historical traffic flow data required for building the intelligent perception model of road traffic safety risks, preprocess the data and label the risk status; in order to simplify the model training process without affecting the model accuracy, select the combination of traffic flow parameters related to intelligent perception of road traffic safety risks from all traffic flow data.
[0026] The original traffic flow data is diverse. If all types of traffic flow parameters are used to train the model, not only will the computation time be long and unable to meet real-time requirements, but there is also a risk of overfitting. Therefore, it is necessary to select a few traffic flow parameters that are strongly correlated with risk assessment for model training. (For example, if there are 17 traffic flow parameters, but only 6 of them are relevant to our model, then using only these 6 parameters to train the model can achieve good results and simplify the computation.)
[0027] Step 3: Use K+XGBoost to build a road traffic safety risk intelligent perception model and obtain the trained road traffic safety risk intelligent perception model;
[0028] Step 4: Distribute the trained intelligent perception model for road traffic safety risks to the base server. Use the base server to perform traffic risk analysis on the real-time traffic flow data detected by the road detectors, visualize the analysis results, and dynamically update the intelligent perception model for road traffic safety risks over time.
[0029] Specific Implementation Method Two: This implementation method differs from Specific Implementation Method One in that initial setup and information collection are performed in step 1; the specific process is as follows:
[0030] Step 1.1: Identify the road sections that require intelligent traffic risk perception, and clarify the road level (expressway, primary road, secondary road, etc.), number of lanes, road alignment, cross-section, etc. of the road sections;
[0031] Step 1.2: Determine the deployment locations of intelligent risk perception detectors along the road (any detector capable of detecting vehicle position, speed, and arrival time is sufficient), and record the road attributes (sharp turns, tunnels, long downhill slopes, etc.) at the locations detected by the detectors. (Different road attributes require different traffic flow parameters for risk assessment. For example, on long downhill sections, more attention is paid to vehicle acceleration and deceleration, while on tunnel sections, more attention is paid to the standard deviation of vehicle speed. Therefore, it is necessary to label the road attributes of the road sections.)
[0032] Step 1.3: Select appropriate traffic flow parameters according to different road attributes;
[0033] Construct a traffic flow parameter dataset corresponding to accident data and traffic flow operation data. The traffic flow parameter dataset is the risk perception dataset.
[0034] The traffic flow parameter data set is obtained through the detector and includes flow rate, density, speed, and the time when vehicles arrive at the detector.
[0035] The other steps and parameters are the same as in Specific Implementation Method 1.
[0036] Specific Implementation Method Three: This implementation method differs from Specific Implementation Method One or Two in that, in step 2, historical traffic flow data required for constructing the intelligent perception model of traffic safety risks is obtained, the data is preprocessed, and risk status is calibrated. To simplify the model training process without affecting model accuracy, combinations of traffic flow parameters related to intelligent perception of traffic safety risks are selected from all traffic flow data. The specific process is as follows:
[0037] 2.1: Establish a main server and base servers for intelligent perception of traffic safety risks. Each base server corresponds to one or more road detectors with the same road attributes. Use the base servers to obtain traffic flow parameters from the historical risk perception dataset of each road detector.
[0038] The traffic flow parameters in the risk perception dataset include traffic flow parameter data (including accident data and traffic flow operation data) corresponding to accident data and traffic flow operation data.
[0039] Preliminary processing of traffic flow parameters in the historical risk perception dataset yields specific values for each parameter. (The data detected by the detectors represents the speed of a vehicle at a specific location at a given time. Preliminary processing involves summarizing and calculating the raw data detected by these detectors to obtain various traffic flow parameters. For example, the flow rate over a five-minute period is the number of vehicles passing through a specific cross-section within those five minutes. The average speed is the average speed over those five minutes.) This results in multi-dimensional traffic flow parameter data for each detector (e.g., using a combination of 17 traffic flow parameters as the risk perception dataset, including flow rate, average speed, density, speed standard deviation, speed coefficient of variation, traffic congestion index, temporal speed fluctuation characteristics, spatial speed fluctuation characteristics, temporal density fluctuation characteristics, spatial density fluctuation characteristics, temporal traffic flow surge ratio, spatial traffic flow surge ratio, average acceleration, temporal acceleration fluctuation characteristics, spatial acceleration fluctuation characteristics, acceleration standard deviation, and acceleration coefficient of variation).
[0040] 2.2: Based on the accident data, the traffic flow parameters in the risk perception dataset are calibrated using a "0-1" method. The specific process is as follows:
[0041] In the risk perception dataset, the data under normal operating conditions in each traffic flow parameter are labeled as 0, and the data under accident conditions in each traffic flow parameter are labeled as 1.
[0042] 2.3: To improve the accuracy of the intelligent road risk perception model and simplify the model training process, traffic flow parameter combinations related to risk perception should be designed for different road attributes. This involves selecting traffic flow parameters from the risk perception dataset that are significantly correlated with the occurrence of traffic accidents under that road attribute, and constructing traffic flow parameter combinations for different road attributes. (For example, traffic congestion index, speed variation coefficient, and other traffic flow parameters are significantly correlated with traffic risk on regular road sections; therefore, the risk perception parameter combinations for regular road sections should include both.) The specific implementation steps are as follows:
[0043] Using the multidimensional traffic flow parameters in the risk perception dataset under the Ath road attribute as independent variables and the 0-1 calibration results of the data as dependent variables, correlation analysis was performed to obtain the traffic flow parameter combinations under the Ath road attribute whose correlation analysis was below the threshold; that is, a significance test was performed on each traffic flow data to test whether it was correlated with the occurrence of traffic accidents under a specific road attribute.
[0044] Obtain the traffic flow parameter combinations under all road attributes, that is, filter out the traffic flow parameter combinations related to intelligent perception of traffic safety risks.
[0045] Other steps and parameters are the same as in specific implementation method one or two.
[0046] Specific Implementation Method Four: This implementation method differs from Specific Implementation Methods One to Three in that, in section 2.3, the multidimensional traffic flow parameters in the risk perception dataset under the Ath road attribute are used as independent variables, and the 0-1 calibration results of the data are used as dependent variables. Correlation analysis is performed to obtain the traffic flow parameter combinations under the Ath road attribute whose correlation analysis is below a threshold; that is, a significance test is performed on each traffic flow data to test whether it is correlated with the occurrence of traffic accidents under a specific road attribute; the specific process is as follows:
[0047] 2.3.1: Significance test process:
[0048] (1) Perform hypothesis testing: H0: A certain traffic flow parameter is related to the occurrence of an accident; H1: A certain traffic flow parameter is not related to the occurrence of an accident.
[0049] (2) Assume that the traffic flow parameters in the risk perception dataset under the Ath road attribute are as follows: Traffic flow parameters With kurtosis K, traffic flow parameters If the skewness is S, then construct the test statistic:
[0050]
[0051] Among them, ~χ 2 (2) indicates that it follows a chi-square distribution with 2 degrees of freedom; n represents the sample size;
[0052] (3) Obtain the corresponding significance p-value by looking up the chi-square distribution table in JB (generally P = 0.05);
[0053] 2.3.2: Traffic flow parameters with a significance p-value below 0.05 are significantly correlated with accident occurrence. Traffic flow parameters with a significance p-value below 0.05 are extracted from the test results. Based on these traffic flow parameters with a significance p-value below 0.05, a combination of traffic flow parameters for the Ath road attribute with a correlation analysis value below the threshold (significance p-value below 0.05) is constructed. This can reduce the parameter dimensionality and improve the model training speed while ensuring accuracy.
[0054] The lower the p-value, the stronger the correlation. For example, in the tunnel scenario, the significance of six parameters—flow rate (0.027), average speed (0.008), density (0.031), speed coefficient of variation (0.013), traffic congestion index (0.009), and speed standard deviation (0.025)—is less than 0.05. This indicates that these six parameters are significantly correlated with the traffic risk assessment in the tunnel scenario, and the subsequent tunnel risk assessment model only needs these six parameters.
[0055] The other steps and parameters are the same as those in one of the specific implementation methods one to three.
[0056] Specific Implementation Method Five: This implementation method differs from Specific Implementation Methods One to Four in that, in step 3, K+XGBoost is used to establish an intelligent perception model for road traffic safety risks; the specific operation method is as follows, as shown in the appendix. Figure 2 As shown:
[0057] Step 3.1: Based on the traffic flow parameter combination related to intelligent perception of traffic safety risks obtained in Step 2, perform K-Means unsupervised clustering on the traffic flow parameter combination under each road attribute with "0-1" labels to obtain the K-Means unsupervised clustering results, and obtain the corresponding road risk level based on the K-Means unsupervised clustering results;
[0058] The intelligent perception model for road traffic safety risks is divided into the XGBoost risk level prediction model and the XGboost intelligent perception model for traffic accidents.
[0059] Step 3.2: Divide the traffic flow parameter combinations with road risk level labels into training and test sets according to the proportions;
[0060] Step 3.3: Use the road risk level in the training set as the dependent variable and the combination of traffic flow parameters under each road attribute as the independent variable. Input them into the XGBoost risk level prediction model and use cross-validation to adjust the parameters to establish the optimal XGBoost risk level prediction model.
[0061] Step 3.4: Input the test set data from Step 3.2 into the XGBoost risk level prediction model. The XGBoost risk level prediction model outputs the predicted value of the risk status assessment. Compare the predicted value of the risk status assessment with the actual value to obtain the prediction accuracy of the XGBoost risk level prediction model. Use this as a standard to test the XGBoost risk level prediction model's ability to predict risk levels.
[0062] Step 3.5: When the accuracy does not meet the requirements, increase the amount of training data and repeat steps 3.3 to 3.5. When the accuracy is reached or the preset maximum number of iterations is reached, output the optimal XGboost risk level prediction model and the prediction accuracy at this time.
[0063] Step 3.6: Based on the K-Means unsupervised clustering results, divide the traffic flow parameter combinations under each road attribute with "0-1" labels into Group B according to the risk level (the corresponding road risk level is obtained from the K-Means unsupervised clustering results obtained in Step 3.1), and divide the traffic flow parameter combinations under each road attribute with "0-1" labels in each group into training set and test set according to the proportion.
[0064] Step 3.7: Use the “0-1” labels in the training set as dependent variables and the combination of traffic flow parameters under each road attribute as independent variables. Input them into the XGboost traffic accident intelligent perception model for training. Use cross-validation to adjust the parameters to establish the optimal XGboost traffic accident intelligent perception model.
[0065] Step 3.8: Input the test set data from Step 3.6 into the XGboost traffic accident intelligent perception model. The XGboost traffic accident intelligent perception model outputs the accident state prediction value. Compare the accident state prediction value with the actual value to obtain the prediction accuracy of the XGboost traffic accident intelligent perception model. Use this as a standard to test the XGboost risk level prediction model's ability to predict risk levels.
[0066] Step 3.9: When the accuracy does not meet the requirements, increase the amount of training data and repeat steps 3.7 to 3.9. When the accuracy is reached or the preset maximum number of iterations is reached, output the optimal XGboost traffic accident intelligent perception model and the prediction accuracy at this time.
[0067] The other steps and parameters are the same as those in one of the specific implementation methods one to four.
[0068] Specific Implementation Method Six: This implementation method differs from Specific Implementation Methods One to Five in that, in step 3.1, based on the traffic flow parameter combinations related to intelligent perception of traffic safety risks obtained in step 2, K-Means unsupervised clustering is performed on the traffic flow parameter combinations under each road attribute with "0-1" labels to obtain K-Means unsupervised clustering results. Based on the K-Means unsupervised clustering results, the corresponding road risk level is obtained. The specific process is as follows:
[0069] K-Means unsupervised clustering is performed on the traffic flow parameters of each road attribute with "0-1" labels to cluster the risk perception dataset into cluster B. The ratio of data in cluster (RDC) and accident data in total (RCT) of each cluster is determined. The road risk level corresponding to the data in cluster B is labeled according to the ratio of each cluster. The higher the ratio, the higher the road risk level (for example, if B is 5, there are 5 ratios. The cluster with the highest ratio corresponds to the road risk level 5, and so on).
[0070] The formulas for calculating the proportion of cluster data and the proportion of accident data are as follows:
[0071]
[0072] Where: n t n is the total number of samples. e n is the number of samples contained in each cluster. c Let n be the total number of accident samples. a This represents the number of accident samples contained in each cluster.
[0073] The operation process of K-Means unsupervised clustering is as follows:
[0074] (1) First, a suitable value of k needs to be selected. If no prior knowledge is performed, a suitable value of k can be selected through cross-validation.
[0075] (2) After determining the value of k, k initial centroids need to be selected; when selecting centroids, the distance between these centroids cannot be too close;
[0076] (3) Input the traffic flow parameter combination D = {x1 x2 x3 …x} under each road attribute. m}, where k is the number of clusters, N is the maximum number of iterations, and the output is the cluster partition C = {C1 C2 C3 …C}. k};
[0077] (4) Randomly select k data points from all data under each road attribute traffic flow parameter combination as the initial k centroid vectors: {μ1,μ2,μ3,…,μ k};
[0078] (5) For i = 1, 2, 3, ..., N; N is the number of data to be classified;
[0079] a) Initialize the cluster partition C to...
[0080] b) Calculate the i-th data point x under this parameter combination. i and each centroid vector {μ1,μ2,μ3,…,μ k Distance d ij =||x i -μ j ||2; i=1,2,3,…m, j=1,2,3,…k;
[0081] Where |||2 represents the 2-norm of the vector; d ij This represents the distance between the traffic flow parameter combination under the i-th road attribute and the j-th centroid vector;
[0082] The data that needs to be classified is assigned to the group containing the centroid vector that is closest to it. After all the traffic flow parameter combinations under all road attributes are divided, a new set of k datasets (i.e., k clusters) are formed.
[0083] c) Regarding C j The new centroid is recalculated using the combination of traffic flow parameters under all road attributes, j = 1, 2, 3, ..., k, and the calculation formula is shown in Equation 30:
[0084]
[0085] Where x i This represents the i-th data point under this combination of traffic flow parameters.
[0086] d) Calculate the centroid vector of each cluster after classification. If the centroid vector changes, repeat step (5). If none of the k centroid vectors change, go to (6).
[0087] (6) Output cluster partitioning C = {C1C2C3…C} k}
[0088] The other steps and parameters are the same as those in one of the specific implementation methods one to five.
[0089] Specific Implementation Method Seven: This implementation method differs from Specific Implementation Methods One through Six in that, in step 3.4, the test set data is input into the XGBoost risk level prediction model. The XGBoost risk level prediction model outputs a predicted value for risk status assessment. The predicted value for risk status assessment is compared with the actual value to obtain the prediction accuracy of the XGBoost risk level prediction model. This is used as a standard to verify the predictive ability of the XGBoost risk level prediction model for risk levels. The specific evaluation indicators for prediction accuracy are as follows:
[0090] If, in reality, the risk level of a road segment is classified as three (high, medium, and low), the three risk levels are represented by the numbers 2, 1, and 0. The final prediction result of the model is also a single number.
[0091] Assuming that the model predicts the risk level of a road segment every five minutes, and the actual road segment is high-risk (2), while the model predicts low-risk (1), it indicates that there is an error in this prediction. Taking into account multiple predictions, the model is evaluated. The evaluation indicators are as follows.
[0092] ① Root mean square error (RMSE) is the square root of the ratio of the squares of the deviations between the predicted and true values (the predicted value is the risk level predicted by the model, and the true value is the actual road risk level) to the number of observations (n). In actual measurements, RMSE is very sensitive to extremely large or small errors in a set of measurements. Therefore, RMSE can well reflect the precision of the measurement. The calculation formula is as follows:
[0093]
[0094] In the formula: X obs,i To obtain the i-th predicted value of the risk status assessment for the XGboost risk level prediction model;
[0095] X model,i It is the i-th truth value;
[0096] n represents the number of predictions;
[0097] ② Mean squared error is the mean of the sum of squares of the errors between the predicted and actual values. The formula for calculation is shown below:
[0098]
[0099] The meanings of the parameters in the formula are the same as those in (1).
[0100] ③ Mean Absolute Error (MAE), which is the average difference between predicted and true values; the calculation formula is shown below:
[0101]
[0102] The meanings of the parameters in the formula are the same as those in (1).
[0103] ④ The residual prediction is the ratio of the standard deviation of the test set to the standard deviation of the prediction (for example, if there are 1000 data points, each containing a risk level label (2, 1, 0) and a combination of traffic flow parameters, 800 of these data points are used to train the model, which outputs the risk level given the combination of traffic flow parameters. The remaining 200 data points are then used to evaluate the model; this involves analyzing the traffic flow parameter combinations of these 200 data points, determining the risk level (predicted value) of each data point, comparing it with the actual risk level (true value), and evaluating the model's judgment). The calculation formula is shown below:
[0104]
[0105] In the formula: X i Let i be the i-th value in the training set;
[0106] The average value of the training set;
[0107] Y i Let be the i-th residual value, which is the difference between the predicted value and the true value;
[0108] The average value of the residuals;
[0109] ⑤ The prediction accuracy rate (CR) represents the proportion of data whose predicted value matches the true value among all predicted data (if the prediction result is low risk (1) and the true value is also low risk (1), it is considered a correct prediction). The calculation formula is as follows:
[0110]
[0111] When the i-th predicted value of the risk status assessment obtained by the XGboost risk level prediction model equals the true value, a i =1, when the i-th predicted value of the risk status assessment obtained by the XGboost risk level prediction model is not equal to the true value, a i =0.
[0112] The other steps and parameters are the same as those in one of the specific implementation methods one to six.
[0113] Specific Implementation Method Eight: This implementation method differs from Specific Implementation Methods One through Seven in that, in step 3.8, the test set data from step 3.6 is input into the XGboost traffic accident intelligent perception model. The XGboost traffic accident intelligent perception model outputs an accident state prediction value. The predicted accident state value is compared with the actual value to obtain the prediction accuracy of the XGboost traffic accident intelligent perception model. This is used as a standard to test the XGboost risk level prediction model's ability to predict risk levels. The specific evaluation indicators for prediction accuracy are as follows:
[0114] ① Root mean square error (RMSE) is the square root of the ratio of the sum of the squares of the deviations between the predicted and true values to the number of observations (n). In actual measurements, RMSE is highly sensitive to exceptionally large or small errors in a set of measurements. Therefore, RMSE can effectively reflect the precision of the measurement. The calculation formula is shown below:
[0115]
[0116] In the formula: X' obs,i' Let be the i'th predicted value of the traffic accident state assessment obtained by the XGboost intelligent traffic accident perception model;
[0117] X' model,i This is the i'th truth value;
[0118] n' represents the number of predictions;
[0119] ② Mean squared error is the mean of the sum of squares of the errors between the predicted and actual values. The formula for calculation is shown below:
[0120]
[0121] The meanings of the parameters in the formula are the same as those in (1).
[0122] ③ Mean Absolute Error (MAE), which is the average difference between predicted and true values; the calculation formula is shown below:
[0123]
[0124] The meanings of the parameters in the formula are the same as those in (1).
[0125] ④ The residual prediction is the ratio of the standard deviation of the validation set to the standard deviation of the prediction; the calculation formula is shown below:
[0126]
[0127] In the formula: X' i' Let i be the i'th value in the training set;
[0128] The average value of the training set;
[0129] Y' i' Let be the i'th residual value, which is the difference between the predicted value and the true value;
[0130] The average value of the residuals;
[0131] ⑤ The prediction accuracy rate (CR) represents the proportion of data whose predicted value matches the true value out of all predicted data; the calculation formula is shown below:
[0132]
[0133] When the i'-th predicted value of the traffic accident state assessment obtained by the XGboost intelligent traffic accident perception model equals the true value, a' i' =1, when the i'-th predicted value of the traffic accident state assessment obtained by the XGboost traffic accident intelligent perception model is not equal to the true value, a' i' =0;
[0134] The other steps and parameters are the same as those in any of the specific implementation methods one to seven.
[0135] Specific Implementation Method Nine: This implementation method differs from Specific Implementation Methods One through Eight in that, in step 4, the trained intelligent perception model for road traffic safety risks is distributed to the base server. The base server then performs traffic risk analysis on the real-time traffic flow data detected by the road detectors, visualizes the analysis results, and dynamically updates the model over time. The specific operation method is as follows:
[0136] Step 4.1: Distribute the trained intelligent perception models for road traffic safety risks under different road attributes (including the XGboost risk level prediction model and the XGboost traffic accident intelligent perception model; the output of the risk level prediction model is the risk level of the current road segment (high risk 2, medium risk 1, low risk 0); the output of the traffic accident intelligent perception model is whether a traffic accident has occurred on the current road segment ("0 or 1") to each base server according to the principle of corresponding road attributes.
[0137] Step 4.2: When the road detector detects the traffic flow parameters at the current moment, it uploads the traffic flow parameters to the base server and the real-time traffic data storage. The base server uses the intelligent perception model of road traffic safety risk under different road attributes (including the XGboost risk level prediction model and the XGboost traffic accident intelligent perception model) to analyze the traffic flow parameter data, determine the risk level of the current road segment and whether a traffic accident has occurred, and upload the analysis results to the main server. The main server summarizes the information uploaded by all base servers and outputs the visualization.
[0138] Step 4.3: The real-time traffic data storage device uploads the stored data to the historical database of the main server at regular intervals. The main server uses the updated data to repeat steps 2, 3 and 4.1 to complete the real-time update of the intelligent perception model of road traffic safety risks (including the XGboost risk level prediction model and the XGboost traffic accident intelligent perception model) under different road attributes.
[0139] The other steps and parameters are the same as those in one of the specific implementation methods one to eight.
[0140] Specific Implementation Method 10: This implementation method uses a road traffic safety prediction system based on a risk intelligent perception model to execute a road traffic safety prediction method based on a risk intelligent perception model.
[0141] Example 1
[0142] In response to the complex and diverse traffic operation scenarios on national and provincial highways, the dynamic and ever-changing road conditions and traffic status, and the difficulty for detectors to collect data covering all road scenarios and traffic conditions, this paper constructs a traffic safety risk perception model for national and provincial highways to achieve risk assessment and prediction for typical traffic flow operation scenarios. Using VISSIM software, this paper constructs four representative traffic simulation operation scenarios for national and provincial highways: regular road sections, long downhill road sections, tunnel sections, and road sections affected by severe weather. Approximately 2.6 million road operation sample data points under different road conditions and traffic statuses are generated. The rationality of the model is further illustrated by the risk intelligent perception model establishment process for regular road sections and tunnel sections, and the specific implementation process is as follows:
[0143] Step 1: First, based on the analysis of national and provincial roads, a combination of 17 traffic flow parameters is selected as the risk perception dataset, including traffic flow, average speed, density, speed standard deviation, speed coefficient of variation, traffic congestion index, speed temporal fluctuation characteristics, speed spatial fluctuation characteristics, density temporal fluctuation characteristics, density spatial fluctuation characteristics, traffic flow temporal surge ratio, traffic flow spatial surge ratio, average acceleration, acceleration temporal fluctuation characteristics, acceleration spatial fluctuation characteristics, acceleration standard deviation, and acceleration coefficient of variation.
[0144] Step 2: Build two representative road traffic environments on the VISSIM platform, and set relevant traffic flow parameters and detectors to obtain risk perception data while making the simulation environment as close to the real environment as possible, as shown in the figure;
[0145] Step 3: The one-way traffic flow range of the simulated environment is 800-2100 pcu / h. For every 50 pcu / h increase in traffic flow, a set of experiments is designed. The traffic flow data during the operation of the simulated environment can be detected by the data detector, and this data is used as the historical data of the road detector to carry out subsequent model building.
[0146] Step 4: Based on the different road accident states, the acquired risk perception data are labeled as "data under normal operating conditions" (label 0) and "data under accident conditions" (label 1);
[0147] Step 5: Select traffic flow parameters that are significantly correlated with the occurrence of traffic accidents on regular road sections and tunnel sections from the risk perception dataset. Through risk correlation analysis, it can be seen that six parameters, namely flow rate, average speed, density, speed variation coefficient, traffic congestion index, and speed standard deviation, are significantly correlated with the risk status assessment of regular road sections and tunnel sections. Therefore, these six parameters are selected as the combination of risk perception parameters for regular road sections and tunnel sections.
[0148]
[0149]
[0150] Step 7: Take the combination of risk perception parameters for regular road sections and tunnel sections as input, take the data risk level as output, and divide the processed data into training set and test set, and input them into the XGBoost trainer for supervised training.
[0151] Step 8: Evaluate the risk level prediction model obtained from the training. The root mean square error, mean square error, residual prediction error, mean absolute error, and accuracy of the prediction results of the model are shown in the table below. The table shows that the prediction accuracy meets the requirements.
[0152] Evaluation indicators Root mean square error Mean square error Residual Predicted Residue Mean Absolute Error Prediction accuracy regular road sections 0.0936 0.0088 6.6094 0.0083 99.27% Tunnel section 0.2723 0.0741 2.8052 0.2086 99.64%
[0153] Step 9: Train the intelligent traffic accident perception model for different risk levels. Take the combination of risk perception parameters of the tunnel section as input and the 0-1 calibration result of the section as output to construct a new multi-dimensional traffic flow parameter sequence and input it into the XGBoost trainer for supervised training.
[0154] Step 10: Evaluate the intelligent perception model for traffic accidents on regular road sections and tunnel sections obtained from the training. The root mean square error, mean square error, residual prediction error, mean absolute error, and accuracy of the model prediction results are shown in the table below. The prediction accuracy meets the requirements.
[0155] Evaluation indicators Root mean square error Mean square error Residual Predicted Residue Mean Absolute Error Prediction accuracy regular road sections 0.3690 0.1362 1.2857 0.2557 78.32% Tunnel section 0.3250 0.1056 1.4750 0.2108 84.44%
[0156] The training of intelligent perception models for road traffic safety risks (including risk level prediction models and intelligent perception models for traffic accidents) for conventional road sections and tunnel sections has been completed.
[0157] Finally, through simulation, we can basically confirm that the simulation results are consistent with reality and have certain reference value and practical significance. The established national and provincial highway traffic safety risk perception model can help drivers and relevant department personnel to predict emergency risk situations more efficiently, judge risk categories, take measures in advance to prevent accident risks, reduce property losses and casualties to a certain extent, and provide more refined guidance for engineering practice.
[0158] The main idea of this method is to first construct a multi-dimensional traffic dataset. When performing risk perception on different road segments, several data points from the multi-dimensional dataset can be selected to form different data combinations. The most suitable data combination for that road segment is then used for more effective risk perception. Secondly, this method first uses the K-means method for unsupervised learning, then XGBoost for supervised learning, and finally combines the two for risk perception. Since there are various unsupervised and supervised learning methods, in practical applications, appropriate learning methods can be selected to replace the two methods, thus accomplishing the task of intelligent traffic safety risk perception.
[0159] The optional embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the embodiments of the present invention are not limited to the specific details of the above embodiments. Within the scope of the technical concept of the embodiments of the present invention, various simple modifications can be made to the technical solutions of the embodiments of the present invention, and these simple modifications all fall within the protection scope of the embodiments of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0160] This invention may have other embodiments. Without departing from the spirit and essence of this invention, those skilled in the art can make various corresponding changes and modifications according to this invention, but these corresponding changes and modifications should all fall within the protection scope of the appended claims.
Claims
1. A road traffic safety prediction method based on a risk intelligent perception model, characterized in that: The method specifically comprises the following steps: Step 1: initial setting and information collection; Step 2: obtaining historical traffic flow data required for constructing a road traffic safety risk intelligent perception model, pre-processing the data and marking the risk state; Step 3: using K+XGBoost to establish a road traffic safety risk intelligent perception model and obtaining a trained road traffic safety risk intelligent perception model; the specific operation method is as follows: Step 3.1: based on the traffic flow parameter combination related to traffic safety risk intelligent perception obtained in step 2, performing K-Means unsupervised clustering on the traffic flow parameter combination under each road attribute with "0-1" label to obtain K-Means unsupervised clustering results, and obtaining the corresponding road risk level based on the K-Means unsupervised clustering results; The road traffic safety risk intelligent perception model comprises an XGBoost risk level prediction model and an XGboost traffic accident intelligent perception model; Step 3.2: dividing the traffic flow parameter combination with road risk level label into a training set and a test set in proportion; Step 3.3: taking the road risk level in the training set as the dependent variable and the traffic flow parameter combination under each road attribute as the independent variable, inputting the XGBoost risk level prediction model, and using the cross-validation method to adjust the parameters to establish the optimal XGBoost risk level prediction model; Step 3.4: taking the "0-1" label in the training set as the dependent variable and the traffic flow parameter combination under each road attribute as the independent variable, inputting the XGboost traffic accident intelligent perception model for training, and using the cross-validation method to adjust the parameters to establish the optimal XGboost traffic accident intelligent perception model; Step 4: distributing the trained road traffic safety risk intelligent perception model to a base server, using the base server to analyze the real-time traffic flow data detected by the road detector, visualizing the analysis results, and dynamically updating the road traffic safety risk intelligent perception model over time. The initial setting and information collection in step 1 specifically comprises the following steps:
2. The road traffic safety prediction method based on the risk intelligent perception model according to claim 1, characterized in that: Step 1.1: determining the road section requiring traffic risk intelligent perception, and clearly defining the road level, number of lanes, road alignment and cross section of the road section; Step 1.2: determining the layout position of the road line risk intelligent perception detector, and recording the road attributes of the place detected by the detector; Step 1.3: constructing a traffic flow parameter data set corresponding to accident data and traffic flow operation data, which is a risk perception data set; The traffic flow parameter data set is obtained by the detector, and the traffic flow parameter data set comprises flow, density, speed and the time when a vehicle passes through the detector. 3. The road traffic safety prediction method based on the risk intelligent perception model according to claim 2, characterized in that: The historical traffic flow data required for constructing the traffic safety risk intelligent perception model in step 2 is obtained, the data is preprocessed and the risk state is calibrated; the traffic flow parameter combination related to traffic safety risk intelligent perception is screened from all traffic flow data; the specific process is: 2.1: Establish a traffic safety risk intelligent perception total server and a base server, each base server corresponds to one or several road detectors with the same road attribute, and the historical risk perception data of each road detector is obtained by using the base server to obtain each traffic flow parameter; The traffic flow parameters in the risk perception data set include traffic flow parameter data corresponding to accident data and traffic flow operation data; The traffic flow parameter data in the historical risk perception data set is preliminarily processed to obtain the specific values of the traffic flow parameters in the risk perception data set, that is, each detector corresponds to multi-dimensional traffic flow parameter data; 2.2: According to the accident data, the traffic flow parameter data in the risk perception data set is labeled as "0-1", and the specific process is: The data in the risk perception data set under normal operation state is labeled as 0 label, and the data in the risk perception data set under accident state is labeled as 1 label; 2.3: The multi-dimensional traffic flow parameters in the risk perception data set under the A road attribute are used as independent variables, and the 0-1 labeling results of the data are used as dependent variables, and correlation analysis is performed to obtain the traffic flow parameter combination under the A road attribute with correlation analysis below the threshold value; Obtain the traffic flow parameter combination under all road attributes, that is, screen out the traffic flow parameter combination related to traffic safety risk intelligent perception.
4. The road traffic safety prediction method based on the risk intelligent perception model according to claim 3, characterized in that: In 2.3, the multi-dimensional traffic flow parameters in the risk perception data set under the A road attribute are used as independent variables, and the 0-1 labeling results of the data are used as dependent variables, and correlation analysis is performed to obtain the traffic flow parameter combination under the A road attribute with correlation analysis below the threshold value; the specific process is: 2.3.1: Significance test process: (1) Hypothesis test H0: a certain traffic flow parameter is related to accident occurrence, H1: a certain traffic flow parameter is not related to accident occurrence; (2) Suppose that the traffic flow parameter in the risk perception data set under the A-th road attribute is The kurtosis of the traffic flow parameter is K, and the skewness of the traffic flow parameter is S, then the test statistic is constructed: where ~χ 2 (2) indicates that it follows a chi-square distribution with 2 degrees of freedom; n indicates the sample size; (3) Obtain the corresponding significance p value by JB chi-square distribution table; 2.3.2: Extract the traffic flow parameters with significance less than 0.05 in the test results, and construct the traffic flow parameter combination under the A road attribute with correlation analysis below the threshold value based on the traffic flow parameters with significance less than 0.
05.
5. The method of claim 4, wherein the method further comprises: determining a risk level of the road traffic safety based on the risk intelligent perception model. In step 3, the K+XGBoost is used to establish a road traffic safety risk intelligent perception model; the specific operation method further includes: Step 3.5: Input the test set data of step 3.2 into the XGBoost risk level prediction model, and the XGBoost risk level prediction model outputs the prediction value of the risk state evaluation; compare the prediction value of the risk state evaluation with the true value to obtain the prediction accuracy of the XGboost risk level prediction model; Step 3.6: When the accuracy does not meet the requirements, expand the data quantity of the training set and repeat steps 3.3, 3.5 and 3.6, and output the optimal XGboost risk level prediction model and the prediction accuracy at this time when the accuracy degree is reached or the maximum number of iterations is reached; Step 3.7: According to the K-Means unsupervised clustering result, the traffic flow parameter combinations with "0-1" labels under each road attribute are divided into B groups according to the risk level, and each group of traffic flow parameter combinations with "0-1" labels under each road attribute is divided into a training set and a test set according to the proportion; Step 3.8: Input the test set data of step 3.7 into the XGboost traffic accident intelligent perception model, and the XGboost traffic accident intelligent perception model outputs the accident state prediction value. The accident state prediction value is compared with the true value to obtain the prediction accuracy of the XGboost traffic accident intelligent perception model; Step 3.9: When the accuracy does not meet the requirements, expand the data quantity of the training set and repeat steps 3.4, 3.8 and 3.9, and output the optimal XGboost traffic accident intelligent perception model and the prediction accuracy at this time when the accuracy is reached or the maximum number of iterations is reached.
6. The method of claim 5, wherein the method further comprises: In step 3.1, the traffic flow parameter combinations with "0-1" labels under each road attribute are subjected to K-Means unsupervised clustering based on the traffic safety risk intelligent perception related traffic flow parameter combinations obtained in step 2, to obtain a K-Means unsupervised clustering result, and a corresponding road risk level is obtained based on the K-Means unsupervised clustering result; The specific process is as follows: The traffic flow parameter combinations with "0-1" labels under each road attribute are subjected to K-Means unsupervised clustering, the traffic flow parameter combinations under each road attribute are clustered into B clusters, the ratio of the class cluster data ratio RDC and the accident data ratio RCT of each cluster data is determined, and the road risk level corresponding to the B cluster data is labeled according to the ratio of each cluster data. The higher the ratio, the higher the road risk level corresponding to the cluster. The calculation formula of the class cluster data ratio and the accident data ratio is as follows: where: n t is the total number of samples, n e is the number of samples contained in each cluster of the same class, n c is the total number of accidents, n a is the number of accidents contained in each cluster of the same class.
7. The method of claim 6, wherein the method further comprises: determining a risk level of the vehicle based on the risk intelligent perception model; and determining a risk level of the vehicle based on the risk intelligent perception model. In step 3.4, the test set data is input into the XGBoost risk level prediction model, the XGBoost risk level prediction model outputs the prediction value of the risk state evaluation, the prediction value of the risk state evaluation is compared with the true value, and the prediction accuracy of the XGboost risk level prediction model is obtained. The specific evaluation indexes of the prediction accuracy are as follows: ① Root mean square error, the calculation formula is as follows: wherein: X obs,i is the ith prediction value of the risk state assessment obtained by the XGboost risk level prediction model; X model,i Xi is the i-th true value; n is the number of predictions; ② Mean square error, the calculation formula is as follows: ③ Mean absolute error, the calculation formula is as follows: ④ Residual prediction error, the calculation formula is as follows: wherein: X i is the ith value in the training set; is the average value for the training set; Y i is the i-th residual value, i.e. the difference between the predicted value and the true value; is the average value of the residual values; ⑤ Prediction accuracy CR, the calculation formula is as follows: When the i-th prediction value of the risk state evaluation obtained by the XGboost risk level prediction model is equal to the true value, a i = 1; When the i-th prediction value of the risk state evaluation obtained by the XGboost risk level prediction model is not equal to the true value, a i = 0.
8. The method of claim 7, wherein the method further comprises: determining a risk level of the vehicle based on the risk intelligent perception model; and determining a risk level of the road based on the risk intelligent perception model. The step 3.8 inputs the test set data of step 3.6 into the XGboost traffic accident intelligent perception model, and the XGboost traffic accident intelligent perception model outputs an accident state prediction value. The accident state prediction value is compared with the true value to obtain the prediction accuracy of the XGboost traffic accident intelligent perception model. The prediction accuracy specific evaluation indexes are as follows: ① Root mean square error, the calculation formula is as follows: wherein: X' obs,i' is the ith prediction of the traffic accident state assessment obtained by the XGboost traffic accident intelligent perception model; X' model,i is the i'th truth value; n' is the prediction number; ② Mean square error, the calculation formula is as follows: ③ Mean absolute error, the calculation formula is as follows: ④ Residual prediction error, the calculation formula is as follows: wherein: X' i' is the i'th value in the training set; is the average value for the training set; Y' i' is the i'th residual value, i.e. the difference between the predicted value and the true value; is the average value of the residual values; ⑤ Prediction accuracy CR, the calculation formula is as follows: When the ith prediction value of the traffic accident state evaluation obtained by the XGboost traffic accident intelligent perception model is equal to the true value, a' i' = 1; When the i'th prediction value of the traffic accident state evaluation obtained by the XGboost traffic accident intelligent perception model is not equal to the true value, a' i' = 0; 9. The method of claim 8, wherein the method further comprises: determining a risk level of the vehicle based on the risk intelligent perception model; and determining a risk level of the vehicle based on the risk intelligent perception model. The step 4 downloads the trained road traffic safety risk intelligent perception model to the base server, uses the base server to analyze the real-time traffic flow data detected by the road detector, visualizes the analysis results, and dynamically updates the model over time. The specific operation method is as follows: Step 4.1: The road traffic safety risk intelligent perception model under different road attributes obtained by training is downloaded to each base server according to the principle of corresponding road attributes; Step 4.2: When the road detector detects each traffic flow parameter at the current time, upload each traffic flow parameter to the base server and the traffic real-time data storage. The base server analyzes each traffic flow parameter data using the road traffic safety risk intelligent perception model under different road attributes, judges the risk level of the current road section and whether a traffic accident occurs, and uploads the analysis result to the total server. The total server aggregates and visualizes the information uploaded by all base servers; Step 4.3: The traffic real-time data storage uploads the stored data to the historical database of the total server every certain time. The total server uses the updated data to re-perform steps 2, 3 and 4.1 to complete the real-time update of the road traffic safety risk intelligent perception model under different road attributes.
10. A road traffic safety prediction system based on risk intelligent perception model characterized in that: The system is used to execute the road traffic safety prediction method based on the risk intelligent perception model in any one of claims 1 to 9.
Citation Information
Patent Citations
Automatic driving tramcar operation risk assessment method based on environmental perception
CN111985782A
Intelligent energy management method and system for hybrid power bus in intelligent network connection environment
CN116187161A