A Traffic Flow Prediction Method and System Based on Self-Attention Mechanism

The traffic flow prediction model built using the self-attention mechanism solves the problem of insufficient dynamic traffic pattern modeling in existing technologies, enabling more accurate traffic flow prediction and management, and improving the efficiency of urban traffic management and planning.

CN119516760BActive Publication Date: 2025-10-31JILIN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing traffic flow prediction models lack spatial dependency modeling capabilities when dealing with dynamic traffic patterns and fail to effectively capture the time delay of traffic conditions between different locations, resulting in inaccurate prediction results.

Method used

A traffic flow prediction model is constructed using a self-attention mechanism. The spatial self-attention model captures the spatial relationships between roads, and the event propagation delay perception model and the temporal self-attention model are combined to capture the dynamic changes in traffic conditions. A comprehensive prediction model is then constructed using the self-attention mechanism.

Benefits of technology

It improves the accuracy and efficiency of traffic flow forecasting, enables a better understanding of the traffic information dissemination process, identifies abnormal events or trends, provides support for traffic management, alleviates traffic congestion, and improves traffic efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119516760B_ABST
    Figure CN119516760B_ABST
Patent Text Reader

Abstract

This application discloses a traffic flow prediction method and system based on a self-attention mechanism. The method includes: collecting historical traffic information of a target monitoring area; establishing a spatial self-attention model to process the historical traffic information and obtain spatial feature information of the road; establishing an event transmission delay perception model to perform feature transformation and cluster analysis on the historical traffic information and obtain time delay feature information; establishing a temporal self-attention model to process the historical traffic information and obtain dynamic time pattern feature information; combining spatial feature information, time delay feature information, and dynamic time pattern feature information, and applying the self-attention mechanism to construct a comprehensive prediction model; evaluating the performance and adjusting the parameters of the comprehensive prediction model to obtain a standard prediction model; and using the standard prediction model to predict future traffic flow. Achieving accurate prediction of future traffic flow helps alleviate traffic congestion and improve traffic efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of traffic prediction technology, and in particular to a traffic flow prediction method and system based on a self-attention mechanism. Background Technology

[0002] As a road network carrying high-volume traffic, the safety and smooth flow of highways have always been two major focuses of traffic management in the national trunk highway network. Therefore, accurate traffic forecasting is crucial, and traffic flow forecasting technology can minimize the negative impact of traffic problems on urban transportation systems. As a key area in intelligent transportation systems, traffic flow forecasting technology can provide core data support for traffic management.

[0003] In existing technologies, neural network models are often used for traffic flow prediction. However, graph neural network-based models often use a static approach to model spatial dependencies, which limits their ability to learn dynamic traffic patterns. In addition, 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] To overcome the shortcomings of the prior art, this application provides a traffic flow prediction method and system based on a self-attention mechanism.

[0005] Firstly, this application provides a traffic flow prediction method based on a self-attention mechanism, the method comprising:

[0006] Historical traffic information of the target monitoring area is collected, and the historical traffic information is preprocessed to obtain standard historical traffic information;

[0007] A spatial self-focus model is established, and the historical traffic information is processed to obtain the spatial feature information of roads in the target monitoring area;

[0008] An event transmission delay perception model is established, the historical traffic information is transformed into features, and the transformed features are clustered using a time clustering algorithm to obtain time delay feature information.

[0009] A time-based self-focus model is established to process the historical traffic information and extract dynamic time pattern feature information.

[0010] By combining spatial feature information, temporal delay feature information, and dynamic temporal pattern feature information, a comprehensive prediction model is constructed by applying a self-attention mechanism.

[0011] The performance of the comprehensive prediction model is evaluated, and the performance evaluation results are obtained.

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

[0013] Preferably, historical traffic information of different road sections and different time points in the target monitoring area is collected. 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 topology of the road system, including the road connections, road classification, and the location and type of road intersections;

