A traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph

Through the dynamic spatiotemporal interlaced graph construction method, the problem of dynamic spatiotemporal dependence modeling in traffic flow prediction is solved, more efficient and accurate traffic flow prediction is achieved, and the performance of intelligent traffic system is improved.

CN116524734BActive Publication Date: 2025-07-11ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310412465.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-18
Publication Date
2025-07-11
Estimated Expiration
2043-04-18

AI Technical Summary

Technical Problem

Existing traffic flow prediction methods cannot effectively model the dynamic space-time interlaced dependence in traffic road networks, resulting in insufficient prediction accuracy, especially in complex spatial and temporal-dependent changing environments.

Method used

The traffic flow prediction device constructed based on dynamic spatiotemporal interleaving graph is adopted. By introducing dynamic spatiotemporal interleaving graphs, combining attention filters, dynamic spatiotemporal interleaving graphs, time connection graphs and graph convolution networks, dynamic spatiotemporal interleaving graphs and time dependencies between sensors and themselves, and using FFT fast Fourier transform to filter related time steps, reduce the computational complexity, and build dynamic spatiotemporal interleaving graphs to capture dynamic dependencies.

Benefits of technology

It improves the accuracy and efficiency of traffic flow forecasting, can better alleviate traffic congestion, improve the safety and efficiency of intelligent traffic systems, and provide citizens with reliable commuting advice.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116524734B_ABST
    Figure CN116524734B_ABST
Patent Text Reader

Abstract

The present invention discloses a traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph, belonging to the field of intelligent transportation systems. It includes, on the basis of obtaining training samples, standardized samples and merged samples, through an attention screening operation, constructing spatial and temporal dependence operations, and obtaining the graph convolution features at time step t through a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, a feature fusion module and a temporal feature extraction module. According to the temporal feature H t Predict the traffic flow prediction data for the next H time steps, improving the prediction efficiency and accuracy, helping to alleviate traffic congestion, and providing reliable traffic planning suggestions for daily commuting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent transportation systems, and particularly to a traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph. Background Art

[0002] Traffic flow prediction is a key technology in intelligent transportation systems and an indispensable part of the development of smart cities. Accurate traffic flow prediction can help efficiently dispatch traffic resources, relieve traffic congestion, provide public safety warnings, and give reliable suggestions for citizens' daily commuting. Therefore, traffic flow prediction has become a research hotspot in academia and industry and has extensive practical applications.

[0003] Traffic flow prediction faces complex spatial and temporal dependencies, so its accuracy poses great challenges. Spatial dependency is manifested in that the traffic flow data collected by traffic flow sensors is affected by the nearby traffic conditions; temporal dependency is manifested in that the current traffic flow data is affected by historical traffic flow data. In addition, the spatial and temporal dependencies in real intelligent transportation systems are usually coupled with each other and change over time.

[0004] In the past few decades, researchers have proposed many traffic flow prediction methods, including methods based on shallow machine learning and methods based on recurrent neural networks and convolutional neural networks. In the past few decades, researchers have proposed many traffic flow prediction methods. These methods include methods based on shallow machine learning and methods based on recurrent neural networks (RNNs) and convolutional neural networks (CNNs). Although these methods make it possible to establish time dependencies and grid-based spatial dependencies, they cannot capture the non-Euclidean spatial dependencies based on irregular traffic road networks in reality. To solve this problem, existing work has introduced graph neural networks (GNNs), representing traffic flow sensors on traffic road networks as nodes and representing the spatial dependencies between traffic flow sensors as edges. Recently, researchers have integrated GNNs with RNNs, CNNs, and Attentions to capture spatial and temporal dependencies. Such neural networks are called spatio-temporal graph neural networks (Spatial Temporal Graph Neural, STGNNs) and have shown state-of-the-art performance in traffic prediction.

[0005] Existing STGNNs often use the distance between traffic flow sensors, the similarity of the distribution of Points of Interest (POIs) near traffic flow sensors, the similarity of the static learnable embedding representations of traffic flow sensors, etc. to construct static spatial graphs, ignoring the fact that the spatial dependencies in the traffic road network change over time. In addition, some models attempt to model dynamic spatial dependencies, such as using dynamic covariates to adjust the static graph or directly constructing a dynamic graph structure using attention mechanisms. These models often only focus on the modeling of spatial dependencies and ignore the dependencies across spatial and temporal dimensions.

[0006] Recent related research has proposed methods for modeling spatio-temporal interleaved dependencies by representing dependencies across spatial and temporal dimensions with composite graphs. Among them, a spatio-temporal synchronous graph is constructed through a distance graph and a time connection graph, and a spatio-temporal composite graph is constructed through a distance graph, a time similarity graph, and a time connection graph. However, these methods rely on static distance graphs, time connection graphs, and time similarity graphs and cannot model dynamic spatio-temporal interleaved dependencies. Summary of the Invention

[0007] In view of the above, the object of the present invention is to provide a traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph. By introducing a dynamic spatio-temporal interleaved graph, spatial dependencies and temporal dependencies between sensors and within sensors themselves are established, thereby improving the prediction accuracy.

[0008] To achieve the above object of the invention, the present invention provides a traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph, including a memory and a processor. The memory is used to store a computer-executable program for performing traffic flow prediction based on the construction of a dynamic spatio-temporal interleaved graph. The processor is communicatively connected to the memory and is configured to execute the computer-executable program stored in the memory. When the processor executes the computer-executable program, the following steps are implemented:

[0009] Divide the traffic flow data into a training set, randomly select a batch from the training set as training samples for time series normalization operations, and merge the normalized samples with the training samples to obtain merged samples;

