Traffic flow prediction method based on multivariate spatial-temporal feature extraction
By introducing a multivariate spatiotemporal feature extraction model (DSTF) into the traffic flow prediction model, using technical means such as the improved Res2Net module, spatial attention mechanism and dual-view Geom-GCN, the problem that existing models are difficult to capture traffic flow dynamics and multi-scale characteristics is solved, and more accurate traffic flow prediction is achieved.
Patent Information
- Application Number
- CN202411985073.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Existing traffic flow prediction models are difficult to effectively capture the dynamics, multi-scale time dependence and spatial-temporal correlation of traffic flow, resulting in insufficient prediction accuracy.
A traffic flow prediction method based on multi-space-time feature extraction is proposed. The multi-space-time feature extraction model (DSTF) is used to use the improved Res2Net module of gated convolution in the time dimension to capture the change mode of traffic flow with the time scale; in the spatial dimension, from a global and local perspective, the spatial attention mechanism and dual-view Geom-GCN are used to capture the global spatial correlation, geographical neighborhood spatial correlation and semantic similarity between nodes in the urban road network; in the time-space interaction dimension, the dynamic spatial-time synchronization aggregation module is used to construct a dynamic spatial-time synchronization aggregation module to capture the dynamic interaction relationship between nodes or regions under the time slice.
Through the DSTF model, multiple spatial and temporal characteristics can be effectively extracted to achieve more accurate traffic flow prediction in complex traffic scenarios, short-term and long-term predictions can be achieved simultaneously, and high prediction accuracy is shown in both time and space dimensions.
Smart Images

