Traffic accident prediction method and device focusing on the relationship between points of interest and multi-scale temporal series
Through the POI space-time knowledge mining and multi-scale timing relationship traffic accident prediction method, combined with space, time and space-time convolution modules, the problem of insufficient road-level prediction accuracy in the existing technology is solved, and more accurate traffic accident prediction is achieved.
Patent Information
- Application Number
- CN202410638807.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-05-22
AI Technical Summary
Existing traffic accident prediction methods are difficult to provide accurate predictions at the road level, and ignore the dynamic functionality and space-time correlation of points of interest (POI), resulting in the loss of key information and the inability to fully capture complex space-time correlations.
The impact of interest points on accidents is extracted through the POI space-time knowledge mining module (PKM), and combined with the spatial convolution module (SCM), time-time convolution module (TCM), and space-time convolution module (STCM) and attention module, traffic accident prediction of multi-scale timing relationships is carried out, data characteristics and POI space-time knowledge are integrated, and model training and prediction are carried out.
It improves the accuracy of road-level traffic accident prediction, can reveal the complex space-time relationship between POI and accidents more comprehensively, learn the daily patterns, long-term cycles and short-term trends of accidents, and achieve more accurate prediction results.
Smart Images

Figure CN118571007B_ABST
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 points of interest and multi-scale time series. Background Art
[0002] Traffic accidents not only threaten the lives of drivers and passengers but also place a heavy burden on the transportation system and the economy. Therefore, predicting whether a traffic accident will occur on a specific road is crucial. For traffic management departments, this can help them better plan traffic and implement strategies in advance, providing strong support for traffic management and emergency response. For drivers, this can help them drive more cautiously, plan safe routes, and reduce the risk 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, and KNN. These methods offer the advantages of simplicity and low computational cost. However, due to the complex spatiotemporal correlations and the influence of various factors such as traffic flow, weather conditions, and road networks, they struggle to fit a large number of heterogeneous features and cannot fully capture complex spatiotemporal correlations, making it difficult to achieve highly accurate predictions.
[0006] 2) Methods based on deep learning models
[0007] With the recent development of deep learning, various deep learning models, such as LSTM, CNN, and GCN, have been applied to this field. Deep learning models, because they can fit a large number of heterogeneous features and capture complex spatiotemporal correlations, are more effective in learning the nonlinear spatiotemporal correlations of traffic accident data. This often results in better prediction results than machine learning-based methods.
[0008] Each of the aforementioned methods has several issues: ① Most existing traffic accident prediction methods divide cities into regular grids, disrupting their geographic characteristics; or they perform predictions at the administrative district level, failing to provide more detailed and accurate road-level predictions. ② Existing road-level traffic accident prediction methods all input raw time series data into the model, making it difficult to mine deeper temporal relationships. ③ Existing traffic accident prediction methods either directly ignore the impact of points of interest (POIs) on accidents or simply treat POIs as static road features, focusing on the number of POIs while ignoring their functional importance. For example, there are often many restaurants near schools. In this case, schools should be considered key POIs that influence accidents on nearby roads, but traditional methods may mistakenly identify restaurants as key POIs. This problem results in the loss of critical information. Furthermore, previous methods have not considered the differences in the temporal impact of different POI types on accident occurrence, resulting in the models failing to fully capture the complex spatiotemporal relationships between POIs and traffic accidents. Often, such spatiotemporal relationships can be used as spatiotemporal knowledge to assist the model in achieving more accurate predictions.
[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, the object of the present invention is to provide a traffic accident prediction method and device that focuses on the relationship between points of interest and multi-scale temporal series, 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] Option 1:
[0013] A traffic accident prediction method focusing on the relationship between points of interest and multi-scale temporal series includes the following steps:
[0014] S1: Collect and clean data and extract data features;
[0015] S2: Extracting the spatiotemporal knowledge of points of interest (POIs) that influence 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 near-scale by 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] Furthermore, 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 locations and types 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] Furthermore, 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 POIs and the likelihood 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 for 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 jth 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, 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 and 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 Consider 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] Furthermore, 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 spatial knowledge), all of which are numerical; the POI spatiotemporal knowledge and data features are spliced in the time and space dimensions respectively; then, the road features and POI spatial knowledge are regarded as spatial features of the model input; the climate features and the calendar information and POI time knowledge at the corresponding time are regarded as temporal features of the model input; and the traffic flow features are regarded as spatiotemporal features of the model input.
[0036] Furthermore, in step S4, the scale division module is used to divide the temporal 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 cyclical pattern of traffic accidents;
[0037] The specific steps of the scale division module to process data are as follows:
[0038] S41: The input space-time and time 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 moment, so as to extract the daily pattern and approaching trend of the features;
[0041] S43: The input space-time and time features are first processed by the sliding window with a step size of t to obtain the input matrix G∈R n×F ;
[0042] S44: Set k to 168 and n 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] Furthermore, 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 a 4-layer GCN stack;
[0048] S503: Activate the output of GCN through the Relu activation function;
[0049] Relu(x)=max(0,x)
[0050] S504: The activated output is normalized 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 step.
[0052] S506: The output of the last S504 is used as the final output to the SCM module.
[0053] Furthermore, in step S5, the TCM is used to learn information that changes only in the temporal dimension but remains unchanged in the spatial dimension, such as the impact of weather and POI on accidents at different times, based on the temporal features;
[0054] The specific steps of TCM data processing are as follows:
[0055] S511: Input the input time series features of different scales into CNN and LSTM respectively, and set the output dimension of CNN and LSTM to 10;
[0056] S512: The output of the CNN is average pooled to reduce the dimension, and then concatenated with the output of the LSTM to obtain the final output of the TCM.
[0057] Furthermore, 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 the spatiotemporal features;
[0058] The specific steps of STCM data processing are as follows:
[0059] S521: Input the spatiotemporal features of different scales into the GCN with three stacked layers 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 spliced together;
[0062] S524: The output of the last S522 is used as the output of the STCM module.
[0063] Furthermore, 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 processed by a multi-head self-attention mechanism and then output, where the number of attention heads is set to 3 and the output dimension is set to 60;
[0067] S533: The output vector after the operation is subjected to a linear layer dimensionality reduction, and its dimension is reduced to 1;
[0068] S534: Pass the dimensionality-reduced 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, including 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 hourly statistical data for the target city, 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 for each data item;
[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 of 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 runs the saved best model based on the input test data to predict the probability value of a traffic accident occurring on a certain road in the future.
[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 a data feature, but also uses the PKM module proposed in the present invention to correlate POI, road, and accident data, thereby exploring the spatial and temporal relationships between POIs and accidents. By using this relationship as prior knowledge to assist model training, the complex spatiotemporal relationships between POIs and accidents can be more comprehensively revealed. The scale division module proposed in the present invention divides the original time and spatiotemporal features into three different scales: historical, cyclical, and proximal. This allows the model to learn the daily patterns, long-term cyclical models, and short-term trends of accidents on each road, thereby comprehensively learning time-varying data. The SCM, TCM, and STCM modules can conduct targeted learning on data with different characteristics (changing only in the spatial dimension, changing only in the temporal dimension, or changing in both the temporal and spatial dimensions), fully capturing the characteristics of all data. The Attention module can selectively focus on the important features that currently influence the occurrence of accidents. The model combining the above modules demonstrates more accurate prediction results than previous models.
[0079] Other advantages, objects, and features of the present invention will be described in part in the following description and, in part, will be apparent to those skilled in the art upon examination of the following description or may be learned from practice of the present invention. The objects and other advantages of the present invention may 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 with reference to the accompanying drawings, in which:
[0081] Figure 1 Schematic diagram of the flow of the traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series of the present invention;
[0082] Figure 2 Schematic diagram of the model structure of the present invention;
[0083] Figure 3 Schematic diagram of the knowledge fusion and feature construction module of the present invention;
[0084] Figure 4 Schematic diagram of the structure of the traffic accident prediction device focusing on the relationship between points of interest and multi-scale time series of the present invention. DETAILED DESCRIPTION
[0085] The following describes the embodiments of the present invention by means of 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 are only schematic illustrations of the basic concept of the present invention, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0086] Among them, the accompanying drawings are only for illustrative purposes and represent only schematic diagrams rather than actual pictures, and should not be understood as limiting the present invention. In order to better illustrate the embodiments of the present invention, some parts of the accompanying drawings may be omitted, enlarged or reduced, and do not represent the dimensions of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions may be omitted in the accompanying drawings.
[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 there are terms such as "upper", "lower", "left", "right", "front", "back", etc. indicating directions or positional relationships, they are based on the directions or positional relationships shown in the drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operate in a specific direction. Therefore, the terms describing the positional 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] Example 1:
[0089] This embodiment provides a road-level traffic accident prediction method that focuses on the influence of points of interest and the multi-scale temporal relationship. Figures 1 to 3 , including but not limited to the following steps:
[0090] Step 1: Clean the data as follows:
[0091] The collected data includes accident information data, climate information data, traffic flow data, road information data, POI information data and road network information of the predicted area.
[0092] Traffic accident data indicates the time and location of a traffic accident. Accident information can be located on a specific road based on the latitude and longitude of the location. This allows us to determine whether a traffic accident has occurred on each road every hour.
[0093] Climate data is recorded hourly by the target city's climate monitoring station. It records the city's temperature, air pressure, humidity, cloud cover, visibility, and dew point temperature at that time. All data is in numerical form. This data is then matched against time to provide the current climate conditions for each road.
[0094] Traffic flow data is the number of vehicles on each road per hour. Because the original dataset contains missing values, for each road with missing data, we use the average of the data from the two hours before and after the missing data moment to fill in the missing data. For any missing data moments, we use the average of the data from all roads at that moment to fill in the missing data.
[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 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 hourly information for each road. Because the numerical differences between different data are too large, we perform Z-score normalization on each data.
[0101] Step 3: Extract POI spatiotemporal knowledge about the impact of POIs on accidents through the POI spatiotemporal knowledge mining module (PKM);
[0102] First, input POI data and road data, and calculate the correlation weight between the j-th type of POI and a certain 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 time t is calculated and 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 massive amount of POI data, it's not feasible to directly traverse and count each data point. Therefore, we use a random sampling method to extract p samples from different POI types and calculate the correlation score. This method maintains the representativeness of the samples while improving computational efficiency.
[0114] The algorithm of the above steps is described as follows:
[0115]
[0116]
[0117] Step 4: Fuse the above-obtained data features with POI spatiotemporal knowledge and divide them into spatial features, temporal features, and spatiotemporal features. For specific methods, please refer to 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 based on 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 partitioning module to divide the temporal and spatiotemporal features obtained above into historical, periodic, and proximate scales. When predicting the probability of a traffic accident on a target road at time t on a future day, time-varying data (such as sudden changes in weather or a surge in traffic) several β hours before time t will affect the prediction task. Therefore, we need to extract this proximate scale for subsequent learning. Its definition is as follows:
[0120] G adjacent ={X t-β ,X t-(β-1) ,…,X t-1}
[0121] In addition, information from the past several weeks at that time and day is crucial for forecasting. For example, traffic flow data at 5:00 PM every Friday exhibits the same characteristics. Therefore, we also need to extract this periodic scale for subsequent learning. Its definition is as follows:
[0122] G periodic ={X t-α×7×24 ,X t-(α-1)×7×24 ,…,X t-7×24}.
[0123] Finally, the information of the previous 24 hours can be regarded as the time series data of the entire day, 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 time and spatiotemporal features of the three scales obtained in step 5 into the SCM, TCM, STCM modules, and Attention module for learning respectively.
[0127] The SCM module targets spatial features and consists of stacked graph convolutional networks (GCNs). Since accidents are not only related to the existing road but also to adjacent roads, the spatial impact of adjacent roads needs to be considered. Therefore, we use graph convolution to capture spatial correlation, aggregating spatial information from the road segment and its neighborhood. Furthermore, between each GCN, we use batch normalization to improve the robustness of model initialization and accelerate training, and use the ReLU activation function to capture nonlinear correlations.
[0128] The TCM module targets temporal features at different scales. It consists of a standard convolutional convolutional neural network (CNN) and a long short-term memory (LSTM) network in parallel. The LSTM and CNN receive the same time series data as input and concatenate their results to produce the output. The LSTM learns long-term dependencies, effectively capturing temporal information, while the CNN considers correlations between multiple variables and focuses on extracting local features. The two complement each other, improving overall accuracy.
[0129] The STCM module targets spatiotemporal features at different scales and is constructed by stacking multiple GCNs and CNNs. To aggregate spatial traffic flow features at different time intervals, the GCN is extended along the temporal dimension, summarizing traffic flow information for itself and adjacent roads. However, since the GCN can only capture spatial traffic flow information at each time interval t, a standard temporal convolutional layer is required to aggregate the temporal traffic flow information for each time interval.
[0130] Finally, different information can be learned through the joint action of each module, 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 outputs of each module but also allows the model to selectively focus on important features. In severe weather conditions, temporal features have a greater impact on accidents, while in normal times, spatiotemporal and spatial features tend to have a greater impact. Therefore, after concatenating the outputs of the three modules, we apply this to 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, allowing it to automatically determine which features are more important for a given task.
[0132] Finally, the calculated results are reduced to one dimension through a linear layer and then applied to the sigmoid function to obtain the predicted probability. A loss function is used to calculate the F1-score between the model output and the label value, and Adam is used as the model optimizer. 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 value 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 performed modeling according to the above specific embodiments. The test results showed that the prediction accuracy of the present invention is better than the previous traffic accident prediction model. 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] Example 2:
[0136] This embodiment provides a road-level traffic accident prediction device that focuses on the influence of points of interest and the multi-scale temporal relationship. Figure 4 , including the following modules:
[0137] The data preprocessing module processes raw accident information, climate information, traffic flow information, road information, and POI information to generate hourly data for all roads. Each piece of data is labeled with the hourly probability of a traffic accident on each road in the target city. In a preferred embodiment, the data preprocessing module includes a data receiver, a first data processor unit, and a data storage unit. The data receiver inputs various raw data in CSV and H5 formats into the data processor, which then cleans, calculates, and performs statistics on the raw data according to the rules described in the embodiments. The data storage unit stores the processed data for use by subsequent modules.
[0138] The feature extraction and POI knowledge mining module converts the processed data into learning-capable data features and mines POI spatiotemporal knowledge. In a preferred embodiment, this module includes a second data processing unit and a third data processing unit, both of which operate in parallel. The second unit performs Z-score normalization on the raw data, while the third processing unit mines POI spatiotemporal knowledge from the data for subsequent processing.
[0139] The knowledge fusion and feature construction module is used to combine and fuse data features with POI spatiotemporal knowledge, constructing spatial, temporal, and spatiotemporal features based on the characteristics of the original data (changing only in the spatial dimension, changing only in the temporal dimension, or changing in both spatial and temporal dimensions), and performing multi-scale division of the temporal and spatiotemporal features. In a preferred embodiment, the knowledge fusion and feature construction module includes a fourth and fifth data processor unit, the two units being connected in series. The fourth unit is used to fuse the data features input from 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 different scales.
[0140] The model training module inputs features processed by knowledge fusion and feature module construction, trains the model after adjusting various model parameters such as the learning rate and batch size, and saves the optimal model. In a preferred embodiment, the model training module includes a sixth data processor unit, a model memory, and a computer program executable on the processing unit. The sixth data processor unit is configured to execute the computer program corresponding to the model including the SCM, TCM, STCM, and Attention modules. The model memory is configured to store the optimal performing model.
[0141] The accident prediction module uses the input test data and runs the stored optimal model to predict the probability of a traffic accident occurring on a specific 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 output device. The data receiver inputs the input test data to the model processor, which, after reading the optimal model from the model reader and running the entire model program, transmits the results to the data output device, which then outputs the final predicted probability.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. 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 solutions of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solutions, which should all 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, characterized by: The method specifically comprises the following steps: S1: Collect and clean data and extract data features; the data includes accident information, climate information, traffic flow information, road information, POI information, and road network information of the predicted area; S2: Extracting POI spatiotemporal knowledge of its impact on accidents through the PKM module, where POI stands for point of interest and PKM module stands for 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 near-scale by 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; where SCM represents spatial convolution module, TCM represents temporal convolution module, and STCM represents spatiotemporal convolution module; S6: Input test data into the saved best model to obtain the predicted value of a traffic accident on a certain road in the future; 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 POI and the probability of collision accidents, thereby determining the impact of different types of POI on road collision accidents at different times; The specific steps of the PKM module for 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 jth 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 POIs of the jth 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 and 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 type POI and the accident at time t Consider 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; In step S4, the scale division module is used to divide the temporal 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 cyclical pattern of traffic accidents; The specific steps of the scale division module to process data are as follows: S41: The input space-time and time 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 moment, so as to extract the daily pattern and approaching trend of the features; S43: The input space-time and time features are first processed by the sliding window with a step size of t to obtain the input matrix G∈R n ×F ; S44: 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.
2. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale temporal series according to claim 1 is characterized in that: In step S1, the accident information includes the locations and times of all accidents that occurred 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 temporal series according to claim 1 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 characteristics, climate characteristics, calendar information at the corresponding time, traffic flow characteristics, and road characteristics, 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 the time and space dimensions respectively; then, the road characteristics and POI spatial knowledge are regarded as spatial features of the model input; the climate characteristics, calendar information at the corresponding time, and POI time knowledge are regarded as temporal features of the model input; and the traffic flow characteristics are regarded as spatiotemporal features of the model input.
4. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale temporal series according to claim 1, 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 release on accidents based on 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 a 4-layer GCN stack; S503: Activate the output of GCN through the Relu activation function; S504: The activated output is normalized 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 step. S506: The output of the last S504 is used as the final output of the SCM module.
5. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale temporal series according to claim 1, characterized in that: In step S5, the TCM is used to learn information that changes only in the time dimension but remains unchanged in the spatial dimension and the impact of POIs on accidents at different times based on the time features; The specific steps of TCM data processing 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.
6. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale temporal series according to claim 1, characterized in that: In step S5, the STCM is used to learn the impact of information that changes in both time and space dimensions on accidents on different roads and at different times based on spatiotemporal features; The specific steps of STCM data processing are as follows: S521: Input the spatiotemporal features of different scales into the GCN with three stacked layers 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 spliced together; S524: The output of the last S522 is used as the output of the STCM module.
7. The traffic accident prediction method focusing on the relationship between points of interest and multi-scale temporal series according to claim 1, characterized in that: 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; 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 processed by a multi-head self-attention mechanism and then output; S533: The output vector after the operation is subjected to a linear layer dimensionality reduction, and its dimension is reduced to 1; S534: Pass the dimensionality-reduced vector through the Sigmoid function to obtain the final output.
8. A device applicable to the traffic accident prediction method focusing on the relationship between points of interest and multi-scale time series as claimed in any one of claims 1 to 7, 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 hourly statistical data for the target city, 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 for each data item; 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 spatial, temporal and spatiotemporal features according to the characteristics of the original data, and perform multi-scale division of the temporal and spatiotemporal features; 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 runs the saved best model based on the input test data to predict the probability value of a traffic accident occurring on a certain road in the future.
Citation Information
Patent Citations
City region traffic accident risk prediction method
CN109993970A
Urban traffic accident risk prediction method based on road network
CN113283665A