[0010] Construct a traffic flow prediction model, including an attention screening module, a dynamic spatial graph construction module, a dynamic time connection graph construction module, a dynamic spatio-temporal interleaved graph construction module, a graph convolution module, a time series feature extraction module, and a traffic flow prediction module. Among them, the attention screening module is used to screen the merged samples to obtain the relevant time step weights W sel and the corresponding relevant traffic flow data X sel ; the dynamic spatial graph construction module is used to generate node embedding representations E N and the time embedding representation of time step t Fuse to obtain E t Use E t to construct the spatial graph at time step t The dynamic time connection graph construction module is used to multiply the diagonal matrix obtained based on the spatial graph and the relevant time step weights at time step t to construct multiple time connection graphs at time step t The dynamic spatio-temporal interleaved graph construction module is used to combine the spatial graph with multiple time connection graphs to obtain the spatio-temporal interleaved graph at time step t The graph convolution module includes a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, and a feature fusion module. Among them, the spatial graph convolution module is used to perform a convolution operation on the traffic flow data X at time step t t and the spatial graph at time step t to obtain the spatial features at time step t The spatio-temporal interleaved graph convolution module is used to perform a convolution operation on the traffic flow data related to time step t and the spatio-temporal interleaved graph at time step t to obtain the spatio-temporal interleaved features at time step t The feature fusion module is used to merge the spatio-temporal interleaved features at time step t and the spatial features at time step t to obtain the graph convolution features The time series feature extraction module is used to fuse the graph convolution features at time step t with the graph convolution features of past time steps to extract the time features H at time step t t ; The traffic flow prediction module is used to predict the traffic flow prediction values for the next H time steps according to the time features H t

[0011] Send all traffic flow data training samples and combined samples into the traffic flow prediction model for training, and continuously optimize by updating the model parameters;

[0012] Use the traffic flow prediction model with optimized parameters to perform traffic flow prediction.

[0013] Preferably, the attention filter module includes an attention filter based on the FFT fast Fourier transform algorithm with time series normalization. The attention filter is used to filter the combined samples to obtain the traffic flow data X sel , and the specific process includes:

[0014] Perform a linear transformation on the combined samples to obtain the query vector Q and the key tensor K

[0015] ​

[0016] Among them, the query vector Q and the key tensor K belong to denote the combined samples, Linear() is a linear transformation, d h denotes the number of dimensions of the hidden representation obtained after the linear transformation;

[0017] Map Q and K to the Fourier space using FFT, and then map the result calculated in the Fourier space back to the original space through the inverse Fourier transform, so as to obtain an FFT-based attention matrix M agg , M agg each element in The calculation process is as follows:

[0018]

[0019] Among them, denotes FFT, denotes the inverse Fourier transform, denotes the conjugate operation, ⊙ denotes the Hadamard product, Q i denotes the i-th query vector, K j denotes the j-th key vector, and respectively denote Q i and K j the values obtained after the FFT transformation, dF denotes the number of dimensions of the hidden representation in the Fourier space, is the attention matrix calculated for Q i and K j Take the average of M ij in the node dimension and the feature dimension to obtain an attention value representing the correlation between Q i and K j

[0020] FFT-based attention matrix Filter τ relevant time steps for each time step, and the corresponding filtered indices and weights obtained based on the τ relevant time steps are and Obtain the relevant traffic flow data according to the index Expressed by the formula as:

[0021] I sel ,W sel =Topτ(M agg ).

[0022] Preferably, the dynamic spatial graph construction module is used to embed the nodes E N and the time embedding representation at time step t​ Fusion, specifically:

[0023]

[0024] Among them, the time embedding is represented as The node embedding is represented as It means adding to each row in E N to obtain the node embedding representation E t at time step t;

[0025] Use E t to construct the spatial graph at time step t Specifically:

[0026]

[0027] Among them, softmax() is a normalization function used to normalize the node embedding representation E t at time step t to obtain the spatial dependence between each node at time step t

[0028] Preferably, the dynamic time connection graph construction module is used to multiply a diagonal matrix obtained from the values on the diagonal of the spatial graph and the relevant time step weights at time step t to construct multiple time connection graphs at time step t Specifically:

[0029] Take the values on the diagonal to obtain the diagonal matrix Multiply it by each relevant time step weight at time step t to construct multiple time connection graphs at time step t. For the construction of each time connection graph:

[0030]

[0031] Among them, represents the i-th time connection graph. There are τ time connection graphs at time step t, denoted as t1, t2,..., t τ are the indices corresponding to τ time steps related to time step t, used to model the time dependence of each node on its own node at time step t and τ related time steps.

[0032] Preferably, the dynamic spatio-temporal interleaved graph construction module is used to combine the spatial graph with multiple time connection graphs Combine them to obtain the spatio-temporal interleaved graph at time step t to model the spatial and temporal dependencies of each node at time step t;

[0033] Place the spatial graph at time step t on the diagonal of the spatio-temporal interleaved graph, and place multiple temporal connection graphs at time step t in the upper triangular part of the spatio-temporal interleaved graph according to the rule that the one with a larger time step index is placed on the right and the one with a smaller index is placed on the left, to model the directed temporal dependencies. Add the spatial graph and the temporal connection graphs on the diagonal to fuse the spatial and temporal dependencies. Specifically:

[0034]

[0035] Among them, is the spatio-temporal interleaved graph at time step t, and t1 < t2 <... < t τ .

[0036] Preferably, the graph convolution module includes a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, and a feature fusion module. Among them, the spatio-temporal interleaved graph convolution module is used to perform a convolution operation on the traffic flow data X sel related to time step t and the spatio-temporal interleaved graph at time step t to obtain the spatio-temporal interleaved feature at time step t Specifically: Use the node embedding representation E t at time step t to generate the graph convolution parameters corresponding to time step t,

[0037]

[0038]

[0039] Among them, is the kernel function for generating the spatio-temporal interleaved graph convolution weight, is the kernel function for generating the spatio-temporal interleaved graph bias, d i and d o are the input and output dimensions of the spatio-temporal interleaved graph convolution. The spatio-temporal interleaved graph convolution based on the message passing theory:

