Traffic flow prediction method and system based on self-attention mechanism

By introducing a self-attention mechanism in traffic flow prediction, a spatial self-attention model and a time self-attention model are established, the problem of ignoring the delay in traffic transmission time in the existing technology is solved, and more accurate traffic flow prediction is achieved.

CN119516760AActive Publication Date: 2025-02-25JILIN UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410695790.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2025-02-25
Estimated Expiration
2044-05-31

AI Technical Summary

Technical Problem

The prior art ignores the time delay of traffic conditions propagating between different locations in traffic flow prediction, resulting in inaccurate prediction results.

Method used

Using the traffic flow prediction method based on the self-attention mechanism, the space self-attention model, the event delivery delay perception model and the time self-attention model are established, and combined with the spatial characteristics, time delay characteristics and dynamic time mode characteristics in historical traffic information, the Comprehensive predictive model.

Benefits of technology

It improves the accuracy of traffic flow prediction, can capture the spatial distribution and dynamic propagation process of traffic flow more accurately, and helps traffic management departments to formulate more effective strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119516760A_ABST
    Figure CN119516760A_ABST
Patent Text Reader

Abstract

The invention discloses a traffic flow prediction method and system based on a self-attention mechanism, and the method comprises the steps: collecting historical traffic information of a target monitoring region, building a spatial self-attention model, and carrying out the processing of the historical traffic information, and obtaining the spatial feature information of a road; establishing an event transfer time delay perception model, and performing feature conversion and clustering analysis on the historical traffic information to obtain time delay feature information; establishing a time self-attention model to process the historical traffic information to obtain dynamic time mode feature information; combining the spatial feature information, the time delay feature information and the dynamic time mode feature information, and constructing a comprehensive prediction model by applying a self-attention mechanism; and performing performance evaluation and parameter adjustment on the comprehensive prediction model to obtain a standard prediction model, and predicting the future traffic flow by using the standard prediction model. Accurate prediction of the future traffic flow is realized, and the traffic jam can be relieved and the traffic efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of traffic prediction, and in particular to a traffic flow prediction method and system based on a self-attention mechanism. Background Art

[0002] As a road carrier for large traffic flows, the safety and smoothness of highways have always been the two major focuses of traffic management in the national trunk highway network, so accurate traffic forecasting is very important. Traffic flow forecasting technology can minimize the negative impact of traffic problems on urban transportation systems. As a key area in the intelligent transportation system, traffic flow forecasting technology can provide core data support for traffic management.

[0003] In the existing technology, neural network models are mostly used for traffic flow prediction, but graph neural network-based models mostly use a static approach to model spatial dependencies, which limits the ability to learn dynamic traffic patterns. At the same time, this method only considers process spatial information and ignores the reality that there is a time delay in the propagation of traffic conditions between different locations, resulting in inaccurate prediction results. Summary of the invention

[0004] In order to overcome the above-mentioned deficiencies of the prior art, the present application provides a traffic flow prediction method and system based on a self-attention mechanism.

[0005] In a first aspect, the present application provides a traffic flow prediction method based on a self-attention mechanism, the method comprising:

[0006] Collecting historical traffic information of a target monitoring area, and preprocessing the historical traffic information to obtain standard historical traffic information;

[0007] Establishing a spatial self-attention model, processing the historical traffic information, and obtaining spatial characteristic information of roads in the target monitoring area;

[0008] Establishing an event transmission delay perception model, performing feature conversion on the historical traffic information, clustering the converted features using a time clustering algorithm, and obtaining time delay feature information;

[0009] Establishing a time self-attention model, processing the historical traffic information, and extracting dynamic time pattern feature information;

[0010] Combining spatial feature information, time delay feature information and dynamic time pattern feature information, applying self-attention mechanism, and constructing a comprehensive prediction model;

[0011] Performing performance evaluation on the comprehensive prediction model to obtain a performance evaluation result;

[0012] Based on the performance evaluation results, the parameters of the comprehensive prediction model are adjusted to obtain a standard prediction model, and the standard prediction model is used to predict the future traffic flow in the target monitoring area.

[0013] Preferably, historical traffic information of different sections and different time points in the target monitoring area is collected, wherein the historical traffic information includes traffic flow information, road network information, weather environment information, timestamp information and historical event information;

[0014] The road network information refers to the topological structure of the road system, including the connection relationship of roads, road grades, and the location and type of road intersections;

[0015] The weather environment information refers to the weather conditions during the traffic operation, including temperature, humidity, rainfall and wind speed;

[0016] The timestamp information refers to the time point information of historical traffic information collection;

