Traffic accident prediction method and device for concerning interest point and multi-scale sequential relationship
By focusing on the relationship between points of interest and multi-scale time series, we extract spatiotemporal knowledge of POIs and combine them with feature modules for model training, which solves the problems of insufficient road-level prediction accuracy and inadequate capture of POI impacts in the existing technology, and achieves more accurate Traffic accident prediction.
Patent Information
- Application Number
- CN202410638807.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-05-22
AI Technical Summary
Existing traffic accident prediction methods are difficult to provide detailed and accurate predictions at the road level, and fail to fully capture the complex spatiotemporal correlation between points of interest (POIs) and traffic accidents, ignoring the functional impact of POIs and differences in the time dimension. .
Using the method of focusing on the relationship between points of interest and multi-scale time series, the POI spatiotemporal knowledge of the accident is extracted through the POI spatiotemporal knowledge mining module. Combining space, time and spatiotemporal features, the spatial convolution module, the temporal convolution module, the spatiotemporal convolution module and The attention module performs model training and divides time features into historical, periodic and adjacent scales to improve prediction accuracy.
It achieves more accurate road-level traffic accident prediction, comprehensively reveals the complex spatio-temporal correlation between POI and accidents, learns the daily patterns, long-term cycles and short-term trends of accident occurrences, and improves the accuracy of prediction results.
Smart Images