[0040]

[0041] Among them, is the input value of the spatio-temporal interleaved graph convolution. For the first layer of graph convolution, is is the identity matrix, is the spatio-temporal interleaved feature at time step t;

[0042] The spatial graph convolution module is used to process the traffic flow data X at time step t t and the spatial graph at time step t to perform a convolution operation to obtain the spatial features at time step t Specifically: Use the node embedding representation E at time step t t to generate the graph convolution parameters corresponding to time step t,

[0043]

[0044]

[0045] Among them, is the kernel function for generating the spatio-temporal interleaved graph convolution weights, is the kernel function for generating the spatio-temporal interleaved graph bias, d i and d o are the input and output dimensions of the spatial graph convolution. Spatio-temporal graph convolution based on the message passing theory:

[0046]

[0047] Among them, is the input value of the spatio-temporal interleaved graph convolution. For the first layer of graph convolution, is is the identity matrix, is the spatio-temporal feature at time step t;

[0048] The feature fusion module is used to merge the spatio-temporal interleaved features at time step t and the spatial features at time step t to obtain the graph convolution features Adopt the recurrent neural network GRU to merge the spatio-temporal interleaved features at time step t and the spatial features and input the merged features into GRU. Specifically:

[0049]

[0050] Among them, AvgPooling() is the average pooling operation, which performs average pooling on the spatio-temporal interleaved features at time step t to reduce the number of feature scales for easy calculation. The dimension of the features after average pooling is the same as that of . After merging and , perform the Linear() linear transformation operation to obtain the graph convolution features that fuse the spatio-temporal interleaved features and spatial features at time step t

[0051] Preferably, the timing feature extraction module uses a gated recurrent unit (GRU), a type of recurrent neural network, to input the graph convolution features into a two-layer GRU network. Based on the time dependencies in the traffic flow data, it extracts temporal features

[0052] Preferably, after the traffic flow prediction module extracts the temporal features, spatial features, and spatio-temporal features from the traffic flow data of T time steps, it takes the hidden representation of the last time step and inputs it into a single-layer convolutional neural network to obtain the traffic flow prediction values for the next H time steps.

[0053] Preferably, during training, the mean absolute error (MAE) function is used to calculate the error between the predicted true values and the predicted values output by the actual model, and the model parameters are updated continuously for optimization.

[0054] To achieve the above invention objectives, the present invention also provides a traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph, which is characterized by including a data acquisition unit, a model construction unit, a training unit, and an application unit.

[0055] The data acquisition unit is used to divide the traffic flow data into a training set, randomly select a batch from the training set as training samples for time series standardization operations, and merge the standardized samples with the training samples to obtain merged samples.

[0056] The model construction unit is used to

[0057] construct a traffic flow prediction model, including an attention screening module, a dynamic spatial graph construction module, a dynamic time connection graph construction module, a dynamic spatio-temporal interleaved graph construction module, a graph convolution module, a timing feature extraction module, and a traffic flow prediction module. Among them, the attention screening module is used to screen the merged samples to obtain the relevant time step weights W sel and the corresponding relevant traffic flow data X sel ; the dynamic spatial graph construction module is used to fuse the node embedding representation E N and the time embedding representation of time step t to obtain E t , and use E t to construct the spatial graph of time step t The dynamic time connection graph construction module is used to multiply the diagonal matrix obtained based on the spatial graph and the relevant time step weights of time step t to construct multiple time connection graphs of time step t The dynamic spatio-temporal interleaved graph construction module is used to combine the spatial graph with multiple time connection graphs to obtain the spatio-temporal interleaved graph of time step t The graph convolution module includes a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, and a feature fusion module. Among them, the spatial graph convolution module is used to perform a convolution operation on the traffic flow data X at time step t t and the spatial graph at time step t to obtain the spatial features at time step t The spatio-temporal interleaved graph convolution module is used to perform a convolution operation on the traffic flow data related to time step t and the spatio-temporal interleaved graph at time step t to obtain the spatio-temporal interleaved features at time step t The feature fusion module is used to merge the spatio-temporal interleaved features at time step t and the spatial features at time step t to obtain the graph convolution features The temporal feature extraction module is used to fuse the graph convolution features at time step t with the graph convolution features of past time steps to extract the temporal feature H at time step t t ; The traffic flow prediction module is used to predict the traffic flow prediction values for the next H time steps according to the temporal feature H t

[0058] The training unit is used to send all traffic flow data training samples and combined samples into the traffic flow prediction model for training, and continuously optimize by updating the model parameters;

[0059] The application unit is used to perform traffic flow prediction using the traffic flow prediction model with optimized parameters.

[0060] Compared with the prior art, the technical effects of the present invention at least include:

[0061] The present invention introduces an attention filter of FFT. According to the traffic flow data of each time step, relevant time steps are screened for each time step, thereby restricting the number of relevant time steps to reduce the computational complexity; the concept of a spatio-temporal combined graph is introduced, and the combined graph is used to represent the dependencies across spatial and temporal dimensions. A dynamic spatio-temporal interleaved graph construction module is introduced. In a data-driven manner, a dynamic spatial graph and a dynamic time connection graph are constructed, and the two are combined to construct a dynamic spatio-temporal interleaved graph, which is used to simultaneously model the dynamic spatial dependencies between various sensors and the dynamic temporal dependencies of each sensor itself, effectively solving the problem of modeling dynamic spatio-temporal interleaved dependencies. Compared with traditional prediction methods, the dynamic spatio-temporal interleaved graph can predict traffic flow more accurately and efficiently, improve the efficiency and safety of the intelligent transportation system, alleviate traffic congestion, and provide reliable suggestions for citizens' daily commuting. At the same time, this technology also has a certain promoting effect on the development of graph neural networks. Description of the Drawings ​

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