[0017] The historical event information refers to events that have a temporary or long-term impact on traffic flow, including traffic accidents, road closures and construction activities;

[0018] The historical traffic information is preprocessed to obtain standard historical traffic information.

[0019] Preferably, extracting road network information from the historical traffic information;

[0020] Based on the topological structure of the road network information, defining the spatial relationship of nodes between road intersections in the target monitoring area;

[0021] Constructing a spatial self-attention model, and calculating the spatial dependency weights between each node and other nodes based on the spatial relationship of the nodes;

[0022] Based on the spatial dependency weight, the features of each node are weighted and aggregated to obtain the spatial feature information of the roads in the target monitoring area.

[0023] Preferably, extracting historical event information from the historical traffic information, as well as timestamp information and traffic flow information corresponding to the time period in which the event occurred;

[0024] Based on the timestamp information, the traffic flow information within the time period of the time occurrence is sorted in chronological order;

[0025] The traffic flow information includes vehicle flow information, vehicle speed information and vehicle density information. Based on the traffic flow information, the vehicle flow change rate, vehicle speed change rate and vehicle density change rate of each node are calculated respectively. The vehicle flow change rate, vehicle speed change rate and vehicle density change rate constitute the traffic condition delay characteristic information of the node.

[0026] The traffic condition time delay characteristic information is input into a clustering algorithm for clustering analysis, and the propagation time delay between each node and other nodes is calculated to obtain the time delay characteristic information.

[0027] Preferably, traffic flow information, timestamp information, road network information and weather environment information are extracted from the historical traffic information;

[0028] Sorting the traffic flow information in chronological order and performing time serialization processing in combination with the timestamp information;

[0029] Matching the road network information, weather environment information and traffic flow information to construct a feature vector sequence;

[0030] A temporal self-attention model is constructed, the feature vector sequence is input into the temporal self-attention model, the temporal pattern of each time point in the feature vector sequence is calculated through the self-attention mechanism, and dynamic temporal pattern feature information is obtained.

[0031] Preferably, the spatial feature information, the time delay feature information and the dynamic time pattern feature information are integrated to obtain a comprehensive feature sequence;

[0032] The comprehensive feature sequence is used as the input of the self-attention mechanism, and the correlation between different positions in the comprehensive feature sequence is calculated through the self-attention mechanism, and an attention weight is assigned to each position;

[0033] Processing the comprehensive feature sequence according to the attention weight to obtain a weighted comprehensive feature representation;

[0034] The weighted comprehensive feature representation is used as input to build a comprehensive prediction model.

[0035] Preferably, the historical traffic information is divided into a training data set and a test data set, and the comprehensive prediction model is trained using the training data set;

[0036] Inputting the test data set into the trained comprehensive prediction model to obtain model prediction result information;

[0037] Obtain actual monitoring result information of the target monitoring area;

[0038] Based on the model prediction result information and the actual monitoring result information, calculating the similarity between the model prediction result information and the actual monitoring result information to obtain information similarity;

[0039] Based on the information similarity, a performance evaluation is performed on the comprehensive prediction model to obtain a performance evaluation result.

[0040] Preferably, based on the performance evaluation result, the model parameters that need to be adjusted are determined to obtain the model parameters to be adjusted;

[0041] Based on the model parameters to be adjusted, iteratively adjust the parameters of the comprehensive prediction model to obtain a standard prediction model;

[0042] Based on the standard prediction model, a multi-step prediction is performed on the future traffic flow in the target monitoring area through a forward propagation process to obtain traffic flow prediction results for multiple future time steps.

[0043] In the second aspect, a traffic flow prediction system based on a self-attention mechanism includes:

[0044] A data collection and processing module is used to collect historical traffic information of a target monitoring area, pre-process the historical traffic information, and obtain standard historical traffic information;

[0045] The spatial self-attention module is used to build geographic and semantic mask matrices and combine the self-attention mechanism to capture dynamic and long-range spatial dependencies to obtain the spatial feature information of the roads in the target monitoring area;

[0046] The delay-aware feature conversion module is used to establish a delay-aware model for event transmission. It uses a temporal clustering algorithm combined with a self-attention mechanism to explicitly model the time delay in spatial information propagation and obtain time delay feature information.

[0047] The temporal self-attention module is used to establish a temporal self-attention model and apply self-attention operations in the time dimension to capture dynamic temporal patterns in traffic data and obtain dynamic temporal pattern feature information;

[0048] A comprehensive prediction model building module is used to combine spatial feature information, time delay feature information and dynamic time pattern feature information, apply the self-attention mechanism, and build a comprehensive prediction model;