Figure CN118571007A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of traffic accident prediction, and relates to a traffic accident prediction method and device focusing on the relationship between interest points and multi-scale time series. Background Art
[0002] Traffic accidents not only threaten the lives of drivers and passengers, but also impose a heavy burden on the transportation system and the economy. Therefore, it is crucial to predict in advance whether a traffic accident will occur on a specific road. For traffic management departments, it can help them better plan traffic and adopt certain strategies in advance, providing strong support for traffic management and emergency rescue. For drivers, it can remind them to drive carefully, better plan a safe route, and reduce the occurrence of accidents.
[0003] In the current environment of rapid development of artificial intelligence, many methods have emerged in the field of traffic accident prediction, which can be mainly divided into two categories:
[0004] 1) Methods based on traditional machine learning models
[0005] Traffic accident prediction methods based on traditional machine learning models include regression models, support vector machines, decision trees, KNN, etc. The advantages of such methods are that they are simple and have low computational costs. However, when dealing with traffic accident prediction, due to complex spatiotemporal correlations and the influence of multiple factors such as traffic flow, meteorological conditions, and road networks, it is difficult for them to fit a large number of heterogeneous features and fully capture complex spatiotemporal correlations, making it difficult to achieve highly accurate predictions.
[0006] 2) Methods based on deep learning models
[0007] With the development of deep learning in recent years, various deep learning models such as LSTM, CNN, GCN, etc. have been applied to this field. Deep learning models can fit a large number of heterogeneous features and capture complex spatiotemporal correlations, thus more effectively learning the nonlinear spatiotemporal correlations of traffic accident data. This makes its prediction effect often better than machine learning-based methods.
[0008] All of the above methods have some problems: ① Most of the existing traffic accident prediction methods divide the city into regular grids, breaking its geographical characteristics; or predict at the administrative district level, which cannot provide finer and more accurate road-level predictions. ② The existing road-level traffic accident prediction methods all input the original time series data into the model, which makes it difficult to mine deeper time series relationships. ③ The existing traffic accident prediction methods either directly ignore the impact of points of interest (POI) on accidents, or only regard POI as a static road feature, focusing on the number of POIs and ignoring their functional importance. For example, there are often many restaurants near a school. In this case, the school should be regarded as a key POI that affects accidents on nearby roads, but traditional methods may mistakenly regard restaurants as key POIs. This problem will lead to the loss of key information; in addition, previous methods have not considered the differences in the impact of different types of POIs on the occurrence of accidents in the time dimension, resulting in the model failing to fully capture the complex spatiotemporal relationship between POIs and traffic accidents. Often this spatiotemporal relationship can be used as a spatiotemporal knowledge auxiliary model for POIs for more accurate prediction.
[0009] Therefore, there is an urgent need for a method that can accurately predict traffic accidents. Summary of the invention
[0010] In view of this, an object of the present invention is to provide a traffic accident prediction method and device focusing on points of interest and multi-scale temporal relationships, so as to improve the accuracy of road-level traffic accident prediction.
[0011] In order to achieve the above object, the present invention provides the following technical solutions:
[0012] Solution 1:
[0013] A traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series, specifically comprising the following steps:
[0014] S1: Collect and clean data and extract data features;
[0015] S2: Extracting the spatiotemporal knowledge of points of interest (POI) that affect accidents through the POI spatiotemporal knowledge mining module (PKM module);
[0016] S3: Fuse the data features extracted in step S1 and the POI spatiotemporal knowledge into new features, and divide them into spatial features, temporal features, and spatiotemporal features;
[0017] S4: The temporal and spatiotemporal features are divided into historical, periodic and adjacent scales through the scale division module;
[0018] S5: inputting spatial features, temporal features of different scales, and spatiotemporal features into the model for training, and saving the best performing model; the model includes a spatial convolution module (SCM), a temporal convolution module (TCM), a spatiotemporal convolution module (STCM), and an attention module (Attention);
[0019] S6: Input the test data into the saved best model to obtain the predicted value of a traffic accident on a certain road in the future.
[0020] Further, in step S1, the data includes accident information, climate information, traffic flow information, road information, POI information and road network information of the predicted area; the accident information includes the locations and times of all accidents in the target city within 24 hours; the climate information includes the weather conditions, wind direction and temperature information of the target city within 24 hours; the traffic flow information is the number of traffic flows on each road in the target city within 24 hours; the road information includes the specific location, road type, road length and road width of each road in the target city; the POI information includes the specific location and type of all POIs in the target city, and the road network information includes the road map structure of the predicted area;
[0021] The specific data cleaning is as follows: select the data of the road 2 hours before and after the missing data moment, and calculate its average value for filling; for the moment that is still missing, use the average value of the data of all roads at that moment for filling.
[0022] Further, in step S2, the PKM module is used to link the POI data with the road and collision accident data to extract the spatiotemporal relationship between the POI and the possibility of collision accidents, thereby determining the impact of different types of POIs on road collision accidents at different times;
[0023] The specific steps of the PKM module processing data are as follows:
[0024] S21: Input POI data and road data, and calculate the correlation weight IDF(q j ):
[0025]
[0026] Among them, q j represents the jth type of POI, N is the total number of roads, n(q j ) is the number of roads with the j-th type of POI around them;
[0027] S22: Calculate the correlation score R(q j ):
[0028]
[0029] Among them, k and b are free parameters, usually set to 2 and 0.75, and f j represents the number of the jth POI category near all roads; dl represents the number of all POIs near a road; avgdl represents the average number of POIs near all roads;
[0030] S23: Calculate the weighted association score of the j-th POI to the i-th road In this way, the influence weight of each type of POI on the probability of traffic accidents on each road is obtained, which is used as the macro knowledge of POI space;
[0031]
[0032] S24: Input POI data and traffic accident data, and calculate the correlation score between the j-th POI and the accident at time t Take it as POI time macro knowledge;
[0033]
[0034] in, represents the number of traffic accidents near the j-th POI at time t, and T represents the total number of days in a week or the total number of hours in a day, which are set to 7 and 24.
[0035] Further, in step S3, in the fusion of data features and POI spatiotemporal knowledge, numerical data is directly used as data features after Z-score normalization; the data features include accident features, climate features, calendar information at the time, traffic flow features and road features, all of which are numerical; the POI spatiotemporal knowledge includes the influence weight of each type of POI on the occurrence of accidents in each time period (POI time knowledge) and the influence weight of each type of POI on the probability of traffic accidents on each road (POI space knowledge), both of which are numerical; the POI spatiotemporal knowledge and data features are spliced in time and space dimensions respectively; then, the road features and POI space knowledge are regarded as spatial features of model input; the climate features and the calendar information and POI time knowledge at the corresponding time are regarded as time features of model input; and the traffic flow features are regarded as spatiotemporal features of model input.
[0036] Further, in step S4, the scale division module is used to divide the time features and spatiotemporal features into information of several hours before the prediction target, information of the next hour, and information of several intervals of k weeks, so as to capture the daily pattern, short-term trend and long-term periodic pattern of traffic accidents;
[0037] The specific steps of the scale division module for processing data are as follows:
[0038] S41: The input spatial and temporal features are first processed by a sliding window with a step size of 1 to obtain the input matrix
[0039] G∈R n×F , n represents the total number of hours acquired, and F represents the number of features per hour;
[0040] S42: n is set to 24 and 6 respectively to obtain the time and space-time features 24 hours and 6 hours before the prediction time, so as to extract the daily pattern and near trend of the features;
[0041] S43: The input spatial and temporal features are first processed by a sliding window with a step size of t to obtain the input matrix G∈R n×F ;
[0042] S44: k is set to 168 and n is set to 12 to obtain 12 time and space-time features at the same time with an interval of 7 days before the prediction time, so as to extract the long-term periodic pattern of the features;
[0043] S45: Output the time and space-time features of the above three different scales.
[0044] Further, in step S5, the SCM is used to learn information that is invariant in the time dimension, such as the impact of road structure and POI spatial release on accidents, based on spatial features;
[0045] The specific steps of the SCM processing data are as follows:
[0046] S501: The input spatial features are passed through a fully connected layer to reduce the feature dimension to 25;
[0047] S502: Input the reduced spatial features into the 4-layer stacked GCN;
[0048] S503: Activate the output of GCN through the Relu activation function;
[0049] Relu(x)=max(0,x)
[0050] S504: Normalize the activated output through Batch normalization;
[0051] S505: Use the output of S504 as the input of S501, repeat this process three times and add the results of each process;
[0052] S506: Use the output of the last S504 as the final output to the SCM module.
[0053] Further, in step S5, the TCM is used to learn information that changes only in the time dimension but does not change in the spatial dimension, such as the influence of weather and POI on accidents at different times, according to the time feature;
[0054] The specific steps of TCM processing data are as follows:
[0055] S511: Input the input time series features of different scales into CNN and LSTM respectively, and set the output dimensions of CNN and LSTM to 10;
[0056] S512: The output of CNN is average pooled to reduce the dimension, and then concatenated with the output of LSTM to obtain the final output of TCM.
[0057] Further, in step S5, the STCM is used to learn information that changes in both time and space dimensions, such as the impact of traffic flow on accidents on different roads and at different times, based on spatiotemporal features;
[0058] The specific steps of STCM data processing are as follows:
[0059] S521: Input the input spatiotemporal features of different scales into the GCN with 3 layers stacked respectively;
[0060] S522: Input the output of the stacked 3-layer GCN to the CNN;
[0061] S523: The output after CNN is used as the input of S521 again, and this process is repeated 3 times and the results of each time are concatenated;
[0062] S524: Use the output of the last S522 as the output of the STCM module.
[0063] Further, in step S5, the attention module is used to fuse the outputs of the SCM, TCM and STCM, selectively focus on the important features that currently affect the occurrence of the accident, and output the final prediction result;
[0064] The specific steps of the attention module to process data are as follows:
[0065] S531: splicing the outputs of SCM, TCM and STCM;
[0066] S532: The concatenated feature input is output after being operated by a multi-head self-attention mechanism, wherein the number of attention heads is set to 3 and the output dimension is set to 60;
[0067] S533: reducing the dimension of the output vector after the operation through a linear layer to reduce its dimension to 1;
[0068] S534: Pass the reduced-dimensional vector through the Sigmoid function to obtain the final output.
[0069]
[0070] Option 2:
[0071] A traffic accident prediction device focusing on the relationship between points of interest and multi-scale temporal series, comprising a data preprocessing module, a feature extraction module, a POI spatiotemporal knowledge mining module (PKM module), a knowledge fusion and feature construction module, a model training module and an accident probability prediction module;
[0072] The data preprocessing module is used to process the original accident information, climate information, traffic flow information, road information and POI information to obtain the statistical data of the target city in hours, and fill in the missing values of other information on each road; and use the probability of traffic accidents occurring on each road in the target city per hour as the label of each data;
[0073] The feature extraction module is used to convert the processed data into data features that can be used for learning;
[0074] The PKM module is used to mine POI spatiotemporal knowledge from the extracted data features;
[0075] The knowledge fusion and feature construction module is used to splice and fuse data features and POI spatiotemporal knowledge, construct spatial, temporal and spatiotemporal features according to the characteristics of the original data (changing only in the spatial dimension, changing only in the temporal dimension, changing in both spatial and temporal dimensions), and perform multi-scale division on the temporal and spatiotemporal features;
[0076] The model training module is used to train all input features, set the verification loss to F1-Score, and save the model with the largest F1-Score value; the model training module includes SCM, TCM, STCM and attention module;
[0077] The accident probability prediction module predicts the probability value of a traffic accident occurring on a certain road in the future after running the saved best model based on the input test data.
[0078] The beneficial effects of the present invention are as follows: in the task of predicting road-level traffic accidents, the present invention not only uses POI information as data features, but also associates POI, road and accident data through the PKM module proposed by the present invention, so as to explore the relationship between POI and accident in space and time. By using this relationship as prior knowledge to assist model training, the complex spatiotemporal relationship between POI and accidents can be more comprehensively revealed; the scale division module proposed by the present invention divides the original time and spatiotemporal features into three different scales: history, cycle and proximity, so that the model can learn the daily pattern, long-term cycle model and short-term trend of accidents on each road, so as to comprehensively learn time-varying data; the SCM, TCM and STCM modules can conduct targeted learning for data with different characteristics (changing only in the spatial dimension, changing only in the temporal dimension, changing in both the temporal and spatial dimensions), and fully capture the characteristics of all data; the Attention module can selectively focus on the important features that currently affect the occurrence of accidents. The model combining the above modules shows more accurate prediction results than previous models.
[0079] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0081] Figure 1 A flow chart of a traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to the present invention;
[0082] Figure 2 It is a schematic diagram of the structure of the model of the present invention;
[0083] Figure 3 It is a schematic diagram of the knowledge fusion and feature construction module of the present invention;
[0084] Figure 4 It is a structural schematic diagram of a traffic accident prediction device focusing on the relationship between points of interest and multi-scale time series according to the present invention. DETAILED DESCRIPTION
[0085] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0086] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0087] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0088] Embodiment 1:
[0089] This embodiment provides a road-level traffic accident prediction method focusing on the influence of interest points and multi-scale temporal relationships. Figure 1 to Figure 3 , including but not limited to the following steps:
[0090] Step 1: Clean the data as follows:
[0091] The collected data include accident information data, climate information data, traffic flow data, road information data, POI information data and road network information of the predicted area.
[0092] The traffic accident data indicates the time and location of a traffic accident. The accident information can be located on a specific road according to the latitude and longitude of the location where it occurred. This allows us to determine whether a traffic accident has occurred on each road every hour.
[0093] Climate data is the data recorded every hour by the climate monitoring station in the target city, which records the temperature, air pressure, humidity, cloud cover, visibility and dew point temperature of the city at that time, all of which are numerical. It is matched according to time as the climate conditions of each road at the current moment.
[0094] Traffic flow data is the number of vehicles per hour on each road. Since the original data set has missing values, for each road with missing data at that moment, we select the data of the road 2 hours before and after the missing data moment and calculate its average value to fill it. For the moment that is still missing, we use the average value of the data of all roads at that moment to fill it.
[0095] Road data includes the specific location, road type, road length, and road width of each road in the target city.
[0096] The POI information data includes the specific locations and types of POIs of all POIs in the target city.
[0097] The road network information of the predicted area includes the road graph structure of the entire area.
[0098] Finally, for each piece of sorted data, the number of accidents that occurred in the city on that day is taken as its label.
[0099] Step 2: Construct the above data into learnable data features.
[0100] After processing in step 1, all data has been focused on the information of each road per hour. Since the numerical differences between different data are too large, we normalize each data by Z-score.
[0101] Step 3: Extract POI spatiotemporal knowledge of the impact of POI on accidents through POI spatiotemporal knowledge mining module (PKM);
[0102] First, input POI data and road data, and calculate the correlation weight between the j-th POI and a road using the following formula:
[0103]
[0104] where q j represents the jth type of POI, N is the total number of roads, n(q j ) is the number of roads with the jth type of POI in the surrounding dxd area;
[0105] Then calculate the relevance score between the j-th POI and a certain road:
[0106]
[0107] where k and b are free parameters, usually set to 2 and 0.75, and f j represents the number of j-th POI category in the d×d range near all roads. dl represents the number of all POIs in the d×d range near a road. avgdl represents the average number of POIs in the d×d range near all roads;
[0108] Then, the weighted association score of the j-th POI on the i-th road is calculated to obtain the influence weight of each type of POI on the probability of traffic accidents on each road, which is used as POI spatial knowledge;
[0109]
[0110] After obtaining the input POI spatial knowledge, the POI data and traffic accident data are input, and the correlation score between the j-th POI and the accident at the t-th time is calculated, which is used as the POI time macro knowledge;
[0111]
[0112] in represents the number of traffic accidents near the j-th POI at time t, and T represents the total number of days in a week and the total number of hours in a day, which are set to 7 and 24.
[0113] Due to the huge amount of POI data, it is not feasible to directly traverse and count each data. Therefore, a random sampling method is used to extract p samples from different POI types for correlation score calculation. This method can both maintain the representativeness of the sample and improve the calculation efficiency.
[0114] The algorithm of the above steps is described as follows:
[0115]
[0116]
[0117] Step 4: Integrate the above-obtained data features with POI spatiotemporal knowledge and divide them into spatial features, temporal features, and spatiotemporal features. For specific methods, see Figure 3 :
[0118] After fusing the data features obtained in steps 2 and 3 with the POI spatiotemporal knowledge, the fused features are divided into spatial features, temporal features, and spatiotemporal features according to the three characteristics of the data: changes only in the spatial dimension, changes only in the temporal dimension, and changes in both the spatial and temporal dimensions.
[0119] Step 5: Use the scale division module to divide the temporal and spatiotemporal features obtained above into historical, periodic, and proximate scales. For predicting the probability of traffic accidents on the target road at a certain time t in the future, the time-varying data (such as sudden changes in weather and a sharp increase in traffic) several β hours before time t will have an impact on the prediction task. Therefore, we need to extract this proximate scale for subsequent learning, which is defined as follows:
[0120] G adjacent ={X t-β ,X t-(β-1) ,…,X t-1}
[0121] In addition, the information of the previous days and times of several weeks is of great reference significance for the prediction task. For example, the traffic flow data at 17:00 every Friday presents the same characteristics, so we also need to extract this periodic scale for subsequent learning, which is defined as follows:
[0122] G periodic ={X t-α×7×24 ,X t-(α-1)×7×24 ,…,X t-7×24}.
[0123] Finally, the information of the first 24 hours of this moment can be the time series data of the whole day at this moment, which helps the model learn the information of time-varying data with a longer time interval. Therefore, we also need to extract this historical scale for subsequent learning. Its definition is as follows:
[0124] G historical ={X t-24 ,X t-23 ,…,X t-1}
[0125] After the above division, we can obtain time and space-time characteristics at three different scales.
[0126] Step 6: Input the spatial features obtained in step 4 and the three-scale temporal and spatiotemporal features obtained in step 5 into the SCM, TCM, STCM modules, and Attention module for learning.
[0127] The SCM module is for spatial features and consists of stacked graph convolution GCNs. Since the occurrence of accidents is not only related to existing roads, but also to adjacent roads, the spatial impact of adjacent roads needs to be considered. Therefore, we use graph convolution to obtain spatial correlation, which aggregates spatial information from road segments and their neighborhoods. In addition, between each GCN, we use batch normalization to improve the robustness of model initialization and speed up training, and use the Relu activation function to capture nonlinear correlation.
[0128] The TCM module is aimed at time features of different scales. It consists of a standard convolutional CNN and a long short-term memory network LSTM in parallel. LSTM and CNN receive the same time series data as input and connect their results to produce output. LSTM can learn long-term dependencies to effectively capture time series information, while CNN can consider the correlation between multiple variables and focus on the extraction of local features. The two complement each other to improve the overall accuracy.
[0129] The STCM module is a spatiotemporal feature for different scales, which is composed of multiple GCN and CNN deconstruction stacking. In order to aggregate the spatial traffic flow features of different time intervals, the GCN can be extended along the time dimension to summarize the traffic flow information of itself and neighboring roads. However, since the GCN can only capture the spatial information of traffic flow at each time interval t, a standard temporal convolution layer is required to summarize the temporal information of traffic flow at each time interval.
[0130] Finally, different information can be learned through the joint action of various modules, and the final output of the entire model also needs to integrate the outputs of the above modules.
[0131] The Attention module not only integrates the output of each module, but also allows the model to selectively focus on important features. When the weather conditions are bad, the time feature will have a greater impact on the occurrence of accidents, while in normal times, the spatiotemporal and spatial features often have a greater impact on the occurrence of accidents. Therefore, after splicing the outputs of the three modules, we calculate it through the multi-head self-attention mechanism in the Attention module. When learning input data through the attention mechanism, different attention weights can be assigned to different parts, so that it can automatically determine which features are more important in a given task.
[0132] Finally, the calculation result is reduced to 1 dimension through the linear layer, and the predicted probability is obtained through the Sigmoid function. The F1-score value between the model output value and the label value is calculated using the loss function, and Adam is used as the optimizer of the model. Finally, the model is trained, and the optimal model parameters are recorded and saved.
[0133] Step 7: Load the saved parameters and run the model. After inputting the corresponding historical data, predict the probability of a traffic accident occurring on a certain road in the future.
[0134] Application example: After the present invention selected the Manhattan area of Los Angeles, USA as the research area, it was modeled according to the above specific embodiments. The test results showed that the prediction accuracy of the present invention is better than that of previous traffic accident prediction models. Under real experimental conditions, the F1-score value of the present invention is 0.6698, while the previous models: the F1-score value of the traditional machine learning model SVM is 0.5880, the F1-score values of the deep learning models CNN and LSTM are 0.6074 and 0.6213 respectively, and the newer deep learning models DSTGCN (proposed in 2021) and ASTGCN (proposed in 2023) for road-level traffic accident prediction have F1-score values of 0.6470 and 0.6544 respectively.
[0135] Embodiment 2:
[0136] This embodiment provides a road-level traffic accident prediction device that focuses on the impact of interest points and multi-scale temporal relationships. Figure 4 , including the following modules:
[0137] Data preprocessing module: used to process the original accident information, climate information, traffic flow information, road information, and POI information to obtain hourly data for all roads, and use the probability of a traffic accident occurring per hour on each road in the target city as a label for each piece of data. In a preferred embodiment, the data preprocessing module includes a data receiver, a first unit of a data processor, and a data storage unit, wherein the data receiver is used to input various raw data in csv and h5 formats into the data processor, and the data processor cleans, calculates, and counts the raw data according to the rules described in the embodiment, and the data storage unit is used to store the data processed by the data processor for use by subsequent modules.
[0138] Feature extraction and POI knowledge mining module: used to convert the processed data into data features that can be used for learning, and to mine POI spatiotemporal knowledge. In a preferred embodiment, the feature extraction and POI knowledge mining module includes a second data processor unit and a third data processor unit, the two units are in parallel, the second unit is used to perform Z-score normalization on the original data, and the third processing unit is used to mine the spatiotemporal knowledge of POI from the data for subsequent modules to process.
[0139] Knowledge fusion and feature construction module: used to splice and fuse data features and POI spatiotemporal knowledge, construct spatial, temporal and spatiotemporal features according to the characteristics of its original data (changes only in the spatial dimension, changes only in the temporal dimension, changes in both spatial and temporal dimensions), and divide the temporal and spatiotemporal features into multiple scales. In a preferred embodiment, the knowledge fusion and feature construction module includes a fourth unit and a fifth unit of the data processor, and the two units are serial. The fourth unit is used to fuse the data features input by the second and third units with the POI spatiotemporal knowledge and divide them into three types of features: spatial, temporal, and spatiotemporal. The fifth unit is used to divide the temporal and spatiotemporal features into scales.
[0140] Model training module: input the features after knowledge fusion and feature module construction processing, adjust the model's learning rate, batch size and other parameters of each model, train the model, and save the best model. In a preferred embodiment, the model training module includes a sixth data processor unit, a model memory, and a computer program that can be run on the processing unit. The sixth data processor unit is used to execute the computer program corresponding to the model including the SCM, TCM, STCM, and Attention modules, and the model memory is used to store the best performing model.
[0141] Accident prediction module: Based on the input test data, the saved best model is run to predict the probability of a traffic accident on a certain road in the future. In a preferred embodiment, the traffic accident prediction module includes a data receiver, a model reader, a model processor, and a data outputter. The data receiver is used to input the input test data into the model processor, and the model processor reads the best model through the model reader and runs the entire program of the model, and then transmits the result to the data outputter, which outputs the final predicted probability.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A traffic accident prediction method focusing on the relationship between points of interest and multi-scale temporal series, It is characterized in that The method specifically comprises the following steps: S1: Collect and clean data and extract data features; S2: extracting POI spatiotemporal knowledge of the impact of POI on accidents through the PKM module, where POI represents point of interest and PKM module represents POI spatiotemporal knowledge mining module; S3: Fuse the data features extracted in step S1 and the POI spatiotemporal knowledge into new features, and divide them into spatial features, temporal features, and spatiotemporal features; S4: The temporal and spatiotemporal features are divided into historical, periodic and adjacent scales through the scale division module; S5: Input spatial features, temporal features of different scales, and spatiotemporal features into the model for training, and save the best performing model; the model includes SCM, TCM, STCM, and attention module; wherein SCM represents spatial convolution module, TCM represents temporal convolution module, and STCM represents spatiotemporal convolution module; S6: Input the test data into the saved best model to obtain the predicted value of a traffic accident on a certain road in the future.
2. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to claim 1, It is characterized in that In step S1, the data includes accident information, climate information, traffic flow information, road information, POI information and road network information of the predicted area; the accident information includes the locations and times of all accidents in the target city within 24 hours; the climate information includes the weather conditions, wind direction and temperature information of the target city within 24 hours; the traffic flow information is the number of traffic flows on each road in the target city within 24 hours; the road information includes the specific location, road type, road length and road width of each road in the target city; the POI information includes the specific location and type of all POIs in the target city, and the road network information includes the road map structure of the predicted area; The specific data cleaning is as follows: select the data of the road 2 hours before and after the missing data moment, and calculate its average value for filling; for the moment that is still missing, use the average value of the data of all roads at that moment for filling.
3. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to claim 1, It is characterized in that In step S2, the PKM module is used to link the POI data with the road and collision accident data to extract the spatiotemporal relationship between the POI and the possibility of collision accidents, so as to determine the impact of different types of POIs on road collision accidents at different times; The specific steps of the PKM module processing data are as follows: S21: Input POI data and road data, and calculate the correlation weight IDF(q j ): Among them, q j represents the jth type of POI, N is the total number of roads, n(q j ) is the number of roads with the j-th type of POI around them; S22: Calculate the correlation score R(q j ): Among them, k and b are free parameters, f j represents the number of the jth POI category near all roads; dl represents the number of all POIs near a road; avgdl represents the average number of POIs near all roads; S23: Calculate the weighted association score of the j-th POI to the i-th road In this way, the influence weight of each type of POI on the probability of traffic accidents on each road is obtained, which is used as the macro knowledge of POI space; S24: Input POI data and traffic accident data, and calculate the correlation score between the j-th POI and the accident at time t Take it as POI time macro knowledge; in, represents the number of traffic accidents near the j-th POI at time t, and T represents the total number of days in a week or the total number of hours in a day.
4. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to claim 1, It is characterized in that In step S3, in the fusion of data features and POI spatiotemporal knowledge, numerical data is directly used as data features after Z-score normalization; the data features include accident features, climate features, calendar information at the time, traffic flow features and road features, all of which are numerical; the POI spatiotemporal knowledge includes the influence weight of each type of POI on the occurrence of accidents in each time period and the influence weight of each type of POI on the probability of traffic accidents on each road, all of which are numerical; the POI spatiotemporal knowledge and data features are spliced in time and space dimensions respectively; then, the road features and POI spatial knowledge are regarded as spatial features of model input; the climate features and the calendar information and POI time knowledge at the corresponding time are regarded as time features of model input; and the traffic flow features are regarded as spatiotemporal features of model input.
5. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to claim 1, It is characterized in that In step S4, the scale division module is used to divide the time features and spatiotemporal features into information of several hours before the prediction target, information of the next hour, and information of several intervals of k weeks, so as to capture the daily pattern, short-term trend and long-term periodic pattern of traffic accidents; The specific steps of the scale division module for processing data are as follows: S41: The input spatial and temporal features are first processed by a sliding window with a step size of 1 to obtain the input matrix G∈R n×F , n represents the total number of hours acquired, and F represents the number of features per hour; S42: n is set to 24 and 6 respectively to obtain the time and space-time features 24 hours and 6 hours before the prediction time, so as to extract the daily pattern and near trend of the features; S43: The input spatial and temporal features are first processed by a sliding window with a step size of t to obtain the input matrix G∈R n ×F ; S44: k is set to 168 and n is set to 12 to obtain 12 time and space-time features at the same time with an interval of 7 days before the prediction time, so as to extract the long-term periodic pattern of the features; S45: Output the time and space-time features of the above three different scales.
6. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to claim 1, It is characterized in that In step S5, the SCM is used to learn the information that is invariant in the time dimension and the impact of POI spatial publishing on accidents based on the spatial features; The specific steps of the SCM processing data are as follows: S501: The input spatial features are passed through a fully connected layer to reduce the feature dimension to 25; S502: Input the reduced spatial features into the 4-layer stacked GCN; S503: Activate the output of GCN through the Relu activation function; S504: Normalize the activated output through Batch normalization; S505: Use the output of S504 as the input of S501, repeat this process three times and add the results of each process; S506: Use the output of the last S504 as the final output to the SCM module.
7. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to claim 1, It is characterized in that In step S5, the TCM is used to learn information that changes only in the time dimension but does not change in the spatial dimension and the influence of POI on the accident at different times according to the time feature; The specific steps of TCM processing data are as follows: S511: Input the input time series features of different scales into CNN and LSTM respectively, and set the output dimensions of CNN and LSTM; S512: The output of CNN is average-pooled and then concatenated with the output of LSTM to obtain the final output of TCM.
8. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to claim 1, It is characterized in that In step S5, the STCM is used to learn the influence of information that changes in both time and space dimensions on accidents on different roads and at different times according to the spatiotemporal features; The specific steps of STCM data processing are as follows: S521: Input the input spatiotemporal features of different scales into the GCN with 3 layers stacked respectively; S522: Input the output of the stacked 3-layer GCN to the CNN; S523: The output after CNN is used as the input of S521 again, and this process is repeated 3 times and the results of each time are concatenated; S524: Use the output of the last S522 as the output of the STCM module.
9. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series according to claim 1, It is characterized in that In step S5, the attention module is used to fuse the outputs of SCM, TCM and STCM, selectively focus on the important features that currently affect the occurrence of the accident, and output the final prediction result; The specific steps of the attention module to process data are as follows: S531: splicing the outputs of SCM, TCM and STCM; S532: The concatenated feature input is output after being operated by a multi-head self-attention mechanism; S533: reducing the dimension of the output vector after the operation through a linear layer to reduce its dimension to 1; S534: Pass the reduced-dimensional vector through the Sigmoid function to obtain the final output.
10. A traffic accident prediction device focusing on the relationship between points of interest and multi-scale temporal series, It is characterized in that The device includes a data preprocessing module, a feature extraction module, a PKM module, a knowledge fusion and feature construction module, a model training module and an accident probability prediction module; The data preprocessing module is used to process the original accident information, climate information, traffic flow information, road information and POI information to obtain the statistical data of the target city in hours, and fill in the missing values of other information on each road; and use the probability of traffic accidents occurring on each road in the target city per hour as the label of each data; The feature extraction module is used to convert the processed data into data features that can be used for learning; The PKM module is used to mine POI spatiotemporal knowledge from the extracted data features; The knowledge fusion and feature construction module is used to splice and fuse data features and POI spatiotemporal knowledge, construct space, time and spatiotemporal features according to the characteristics of the original data, and divide the time and spatiotemporal features into multiple scales; The model training module is used to train all input features, set the verification loss to F1-Score, and save the model with the largest F1-Score value; the model training module includes SCM, TCM, STCM and attention module; The accident probability prediction module predicts the probability value of a traffic accident occurring on a certain road in the future after running the saved best model based on the input test data.
Citation Information
Patent Citations
City region traffic accident risk prediction method
CN109993970A
Urban traffic accident risk prediction method based on road network
CN113283665A
Traffic accident prediction method based on graph attention network
CN118053095A
Traffic accident prediction systems and methods
US20230140289A1