[0015] The aforementioned weather information refers to weather conditions during traffic operations, 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, road network information is extracted from the historical traffic information;

[0020] Based on the topology of the road network information, the spatial relationships between nodes at road intersections in the target monitoring area are defined.

[0021] Construct a spatial self-focus model and calculate the spatial dependency weights between each node and other nodes based on the aforementioned node spatial relationships;

[0022] Based on the spatial dependency weights, 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, historical event information, as well as timestamp information and traffic flow information corresponding to the time period in which the event occurred, are extracted from the historical traffic information;

[0024] Based on the timestamp information, the traffic flow information within the time period in which the time occurred 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 time delay feature information of that node.

[0026] The traffic condition delay feature information is input into a clustering algorithm for cluster analysis to calculate the propagation time delay between each node and other nodes, thus obtaining the time delay feature information.

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

[0028] The traffic flow information is sorted in chronological order and then combined with the timestamp information for time serialization.

[0029] The road network information, weather information, and traffic flow information are mapped together to construct a feature vector sequence;

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

[0031] Preferably, a comprehensive feature sequence is obtained by combining the spatial feature information, the time delay feature information, and the dynamic time pattern feature information;

[0032] The comprehensive feature sequence is used as input to the self-attention mechanism. Through the self-attention mechanism, the correlation between different positions in the comprehensive feature sequence is calculated, and attention weights are assigned to each position.

[0033] The comprehensive feature sequence is weighted according to the attention weights to obtain a weighted comprehensive feature representation.

[0034] A comprehensive prediction model is constructed by using the weighted integrated feature representation as input.

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

[0036] The test dataset is input into the trained comprehensive prediction model to obtain the model prediction results.

[0037] Obtain actual monitoring results information for the target monitoring area;

[0038] Based on the model prediction results and the actual monitoring results, the similarity between the model prediction results and the actual monitoring results is calculated to obtain the information similarity.

[0039] Based on the information similarity, the performance of the comprehensive prediction model is evaluated, and the performance evaluation results are obtained.

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

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

[0042] Based on the standard prediction model, the future traffic flow of the target monitoring area is predicted in multiple steps through a forward propagation process, resulting in traffic flow prediction results for multiple future time steps.

[0043] Secondly, a traffic flow prediction system based on a self-attention mechanism includes:

[0044] The data collection and processing module is used to collect historical traffic information of the target monitoring area, preprocess 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 them with a self-attention mechanism to capture dynamic and remote spatial dependencies, thereby obtaining spatial feature information of roads in the target monitoring area.

[0046] The delay-aware feature conversion module is used to establish an event transmission delay-aware model. It uses a time 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 time self-focus module is used to build a time self-focus model, apply self-focus operations in the time dimension to capture dynamic time patterns in traffic data, and obtain dynamic time pattern feature information.

[0048] The integrated prediction model construction module is used to combine spatial feature information, time delay feature information, and dynamic time pattern feature information, and apply a self-attention mechanism to construct an integrated prediction model.

[0049] The comprehensive prediction model evaluation module is used to evaluate the performance of the comprehensive prediction model and obtain the performance evaluation results.