[0049] A comprehensive prediction model evaluation module is used to perform performance evaluation on the comprehensive prediction model to obtain a performance evaluation result;

[0050] The model prediction module is used to adjust the parameters of the comprehensive prediction model based on the performance evaluation results to obtain a standard prediction model, and use the standard prediction model to predict the future traffic flow in the target monitoring area.

[0051] Compared with the prior art, the present invention has the following characteristics and beneficial effects:

[0052] 1. Establish a spatial self-attention model to capture the spatial relationship between roads in the target monitoring area, including dynamic and remote relationships, so as to build a more effective model to process spatial data, and then help improve urban traffic management and planning. By establishing an event transmission delay perception model to capture the dynamic changes of traffic status and analyze the delay of information transmission in traffic time, the process of spatial information propagation can be understood more accurately, which is helpful to predict the future propagation of spatial information, discover abnormal events or trends in time, and provide support for corresponding traffic management. Establish a temporal self-attention model to capture the dynamic time patterns of traffic flow, such as periodic changes and trends, which is helpful to improve the accuracy of traffic flow prediction and improve the efficiency of traffic management and planning. Combining spatial feature information, time delay feature information and dynamic time pattern feature information, applying the self-attention mechanism, constructing a comprehensive prediction model, and evaluating the performance of the comprehensive prediction model can ensure the effectiveness and reliability of the model, which is also the basis for subsequent model tuning. Adjusting the parameters of the model according to the evaluation structure can make the model more suitable for specific data and environment to improve the prediction performance of the model, thereby improving the accuracy of traffic flow prediction, helping to alleviate traffic congestion and improve traffic efficiency.

[0053] 2. Abstracting the intersections or key nodes in the road network and defining the spatial relationship between them based on their prior positions in the topological structure helps the model understand how traffic flow propagates and is distributed in the network. Through the spatial self-attention model, the spatial dependence of each road node on other nodes is calculated. This dependence is expressed in the form of weights, reflecting the degree of mutual influence between nodes, which helps the model simulate the spatial distribution of traffic flow more accurately. Using the calculated spatial dependency weights, the features of each node are weighted and aggregated to obtain a comprehensive spatial feature representation, which enables the model to more accurately capture the spatial distribution and propagation pattern of traffic flow.

[0054] 3. Arrange traffic flow information in the order of actual occurrence through timestamp information, which helps to observe and analyze the changing trend of traffic flow before and after historical events, thereby providing more accurate time series data for the prediction model. Using traffic flow information, calculate the change rate of each traffic node in terms of traffic flow, traffic speed and traffic density indicators. These change rates reflect the dynamic changes in traffic conditions and can more accurately capture the real-time impact of historical time on traffic flow. Input the calculated traffic condition delay feature information into the clustering algorithm to analyze the similarities and differences of traffic condition changes between different nodes, thereby estimating the propagation time delay of traffic condition changes between different nodes. The propagation time delay reflects the propagation speed of traffic condition changes in the network, which helps the prediction model to more accurately simulate the dynamic propagation process of traffic flow, especially after historical events, and can predict the speed and range of traffic congestion or recovery to normal. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 This is a flowchart of a method for predicting traffic flow based on a self-attention mechanism, which is mainly embodied in this embodiment;

[0056] Figure 2 This is a structural block diagram of a traffic flow prediction system based on a self-attention mechanism, which is mainly embodied in this embodiment.

[0057] Explanation of the accompanying drawings: 1. Data collection and processing module; 2. Spatial self-attention module; 3. Delay-aware feature conversion module; 4. Temporal self-attention module; 5. Comprehensive prediction model construction module; 6. Comprehensive prediction model evaluation module; 7. Model prediction module. DETAILED DESCRIPTION

[0058] The following combination Figure 1-Figure 2 The present application is further described in detail, but the embodiments of the present invention are not limited thereto.

[0059] Reference Figure 1 , a traffic flow prediction method and system based on self-attention mechanism, the method comprising the following steps:

[0060] S1. Collect historical traffic information of the target monitoring area, pre-process the historical traffic information, and obtain standard historical traffic information;

[0061] S2. Establish a spatial self-attention model to process the historical traffic information to obtain spatial characteristic information of the target monitoring area roads;

[0062] S3. Establish an event transmission delay perception model, perform feature conversion on the historical traffic information, cluster the converted features using a time clustering algorithm, and obtain time delay feature information;

[0063] S4. Establishing a time self-attention model, processing the historical traffic information, and extracting dynamic time pattern feature information;

