Traffic Flow Prediction Method and Device Based on Local-Global Spatiotemporal Feature Fusion

Through the local-global spatiotemporal feature fusion method, combined with graph attention network, graph convolution network, gated recurrent neural network and transformer network, the problem of insufficient model prediction accuracy in existing traffic flow prediction is solved, and higher prediction accuracy and accuracy are achieved.

CN116311880BActive Publication Date: 2025-08-01HUBEI UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211464985.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-22
Publication Date
2025-08-01
Estimated Expiration
2042-11-22

AI Technical Summary

Technical Problem

Existing traffic flow prediction methods cannot effectively process nonlinear and uncertain traffic flow data, graph convolutional networks are difficult to capture long-term dependencies, and recursive neural networks cannot process data in parallel during training, resulting in insufficient model prediction accuracy.

Method used

Using a method based on local-global spatiotemporal feature fusion, non-local spatial dependency features are extracted through graph attention networks, local spatial dependency features are extracted through graph convolutional networks, and gated recurrent neural networks fit the time correlation, and parallel processing is used to capture long-term dependencies.

Benefits of technology

It improves the learning ability of the model, improves the accuracy and accuracy of traffic flow prediction, and can better fit complex traffic flow data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116311880B_ABST
    Figure CN116311880B_ABST
Patent Text Reader

Abstract

The present invention provides a traffic flow prediction method and device based on local-global spatio-temporal feature fusion. The method includes: Step 1 to Step 5. The present invention obtains the global time information for traffic speed prediction while taking into account the order correlation of temporal information, and improves the learning ability of the model by fusing local and non-local information in time and space, and the model has higher prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical field of traffic flow prediction, and particularly to a traffic flow prediction method and device based on local-global spatio-temporal feature fusion. Background Art

[0002] The Intelligent Traffic System (ITS) plays an important role in urban transportation, safety assurance, and road management. ITS can effectively plan and manage cities by analyzing and predicting the collected traffic big data. Traffic prediction is an important part of ITS. By predicting the future traffic volume in a region through traffic flow big data, local governments and communities can better conduct traffic scheduling and flow management, alleviate the contradiction between vehicle flow and pedestrian flow to ensure road traffic safety. At the same time, accurate traffic flow prediction can predict traffic congestion sections in a region and also bring convenience to people's travel. Making traffic decisions through prediction is a simpler, cheaper, and less traffic-congested solution. Traffic flow prediction methods create prediction models based on historical traffic data to predict the short-term traffic flow state in the next 5 - 60 minutes. It is a time series prediction. However, traffic flow is usually non-linear and uncertain, and as the traffic flow data grows, these models cannot handle it effectively. For spatial modeling, the Graph Convolutional Network (GCN) can aggregate the features of neighbors around graph nodes and is used to extract the spatial features of the real traffic road network. However, the traffic relationship of a certain node is not only affected by the surrounding nodes, which means that the relationship between nodes is non-local, and not all nodes will affect each other. For time modeling, methods based on RNN usually use LSTM and GRU to fit time dependencies. Although they have good effects in dealing with time series problems, using recursive neural networks to capture traffic sequence information will lose long-term dependencies due to long cycle paths and cannot process data in parallel during training. Therefore, developing a traffic flow prediction method and device based on local-global spatio-temporal feature fusion to effectively overcome the defects in the above related technologies has become an urgent technical problem in the industry. Summary of the Invention

[0003] In view of the above problems existing in the prior art, the embodiments of the present invention provide a traffic flow prediction method and device based on local-global spatio-temporal feature fusion.

[0004] In a first aspect, an embodiment of the present invention provides a traffic flow prediction method based on local-global spatio-temporal feature fusion, including: Step 1: Construct a data set, collect real vehicle speed information passing on the highway, and construct a traffic flow data set; and construct an adjacency matrix according to the traffic road network topology map; Step 2: Construct a graph attention network layer, and extract non-local spatial dependence features between different nodes in the traffic network topology map according to the attention weights learned by the network itself; Step 3: Construct a graph convolutional network layer, and extract local spatial dependence features aggregated by each node in the traffic network topology map and its surrounding nodes; Step 4: Construct a gated recurrent neural network layer to fit the sequential duration correlation of traffic flow information; Step 5: Construct a transformer network layer for parallel processing of traffic sequence information, capturing the long-term dependence of the transformer network layer, and predicting future traffic flow.