[0063] Figure 1 It is a flowchart of a traffic flow prediction method based on the construction of a dynamic spatio-temporal interleaved graph provided by an embodiment of the present invention;

[0064] Figure 2 It is a general training flowchart of a traffic flow prediction model based on the construction of a dynamic spatio-temporal interleaved graph provided by an embodiment of the present invention;

[0065] Figure 3 It is a structural diagram of a traffic flow prediction model based on the construction of a dynamic spatio-temporal interleaved graph provided by an embodiment of the present invention;

[0066] Figure 4 It is a structural diagram of a time-series standardized FFT-based attention filter in a traffic flow prediction model based on the construction of a dynamic spatio-temporal interleaved graph provided by an embodiment of the present invention;

[0067] Figure 5 It is a structural diagram of a traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph provided by an embodiment of the present invention. Specific embodiments

[0068] To make the purpose, technical solutions and advantages of the present invention clearer, the following will further elaborate on the present invention in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention and do not limit the protection scope of the present invention.

[0069] To solve the problems in the prior art, the embodiment provides a traffic flow prediction method and device based on the construction of a dynamic spatio-temporal interleaved graph.

[0070] As Figure 1 shown, a traffic flow prediction method based on the construction of a dynamic spatio-temporal interleaved graph provided by the embodiment includes the following steps:

[0071] S110, divide the traffic flow data into a training set, randomly select a batch from the training set as training samples for time-series standardization operations, and merge the standardized samples with the training samples to obtain merged samples.

[0072] In the embodiment, outlier elimination processing and standardization processing are performed on the given traffic flow data, and the processed data is divided using a sliding window to obtain a training set.

[0073] Remove the outliers and invalid values (such as values outside the normal range) in the given traffic flow, and perform z-score standardization on the processed traffic flow. Specifically:

[0074]

[0075] Among them, X i,raw is the original traffic flow data of the i-th node, μ i,raw is the average value in the original traffic flow data of the i-th node, σ i,raw is the variance in the original traffic flow data of the i-th node, X i is the traffic flow data of the i-th node after standardization.

[0076] According to experience, manually set the time window size T, and use a fixed-length sliding step to divide the standardized data to obtain a training set.

[0077] In the embodiment, as Figure 2 shown, batch the training set according to a fixed batch size, and randomly select a batch of training samples from the training set, where the data of each sample includes the traffic flow X 1:T of N nodes at T time steps on the traffic network.

[0078] In the embodiment, perform time series standardization on each batch of training samples, and merge the standardized samples with the original training samples in the feature dimension.

[0079] Use time series standardization to process the batch training samples to extract the high-frequency components in the traffic flow data Specifically:

[0080]

[0081] Among them, μ batch and σ batch are respectively the mean and variance of a batch of samples, γ high and β high are learnable parameters used to estimate μ batch and σ batch , ∈ is a very small value, is the sample of time series standardization. Contains the high-frequency components of N nodes at T time steps, and merge it with the original input X 1:T in the feature dimension to obtain the traffic flow data after expanding the time series features Specifically:

[0082]

[0083] That is the merged sample.

[0084] S120, construct a traffic flow prediction model, including an attention screening module, a random initialization module, a dynamic spatial graph construction module, a dynamic temporal connection graph construction module, a combination module, a graph convolution module, a spatio-temporal interleaved graph convolution module, a feature fusion extraction module, and a traffic flow prediction module.

[0085] In the embodiment, the overall training process is as Figure 2 shown. Input the merged sample into the FFT-based attention screening filter to screen the most relevant τ time steps for each time step. The corresponding screening indices and weights are I sel and W sel , and obtain the relevant traffic flow data X sel .

[0086] In the embodiment, the structural diagram of the FFT-based attention screening filter is as Figure 4 shown. Input the merged sample into the FFT-based attention screening filter to obtain the screened traffic flow data X sel . The specific process includes:

[0087] Pass the merged sample through a linear transformation to obtain a query vector Q and a key tensor K.

[0088]

[0089] Among them, the query vector Q and the key tensor K belong to which represents the merged sample, Linear() is the linear transformation, and d h is the dimension number of the hidden representation obtained after the linear transformation.

[0090] Map Q and K to the Fourier space using FFT, and then map the result calculated in the Fourier space back to the original space through the inverse Fourier transform to obtain an FFT-based attention matrix M agg , and each element agg in M is calculated as follows:

[0091]

[0092] Among them, represents FFT, represents the inverse Fourier transform, represents the conjugate operation, ⊙ represents the Hadamard product, Q i represents the i-th query vector, K j represents the j-th key vector, and respectively represent Qi and K j The value obtained after FFT transformation, d F is the number of dimensions of the hidden representation in the Fourier space, is Q i and K j The calculated attention matrix, M ij Take the average in the node dimension and the feature dimension to obtain an attention value representing the correlation between Q i and K j between

[0093] Attention matrix based on FFT Screen τ relevant time steps for each time step, and the corresponding screening indices and weights obtained based on the τ relevant time steps are and Obtain the relevant traffic flow data according to the index Expressed by the formula:

[0094] I sel , W sel = Topτ(M agg ).

[0095] As Figure 3 shown, the dynamic spatial graph construction module is used to fuse the node embedding E N and the time embedding representation at time step t Specifically:

[0096]

[0097] Among them, the time embedding representation is The node embedding representation is Indicates adding to each row in E N to obtain the node embedding representation E at time step t t ;

[0098] Use E t to construct the spatial graph at time step t Specifically:

[0099]

[0100] Among them, softmax() is a normalization function used to normalize the node embedding representation E at time step t t to obtain the spatial dependence between each node at time step t

[0101] As Figure 3As shown, the dynamic time connection graph construction module is used to construct a diagonal matrix based on the values on the diagonal of the spatial graph and the relevant time step weights at time step t to multiply and construct multiple time connection graphs at time t Specifically:

[0102] Take the values on the diagonal to obtain a diagonal matrix Multiply it with each relevant time step weight at time step t to construct multiple time connection graphs at time step t. For the construction of each time connection graph:

[0103]

[0104] Among them, represents the i-th time connection graph. There are τ time connection graphs at time step t, denoted as t1, t2,..., t τ are the indices corresponding to τ time steps related to time step t, used to model the time dependence of each node on its own node at time step t and τ related time steps.

[0105] Such as Figure 3 shown, the dynamic spatio-temporal interleaved graph construction module is used to combine the spatial graph with multiple time connection graphs to obtain the spatio-temporal interleaved graph at time step t used to model the spatial and time dependencies of each node at time step t;

[0106] Place the spatial graph at time step t on the diagonal of the spatio-temporal interleaved graph. Place the multiple time connection graphs at time step t on the upper triangular part of the spatio-temporal interleaved graph according to the rule that the one with a larger time step index is placed on the right and the one with a smaller index is placed on the left to model the directed time dependence. Add the spatial graph and the time connection graph on the diagonal to fuse the spatial and time dependencies. Specifically:

[0107]

[0108] Among them, is the spatio-temporal interleaved graph at time step t, and t1 < t2 <... < t τ .

[0109] Such as Figure 3 shown, the graph convolution module includes a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, and a feature fusion module. Among them, the spatio-temporal interleaved graph convolution module is used to process the traffic flow data X related to time step tsel Space-time interleaved graph at time step t Perform a convolution operation to obtain the space-time interleaved features at time step t Specifically: Use the node embedding representation E at time step t t To generate the graph convolution parameters corresponding to time step t

[0110]

[0111]

[0112] Among them Is the kernel function for generating the space-time interleaved graph convolution weights Is the kernel function for generating the space-time interleaved graph bias, d i And d o Are the input and output dimensions of the space-time interleaved graph convolution. Space-time interleaved graph convolution based on message passing theory

[0113]

[0114] Among them Is the input value of the space-time interleaved graph convolution. For the first layer of graph convolution Is Is the identity matrix Is the space-time interleaved feature at time step t

[0115] The spatial graph convolution module is used to process the traffic flow data X at time step t t And the spatial graph at time step t Perform a convolution operation to obtain the spatial features at time step t Specifically: Use the node embedding representation E at time step t t To generate the graph convolution parameters corresponding to time step t

[0116]

[0117]

[0118] Among them Is the kernel function for generating the space-time interleaved graph convolution weights Is the kernel function for generating the space-time interleaved graph bias, d i And d o Are the input and output dimensions of the spatial graph convolution. Spatial graph convolution based on message passing theory

[0119]

[0120] Among them is the input value of the spatio-temporal interleaved graph convolution. For the first layer of graph convolution, is the identity matrix, is the spatio-temporal feature at time step t;

[0121] The feature fusion module is used to combine the spatio-temporal interleaved features at time step t and the spatial features at time step t to obtain the graph convolution features Using the recurrent neural network GRU, the spatio-temporal interleaved features at time step t and the spatial features are combined, and the combined features are input into the GRU. Specifically:

[0122]

[0123] where AvgPooling() is the average pooling operation, which performs average pooling on the spatio-temporal interleaved features at time step t Average pooling is used to reduce the number of feature scales for easy calculation. The dimension of the features after average pooling is the same as that of After combining with a Linear() linear transformation operation is performed to obtain the graph convolution features that fuse the spatio-temporal interleaved features and spatial features at time step t

[0124] As Figure 3 shown, the time series feature extraction module uses the recurrent neural network GRU to input the graph convolution features into a two-layer GRU network, and extracts time features

[0125] As Figure 2 shown, for time steps t = 1, 2,..., T, the operation steps of constructing the dynamic spatial graph at time step t, constructing the dynamic time connection graph, constructing the dynamic spatio-temporal interleaved graph, spatio-temporal interleaved graph convolution operation to obtain the spatio-temporal interleaved features at time step t, spatial graph convolution operation to obtain the spatial features at time step t, and extraction of time features are iteratively executed.

[0126] As Figure 3 shown, after the traffic flow prediction module extracts the time features, spatial features, and spatio-temporal features from the traffic flow data of T time steps, it takes the hidden representation of the last time step and inputs it into a one-layer convolutional neural network to obtain the traffic flow prediction values for the future H time steps

[0127] S130. Send all traffic flow data training samples and combined samples into the traffic flow prediction model constructed by the dynamic spatio-temporal interleaved graph for training, and continuously optimize by updating the model parameters.

[0128] As Figure 2 shown, calculate the predicted true value X T+1:T:H corresponding to each training sample and the predicted value output by the actual model

[0129] In the embodiment, use the mean absolute error as the prediction loss That is, the predicted true value X T +1:T:H corresponding to the training sample and the predicted value output by the actual model. Specifically,

[0130]

[0131] Adjust the network parameters in the entire model according to the errors of all samples in the batch.

[0132] According to the prediction loss calculation formula, calculate the losses of all samples in the batch The formula is as follows.

[0133]

[0134] Where is the loss of the b-th sample in the batch, and B is the number of samples in each batch. According to the loss update the network parameters θ in the entire model. The formula is as follows:

[0135]

[0136] Where η is the learning rate.

[0137] As Figure 2 shown, repeat the time series normalization operation of the training samples until the losses of all samples in the batch are calculated until all batches have participated in the model training.

[0138] Repeat the time series normalization operation of the training samples until all batches have participated in the model training until the specified number of iterations is reached.

[0139] S140. Use the traffic flow prediction model with optimized parameters to predict the traffic flow.

[0140] In the embodiment, use the traffic flow prediction model with optimized parameters to predict the traffic flow. Output the traffic flow prediction result.