[0064] S5. Combine spatial feature information, time delay feature information and dynamic time pattern feature information, apply self-attention mechanism, and build a comprehensive prediction model;

[0065] S6. Performing a performance evaluation on the comprehensive prediction model to obtain a performance evaluation result;

[0066] S7. Based on the performance evaluation results, the parameters of the comprehensive prediction model are adjusted to obtain a standard prediction model, and the standard prediction model is used to predict the future traffic flow in the target monitoring area.

[0067] In actual application, historical traffic information of the target monitoring area is obtained, the historical traffic information is preprocessed, the raw data is cleaned and formatted, the outlier data in the historical traffic information is eliminated, and the missing values ​​are filled, so as to improve the data quality, so that the model can more easily learn the rules in the data, thereby improving the accuracy of the model prediction. Spatial characteristics are crucial to traffic flow prediction, because traffic flow is often affected by adjacent roads or areas. A spatial self-attention model is established to capture the spatial relationship between roads in the target monitoring area, including dynamic and remote relationships, so as to build a more effective model to process spatial data, thereby helping to improve urban traffic management and planning. The change of traffic flow is not only affected by the current situation, but also by the previous situation. It is very necessary to analyze the delay of information transmission in traffic time. By establishing an event transmission delay perception model to capture the dynamic changes of traffic status, the process of spatial information propagation can be more accurately understood, which is helpful to predict the future propagation of spatial information, discover abnormal events or trends in time, and provide support for corresponding traffic management. Traffic flow usually has daily cycles, weekly cycles and other patterns. Establishing a temporal self-attention model to capture dynamic time patterns such as periodic changes and trends can help improve the accuracy of traffic flow prediction and improve the efficiency of traffic management and planning. Combining spatial feature information, time delay feature information and dynamic time pattern feature information, applying the self-attention mechanism, building a comprehensive prediction model, and evaluating the performance of the comprehensive prediction model can ensure the effectiveness and reliability of the model, which is also the basis for subsequent model tuning. Adjusting the model parameters according to the evaluation structure can make the model more suitable for specific data and environment, so as to improve the prediction performance of the model, thereby improving the accuracy of traffic flow prediction, providing decision-making basis for traffic management, planning and travel, and helping to alleviate traffic congestion and improve traffic efficiency.

[0068] The specific step S1 includes the following sub-steps:

[0069] S11. Collect historical traffic information of different sections and time points in the target monitoring area, wherein the historical traffic information includes traffic flow information, road network information, weather environment information, timestamp information and historical event information;

[0070] S12. The road network information refers to the topological structure of the road system, including the connection relationship of roads, road grades, and the location and type of road intersections;

[0071] S13. The weather environment information refers to the weather conditions during the traffic operation, including temperature, humidity, rainfall and wind speed;

[0072] S14. The timestamp information refers to the time point information of historical traffic information collection;

[0073] S15. The historical event information refers to events that have a temporary or long-term impact on traffic flow, including traffic accidents, road closures and construction activities;

[0074] S16. Preprocess the historical traffic information to obtain standard historical traffic information.

[0075] In actual application, traffic flow information directly reflects the usage and congestion of roads. By analyzing the changing trend of traffic flow, we can understand the daily fluctuations, periodic changes and abnormal traffic patterns of traffic flow, so as to more accurately predict future traffic conditions. Road network information provides the detailed layout and characteristics of the road system. The topological structure of the road network has an important influence on the distribution and flow of traffic flow. Understanding the connection relationship and level of roads can help predict the propagation path and congestion points of traffic flow, while the location and type of intersections will affect the smoothness of traffic and the probability of accidents. Weather environment information reflects the natural environmental conditions during traffic operation. Weather conditions have a significant impact on driving conditions and traffic flow. In severe weather, driving speed may slow down and visibility may be reduced, thus affecting traffic flow. Incorporating these factors into the prediction model can improve the accuracy of the prediction. Timestamp information records the specific time point when historical traffic information is collected, which is crucial for identifying the time pattern and periodicity of traffic flow. For example, there may be significant differences in traffic flow between weekdays and weekends, and between peak hours and non-peak hours. Through accurate time records, these changes can be better understood and future traffic conditions can be accurately predicted. Historical time information provides data on temporary or long-term impacts on traffic flow, such as traffic accidents, road closures, and construction activities. These events often lead to sudden or abnormal changes in traffic flow. Understanding these events and their impacts can help the prediction model better cope with changes in traffic flow under abnormal circumstances, thereby improving the robustness and accuracy of the prediction. Preprocessing historical traffic information to eliminate outliers, fill in missing values, and ensure that all data formats are unified and of reliable quality can significantly improve data availability and model learning effects, thereby obtaining more accurate model prediction results.

