A highway traffic flow prediction method and system based on spatiotemporal attention mechanism
By building an MDAN model, combining graph neural network and time convolution network, multi-dimensional attention mechanism and multi-task learning are introduced, the accuracy of traffic flow prediction during the highway renovation and expansion is solved, and higher prediction accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202410985950.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2044-07-23
AI Technical Summary
When facing complex and dynamic traffic environments, especially during renovation and expansion, it is difficult to accurately predict traffic flow. Traditional models ignore the differences in different gantry data, resulting in large prediction errors.
The highway traffic flow prediction method based on the spatiotemporal attention mechanism is adopted, and the spatial and temporal characteristics are extracted by constructing an MDAN model, combining graph neural networks and temporal convolution networks, and a multi-dimensional attention mechanism is introduced, and a multi-task learning architecture and homovariance uncertainty loss function are used to balance the differences between different tasks.
It improves the accuracy and robustness of traffic flow forecasting, can accurately predict in complex and dynamic traffic environments, adapt to flow changes during highway renovation and expansion, and provides more accurate and reliable traffic flow forecasting support.
Smart Images

Figure CN118942054B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of transportation, and in particular to a method and system for predicting highway traffic flow based on a spatiotemporal attention mechanism. Background Art
[0002] Highway transportation is a crucial component of a comprehensive, three-dimensional transportation network, and expressways serve as both distribution channels and connecting transport hubs in advancing the development of this integrated transportation system. Information on the operational status of expressway traffic flows is fundamental and crucial for highway management and control. However, current challenges in information perception and status analysis include limited monitoring methods, low monitoring equipment coverage, limited information feedback, simplified detection of abnormal traffic events, and insufficient proactive risk prediction capabilities for road network operations. These issues hinder the timely and accurate implementation of highway management and control measures.
[0003] Thus, traffic flow forecasting on highways has become the foundation of smart highway management. However, for complex prediction problems such as short-term traffic flow, classical theoretical methods rarely achieve satisfactory results. This is especially true for highways undergoing renovation and expansion, where regional traffic conditions constantly change as the project progresses, and these changes are difficult for traditional forecasting models to detect. Current mainstream neural network-based methods often focus on extracting spatiotemporal information, integrating the prediction results of all gantries together for output, ignoring the differences in data distribution across each gantry, resulting in large prediction errors for some gantries. Therefore, researching more accurate and feasible methods to accurately predict future traffic flows, while taking into account the differences in data from different gantries, is of great significance to the development of smart highway organization and control plans. Summary of the Invention
[0004] Purpose of the invention: In view of the limitations of existing highway traffic flow prediction methods, the purpose of the present invention is to propose a highway traffic flow prediction method and system based on the spatiotemporal attention mechanism. Based on the gantry data, a highway traffic flow prediction model MDAN (Multi-Dimensional Attention Network) is constructed based on deep learning. Graph neural networks and temporal convolutional networks are used to extract spatial and temporal features. At the same time, key information is captured through a multi-dimensional attention mechanism to improve the accuracy and reliability of the prediction.
[0005] Technical solution: The present invention is implemented through the following technical solution: a highway traffic flow prediction method based on a spatiotemporal attention mechanism, comprising the following steps:
[0006] Step 1: Obtain highway gantry data, perform data cleaning, and construct a spatiotemporal information data feature matrix, including the traffic flow of each gantry in each time slice. Apply a Gaussian kernel function to integrate the distance information between gantries into an adjacency matrix. The farther the gantries are from each other, the smaller the value marked in the adjacency matrix.
[0007] Step 2: Build a highway traffic flow prediction model MDAN based on deep learning. This model includes the following:
[0008] The MDAN model combines the Diffusion Convolution Network (DCN) with the Temporal Convolution Network
[0009] (Time Convolution Network, TCN) is used for fusion, and spatial and temporal features are extracted at the same time;
[0010] The MDAN model uses the attention mechanism in the model from multiple dimensions to identify the importance of different features, different spatial positions, and different moments, thereby improving the model's prediction performance.
[0011] The MDAN model adopts a multi-task learning architecture, treating the flow prediction of each gantry as a separate task, and balancing different tasks through a loss function based on homoscedastic uncertainty (Uncertainty Weight). It learns together to overcome the problem of large differences in data features of different gantry and improve the generalization ability and robustness of the model.
[0012] Step 3: Input the spatiotemporal information data of the highway gantries into the trained MDAN network to predict the flow rate of each gantry.
[0013] Furthermore, the MDAN model fuses the diffuse convolutional network with the temporal convolutional network to extract both spatial and temporal features, including:
[0014] The MDAN model uses the diffuse convolutional network (DCN), a convolution operation suitable for directed graphs. Through the diffuse convolutional network, MDAN can effectively capture the spatial dependencies between nodes, thereby better understanding the associations and structural features between nodes when processing graph-structured data.
[0015] The MDAN model uses a temporal convolutional network (TCN) as its core component for processing time series data. Compared to traditional recurrent neural networks, TCN offers higher computational efficiency and improved parallelism, enabling more effective capture of temporal dependencies within time series. Using TCN, MDAN can more accurately understand the characteristics of time series data, providing a solid foundation for spatiotemporal feature extraction.
[0016] During the feature extraction process, the MDAN model also uses the LeakyReLU activation function to introduce nonlinearity and enhance the expressiveness of the model.
[0017] The MDAN model uses a channel attention layer to identify the importance of different features, helping to improve feature differentiation. In the channel attention layer, the input spatiotemporal features are first max-pooled and average-pooled in the spatiotemporal dimensions. The information is then transformed through a shared multi-layer perceptron. The resulting summation is then applied to the sigmoid activation function to obtain the final attention representation.
[0018] Furthermore, the MDAN model introduces attention mechanisms into the model from multiple dimensions, including:
[0019] The spatiotemporal attention module is used to identify key spatiotemporal nodes from both temporal and spatial perspectives. The spatiotemporal attention module includes:
[0020] The spatial attention layer primarily consists of pooling and a GraphSAGE structure, which is used to extract important features between nodes in a graph. In the spatial attention layer, the input spatiotemporal features are first subjected to maximum pooling and average pooling in the temporal dimension. The results of these two pooling operations are then concatenated. The spatial dependencies between adjacent nodes are extracted using a GraphSAGE network. This information is then nonlinearly transformed using a multilayer perceptron and then activated using a sigmoid function to obtain the final spatial attention representation.
[0021] The temporal attention layer primarily includes pooling and a BiLSTM structure, which is used to capture key information in time series. In this layer, the input spatiotemporal features are first subjected to maximum pooling and average pooling in the spatial dimension. The two pooling results are then concatenated, and the BiLSTM network is used to extract information from the time series. This information is then nonlinearly transformed using a multi-layer perceptron and passed through a sigmoid activation function to obtain the final temporal attention representation.
[0022] The time dimension is skimmed off through the average pooling operation.
[0023] An external attention layer is introduced to store external memory units to identify the relationship between nodes, thereby enhancing the generalization ability of the model.
[0024] Furthermore, the MDAN model uses a multi-task learning architecture to treat the flow prediction of each gantry as a separate task. Its specific steps include:
[0025] First, a multi-layer perceptron is designed for each gantry to input the spatiotemporal hidden state representation of the gantry and output the traffic flow prediction result of the gantry.
[0026] The loss function based on homoscedastic uncertainty is used to balance different tasks and learn them together to improve the generalization ability and robustness of the model. This loss function takes into account the homoscedastic uncertainty of each task and weights the loss functions of multiple tasks. Homoscedastic uncertainty is task-specific; the higher the uncertainty, the more noise there is in the task-related output, making the learning of the task more challenging. During the training process of the multi-task model, the weights of tasks with higher uncertainty will be reduced, making the overall training of the multi-task model smoother and more efficient. Specifically, the loss function based on homoscedastic uncertainty is expressed as:
[0027]
[0028] Among them, T is the set of all gantry prediction tasks, is the mean square error loss of the t-th gantry prediction task, σ t is a learnable parameter used to measure the uncertainty of the t-th gantry prediction task, σ t The smaller it is, the lower the uncertainty of the task.
[0029] Based on the same inventive concept, the present invention provides a highway traffic flow prediction system based on a spatiotemporal attention mechanism, comprising:
[0030] The preprocessing module is used to obtain highway gantry data, clean the data, and then construct a spatiotemporal information data feature matrix, including the traffic flow of each gantry in each time slice. The distance information between gantries is integrated into the adjacency matrix using a Gaussian kernel function. The farther the gantries are from each other, the smaller the value marked in the adjacency matrix.
[0031] The model building and training module is used to build a highway traffic flow prediction model (MDAN) based on deep learning. The MDAN model integrates the diffuse convolutional network (DCN) and the temporal convolutional network (TCN) to simultaneously extract spatial and temporal features. It also introduces an attention mechanism from multiple dimensions to identify the importance of different features, different spatial locations, and different moments. The MDAN model adopts a multi-task learning architecture, treating traffic flow prediction for each gantry as a separate task and balancing different tasks through a loss function based on homoscedastic uncertainty.
[0032] The traffic flow prediction module is used to input the spatiotemporal information data of highway gantries into the trained MDAN network to predict the traffic flow of each gantry.
[0033] Based on the same inventive concept, the present invention provides a computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor. When the computer program / instruction is executed by the processor, the steps of the highway traffic flow prediction method based on the spatiotemporal attention mechanism are implemented.
[0034] Based on the same inventive concept, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the highway traffic flow prediction method based on the spatiotemporal attention mechanism.
[0035] Beneficial effects: Compared with the existing technology, the present invention has the following advantages: The MDAN model constructed by the present invention effectively extracts the spatiotemporal characteristics of traffic data by fusing graph neural networks and temporal convolutional networks, and is particularly suitable for processing traffic changes during renovation and expansion. The model introduces a multi-dimensional attention mechanism, which enhances the model's recognition of key information and improves the accuracy of predictions. In addition, the multi-task learning architecture enables the model to take into account the differences between different gantries and make more precise traffic predictions. The external attention layer and the optimized loss function increase the generalization and robustness of the model, allowing it to remain efficient in the face of complex and atypical traffic conditions. These advantages work together to enable the MDAN model to have a strong adaptability to dynamically changing and complex traffic environments in the scenario of highway renovation and expansion, and can accurately capture traffic flow characteristics, provide more accurate and reliable traffic flow predictions, and provide strong data support for traffic management and planning. The present invention verified the accuracy of the model by comparing it with multiple benchmark models, and the prediction error MAE on the test set reached 6.825. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 is a flow chart of an embodiment of the present invention.
[0037] Figure 2 This is the entire flow chart of MDAN.
[0038] Figure 3 It is a flow chart of the channel attention mechanism.
[0039] Figure 4 It is a flowchart of the temporal attention mechanism.
[0040] Figure 5 It is a flowchart of the spatial attention mechanism.
[0041] Figure 6 It is a flowchart of the external attention mechanism.
[0042] Figure 7 It is a diagram showing the prediction results of the embodiment. DETAILED DESCRIPTION
[0043] The implementation process of the present invention is described in detail below with reference to the embodiments and accompanying drawings.
[0044] like Figure 1 As shown, an embodiment of the present invention discloses a highway traffic flow prediction method based on a spatiotemporal attention mechanism, comprising the following steps:
[0045] Step 1: Obtain highway gantry data. In this example, vehicle passing data is collected from 24 ETC gantries in both directions on the Jiangxi Zhangji Expressway. The data collection period is from September 1 to September 7, 2023, a time span of one week.
[0046] Step 2: Clean the collected ETC gantry data to remove duplicate data and erroneous data.
[0047] Step 3: Based on step 2, construct temporal and spatial features for the ETC gantry data, which is achieved by the following steps:
[0048] Step 3.1: Construct spatiotemporal information data. In this embodiment, based on ETC gantry data, traffic flow at each gantry in each time slot is counted to generate a spatiotemporal information data feature matrix, with each row representing a time slot and each column representing a gantry. Date information is input into the model as external information by establishing a relationship table between time slot numbers and specific timestamps.
[0049] Step 3.2: Construct an adjacency matrix. In this embodiment, the spatial distribution of the 24 door frames is regarded as a curve. The Gaussian kernel function is applied to integrate the distance information between the door frames into an adjacency matrix. Each element in the adjacency matrix is a floating point number between [0,1]. The farther the door frames are from each other, the weaker the connection between them, and the smaller the value marked in the adjacency matrix. The Gaussian kernel function will realize the mapping from spatial distance to the value of the adjacency matrix element. It can measure the similarity between two vectors. The greater the similarity, the greater the value of the function. The Gaussian kernel function is expressed as follows:
[0050]
[0051] Where x i ,x j represents the coordinate vector of the gantry i and j, σ is the bandwidth of the Gaussian kernel, and the smaller σ is, the narrower the Gaussian distribution is. In this embodiment, the parameter σ of the Gaussian kernel function is 2 Set to 500.
[0052] Step 4: Based on Figure 2The highway traffic flow prediction model MDAN constructed as shown imports the spatiotemporal information data obtained in step 3 into the spatiotemporal feature extraction module. The specific steps are as follows:
[0053] Step 4.1: Extract spatial features. A diffusion convolutional network (DCN) is used to process graph-structured data, capturing the spatial dependencies between nodes and understanding their associations and structural characteristics. The adjacency matrix, a constant parameter in the DCN, assists in extracting spatial features.
[0054] Step 4.2: Extract temporal features. Using the Time Convolution Network (TCN) as the core component for time series data processing, we can capture the temporal dependencies within the time series and understand the characteristics of the time series data.
[0055] Step 4.3: Using the output of step 4.2 as input, use the LeakyReLU activation function to introduce nonlinearity and enhance the model’s expressiveness.
[0056] Step 4.4: Input channel attention layer (Channel Attention). Figure 3 As shown in the figure, in the channel attention layer, the input spatiotemporal features are first subjected to maximum pooling and average pooling in the spatiotemporal dimension, and then the information is transformed through a shared multi-layer perceptron, the results are added together, and the final attention representation is obtained after passing the Sigmoid activation function.
[0057] Step 5: Import the spatiotemporal information data processed in step 4 into the spatiotemporal attention module. The specific steps in the module are as follows:
[0058] Step 5.1: Input the spatial attention layer, such as Figure 5 As shown in the figure, the input spatiotemporal features are first subjected to maximum pooling and average pooling in the time dimension. The results of the two poolings are then concatenated, and the spatial dependencies between adjacent nodes are extracted through the GraphSAGE network. The information is then nonlinearly transformed through a multi-layer perceptron and passed through a Sigmoid activation function to obtain the final spatial attention representation.
[0059] Step 5.2: Input the temporal attention layer, such as Figure 4As shown in the figure, the input spatiotemporal features are first subjected to maximum pooling and average pooling in the spatial dimension. The two pooling results are then concatenated, and the information in the time series is extracted through a BiLSTM network. The information is then nonlinearly transformed through a multi-layer perceptron and passed through a Sigmoid activation function to obtain the final temporal attention representation.
[0060] Step 6: Perform an average pooling operation on the spatiotemporal information data processed in step 5 to remove the time dimension.
[0061] Step 7: Input the average pooled spatiotemporal information data into the external attention layer to store external memory units to identify the relationship between nodes and enhance the generalization ability of the model. Figure 6 As shown in the figure, M k and M v An external memory unit that represents keys and values.
[0062] Step 8: Treat the data prediction for each gantry as a separate task and train it using a multi-task model. The input of the multi-task model is the spatiotemporal information of the entire traffic network. After extracting this spatiotemporal information, the hidden state representation corresponding to each node is branched into a single task. The output of each task is the future traffic flow of the corresponding gantry. Specifically, a loss function based on homoscedastic uncertainty is used to balance the different tasks and jointly learn them. The loss function is expressed as follows:
[0063]
[0064] Where T is the set of all gantry prediction tasks, is the mean square error loss of the t-th gantry prediction task, σ t is a learnable parameter used to measure the uncertainty of the t-th gantry prediction task, σ t The smaller it is, the lower the uncertainty of the task.
[0065] Step 9: A multi-layer perceptron is set up for each gantry to output the prediction results.
[0066] The following is a verification experiment of this embodiment:
[0067] The S69 Zhangji Expressway was selected as the research object. The research scope is from Zhangshu Hub (excluding) to Ji'an South Hub (excluding). There are 5 entrance and exit interchanges and 1 hub interchange along the line, and the expressway is divided into 7 sections. Traffic flow data was collected from 12 pairs of 24 gantries along the line, including 7 pairs of mainline gantries located in 7 sections and 5 pairs of toll station gantries located at 5 entrances and exits. The data collection time is from September 1 to September 7, 2023, with a time span of one week. The indicators of model evaluation are MAE and RMSE. The benchmark models used for comparison are as follows:
[0068] 1) History Average (HA)
[0069] The average traffic flow within the historical time window is used as the predicted traffic flow at the next moment.
[0070] 2) Support Vector Regression Model (SVR)
[0071] A regression model based on support vector machines that fits the input-output relationship in training data by finding an optimal hyperplane in high-dimensional space.
[0072] 3) Graph Convolutional Network (GCN)
[0073] Without considering time feature extraction, the adjacency matrix and feature matrix are input and the prediction results are output.
[0074] 4) Gated Recurrent Unit (GRU)
[0075] A variant of the LSTM model that only considers temporal features and ignores spatial features.
[0076] 5) Temporal Graph Convolutional Network Model (T-GCN)
[0077] A deep learning model that combines GCN and GRU.
[0078] The MDAN model and multiple benchmark models were trained on the training set and verified on the test set. The prediction accuracy of each model is shown in the following table.
[0079] Table 1 Prediction accuracy of each model
[0080]
[0081] As shown in Table 1, the traditional HA model performs averagely in terms of RMSE and MAE, with values of 14.743 and 8.778, respectively. The SVR model shows slight improvement on these two metrics, achieving values of 12.404 and 7.754, respectively. However, the GCN model based on graph neural networks performs less well, with RMSE and MAE of 27.828 and 22.122, respectively, which are much higher than those of other models. In contrast, the GRU and T-GCN models perform relatively similarly in terms of prediction accuracy, with RMSEs of 11.016 and 10.854, and MAEs of 7.305 and 7.264, respectively. Our proposed MDAN model performs best among all models, with an RMSE of 10.523 and a MAE of only 6.825, indicating that the MDAN model has higher accuracy and reliability in the task of highway traffic flow prediction.
[0082] Visualize the prediction results of each gantry, such as Figure 7 As shown in the figure, the model can effectively predict traffic flow trends and accurately perceive sudden changes in traffic flow. These visualization results further verify the effectiveness and robustness of the model in actual traffic flow prediction, providing an important reference for traffic management decision-making.
[0083] Based on the same inventive concept, an embodiment of the present invention discloses a highway traffic flow prediction system based on a spatiotemporal attention mechanism, including: a preprocessing module for acquiring highway gantry data, performing data cleaning and then constructing a spatiotemporal information data feature matrix, including the traffic flow of each gantry in each time slice, and applying a Gaussian kernel function to integrate the distance information between the gantries into an adjacency matrix. The farther the distance between the gantries, the smaller the value marked in the adjacency matrix; a model construction and training module for constructing a highway traffic flow prediction model MDAN based on deep learning. The MDAN model fuses the diffuse convolutional network DCN with the temporal convolutional network TCN, extracts spatial features and temporal features at the same time, and introduces an attention mechanism into the model from multiple dimensions to identify the importance of different features, different spatial positions and different times; the MDAN model adopts a multi-task learning architecture, regards the flow prediction of each gantry as a separate task, and balances different tasks through a loss function based on homoscedastic uncertainty; a flow prediction module for inputting the spatiotemporal information data of the highway gantry into the trained MDAN network to predict the flow of each gantry.
[0084] Based on the same inventive concept, an embodiment of the present invention discloses a computer system, including a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor. When the computer program / instruction is executed by the processor, the steps of the highway traffic flow prediction method based on the spatiotemporal attention mechanism are implemented.
[0085] Based on the same inventive concept, an embodiment of the present invention discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the highway traffic flow prediction method based on the spatiotemporal attention mechanism.
Claims
1. A highway traffic flow prediction method based on spatiotemporal attention mechanism, characterized in that: The steps include: Obtain highway gantry data, perform data cleaning, and then construct a spatiotemporal information data feature matrix, including the traffic flow of each gantry in each time slice. Apply a Gaussian kernel function to integrate the distance information between gantries into an adjacency matrix. The farther the gantries are from each other, the smaller the value marked in the adjacency matrix. A highway traffic flow prediction model, MDAN, is constructed based on deep learning. The MDAN model integrates a diffuse convolutional network (DCN) with a temporal convolutional network (TCN), extracting both spatial and temporal features. An attention mechanism is introduced into the model from multiple dimensions to identify the importance of different features, spatial locations, and time periods. The MDAN model uses a multi-task learning architecture, treating traffic flow prediction for each gantry as a separate task and balancing these tasks using a loss function based on homoscedastic uncertainty. The spatiotemporal information data of highway gantries are input into the trained MDAN network to predict the flow rate of each gantry; The MDAN model uses the diffuse convolutional network (DCN) to process graph structure data, capture the spatial dependencies between nodes, and understand the associations and structural features between nodes. The MDAN model uses the temporal convolutional network (TCN) as the core component for time series data processing, capturing temporal dependencies within the time series and understanding the characteristics of the time series data. During feature extraction, the MDAN model uses the LeakyReLU activation function to introduce nonlinearity, enhancing the model's expressiveness, and utilizes a channel attention layer to identify the importance of different features and improve feature discrimination. The channel attention layer performs maximum pooling and average pooling on the input spatiotemporal features in the spatiotemporal dimensions, then transforms the information through a shared multi-layer perceptron, adds the results, and passes them through a Sigmoid activation function to obtain the final attention representation. The MDAN model extracts important features between nodes in the graph structure through a spatial attention layer. The spatial attention layer performs maximum pooling and average pooling on the input spatiotemporal features in the time dimension, then concatenates the two pooling results and extracts the spatial dependencies between adjacent nodes through the GraphSAGE network. The information is then nonlinearly transformed through a multi-layer perceptron and passed through a Sigmoid activation function to obtain the final spatial attention representation. The MDAN model captures key information in time series through a temporal attention layer. The temporal attention layer performs maximum pooling and average pooling on the input spatiotemporal features in the spatial dimension, then concatenates the two pooling results and extracts information from the time series through a BiLSTM network. This information is then nonlinearly transformed through a multi-layer perceptron and activated with a Sigmoid function to obtain the final temporal attention representation. The MDAN model performs an average pooling operation on the spatiotemporal features processed by the spatial attention mechanism and the temporal attention mechanism to remove the time dimension, and inputs them into the external attention layer to identify the association relationship between nodes.
2. The highway traffic flow prediction method based on spatiotemporal attention mechanism according to claim 1 is characterized in that: The MDAN model designs a multi-layer perceptron for each gantry, which is used to input the spatiotemporal hidden state representation of the gantry and output the traffic flow prediction result of the gantry.
3. The highway traffic flow prediction method based on spatiotemporal attention mechanism according to claim 1 is characterized in that: The loss function based on homoscedastic uncertainty is expressed as: Among them, T is the set of all gantry prediction tasks, is the mean square error loss of the t-th gantry prediction task, σ t is a learnable parameter used to measure the uncertainty of the t-th gantry prediction task, σ t The smaller it is, the lower the uncertainty of the task.
4. A highway traffic flow prediction system based on spatiotemporal attention mechanism, characterized by: include: The preprocessing module is used to obtain highway gantry data, clean the data, and then construct a spatiotemporal information data feature matrix, including the traffic flow of each gantry in each time slice. The distance information between gantries is integrated into the adjacency matrix using a Gaussian kernel function. The farther the gantries are from each other, the smaller the value marked in the adjacency matrix. The model building and training module is used to build a highway traffic flow prediction model MDAN based on deep learning. The MDAN model integrates the diffusion convolutional network DCN and the temporal convolutional network TCN, extracts spatial features and temporal features at the same time, and introduces an attention mechanism in the model from multiple dimensions to identify the importance of different features, different spatial positions and different moments. The MDAN model adopts a multi-task learning architecture, treats the flow prediction of each gantry as a separate task, and balances different tasks through a loss function based on homoscedastic uncertainty. The MDAN model uses the diffusion convolutional network DCN to process graph structure data, capture the spatial dependencies between nodes, and understand the relationships between nodes. The MDAN model uses the temporal convolutional network (TCN) as the core component for time series data processing to capture the temporal dependencies within the time series and understand the characteristics of the time series data. In the feature extraction process, the MDAN model uses the LeakyReLU activation function to introduce nonlinearity, enhance the model's expressiveness, and uses the channel attention layer to identify the importance of different features and improve feature discrimination. The channel attention layer performs maximum pooling and average pooling on the input spatiotemporal features in the spatiotemporal dimension, then transforms the information through a shared multi-layer perceptron, adds the results, and passes them through the Sigmoid activation function to obtain the final attention representation. The MDAN model extracts important features between nodes in the graph structure through a spatial attention layer. The spatial attention layer performs maximum pooling and average pooling on the input spatiotemporal features in the time dimension, then concatenates the two pooling results and extracts the spatial dependencies between adjacent nodes through the GraphSAGE network. The information is then nonlinearly transformed through a multi-layer perceptron and passed through a Sigmoid activation function to obtain the final spatial attention representation. The MDAN model captures key information in time series through a temporal attention layer. The temporal attention layer performs maximum pooling and average pooling on the input spatiotemporal features in the spatial dimension, then concatenates the two pooling results and extracts information from the time series through a BiLSTM network. This information is then nonlinearly transformed through a multi-layer perceptron and activated with a Sigmoid function to obtain the final temporal attention representation. The MDAN model performs an average pooling operation on the spatiotemporal features processed by the spatial attention mechanism and the temporal attention mechanism to remove the time dimension, and inputs them into the external attention layer to identify the association relationship between nodes; The traffic flow prediction module is used to input the spatiotemporal information data of highway gantries into the trained MDAN network to predict the traffic flow of each gantry.
5. A computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein: When the computer program / instructions are executed by a processor, the steps of the highway traffic flow prediction method based on the spatiotemporal attention mechanism according to any one of claims 1 to 3 are implemented.
6. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the highway traffic flow prediction method based on the spatiotemporal attention mechanism according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Expressway traffic condition prediction method and device, electronic equipment and storage medium
CN117576891A
Traffic flow prediction method and system based on time-space synchronization dynamic graph attention network
CN117671952A