[0141] For the problems of complex data calculation and low prediction efficiency, an attention filter of FFT is introduced. According to the traffic flow data at each time step, relevant time steps are screened for each time step, thereby limiting the number of relevant time steps to reduce the computational complexity.

[0142] For the problem of dynamic spatio-temporal interleaved dependence modeling, the concept of a spatio-temporal combined graph is introduced. The combined graph is used to represent the dependence across spatial and temporal dimensions. A dynamic spatio-temporal interleaved graph construction module is introduced. In a data-driven manner, a dynamic spatial graph and a dynamic time connection graph are constructed, and the two are combined to construct a dynamic spatio-temporal interleaved graph, which is used to simultaneously model the dynamic spatial dependence between various sensors and the dynamic temporal dependence of each sensor itself, effectively solving the problem of dynamic spatio-temporal interleaved dependence modeling. Compared with traditional prediction methods, the dynamic spatio-temporal interleaved graph can predict traffic flow more accurately and efficiently, and can improve the efficiency and safety of intelligent transportation systems.

[0143] Based on the same inventive concept, the embodiment also provides a traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph, including a memory and a processor. The memory is used to store a computer program. When its processor executes the computer program, the steps of the traffic flow prediction method based on the construction of a dynamic spatio-temporal interleaved graph provided in the above embodiment are implemented, including the following steps:

[0144] S110, divide the traffic flow data into a training set, randomly select a batch from the training set as training samples for time series normalization operation, and merge the normalized samples with the training samples to obtain merged samples;

[0145] S120, construct a traffic flow prediction model, including an attention filter module, a dynamic spatial graph construction module, a dynamic time connection graph construction module, a dynamic spatio-temporal interleaved graph construction module, a graph convolution module, a time series feature extraction module, and a traffic flow prediction module;

[0146] S130, send all traffic flow data training samples and merged samples into the traffic flow prediction model constructed by the dynamic spatio-temporal interleaved graph for training, and continuously optimize by updating model parameters;

[0147] S140, use the traffic flow prediction model with optimized parameters to predict traffic flow.

[0148] In the embodiment, the memory can be a volatile memory at the proximal end, such as RAM, or a non-volatile memory, such as ROM, FLASH, floppy disk, mechanical hard disk, etc., or a remote storage cloud. The processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), that is, the steps of the traffic flow prediction method based on the construction of the dynamic spatio-temporal interleaved graph can be implemented through these processors.

[0149] Based on the same inventive concept, the embodiment also provides a traffic flow prediction device 500 based on the construction of a dynamic spatio-temporal interleaved graph, including a data acquisition unit 510, a model construction unit 520, a training unit 530, and an application unit 540.

[0150] Among them, the data acquisition unit 510 is used to divide the traffic flow data into a training set, randomly select a batch from the training set as training samples for time series normalization operation, and merge the normalized samples with the training samples to obtain merged samples.

[0151] The model construction unit 520 is used to construct a traffic flow prediction model, including an attention screening module, a dynamic spatial graph construction module, a dynamic time connection graph construction module, a dynamic spatio-temporal interleaved graph construction module, a graph convolution module, a time series feature extraction module, and a traffic flow prediction module. Among them, the attention screening module is used to screen the merged samples to obtain the relevant time step weight W sel and the corresponding relevant traffic flow data X sel ; the dynamic spatial graph construction module is used to fuse the node embedding representation E N and the time embedding representation of time step t to obtain E t , and use E t to construct the spatial graph of time step t The dynamic time connection graph construction module is used to multiply the diagonal matrix obtained based on the spatial graph and the relevant time step weight of time step t to construct multiple time connection graphs of time step t The dynamic spatio-temporal interleaved graph construction module is used to combine the spatial graph with multiple time connection graphs to obtain the spatio-temporal interleaved graph of time step t The graph convolution module includes a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, and a feature fusion module. Among them, the spatial graph convolution module is used to perform a convolution operation on the traffic flow data X t of time step t and the spatial graph of time step t to obtain the spatial feature of time step t. The spatio-temporal interleaved graph convolution module is used to process the traffic flow data related to time step t and the spatio-temporal interleaved graph at time step t Perform a convolution operation to obtain the spatio-temporal interleaved features at time step t The feature fusion module is used to combine the spatio-temporal interleaved features at time step t and the spatial features at time step t to obtain graph convolution features The temporal feature extraction module is used to fuse the graph convolution features at time step t with the graph convolution features of past time steps to extract the temporal feature H at time step t t ; The traffic flow prediction module is used to predict the traffic flow prediction values for the next H time steps based on the temporal feature H t

[0152] The training unit 530 is used to send all traffic flow data training samples and combined samples into the traffic flow prediction model constructed by this dynamic spatio-temporal interleaved graph for training, and continuously optimize by updating the model parameters;

[0153] The application unit 540 is used to perform traffic flow prediction using the traffic flow prediction model with optimized parameters.

[0154] It should be noted that when the traffic flow prediction device based on the dynamic spatio-temporal interleaved graph provided in the above embodiment performs traffic flow prediction, the above examples should be given according to the division of the above functional units. The above functions can be allocated to different functional units according to needs, that is, the internal structure of the terminal or server is divided into different functional units to complete all or part of the functions described above. In addition, the traffic flow prediction device based on the dynamic spatio-temporal interleaved graph provided in the above embodiment and the embodiment of the traffic flow prediction method based on the dynamic spatio-temporal interleaved graph belong to the same concept. For the specific implementation process, please refer to the embodiment of the traffic flow prediction method based on the dynamic spatio-temporal interleaved graph, which will not be elaborated here.

[0155] The above specific embodiments have detailed the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not used to limit the present invention. Any modifications, supplements, equivalent replacements, etc. made within the scope of the principles of the present invention should be included in the protection scope of the present invention.​

Claims