[0076] The specific step S2 includes the following sub-steps:

[0077] S21. Extracting road network information from the historical traffic information;

[0078] S22. Based on the topological structure of the road network information, define the spatial relationship between nodes in the target monitoring area and the road intersections;

[0079] S23. Construct a spatial self-attention model, and calculate the spatial dependency weight between each node and other nodes based on the spatial relationship of the nodes;

[0080] S24. Based on the spatial dependency weight, the features of each node are weighted and aggregated to obtain the spatial feature information of the roads in the target monitoring area.

[0081] In practical applications, road network information is the basis for building traffic flow prediction models, reflecting the physical layout and characteristics of the traffic network. Abstracting intersections or key nodes in the road network and defining the spatial relationship between them based on their prior positions in the topological structure helps the model understand how traffic flow propagates and distributes in the network. For example, adjacent nodes may be more likely to influence each other, while nodes farther away may have less influence. Through the spatial self-attention model, the spatial dependence of each road node on other nodes is calculated. This dependence is expressed in the form of weights, reflecting the degree of mutual influence between nodes, which helps the model to more accurately simulate the spatial distribution of traffic flow. For example, if the traffic flow of a node is often affected by another node, then the spatial dependence weight between the two nodes will be relatively high. Using the calculated spatial dependency weights, the features of each node are weighted and aggregated to obtain a comprehensive spatial feature representation, which enables the model to more accurately capture the spatial distribution and propagation pattern of traffic flow.

[0082] The specific step S3 includes the following sub-steps:

[0083] S31. Extracting historical event information from the historical traffic information, as well as the timestamp information and traffic flow information corresponding to the time period in which the event occurred;

[0084] S32. Based on the timestamp information, the traffic flow information within the time period is sorted in chronological order;

[0085] S33. The traffic flow information includes vehicle flow information, vehicle speed information and vehicle density information. Based on the traffic flow information, the vehicle flow change rate, vehicle speed change rate and vehicle density change rate of each node are calculated respectively. The vehicle flow change rate, vehicle speed change rate and vehicle density change rate constitute the traffic condition delay characteristic information of the node;

[0086] S34. Input the traffic condition delay characteristic information into a clustering algorithm for clustering analysis, calculate the propagation time delay between each node and other nodes, and obtain the time delay characteristic information.

[0087] In actual application, historical events often have a significant impact on traffic flow. By deeply analyzing historical events and their impact on traffic flow, the prediction model can more accurately simulate and predict changes in actual traffic conditions. By arranging traffic flow information in the order of actual occurrence through timestamp information, it is helpful to observe and analyze the changing trend of traffic flow before and after historical events, thereby providing more accurate time series data for the prediction model. Using traffic flow information, the change rate of each traffic node in terms of traffic flow, traffic speed and traffic density indicators is calculated. These change rates reflect the dynamic changes in traffic conditions and can more accurately capture the real-time impact of historical time on traffic flow. The calculated traffic condition delay feature information is input into the clustering algorithm to analyze the similarities and differences of traffic condition changes between different nodes, thereby estimating the propagation time delay of traffic condition changes between different nodes. The propagation time delay reflects the propagation speed of traffic condition changes in the network, which helps the prediction model to more accurately simulate the dynamic propagation process of traffic flow, especially after historical events, and can predict the speed and range of traffic congestion or recovery to normal.

[0088] The specific step S4 includes the following sub-steps:

[0089] S41. Extracting traffic flow information, timestamp information, road network information and weather environment information from the historical traffic information;

[0090] S42. Sort the traffic flow information in chronological order and perform time serialization processing in combination with the timestamp information;

[0091] S43. Corresponding the road network information, weather environment information and traffic flow information to construct a feature vector sequence;

[0092] S44. Construct a temporal self-attention model, input the feature vector sequence into the temporal self-attention model, calculate the temporal pattern of each time point in the feature vector sequence through the self-attention mechanism, and obtain dynamic temporal pattern feature information.

[0093] In actual application, traffic flow information is sorted by timestamp and converted into time series data. Time series processing enables the data to reflect the continuous changes and trends of traffic flow, and can better understand the periodicity, trend and seasonality of traffic flow. The road network, weather environment and traffic flow information are used and integrated to form a feature vector sequence, so that the model can understand the changes in traffic flow more comprehensively, which helps to improve the accuracy and robustness of the prediction model. The temporal self-attention model is used to analyze the feature vector sequence. The time pattern of each time point is captured through the self-attention mechanism, so as to obtain the dynamic change pattern of traffic flow, which can extract long-term dependencies and complex patterns in the time series, thereby improving the accuracy of traffic flow prediction.