Figure CN119863929A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical fields of information technology, graph convolutional neural networks, residual networks and attention mechanisms, and specifically relates to a traffic flow prediction method based on multivariate spatiotemporal feature extraction. Background Art
[0002] Traffic flow prediction is the key basis for intelligent transportation systems (ITS) to manage traffic problems and an important driving force for achieving efficient and green urban transportation. As urban traffic problems become increasingly prominent, the importance of traffic flow prediction has increased significantly. The task of traffic flow prediction is to analyze historical traffic flow data, road network structure data, and other related information to predict traffic flow in future periods. By accurately predicting future traffic flow status, ITS and traffic management departments can monitor the future traffic conditions of the city, thereby optimizing traffic signal control, helping travelers choose reasonable travel routes, and reducing the occurrence of traffic accidents.
[0003] The current research on traffic flow prediction is becoming more and more in-depth. Existing research mainly includes traffic flow state analysis based on specific observation points on road sections and traffic flow state analysis based on urban areas or grid divisions. The latter flow usually includes inflow and outflow. The schematic diagrams of the two are respectively shown in the attached manual. Figure 7 (a) and Figure 7 (b). Prediction models are mainly divided into three categories: mathematical statistics models, traditional machine learning models, and deep neural networks.
[0004] The traffic prediction model based on mathematical statistics is simple in principle, but it often relies on linear assumptions and is difficult to fully consider the complex spatial characteristics of traffic flow, resulting in poor prediction accuracy. Traditional machine learning models such as the K-nearest neighbor (KNN) algorithm can learn the interaction relationship between traffic flows at different spatial nodes, but it cannot model the complex dynamic spatiotemporal characteristics of traffic flows. Recently, deep learning technology has become a powerful tool in the field of traffic flow prediction. Convolutional neural networks (CNNs) can effectively process grid data. In the early days, many researchers processed the road network into a grid topology, then used CNN to simulate the spatial interaction of traffic flow, and used recurrent neural networks (RNNs) and their variants to mine the temporal feature associations of traffic flow. However, due to the complexity of the traffic network, simplifying the traffic network into grid data may lead to the loss of spatial information, especially when the grid division is unreasonable. In addition, RNN performs well in capturing the short-term temporal dependencies of sequence data, but there are problems such as gradient vanishing and gradient explosion when processing long-term temporal dependencies, and the time overhead required for training is large. Graph structures can naturally represent complex traffic networks. By introducing graph structures, graph convolutional neural networks (GCNs) can capture the interactions between nodes in the road network using the adjacency relationships between nodes in the graph.
[0005] Many existing studies have extracted the spatiotemporal characteristics of traffic flow by integrating GCN with RNN, attention mechanism and other temporal models. However, GCN-based models lose the structural information of neighbor nodes, and these models usually design graph structures based on the road network adjacency matrix, ignoring the correlation between nodes with long distances but similar traffic flow patterns in the road network. Figure 8 As shown in (a) and (b), nodes A and F are two sensor nodes that are far apart in the road network, but they exhibit similar traffic flow patterns. In addition, it is crucial to extract the global dynamic spatial correlation of network nodes. Due to the complexity of the traffic network, changes in a node not only affect neighboring nodes, but may also affect distant nodes, and the dependencies between nodes may change dynamically due to time patterns and emergency situations.
[0006] In addition, in the time dimension, the existing models mainly focus on modeling time dependencies at a fixed time scale, but are not good at multi-scale modeling, making it difficult to learn the rich temporal patterns of traffic flow data. Traffic flow data has multi-scale characteristics, and traffic flow patterns at different time scales are different. Figure 8 As shown in (c), at the fine-grained time scale 1, the traffic flow curves of nodes B and C are in a stable state, while at the fine-grained time scale 2, the traffic flow curves of nodes B and C gradually rise from a stable state and are in the early morning peak period; at the coarse-grained time scale 3, the traffic flow curves of nodes B and C are in the morning peak period, which fully presents the changes in traffic flow during the morning peak period. The traffic flow gradually rises from a stable state to the morning flow peak and then begins to decline. The fine-grained time scale mainly focuses on the short-term fluctuations of traffic flow, while as the time scale increases, the mid-term and long-term trend changes of traffic flow can be captured, but the existing technical solutions are difficult to effectively utilize this information and characteristics. Summary of the invention
[0007] Therefore, in view of the defects and shortcomings of the prior art, as well as the room for improvement, the present invention proposes a traffic flow prediction method based on multivariate spatiotemporal feature extraction, which proposes a multivariate spatiotemporal feature extraction model (DSTF) for traffic flow prediction, which can effectively predict the future traffic flow state of the road. First, in the time dimension, DSTF uses the gated convolution improved Res2Net module to capture the traffic flow change pattern over time. Secondly, in the spatial dimension, the present invention uses the spatial attention mechanism and the dual-view Geom-GCN from the global and local perspectives to comprehensively capture the global spatial correlation, geographic neighborhood spatial correlation and semantic similarity spatial correlation between nodes in the urban road network. Third, in the time-space interaction dimension, the present invention uses spatiotemporal attention to construct a dynamic spatiotemporal synchronization aggregation module to capture the dynamic interaction relationship between nodes or regions across time slices. By accurately predicting the future traffic flow state of the road, the road transportation efficiency can be improved and the urban traffic conditions can be improved.
[0008] The technical solution specifically adopted by the present invention to solve the technical problem is:
[0009] A traffic flow prediction method based on multivariate spatiotemporal feature extraction: a multivariate spatiotemporal feature extraction model is adopted. In the time dimension, the Res2Net module improved by gated convolution is used to capture the traffic flow variation pattern with time scale; in the spatial dimension, from the global and local perspectives, the spatial attention mechanism and dual-view Geom-GCN are used respectively to capture the global spatial correlation, geographic neighborhood spatial correlation and semantic similarity spatial correlation between nodes in the urban road network; in the time-space interaction dimension, the dynamic spatiotemporal synchronization aggregation module constructed by spatiotemporal attention is used to capture the dynamic interaction relationship between nodes or regions across time slices to predict future road traffic flow.
[0010] Furthermore, the multivariate spatiotemporal feature extraction model includes: a data embedding layer, L stacked spatiotemporal feature extraction layers and an output layer; the data embedding layer is used to integrate traffic flow with time and space information to embed and represent traffic flow data; the spatiotemporal feature extraction layer is used to extract and fuse features, including a local-global spatial feature extraction module for capturing spatial features, a gated convolution improved Res2Net module for extracting multi-scale temporal features, a dynamic spatiotemporal synchronization aggregation module for modeling spatiotemporal correlation, and a spatiotemporal feature fusion module for splicing the extracted multiple spatiotemporal features and fusing them through two linear layers and a Relu activation function; the output layer is used to predict future traffic flow.
[0011] Furthermore, the data embedding layer introduces information including time position coding, time periodicity, and geographic space adjacency to embed and represent the traffic flow data.
[0012] Furthermore, after the data embedding layer, the tensor X emb ∈R N×T×d Segmentation is performed and divided into feature subsets X1∈R N×T×d1 and X2∈R N×T×d2 , d1+d2=d, and the feature subset X1∈R N×T×d1 Input local-global feature extraction module captures local and global spatial features in traffic flow data; feature subset X2∈R N×T×d2 The Res2Net module improved by input gated convolution extracts temporal features of different scales.
[0013] Furthermore, the local-global feature extraction module includes a local spatial feature extraction module and a dynamic global spatial feature extraction module; the local spatial feature extraction module is used to model the local spatial correlation of traffic flow using Geom-GCN under dual perspectives: based on the sensor adjacency matrix corresponding to the road network connectivity and the traffic data similarity, a geographic spatial graph structure and a semantic spatial graph structure are constructed; the latent spatial neighborhood is constructed using the Struc2vec and Node2vec embedding algorithms, and Geom-GCN is used for graph aggregation; the dynamic global spatial feature extraction module uses the spatial self-attention mechanism to dynamically assign weights to spatial information at different locations to capture global dynamic spatial correlation.
[0014] Furthermore, in the local space feature extraction module:
[0015] Geographic neighborhood spatial graph structure G G Sensor adjacency matrix construction;
[0016] Semantic similarity space graph structure G S By giving any two time series X = (x1, x2, x3, ..., x m ) and Y=(y1,y2,x3,...,y n ), the sequence lengths are m and n respectively, and the FastDTW algorithm is used to calculate the similarity between any two sensor node traffic flow sequences, thereby obtaining the similarity between the two sensor nodes; according to the calculation results of FastDTW, find the K sensor nodes top_k (v i ), thereby establishing the adjacency matrix A S ∈R N×N ;
[0017] The graph structure built based on geographic neighborhood uses the Struc2Vec algorithm as the node embedding algorithm, and the graph structure built based on semantic similarity uses the Node2vec algorithm as the node embedding algorithm.
[0018] The dynamic global spatial feature extraction module adopts a multi-head self-attention mechanism to capture global dynamic spatial correlation.
[0019] The output layer includes two 1×1 convolutional layers, which take the results obtained by the spatiotemporal feature extraction layer through the skip connection layer as input and convert them into the final prediction output.
[0020] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of a traffic flow prediction method based on multivariate spatiotemporal feature extraction as described above are implemented.
[0021] A non-transitory computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a traffic flow prediction method based on multivariate spatiotemporal feature extraction as described above.
[0022] Compared with the prior art, the present invention and its preferred embodiments have at least the following advantages:
[0023] The DSTF model effectively solves the problems of the dynamics of traffic flow data, multi-scale time dependence, and insufficient consideration of spatiotemporal correlation. It can effectively extract a variety of spatiotemporal features and achieve more accurate traffic flow prediction in complex traffic scenarios.
[0024] In the temporal dimension, DSTF successfully extracts the multi-scale temporal features of traffic flow and can achieve both short-term and long-term predictions. In the spatial dimension, DSTF effectively extracts local spatial dependencies and global dynamic spatial dependencies.
[0025] In terms of time-space correlation, by introducing the dynamic spatiotemporal synchronization aggregation module, DSTF can effectively utilize the dynamic relationships between traffic flows at different times and locations. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0027] Figure 1 The left figure is the visualization of the PEMS04 dataset, and the right figure is the visualization of the PEMS08 dataset.
[0028] Figure 2 This is a performance comparison chart of different models of the embodiments of the present invention for short-term and medium- to long-term predictions on the PEMS04 dataset.
[0029] Figure 3 This is a performance comparison chart of different models in embodiments of the present invention for short-term and medium- to long-term predictions on the PEMS08 dataset.
[0030] Figure 4 This is a diagram of the ablation experiment results performed on the PEMS04 dataset according to an embodiment of the present invention.
[0031] Figure 5 The figure is a comparison of the prediction performance of the DSTF model and the PDFormer model on the PEMS04 data set of the embodiment of the present invention, where (a) the flow of sparse nodes and (b) the flow of dense nodes. The black curve represents the actual traffic flow value. The light blue curve and the dark blue curve represent the prediction values obtained by the PDFormer model for the 5-minute and 60-minute prediction tasks, respectively. The red curve and the purple curve show the prediction values obtained by the DSTF model for the 5-minute and 60-minute prediction tasks, respectively.
[0032] Figure 6 This is a comparison chart of the traffic flow value predicted by the embodiment of the present invention and the actual traffic flow value. The black curve represents the actual traffic flow value, and the purple curve represents the predicted value.
[0033] Figure 7 Schematic diagrams of two existing methods for representing traffic flow, including (a) a schematic diagram of traffic flow at a specified observation point on a road section, and (b) a schematic diagram of traffic flow based on area or grid division. The arrows in Figure (a) represent the direction of vehicle flow detected by a specific sensor. In Figure (b), the entire area is divided into multiple grids, and the inflow and outflow traffic flows are calculated for each grid cell.
[0034] Figure 8 Schematic diagram of traffic flow characteristics, including (a) node location distribution diagram, (b) traffic flow curves of nodes A and F, and (c) traffic flow patterns of nodes B and C. In (b), the long-distance spatial similarity of traffic flow is shown, while (c) illustrates the multi-scale characteristics of traffic flow.
[0035] Fig. 9 It is a structural diagram of the DSTF model of an embodiment of the present invention.
[0036] Fig.10 The following is a visualization diagram of traffic flow on the PEMS03 dataset according to an embodiment of the present invention, where: (a) daily cycle, (b) weekly cycle. In Figure (a), traffic data of the selected sensor node for two consecutive days in the same week are displayed. Figure (b) displays data for two consecutive Thursdays. The legend uses a color gradient from dark gray to light gray, then to light green, and finally to dark green to represent traffic flow, and its value increases from 0 to the peak value.
[0037] Fig.11 This is a processing flow chart of the Geom-GCN model under dual perspectives according to an embodiment of the present invention.
[0038] Fig.12 The left figure shows the overall schematic diagram of GRes2Net, and the right figure depicts the structure of the gated convolution (GConv). DETAILED DESCRIPTION
[0039] In order to make the features and advantages of this patent more obvious and easy to understand, the following embodiments are specifically described in detail as follows:
[0040] It should be noted that the following detailed descriptions are illustrative and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0041] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0042] In order to facilitate the detailed description of the present invention, the relevant basic concepts are first described in a unified manner.
[0043] Definition 1 (Directed graph of traffic network G) Given a traffic network containing N sensor nodes, the traffic network can be modeled as a directed graph G = (V, E, A), where V = {v1, v2, ..., v n} represents the sensor nodes on the road network, E represents the edge set between nodes, A∈R N×N is the weighted adjacency matrix of graph G. Assume is the traffic status of each sensor node at time t (such as traffic flow, speed, etc.), where F is the observed feature dimension.
[0044] Definition 2 (Traffic Flow Prediction Problem f) In this embodiment, the traffic flow X of each sensor node in the history of T steps is taken (t-T+1):t ={X t-T+1 ,X t-T+2 ,....,X t} as the research object, and based on this, a model f is established to predict the traffic flow X of these nodes in the next T' steps (t+1):(t+T’) ={X (t+1) ,X(t+2) ,....,X (t+T’)}:
[0045]
[0046] The structure of the multivariate spatiotemporal feature extraction model (DSTF) for traffic flow prediction proposed in the embodiment of the present invention is as follows: Fig. 9 As shown in the figure, it includes a data embedding layer for input, L stacked spatiotemporal feature extraction layers, and an output layer. The data embedding layer forms a more comprehensive spatiotemporal feature by embedding traffic flow data, temporal and spatial features. Each spatiotemporal feature extraction layer includes a local-global spatial feature extraction module (LGSFEM), a gated convolution improved Res2Net module (GRes2Net), a dynamic spatiotemporal synchronization aggregation module (DSTSAM), and a spatiotemporal feature fusion module. The local-global spatial feature extraction module is mainly divided into two parts. The first part is to capture local spatial dependencies using Geom-GCN under dual perspectives, and the second part is to extract spatial features under a global perspective. GRes2Net is used to extract temporal features of different scales. DSTSAM extracts dynamic spatiotemporal dependencies at the same time. The extracted multiple spatiotemporal features are fused through the feature fusion module, and a feedforward fully connected layer is used afterwards. Finally, the data is converted to the final dimension required for output through skip connections and fully connected layers.
[0047] (1) Data Embedding Layer
[0048] The following is a detailed description of the working process of the data embedding layer. In this embodiment, the data embedding layer introduces information such as time position coding, time periodicity, and road network structure, which effectively enhances the model's ability to extract complex spatiotemporal dependencies. Specifically, the input traffic flow X input First, it is converted into a fixed-dimensional representation X through a fully connected layer f ∈R N×d , where d is the embedding dimension of the data. Secondly, in the time dimension, time embedding coding is performed by combining time position coding with the daily and weekly periodicity of traffic flow. Finally, in the spatial dimension, spatial graph Laplace embedding is used to embed the spatial structure of the road network.
[0049] Traffic flow data presents a typical time series pattern. As time goes by and vehicles move in space, the traffic flow on each road at different times is constantly changing. Therefore, there is a position relationship between the traffic flow measurements at different time steps. To address this feature, the present invention first converts a time position code X t ∈R T×d Included in the input data X input After this, if Fig.10(a) shows the traffic flow heat map of 10 sensor nodes on Thursday and Friday using the PEMS03 dataset. Fig.10 (b) presents the traffic flow heatmaps of 10 sensor nodes on two consecutive Thursdays. It can be clearly seen from these figures that the traffic flow shows obvious daily and weekly periodicity.
[0050] Therefore, in order to further improve the prediction accuracy of the DSTF model, the present invention introduces daily periodicity and weekly periodicity embedding. According to the established practice, each day is divided into 1440 time slots according to minutes, and each week is divided into 7 days. Then, these time slots are converted into high-dimensional representations to obtain the periodic embedding X p ∈R T×d .
[0051] Given the constraints of the traffic network, the traffic flow in each road section is not only affected by its immediate surrounding environment, but also by the adjacent road sections in the network. Therefore, it is necessary to include the geographic spatial adjacency relationship of each road section. This embodiment uses the graph Laplace eigenvector to represent the structural information of the road network. Specifically, first use Formula 2 to obtain the Laplace eigenvector of the normalized adjacency matrix. Subsequently, these eigenvectors are generated into a spatial embedding X through a linear operation layer. s ∈R N×d , which is specifically expressed as the following steps:
[0052] Step 1: Input traffic flow X input Transformed into a fixed-dimensional representation X through a fully connected layer f ∈R N×d ;
[0053] Step 2: Construct the time position code X t ∈R T×d :
[0054]
[0055] Where t is the position in the time series, i is the length of the sequence, and d is the dimension of the sequence.
[0056] Step 3: Divide each day into 1440 time periods in minutes and each week into 7 days in days, and convert them into high-dimensional representations to obtain the period embedding code X p ∈R T×d ;
[0057] Step 4: Use the graph Laplace eigenvector to represent the structural information of the road network. The Laplace eigenvector of the normalized adjacency matrix is obtained by formula (3);
[0058] Δ=ID -1 / 2 AD-1 / 2 =U T ΛU(3)
[0059] Where A is the adjacency matrix, D is the degree matrix, I is the identity matrix, U is the eigenvector matrix, and Λ is the eigenvalue.
[0060] Step 5: Generate spatial embedding code X from these feature vectors through a linear operation layer s ∈R N×d .
[0061] Step 6: Based on the above time embedding code and space embedding code, simply sum the two to get the output X of the data embedding layer emb ∈R N×d :
[0062] X emb =X f +X t +X p +X s (4)
[0063] So far, the data embedding layer work of the present invention is basically completed.
[0064] (2) Spatiotemporal feature extraction layer (spatial-temporal encoder layer)
[0065] The following introduction gives the detailed process of the spatiotemporal feature extraction layer. The spatiotemporal feature extraction layer mainly includes four parts: local-global spatial feature extraction module, multi-scale feature extraction GRes2Net module, dynamic spatiotemporal synchronization aggregation module and spatiotemporal feature fusion module. This encoder layer can extract a variety of spatiotemporal features of traffic flow data, so as to more comprehensively capture the evolution of traffic flow. In order to improve the expressiveness of the model, inspired by the multi-head attention mechanism, in the subsequent part of the model, this embodiment converts the tensor X emb ∈R N×T×d Split into feature subsets and Where d1+d2=d. The feature subsets are input into different feature extraction modules so that each feature subset can learn different feature representations.
[0066] The detailed processes of the local-global spatial feature extraction module, the multi-scale feature extraction GRes2Net module, and the dynamic spatiotemporal synchronization aggregation module are introduced below.
[0067] Local-global spatial feature extraction module:
[0068] The local-global feature extraction module consists of two parts: the local spatial feature extraction module and the dynamic global spatial feature extraction module. The local spatial feature extraction module uses Geom-GCN to model the local spatial correlation of traffic flow under dual perspectives. The specific process is as follows: Fig.11 As shown in the figure, 1 / 1, 1 / 2 and 1 / 4 respectively indicate that the sequence length becomes 1 / 1, 1 / 2 and 1 / 4 of the original sequence length. Based on the road network connectivity and traffic data similarity, two perspectives are constructed: geographic spatial graph structure and semantic spatial graph structure. Subsequently, the Struc2vec and Node2vec embedding algorithms are used to construct the latent spatial neighborhood, and finally Geom-GCN is used for graph aggregation. The dynamic global spatial feature extraction module uses the spatial self-attention mechanism to dynamically assign weights to the spatial information at different locations to capture the global dynamic spatial correlation.
[0069] The detailed processes of the local space feature extraction module and the dynamic global space feature extraction module are introduced below:
[0070] Local spatial feature extraction module: As a key part of the graph convolutional neural network, the construction method of the graph structure is crucial to the model prediction results. In the past, GCN-based models usually constructed the graph structure according to the road network adjacency matrix. However, in actual scenarios, it is not sufficient to rely solely on this method to capture the spatial dependency of traffic flow. This is because even if the geographical locations of two nodes are far apart, if they have similar traffic functions or roles, they may have similar properties. For example, similar traffic patterns may exist near two commercial or residential areas that are far apart and not connected in the road network. Therefore, this embodiment constructs the geographic neighborhood G based on the sensor geographic adjacency matrix and the temporal similarity, respectively. G Similar to G S Two spatial structure maps are used to extract more comprehensive spatial dependencies.
[0071] In order to capture the local spatial correlation in the traffic network, graph convolutional neural networks are widely used to simulate the modeling of traffic flow propagation patterns in the road network. However, traditional graph convolutional neural networks have limitations when processing graph data. They fail to retain the structural information of neighboring nodes and have difficulty capturing long-distance spatial dependencies. Geom-GCN uses a geometric aggregation scheme to improve the aggregation function in graph convolutional neural networks. It uses the geometric relationships defined in the latent space and the designed two-layer aggregator to retain the structural information between nodes. At the same time, by introducing a suitable node embedding algorithm, Geom-GCN can capture long-distance spatial dependencies.
[0072] The node embedding algorithm aims to map each node in the graph into a vector in a low-dimensional continuous space. The traditional adjacency matrix based on geographic neighborhood ignores the fact that two nodes in the transportation network that are far apart but have similar spatial structures often have strong spatial correlation. The Struc2Vec algorithm uses the distance between the ordered degree sequences of two nodes as a metric, and can embed nodes with similar local spatial structures into nearby locations in the latent space. Finally, the aggregation scheme in the graph convolutional neural network is replaced by two-level aggregation, so that the structural information of the node can be used in the process of updating the hidden features of the node. The two-level aggregation includes two aggregation functions: a low-level aggregation function and a high-level aggregation function. The low-level aggregation function aggregates the node information that is in the same neighborhood and has the same geometric relationship with the node, and uses it as a virtual node. After that, high-level aggregation is performed, that is, the features of the virtual node generated in the previous step are aggregated to obtain the final hidden features of the node, which is specifically expressed as the following steps:
[0073] Step 1: Construct the geographic neighborhood G G Spatial structure diagram: The spatial structure diagram of the geographic neighborhood is constructed based on the adjacency matrix of real-world sensors. G ∈R N×N The expression is as follows:
[0074]
[0075] Step 2: Construct semantic similarity G S Spatial structure diagram: Given any two time series X = (x1, x2, x3, ..., x m ) and Y=(y1,y2,x3,...,y n ), the sequence lengths are m and n respectively, and the FastDTW algorithm is used to calculate the similarity between any two sensor node traffic flow sequences, thereby obtaining the similarity between the two sensor nodes. According to the calculation results of FastDTW, find the K sensor nodes top_k (v i ), based on which the adjacency matrix A is established S ∈R N ×N :
[0076]
[0077] Step 3: For the graph structure built based on geographic neighborhood, use the Struc2Vec algorithm as the node embedding algorithm. For the graph structure built based on semantic similarity, use the Node2vec algorithm as the node embedding algorithm.
[0078] Step 4: Constructing a structural neighborhood: Based on the latent space generated by the node embedding algorithm in step 3, given any two nodes u∈V and v∈V, the present invention first constructs a structural neighborhood according to the ordered positions of nodes u and v in the latent space. Define a relational operator τ that can represent the geometric relationship between two nodes. Then, define a parameter ρ and find nodes z∈V whose distance to each node u is less than ρ in the latent space to construct the neighborhood N of the node in the latent space. s (u). Finally, combine the neighborhood N in the original image g (u), construct the structural neighborhood N(u) = {N g (u),N s (u),τ}.
[0079] Step 5: Use two-level aggregation to obtain the final hidden features of the node.
[0080]
[0081] in, is the hidden feature of node u at layer l-1, is a virtual node feature representation, obtained by aggregating the node features that are in the same neighborhood i as node v and whose geometric relationship with node v is equal to r. o(·) and q(·) are low-level aggregation functions and high-level aggregation functions, respectively. The input of q(·) consists of two parts: virtual node feature and index (i,r), σ is a nonlinear activation function, W l are learnable matrix parameters.
[0082] Step 6: Given input features Based on the geographic neighborhood spatial graph structure G G and the semantic similarity space graph structure G S , respectively use Geom-GCN to capture local spatial correlation, and get and In addition, through the gated fusion mechanism, the two spatial dependencies of geographic adjacency and semantic similarity are considered at the same time to obtain the final local spatial feature X LS :
[0083] z=sigmoid((X G W G +b G )+(X S W S +b S )) (10)
[0084] X LS =z⊙X G +(1-z)⊙X S (11)
[0085] in, is the fused feature, W G , W S are two learnable parameter matrices, b G and b S is the weight bias, and ⊙ is the Hadamard product.
[0086] At this point, the local space feature extraction work of the present invention is basically completed.
[0087] Dynamic global spatial feature extraction module: The traffic network is complex, and the traffic flows between different sections affect each other. The traffic flows between some sections may have strong correlations, while the correlations between other sections are relatively weak. In addition, different time slices of each section have different correlations. In order to better model the spatial correlation of traffic flow, the present invention adopts a multi-head self-attention mechanism to capture the above global dynamic spatial correlation, which is specifically expressed as the following steps:
[0088] Step 1: At time t, given the input data First, the three matrices required to calculate multi-head self-attention are obtained through linear transformation:
[0089]
[0090] in, are three learnable parameter matrices.
[0091] Step 2: Subsequently, the correlation between the various sensor nodes in each attention head is calculated using the scaled dot product attention mechanism:
[0092]
[0093] in, represents the sensor node v at time t i With node v j The similarity between them. Since the sensor node v at time t+1 i The traffic flow of is correlated with the traffic flow of all sensor nodes at time t. Therefore:
[0094] Step 3: Use the softmax function to normalize the similarity vector and calculate the node v i The similarity scores between each sensor node are used to calculate the value Weighted.
[0095]
[0096] in, is the learnable parameter matrix, represents the output of the h-th attention head module at time t, is the output of the multi-head self-attention module at the tth moment.
[0097] At this point, the global spatial feature extraction work of the present invention is basically completed.
[0098] Multi-scale feature extraction GRes2Net module
[0099] Traffic flow shows different changing patterns at different time scales. This embodiment uses the Res2Net structure to overcome the problem of insufficient multi-scale temporal feature extraction in existing prediction models. Different from the standard Res2Net, this embodiment uses gated convolution to replace standard convolution to learn richer feature representation. Fig.12 The framework structure of GRes2Net is shown, which is specifically expressed in the following steps:
[0100] Step 1: First, input features After a 1×1 convolution.
[0101] Step 2: Split the input features in the channel dimension and evenly divide them into k feature map subsets where i∈{1,2,...,k}.
[0102] Step 3: Subset each feature map After a gated convolution and upsampling operation, the next feature map subset is Add them together and enter the next gated convolution. The process is as follows:
[0103]
[0104] Among them, Г1 and Г2 are convolution kernels of size 1×S1 and 1×S2 respectively, ★ represents the convolution operation, and g and σ are tanh and sigmoid activation functions respectively. Feature map subset X (2,i) Each gated convolution operation can obtain a larger receptive field. Therefore, the GRes2Net module can gradually extract multi-scale temporal features.
[0105] Step 4: Finally, in order to fully integrate the multi-scale temporal information, the output y of all feature map subsets is i The concatenation operation is performed, followed by a residual convolution layer and a Relu activation function to obtain the final output:
[0106]
[0107] in Represents a concatenation operation.
[0108] Step 5: Get the output of GRes2Net Finally, in order to reduce the number of parameters, we divide For feature subset and Where c1+c2=d2.
[0109] At this point, the multi-scale feature extraction work of the present invention is basically completed.
[0110] Dynamic spatiotemporal synchronization aggregation module
[0111] In the aforementioned section, the embodiments of the present invention respectively designed feature extraction modules for the time correlation and spatial correlation of traffic flow. However, traffic flow data is typical spatiotemporal data, and its changing rules in the time dimension and distribution patterns in the spatial dimension are interrelated and influence each other. Extracting time and space features separately may ignore this correlation. Therefore, this embodiment designs a dynamic spatiotemporal synchronization aggregation module based on the attention mechanism, which aims to simultaneously extract the time and space characteristics of traffic flow to achieve more accurate traffic flow prediction.
[0112] In the time dimension, the traffic flow of the current time slice is affected by the traffic flow of the historical time slices, and will also affect the traffic flow of the future time slices. Therefore, there is a correlation between the traffic flows of different time slices, and this correlation changes dynamically. This embodiment uses a self-attention mechanism to capture this long-term, dynamic time correlation. In addition, since the multi-head attention mechanism allows the model to focus on different features in different subspaces, the multi-head self-attention mechanism is used, which is specifically expressed as the following steps:
[0113] Step 1: Given the traffic flow data of the nth sensor node in T time slices First, calculate the two inputs of the multi-head attention:
[0114]
[0115] Among them, X GR1 is the feature subset output by the GRes2Net module, They are the three learnable parameter matrices of the h-th attention head.
[0116] Step 2: Get the dynamic time adjacency matrix:
[0117]
[0118] Step 3: Similarly, given the input data The dynamic space adjacency matrix is calculated as follows:
[0119]
[0120] Step 4: Given input data In addition to the two dynamic adjacency matrices mentioned above, a temporal adjacency matrix is added to the standard graph convolutional neural network to further achieve synchronous spatiotemporal feature extraction:
[0121] X DST =A s X2A t W1+b3(22)
[0122] X2=X GR W2+b4(23)
[0123] Among them, W1, W2 and b3, b4 are learnable weights and bias parameters respectively.
[0124] At this point, the dynamic spatiotemporal synchronization aggregation work of the present invention is basically completed.
[0125] Spatiotemporal feature fusion module
[0126] Based on the output results of the above modules, the present invention concatenates the extracted multiple spatiotemporal features and fuses them through two linear layers and a ReLU activation function to learn richer features.
[0127]
[0128] Among them, W3, W4 and b5, b6 are learnable weights and bias parameters respectively. They are the outputs of the GRes2Net module, the local-global spatial feature extraction module, and the dynamic spatiotemporal aggregation module. Based on the extracted spatiotemporal features, the output of the spatiotemporal layer is obtained through the residual connection layer and the feedforward neural network layer.
[0129] At this point, the spatiotemporal feature fusion work of the present invention is basically completed.
[0130] (3) Output layer
[0131] The embodiment of the present invention uses a jump connection layer to enable information to be transferred between different layers. Finally, two 1×1 convolutional layers are used to convert it into the final output of the model.
[0132] So far, the complete process of the DSTF model has been introduced.
[0133] Furthermore, the scheme of the present invention uses three indicators, namely mean absolute error (MAE), root mean square error (RMSE) and mean absolute percentage error (MAPE), to evaluate the performance of the model. The specific calculation formula is as follows:
[0134]
[0135] Among them, N is the sample data size, y i and are the true value and the predicted value respectively. MAE can intuitively reflect the average difference between the predicted value and the true value. MAPE further compares the error between the predicted value and the true value with the true value, which is more interpretable. Compared with MAE and MAPE, RMSE calculates the root mean square error between the predicted value and the true value, and is more sensitive to predictions that deviate greatly from the true value.
[0136] The following is a further introduction and demonstration of the embodiments of the present invention through specific test examples:
[0137] Experimental Dataset
[0138] The PEMS03, PEMS04, PEMS07, and PEMS08 datasets are derived from the California Department of Transportation Performance Measurement System (PeMS) and are collected using sensors deployed by PeMS on highways in California, USA. The data is aggregated every 5 minutes, and missing values are filled using linear interpolation. The Hangzhou Metro (HZMETRO) dataset is a passenger flow dataset based on the subway system, derived from transaction records at 80 operating stations, representing a daily passenger flow of approximately 2.35 million people. The dataset provides inflow and outflow data for each station every 15 minutes. More detailed information about these datasets is presented in Table 1.
[0139] Dataset processing
[0140] Consistent with the baseline method, the highway dataset and Hangzhou Metro (HZMETRO) dataset are divided into training set, validation set and test set according to the ratio of 6:2:2 and 7:1:2 respectively. The Z-Score normalization method is applied to all datasets to standardize each feature:
[0141]
[0142] For all data sets, this embodiment uses a multi-step prediction method. The input data contains the traffic flow data sequence of the past hour (12 time steps), and the output data represents the traffic flow situation of the next hour (12 time steps). For the Hangzhou Metro (HZMETRO) data set, the data of the past 6 time steps are used to predict the traffic flow of the next 6 time steps.
[0143] Table 1: Dataset description
[0144] Dataset node side Sampling time Time step Time interval Missing rate PEMS03 358 547 09 / 01 / 2018-11 / 30 / 2018 26208 5min 0.672% PEMS04 307 340 01 / 01 / 2018-02 / 28 / 2018 16992 5min 3.182% PEMS07 883 866 05 / 01 / 2017-08 / 31 / 2017 28224 5min 0.452% PEMS08 170 295 07 / 01 / 2016-08 / 31 / 2016 17856 5min 0.672% HZMETRO 80 240 01 / 01 / 2019-01 / 25 / 2019 - 15min -
[0145] Baseline comparison experiment
[0146] In order to evaluate the effectiveness of the proposed DSTF, the DSTF is compared with the following eight baselines:
[0147] LSVR: Linear Support Vector Regression uses SVM for traffic flow prediction and only models the temporal correlation of traffic flow.
[0148] FNN: Feed-forward Neural Network, uses a standard fully connected neural network for traffic flow prediction.
[0149] FC-LSTM: Fully-Connected LSTM, as a variant of RNN, LSTM has advantages in capturing the long-term temporal dependencies of traffic flow due to its ability to alleviate the gradient vanishing and gradient exploding problems.
[0150] STGCN: Spatial-temporal graph convolution network, which combines temporal convolution with spatial graph convolution to capture the temporal and spatial dependencies of traffic flow.
[0151] GWN: Graph WaveNet, which uses temporal gated convolution and spatial graph diffusion convolution to capture temporal and spatial dependencies respectively, and designs an adaptive adjacency matrix to learn the hidden graph structure.
[0152] ASTGCN(r): Attention based spatial-temporal graph convolutional network, which designs temporal attention mechanism and spatial attention mechanism to capture dynamic temporal and spatial dependencies respectively, and uses spatiotemporal convolution to capture static spatiotemporal dependencies, considering only the dependencies of adjacent time periods.
[0153] ·STSGCN: Spatial-temporal synchronous graph convolutional network, which captures the spatiotemporal dependencies of traffic flow simultaneously by constructing multiple local spatiotemporal graphs.
[0154] STG-NCDE: Graph Neural Controlled Differential Equations for Traffic Forecasting, designed temporal neural controlled differential equations and spatial neural controlled differential equations to extract temporal features and spatial features respectively.
[0155] PDFormer: Propagation Delay-Aware Dynamic Long-Range Transformer for Traffic Flow Prediction, which uses temporal self-attention mechanism and spatial self-attention to capture spatiotemporal correlation. Two graph masking matrices are designed in the spatial self-attention mechanism to highlight long-range and short-range spatial dependencies, and a traffic delay-aware feature transformation module is further designed to capture the spatial information propagation delay caused by traffic accidents, etc.
[0156] Table 2 shows the average prediction results of different models for traffic flow for one hour (12 time steps) on four datasets. The results highlighted in bold represent the best performance, while the results marked as suboptimal are also highlighted accordingly. Figure 1 The prediction capabilities of the DSTF model and the main benchmark models on the PEMS04 and PEMS08 datasets are intuitively compared. The research results of the present invention show that the proposed model generally exhibits better performance than other models on the four datasets.
[0157] As shown in Table 2, the performance of the three models, LSVR, FNN, and FC-LSTM, is relatively poor compared to the other models. These three models mainly focus on the dependencies of temporal flows and ignore the inherent spatial dependencies in road networks. STGCN handles the problem of spatial flow dependencies by combining graph convolutional neural networks with temporal one-dimensional convolutions. However, traditional convolutional neural networks mainly focus on local information, which may lead to suboptimal performance in scenarios that rely on long-term temporal patterns. GWN uses dilated causal convolutions to expand the receptive field, thereby enhancing its ability to capture long-term temporal features. However, in the spatial dimension, the adaptive adjacency matrix designed to learn the hidden graph structure is static and cannot capture complex dynamic features. STSGCN introduces a new perspective, which is to extract local spatiotemporal correlations synchronously by designing local spatiotemporal graphs. However, the construction of these graphs relies on fixed-size time windows, which limits their ability to model global dependencies of traffic flows.
[0158] ASTGCN(r) incorporates an attention mechanism to capture correlations in traffic flow dynamics. However, its effectiveness is affected by the failure of the model to consider daily and weekly cycle characteristics. STG-NCDE introduces neural controlled differential equations to capture spatiotemporal dependencies and achieves very good results. PDFormer introduces two graph mask matrix spatial self-attention mechanisms to model spatial dependencies, and is also equipped with a novel propagation delay perception module, showing excellent modeling performance.
[0159] In contrast, the DSTF model effectively handles the complex spatiotemporal dependencies of traffic flow and achieves higher prediction accuracy. Specifically, GRes2Net progressively expands the receptive field in the temporal dimension by stepwise connections, thereby capturing multi-scale temporal features. LSGSFEM combines the local dual perspective with the global spatial perspective, which can capture both the local node interaction characteristics and the dynamic interactions between global nodes. In addition, by incorporating the temporal and spatial dynamic matrices into the graph aggregation process, DSTSAM is able to capture the dynamic interactions of nodes in both temporal and spatial dimensions.
[0160] Table 3, Table 4, Figure 2 and Figure 3 The average prediction results of the DSTF model and other baseline models for the next 5, 15, 30, and 45 minutes on both datasets are shown. The best results are presented in bold, and the suboptimal results are underlined. The results show that the DSTF model performs best in both short-term and medium- and long-term predictions. This can be attributed to the ability of the DSTF model to extract multiple spatiotemporal features. Specifically, the multi-scale temporal feature extraction module uses a convolutional neural network to consider local temporal features, while the temporal adjacency matrix calculated by the temporal self-attention mechanism can capture long-term temporal dependencies. In addition, the local feature extraction module comprehensively considers short-range spatial dependencies, while the global spatial self-attention module can effectively extract global spatial dependencies. Moreover, it can be found that the prediction performance of each model decreases to varying degrees as the prediction time increases. This phenomenon may be attributed to the complex and dynamic nature of the traffic system, which is affected by many factors, including weather conditions and sudden emergencies. Traffic flow within the road network may change significantly over time, which poses a greater challenge for the model to make accurate predictions.
[0161] Table 2: Prediction results of different models on four datasets. The best values are highlighted in bold. The suboptimal results are underlined.
[0162]
[0163]
[0164] Table 3: Prediction performance of DSTF models on the PEMS04 dataset. The best values are highlighted in bold and the suboptimal results are underlined.
[0165]
[0166] Table 4: Prediction performance of the DSTF model on the PEMS08 dataset. The best values are highlighted in bold and the suboptimal results are underlined.
[0167]
[0168]
[0169] Generalization
[0170] To evaluate the robustness of the DSTF model under different conditions, it was tested on the Hangzhou Metro (HZMETRO) dataset. Unlike the PEMS series dataset, the Hangzhou Metro (HZMETRO) dataset presents completely different geographical characteristics and traffic patterns. For comparison, three competitive benchmark models were selected, as shown in Table 5. The results show that the DSTF model consistently outperforms these benchmark models in all three evaluation indicators, which highlights its effectiveness and robustness.
[0171] Table 5: Prediction results of different models on the Hangzhou Metro (HZMETRO) dataset. The best values are highlighted in bold and the suboptimal results are underlined.
[0172]
[0173] Ablation experiment
[0174] In order to further test the effectiveness of each component of the model, the following six model variants were designed and ablation experiments were performed on the PEMS04 dataset:
[0175] The w / o GR2N variant removes the GRes2Net module that captures multi-scale temporal dependencies;
[0176] The w / o SPA variant removes the attention module that captures dynamic global dependencies;
[0177] w / o SG-GCN removes the temporal similarity Geom-GCN that captures static local features;
[0178] w / o GG-GCN removes the neighboring Geom-GCN that captures static local features;
[0179] w / o DSTSA removes the dynamic spatiotemporal synchronization aggregation module;
[0180] w / o GConv replaces the gated convolution in the GRes2Net module with normal convolution.
[0181] Table 6 and Figure 4The results show that the DSTF model outperforms its variants, which verifies the effectiveness of the various components of the DSTF model. The performance of variants GG-GCN and SG-GCN drops most significantly, indicating that relying solely on a geographic or semantic spatial perspective is not enough to fully consider the traffic flow and interactions affected by the real-world road network structure. In addition, the performance of the w / o SPA variant highlights the critical importance of capturing the dynamic spatial dependencies between nodes that evolve over time. The results of the w / o GR2N variant highlight the necessity of extracting multi-scale temporal features for effective time series learning. Similarly, the performance of the w / o GConv variant emphasizes the superior ability of gated convolutions in comprehensively extracting temporal features. This superiority stems from the ability of the gating mechanism to regulate the flow of information within the convolutional layer, ensuring that only key information that is critical to prediction is retained after each convolution operation. Finally, the w / o DSTSA variant emphasizes the important role of capturing dynamic spatiotemporal intercorrelations in traffic flow prediction.
[0182] In order to explore the impact of various attention mechanisms on the model, a series of comparative experiments were conducted using the PEMS04 dataset. The relevant results can be seen in Table 7. The definitions of each module are as follows:
[0183] w / oATT: Remove the temporal attention mechanism from DSTSAM.
[0184] w / o STT: Remove the spatial attention mechanism from DSTSAM.
[0185] w / o ATT-STT: Remove both temporal and spatial attention mechanisms from DSTSAM, effectively removing DSTSAM completely.
[0186] w / o SPA: Remove the global spatial attention mechanism from LGSFEM.
[0187] w / o STT-SPA: remove both the spatial attention mechanism in DSTSAM and the global spatial attention mechanism in LGSFEM.
[0188] w / o ATT-SPA: remove both the temporal attention mechanism in DSTSAM and the global spatial attention mechanism in LGSFEM.
[0189] w / oATT-STT-SPA: remove the global spatial attention mechanism from LGSFEM and remove both temporal and spatial attention mechanisms from DSTSAM.
[0190] The results show that the global spatial attention mechanism in LGSFEM plays a key role in the model performance, indicating that relying solely on local spatial correlations is not enough to capture the broader spatial relationships between nodes within the road network. In addition, removing either the temporal attention mechanism or the spatial attention mechanism in DSTSAM leads to a significant drop in performance, highlighting the importance of extracting spatiotemporal cross-correlations. This necessity stems from the inherent spatiotemporal dependencies in traffic flow as vehicles travel through the road network over time.
[0191] Table 6: Ablation study on the PEMS04 dataset, the best values are highlighted in bold
[0192]
[0193]
[0194] Table 7: Performance comparison of attention mechanisms on the PEMS04 dataset, the best values are highlighted in bold
[0195]
[0196] Analysis and Visualization
[0197] In order to intuitively demonstrate the performance of the model, the traffic flow prediction results of the sensor nodes on the PEMS04 dataset are visualized. Specifically, a day is randomly selected from the PEMS04 dataset, and the actual traffic flow values are plotted together with the predicted values of the DSTF model and the PDFormer model for the 5-minute and 60-minute prediction tasks. This visualization includes two randomly selected sensor nodes: one with relatively sparse traffic and the other with relatively dense traffic, such as Figure 5 As shown. Figure 5 It can be observed that both the PDFormer model and the DSTF model can effectively predict the dynamic changes of future traffic flow. However, the overall trend shows that the DSTF model provides more accurate predictions, which indicates that incorporating multiple spatiotemporal characteristics can improve the accuracy of traffic flow prediction.
[0198] Additionally, it is worth noting that traffic volume steadily increases between 4 and 6 a.m., reaching a peak around 6 a.m. Figure 5 The red box in (a) highlights that the DSTF model is better at dealing with the long-term dynamic changes in traffic flow than the PDFormer model when making long-term predictions. This may be because the DSTF model is able to cover a longer time frame, during which traffic conditions undergo more complex changes. By considering various spatiotemporal correlations, the DSTF model is able to capture these complex features more comprehensively, thereby improving the accuracy of the prediction.
[0199] Figure 6 The actual traffic flow for seven consecutive days and the predicted values given by the DSTF model for the 60-minute prediction task are shown. Figure 6 It can be clearly seen that the DSTF model can generally predict the dynamic changes in traffic flow. However, in the area marked by the blue circle, the DSTF model has difficulty accurately capturing the changes. This difference is likely caused by external factors, such as social activities, emergencies, or weather conditions, which can cause sudden fluctuations in traffic conditions. The data input to the DSTF model is only historical surrounding traffic flow data and corresponding daily and weekly time stamps, which makes it difficult for the DSTF model to capture sudden changes in traffic flow patterns.
[0200] Based on the same inventive concept, the present invention also provides a computer device, which includes: one or more processors, and a memory for storing one or more computer programs; the program includes program instructions, and the processor is used to execute the program instructions stored in the memory. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is used to implement one or more instructions, specifically for loading and executing one or more instructions in a computer storage medium to implement the above method.
[0201] It needs to be further explained that, based on the same inventive concept, the present invention also provides a computer storage medium, on which a computer program is stored, and the computer program is executed by a processor to execute the above method. The storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electrical, magnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0202] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0203] The above shows and describes the basic principles, main features and advantages of the present disclosure. Those skilled in the art should understand that the present disclosure is not limited by the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present disclosure. Without departing from the spirit and scope of the present disclosure, the present disclosure may have various changes and improvements, and these changes and improvements fall within the scope of the present disclosure to be protected.
[0204] This patent is not limited to the above-mentioned optimal implementation mode. Anyone can derive other forms of traffic flow prediction methods based on multivariate spatiotemporal feature extraction under the inspiration of this patent. All equal changes and modifications made according to the scope of the patent application of the present invention should be covered by this patent.
Claims
1. A traffic flow prediction method based on multivariate spatiotemporal feature extraction, characterized by: A multivariate spatiotemporal feature extraction model is adopted. In the temporal dimension, the gated convolution-improved Res2Net module is used to capture the changing pattern of traffic flow over time. In the spatial dimension, the spatial attention mechanism and dual-view Geom-GCN are used from a global and local perspective to capture the global spatial correlation, geographic neighborhood spatial correlation, and semantic similarity spatial correlation between nodes in the urban road network. In the time-space interaction dimension, a dynamic spatiotemporal synchronization aggregation module constructed using spatiotemporal attention is used to capture the dynamic interaction relationships between nodes or regions across time slices to predict future road traffic flows.
2. The traffic flow prediction method based on multivariate spatiotemporal feature extraction according to claim 1 is characterized by: The multivariate spatiotemporal feature extraction model includes: a data embedding layer, L stacked spatiotemporal feature extraction layers and an output layer; the data embedding layer is used to integrate traffic flow with time and space information to embed and represent traffic flow data; the spatiotemporal feature extraction layer is used to extract and fuse features, including a local-global spatial feature extraction module for capturing spatial features, a gated convolution improved Res2Net module for extracting multi-scale temporal features, a dynamic spatiotemporal synchronization aggregation module for modeling spatiotemporal cross-correlation, and a spatiotemporal feature fusion module for splicing the extracted multiple spatiotemporal features and fusing them through two linear layers and a Relu activation function; the output layer is used to predict future traffic flow.
3. The traffic flow prediction method based on multivariate spatiotemporal feature extraction according to claim 2 is characterized by: The data embedding layer introduces information including time position coding, time periodicity, and geographic space adjacency to embed and represent traffic flow data. The processing process includes: Input traffic flow X input Transformed into a fixed-dimensional representation X through a fully connected layer f ∈R N×d ; Where N is the number of sensor nodes in the traffic network, and d is the embedding dimension of the data; Build time position encoding X t ∈R T×d : Among them, t represents the position of the moment in the time series, and i is the length of the sequence; After dividing the time period, it is converted into a high-dimensional representation to form a periodic embedding X p ∈R T×d ; Where T is the historical step length of each sensor node; The Laplace eigenvector of the graph is used to represent the structural information of the road network, through the formula: Δ = ID -1 / 2 AD -1 / 2 =U T ΛU obtains the Laplace eigenvector of the normalized adjacency matrix; where A is the adjacency matrix, D is the degree matrix, I is the identity matrix, U is the eigenvector matrix, and Λ is the eigenvalue; then the obtained eigenvector is generated into a spatial embedding code X through a linear operation layer s ∈R N×d ; Based on the sum of time embedding coding and space embedding coding, the output X of the data embedding layer is obtained emb ∈R N×T×d : X emb =X f +X t +X p +X s 。 4. The traffic flow prediction method based on multivariate spatiotemporal feature extraction according to claim 3 is characterized by: After the data embedding layer, the tensor X emb ∈R N×T×d Split into feature subsets and d1+d2=d, subset the features The input local-global feature extraction module captures local and global spatial features in traffic flow data; the feature subset The Res2Net module improved by input gated convolution extracts temporal features of different scales.
5. The traffic flow prediction method based on multivariate spatiotemporal feature extraction according to claim 4 is characterized by: The local-global feature extraction module includes a local spatial feature extraction module and a dynamic global spatial feature extraction module; the local spatial feature extraction module is used to model the local spatial correlation of traffic flow using Geom-GCN under dual perspectives: based on the sensor adjacency matrix corresponding to the road network connectivity and the traffic data similarity, a geographic spatial graph structure and a semantic spatial graph structure are constructed; the Struc2vec and Node2vec embedding algorithms are used to construct a potential spatial neighborhood, and Geom-GCN is used for graph aggregation; the dynamic global spatial feature extraction module uses a spatial self-attention mechanism to dynamically assign weights to spatial information at different locations to capture global dynamic spatial correlation.
6. The traffic flow prediction method based on multivariate spatiotemporal feature extraction according to claim 5 is characterized by: In the local space feature extraction module: Geographic neighborhood spatial graph structure G G Based on the sensor adjacency matrix, the adjacency matrix A G ∈R N×N The expression is as follows: Where v represents the sensor node on the road network, E represents the edge set between nodes, and A∈R N×N It is a weighted adjacency matrix that models the traffic network as a directed graph; Semantic similarity space graph structure G S By giving any two time series X = (x1, x2, x3, ..., x m ) and Y=(y1,y2,x3,...,y n ), the sequence lengths are m and n respectively, and the FastDTW algorithm is used to calculate the similarity between any two sensor node traffic flow sequences, thereby obtaining the similarity between the two sensor nodes; according to the calculation results of FastDTW, find the K sensor nodes top_k (v i ), thereby establishing the adjacency matrix A S ∈R N×N : The graph structure built based on geographic neighborhood uses the Struc2Vec algorithm as the node embedding algorithm, and the graph structure built based on semantic similarity uses the Node2vec algorithm as the node embedding algorithm; Given input features Based on the geographic neighborhood spatial graph structure G G and the semantic similarity space graph structure G S , respectively use Geom-GCN to capture local spatial correlation, and get and Through the gated fusion mechanism, the two spatial dependencies of geographic adjacency and semantic similarity are considered at the same time to obtain the local spatial feature X LS : z=sigmoid((X G W G +b G )+(X S W S +b S )) X LS =z⊙X G +(1-z)⊙X S in, is the fused feature, W G , W S are two learnable parameter matrices, b G and b S is the weight bias, ⊙ is the Hadamard product; The dynamic global spatial feature extraction module uses a multi-head self-attention mechanism to capture global dynamic spatial correlation, which is specifically expressed as the following steps: At time t, given the input data First, the three matrices required to calculate multi-head self-attention are obtained through linear transformation: in, are three learnable parameter matrices; The correlation between each sensor node in each attention head is calculated using the scaled dot product attention mechanism: in, represents the sensor node v at time t i With node v j The similarity vector between ; The similarity vector is normalized using the softmax function to calculate the node v i The similarity scores between each sensor node; use the similarity scores to calculate the value weighting; in, is the learnable parameter matrix, represents the output of the h-th attention head module at time t, is the output of the multi-head self-attention module at time t.
7. The traffic flow prediction method based on multivariate spatiotemporal feature extraction according to claim 6 is characterized by: In the gated convolution improved Res2Net module: The input features After a 1×1 convolution; The input features are then split in the channel dimension and evenly divided into k feature map subsets where i∈{1,2,...,k}; Subset each feature map After a gated convolution and upsampling operation, the next feature map subset is Add and enter the next gated convolution; the process is as follows: Among them, Г1 and Г2 are convolution kernels of size 1×S1 and 1×S2 respectively, ★ represents the convolution operation, g and σ are tanh and sigmoid activation functions respectively; The output y for all feature map subsets i After concatenation, a residual convolution layer and a Relu activation function are performed to obtain the final output: X GR =Relu(⊕(and i ,and i+1 ,...,and k )+Conv1×1(X2)) Where ⊕ represents the splicing operation; Division For feature subset and Where c1+c2=d2.
8. The traffic flow prediction method based on multivariate spatiotemporal feature extraction according to claim 7 is characterized by: The dynamic spatiotemporal synchronization aggregation module uses a multi-head self-attention mechanism, which is specifically expressed as the following steps: Given the traffic flow data of the nth sensor node in T time slices First, calculate the two inputs of the multi-head attention: in,, They are the three learnable parameter matrices of the h-th attention head; Get the dynamic time adjacency matrix: Given input data The dynamic space adjacency matrix is calculated as follows: Given input data The dynamic time adjacency matrix and the dynamic space adjacency matrix are added to the graph convolutional neural network to achieve synchronous spatiotemporal feature extraction: X DST =A s X2A t W1+b3 X2=X GR W2+b4 Among them, W1, W2 and b3, b4 are learnable weights and bias parameters respectively; The expression of the spatiotemporal feature fusion module is: X=(Relu⊕(X GR ,X GS ,X DST )W3+b5)W4+b6 Among them, W3, W4 and b5, b6 are learnable weights and bias parameters respectively. They are the outputs of the gated convolution-improved Res2Net module, the local-global spatial feature extraction module, and the dynamic spatiotemporal aggregation module. Based on the extracted spatiotemporal features, the output of the spatiotemporal layer is obtained through the residual connection layer and the feedforward neural network layer. The output layer includes two 1×1 convolutional layers, which take the result obtained by the spatiotemporal feature extraction layer through the jump connection layer as input and convert it into the final prediction output.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of a traffic flow prediction method based on multivariate spatiotemporal feature extraction as described in any one of claims 1 to 8 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a traffic flow prediction method based on multivariate spatiotemporal feature extraction as described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Traffic flow prediction method based on global diffusion convolution residual network
CN112071065A
Traffic flow prediction method, electronic device and storage medium
CN113159428A
Traffic prediction method and device based on dynamic space-time diagram convolution attention model
CN113487088A
Traffic flow prediction method based on multimode dynamic memory graph convolutional network
CN119107798A
KR20240159723A
Cited By
Abnormal traffic flow detection method and system based on dynamic graph
CN120412286A
Traffic speed prediction method and device based on self-attention nerve control
CN120954246A
Traffic flow prediction method and system based on multi-view space-time modeling
CN122176930A
A traffic flow prediction method and system based on multi-view spatio-temporal modeling
CN122176930B