1. A traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph, comprising a memory and a processor. The memory is used to store computer-executable programs for performing traffic flow prediction based on the construction of a dynamic spatio-temporal interleaved graph. The processor is communicatively connected to the memory and is configured to execute the computer-executable programs stored in the memory, and is characterized in that: When the processor executes the computer-executable programs, the following steps are implemented: Divide the traffic flow data into a training set, randomly select a batch from the training set as training samples for time series normalization operation, and merge the normalized samples with the training samples to obtain merged samples; Construct a traffic flow prediction model, including an attention screening module, a dynamic spatial graph construction module, a dynamic temporal connection graph construction module, a dynamic spatio-temporal interleaved graph construction module, a graph convolution module, a temporal feature extraction module, and a traffic flow prediction module. Among them, the attention screening module is used to screen the merged samples to obtain the relevant time step weights W sel and the corresponding relevant traffic flow data X sel ; The dynamic spatial graph construction module is used to fuse the node embedding representation E N and the temporal embedding representation at time step t to obtain E t , and use E t to construct the spatial graph at time step t The dynamic temporal connection graph construction module is used to multiply the diagonal matrix obtained based on the spatial graph and the relevant time step weights at time step t to construct multiple temporal connection graphs at time step t The dynamic spatio-temporal interleaved graph construction module is used to combine the spatial graph with multiple temporal connection graphs to obtain the spatio-temporal interleaved graph at time step t The graph convolution module includes a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, and a feature fusion module. Among them, the spatial graph convolution module is used to perform a convolution operation on the traffic flow data X at time step t t and the spatial graph at time step t to obtain the spatial features at time step t The spatio-temporal interleaved graph convolution module is used to perform a convolution operation on the traffic flow data related to time step t and the spatio-temporal interleaved graph at time step t to obtain the spatio-temporal interleaved features at time step t The feature fusion module is used to merge the spatio-temporal interleaved features at time step t and the spatial features at time step t to obtain the graph convolution features The temporal feature extraction module is used to fuse the graph convolution features at time step t with the graph convolution features of past time steps to extract the temporal features H at time step t t ; The traffic flow prediction module is used to predict the traffic flow prediction values for the next H time steps according to the temporal features H t ​ Send all traffic flow data training samples and merged samples into the traffic flow prediction model for training, and continuously optimize by updating the model parameters; Use the traffic flow prediction model with optimized parameters to predict the traffic flow.

2. The traffic flow prediction device constructed based on the dynamic spatio-temporal interleaved graph according to claim 1, characterized in that, The attention screening module includes an attention screening filter based on the FFT (Fast Fourier Transform) algorithm with temporal normalization. The attention screening filter is used to screen and merge samples to obtain traffic flow data X sel , and the specific process is as follows: Perform a linear transformation on the merged samples to obtain a query vector Q and a key tensor K, Among them, represents the combined samples, Linear() is a linear transformation, d h represents the number of dimensions of the hidden representation obtained after the linear transformation. The data of each sample contains the traffic flow X of N nodes at T time steps on the traffic network 1:T ; Map Q and K to the Fourier space using FFT, and then map the results calculated in the Fourier space back to the original space through the inverse Fourier transform to obtain an attention matrix M based on FFT agg , M agg Each element in The calculation process is as follows: Among them, represents FFT, represents the inverse Fourier transform, represents the conjugate operation, ⊙ represents the Hadamard product, Q i represents the i-th query vector, K j represents the j-th key vector, and respectively represent Q i and K j the values obtained after FFT transformation, M ij is the attention matrix calculated from Q i and K j Taking the average of M ij in the node dimension and the feature dimension, an attention value representing the correlation between Q i and K j is obtained Attention matrix M based on FFT agg , screen τ relevant time steps for each time step, and based on the τ relevant time steps, the corresponding screening indices and weights are I sel and W sel respectively. Obtain the relevant traffic flow data X according to the indices sel , which is expressed by the formula: I sel ,W sel = Topτ(M agg ).

3. The traffic flow prediction device constructed based on the dynamic spatio-temporal interleaved graph according to claim 2, wherein The dynamic spatial graph construction module is used to embed the nodes E N and the time embedding representation at time step t are fused, specifically as follows: Among them, the time embedding is represented as The node embedding is represented as E N , denotes adding to each row in E N to obtain the node embedding representation E t ; Take E t for constructing the spatial graph at time step t Specifically: Among them, softmax() is a normalization function used to normalize the node embedding representation E at time step t t to obtain the spatial dependence among nodes at time step t 4. The traffic flow prediction device constructed based on the dynamic spatio-temporal interleaved graph according to claim 3, wherein, The dynamic time connection graph construction module is used to multiply a diagonal matrix obtained from the values on the diagonal of the spatial graph by the relevant time step weights at time step t to construct multiple time connection graphs at time step t Specifically: Take the values on the diagonal to obtain a diagonal matrix and multiply it with each relevant time-step weight at time step t to construct multiple time connection graphs at time step t, where for the construction of each time connection graph: Among them, represents the i-th temporal connection graph. There are τ temporal connection graphs in time step t, denoted as t1, t2, …, t τ are the indices corresponding to τ time steps related to time step t, which are used to model the temporal dependencies of each node on its own node at time step t and τ related time steps.

5. The traffic flow prediction device constructed based on the dynamic spatio-temporal interleaved graph according to claim 4, wherein The dynamic spatio-temporal interleaved graph construction module is used to combine the spatial graph with multiple temporal connection graphs to obtain the spatio-temporal interleaved graph at time step t for modeling the spatial and temporal dependencies of each node at time step t; Place the spatial graph at time step t on the diagonal of the spatio-temporal interleaved graph, and place multiple temporal connection graphs at time step t in the upper triangular part of the spatio-temporal interleaved graph according to the rule that the one with a larger time step index is placed on the right and the one with a smaller index is placed on the left to model the directed temporal dependence. Add the spatial graph on the diagonal and the temporal connection graphs to perform the fusion of spatial and temporal dependencies. Specifically: Among them, is the spatio-temporal interleaved graph at time step t, and t1 < t2 < … < t τ .