[0094] The specific step S5 includes the following sub-steps:

[0095] S51. Combining the spatial feature information, the time delay feature information and the dynamic time pattern feature information to obtain a comprehensive feature sequence;

[0096] S52. Using the comprehensive feature sequence as the input of the self-attention mechanism, calculating the correlation between different positions in the comprehensive feature sequence through the self-attention mechanism, and assigning an attention weight to each position;

[0097] S53. weighting the comprehensive feature sequence according to the attention weight to obtain a weighted comprehensive feature representation;

[0098] S54. Use the weighted comprehensive feature representation as input to build a comprehensive prediction model.

[0099] In practical applications, the calculated spatial feature information, time delay feature information, and dynamic time pattern feature information are integrated to form a unified comprehensive feature sequence, so that the model can more comprehensively consider the comprehensive impact of various factors on traffic flow, which helps to improve the comprehensiveness and accuracy of the prediction model. The self-attention mechanism is used to analyze the comprehensive feature sequence, calculate the correlation between different positions in the sequence, and assign an attention weight to each position, so as to capture the dependency and mutual influence between different features, which helps to more accurately understand the complex changes in traffic flow and assign a reasonable degree of attention to each feature, thereby improving the accuracy of the prediction. The weighted comprehensive feature representation is used as input to construct a comprehensive prediction model for traffic flow prediction. The comprehensive prediction model can capture the change pattern of traffic flow more comprehensively and accurately, and is expected to provide more accurate and reliable traffic flow prediction results, providing strong support for intelligent traffic management and planning.

[0100] The specific step S6 includes the following sub-steps:

[0101] S61. Dividing the historical traffic information into a training data set and a test data set, and using the training data set to train the comprehensive prediction model;

[0102] S62. Inputting the test data set into the trained comprehensive prediction model to obtain model prediction result information;

[0103] S63. Obtaining actual monitoring result information of the target monitoring area;

[0104] S64. Based on the model prediction result information and the actual monitoring result information, calculate the similarity between the model prediction result information and the actual monitoring result information to obtain information similarity;

[0105] S65. Based on the information similarity, the comprehensive prediction model is subjected to performance evaluation to obtain a performance evaluation result.

[0106] In actual application, the comprehensive prediction model is trained using the training data set so that it can learn and identify traffic flow patterns and trends. Using the test data set to evaluate the model's prediction ability can improve the model's generalization ability. If the model performs well on the training data but poorly on the test data, it may be overfitting, that is, the model is too complex and "memorizes" rather than "learns" the training data. By comparing the model prediction results and the actual monitoring results, calculating the similarity between the two, the model's prediction accuracy is quantified, which is more objective and reliable than simple intuitive judgment. Based on the calculated information similarity, the performance of the model is comprehensively evaluated, providing an important basis for model optimization and improvement.

[0107] The specific step S7 includes the following sub-steps:

[0108] S71. Based on the performance evaluation results, determine the model parameters that need to be adjusted, and obtain the model parameters to be adjusted;

[0109] S72. Based on the model parameters to be adjusted, iteratively adjust the parameters of the comprehensive prediction model to obtain a standard prediction model;

[0110] S73. Based on the standard prediction model, a multi-step prediction is performed on the future traffic flow in the target monitoring area through a forward propagation process to obtain traffic flow prediction results for multiple future time steps.

[0111] In actual application, the deficiencies and problems in the model can be identified based on the performance evaluation results, and then which model parameters need to be adjusted to optimize the model performance. These parameters are adjusted in an iterative manner so that the model gradually approaches the optimal performance state and a standard prediction model is obtained. Using the optimized annotation prediction model, the forward propagation algorithm can be used to make multi-step predictions of traffic flow in the future, which can provide important information about future traffic flow to the traffic management department and help formulate traffic management strategies and countermeasures in advance. In addition, accurate traffic flow predictions also provide data support for intelligent navigation systems and shared travel services, which helps to improve the efficiency and convenience of urban transportation.