[0005] Based on the above method embodiment content, in the traffic flow prediction method based on local-global spatio-temporal feature fusion provided in the embodiment of the present invention, Step 1 includes: Step 1.1: Collect the speed information of passing vehicles by sensors and construct a traffic flow feature matrix where N is the number of nodes and P is the number of node attribute features; Step 1.2: Construct the traffic road network topology into a graph G=(V, E, A), where V is the road node and E is the edge connecting the graph node v i with v j connected, is the adjacency matrix, and each element a i,j in A is 0 or 1, indicating whether node v i is adjacent to node v j . The calculation of the adjacency matrix includes: where i, j = 1, …, N.

[0006] Based on the above method embodiment content, in the traffic flow prediction method based on local-global spatio-temporal feature fusion provided in the embodiment of the present invention, Step 2 is specifically: Step 2.1: Map the feature vector x i to another vector space and calculate the feature correlation coefficient between each node:

[0007]

[0008]

[0009] where x i is the feature vector of node v i , || is the connection of node attributes, is a weight parameter vector, LeakyReLU is a non-linear activation function, and W is a weight parameter mapping vector of the feature vector; Step 2.2: Use the softmax activation function for normalization processing and calculate the correlation weights between each node:

[0010]

[0011] Step 2.3: Multiply the correlation weights between nodes by the feature matrix to obtain an updated feature matrix, and use the multi-head form to fit in different subspaces:

[0012]

[0013] where x j is the v i feature vector of the node that calculates the correlation weight with node v j , K is the number of attention heads, W k is the weight parameter coefficient in the k-th attention head, σ is the sigmoid activation function; Connect and fuse the expressions of each attention head in different subspaces: X" = X'W'; where, W' is the weight parameter matrix, and Perform residual connection: X″′ = X + X″.

[0014] Based on the content of the above method embodiment, in the traffic flow prediction method provided in the embodiment of the present invention based on local-global spatio-temporal feature fusion, Step Three is specifically: Step 3.1: Laplacian matrix of the graph: where I N is the identity matrix; Calculate the degree matrix: Calculate the symmetric normalized Laplacian matrix: Step 3.2: Construct a layer of graph convolutional neural network: where, W0 is the weight parameter matrix, and σ is the sigmoid activation function.

[0015] Based on the content of the above method embodiment, in the traffic flow prediction method provided in the embodiment of the present invention based on local-global spatio-temporal feature fusion, Step Four is specifically: Step 4.1: Construct a gated recurrent neural network, and the specific formula includes:

[0016] u t = σ(V u [F(X t , A), h t-1 + b u );

[0017] r t = σ(V r [F(X t , A), h t-1]+b r );

[0018] c t =tanh(V c [F(X t ,A),(r t *h t-1 )]+b c );

[0019] h t =u t *h t-1 +(1-u t )*c t ;

[0020] Among them, u t is the state of the update door at time t, r t is the reset gate state at time t, c t is the candidate hidden layer state at time t, V u , V r , V c is the weight parameter matrix, b u , b r , b c is the deviation coefficient, [] is the matrix connection, h t-1 is the output at time t-1, tanh is the activation function, and σ is the sigmoid activation function.

[0021] Based on the content of the above method embodiment, the traffic flow prediction method based on local-global spatiotemporal feature fusion provided in the embodiment of the present invention has the following steps: Step 5.1: Construct the transformer layer, first add the position encoding information matrix to each position of the feature vector: in:

[0022]

[0023] Among them, H is the final output result of the gated recurrent neural network layer, r is the node position of the feature matrix, d model is the dimension size of the feature matrix mapped to the multi-head attention space, i is the position of the node attribute in the time series, sin and cos are trigonometric functions; Step 5.2: Mapping to the multi-head self-attention layer:

[0024]

[0025]

[0026] d k =d model / S;

[0027] Among them, W 1 , W Q , W K , W V is the weight parameter matrix, S is the number of heads in the multi-head self-attention, || is the connection between the multi-heads; d k is the feature dimension in each subspace; Regularized residual connection:

[0028]

[0029] Among them, LayerNrom is the layer feature normalization function;

[0030] Step 5.3: Regularize the residual link again after passing through the feed-forward network layer, and input the fully connected prediction layer to obtain the final prediction result:

[0031] FFN(H l ) = W2ReLU(W1H l +b1)+b2;

[0032]

[0033] X l = W3H l +b3;

[0034] Among them, W1, W2, and W3 are parameter weight matrices, b1, b2, and b3 are bias coefficients, and ReLU is the activation function.

[0035] In a second aspect, an embodiment of the present invention provides a traffic flow prediction device based on local-global spatio-temporal feature fusion, including: a first main module for implementing Step 1: constructing a data set, collecting real vehicle speed information passing on the highway, and constructing a traffic flow data set; and constructing an adjacency matrix according to the traffic road network topology map; a second main module for implementing Step 2: constructing a graph attention network layer, and extracting non-local spatial dependence features between different nodes in the traffic network topology map according to the attention weights learned by the network itself; a third main module for implementing Step 3: constructing a graph convolutional network layer, and extracting local spatial dependence features aggregated by each node in the traffic network topology map with surrounding nodes; a fourth main module for implementing Step 4: constructing a gated recurrent neural network layer to fit the sequential duration correlation of traffic flow information; Step 5: constructing a transformer network layer for parallel processing of traffic sequence information and capturing the long-term dependence of the transformer network layer to predict future traffic flow.

[0036] In a third aspect, an embodiment of the present invention provides an electronic device, including:

[0037] At least one processor; and

[0038] At least one memory communicatively connected to a processor, wherein:

[0039] The memory stores program instructions executable by the processor, and the processor can execute the traffic flow prediction method based on local-global spatio-temporal feature fusion provided by any one of the various implementations of the first aspect by invoking the program instructions.

[0040] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium storing computer instructions that cause a computer to execute the traffic flow prediction method based on local-global spatio-temporal feature fusion provided by any one of the various implementations of the first aspect.

[0041] The traffic flow prediction method and device based on local-global spatio-temporal feature fusion provided by the embodiments of the present invention obtain the global time information for traffic speed prediction while taking into account the order correlation of temporal information, and improve the learning ability of the model by fusing local and non-local information in time and space, so that the model has higher prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0043] Figure 1 It is a flowchart of the traffic flow prediction method based on local-global spatio-temporal feature fusion provided by an embodiment of the present invention;

[0044] Figure 2 It is a schematic structural diagram of the traffic flow prediction device based on local-global spatio-temporal feature fusion provided by an embodiment of the present invention;

[0045] Figure 3 It is a schematic physical structure diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0046] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention. In addition, the technical features in each embodiment or a single embodiment provided by the present invention can be combined with each other arbitrarily to form a feasible technical solution. This combination is not restricted by the order of steps and / or the structural composition mode, but must be based on the fact that those of ordinary skill in the art can implement it. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention.

[0047] An embodiment of the present invention provides a traffic flow prediction method based on local-global spatio-temporal feature fusion. Refer to Figure 1 , the method includes: Step 1: Construct a data set, collect the real vehicle speed information passing on the highway, and construct a traffic flow data set; and construct an adjacency matrix according to the traffic road network topology map; Step 2: Construct a graph attention network layer, and extract the non-local spatial dependence features between different nodes in the traffic network topology map according to the attention weights learned by the network itself; Step 3: Construct a graph convolutional network layer, and extract the local spatial dependence features aggregated by each node in the traffic network topology map with its surrounding nodes; Step 4: Construct a gated recurrent neural network layer to fit the sequential duration correlation of traffic flow information; Step 5: Construct a transformer network layer to parallelize the processing of traffic sequence information, capture the long-term dependence of the transformer network layer, and predict the future traffic flow.

[0048] Based on the content of the above method embodiment, as an optional embodiment, in the traffic flow prediction method based on local-global spatio-temporal feature fusion provided by the embodiments of the present invention, Step 1 includes: Step 1.1: Collect the speed information of passing vehicles by sensors and construct a traffic flow feature matrix where N is the number of nodes and P is the number of node attribute features; Step 1.2: Construct the traffic road network topology into a graph G=(V, E, A), where V is the road node, E is the edge connecting the graph node v i and v j , is the adjacency matrix, and each element a i,j in A is 0 or 1, indicating whether the node v i is adjacent to the node v j . The calculation of the adjacency matrix includes: where i, j = 1, …, N.