6. The traffic flow prediction device constructed based on the dynamic spatio-temporal interleaved graph according to claim 5, characterized in that, The graph convolution module includes a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, and a feature fusion module. Among them, the spatio-temporal interleaved graph convolution module is used to perform convolution operations on the traffic flow data X related to time step t sel and the spatio-temporal interleaved graph at time step t to obtain the spatio-temporal interleaved features at time step t Specifically, the node embedding representation E at time step t t is used to generate the graph convolution parameters corresponding to time step t Among them, K C,weights is the kernel function for generating the spatio-temporal interleaved graph convolution weights, and K C,bais is the kernel function for generating the spatio-temporal interleaved graph bias. The spatio-temporal interleaved graph convolution based on the message passing theory: Among them, is the input value of the spatio-temporal interleaved graph convolution. For the first layer of graph convolution, is I is the identity matrix, is the spatio-temporal interleaved feature at time step t; The spatial graph convolution module is used to convolve the traffic flow data X at time step t t and the spatial graph at time step t to obtain the spatial features at time step t Specifically: use the node embedding representation E at time step t t to generate the graph convolution parameters corresponding to time step t Among them, K S,weights is the kernel function for generating the spatio-temporal interleaved graph convolution weights, and K S,bais is the kernel function for generating the spatio-temporal interleaved graph bias. Spatio-temporal graph convolution based on the message passing theory: Among them, is the input value of the spatio-temporal interleaved graph convolution. For the first layer of graph convolution, is I is the identity matrix, is the spatio-temporal feature at time step t; The feature fusion module is used to combine the spatio-temporal interleaved features at time step t and the spatial features at time step t to obtain graph convolution features Using a recurrent neural network GRU, the spatio-temporal interleaved features at time step t and the spatial features are combined, and the combined features are input into the GRU, specifically: Among them, AvgPooling() is an average pooling operation that interleaves spatio-temporal features at time step t Average pooling is used to reduce the number of feature scales for easier calculation. The dimension of the features after average pooling is the same as that of , and after combining with , a Linear() linear transformation operation is performed to obtain graph convolution features that fuse the spatio-temporal interleaved features and spatial features at time step t 7. The traffic flow prediction device constructed based on the dynamic spatio-temporal interleaved graph according to claim 6, wherein The timing feature extraction module uses a recurrent neural network GRU to convert the graph convolution features and input them into a two-layer GRU network. According to the time dependence in traffic flow data, time features H are extracted t .

8. The traffic flow prediction device constructed based on the dynamic spatio-temporal interleaved graph according to claim 1, characterized in that, After extracting the temporal features, spatial features, and spatio-temporal features from the traffic flow data of T time steps, the traffic flow prediction module takes the hidden representation of the last time step and inputs it into a convolutional neural network to obtain the traffic flow prediction values for the next H time steps.

9. The traffic flow prediction device constructed based on the dynamic spatio-temporal interleaved graph according to claim 1, characterized in that, During training, use the mean absolute error function MAE to calculate the error between the predicted true value and the predicted value output by the actual model, and update the model parameters to continuously optimize.

10. A traffic flow prediction device based on the construction of a dynamic spatio-temporal interleaved graph, characterized in that, It includes a data acquisition unit, a model construction unit, a training unit, and an application unit, The data acquisition unit is used to divide the traffic flow data into a training set, randomly select a batch from the training set as training samples for time series normalization operation, and merge the normalized samples with the training samples to obtain merged samples; The model construction unit is used to construct a traffic flow prediction model, including an attention screening module, a dynamic spatial graph construction module, a dynamic time connection graph construction module, a dynamic spatio-temporal interleaved graph construction module, a graph convolution module, a time series feature extraction module, and a traffic flow prediction module. Among them, the attention screening module is used to screen the combined samples to obtain the relevant time step weights W sel and the corresponding relevant traffic flow data X sel ; The dynamic spatial graph construction module is used to fuse the node embedding representation E N and the time embedding representation at time step t to obtain E t , and use E t to construct the spatial graph at time step t The dynamic time connection graph construction module is used to multiply the diagonal matrix obtained based on the spatial graph and the relevant time step weights at time step t to construct multiple time connection graphs at time step t The dynamic spatio-temporal interleaved graph construction module is used to combine the spatial graph with multiple time connection graphs to obtain the spatio-temporal interleaved graph at time step t The graph convolution module includes a spatial graph convolution module, a spatio-temporal interleaved graph convolution module, and a feature fusion module. Among them, the spatial graph convolution module is used to perform a convolution operation on the traffic flow data X at time step t t and the spatial graph at time step t to obtain the spatial features at time step t The spatio-temporal interleaved graph convolution module is used to perform a convolution operation on the traffic flow data related to time step t and the spatio-temporal interleaved graph at time step t to obtain the spatio-temporal interleaved features at time step t The feature fusion module is used to combine the spatio-temporal interleaved features at time step t and the spatial features at time step t to obtain the graph convolution features The time series feature extraction module is used to fuse the graph convolution features at time step t with the graph convolution features of past time steps to extract the time features H at time step t t ; The traffic flow prediction module is used to predict the traffic flow prediction values for the next H time steps according to the time features H t ​ The training unit is used to send all traffic flow data training samples and merged samples into the traffic flow prediction model for training, and continuously optimize by updating the model parameters; The application unit is used to use the traffic flow prediction model with optimized parameters to predict the traffic flow.

Citation Information

Patent Citations

  • Traffic flow prediction method and device based on dynamic space-time diagram convolution circulation network, and storage medium

    CN114220271A

  • Traffic flow prediction method based on Transform space-time diagram convolutional network

    CN114330671A