[0112] Reference Figure 2 A traffic flow prediction system based on self-attention mechanism includes a data collection and processing module, a spatial self-attention module, a delay-aware feature conversion module, a temporal self-attention module, a comprehensive prediction model construction module, a comprehensive prediction model evaluation module and a model prediction module. First, the data collection and processing module is used to collect historical traffic information of the target monitoring area, and the historical traffic information is preprocessed to obtain standard historical traffic information; then, the spatial self-attention module is used to establish a geographic and semantic mask matrix, and the self-attention mechanism is combined to capture dynamic and long-range spatial dependencies to obtain spatial feature information of the target monitoring area roads; then, the delay-aware feature conversion module is used to establish an event transmission delay perception model, and the temporal clustering algorithm is used in combination with the self-attention mechanism to analyze the spatial information transmission delay. The time delay in the broadcast is displayed and modeled to obtain the time delay feature information; then the time self-attention module is used to establish a time self-attention model, and the self-attention operation is applied in the time dimension to capture the dynamic time pattern in the traffic data and obtain the dynamic time pattern feature information; then the comprehensive prediction model construction module combines the spatial feature information, the time delay feature information and the dynamic time pattern feature information, and applies the self-attention mechanism to construct a comprehensive prediction model; then the comprehensive prediction model evaluation module is used to evaluate the performance of the comprehensive prediction model and obtain the performance evaluation result; finally, the model prediction module is used to adjust the parameters of the comprehensive prediction model based on the performance evaluation result to obtain the standard prediction model, and the standard prediction model is used to predict the future traffic flow in the target monitoring area.

[0113] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.

Claims

1. A traffic flow prediction method based on self-attention mechanism, characterized in that: The following steps are involved: Collecting historical traffic information of a target monitoring area, and preprocessing the historical traffic information to obtain standard historical traffic information; Establishing a spatial self-attention model, processing the historical traffic information, and obtaining spatial characteristic information of roads in the target monitoring area; Establishing an event transmission delay perception model, performing feature conversion on the historical traffic information, clustering the converted features using a time clustering algorithm, and obtaining time delay feature information; Establishing a time self-attention model, processing the historical traffic information, and extracting dynamic time pattern feature information; Combining spatial feature information, time delay feature information and dynamic time pattern feature information, applying self-attention mechanism, and constructing a comprehensive prediction model; Performing performance evaluation on the comprehensive prediction model to obtain a performance evaluation result; Based on the performance evaluation results, the parameters of the comprehensive prediction model are adjusted to obtain a standard prediction model, and the standard prediction model is used to predict the future traffic flow in the target monitoring area.

2. A traffic flow prediction method based on self-attention mechanism according to claim 1, characterized in that: The steps of collecting historical traffic information of the target monitoring area and preprocessing the historical traffic information to obtain standard historical traffic information are specifically as follows: Collect historical traffic information of different sections and time points in the target monitoring area, wherein the historical traffic information includes traffic flow information, road network information, weather environment information, timestamp information and historical event information; The road network information refers to the topological structure of the road system, including the connection relationship of roads, road grades, and the location and type of road intersections; The weather environment information refers to the weather conditions during the traffic operation, including temperature, humidity, rainfall and wind speed; The timestamp information refers to the time point information of historical traffic information collection; The historical event information refers to events that have a temporary or long-term impact on traffic flow, including traffic accidents, road closures and construction activities; The historical traffic information is preprocessed to obtain standard historical traffic information.

3. A traffic flow prediction method based on self-attention mechanism according to claim 2, characterized in that: The steps of establishing a spatial self-attention model, processing the historical traffic information, and obtaining the spatial characteristic information of the roads in the target monitoring area are specifically as follows: Extracting road network information from the historical traffic information; Based on the topological structure of the road network information, defining the spatial relationship of nodes between road intersections in the target monitoring area; Constructing a spatial self-attention model, and calculating the spatial dependency weights between each node and other nodes based on the spatial relationship of the nodes; Based on the spatial dependency weight, the features of each node are weighted and aggregated to obtain the spatial feature information of the roads in the target monitoring area.

4. The traffic flow prediction method based on self-attention mechanism according to claim 3 is characterized in that: The steps of establishing an event transmission delay perception model, performing feature conversion on the historical traffic information, clustering the converted features using a time clustering algorithm, and obtaining time delay feature information are as follows: Extracting historical event information from the historical traffic information, as well as timestamp information and traffic flow information corresponding to the time period in which the event occurred; Based on the timestamp information, the traffic flow information within the time period of the time occurrence is sorted in chronological order; The traffic flow information includes vehicle flow information, vehicle speed information and vehicle density information. Based on the traffic flow information, the vehicle flow change rate, vehicle speed change rate and vehicle density change rate of each node are calculated respectively. The vehicle flow change rate, vehicle speed change rate and vehicle density change rate constitute the traffic condition delay characteristic information of the node. The traffic condition time delay characteristic information is input into a clustering algorithm for clustering analysis, and the propagation time delay between each node and other nodes is calculated to obtain the time delay characteristic information.