[0049] Based on the content of the above method embodiments, as an alternative embodiment, in the embodiment of the present invention, for the traffic flow prediction method based on local-global spatio-temporal feature fusion, step two is specifically as follows: Step 2.1: Map the feature vector x i to another vector space and calculate the feature correlation coefficient between each node:

[0050]

[0051]

[0052] where x i is the feature vector of node v i , || is the concatenation of node attributes, is a weight parameter vector, LeakyReLU is a non-linear activation function, and W is the weight parameter mapping vector of the feature vector; Step 2.2: Use the softmax activation function for normalization processing and calculate the correlation weights between each node:

[0053]

[0054] Step 2.3: Multiply the correlation weights between nodes by the feature matrix to obtain the updated feature matrix, and use the multi-head form to fit in different subspaces:

[0055]

[0056] where x j is the feature vector of v of the node for which the correlation weight is calculated with node v i , K is the number of attention heads, W j is the weight parameter coefficient in the k-th attention head, σ is the sigmoid activation function; Connect and fuse the expressions of each attention head in different subspaces: X" = X'W'; where, W' is the weight parameter matrix, and k Perform a residual connection: X″′ = X + X″.

[0057] Based on the content of the above method embodiments, as an alternative embodiment, in the embodiment of the present invention, for the traffic flow prediction method based on local-global spatio-temporal feature fusion, step three is specifically as follows: Step 3.1: Laplacian matrix of the graph: where I N is the identity matrix; Calculate the out-degree matrix: Calculate the symmetric normalized Laplacian matrix: Step 3.2: Construct a layer of graph convolutional neural network: Among them, W0 is the weight parameter matrix, and σ is the sigmoid activation function.

[0058] Based on the content of the above method embodiments, as an alternative embodiment, in the embodiment of the present invention, the traffic flow prediction method based on local-global spatio-temporal feature fusion, step four is specifically as follows: Step 4.1: Construct a gated recurrent neural network, and the specific formula includes:

[0059] u t = σ(V u [F(X t , A), h t-1 + b u );

[0060] r t = σ(V r \ [F(X t , A), h t-1 + b r );

[0061] c t = tanh(V c [F(X t , A), (r t * h t-1 )] + b c );

[0062] h t = u t * h t-1 + (1 - u t ) * c t ;

[0063] Among them, u t is the update gate state at time t, r t is the reset gate state at time t, c t is the candidate hidden layer state at time t, V u , V r , V c are weight parameter matrices, b u , b r , b c are bias coefficients, [] is matrix concatenation, h t-1 is the output at time t - 1, tanh is the activation function, and σ is the sigmoid activation function.

[0064] Based on the content of the above method embodiments, as an alternative embodiment, in the embodiment of the present invention, the traffic flow prediction method based on local-global spatio-temporal feature fusion, step five is specifically as follows: Step 5.1: Construct a transformer layer. First, add a position encoding information matrix to each position of the feature vector: Wherein:

[0065]

[0066] Wherein, H is the final output result of the gated recurrent neural network layer, r is the node position of the feature matrix, d model is the dimension size of the feature matrix mapped to the multi-head attention space, i is the position of the node attribute in the time series, and sin and cos are trigonometric functions; Step 5.2: Map to the multi-head self-attention layer:

[0067]

[0068]

[0069] d k = d model / S;

[0070] Wherein, W 1 , W Q , W K , W V are weight parameter matrices, S is the number of heads in the multi-head self-attention, || is the connection between the multi-heads, and d k is the feature dimension in each subspace; Regularized residual connection:

[0071]

[0072] Wherein, LayerNrom is the layer feature normalization function;

[0073] Step 5.3: Pass through the feed-forward network layer and then regularize the residual connection again, and input the fully connected prediction layer to obtain the final prediction result:

[0074] FFN(H l ) = W2ReLU(W1H l + b1)+ b2;

[0075]

[0076] X l = W3H l + b3;

[0077] Wherein, W1, W2, and W3 are parameter weight matrices, b1, b2, and b3 are bias coefficients, and ReLU is an activation function.

[0078] The traffic flow prediction method based on local-global spatio-temporal feature fusion provided by the embodiments of the present invention obtains the global time information for traffic speed prediction while taking into account the order correlation of time series information, and improves the learning ability of the model by fusing local and non-local information in time and space, and the model has higher prediction accuracy.

[0079] In another embodiment, the method of the present invention is introduced through specific data experiments as follows:

[0080] The data set collects the speed information of passing vehicles from March 1st to March 7th, 2012 by 207 sensors on the highway, constructs a feature matrix of 2016×207, where each value is the true vehicle speed value passing through the sensor, and the vehicle speed of each sensor is collected every 5 minutes; and an adjacency matrix of 207×207.

[0081] In the experiment, the values of the input data are normalized to [0, 1], the first 80% is divided as the training set, and the remaining 20% is used as the test set. The traffic flow for the next 15 minutes is predicted using the data of the previous 60 minutes before the current time node.

[0082] Model parameter settings: The mapping dimension d in the multi-head layer model is 16, the number of heads is 4, the learning rate is 0.001, the batch size is 32, the number of hidden units in the model is set to 64, the training batch is 3000, and the model is trained using the Adam optimizer.

[0083] To verify the effectiveness of the method of the present invention, the method of the present invention is compared with other models through experiments, and the comparison results are included through evaluation criteria:

[0084] Table 1

[0085] Methods RMSE MAE Accuracy HA 7.3067 3.8782 0.8756 ARIMA 10.0811 7.7031 0.8272 SVR 6.6993 3.5352 0.8859 GCN 7.9350 5.5310 0.8649 GRU 5.7062 3.3100 0.9029 T-GCN 5.1805 3.2144 0.9118 The method of the present invention 3.6105 2.9995 0.9382

[0086] The introduction of each method in Table 1 includes:

[0087] HA: Historical average model, using the average traffic information in the historical period as the prediction;

[0088] ARIMA: Autoregressive integrated moving average model, a classic model in the field of time series prediction;

[0089] SVR: Support vector regression model, training the model using historical data to obtain the relationship between input and output for prediction;

[0090] GCN: Graph convolutional neural network model, fusing graph nodes and their first-order neighborhood information, combining spatial features with time series information after capturing them;

[0091] GRU: Gated Recurrent Unit, a variant of the recurrent neural network and one of the most widely used models for time series data;

[0092] T-GCN: Temporal Graph Convolutional Network, which combines graph convolutional network and gated recurrent neural network for traffic prediction;

[0093] As can be seen from Table 1, compared with the traditional classical model methods HA and ARIMA, and the machine learning method SVR, the deep learning method has higher prediction accuracy when dealing with complex and non-stationary traffic flow time series data; compared with the neural network GRU model relying only on single duration features and the neural network GCN model relying only on spatial features, the deep learning model T-GCN that can fit spatio-temporal features has higher prediction accuracy; while the method of the present invention considers the extraction and fitting of local and global information in both duration features and spatial features, has better fitting and learning ability for data, and has the lowest prediction error and the highest prediction accuracy among all the compared models.

[0094] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0095] Using graph attention network and graph convolutional network to fit the non-local and local information of the traffic network topology map, compared with the situation in the existing traffic flow prediction technology methods where only local and non-local are considered singly for spatial features, the fusion of local and non-local features of the traffic network topology map can more completely fit the spatial features of traffic flow data and improve the learning ability of the model for the spatial features of real traffic roads.

[0096] Using gated recurrent neural network and transformer network to extract and fit the short-term dependence and parallelized long-term dependence of traffic flow time series information respectively. Compared with a single recurrent neural network for processing time series information, it can take into account the global duration information related to the order of time series information for obtaining traffic speed prediction and improve the learning ability of the model for traffic flow time series information.

[0097] Combining the local and global traffic information fitted separately in terms of duration and space, the designed model can be used to model sequence data with complex topological structures and duration dependencies, has stronger feature fusion ability compared with other spatio-temporal model technology methods, and has lower prediction error and higher prediction accuracy compared with other model experiments.

[0098] The implementation basis of each embodiment of the present invention is achieved through programmed processing by a device with processor functions. Therefore, in engineering practice, the technical solutions and their functions of each embodiment of the present invention can be encapsulated into various modules. Based on this reality, on the basis of the above embodiments, an embodiment of the present invention provides a traffic flow prediction device based on local-global spatio-temporal feature fusion, which is used to execute the traffic flow prediction method based on local-global spatio-temporal feature fusion in the above method embodiments. Refer to Figure 2 , the device includes: a first main module, which is used to implement step one: construct a data set, collect the real vehicle speed information passing on the highway, and construct a traffic flow data set; and construct an adjacency matrix according to the traffic road network topology map; a second main module, which is used to implement step two: construct a graph attention network layer, and extract the non-local spatial dependence features between different nodes in the traffic network topology map according to the attention weights learned by the network itself; a third main module, which is used to implement step three: construct a graph convolutional network layer, and extract the local spatial dependence features aggregated by each node in the traffic network topology map with its surrounding nodes; a fourth main module, which is used to implement step four: construct a gated recurrent neural network layer to fit the sequential duration correlation of traffic flow information; a fifth main module, which is used to implement step five: construct a transformer network layer, which is used to parallelize the processing of traffic sequence information, capture the long-term dependence of the transformer network layer, and predict the future traffic flow.

[0099] The traffic flow prediction device based on local-global spatio-temporal feature fusion provided by the embodiment of the present invention adopts Figure 2 several modules in it, while taking into account the sequential correlation of time series information, obtains the global time information of traffic speed prediction, and improves the learning ability of the model by fusing local and non-local information in time and space. The model has higher prediction accuracy.

[0100] It should be noted that the device in the device embodiment provided by the present invention can be used not only to implement the method in the above method embodiment, but also to implement the methods in other method embodiments provided by the present invention. The difference is only to set the corresponding functional modules, and its principle is basically the same as that of the above device embodiment provided by the present invention. As long as those skilled in the art, on the basis of the above device embodiment, refer to the specific technical solutions in other method embodiments, obtain the corresponding technical means by combining technical features, and the technical solutions composed of these technical means, and ensure that the technical solutions are practical, the device in the above device embodiment can be improved, so as to obtain the corresponding device type embodiment for implementing the methods in other method type embodiments. For example:

[0101] Based on the content of the above device embodiments, as an alternative embodiment, the traffic flow prediction device based on local-global spatio-temporal feature fusion provided in the embodiments of the present invention further includes: a first sub-module for implementing step one, including: Step 1.1: Collect the speed information of passing vehicles by sensors and construct a traffic flow feature matrix where N is the number of nodes and P is the number of node attribute features; Step 1.2: Construct the traffic road network topology into a graph G=(V, E, A), where V is the road node and E is the edge connecting the graph node v i with v j connected, is the adjacency matrix, and each element a in A i,j is 0 or 1, indicating whether node v i is adjacent to node v j . The calculation of the adjacency matrix includes: where i, j = 1, …, N.

[0102] Based on the content of the above device embodiments, as an alternative embodiment, the traffic flow prediction device based on local-global spatio-temporal feature fusion provided in the embodiments of the present invention further includes: a second sub-module for implementing step two, specifically: Step 2.1: Map the feature vector x i to another vector space and calculate the feature correlation coefficient between each node:

[0103]

[0104]

[0105] where x i is the feature vector of node v i , || is the connection of node attributes, is a weight parameter vector, LeakyReLU is a non-linear activation function, and W is the weight parameter mapping vector of the feature vector; Step 2.2: Use the softmax activation function for normalization processing and calculate the correlation weight between each node:

[0106]

[0107] Step 2.3: Multiply the correlation weight between nodes by the feature matrix to obtain an updated feature matrix, and use the multi-head form to fit in different subspaces:

[0108]

[0109] where x j is the v of the node calculating the correlation weight with node v i , and v jFeature vector, K is the number of attention heads, and W k is the weight parameter coefficient in the k-th attention head, and σ is the sigmoid activation function; the expressions of each attention head in different subspaces are concatenated and then fused for output: X" = X'W'; where, W' is the weight parameter matrix, and a residual connection is made: X″′ = X + X″.

[0110] Based on the content of the above device embodiment, as an alternative embodiment, the traffic flow prediction device based on local-global spatio-temporal feature fusion provided in the embodiments of the present invention further includes: a third sub-module for implementing step three specifically: Step 3.1: Laplacian matrix of the graph: where I N is the identity matrix; calculate the degree matrix: calculate the symmetric normalized Laplacian matrix: Step 3.2: Construct a one-layer graph convolutional neural network: where, W0 is the weight parameter matrix, and σ is the sigmoid activation function.

[0111] Based on the content of the above device embodiment, as an alternative embodiment, the traffic flow prediction device based on local-global spatio-temporal feature fusion provided in the embodiments of the present invention further includes: a fourth sub-module for implementing step four specifically: Step 4.1: Construct a gated recurrent neural network, and the specific formulas include:

[0112] u t = σ(V u [F(X t , A), h t-1 + b u );

[0113] r t = σ(V r [F(X t , A), h t-1 + b r );

[0114] c t = tanh(V c [F(X t , A), (r t * h t-1 ) + b c );

[0115] h t = u t * h t-1 + (1 - u t ) * c t ;

[0116] where, u t is the update gate state at time t, r t is the reset gate state at time t, c t is the candidate hidden layer state at time t, V u , V r , V c is the weight parameter matrix, b u , b r , b c is the bias coefficient, [] is matrix concatenation, h t-1 is the output at time t-1, tanh is the activation function, and σ is the sigmoid activation function.

[0117] Based on the content of the above device embodiment, as an optional embodiment, the traffic flow prediction device provided in the embodiment of the present invention based on local-global spatio-temporal feature fusion further includes: a fifth sub-module for implementing Step Five specifically: Step 5.1: Construct a Transformer layer. First, add a positional encoding information matrix to each position of the feature vector: where:

[0118]

[0119] where H is the final output result of the gated recurrent neural network layer, r is the node position of the feature matrix, d model is the dimension size of the feature matrix mapped to the multi-head attention space, i is the position of the node attribute in the time series, and sin and cos are trigonometric functions; Step 5.2: Map to the multi-head self-attention layer:

[0120]

[0121]

[0122] d k = d model / S;

[0123] where, W 1 , W Q , W K , W V is the weight parameter matrix, S is the number of heads in the multi-head self-attention, || is the connection between the multi-heads, and d k is the feature dimension in each subspace; Regularized residual connection:

[0124]

[0125] where LayerNrom is the layer feature normalization function;

[0126] Step 5.3: Regularize the residual link again after passing through the feedforward network layer, and input it into the fully connected prediction layer to obtain the final prediction result:

[0127] FFN(H l ) = W2ReLU(W1H l + b1) + b2;

[0128]

[0129] X l = W3H l + b3;

[0130] Among them, W1, W2, and W3 are parameter weight matrices, b1, b2, and b3 are bias coefficients, and ReLU is an activation function.

[0131] The method of the embodiment of the present invention is implemented relying on an electronic device. Therefore, it is necessary to introduce the relevant electronic device. For this purpose, the embodiment of the present invention provides an electronic device, as Figure 3 shown, the electronic device includes: at least one processor, a communication interface, at least one memory, and a communication bus. Among them, at least one processor, the communication interface, and at least one memory complete mutual communication through the communication bus. The at least one processor can call the logical instructions in the at least one memory to execute all or part of the steps of the methods provided in the foregoing method embodiments.

[0132] In addition, when the logical instructions in the foregoing at least one memory are implemented in the form of a software functional unit and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the method embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.

[0133] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative labor.

[0134] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0135] The flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of systems, methods, and computer program products according to multiple embodiments of the present invention. Based on this understanding, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and sometimes in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0136] It should be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, the elements defined by the statement "including..." do not exclude the existence of additional identical elements in the process, method, article or device including the said elements.

[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A traffic flow prediction method based on local-global spatio-temporal feature fusion, characterized in that, Including: Step 1: Construct a dataset, collect the real vehicle speed information passing on the highway, and construct a traffic flow dataset; and construct an adjacency matrix according to the traffic road network topology map; And construct an adjacency matrix according to the traffic road network topology map; Step 2: Construct a graph attention network layer, and extract the non-local spatial dependence features between different nodes in the traffic network topology map according to the attention weights learned by the network; Step 3: Construct a graph convolutional network layer, and extract the local spatial dependence features aggregated by each node in the traffic network topology map and its surrounding nodes; Step 4: Construct a gated recurrent neural network layer to fit the sequential duration correlation of traffic flow information; Step 5: Construct a Transformer network layer for parallel processing of traffic sequence information, capturing the long-term dependence of the Transformer network layer, and predicting future traffic flow; Step 2 specifically includes: Step 2.1: Map the feature vector to another vector space and calculate the feature correlation coefficient between each node: ; Among them, is the eigenvector of the node , is the connection of node attributes, is a weight parameter vector, LeakyReLU is a non-linear activation function, and W is the weight parameter mapping vector of the eigenvector; Step 2.2: Use the softmax activation function for normalization processing to calculate the correlation weights between each node: ; Step 2.3: Multiply the correlation weights between nodes by the feature matrix to obtain an updated feature matrix, and use the multi-head form to fit in different subspaces: ; Among them, is the eigenvector of the node calculating the relevant weight, K is the number of attention heads, is the weight parameter coefficient in the k-th attention head, and is the sigmoid activation function; after connecting the expressions of each attention head in different subspaces, the output is fused: ; among them, is the weight parameter matrix, and ; perform residual connection: ; Step 5 is specifically as follows: Step 5.1: Construct a transformer layer. First, add a positional encoding information matrix to each position of the feature vector: where: ; Among them, H is the final output result of the gated recurrent neural network layer, r is the node position of the feature matrix, is the dimension size of the feature matrix mapped to the multi-head attention space, i is the position of the node attribute in the time series, sin and cos are trigonometric functions; Step 5.2: Map to the multi-head self-attention layer: ; ; Among them, , , , is the weight parameter matrix, S is the number of heads in the multi-head self-attention, is the connection between the multi-heads, is the feature dimension in each subspace; Regularized residual connection: ; Where LayerNrom is a layer feature normalization function; Step 5.3: Regularize the residual connection again after passing through the feed-forward network layer, and input the fully connected prediction layer to obtain the final prediction result: ; ; ; Among them, , , is the parameter weight matrix, , , is the bias coefficient, and ReLU is the activation function.

2. The traffic flow prediction method based on local-global spatio-temporal feature fusion according to claim 1, wherein Step 1 includes: Step 1.1: Collect speed information of passing vehicles by sensors and construct a traffic flow feature matrix , where N is the number of nodes and P is the number of node attribute features; Step 1.2: Construct the traffic road network topology into a graph G=(V,E,A), where V is the road node and E is the graph node and the edge connected to is the adjacency matrix. Each element in A is 0 or 1, indicating whether node is adjacent to node . The calculation of the adjacency matrix includes: , where i,j = 1,…,N.

3. The traffic flow prediction method based on local-global spatio-temporal feature fusion according to claim 1, wherein Step 3 specifically is: Step 3.1: Laplacian matrix of the graph: , where is the identity matrix; find the degree matrix: ; Calculate the symmetric normalized Laplacian matrix: ; Step 3.2: Construct a one-layer graph convolutional neural network: ; Among them, is the weight parameter matrix, is the sigmoid activation function.

4. The traffic flow prediction method based on local-global spatio-temporal feature fusion according to claim 3, wherein Specifically, Step 4 is: Step 4.1: Construct a gated recurrent neural network, and the specific formula includes: ; ; ; ; wherein, is the update gate state at time t, is the reset gate state at time t, is the candidate hidden layer state at time t, , , is the weight parameter matrix, , , is the bias coefficient, is the matrix connection, is the output at time t - 1, tanh is the activation function, is the sigmoid activation function.

5. A traffic flow prediction device based on local-global spatio-temporal feature fusion, the traffic flow prediction device based on local-global spatio-temporal feature fusion is used to implement the traffic flow prediction method based on local-global spatio-temporal feature fusion described in claim 1, and is characterized in that, Including: The first main module is used to implement Step 1: Construct a dataset, collect the real vehicle speed information passing on the highway, and construct a traffic flow dataset; and construct an adjacency matrix according to the traffic road network topology map; The second main module is used to implement Step 2: Construct a graph attention network layer, and extract the non-local spatial dependence features between different nodes in the traffic network topology map according to the attention weights learned by the network; The third main module is used to implement Step 3: Construct a graph convolutional network layer, and extract the local spatial dependence features aggregated by each node in the traffic network topology map and its surrounding nodes; The fourth main module is used to implement Step 4: Construct a gated recurrent neural network layer to fit the sequential duration correlation of traffic flow information; Step 5: Construct a Transformer network layer for parallel processing of traffic sequence information, capturing the long-term dependence of the Transformer network layer, and predicting future traffic flow.

6. An electronic device, characterized in that, Including: At least one processor, at least one memory, and a communication interface; where The processor, memory, and communication interface communicate with each other; The memory stores program instructions executable by the processor, and the processor invokes the program instructions to execute the method according to any one of claims 1 to 4.

7. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions cause the computer to execute the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Regional flow prediction-oriented spatio-temporal global semantic representation learning method

    CN114493034A

  • Traffic flow prediction method based on space-time fusion graph neural network

    CN114970825A