Traffic flow prediction method based on fusion of multiple time-space diagrams and dynamic attention
By adopting diversified convolutional units and multi-head self-attention mechanisms in the traffic flow prediction model, combining multi-spatial-time graph fusion and dynamic attention mechanisms, the shortcomings of existing models in spatial-time feature extraction and correlation representation are solved, and traffic flow prediction with higher accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202510304832.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-06-17
AI Technical Summary
The existing multi-spatial-time graph convolutional network model is difficult to fully represent the correlation between nodes with spatial-time attributes in traffic flow prediction, and the extraction of long-term spatial-time features is not sufficient.
The diversified convolutional units and multi-head self-attention mechanism are adopted to extract the global and local features of traffic flow data, and the fusion of multi-space maps and dynamic attention traffic flow prediction model is realized by constructing a variety of feature maps and spatial embedding methods.
It effectively improves the accuracy of traffic flow prediction and the robustness of the model, and can more accurately capture the spatio-temporal dynamics of nodes in the traffic road network.
Smart Images

Figure CN120164323A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of traffic technology, and particularly relates to an online spatio-temporal traffic flow prediction method integrating multi-spatio-temporal graphs and a dynamic attention structure. Background Art
[0003] Currently, dynamic graphs have become one of the main research directions in multi-spatio-temporal graph convolutional networks because they can better represent the spatio-temporal dynamics of nodes in a traffic road network. However, most existing models only consider the spatial similarity of nodes, such as distance similarity and neighborhood similarity, which are not sufficient to comprehensively represent the correlation between nodes with spatio-temporal attributes. In addition, for the fusion graphs generated by different algorithms, each node in the graph contains unique spatio-temporal information. How to realize the corresponding relationship between nodes in different graphs and multi-graph spatio-temporal fusion is still a huge challenge. At the same time, multi-spatio-temporal deep learning models are restricted by data sources and are not sufficient in extracting long-term spatio-temporal features. Time and space correlations are dynamically associated, and fine-grained fusion of spatio-temporal information can reveal more complex spatio-temporal associations. Therefore, deeply mining the potential spatio-temporal features in traffic characteristics is crucial for improving prediction accuracy and model robustness. Summary of the Invention
[0004] Object of the Invention: In response to the above challenges, this study proposes an innovative traffic flow prediction model based on multi-spatio-temporal graph fusion and dynamic attention. This model deeply analyzes the characteristics of traffic flow data from three dimensions: time, space, and spatio-temporal fusion. First, different convolutional units are used in this paper to capture the global and local correlations of traffic flow information, and at the same time, the self-attention mechanism is used to deeply analyze the fine-grained time features in multi-time domains; then, four feature graphs representing different attributes are constructed to reflect the heterogeneity of nodes in the spatial distribution. These feature graphs include a distance graph, an adjacency graph, a functional graph, and a time pattern similarity graph, which jointly capture the spatial relationships and characteristics of nodes in the traffic road network. Combining with the spatial embedding method, the fusion of multi-spatio-temporal graphs is realized, and the global spatial features of traffic flow data are extracted using GCN and the self-attention mechanism; finally, spatio-temporal features are fused to complete the global analysis and interaction of traffic information and achieve more accurate prediction.
[0005] Technical Solution: A traffic flow prediction method based on multi-spatio-temporal graph fusion and dynamic attention
[0006] Step 1) Construct a distance graph, an adjacency graph, a pattern similarity graph, and a functional graph through traffic flow data and the Euclidean distance information between nodes, and fuse these graphs into a multi-spatio-temporal graph as the graph structure input of the model. Use the graph convolutional network to extract the dynamic correlation of nodes in the spatial domain state and provide an in-depth understanding of the spatial distribution for the model;
[0007] Step 2) Construct a feature extraction layer to preliminarily mine the temporal features and spatial features, and at the same time achieve an in-depth analysis of the short-term and long-term distributions of the temporal features, providing rich spatio-temporal feature information for the model;
[0008] Step 3) According to the attention mechanism, deeply mine the temporal and spatial features, extract the global changes in the time domain and spatial domain, and enhance the model's ability to capture the changing trend of traffic flow;
[0009] Step 4) Use the attention mechanism to achieve the global fusion of temporal and spatial features, and obtain the final prediction result through the convolutional layer, ensuring that the model can comprehensively consider spatio-temporal factors and improve the prediction accuracy;
[0010] Step 5) Finally, use the training dataset as the training input of the multi-spatio-temporal graph fusion and dynamic attention model, and use the test dataset to test the prediction accuracy of the model to verify the effectiveness and generalization ability of the model.
[0011] Furthermore, in step 1), there are complex and changeable spatio-temporal dependence relationships in traffic flow information, and it is difficult to fully reflect the spatial dynamics of traffic nodes only through the predefined adjacency graph. Therefore, the present invention constructs different feature graphs to reflect the distribution characteristics of nodes in different spatial patterns, and uses a trainable weight tensor to align the spatial and temporal dependencies. At the same time, spatial and graph attention mechanisms are introduced to calculate the correlation between nodes located in different graphs, generating a dynamic fusion graph G * . Take the dynamic fusion graph G * and traffic flow data as the input of the spatial component, extract the spatial correlation of traffic flow data, and provide more accurate spatio-temporal features for the model. The specific steps are as follows:
[0012] Step 1-1: Define four structure graphs: namely, distance graph G D , adjacency graph G N , function graph G F and time pattern similarity graph G T . The correspondence between the graph and the matrix is defined as:
[0013]
[0014] where: A D , A N , A F , A T represent the distance matrix, adjacency matrix, function matrix and time pattern similarity matrix respectively.
[0015] Step 1-2: In order to achieve accurate prediction of traffic flow, the present invention adopts advanced spatial embedding and graph embedding technologies to capture and fuse the structural information and node relationships in the multi-spatio-temporal graph. First, use the spatial embedding method to obtain to save the structural information of the graph. Then, a graph embedding method is adopted to encode different graphs, representing the node relationships in different graphs. For this purpose, a trainable weight tensor is constructed for each node in the reference graph, and then the graph is transformed into a vector through a fully connected network to obtain a multi-graph embedding matrix where (i) is an arbitrary graph. To obtain the vertex representation between multiple graphs, the spatial embedding and multi-graph embedding are fused into the node representation of the multi-graph, that is, the graph spatial embedding. The spatial attention and graph attention mechanisms are used to adaptively extract the correlations between nodes. Finally, through the weighted summation method, the extracted correlation information is integrated into the multi-temporal and spatial fusion graph in it.
[0016] Steps 1-3: Use the graph convolutional network to extract the spatial features of the nodes. The spatial component uses two layers of graph convolutional network (GCN) to capture the spatial correlations of traffic nodes, as follows:
[0017] X G = Relu(gcn(FC(gcn(X))))
[0018] where FC(·) is the fully connected layer.
[0019] The graph convolution operation is calculated as follows:
[0020]
[0021] where, is the adjacency matrix with self-connection added, I is the identity matrix, D^ is the degree matrix of, X represents the input of the model, and θ represents the convolution kernel.
[0022] Furthermore, in the step 2), since the traffic flow information in a certain area will be affected by other areas, the similarity of the time series data between nodes will change with the change of the time domain pattern. The data correlation between adjacent time domains is high, while the data correlation between indirectly adjacent nodes is weak. To extract the influence relationship between regional nodes in different time domain patterns, long-term gated convolution and short-term gated convolution units are built to capture long-term and short-term time correlation features with different convolution kernel sizes. The specific steps are as follows:
[0023] Step 2-1: Long-term gated convolution unit (L-convolution layer): Use a convolution kernel of size (T, 1), expand the convolution operation according to the time series length (T = 12), extract the complete time series features, and the output result is μ represents the intermediate vector dimension, and the calculation formula is:
[0024]
[0025] where: is the output of the graph convolutional recurrent unit, Conv1(·) and Conv2(·) are long-term convolutional operations, and a and b are learnable bias parameters.
[0026] Step 2-2: Short-term gated convolutional unit (S-convolutional layer): Use a convolutional kernel of size (4, 1) to finely extract the features of the short-term sequence, and the output result is The formula is defined as:
[0027]
[0028] where: Conv3(·) and Conv4(·) are short-term convolutional operations, and c and d are learnable bias parameters.
[0029] Furthermore, in step 3), in order to enhance the ability to mine the global correlation features of nodes, a multi-head self-attention unit is connected in series after the gated convolutional unit, which can not only deeply mine the correlation features in different time domain states, but also realize the dynamic analysis of the periodic features of data at different time scales, such as the changes in daily and weekly periodic features.
[0030] For the multi-head self-attention mechanism, assume that the given input is X q , X k and X v , and linear mappings are used to obtain the sequences Q, K, V:
[0031] Q = X q W q , K = X k W k , V = X v W v
[0032] where: are the weight parameters of the linear transformation.
[0033] Based on Q, K, V and the scaling factor d, calculate the i-th attention head head i :
[0034]
[0035] Then use the multi-head attention unit to connect the attention features of n heads and calculate the attention function in parallel:
[0036] MHA(Q, K, V) = Concat(head1,..., head h )W m
[0037] where: MHA(·) is the multi-head attention function, Concat is the concatenation operation for connecting attention features, Learning parameters for integrating multi-head attention scores and performing dimensionality reduction.
[0038] Construct multi-head self-attention layers, fully connected layers, and residual and normalization layers for global and local features to learn temporal dependencies in high dimensions, and obtain
[0039] X TL = FMHA(X Tl , X Tl , X Tl ))W a )
[0040] X TS = FMHA(X Ts , X Ts , X Ts ))W β )
[0041] where: X Tl and X Ts are the outputs of the long-term and short-term gated convolutional units, are the weight parameters of the self-attention layer respectively, and F(·) is the mapping of the residual and normalization layer.
[0042] Furthermore, the outputs of the temporal component and the spatial component in step 4) are respectively and Both modes occupy a certain proportion in the traffic flow. Combining the complex spatio-temporal dependencies between nodes and edges, a fusion layer based on the multi-head self-attention mechanism is constructed, and the weights are flexibly allocated using the correspondence between the spatial and temporal components. The calculation formula is:
[0043] X ST = MHA(Q, K, V)
[0044] Q = X TS W q , K = X TL W k , V = X TL W v
[0045] where: represents the output of the spatio-temporal fusion component, are the weight parameters of the linear transformation.
[0046] Furthermore, in step 5), the multi-spatio-temporal graph fusion and dynamic attention model is trained using the training set, and the prediction accuracy of the model is verified using the test set.
[0047] Step 5-1: First, divide the traffic data into a training set, a validation set, and a test set according to a ratio of 6:2:2. Then, construct the basic architecture of the model, initialize the network weights, and determine the input and output dimensions of the network as well as a series of key hyperparameters, laying a solid foundation for model training;
[0048] Step 5-2: Use the training set as the input of the model and train it using a multi-spatiotemporal graph fusion and dynamic attention model. During the training process, generate a series of model training parameters, and determine the mean absolute error, root mean square error, and mean absolute percentage error as the loss functions, and use the Adam optimizer to optimize the network parameters. By iteratively updating the network parameters, the model can learn complex spatiotemporal relationships and gradually improve the prediction accuracy;
[0049] Step 5-3: After the model parameters are determined, record the current optimal model, and use the test set as the model input to test the prediction accuracy of the model. By comparing the model prediction results with the actual traffic flow data, evaluate the performance of the model, display the prediction results of the model, so as to verify the effectiveness and accuracy of the model in actual traffic flow prediction. This step not only ensures the generalization ability of the model but also provides important feedback for the further optimization and application of the model. Description of the Drawings
[0050] Figure 1 It is a flowchart of a traffic flow prediction method based on multi-spatiotemporal graph fusion and dynamic attention of the present invention;
[0051] Figure 2 It is a model structure diagram of a traffic flow prediction method based on multi-spatiotemporal graph fusion and dynamic attention of the present invention;
[0052] Figure 3 It is a graph convolutional recurrent network structure diagram of a traffic flow prediction method based on multi-spatiotemporal graph fusion and dynamic attention of the present invention;
[0053] Figure 4 It is a construction diagram of multi-spatiotemporal graph fusion of a traffic flow prediction method based on multi-spatiotemporal graph fusion and dynamic attention of the present invention;
[0054] Figure 5 It is a comparison diagram of the real data and predicted data of the test set of a traffic flow prediction method based on multi-spatiotemporal graph fusion and dynamic attention of the present invention. Detailed Embodiment
[0055] The technical method of the present invention will be further described in detail below in conjunction with the drawings in the specification.
[0056] As Figure 1-2 shown, a traffic flow prediction method based on multi-spatiotemporal graph fusion and dynamic attention includes the following steps:
[0057] Step 1) Using traffic flow data and the Euclidean distance information between nodes, construct and generate a distance graph, an adjacency graph, a pattern similarity graph, and a functional graph, fuse them into a multi-spatiotemporal graph as the graph structure input of the model, and use a graph convolutional network to extract the dynamic correlation of nodes in the spatial domain state;
[0058] In the above-mentioned Step 1), there are complex and variable spatiotemporal dependence relationships in traffic flow information, and it is difficult to fully reflect the spatial dynamics of traffic nodes only through a predefined adjacency graph. Therefore, the present invention constructs different feature graphs to reflect the distribution characteristics of nodes in different spatial patterns, and uses a trainable weight tensor to align the spatial and temporal dependencies. At the same time, a spatial and graph attention mechanism is introduced to calculate the correlation between nodes located in different graphs, and a dynamic fusion graph G is generated. * Take the dynamic fusion graph G * and traffic flow data as the input of the spatial component, extract the spatial correlation of traffic flow data, and provide more accurate spatiotemporal features for the model. The specific steps are as follows:
[0059] Step 1-1: Define four structure graphs: namely, distance graph G D , adjacency graph G N , functional graph G F and time pattern similarity graph G T . The correspondence between the graph and the matrix is defined as:
[0060]
[0061] Where: A D , A N , A F , A T represent the distance matrix, adjacency matrix, functional matrix, and time pattern similarity matrix respectively.
[0062] Step 1-2: In order to achieve accurate prediction of traffic flow, the present invention adopts advanced spatial embedding and graph embedding technologies to capture and fuse the structural information and node relationships in the multi-spatiotemporal graph. First, use the spatial embedding method to obtain to save the structural information of the graph. Then, use the graph embedding method to encode different graphs to represent the node relationships in different graphs. For this purpose, construct a trainable weight tensor for each node in the graph. Then, transform the graph into a vector through a fully connected network to obtain a multi-graph embedding matrix Among them, (i) is an arbitrary graph. To obtain the vertex representations between multiple graphs, the spatial embedding and multi-graph embedding are fused into the node representation of the multi-graph, that is, the graph space embedding. The spatial attention and graph attention mechanisms are used to adaptively extract the correlations between nodes. Finally, in the way of weighted summation, the extracted correlation information is integrated into the multi-temporal fusion graph in.
[0063] Steps 1-3: Use the graph convolutional network to extract the spatial features of the nodes. The spatial component uses two layers of graph convolutional network (GCN) to capture the spatial correlations of traffic nodes, as follows:
[0064] X G = Relu(gcn(FC(gcn(X))))
[0065] where FC(·) is the fully connected layer.
[0066] The graph convolution operation is calculated as follows:
[0067]
[0068] where, is the adjacency matrix with self-connection added, I is the identity matrix, D^ is the degree matrix of, X represents the input of the model, and θ represents the convolution kernel.
[0069] Step 2) Construct a feature extraction layer to extract the time features and spatial features for the preliminary mining of the features; at the same time, realize the short-term and long-term distribution mining of the time features.
[0070] In the above-mentioned step 2), since the traffic flow information in a certain area will be affected by other areas, the similarity of the time-series data between nodes will change with the change of the time-domain pattern. The data correlation between adjacent time domains is high, while the data correlation between indirectly adjacent nodes is weak. To extract the influence relationship between regional nodes under different time-domain patterns, long-term gated convolution and short-term gated convolution units are built to capture the long-term and short-term time correlation features with different convolution kernel sizes. The specific steps are as follows:
[0071] Step 2-1: Long-term gated convolution unit (L-convolution layer): Use a convolution kernel of size (T, 1), expand the convolution operation according to the time series length (T = 12), and extract the complete time series features. The output result is μ represents the intermediate vector dimension, and the calculation formula is:
[0072]
[0073] where: is the output of the graph convolutional recurrent unit, Conv1(·) and Conv2(·) are long-term convolutional operations, and a and b are learnable bias parameters.
[0074] Step 2-2: Short-term gated convolutional unit (S-convolution layer): Use a convolutional kernel of size (4, 1) to finely extract the features of the short-term sequence, and the output result is The formula is defined as:
[0075]
[0076] where: Conv3(·) and Conv4(·) are short-term convolutional operations, and c and d are learnable bias parameters.
[0077] Step 3) Deeply mine the temporal and spatial features according to the attention mechanism, and extract the global changes in the time domain and spatial domain.
[0078] In the said step 3), in order to strengthen the ability to mine the global correlation features of nodes, a multi-head self-attention unit is connected in series after the gated convolutional unit, which can not only deeply mine the correlation features in different temporal states, but also realize the dynamic analysis of the periodic features of data at different time scales, such as the changes in daily cycle and weekly cycle features.
[0079] For the multi-head self-attention mechanism, assume that the given input is X q , X k and X v , and linear mapping is used to obtain the sequences Q, K, V:
[0080] Q = X q Wq , K = X k W k , V = X v W v
[0081] where: are the weight parameters of the linear transformation.
[0082] Based on Q, K, V and the scaling factor d, calculate the i-th attention head head i :
[0083]
[0084] Then use the multi-head attention unit to connect the attention features of n heads and calculate the attention function in parallel:
[0085] MHAQ,K,V = Concathead1,…,head h )W m
[0086] where: MHA(·) is the multi-head attention function, and Concat is the concatenation operation for concatenating attention features. Learning parameters for integrating multi-head attention scores and performing dimensionality reduction.
[0087] Construct multi-head self-attention layers, fully connected layers, and residual and normalization layers for global and local features to learn temporal dependencies in high dimensions, obtaining
[0088] X TL = FMHA(X Tl , X Tl , X Tl ))W a )
[0089] X TS = FMHA(X Ts , X Ts , X Ts ))W β )
[0090] where: X TL and X TS are the outputs of the long-term and short-term gated convolutional units, are the weight parameters of the self-attention layer respectively, and F(·) is the mapping of the residual and normalization layer.
[0091] Step 4) Use the attention mechanism to achieve global fusion of temporal and spatial features, and obtain the final prediction result through the convolutional layer.
[0092] In the said step 4), the outputs of the temporal component and the spatial component are respectively and Both modes occupy a certain proportion in the traffic flow. Combining the complex spatio-temporal dependencies between nodes and edges, construct a fusion layer based on the multi-head self-attention mechanism, and flexibly allocate weights using the correspondence between the spatial and temporal components. The calculation formula is:
[0093] X ST = MHA(Q, K, V)
[0094] Q = X TS W q , K = X TL W k , V = X TL W v
[0095] where: represents the output of the spatio-temporal fusion component, is the weight parameter of the linear transformation.
[0096] Step 5) Use the training dataset as the training input for the multi - spatio - temporal graph fusion and dynamic attention model, and use the test dataset to test the prediction accuracy of the model.
[0097] In the said step 5), the multi - spatio - temporal graph fusion and dynamic attention model is trained by using the training set, and the test set is used to verify the prediction accuracy of the model.
[0098] Step 5 - 1: First, divide the traffic data into a training set, a validation set, and a test set according to the ratio of 6:2:2. Then, construct the basic architecture of the model, initialize the network weights, and determine the input and output dimensions of the network as well as a series of key hyperparameters, laying a solid foundation for model training;
[0099] Step 5 - 2: Use the training set as the input of the model and train it using the multi - spatio - temporal graph fusion and dynamic attention model proposed in the present invention. During the training process, a series of model training parameters are generated, and the mean absolute error, root mean square error, and mean absolute percentage error are determined as the loss functions, and the Adam optimizer is used to optimize the network parameters. By iteratively updating the network parameters, the model can learn complex spatio - temporal relationships and gradually improve the prediction accuracy;
[0100] Step 5 - 3: After the model parameters are determined, record the current optimal model, and use the test set as the model input to test the prediction accuracy of the model. By comparing the model prediction results with the actual traffic flow data, evaluate the performance of the model, display the prediction results of the model, so as to verify the effectiveness and accuracy of the model in actual traffic flow prediction. This step not only ensures the generalization ability of the model but also provides important feedback for the further optimization and application of the model.
[0101] The present invention aims to solve the problem of insufficient spatio-temporal feature extraction caused by the dynamic changes of sensor nodes in the traffic road network, and proposes an innovative traffic flow prediction model based on multi-spatio-temporal graph fusion and dynamic attention. The model uses diverse convolutional units and multi-head self-attention mechanisms to extract the global and local features of traffic flow data respectively, and conducts fine-grained analysis on the time features in multiple time domains. In addition, in order to enhance the model's ability to mine node spatial features and solve the problem of spatial heterogeneity in the data, four different feature maps are constructed in this paper, and a dynamic fusion graph is generated by combining with the spatial embedding method. Through the graph convolutional network (GCN) and multi-head self-attention mechanism, the model can extract the global spatial features of traffic flow data. Finally, by fusing spatio-temporal features through the attention mechanism, the global analysis and interaction of traffic information are completed, and more accurate prediction is achieved. The present invention constructs a multi-spatio-temporal fusion graph to represent the dynamic changes of road network nodes in spatial distribution, and uses the attention mechanism to achieve deep fusion in time domain and space domain. This method effectively improves the perception and prediction ability of the global situation of the road network, thus significantly improving the accuracy of traffic flow prediction. Through this deep learning method integrating spatio-temporal features, the present invention provides a new technical path for the development of intelligent transportation systems, which helps to achieve more efficient management and optimization of urban traffic flow.
[0102] The above is only a preferred implementation manner of the present invention under the urban road or highway data set. The protection scope of the present invention is not limited to the above implementation manner. Any equivalent modifications and other modified changes made by those of ordinary skill in the art according to the content disclosed by the present invention shall be included in the protection scope recorded in the claims.
Claims
1. A traffic flow prediction method based on multi-spatial graph fusion and dynamic attention. This method finely integrates spatiotemporal data to achieve accurate prediction of traffic flow. The specific steps are as follows: Collect traffic network sensor data, remove outliers, repair missing values and normalize data, and then divide it into training set, validation set and test set; Based on traffic flow data and the Euclidean distance information between nodes, distance graphs, adjacency graphs, pattern similarity graphs, and functional graphs are constructed and fused into multi-temporal and spatial graphs as model inputs. Graph convolutional networks are used to extract the dynamic correlation of node spatial domains. Build a feature extraction layer to capture the long-term and short-term distribution of traffic flow temporal features through long-term gated convolutional units and short-term gated convolutional units, and preliminarily mine spatial features; Adopting the attention mechanism, multiple self-attention units are connected in series after the gated convolutional unit to mine the global changes in the time and space domains and analyze the periodic characteristics of data at different time scales; The attention mechanism is used to achieve global fusion of temporal and spatial features, and the final traffic flow prediction results are obtained through the convolution layer; Train the model with the training set, determine the loss function and optimizer, and iterate the network parameters; use the test set to test the model prediction accuracy and evaluate the model performance.
2. The traffic flow prediction method based on multi-temporal and spatial graph fusion and dynamic attention according to the claim is characterized by: The multi-temporal and spatial graph construction and spatial feature extraction steps include: Define the distance graph G D 、Adjacency graph G N , Functional graph G F Similar to the time pattern graph G T , the correspondence between the graph and the matrix is defined as: Among them: A D , A N , A F , A T They represent distance matrix, adjacency matrix, functional matrix and temporal pattern similarity matrix respectively; Use spatial embedding and graph embedding techniques to build trainable weight tensors Convert the graph into a vector through a fully connected network to obtain a multi-graph embedding matrix Where (i) is an arbitrary graph; we fuse spatial embedding and multi-graph embedding, use spatial and graph attention mechanisms to extract node correlations, and integrate them into multi-temporal fusion graphs middle; A two-layer graph convolutional network (GCN) is used to capture the spatial correlation of traffic nodes as follows: X G =Relu(gcn(FC(gcn(X)))) Among them, FC(·) is a fully connected layer; The graph convolution operation is calculated as follows: in, is the adjacency matrix to add self-connection, I is the identity matrix, for The degree matrix of , X represents the input of the model, and θ represents the convolution kernel.
3. The traffic flow prediction method based on multi-temporal and spatial graph fusion and dynamic attention according to the claim is characterized by: The feature extraction layer construction step includes: The long-term gated convolution unit (L-convolution layer) uses a convolution kernel of size (T, 1) to expand the convolution operation and extract the complete time series features. The output result is μ represents the intermediate vector dimension, and the calculation formula is: in: is the output of the graph convolutional recurrent unit, Conv1(·) and Conv2(·) are long-term convolution operations, and a and b are learnable bias parameters; The short-term gated convolution unit (S-convolution layer) uses a convolution kernel of size (4, 1) to extract the features of short-term sequences in a fine-grained manner. The output result is The formula is defined as: Among them: Conv3(·) and Conv4(·) are short-term convolution operations, and c and d are learnable bias parameters.
4. The traffic flow prediction method based on multi-temporal and spatial graph fusion and dynamic attention according to the claim is characterized by: The step of deep mining of spatiotemporal features comprises: For the multi-head self-attention mechanism, given the input is X q , X k and X v , through linear mapping to obtain the sequence Q = X q W q , K = X k W k , V = X v W v in: is the weight parameter of the linear transformation; Based on Q, K, V and scaling factor d, calculate the i-th attention head i : The multi-head attention unit connects the attention features of n heads and calculates the attention function in parallel: MHA(Q,K,V)=Concat(head1,…,(head h )W m Where: MHA(·) is the multi-head attention function, Concat is the concatenation operation that connects the attention features, Learning parameters for combining multiple attention scores and performing dimensionality reduction; Construct multi-head self-attention layers, fully connected layers, residual and normalization layers for global and local features, learn temporal dependencies, and obtain X TL =F((MHA(X Tl ,X Tl ,(X Tl ))W a ) X TS =F((MHA(X Ts ,X Ts ,X Ts ))W β Where: X Tl and X Ts The output of long-term and short-term gated convolutional units, are the weight parameters of the self-attention layer, and F(·) is the residual and normalization layer mapping.
5. The traffic flow prediction method based on multi-temporal and spatial graph fusion and dynamic attention according to the claim is characterized by: The spatiotemporal feature fusion and prediction steps include: Construct a fusion layer based on the multi-head self-attention mechanism. The calculation formula is: X ST =MHA(Q,K,V) Q=X TS W q ,K=X TL W k ,V=X TL W v in: represents the output of the spatiotemporal fusion component, is the weight parameter of the linear transformation.
6. The traffic flow prediction method based on multi-temporal and spatial graph fusion and dynamic attention according to the claim is characterized by: The model training and testing steps include: Divide the traffic data into training set, validation set and test set in a ratio of 6:2:2; build the basic architecture of the model, initialize the network weights, and determine the input and output dimensions of the network as well as a series of key hyperparameters; The training set is used as the input of the model, and the training is performed based on multi-temporal and spatial graph fusion and dynamic attention model. The mean absolute value error, root mean square error, and mean absolute percentage error are used as loss functions, and the Adam optimizer is used to optimize the network parameters. After the model parameters are determined, the current optimal model is recorded, and the test set is used as the model input to test the prediction accuracy of the model.
Citation Information
Patent Citations
Traffic flow prediction method based on Transform space-time diagram convolutional network
CN114330671A
Traffic flow prediction method based on combination of multiple attention and adaptive graph convolution
CN116911460A
Cited By
High-speed rail hub multi-mode traffic demand space-time prediction method and device based on multi-attention mechanism and medium
CN121743759A
A high-speed rail hub multi-modal traffic demand space-time prediction method and device based on a multi-attention mechanism and a medium
CN121743759B