5. A traffic flow prediction method based on self-attention mechanism according to claim 4, characterized in that: The steps of establishing a temporal self-attention model, processing the historical traffic information, and extracting dynamic temporal pattern feature information are specifically as follows: Extracting traffic flow information, timestamp information, road network information and weather environment information from the historical traffic information; Sorting the traffic flow information in chronological order and performing time serialization processing in combination with the timestamp information; Matching the road network information, weather environment information and traffic flow information to construct a feature vector sequence; A temporal self-attention model is constructed, the feature vector sequence is input into the temporal self-attention model, the temporal pattern of each time point in the feature vector sequence is calculated through the self-attention mechanism, and dynamic temporal pattern feature information is obtained.

6. A traffic flow prediction method based on self-attention mechanism according to claim 5, characterized in that: Combining spatial feature information, time delay feature information and dynamic time pattern feature information, applying the self-attention mechanism, and constructing a comprehensive prediction model are as follows: The spatial feature information, the time delay feature information and the dynamic time pattern feature information are integrated to obtain a comprehensive feature sequence; The comprehensive feature sequence is used as the input of the self-attention mechanism, and the correlation between different positions in the comprehensive feature sequence is calculated through the self-attention mechanism, and an attention weight is assigned to each position; Processing the comprehensive feature sequence according to the attention weight to obtain a weighted comprehensive feature representation; The weighted comprehensive feature representation is used as input to build a comprehensive prediction model.

7. A traffic flow prediction method based on self-attention mechanism according to claim 6, characterized in that: The step of performing performance evaluation on the comprehensive prediction model to obtain a performance evaluation result is specifically as follows: Dividing the historical traffic information into a training data set and a test data set, and using the training data set to train a comprehensive prediction model; Inputting the test data set into the trained comprehensive prediction model to obtain model prediction result information; Obtain actual monitoring result information of the target monitoring area; Based on the model prediction result information and the actual monitoring result information, calculating the similarity between the model prediction result information and the actual monitoring result information to obtain information similarity; Based on the information similarity, a performance evaluation is performed on the comprehensive prediction model to obtain a performance evaluation result.

8. The traffic flow prediction method based on self-attention mechanism according to claim 7 is characterized in that: Based on the performance evaluation results, the parameters of the comprehensive prediction model are adjusted to obtain a standard prediction model, and the steps of using the standard prediction model to predict the future traffic flow of the target monitoring area are specifically as follows: Based on the performance evaluation result, determining the model parameters that need to be adjusted, and obtaining the model parameters to be adjusted; Based on the model parameters to be adjusted, iteratively adjust the parameters of the comprehensive prediction model to obtain a standard prediction model; Based on the standard prediction model, a multi-step prediction is performed on the future traffic flow in the target monitoring area through a forward propagation process to obtain traffic flow prediction results for multiple future time steps.

9. A traffic flow prediction system based on self-attention mechanism, characterized in that: A traffic flow prediction method based on a self-attention mechanism applicable to any one of claims 1 to 8, comprising: A data collection and processing module is used to collect historical traffic information of a target monitoring area, pre-process the historical traffic information, and obtain standard historical traffic information; The spatial self-attention module is used to build geographic and semantic mask matrices and combine the self-attention mechanism to capture dynamic and long-range spatial dependencies to obtain the spatial feature information of the roads in the target monitoring area; The delay-aware feature conversion module is used to establish a delay-aware model for event transmission. It uses a temporal clustering algorithm combined with a self-attention mechanism to explicitly model the time delay in spatial information propagation and obtain time delay feature information. The temporal self-attention module is used to establish a temporal self-attention model and apply self-attention operations in the time dimension to capture dynamic temporal patterns in traffic data and obtain dynamic temporal pattern feature information; A comprehensive prediction model building module is used to combine spatial feature information, time delay feature information and dynamic time pattern feature information, apply the self-attention mechanism, and build a comprehensive prediction model; A comprehensive prediction model evaluation module is used to perform performance evaluation on the comprehensive prediction model to obtain a performance evaluation result; The model prediction module is used to adjust the parameters of the comprehensive prediction model based on the performance evaluation results to obtain a standard prediction model, and use the standard prediction model to predict the future traffic flow in the target monitoring area.

Citation Information

Patent Citations

  • Urban space-time prediction method based on space-time attention

    CN116011638A

  • Traffic flow prediction method and device fusing multi-source spatio-temporal data, and storage medium

    CN116089875A

  • Method for temporal knowledge graph reasoning based on distributed attention

    US20230401466A1