Real-time risk prediction method for secondary accident of expressway
By constructing a machine learning model of primary accidents and secondary accidents and adopting a voting strategy, the problem of inaccurate secondary accident prediction in the existing technology is solved, real-time risk prediction and active management and control of secondary accidents on highways are realized, and safety is improved. sex.
Patent Information
- Application Number
- CN202410952310.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-10-01
AI Technical Summary
Existing real-time risk prediction methods for secondary accidents are difficult to accurately predict the risk of secondary accidents, and rely on the acquisition of characteristics related to the primary accident, which has authenticity and accuracy issues, making it difficult to achieve rapid response and timely intervention.
By obtaining highway historical traffic accident information and traffic flow data of spatiotemporal location, we divide secondary accidents, primary accidents and ordinary accidents, build primary accident and ordinary accident data sets, and use machine learning models to build primary accident risk prediction sub-models and secondary accidents. The accident real-time risk prediction sub-model adopts the 'OR' voting strategy to fuse the prediction results to achieve real-time risk prediction of secondary accidents.
It improves the information effectiveness of real-time risk prediction of secondary accidents, realizes active management and control of secondary accidents on highways, and reduces the risk of secondary accidents.
Smart Images

Figure CN118735074A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of active traffic safety risk prevention and control for expressways, and in particular to a real-time risk prediction method for secondary accidents on expressways. Background Art
[0002] On the highway, after an accident occurs, the accident handling will lead to abnormal occupation of the road, which will interfere with the normal driving of other vehicles. Moreover, traffic accidents will cause traffic flow disorder, which will gradually spread the impact on traffic flow in time and space, which may lead to further traffic accidents. Secondary traffic accidents occur within the spatial and temporal impact range caused by the initial traffic accident. Studies have shown that 2.2% to 3.9% of highway traffic accidents may lead to traffic accidents again. If a traffic accident has occurred before, the risk of another traffic accident will increase by more than six times. Similarly, for every minute increase in accident clearance time, the possibility of a secondary traffic accident increases by 2.8%. Compared with ordinary accidents, secondary accidents are more preventable. Active traffic safety control measures can be used to intervene in time and reduce the corresponding risks, thereby reducing the occurrence of secondary accidents.
[0003] At present, the main idea in the modeling process of the real-time risk of secondary accidents is to predict the risk of secondary accidents by classifying primary accidents and ordinary accidents. The output result of this prediction idea can only indicate that the risk of secondary accidents caused by primary accidents is high, but the time and location of secondary accidents cannot be determined, making it difficult to provide assistance for rapid response and timely intervention of secondary accident risks. In addition, the existing secondary accident risk prediction model relies heavily on the relevant features of the primary accident, such as the type of accident, the duration of the accident, etc. However, these features can hardly be obtained in real time in practical applications. Even if they can be obtained, it is difficult to ensure their authenticity and accuracy because their source depends on the reports of the accident participants.
[0004] Therefore, the current method of predicting secondary accidents has certain limitations, and it is difficult to accurately predict the risk of secondary accidents. Summary of the invention
[0005] The embodiment of the present invention provides a real-time risk prediction method for secondary accidents on highways, so as to achieve effective real-time management and control of the risk of secondary accidents on highways.
[0006] In order to achieve the above object, the present invention adopts the following technical scheme.
[0007] A real-time risk prediction method and system for secondary accidents on highways, comprising:
[0008] Obtain information data on historical traffic accidents on highways and traffic flow data at corresponding time and space locations, divide traffic accidents into secondary accidents, primary accidents, and common accidents, and construct primary accident and common accident datasets, secondary accident and no accident datasets based on the case matching method;
[0009] Using various traffic flow characteristic factors, respectively constructing a primary accident risk prediction sub-model and a secondary accident real-time risk prediction sub-model, using the primary accident and common accident data sets to train the primary accident risk prediction sub-model to obtain a trained primary accident risk prediction sub-model, using the secondary accident and no-accident data sets to train the secondary accident real-time risk prediction sub-model to obtain a trained secondary accident real-time risk prediction sub-model;
[0010] The traffic flow characteristic factors of the real-time accident on the highway to be analyzed are input into the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model, and the prediction results of the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model are merged using an "or" voting strategy to obtain the secondary accident risk prediction result of the real-time accident to be analyzed.
[0011] Preferably, the information data of historical traffic accidents on the highway and the traffic flow data of the corresponding time and space positions are obtained, and the traffic accidents are divided into secondary accidents, primary accidents and ordinary accidents, including:
[0012] Obtain historical traffic accident information data and traffic flow data at corresponding time and space locations. After preprocessing the data, match and associate various types of data through the index fields of the data table, begin to identify the detection coil number, determine the road number and mileage post number where the accident occurred, and the driving direction of the accident vehicle, locate the numbers of the upstream and downstream lines of the accident by searching the relevant coil information data files, collect the time of the accident and the corresponding upstream and downstream line numbers, and obtain the traffic flow data within the set time of the accident.
[0013] Preferably, the construction of the first accident and common accident data set, the second accident and no accident data set according to the case matching method includes:
[0014] For each accident in the database, a secondary accident identification buffer zone with a specified time distance and space distance is generated. The time distance is from 2 hours before the accident to 4 hours after the accident, and the space distance is from 5 km upstream of the accident site to 1 km downstream of the accident site. If no accident occurs in the secondary accident identification buffer zone, the accident is marked as a common accident.
[0015] If an accident occurs within the secondary accident identification buffer zone, a spatiotemporal matrix of the average speed within the specified range on the day of the accident and an average speed matrix and a standard deviation matrix under normal traffic conditions on a day without an accident are constructed. The spatiotemporal impact range of the accident is determined by the difference in speed between the accident day and the normal traffic conditions, and a speed contour map of the accident impact range is constructed. If an accident occurs within the spatiotemporal impact range of the accident, the accident is marked as a primary accident and added to the primary accident database, and accidents within the spatiotemporal range of the primary accident are marked as secondary accidents in sequence and added to the secondary accident database.
[0016] The common accident and first accident data sets were constructed using two types of accident samples, namely first accident and common accident. For the first accident data, all the extracted samples were used as the case group. For the common accident data, the case-control method was used, and the common accident data related to the first accident were selected at a ratio of 1:4. The second accident data set was constructed using two types of accident samples, namely second accident data and no accident data. For the second accident data, all the second accidents corresponding to the first accident extracted from the database were used as case samples, and the no accident data were selected by the case-control method.
[0017] Preferably, the construction of the first accident and common accident data set, the second accident and no accident data set according to the case matching method includes:
[0018] Three traffic flow parameters of upstream and downstream sections and their upstream and downstream average difference and adjacent lane average difference indicators were selected, totaling 15 parameters as traffic flow characteristic factors. The specific parameters and their meanings are shown in Table 2 below:
[0019] Table 2 Traffic flow characteristic factors
[0020]
[0021] Preferably, the method of using various traffic flow characteristic factors to respectively construct a primary accident risk prediction submodel and a secondary accident real-time risk prediction submodel, using the primary accident and common accident data sets to train the primary accident risk prediction submodel to obtain a trained primary accident risk prediction submodel, and using the secondary accident and no-accident data sets to train the secondary accident real-time risk prediction submodel to obtain a trained secondary accident real-time risk prediction submodel comprises:
[0022] Traffic flow characteristic factors such as flow rate, speed and occupancy rate are selected to construct a first accident risk prediction sub-model, the input data of the first accident risk prediction sub-model are 15 traffic flow characteristic factors of the initial accident, and the output data is 0 / 1, 0 indicates that the risk of the first accident is low, and 1 indicates that the risk of the first accident is high. The first accident risk prediction sub-model is trained using a machine learning model based on the first accident and common accident data sets to obtain a trained first accident risk prediction sub-model;
[0023] Traffic flow characteristic factors such as flow rate, speed and occupancy rate are selected to construct a secondary accident real-time risk prediction sub-model. The input data of the secondary accident real-time risk prediction sub-model is the traffic flow characteristic factor of the secondary accident, and the output data is 0 / 1, 0 indicates that the risk of a secondary accident is low, and 1 indicates that the risk of a secondary accident is high. The secondary accident real-time risk prediction sub-model is trained using a machine learning model based on the secondary accident and no-accident data sets to obtain a trained secondary accident real-time risk prediction sub-model.
[0024] Preferably, the traffic flow characteristic factors of the real-time highway accident to be analyzed are input into the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model, and the prediction results of the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model are merged using an "or" voting strategy to obtain the secondary accident risk prediction result of the real-time accident to be analyzed, including:
[0025] The traffic flow characteristic factors of 15 primary accidents of the real-time accidents to be analyzed are input into the primary accident risk prediction sub-model. The 15 traffic flow factors, i.e., the three parameters of the upstream and downstream section traffic flow and the average difference between the upstream and downstream and the average difference between the adjacent lanes, are detected by the upstream and downstream coil detectors. The traffic flow characteristic factors of 15 secondary accidents of the real-time accidents to be analyzed are input into the secondary accident real-time risk prediction sub-model. The prediction results of the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model are fused using the "or" voting strategy. The fusion logic of the primary accident risk prediction sub-model and the secondary accident risk prediction sub-model is shown in Table 3:
[0026] Table 3
[0027] First-time accident prediction model results Secondary accident prediction model results Two-layer prediction model +1 (higher risk of secondary accidents) +1 (higher risk of secondary accidents) +1 (higher risk of secondary accidents) +1 (higher risk of secondary accidents) -1 (lower risk of secondary accidents) +1 (higher risk of secondary accidents) -1 (lower risk of secondary accidents) +1 (higher risk of secondary accidents) +1 (higher risk of secondary accidents) -1 (lower risk of secondary accidents) -1 (lower risk of secondary accidents) -1 (lower risk of secondary accidents)
[0028] A secondary accident risk prediction result of the real-time accident to be analyzed is obtained.
[0029] It can be seen from the technical solutions provided by the above-mentioned embodiments of the present invention that the method of the embodiments of the present invention can improve the effectiveness of the information output of the real-time risk prediction of secondary accidents, thereby realizing active real-time risk management and control of secondary accidents on highways.
[0030] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0032] Figure 1 A schematic diagram of the implementation of a real-time risk prediction method for secondary accidents on highways provided by an embodiment of the present invention;
[0033] Figure 2 A processing flow chart of a method for real-time risk prediction of secondary accidents on highways provided by an embodiment of the present invention;
[0034] Figure 3 This is a flow chart of secondary accident identification according to an embodiment of the present invention.
[0035] Figure 4 A schematic diagram of selecting a spatial position of traffic flow data provided by an embodiment of the present invention.
[0036] Figure 5 A schematic diagram of an initial accident risk prediction sub-model provided in an embodiment of the present invention.
[0037] Figure 6 A schematic diagram of a secondary accident risk prediction sub-model provided in an embodiment of the present invention.
[0038] Figure 7 A schematic diagram of the relationship between a data set and a model input provided in an embodiment of the present invention.
[0039] Figure 8 A schematic diagram of data matching steps provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.
[0041] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or coupling. The term "and / or" used herein includes any unit and all combinations of one or more associated listed items.
[0042] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless defined as herein.
[0043] To facilitate understanding of the embodiments of the present invention, several specific embodiments will be further explained below with reference to the accompanying drawings, and each embodiment does not constitute a limitation on the embodiments of the present invention.
[0044] A secondary accident is an accident that occurs within the time and space impact of a primary accident. A primary accident is an accident that causes a secondary accident due to the time and space impact of its occurrence. An ordinary accident is an accident that will not cause a secondary accident.
[0045] Example 1
[0046] The implementation principle diagram of a real-time risk prediction method for secondary accidents on highways provided by an embodiment of the present invention is as follows: Figure 1 The specific processing flow is as shown in Figure 2 As shown, the processing steps include the following:
[0047] Step S10, obtaining historical traffic accident information data and traffic flow data at corresponding time and space locations, and matching and associating various types of data after preprocessing the data;
[0048] Data matching is performed through the index fields of the data table. The specific matching logic is as follows: Figure 8As shown: First, start to identify the detection coil number, determine the road number and mileage number where the accident occurred, and the driving direction of the accident vehicle. Then, by searching the relevant coil information data file, locate the numbers of the upstream and downstream lines of the accident. Then, enter the second step, collect the time of the accident and the corresponding upstream and downstream line numbers, and obtain the traffic flow data 5 to 10 minutes before the accident. Finally, organize and summarize all the data to complete the entire accident handling process.
[0049] Step S20, classifying the accidents into secondary accidents, primary accidents and common accidents, constructing the primary accident and common accident data sets, secondary accident and no accident data sets according to the case matching method, and calculating the traffic flow precursor characteristic factors of each accident;
[0050] Step S30, respectively construct a primary accident real-time risk prediction sub-model and a secondary accident real-time risk prediction sub-model, fuse the sub-model prediction results based on the voting strategy, construct a secondary accident real-time risk prediction model based on a double-layer structure, and output the secondary accident real-time risk.
[0051] Specifically, the above step S20 includes: performing data preprocessing including: removing records with key missing fields in the accident data; for traffic flow data, in order to ensure the use of real and complete traffic flow data, removing abnormal data to ensure the originality and accuracy of the data set. Evaluate whether the traffic flow data is wrong based on basic rules, and remove it from the data set after confirming the error. Optionally, perform database matching through the index field of the data table. The relationship between traffic flow parameters is shown in Table 1.
[0052] Table 1 Traffic flow parameter relationships
[0053] flow speed Occupancy Is the data correct? 1 0 ≠0 ≠0 False 2 0 0 ≠0 False 3 0 ≠0 0 False 4 0 0 0 True 5 ≠0 0 ≠0 False 6 ≠0 0 0 False 7 ≠0 ≠0 0 False 8 ≠0 ≠0 ≠0 True
[0054] Specifically, the above step S20 includes: the identification and classification of secondary accidents mainly includes two steps:
[0055] S1: Preliminary screening based on accident buffer: For each accident in the database, a secondary accident identification buffer with a specified time and space distance is generated. The time distance used in this example is 2 hours before the accident to 4 hours after the accident, and the space distance is within 5 kilometers upstream of the accident site to 1 kilometer downstream of the accident. If no accident occurs in the accident buffer, the identification of this accident is terminated and the accident is marked as a common accident. If an accident occurs in the buffer, the same index is used to mark the accident and several accidents in its buffer for further identification.
[0056] S2: A processing flow chart of an accurate identification of secondary accidents based on the speed contour method provided by an embodiment of the present invention is as follows: Figure 3As shown: First, extract the time and space information of the accident from the accident database, build the accident time and space buffer, and search whether there is an accident within the buffer range. If not, the accident is marked as a common accident and added to the common accident database. Then, enter the fine screening step based on the speed contour map, build the average speed time and space matrix within the specified range on the day of the accident and the average speed matrix and standard deviation matrix under normal traffic conditions on accident-free days, judge the time and space impact range of the accident by the speed difference between the accident day speed and the speed under normal traffic conditions, and build the speed contour map of the accident impact range. If there is an accident within the time and space impact range of the accident, the accident is marked as a primary accident and added to the primary accident database, and the accidents within the time and space range of the primary accident are marked as secondary accidents and added to the secondary accident database.
[0057] The time and space impact range of the accident is depicted through speed contour maps, that is, the accident impact range is delineated by judging the difference between the speed of each section of road before and after the accident and the speed of the same time period on accident-free days. Accidents occurring within the accident impact range are identified as secondary accidents for subsequent real-time risk prediction and analysis, and accidents that cause secondary accidents are marked as primary accidents.
[0058] Before building the prediction model, the sample structure design is carried out. This example involves two sets of data sets: ordinary accident and first accident data sets; secondary accident and non-accident data sets. Figure 7 A schematic diagram of the relationship between a data set and a model input provided in an embodiment of the present invention.
[0059] The common accident and first accident dataset is an important dataset for building a real-time risk prediction model for secondary accidents on highways. This dataset mainly includes two types of accident samples: first accidents and common accidents. First accidents refer to events with the potential to cause secondary accidents, while common accidents are samples with a relatively low risk of causing secondary accidents. This dataset is mainly used for the real-time risk prediction model for secondary accidents on highways based on machine learning, as well as the first accident prediction sub-model in the two-layer structure prediction model.
[0060] For the first accident data, all the extracted samples are used as the case group. For the common accident data, the case control method is used, and the common accident data related to the first accident is selected at a ratio of 1:4. When selecting common accident data, the following principles are followed: 1) Time matching principle: the selected common accidents occur in a time period close to the first accident, usually within 1 hour nearby; 2) Location matching principle: the common accident occurs in a location close to the first accident, usually within 2 kilometers nearby; 3) Season matching principle: the common accident occurs in the same season as the first accident; 4) If none of the above principles can be met, random sampling is used to select common accident data.
[0061] The secondary accident data set is mainly used to construct the secondary accident prediction sub-model in the two-layer structure prediction model. The data set contains two main parts: secondary accident data and accident-free data. For the secondary accident data, all secondary accidents corresponding to the primary accident extracted from the database are used as case samples. The accident-free data is selected by the case control method and paired with the secondary accident data at a ratio of 1:4. When selecting accident-free samples, the following principles are followed: 1) Time matching principle: the selected accident-free samples occur in a time period close to the secondary accident, usually within 1 hour nearby; 2) Location matching principle: the accident-free samples occur in a location close to the secondary accident, usually within 2 kilometers nearby; 3) Date matching principle: the accident-free samples occur on the same day of the same week as the secondary accident; 4) Season matching principle: the selected accident-free samples should be in the same season as the secondary accident; 5) The accident-free samples should be within two hours before and after the accident time, and no accidents occur near the location to ensure that the selected samples reflect the normal traffic flow state.
[0062] The traffic flow characteristic parameters are calculated as follows:
[0063] In the spatial dimension, the upstream and downstream loop coil detectors closest to the accident scene are selected to obtain traffic flow data. Figure 4 Schematic diagram of selecting the spatial position of traffic flow data according to an embodiment of the present invention, as shown in FIG. Figure 4 As shown; in the time dimension, 5 minutes is used as the time aggregation unit as the time dimension screening condition of the model traffic flow data characteristics, and the traffic flow data 5-10 minutes before the accident is selected as the analysis sample.
[0064] Traffic flow refers to the number of vehicles passing through a specific road section or location per unit time. The data collected by the loop detectors on each lane of the road is summarized in five-minute time periods to obtain the total traffic flow of the road section, calculated according to the following formula:
[0065]
[0066] In the formula, Q represents the traffic flow of the highway section, q i represents the traffic flow of each lane, and n is the number of lanes. This calculation method can comprehensively consider the traffic conditions on each lane and provide an accurate data basis for analyzing and predicting traffic flow on highways.
[0067] The average speed is defined as the average of the 5-minute instantaneous speed of each vehicle recorded by the coil detector on the lane. The average speed used in this example is the average speed of all lanes in the road section. Therefore, the average speed of each lane needs to be multiplied by the flow of the corresponding lane, and then added and divided by the total flow of the section. The calculation formula is as follows:
[0068]
[0069] In this formula, V represents the average speed of the road section, and v i represents the average speed of lane i at five-minute intervals, q i represents the traffic volume of lane i in a 5-minute period.
[0070] Occupancy rate refers to the proportion of time a vehicle occupies a certain coil detector. The average occupancy rate used in this example is the average occupancy rate of all lanes in the road section. Therefore, the average occupancy rate of each lane needs to be added up and divided by the total number of lanes. The calculation formula is as follows:
[0071]
[0072] Where: O is the average occupancy rate of the road section; i is the average occupancy rate of vehicles passing through lane i in a five-minute time interval.
[0073] The difference in traffic parameters upstream and downstream of the accident site can reflect the characteristics before the accident. Therefore, after obtaining the traffic flow parameters of the upstream and downstream coil detectors, the parameters of the upstream and downstream sections are subtracted. By calculating their differences and taking the absolute value, the changes in traffic flow parameters between sections can be captured. This method helps to reveal the potential correlation between traffic flow parameter differences and accidents. The specific calculation method is shown in the following formula:
[0074] vol_dif=|v down -v up
[0075] Where: vol_dif is the absolute difference in flow rate between upstream and downstream coils at the accident site within 5 minutes; v down v is the flow rate of the downstream section of the accident site within 5 minutes; up The flow rate of the upstream section of the accident site within 5 minutes;
[0076] spe_dif=|s down -s up |
[0077] Where: spe_dif is the absolute difference in average speed of the upstream and downstream coils at the accident site within 5 minutes; s down is the average velocity of the downstream section of the accident site within 5 minutes; s up The average velocity of the upstream section of the accident site within 5 minutes;
[0078] occ_dif=|o down -o up |
[0079] Where: occ_dif is the absolute difference in the average occupancy rate of the upstream and downstream coils at the accident site within 5 minutes; down is the average occupancy rate of the downstream section of the accident site within 5 minutes; up It is the average occupancy rate of the upstream section of the accident site within 5 minutes.
[0080] After the initial accident, the difference in traffic flow between lanes may lead to behaviors such as lane changing, which increases the risk of secondary accidents. Therefore, side-scuffing accidents between vehicles are also a common form of secondary accidents. Therefore, this example considers the difference in traffic flow parameters between lanes as a characteristic factor related to side-scuffing accidents.
[0081]
[0082] In the formula: vol_lane_dif_up is the average difference in flow rate between adjacent lanes in the upstream section; spe_lane_dif_up is the average difference in speed between adjacent lanes in the upstream section; occ_lane_dif_up is the average difference in occupancy rate between adjacent lanes in the upstream section; vol_lane_dif_down is the average difference in flow rate between adjacent lanes in the downstream section; spe_lane_dif_down is the average difference in speed between adjacent lanes in the downstream section; occ_lane_dif_down is the average difference in occupancy rate between adjacent lanes in the downstream section.
[0083] In summary, this example selected three parameters of upstream and downstream traffic flow and their upstream and downstream average differences, adjacent lane average differences and other indicators, a total of 15 parameters as characteristic factors. The specific parameters and their meanings are shown in Table 2 below.
[0084] Table 2 Selection of traffic flow characteristic factors
[0085]
[0086] Specifically, the above step S30 includes: constructing a first accident risk prediction sub-model, selecting traffic flow characteristic factors such as flow, speed and occupancy to construct the first accident risk prediction sub-model. Considering that the output of the first accident risk prediction sub-model is a binary classification result, four machine learning models with good classification performance were selected for discussion and experiment, including support vector machine (SVM), random forest (RF), XGBoost model and CatBoost model. These four algorithms have excellent performance and robustness in processing numerical features, and are suitable for complex feature space modeling. The input data of the above-mentioned first accident risk prediction sub-model are the 15 traffic flow characteristic factors in Table 2, and the output data is 0 / 1, 0 indicates that the risk of the first accident is low, and 1 indicates that the risk of the first accident is high.
[0087] The first accident risk prediction sub-model is shown as follows: Figure 5 As shown in the figure. The first accident risk prediction sub-model analyzes the precursory characteristic factors of traffic flow before the first accident and ordinary accident, such as flow, speed, occupancy, etc., and uses them as the input variables of the model. The purpose of this classification logic is to distinguish between first accidents and ordinary accidents, so as to evaluate the risk of secondary accidents in real time. When a sample data is classified as a first accident by the model, it indicates a significant increase in the risk of secondary accidents in the area where the accident occurred. This identification mechanism allows traffic managers to respond quickly to first accidents and intervene in time with high secondary accident risks, such as timely traffic control or issuing emergency notices, to reduce the probability of secondary accidents. On the contrary, if the sample data is classified as an ordinary accident, then the possibility of causing a secondary accident is relatively low, and managers can adjust resource allocation and response measures accordingly to reduce the waste of related resources and the impact on traffic flow.
[0088] The training process of the four machine learning models is as follows.
[0089] Step 1: Divide the data set. Divide the original data set into a training set and a test set in a ratio of 7:3.
[0090] Step 2: Define parameter space and create parameter grid. Select the model parameters to be optimized and determine their possible value ranges; use the grid search method to create a parameter grid and list all possible parameter combinations.
[0091] Step 3: Enter the grid search loop: For each parameter combination, perform K-fold cross validation:
[0092] Step 3.1: Divide the training set into K equal subsets (folds). For each fold, use K-1 subsets to train the model, and one of the subsets is used as the validation set. Evaluate the model performance on the validation set and record the area under the ROC curve (AUC).
[0093] Step 3.2: Calculate the model performance and record the best parameter combination. Average the AUC values of K cross-validations to obtain the performance evaluation results of the parameter combination.
[0094] Step 4: Determine the best parameter combination and performance evaluation. Among all parameter combinations, select the best parameter combination for performance evaluation as the best parameter combination; output the best parameter combination and its corresponding performance evaluation result.
[0095] Step 5: Train the final model. The final model is trained on the entire training set using the best parameter combination.
[0096] Construct a secondary accident risk prediction sub-model. The machine model, model training process, input and output data, and processing process used in the secondary accident risk prediction are consistent with the primary accident risk prediction model. The difference between the two is that the input data of the primary accident risk prediction uses the data of the primary accident, while the input data of the secondary accident risk prediction model uses the data of the secondary accident.
[0097] In the two-layer prediction model, the "or" strategy is used to merge the two single-layer prediction models, which may result in a high false positive rate, that is, a high false alarm rate. Therefore, the results of the prediction model are further converted into risk probability, that is, the probability of the model classifying the sample as a positive sample is used as the risk probability. In the first accident risk prediction sub-model and the second accident risk prediction sub-model, the four machine learning-based classification models used all have the function of outputting probability estimation results.
[0098] Taking the CatBoost model as an example, the steps to output classification probabilities are as follows.
[0099] Step 1: Construct the primary accident risk prediction sub-model and the secondary accident risk prediction sub-model based on the CatBoost algorithm respectively. By constructing a decision tree and optimizing the loss function, the model generates a prediction score.
[0100] Step 2: For the two sub-models, use the sigmoid function to convert the prediction results into quantized probabilities. The calculation method is:
[0101]
[0102] Where P(y=1) is the probability that the sample belongs to category 1, and f(x) is the prediction score of the model, that is, the output of the decision tree.
[0103] Step 3: Fusion the risk prediction probabilities of the two sub-models. According to the double-layer prediction model result fusion method, the value with the largest risk probability in the two sub-models is taken as the risk probability output of the double-layer prediction model.
[0104] The secondary accident risk prediction sub-model is shown as follows: Figure 6 As shown. The secondary accident risk prediction submodel aims to predict the real-time risk of a secondary accident after a previous accident. The secondary accident risk prediction submodel in this example is also a binary classification problem. The model classifies secondary accident samples and non-secondary accident (no accident) samples by taking the traffic flow parameter characteristics within the spatiotemporal influence range of the previous accident as the model input.
[0105] In the process of data-driven model construction, the samples of secondary accidents are accidents that occur within the time and space influence range of the initial accident divided in the database. The traffic flow parameters are selected from the data extracted from the upstream and downstream coils closest to the accident site 5-10 minutes before the secondary accident as the model input features. The real-time risk of secondary accidents is predicted by the traffic flow precursor characteristic factors 5-10 minutes before the secondary accident site. In order to further improve the accuracy and generalization ability of the model, the case matching method is used to select non-secondary accident (no accident) samples to ensure that the control group samples match the accident samples in other conditions. For example, the location of the accident, the time of the day when the accident occurred, and the day of the week in which the accident occurred are selected as control factors so that the model can more efficiently extract the characteristics of secondary accidents.
[0106] Based on the voting strategy, the prediction results of the trained initial accident risk prediction sub-model and the secondary accident risk prediction sub-model are integrated to build a real-time risk prediction model for secondary accidents based on a double-layer structure. The output results of the initial accident and secondary accident risk prediction models are both 0 / 1. 0 indicates a low risk of an accident, and 1 indicates a high risk of an accident. The results of the two models are integrated.
[0107] The traffic flow characteristic factors of the real-time accident to be analyzed need to be input into the real-time risk prediction model for secondary accidents with a double-layer structure, and the real-time risk prediction model for secondary accidents with a double-layer structure outputs the probability value that the accident to be analyzed will lead to a secondary accident. The prediction results of the two sub-models are merged using an "or" voting strategy, that is, if one of the two models predicts a result of 1, the prediction result of the double-layer prediction model is also 1, which means that the risk of a secondary accident is high.
[0108] The fusion logic of the initial accident risk prediction sub-model and the secondary accident risk prediction sub-model is shown in Table 3:
[0109] Table 3
[0110] First-time accident prediction model results Secondary accident prediction model results Two-layer prediction model +1 (higher risk of secondary accidents) +1 (higher risk of secondary accidents) +1 (higher risk of secondary accidents) +1 (higher risk of secondary accidents) -1 (lower risk of secondary accidents) +1 (higher risk of secondary accidents) -1 (lower risk of secondary accidents) +1 (higher risk of secondary accidents) +1 (higher risk of secondary accidents) -1 (lower risk of secondary accidents) -1 (lower risk of secondary accidents) -1 (lower risk of secondary accidents)
[0111] Example 2
[0112] This embodiment 2 provides a method for real-time risk prediction of secondary accidents on highways, which is used to improve the accuracy of real-time risk prediction of secondary accidents on highways. The technical solution of the method described in this embodiment 2 is as follows:
[0113] First, historical traffic accident information data and traffic flow data at corresponding time and space locations are obtained, and after preprocessing the data, various types of data are matched and associated;
[0114] Secondly, the accidents are divided into secondary accidents, primary accidents and common accidents. The data sets of primary accidents and common accidents, secondary accidents and no accidents are constructed according to the case matching method, and the traffic flow precursor characteristic factors of each accident are calculated.
[0115] Finally, the real-time risk prediction sub-model for the first accident and the real-time risk prediction sub-model for the second accident are constructed respectively. The prediction results of the sub-models are fused based on the voting strategy to construct a real-time risk prediction model for the second accident based on a double-layer structure, and the real-time risk of the second accident is output, including the following steps:
[0116] Take the accident that occurred on the mileage section of the I-405 highway in the United States from mileage 9 to 21 in 2016 as an example, but the present invention is not limited to this example. S1: Obtain the accident and corresponding traffic flow data on the mileage section of the I-405 highway in the United States from mileage 9 to 21 in 2016, and perform data processing and data matching.
[0117] S2: Accidents are divided into secondary accidents, primary accidents and common accidents. This accident database identified 108 primary accidents, 108 secondary accidents and 3960 common accidents.
[0118] S3: Sample structure design is performed based on the case matching method. This example involves two sets of data sets: ordinary accident and first accident data sets; second accident and non-accident data sets. The relationship between the data sets and the model input is as follows: Figure 6 shown.
[0119] S4: Random forest algorithm, SVM algorithm, XGBoost algorithm and CatBoost algorithm were selected as alternative algorithms for the sub-model to construct the prediction sub-model. The confusion matrix and its calculated secondary indicators, receiver operating characteristic ROC curve and the area under the curve AUC value were selected as the evaluation indicators of model prediction accuracy. The prediction indicators are shown in Tables 4 and 5.
[0120] Table 4 Comparison of evaluation indicators of initial accident risk prediction sub-models
[0121]
[0122] Table 5 Comparison of evaluation indicators of secondary accident risk prediction sub-models
[0123]
[0124] From the above table, the CatBoost algorithm is selected as the algorithm for the initial accident risk prediction sub-model and the secondary accident risk prediction sub-model to build the model.
[0125] S5: The prediction results of the two sub-models are integrated to construct a double-layer structured real-time risk prediction model for secondary accidents. The prediction results of the double-layer structured real-time risk prediction model for secondary accidents are shown in Table 6 below.
[0126] Table 6 Evaluation index calculation based on the double-layer structure prediction model
[0127]
[0128] Comparing the prediction results of the double-layer structure prediction model with those of the single-layer prediction model based on the CatBoost algorithm, it can be found that the double-layer structure prediction model has a significantly higher recall rate for secondary accident samples than CatBoost. The double-layer structure prediction model does a better job of ensuring that secondary accidents are identified, although this may cause more non-secondary accidents to be misjudged as secondary accidents. From the overall performance point of view, the double-layer structure prediction model has a higher recall rate, and the double-layer structure prediction model also has a good performance in terms of overall accuracy and AUC. In short, the double-layer structure prediction model has an advantage in ensuring that all secondary accident samples are identified, which is very important in safety-sensitive fields such as real-time risk prediction of accidents.
[0129] To summarize, the real-time risk prediction framework for secondary accidents on highways based on a double-layer structure in the embodiment of the present invention includes a primary accident risk prediction sub-model and a secondary accident real-time risk prediction sub-model. The double-layer prediction model is mainly for framework construction, and the algorithm adopted by the sub-model can be selected according to the prediction performance in actual experiments. This method can improve the prediction accuracy of the real-time risk of secondary accidents, and can provide the time and spatial scope of potential secondary accidents, strengthen the prevention of secondary accident risks, and can provide a reference for the active risk management of secondary accidents on highways, which is helpful to improve the safety level of highways.
[0130] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.
[0131] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.
[0132] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0133] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A real-time risk prediction method and system for secondary accidents on highways, characterized in that: include: Obtain information data on historical traffic accidents on highways and traffic flow data at corresponding time and space locations, divide traffic accidents into secondary accidents, primary accidents, and common accidents, and construct primary accident and common accident datasets, secondary accident and no accident datasets based on the case matching method; Using various traffic flow characteristic factors, respectively constructing a primary accident risk prediction sub-model and a secondary accident real-time risk prediction sub-model, using the primary accident and common accident data sets to train the primary accident risk prediction sub-model to obtain a trained primary accident risk prediction sub-model, using the secondary accident and no-accident data sets to train the secondary accident real-time risk prediction sub-model to obtain a trained secondary accident real-time risk prediction sub-model; The traffic flow characteristic factors of the real-time accident on the highway to be analyzed are input into the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model, and the prediction results of the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model are merged using an "or" voting strategy to obtain the secondary accident risk prediction result of the real-time accident to be analyzed.
2. The method according to claim 1, characterized in that Obtain information data of historical traffic accidents on highways and traffic flow data of corresponding time and space locations, and classify traffic accidents into secondary accidents, primary accidents and ordinary accidents, including: Obtain historical traffic accident information data and traffic flow data at corresponding time and space locations. After preprocessing the data, match and associate various types of data through the index fields of the data table, begin to identify the detection coil number, determine the road number and mileage post number where the accident occurred, and the driving direction of the accident vehicle, locate the numbers of the upstream and downstream lines of the accident by searching the relevant coil information data files, collect the time of the accident and the corresponding upstream and downstream line numbers, and obtain the traffic flow data within the set time of the accident.
3. The method according to claim 2, characterized in that The first accident and common accident data sets, the second accident and no accident data sets are constructed according to the case matching method, including: For each accident in the database, a secondary accident identification buffer zone with a specified time distance and space distance is generated. The time distance is from 2 hours before the accident to 4 hours after the accident, and the space distance is from 5 km upstream of the accident site to 1 km downstream of the accident site. If no accident occurs in the secondary accident identification buffer zone, the accident is marked as a common accident. If an accident occurs within the secondary accident identification buffer zone, a spatiotemporal matrix of the average speed within the specified range on the day of the accident and an average speed matrix and a standard deviation matrix under normal traffic conditions on a day without an accident are constructed. The spatiotemporal impact range of the accident is determined by the difference in speed between the accident day and the normal traffic conditions, and a speed contour map of the accident impact range is constructed. If an accident occurs within the spatiotemporal impact range of the accident, the accident is marked as a primary accident and added to the primary accident database, and accidents within the spatiotemporal range of the primary accident are marked as secondary accidents in sequence and added to the secondary accident database. The common accident and first accident data sets were constructed using two types of accident samples, namely first accident and common accident. For the first accident data, all the extracted samples were used as the case group. For the common accident data, the case-control method was used, and the common accident data related to the first accident were selected at a ratio of 1:
4. The second accident data set was constructed using two types of accident samples, namely second accident data and no accident data. For the second accident data, all the second accidents corresponding to the first accident extracted from the database were used as case samples, and the no accident data were selected by the case-control method.
4. The method according to claim 3, characterized in that The first accident and common accident data sets, the second accident and no accident data sets are constructed according to the case matching method, including: Three traffic flow parameters of upstream and downstream sections and their upstream and downstream average difference and adjacent lane average difference indicators were selected, totaling 15 parameters as traffic flow characteristic factors. The specific parameters and their meanings are shown in Table 2 below: Table 2 Traffic flow characteristic factors 5. The method according to claim 2, characterized in that: The method of using various traffic flow characteristic factors to respectively construct a primary accident risk prediction sub-model and a secondary accident real-time risk prediction sub-model, using the primary accident and common accident data sets to train the primary accident risk prediction sub-model to obtain a trained primary accident risk prediction sub-model, and using the secondary accident and no-accident data sets to train the secondary accident real-time risk prediction sub-model to obtain a trained secondary accident real-time risk prediction sub-model, includes: Traffic flow characteristic factors such as flow rate, speed and occupancy rate are selected to construct a first accident risk prediction sub-model, the input data of the first accident risk prediction sub-model are 15 traffic flow characteristic factors of the initial accident, and the output data is 0 / 1, 0 indicates that the risk of the first accident is low, and 1 indicates that the risk of the first accident is high. The first accident risk prediction sub-model is trained using a machine learning model based on the first accident and common accident data sets to obtain a trained first accident risk prediction sub-model; Traffic flow characteristic factors such as flow rate, speed and occupancy rate are selected to construct a secondary accident real-time risk prediction sub-model. The input data of the secondary accident real-time risk prediction sub-model is the traffic flow characteristic factor of the secondary accident, and the output data is 0 / 1, 0 indicates that the risk of a secondary accident is low, and 1 indicates that the risk of a secondary accident is high. The secondary accident real-time risk prediction sub-model is trained using a machine learning model based on the secondary accident and no-accident data sets to obtain a trained secondary accident real-time risk prediction sub-model.
6. The method according to claim 5, characterized in that The method of inputting the traffic flow characteristic factors of the real-time highway accident to be analyzed into the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model, and adopting an "or" voting strategy to merge the prediction results of the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model to obtain the secondary accident risk prediction result of the real-time accident to be analyzed includes: The traffic flow characteristic factors of 15 primary accidents of the real-time accidents to be analyzed are input into the primary accident risk prediction sub-model. The 15 traffic flow factors, i.e., the three parameters of the upstream and downstream section traffic flow and the upstream and downstream average difference and the adjacent lane average difference index, are detected by the upstream and downstream coil detectors. The traffic flow characteristic factors of 15 secondary accidents of the real-time accidents to be analyzed are input into the secondary accident real-time risk prediction sub-model. The prediction results of the primary accident risk prediction sub-model and the secondary accident real-time risk prediction sub-model are fused by adopting the "or" voting strategy. The fusion logic of the primary accident risk prediction sub-model and the secondary accident risk prediction sub-model is shown in Table 3: Table 3 A secondary accident risk prediction result of the real-time accident to be analyzed is obtained.