[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 to use the standard prediction model to predict the future traffic flow of 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 relationships between roads within the target monitoring area, including dynamic and long-distance relationships. This allows for the construction of a more effective model to process spatial data, thereby helping to improve urban traffic management and planning. Establish an event transmission delay perception model to capture dynamic changes in traffic conditions and analyze the delay in information transmission during traffic time. This provides a more accurate understanding of the spatial information propagation process, helping to predict future spatial information dissemination, identify temporal anomalies or trends, and support corresponding traffic management. Establish a temporal self-attention model to capture dynamic temporal patterns in traffic flow, such as periodic changes and trends. This helps improve the accuracy of traffic flow prediction and enhance the efficiency of traffic management and planning. Combining spatial feature information, temporal delay feature information, and dynamic temporal pattern feature information, and applying a self-attention mechanism, a comprehensive prediction model is constructed. Performance evaluation of the comprehensive prediction model ensures its effectiveness and reliability and serves as the basis for subsequent model optimization. Adjusting the model parameters based on the evaluation results makes the model more suitable for specific data and environments, improving its predictive performance and thus increasing the accuracy of traffic flow prediction. This helps alleviate traffic congestion and improve traffic efficiency.

[0053] 2. Abstracting intersections or key nodes in the road network and defining their spatial relationships based on their relative positions in the topology helps the model understand how traffic flow propagates and distributes within the network. Using a spatial self-attention model, the spatial dependency of each road node on other nodes is calculated. This dependency, represented by weights, reflects the degree of mutual influence between nodes, helping the model more accurately simulate the spatial distribution of traffic flow. Using the calculated spatial dependency weights, the features of each node are weighted and aggregated to obtain a comprehensive spatial feature representation, enabling the model to more accurately capture the spatial distribution and propagation patterns of traffic flow.

[0054] 3. By arranging traffic flow information according to the actual time sequence of occurrence using timestamp information, it is helpful to observe and analyze the changing trends of traffic flow before and after historical events, thus providing more accurate time series data for predictive models. Using traffic flow information, the rate of change of traffic flow, speed, and density at each traffic node is calculated. These rates of change 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 characteristics are input into a clustering algorithm to analyze the similarity and differences in 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 speed at which traffic condition changes propagate in the network, helping predictive models to more accurately simulate the dynamic propagation process of traffic flow, especially after historical events, enabling the prediction of the speed and extent of traffic congestion or recovery. Attached Figure Description

[0055] Figure 1 This is a flowchart illustrating the steps of a traffic flow prediction method based on a self-attention mechanism, which is the main feature of 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 the main feature of this embodiment.

[0057] Explanation of reference numerals in the attached diagram: 1. Data collection and processing module; 2. Spatial self-focus module; 3. Delay-aware feature conversion module; 4. Temporal self-focus module; 5. Comprehensive prediction model construction module; 6. Comprehensive prediction model evaluation module; 7. Model prediction module. Detailed Implementation

[0058] The following combination Figures 1-2 This application will be described in further 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 a self-attention mechanism, the method comprising the following steps:

[0060] S1. Collect historical traffic information of the target monitoring area, preprocess the historical traffic information to obtain standard historical traffic information;

[0061] S2. Establish a spatial self-focus model, process the historical traffic information, and obtain spatial feature information of roads in the target monitoring area;

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

[0063] S4. Establish a time-based self-focus model, process the historical traffic information, and extract dynamic time pattern feature information;

[0064] S5. Combining spatial feature information, time delay feature information, and dynamic time pattern feature information, a comprehensive prediction model is constructed by applying a self-attention mechanism;

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

[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 of the target monitoring area.

[0067] In practical applications, historical traffic information of the target monitoring area is acquired, preprocessed, and cleaned and formatted to eliminate outliers and fill in missing values, thereby improving data quality. This allows the model to learn patterns in the data more easily, thus improving the accuracy of model predictions. Spatial characteristics are crucial for traffic flow prediction because traffic flow is often influenced by adjacent roads or areas. Establishing a spatial self-focused model captures the spatial relationships between roads within the target monitoring area, including dynamic and long-distance relationships, enabling the construction of a more effective model to process spatial data and thus helping to improve urban traffic management and planning. Changes in traffic flow are influenced not only by the current situation but also by past situations. Analyzing the delay in information transmission during traffic time is essential. By establishing an event transmission delay perception model to capture dynamic changes in traffic conditions, a more accurate understanding of the spatial information propagation process can be achieved. This helps predict future spatial information propagation, identify temporal anomalies or trends, and provide support for corresponding traffic management. Traffic flow typically exhibits daily or weekly patterns. Establishing a time-focused model captures dynamic time patterns such as periodic changes and trends, helping to improve the accuracy of traffic flow prediction and enhance the efficiency of traffic management and planning. By combining spatial feature information, time delay feature information, and dynamic time pattern feature information, and applying a self-attention mechanism, a comprehensive prediction model is constructed. Performance evaluation of this comprehensive prediction model ensures its effectiveness and reliability, and serves as the basis for subsequent model tuning. Adjusting the model parameters based on the evaluation results makes the model more suitable for specific data and environments, thereby improving its predictive performance and increasing the accuracy of traffic flow prediction. This provides a basis for decision-making in traffic management, planning, and travel, 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 for different road sections and at different times in the target monitoring area. 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 topology of the road system, including the connection relationships of roads, road grades, and the location and type of road intersections;

[0071] S13. The weather environment information refers to the weather conditions during 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 practical applications, traffic flow information directly reflects road usage and congestion levels. Analyzing traffic flow trends helps us understand daily fluctuations, periodic changes, and abnormal flow patterns, thus enabling more accurate predictions of future traffic conditions. Road network information provides a detailed layout and characteristics of the road system. The topology of the road network significantly impacts the distribution and flow of traffic flow. Understanding road connectivity and hierarchy helps predict traffic flow propagation paths and congestion points, while the location and type of intersections affect traffic flow smoothness and the probability of accidents. Weather information reflects the natural environmental conditions during traffic operation. Weather conditions significantly affect driving conditions and traffic flow. Inclement weather can lead to slower driving speeds and reduced visibility, thus affecting traffic flow. Incorporating these factors into prediction models can improve prediction accuracy. Timestamp information records the specific time points when historical traffic information was collected, which is crucial for identifying temporal patterns and periodicity of traffic flow. For example, traffic flow may differ significantly between weekdays and weekends, and between peak and off-peak hours. Precise time recording allows for a better understanding of these changes and more accurate predictions of future traffic conditions. Historical time information provides temporal data on events that have 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 helps predictive models better cope with abnormal traffic flow changes, thereby improving the robustness and accuracy of predictions. Preprocessing historical traffic information to eliminate outliers, fill in missing values, and ensure that all data are in a consistent format and of reliable quality significantly improves data usability and model learning effectiveness, ultimately leading to more accurate model predictions.

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

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

[0078] S22. Based on the topology of the road network information, define the spatial relationships between nodes at road intersections in the target monitoring area;

[0079] S23. Construct a spatial self-focus model, and calculate the spatial dependency weights between each node and other nodes based on the aforementioned node spatial relationships;

[0080] S24. Based on the spatial dependency weights, 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 foundation for building traffic flow prediction models. It reflects the physical layout and characteristics of the traffic network. Abstracting intersections or key nodes in the road network and defining their spatial relationships based on their relative positions in the topology helps the model understand how traffic flow propagates and distributes within the network. For example, adjacent nodes may be more likely to influence each other, while nodes that are farther apart may have a smaller impact. Through a spatial self-attention model, the spatial dependence of each road node on other nodes is calculated. This dependence is represented by weights, reflecting the degree of mutual influence between nodes. This helps the model more accurately simulate the spatial distribution of traffic flow. For instance, if the traffic flow of a certain node is frequently affected by another node, then the spatial dependence weight between these two nodes will be relatively high. Using the calculated spatial dependence weights, the features of each node are weighted and aggregated to obtain a comprehensive spatial feature representation, enabling the model to more accurately capture the spatial distribution and propagation patterns of traffic flow.

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

[0083] S31. Extract 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, sort the traffic flow information within the time period 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 time delay feature information of the node.

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

[0087] In practical applications, historical events often have a significant impact on traffic flow. By deeply analyzing historical events and their impact on traffic flow, predictive models can more accurately simulate and predict changes in actual traffic conditions. Using timestamp information to arrange traffic flow data in chronological order helps observe and analyze trends in traffic flow before and after historical events, thus providing more accurate time-series data for predictive models. Calculating the rate of change of traffic flow, speed, and density at each traffic node using traffic flow information reflects the dynamic changes in traffic conditions and can more accurately capture the real-time impact of historical events on traffic flow. Inputting the calculated traffic condition delay characteristics into a clustering algorithm analyzes the similarity and differences in traffic condition changes between different nodes, thereby estimating the propagation time delay of traffic condition changes between different nodes. This propagation time delay reflects the speed at which traffic condition changes propagate in the network, helping predictive models to more accurately simulate the dynamic propagation process of traffic flow, especially after historical events, enabling the prediction of the speed and extent of traffic congestion or recovery.

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

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

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

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

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

[0093] In practical applications, traffic flow information is sorted by timestamp and transformed into time-series data. This time-series processing allows the data to reflect continuous changes and trends in traffic flow, enabling a better understanding of its periodicity, trends, and seasonality. Integrating road network, weather, and traffic flow information to form a feature vector sequence allows the model to more comprehensively understand traffic flow changes, improving the accuracy and robustness of the prediction model. Using a time-self-attention model to analyze the feature vector sequence captures the temporal patterns at each point in time through a self-attention mechanism, thereby obtaining the dynamic change patterns of traffic flow. This allows for the extraction of long-term dependencies and complex patterns in the time series, further improving the accuracy of traffic flow prediction.

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

[0095] S51. By combining the spatial feature information, time delay feature information, and dynamic time pattern feature information, a comprehensive feature sequence is obtained;

[0096] S52. The comprehensive feature sequence is used as the input of the self-attention mechanism. The correlation between different positions in the comprehensive feature sequence is calculated through the self-attention mechanism, and attention weights are assigned to each position.

[0097] S53. The comprehensive feature sequence is weighted according to the attention weights to obtain the weighted comprehensive feature representation;

[0098] S54. Using the weighted comprehensive feature representation as input, construct 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. This allows the model to more comprehensively consider the combined impact of various factors on traffic flow, improving the comprehensiveness and accuracy of the prediction model. Utilizing a self-attention mechanism to analyze the comprehensive feature sequence, the correlation between different locations in the sequence is calculated, and an attention weight is assigned to each location. This captures the dependencies and mutual influences between different features, helping to more accurately understand the complex changes in traffic flow and assigning appropriate attention to each feature, thereby improving prediction accuracy. Using the weighted comprehensive feature representation as input, a comprehensive prediction model for traffic flow forecasting is constructed. This model can more comprehensively and accurately capture traffic flow change patterns, and is expected to provide more accurate and reliable traffic flow prediction results, offering strong support for intelligent traffic management and planning.

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

[0101] S61. Divide the historical traffic information into a training dataset and a test dataset, and use the training dataset to train the comprehensive prediction model;

[0102] S62. Input the test dataset into the trained comprehensive prediction model to obtain the model prediction result information;

[0103] S63. Obtain actual monitoring results information for the target monitoring area;

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

[0105] S65. Based on the information similarity, the performance of the comprehensive prediction model is evaluated to obtain the performance evaluation results.

[0106] In practical applications, a comprehensive prediction model is trained using a training dataset to learn and identify traffic flow patterns and trends. Using a test dataset to evaluate the model's predictive ability improves its generalization capacity. If a model performs well on training data but poorly on test data, overfitting may have occurred, meaning the model is too complex and has "memorized" the training data rather than "learned" it. By comparing the model's predictions with actual monitoring results and calculating the similarity between the two, the model's predictive accuracy is quantified, providing a more objective and reliable assessment than simple intuitive judgment. Based on the calculated information similarity, a comprehensive evaluation of the model's performance is conducted, providing crucial information 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 parameters of the model to be adjusted, the parameters of the comprehensive prediction model are iteratively adjusted to obtain a standard prediction model;

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

[0111] In practical applications, performance evaluation results can identify shortcomings and problems in the model, allowing for the determination of which model parameters need adjustment to optimize performance. These parameters are then iteratively adjusted to gradually bring the model closer to its optimal performance state, resulting in a standard prediction model. Using the optimized labeled prediction model, multi-step predictions of traffic flow over a future period can be made through the forward propagation algorithm. This provides traffic management departments with crucial information about future traffic flow, facilitating the development of traffic management strategies and countermeasures in advance. Furthermore, accurate traffic flow prediction provides data support for intelligent navigation systems and shared mobility services, contributing to improved efficiency and convenience of urban transportation.

[0112] Reference Figure 2 A traffic flow prediction system based on a 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 collects historical traffic information of the target monitoring area and preprocesses it to obtain standardized historical traffic information. Then, the spatial self-attention module establishes a geographic and semantic mask matrix and combines it with a self-attention mechanism to capture dynamic and long-distance spatial dependencies, obtaining spatial feature information of roads in the target monitoring area. Finally, the delay-aware feature conversion module establishes an event transmission delay-aware model and uses a temporal clustering algorithm combined with a self-attention mechanism to process the spatial information transmission delay. The system displays and models the time delay during broadcasting to obtain time delay feature information. Then, using a time self-attention module, it establishes a time self-attention model, applying self-attention operations in the time dimension to capture dynamic time patterns in traffic data, obtaining dynamic time pattern feature information. Next, a comprehensive prediction model construction module combines spatial feature information, time delay feature information, and dynamic time pattern feature information, applying a self-attention mechanism to construct a comprehensive prediction model. Then, a comprehensive prediction model evaluation module evaluates the performance of the comprehensive prediction model, obtaining performance evaluation results. Finally, using a model prediction module, based on the performance evaluation results, it adjusts the parameters of the comprehensive prediction model to obtain a standard prediction model, which is then used to predict future traffic flow in the target monitoring area.

[0113] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. A traffic flow prediction method based on a self-attention mechanism, characterized in that, Includes the following steps: Historical traffic information of the target monitoring area is collected, and the historical traffic information is preprocessed to obtain standard historical traffic information; A spatial self-focus model is established, and the historical traffic information is processed to obtain the spatial feature information of roads in the target monitoring area; An event transmission delay perception model is established, the historical traffic information is transformed into features, and the transformed features are clustered using a time clustering algorithm to obtain time delay feature information. Extract 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; Based on the timestamp information, the traffic flow information within the time period in which the time occurred 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 time delay feature information of that node. The traffic condition delay feature information is input into a clustering algorithm for cluster analysis to calculate the propagation time delay between each node and other nodes, thus obtaining the time delay feature information. A time-based self-focus model is established to process the historical traffic information and extract dynamic time pattern feature information. Extract traffic flow information, timestamp information, road network information, and weather information from the historical traffic information; The traffic flow information is sorted in chronological order and then combined with the timestamp information for time serialization. The road network information, weather information, and traffic flow information are mapped together to construct a feature vector sequence; A time self-attention model is constructed. The feature vector sequence is input into the time self-attention model, and the time pattern of each time point in the feature vector sequence is calculated through the self-attention mechanism to obtain dynamic time pattern feature information. By combining spatial feature information, temporal delay feature information, and dynamic temporal pattern feature information, a comprehensive prediction model is constructed by applying a self-attention mechanism. The performance of the comprehensive prediction model is evaluated, and the performance evaluation results are obtained. Based on the performance evaluation results, the parameters of the comprehensive prediction model are adjusted to obtain a standard prediction model, which is then used to predict future traffic flow in the target monitoring area.

2. The 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 as follows: collecting historical traffic information of different road sections and different time points in the target monitoring area, including traffic flow information, road network information, weather environment information, timestamp information and historical event information; The road network information refers to the topology of the road system, including the road connections, road classification, and the location and type of road intersections; The aforementioned weather information refers to weather conditions during traffic operations, 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. The traffic flow prediction method based on a self-attention mechanism according to claim 2, characterized in that, The steps of establishing a spatial self-focus model and processing the historical traffic information to obtain spatial feature information of roads in the target monitoring area are as follows: extracting road network information from the historical traffic information; Based on the topology of the road network information, the spatial relationships between nodes at road intersections in the target monitoring area are defined. Construct a spatial self-focus model and calculate the spatial dependency weights between each node and other nodes based on the aforementioned node spatial relationships; Based on the spatial dependency weights, 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 a self-attention mechanism according to claim 3, characterized in that, The steps for constructing a comprehensive prediction model by combining spatial feature information, time delay feature information, and dynamic time pattern feature information and applying a self-attention mechanism are as follows: A comprehensive feature sequence is obtained by integrating the aforementioned spatial feature information, time delay feature information, and dynamic time pattern feature information. The comprehensive feature sequence is used as input to the self-attention mechanism. Through the self-attention mechanism, the correlation between different positions in the comprehensive feature sequence is calculated, and attention weights are assigned to each position. The comprehensive feature sequence is weighted according to the attention weights to obtain a weighted comprehensive feature representation. A comprehensive prediction model is constructed by using the weighted integrated feature representation as input.

5. The traffic flow prediction method based on a self-attention mechanism according to claim 4, characterized in that, The steps for evaluating the performance of the comprehensive prediction model and obtaining the performance evaluation results are as follows: the historical traffic information is divided into a training dataset and a test dataset, and the comprehensive prediction model is trained using the training dataset. The test dataset is input into the trained comprehensive prediction model to obtain the model prediction results. Obtain actual monitoring results information for the target monitoring area; Based on the model prediction results and the actual monitoring results, the similarity between the model prediction results and the actual monitoring results is calculated to obtain the information similarity. Based on the information similarity, the performance of the comprehensive prediction model is evaluated, and the performance evaluation results are obtained.

6. The traffic flow prediction method based on a self-attention mechanism according to claim 5, characterized in that, Based on the performance evaluation results, the parameters of the comprehensive prediction model are adjusted to obtain a standard prediction model. The steps of using the standard prediction model to predict the future traffic flow of the target monitoring area are as follows: Based on the performance evaluation results, the model parameters that need to be adjusted are determined to obtain the model parameters to be adjusted. Based on the parameters of the model to be adjusted, the parameters of the comprehensive prediction model are iteratively adjusted to obtain the standard prediction model; Based on the standard prediction model, the future traffic flow of the target monitoring area is predicted in multiple steps through a forward propagation process, resulting in traffic flow prediction results for multiple future time steps.

7. A traffic flow prediction system based on a self-attention mechanism, characterized in that, A traffic flow prediction method based on a self-attention mechanism, applicable to any one of claims 1-6, includes: a data collection and processing module, used to collect historical traffic information of a target monitoring area, and preprocess the historical traffic information to obtain standard historical traffic information; The spatial self-attention module is used to build geographic and semantic mask matrices and combine them with a self-attention mechanism to capture dynamic and remote spatial dependencies, thereby obtaining spatial feature information of roads in the target monitoring area. The delay-aware feature conversion module is used to establish an event transmission delay-aware model. It uses a time 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 time self-focus module is used to build a time self-focus model, apply self-focus operations in the time dimension to capture dynamic time patterns in traffic data, and obtain dynamic time pattern feature information. The integrated prediction model construction module is used to combine spatial feature information, time delay feature information, and dynamic time pattern feature information, and apply a self-attention mechanism to construct an integrated prediction model. The comprehensive prediction model evaluation module is used to evaluate the performance of the comprehensive prediction model and obtain the performance evaluation results. 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 to use the standard prediction model to predict the future traffic flow of 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