Self-supervised dynamic space-time diagram traffic flow prediction method, device, medium and product
Through the self-supervised dynamic spatiotemporal graph traffic flow prediction method, the self-supervised dynamic spatiotemporal graph convolution network captures cross-region dependencies and dynamic spatiotemporal features, solving the problem that existing models ignore cross-region dependencies and cannot handle dynamic changes, achieving higher prediction accuracy and model adaptability.
Patent Information
- Application Number
- CN202510180122.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-05-27
AI Technical Summary
Existing traffic flow prediction models focus mainly on local geographical correlations, ignore cross-regional interdependences on a global scale, and most GCN-based models rely on predefined graph structures and fixed adjacency matrices, and cannot flexibly handle dynamic changes in traffic networks.
A self-supervised dynamic spatiotemporal graph traffic flow prediction method is proposed. By obtaining the current traffic flow sequence and inputting it into the self-supervised dynamic spatiotemporal graph convolution network, the dual-branch graph feature extraction structure and self-supervised learning module are used to capture interdependence and dynamic spatiotemporal features across regions.
It significantly improves the accuracy of traffic flow prediction and generalization capabilities of models, can flexibly respond to dynamic changes in the traffic network, comprehensively capture cross-region dependencies, and maximize the use of mutual information between dynamic spatio-temporal features.
Smart Images

Figure CN120048107A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of intelligent transportation systems, and particularly to a self-supervised dynamic spatio-temporal graph traffic flow prediction method, device, medium, and product. Background Art
[0002] With the acceleration of the urbanization process, traffic management and optimization have become the core challenges of intelligent transportation systems. Accurately predicting traffic flow is crucial for traffic management departments and individual passengers. In recent years, Graph Neural Networks (GNNs) have been widely applied to traffic flow prediction due to their excellent spatial feature capture ability. However, existing GNN models mainly focus on local geographical correlations and ignore cross-regional dependencies. This limitation restricts the model's ability to capture the global features of traffic flow, thereby affecting the prediction accuracy. In addition, most existing models based on Graph Convolutional Networks (GCNs) rely on predefined graphs and fixed adjacency matrices and cannot flexibly handle the dynamic changes in traffic networks. Therefore, how to construct a traffic flow prediction model that can effectively capture cross-regional dependencies and adapt to the dynamic changes of spatio-temporal features has become a hot and difficult issue in current research.
[0003] Researchers have proposed many models for traffic flow prediction. Initially, historical data patterns and trends were used to predict future traffic flow, such as the historical average model, which predicts based on the average of historical observations. However, simple linear operations cannot fully capture the complex relationships in spatio-temporal sequences. The ARIMA model is a commonly used time series analysis and prediction method that models trends and random fluctuations in time series by combining three parts: autoregressive (AR), differencing (I), and moving average (MA). However, it is still mainly applicable to static time data, limiting its ability to estimate and predict the state of dynamic systems. SVR projects the original space into a higher-dimensional feature space using a kernel function and constructs a linear model to capture non-linear relationships. However, its ability to express complex non-linear relationships is limited, and it cannot effectively learn high-level abstract feature representations from the original data. With the in-depth development of deep learning, researchers have considered using deep learning to build models, significantly improving the performance of the models. For example, the STGCN model uses Chebyshev approximation graph convolution to capture spatial dependencies and uses a gated convolutional neural network (gate-CNN) to simulate temporal dependencies, thus improving the training speed and reducing the number of parameters. SDGCN uses GCN to extract spatial features and gated recurrent units (GRUs) to extract temporal features. This model improves the modeling ability of complex roads to a certain extent, but performs better under sparse data than dense data. The ST-CGCN model consists of a graph convolution operator, a complex correlation matrix, and a residual unit, and has greater flexibility in dealing with spatial correlations. In addition, its temporal feature extraction module combines a three-dimensional convolution operator and long short-term memory (LSTM), greatly improving the accuracy of temporal correlations. This model performs well in processing complex spatio-temporal data and is applicable to different types of spatio-temporal data, including dense and sparse data. ADGCN, based on the consideration of the asynchronous spatio-temporal correlations of the transmission network, proposed asynchronous spatio-temporal graph convolution (ASTGC) and combined ASTGC with an extended causal convolutional network, achieving the effect of improving the prediction accuracy with fewer parameters. However, although the above models have improved the performance of traffic flow prediction to a certain extent, they still have deficiencies in the comprehensiveness of feature extraction. CGGCN improves the ability to capture dynamic traffic patterns by learning the adjacency matrix, but is still limited by the predefined graph structure and lacks flexibility in dealing with complex traffic networks. Similarly, HTSTGC effectively solves the problem of heterogeneity of spatio-temporal features, but ignores potential cross-regional dependencies and cannot comprehensively capture the global dynamics of the traffic network. In addition, TPSSL improves the robustness of the model through adaptive data masking, but still faces challenges in comprehensively processing the global features of dynamic spatio-temporal graphs. STGNN-ANS generates a more flexible graph structure by introducing an adjacency selection mechanism, but the fixed graph structure may limit its performance when dealing with dynamic changes.Similarly, although STFGCN has improved in terms of multi-scale time dependence, it is still unable to fully handle the cross-regional dynamic changes in the traffic network.
[0004] Existing methods mainly focus on local geographical correlations and ignore the cross-regional interdependencies on a global scale, which is insufficient to extract comprehensive semantic relationships and thus limits the prediction accuracy. In addition, most GCN-based models rely on predefined graphs and invariant adjacency matrices to reflect the spatial relationships between node features, ignoring the dynamics of spatio-temporal features, resulting in challenges in capturing the complexity and dynamic spatial dependencies of traffic data. Therefore, there are still many deficiencies in existing traffic flow prediction methods in terms of dynamic feature extraction and modeling of global dependencies. Specifically: (1) Existing methods mainly focus on local geographical correlations and ignore the cross-regional interdependencies on a global scale, making it difficult to comprehensively extract semantic information in the traffic network and resulting in limited prediction accuracy. (2) Most graph convolutional network (GCN)-based models rely on predefined graph structures and fixed adjacency matrices to reflect the spatial relationships between nodes, failing to fully consider the dynamic changes of spatio-temporal features. This limitation makes the model perform poorly in capturing the dynamic spatial dependencies in complex traffic data. (3) How to effectively integrate the mutual information between cross-regional dependencies and dynamic spatio-temporal features to enhance the model's learning ability of traffic flow features from multiple dimensions, thereby improving the model's generalization ability and prediction accuracy, remains an important challenge in current research. To address the above problems, there is an urgent need for a new type of traffic flow prediction method that can flexibly handle the dynamic changes of the traffic network, comprehensively capture cross-regional dependencies, and maximize the utilization of the mutual information between dynamic spatio-temporal features, so as to provide more accurate prediction results in complex traffic environments. Summary of the Invention
[0005] The purpose of this application is to provide a self-supervised dynamic spatio-temporal graph traffic flow prediction method, device, medium and product, which can improve the accuracy of traffic flow prediction.
[0006] To achieve the above purpose, this application provides the following solutions:
[0007] In the first aspect, this application provides a self-supervised dynamic spatio-temporal graph traffic flow prediction method, including:
[0008] Obtain the current traffic flow sequence; the current traffic flow sequence is constructed based on the traffic flow data within the first preset time period before the current moment;
[0009] Input the current traffic flow sequence into the traffic flow prediction model to obtain the current traffic flow prediction sequence; the current traffic flow prediction sequence includes: traffic flow prediction data within a second preset time period after the current moment; the traffic flow prediction model is obtained by training a self-supervised dynamic spatio-temporal graph convolutional network using historical traffic flow data; the self-supervised dynamic spatio-temporal graph convolutional network includes: a double-branch graph feature extraction structure and a self-supervised learning module connected in sequence; the double-branch graph feature extraction structure includes a spatio-temporal graph branch and a regional graph branch connected in parallel.
[0010] Optionally, the spatio-temporal graph branch includes a spatio-temporal graph construction unit and a spatio-temporal graph feature learning module connected in sequence; the spatio-temporal graph feature learning module is a recursive dynamic graph convolutional network; the recursive dynamic graph convolutional network includes multiple spatio-temporal dynamic graph convolutional gating mechanisms.
[0011] Optionally, the regional graph branch includes a regional graph construction unit and a regional graph feature learning unit connected in sequence; the regional graph feature learning unit is a graph convolutional network based on Chebyshev polynomials.
[0012] Optionally, before obtaining the current traffic flow sequence, it further includes:
[0013] Construct a total data set based on historical traffic flow data; the total data set includes multiple data pairs corresponding to historical moments; any one of the data pairs includes a historical sequence and a prediction sequence; the historical sequence is constructed based on the traffic flow data within a first preset time period before the corresponding historical moment; the label of the historical sequence is the time information of the historical sequence; the prediction sequence is constructed based on the traffic flow data within a second preset time period after the corresponding historical moment; the label of the prediction sequence is the time information of the prediction sequence;
[0014] Divide the total data set into a training data set, a validation data set, and a test data set according to a preset ratio;
[0015] Construct a self-supervised dynamic spatio-temporal graph convolutional network;
[0016] Determine any historical sequence in the training data set as the current historical sequence;
[0017] Input the current historical sequence into the spatio-temporal graph construction unit to obtain an initial spatio-temporal traffic signal graph;
[0018] Divide the current historical sequence and the initial spatio-temporal traffic signal graph into multiple time steps to obtain multiple dynamic graphs;
[0019] Use the K-means clustering algorithm to cluster all features in the original graph structure diagram, which is an intermediate quantity generated by the spatio-temporal graph construction unit, to obtain multiple clusters;
[0020] Construct multiple regional maps; the regional maps correspond to the clusters one by one;
[0021] Input multiple dynamic maps into the spatio-temporal map feature learning module to obtain dynamic map features;
[0022] Input multiple regional maps into the regional map feature learning unit to obtain regional map features;
[0023] Input the spatio-temporal map features and the regional map features into the self-supervised learning module to obtain the predicted traffic flow prediction historical sequence;
[0024] Update the current historical sequence, and return to the step of "inputting the current historical sequence into the spatio-temporal map construction unit to obtain the initial spatio-temporal traffic signal map" until the training data set is traversed, and complete one iteration of training;
[0025] Update the self-supervised dynamic spatio-temporal graph convolutional network parameters, and return to the step of "determining any historical sequence in the training data set as the current historical sequence" until the number of iterations reaches the preset number of iterations, and reach the to-be-determined traffic flow prediction model;
[0026] Use the validation data set to verify and adjust the to-be-determined traffic flow prediction model to obtain the traffic flow prediction model;
[0027] Use the test data set to test the traffic flow prediction model.
[0028] Optionally, the spatio-temporal map construction unit is:
[0029] L i = MLP(X i ');
[0030] W i = Attention(L i );
[0031] DG i = tanh(W i × G i );
[0032] Where, L i represents the feature matrix output after inputting the fused input data into the MLP layer; MLP(*) represents a multi-layer perceptron; X i ' represents the fused input data at the i-th time step, and the fused input data is obtained by combining the input data X i at the i-th time step with the dynamic feature H i-1 at the i-1-th time step; W i represents the weight matrix at the i-th time step; Attention(*) represents the Attention module; DG iDenote the spatio-temporal graph at the $i$-th time step; $\tanh(*)$ represents the cross-feature method; $G$ i Denote the traffic graph at the $i$-th time step.
[0033] Optionally, the spatio-temporal graph feature learning module is:
[0034]
[0035] $r$ i $=\sigma([x$ i , $h$ i-1 $S$ i $W$ r $+b$ r );
[0036] $z$ i $=\sigma([x$ i , $h$ i-1 $S$ i $W$ z $+b$ z );
[0037] $c$ i $=\tanh([x$ i , $h$ i-1 $\odot r$ i $S$ i $W$ c $+b$ c );
[0038] $F$ D i $=z$ i $\odot h$ i-1 $+(1 - z$ i ) $\odot c$ i ;
[0039]
[0040] where, $D$ i denotes the diagonal matrix at the $i$-th time step; $A$ represents the adjacency matrix of the graph; $\text{ReLU}(*)$ represents the ReLU activation function; $S$ i denotes the output feature of the spatio-temporal dynamic graph convolution operation; $I$ N denotes the identity matrix; $X\in\mathbb{R}$ N×D denotes the input feature of the dynamic graph convolution; $G$ i $\odot W$ Ni denotes the weight tensor $W$ Ni updates and changes with the traffic signal graph $G$ i containing time information; $\odot$ represents the concatenation operation; $G$ i $\odot b$ Ni denotes the weight tensor $b$ Ni updates and changes with the traffic signal graph $G$ iUpdate changes; r i represents the reset gate at the current time step; σ represents the sigmoid activation function, x i represents the input data at the i-th time step; h i-1 represents the hidden state of the previous time step; W r represents the first learnable parameter; b r represents the second learnable parameter; z i represents the update gate at the current time step; W z represents the third learnable parameter; b z represents the fourth learnable parameter; c i represents an intermediate temporary variable; W c represents the fifth learnable parameter; b c represents the sixth learnable parameter; F D i represents the dynamic feature at the i-th time step; F D represents the dynamic graph feature; m represents the number of time steps.
[0041] Optionally, the regional graph feature learning unit is:
[0042] T k = 2G E T k-1 - T k-2 , k ≥ 2;
[0043]
[0044] F E = X g W Ei + b Ei ;
[0045] where, T k represents the Chebyshev polynomial support set; G E represents the regional graph; T k-1 represents the (k - 1)-th order approximation of the Chebyshev polynomial of the regional graph adjacency matrix; similarly, T k-2 represents the (k - 2)-th order approximation of the Chebyshev polynomial of the regional graph adjacency matrix; k represents the order of the Chebyshev polynomial currently being calculated; K represents the total order of the Chebyshev polynomial calculation, usually a hyperparameter used to control the "receptive field" of the graph convolution (i.e., the maximum adjacency distance that can propagate information); X g represents the output feature of the regional graph convolution; H represents the input feature of the regional graph convolution; F E represents the regional graph feature; W Ei represents the regional weight; b Ei represents the regional bias term.
[0046] In a second aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the above self-supervised dynamic spatio-temporal graph traffic flow prediction method.
[0047] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above self-supervised dynamic spatio-temporal graph traffic flow prediction method is implemented.
[0048] In a fourth aspect, the present application provides a computer program product, comprising a computer program, and when the computer program is executed by a processor, the above self-supervised dynamic spatio-temporal graph traffic flow prediction method is implemented.
[0049] According to the specific embodiments provided by the present application, the following technical effects are disclosed in the present application:
[0050] The present application provides a self-supervised dynamic spatio-temporal graph traffic flow prediction method, device, medium and product. It creates a dynamic graph by combining time, space and traffic data, and then uses clustering technology to construct a regional graph based on geographical correlation to capture cross-regional interdependencies; uses a recurrent neural network (RNN) to facilitate dynamic graph convolution and recursively extract spatio-temporal correlations in traffic data. In addition, self-supervised learning is embedded as an auxiliary task in the network training process, aiming to enhance the prediction task by optimizing the mutual information of the learned features in the two graph networks. The present application is applicable not only to urban areas with similar functions but geographically dispersed (such as similar traffic patterns between commercial areas and business districts), but also to urban traffic environments with complex and heterogeneous traffic patterns. By constructing a clustering regional graph based on geographical correlation, the present application successfully solves the deficiency of traditional traffic flow prediction models in capturing cross-regional dependencies. Combining the graph convolutional network (GCN) and Chebyshev polynomial convolution, the present application further enhances the ability to capture the mutual correlation features between nodes in different regions and improves the adaptability of the model in complex traffic networks. This improvement ensures that the mutual influence of cross-regional traffic flows can be accurately captured, making the prediction results more global and accurate. Compared with traditional static or local spatio-temporal graph modeling methods, the present application flexibly captures the temporal and spatial dynamic changes of traffic flow through a recursive dynamic graph convolution module, ensuring accurate modeling of short-term and long-term traffic changes. This mechanism greatly improves the spatio-temporal feature extraction ability of the model. Especially when dealing with a rapidly changing traffic environment, this solution can update in real time and adapt to the dynamic fluctuations of traffic flow, significantly improving the accuracy and efficiency of prediction. By introducing a self-supervised learning mechanism, the present application maximizes the mutual information between dynamic graph features and regional graph features, thus effectively improving the learning effect of the model. Self-supervised learning not only reduces the dependence on a large amount of labeled data, but also enhances the robustness and generalization ability of the model in different complex traffic scenarios. This mechanism ensures the performance stability of the model in the face of diverse traffic scenarios and provides stronger interpretability, enabling the model to consider the spatio-temporal characteristics of traffic flow more comprehensively from both global and local perspectives. By flexibly using multi-step time signal input, the present application can accurately model the short-term and long-term changes of traffic flow. This multi-step time series modeling method makes up for the limitations of traditional single-step time modeling methods in capturing temporal sequence information, further improving the application performance of the model in complex dynamic scenarios, especially in the ability to respond to peak hours or sudden traffic situations. Description of the Drawings
[0051] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required in the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0052] Figure 1 Flowchart of the self-supervised dynamic spatio-temporal graph traffic flow prediction method provided by the embodiment of the present application;
[0053] Figure 2 Structural diagram of the self-supervised dynamic spatio-temporal graph convolutional network provided by the embodiment of the present application;
[0054] Figure 3 Structural diagram of the Recursive Dynamic Graph Convolutional (RDGC) module provided by the embodiment of the present application. Detailed implementation manners
[0055] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.
[0056] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below in conjunction with the drawings and specific implementation manners.
[0057] In an exemplary embodiment, as Figure 1 shown, a self-supervised dynamic spatio-temporal graph traffic flow prediction method is provided, including:
[0058] Step 101: Obtain the current traffic flow sequence. The current traffic flow sequence is constructed based on the traffic flow data within the first preset time period before the current moment.
[0059] Step 102: Input the current traffic flow sequence into the traffic flow prediction model to obtain the current traffic flow prediction sequence. The current traffic flow prediction sequence includes: traffic flow prediction data within the second preset time period after the current moment. The traffic flow prediction model is obtained by training a self-supervised dynamic spatio-temporal graph convolutional network using historical traffic flow data. Self-supervised dynamic spatio-temporal graph convolutional network (SDSC model) The SDSC model is a hierarchical graph neural architecture. The upper layer is a dynamic spatio-temporal graph, which introduces recursive dynamic graph convolution to extract spatio-temporal correlation features; the lower layer is a regional graph, which is constructed based on the similarity of node functions within the road network, and uses graph convolution method to extract regional features, and then obtains comprehensive traffic flow features through self-supervised learning. Specifically, first create a dynamic graph using a combination of time, space, and traffic data, and use recursive dynamic graph convolution to capture the dynamic changes in the dynamic graph. Then use clustering technology to construct a regional graph according to geographical relevance, and use a graph convolutional network based on Chebyshev polynomials to capture the interdependencies across regions. In addition, self-supervised learning is embedded as an auxiliary task in the network training process, aiming to enhance the prediction task by optimizing the mutual information of the learned features in the two graph networks. Finally, through loss function calculation, in the deep learning framework, find the optimal model for prediction by minimizing the loss. The prediction results of the model are compared with historical observation results, and error metrics are calculated, including MAE, MAPE, and RMSE. The process of the overall network model can be expressed by the following formula:
[0060] represents the final prediction result, that is, the current traffic flow prediction sequence; SSLearning represents self-supervised learning (contrast learning); DG represents dynamic graph features, and EG represents regional graph features.
[0061] Such as Figure 2 , the self-supervised dynamic spatio-temporal graph convolutional network includes: a double-branch graph feature extraction structure and a self-supervised learning module connected in sequence. The double-branch graph feature extraction structure includes a parallel spatio-temporal graph branch and a regional graph branch.
[0062] Among them, the spatio-temporal graph branch includes a spatio-temporal graph construction unit and a spatio-temporal graph feature learning module connected in sequence. The spatio-temporal graph feature learning module is a recursive dynamic graph convolutional network. Such as Figure 3 , the recursive dynamic graph convolutional network includes multiple spatio-temporal dynamic graph convolution gating mechanisms. The spatio-temporal graph construction unit is:[[]]
[0063] L i = MLP(X′ i ).
[0064] W i = Attention(L i ).
[0065] DGi = tanh(W i ×G i ).
[0066] Among them, L i represents the feature matrix output after the fused input data is input into the MLP layer. MLP(*) represents a multi-layer perceptron. X' i represents the fused input data at the i-th time step. The fused input data is obtained by combining the input data X i at the i-th time step with the dynamic feature H i-1 at the (i - 1)-th time step. W i represents the weight matrix at the i-th time step. Attention(*) represents the Attention module. DG i represents the spatio-temporal graph at the i-th time step. tanh(*) represents the cross-feature method. G i represents the traffic graph at the i-th time step.
[0067] The spatio-temporal graph feature learning module is as follows:
[0068]
[0069] First, use the Laplacian matrix to perform a dot product on the dynamic spatio-temporal graph and apply the ReLU activation function to complete the convolution operation. D i represents the diagonal matrix at the i-th time step, and its diagonal elements are the degrees of each node. Perform spatio-temporal dynamic graph convolution operations by constructing a normalized Laplacian matrix to generate the output feature S i ; among them, D i represents the diagonal matrix at the i-th time step. A represents the adjacency matrix of the graph. ReLU(*) represents the ReLU activation function. S i represents the output feature of the spatio-temporal dynamic graph convolution operation. I N represents the identity matrix. X ∈ R N×D represents the input feature of the dynamic graph convolution. G i ⊙W Ni represents the weight tensor W Ni changing with the update of the traffic signal graph G i containing time information. ⊙ represents the concatenation operation. G i ⊙b Ni represents the weight tensor b Ni changing with the update of the traffic signal graph G i containing time information.
[0070] r i = σ([x i , h i-1 S i W r+b r ).
[0071] z i =σ([x i ,h i-1 ]S i W z +b z ).
[0072] c i =tanh([x i ,h i-1 ⊙r i ]S i W c +b c ).
[0073] F D i =z i ⊙h i-1 +(1-z i )⊙c i .
[0074]
[0075] Among them, r i represents the reset gate of the current time step. σ represents the sigmoid activation function, x i Represents the input data of the i-th time step. i-1 W represents the hidden state of the previous time step. r represents the first learnable parameter. b r represents the second learnable parameter. i Represents the update gate for the current time step. W z represents the third learnable parameter. b z represents the fourth learnable parameter. i Indicates an intermediate temporary variable. c represents the fifth learnable parameter. b c represents the sixth learnable parameter. D i represents the dynamic characteristics of the i-th time step. D Represents the dynamic graph features. m represents the number of time steps.
[0076] The region graph branch includes a region graph construction unit and a region graph feature learning unit connected in sequence. The region graph feature learning unit is a graph convolution network based on Chebyshev polynomials.
[0077] The regional map feature learning unit is:
[0078] T k =2G E Tk-1 -T k-2 , where \(k\geq2\).
[0079]
[0080] F E =X g W Ei +b Ei .
[0081] First, construct the Chebyshev polynomial support set \(T\) k , and then use the support set to perform a convolution operation on the input features to obtain \(X\) g ; where \(T\) k represents the Chebyshev polynomial support set. \(G\) E represents the region graph. \(T\) k-1 represents the \((k - 1)\)-th order approximation of the Chebyshev polynomial of the region graph adjacency matrix. \(T\) k-2 represents the \((k - 2)\)-th order approximation of the Chebyshev polynomial of the region graph adjacency matrix. \(k\) represents the order of the Chebyshev polynomial currently being calculated. \(K\) represents the total order of the Chebyshev polynomial calculation, usually a hyperparameter used to control the "receptive field" of the graph convolution (i.e., the maximum adjacency distance that can propagate information). \(X\) g represents the output features of the region graph convolution. \(H\) represents the input features of the region graph convolution. \(F\) E represents the region graph features. \(W\) Ei represents the region weights. \(b\) Ei represents the region bias term.
[0082] Before step 101, it also includes: the process of constructing a traffic flow prediction model (steps 103 to 103).
[0083] Step 103: Construct a total data set based on historical traffic flow data. The total data set includes data pairs corresponding to multiple historical moments. Any data pair includes a historical sequence and a prediction sequence. The historical sequence is constructed based on the traffic flow data within the first preset time period before the corresponding historical moment. The label of the historical sequence is the time information of the historical sequence. The prediction sequence is constructed based on the traffic flow data within the second preset time period after the corresponding historical moment. The label of the prediction sequence is the time information of the prediction sequence.
[0084] Step 104: Divide the total dataset into a training dataset, a validation dataset, and a test dataset according to a preset ratio. Determine the lengths of the historical sequence and the prediction sequence according to the model requirements, and divide the original data. Each group of data includes a historical sequence, a prediction sequence, and their corresponding time information. Then, organize all the historical sequences, prediction sequences, and related time information into groups, and divide them into a training set and a test set for model training and evaluation. After data division, 60% of the data is used as the training set, 20% of the data is used as the validation set, and the remaining 20% is used as the test set to evaluate the model performance.
[0085] Step 105: Construct a self-supervised dynamic spatio-temporal graph convolutional network.
[0086] Step 106: Determine any historical sequence in the training dataset as the current historical sequence.
[0087] Step 107: Input the current historical sequence into the spatio-temporal graph construction unit to obtain an initial spatio-temporal traffic signal graph.
[0088] Step 108: Divide the current historical sequence and the initial spatio-temporal traffic signal graph into multiple time steps to obtain multiple dynamic graphs. Select training data from the training dataset and input it into the self-supervised dynamic spatio-temporal graph convolutional network SDSC. Combine the time data and the generated original adjacency matrix A E to generate the initial spatio-temporal traffic signal graph G p , and divide G p and the traffic flow data X into K time steps to construct the dynamic graph DG corresponding to each time step. i .
[0089] Step 109: Use the K-means clustering algorithm to cluster all the features in the original graph structure diagram to obtain multiple clusters. The original graph structure diagram is an intermediate quantity generated by the spatio-temporal graph construction unit.
[0090] Step 1010: Construct multiple regional graphs. The regional graphs correspond one-to-one with the clusters.
[0091] Use clustering analysis K-means to identify similar features in the original graph structure A E to construct the regional graph G E ;
[0092] c (i) = arg min k ||x (i) - μ k (t) || 2
[0093]
[0094] where x(i) represents the i-th data point, μ k (t) represents the position of the k-th cluster center in the t-th iteration, c (i) represents the cluster to which the i-th data point belongs, ||·|| 2 represents the square of the Euclidean distance. Data points are assigned to the cluster of the nearest cluster center through this formula. For each cluster, calculate the average value of all data points in the cluster and use this average value as the new cluster center, i.e., μ k (t-1) . Among them, I{*} is an indicator function, which returns 1 if the condition holds and 0 otherwise. v is the total number of data points. Repeat the above two formulas until the cluster centers no longer change or reach the predetermined number of iterations. The cluster labels to which each node belongs are obtained. Finally, based on these cluster labels, the sum of weights between nodes in the same cluster is statistically calculated for constructing a new graph structure, i.e., the regional graph G E .
[0095] Step 1011: Input multiple dynamic graphs into the spatio-temporal graph feature learning module to obtain dynamic graph features.
[0096] Step 1012: Input multiple regional graphs into the regional graph feature learning unit to obtain regional graph features.
[0097] Step 1013: Input both the spatio-temporal graph features and the regional graph features into the self-supervised learning module to obtain the predicted traffic flow prediction historical sequence.
[0098] Perform contrastive learning on the dynamic graph features and the regional graph features through self-supervised learning, and further transform through the fully connected layer to output the final prediction result.
[0099] The relevant formulas for performing contrastive learning are as follows:
[0100]
[0101] Among them, Z D and Z E are the original feature vectors F D and F E transformed into enhanced feature vectors through the feature transformation function. sim(Z D , Z E ) represents calculating the similarity between the enhanced feature and the positive sample pair, and sim(Z D , Z q ) represents the similarity between the enhanced feature and the negative sample. L InfoNCE is the InfoNCE contrastive loss. Among them, τ is a temperature parameter used to control the smoothness of the contrast, and Q is the number of negative samples.
[0102] After further transformation through the fully connected layer, the relevant formula for outputting the final prediction result is as follows:
[0103] Z combined =[Z D , Z E
[0104] Z out = ReLU(Z combined W combined + b comvbined ).
[0105]
[0106] Among them, Z combined represents the concatenation of the two features after contrastive learning, W combined and b combined are the weight and bias term for feature fusion respectively, W out and b out represent the weight and bias term of the output layer respectively, is the final prediction result.
[0107] Step 1014: Update the current historical sequence, and return to Step 107 until the training dataset is traversed to complete one iteration of training.
[0108] Step 1015: Update the parameters of the self-supervised dynamic spatio-temporal graph convolutional network, and return to Step 106 until the number of iterations reaches the preset number of iterations to obtain the to-be-determined traffic flow prediction model.
[0109] Step 1016: Use the validation dataset to verify and adjust the to-be-determined traffic flow prediction model to obtain the traffic flow prediction model.
[0110] Step 1017: Test the traffic flow prediction model using the test dataset.
[0111] Calculate the mean absolute error (MAE) and mean square error (MSE) between the predicted value and the prediction result, then perform backpropagation through the Adam optimizer to update the network parameters to obtain the trained self-supervised dynamic spatio-temporal graph convolutional network; with the help of the prediction sequence, calculate the mean absolute error (MAE) between this prediction sequence and the true sequence, and find the mean after obtaining the mean absolute error (MAE) of all groups of data to obtain the final MAE error representing the model performance.
[0112] To verify the effectiveness of the self-supervised dynamic spatio-temporal graph convolutional network (SDSC) for traffic flow prediction, it is verified through SDSC on two publicly available datasets (as shown in Table 1) of California highways in the United States: PeMS04 and PeMS08. These two datasets come from different time periods and geographical regions, covering a wide range of traffic conditions and road types: the PeMSD4 dataset reflects the traffic patterns in the early winter of 2018, while the PeMSD8 dataset provides data for the summer of 2016. This diversity in time and season ensures the representativeness of the data and also ensures that the model can be generalizable under different traffic conditions. In addition, the data provided by these two datasets has a high time resolution (collected every 5 minutes) and contains multiple key metrics (such as traffic flow, average speed, and occupancy rate), making the data highly representative both spatially and temporally.
[0113] Table 1 Dataset Table
[0114]
[0115] This experiment uses an 8G video memory Nvidia GeForce RTX 2070 GPU graphics card, the computer operating system is Windows10, the programming language used is Python 3.6.5, and the framework used is PyTorch. To ensure effective training and accuracy, the model was trained for 100 epochs and optimized using the Adam optimizer. Since graph convolutional operations and contrastive learning have high memory requirements, we set specific settings for different datasets: for the PEMSD4 dataset, the batch size is set to 10 and the learning rate is set to 0.0015. For the PEMSD8 dataset, the batch size is set to 32 and the learning rate is set to 0.003. To evaluate the performance, this application uses three evaluation metrics: (1) Mean Absolute Error (MAE), (2) Root Mean Square Error (RMSE), and (3) Mean Absolute Percentage Error (MAPE).
[0116] The error comparison between the model of this application and other models is shown in Table 2. The models in Table 2 include: Historical Average Model (HA): It makes predictions based on the average of historical observations. Autoregressive Integrated Moving Average Model (ARIMA): It combines autoregressive (AR), integration (I), and moving average (MA) techniques for modeling and predicting time series data. Vector Autoregression (VAR): A multivariate linear model for time series analysis and prediction. Temporal Graph Convolutional Network (T-GCN): It combines the Graph Convolutional Network (GCN) with a time series model to capture spatio-temporal relationships and dynamic changes in time series data. Spatio-Temporal Graph Convolutional Network (STGCN): It uses GCN and Convolutional Neural Network (CNN) to capture spatio-temporal dependencies in spatio-temporal data. Attention-based Spatio-Temporal Graph Convolutional Network (ASTGCN): It combines GCN and an attention mechanism to capture spatio-temporal dependencies and adaptively learn important spatio-temporal features. Spatio-Temporal Synchronous Graph Convolutional Network (STSGCN): It synchronously processes the spatial and temporal dimensions to capture correlations and evolutions in spatio-temporal data. Spatio-Temporal Complex Graph Convolutional Network (ST-CGCN): It integrates GCN and Long Short-Term Memory (LSTM) to represent the dynamic spatio-temporal features of complex correlation matrices. GraphWaveNet: It combines a graph neural network and a wavelet network model, and uses an adaptive matrix to extract hidden spatial features. Spatio-Temporal Fusion Graph Neural Network (STFGNN): It introduces a fusion mechanism to effectively integrate spatial and temporal information. Adaptive Graph Convolutional Recurrent Network (AGCRN): It combines an attention mechanism, GCN, and a Recurrent Neural Network (RNN) to adaptively learn the important relationships between nodes in a traffic network, thereby improving prediction performance. Spatio-Temporal Graph ODE Network (STGODE): It integrates GNN and an Ordinary Differential Equation (ODE) to capture the dynamic evolution process in spatio-temporal data. Temporal-Aware Zigzag Topology Layer (Z-GCNETs): It proposes the concept of temporal zigzag persistence to learn the temporal graph structure and improve performance. Spatio-Temporal Graph Neural Controlled Differential Equation (STG-NCDE): It uses two differential neural control equations to separately process the time and space dimensions of traffic prediction. Temporal Branch Convolutional Graph Neural ODE Network (TBC-GNODE): It combines Spatio-Temporal Branch Convolution (TBC) and Graph Neural ODE, and applies a refined graph neural differential equation to simulate the dynamic changes of traffic flow. Spatio-Temporal Heterogeneous Synchronous Graph Convolutional Network (STHSGCN): It designs a separate extended causal spatio-temporal synchronous graph convolutional network and deploys different modules to reflect spatial and temporal heterogeneity, and proposes a causal spatio-temporal synchronous graph (CSTSG) to capture the temporal causal relationship in spatio-temporal synchronous learning. Spatio-Temporal Fusion Graph Convolutional Network (STFGCN): It introduces graph convolutional operations for specific nodes to learn specific node patterns and uses an adaptive adjacency matrix to represent the interdependencies between traffic sequences.It also includes a continuous-time correlation learning module and a Transformer-based global time correlation learning module to capture the continuous and global time correlations in the traffic sequence.
[0117] Table 2 Comparison Results Table
[0118]
[0119]
[0120] Table 2 lists the comparison results of the model of this application with 17 other benchmark models. All models were evaluated on the PeMSD4 and PeMSD8 datasets. Table 2 shows that the model of this application achieved the best performance within 12 time steps. The model of this application is significantly better than traditional models such as HA, ARIMA, and VAR. Although these traditional methods can handle time series data, they have obvious deficiencies in modeling non-linear relationships and only focus on the time dimension, completely ignoring the spatial correlations of traffic flow data. Therefore, these methods perform poorly in dealing with complex traffic networks and are difficult to capture the potential correlations between different regions. The SDSC model overcomes these shortcomings by introducing an adaptive neighborhood structure and a dynamic graph convolution module, and can capture complex traffic flow characteristics more comprehensively. Compared with fixed neighborhood methods (such as STGCN, T-GCN, ASTGCN, STSGCN, etc.), the SDSC model is more adaptable to the dynamic changes of traffic networks. The SDSC model overcomes the limitations of these methods in modeling long-term and short-term dependencies by introducing a dynamic neighborhood structure and a recursive dynamic graph convolution (RDGC) module, thus significantly improving the model's ability to cope with the dynamic changes of traffic networks. Compared with methods using adaptive structures (such as GraphWaveNet, STFGNN, and AGCRN, etc.), the SDSC model also shows greater advantages in dealing with regional dependencies. SDSC can better understand and utilize the complex traffic flow relationships between different regions through cluster analysis. At the same time, the self-supervised learning mechanism of SDSC can maximize the mutual information between the dynamic graph and the regional graph, thus significantly improving the prediction accuracy and the robustness of the model.
[0121] Table 3 Ablation Experiment Table
[0122]
[0123]
[0124] According to the ablation experiment results of w / ocluster shown in Table 3, the performance of this variant significantly decreases on the PeMSD4 and PeMSD8 datasets. This indicates that constructing the regional graph using proximity instead of clustering cannot effectively capture cross-regional semantic relationships, resulting in an increase in prediction errors. The lack of cluster analysis affects the model's ability to capture cross-regional traffic flow, reducing the accuracy of constructing the regional graph. The ablation results of w / ocompare show that the model performance decreases after omitting the self-supervised learning module. This highlights the importance of comparative learning in capturing and integrating dynamic graph features. Without this mechanism, the model cannot effectively utilize the mutual information between the two graph networks, leading to a decrease in prediction accuracy. The results of w / oRDGC show that the model performance significantly decreases after removing the recursive dynamic graph convolution module. This result indicates that the RDGC module is crucial for capturing the spatio-temporal changes of dynamic graph features, and the lack of this module will seriously affect the model's ability to understand and process dynamic relationships. w / oGCN: Using simple graph convolution instead of graph convolution based on Chebyshev polynomials leads to a performance decrease. This shows that graph convolution based on Chebyshev polynomials has significant advantages in extracting features from the regional graph and can more accurately capture the complex relationships between regions. From the results of w / oAttention, it can be seen that the model without the attention mechanism performs poorly. This highlights the importance of the attention mechanism in constructing dynamic graphs, which can effectively adjust the importance of dynamic information and improve the model's prediction ability (three metrics are used to evaluate the performance: mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE)).
[0125] This application constructs a hierarchical neural network architecture and models from two perspectives: regional dependence and dynamic spatio-temporal changes, successfully addressing the deficiencies of existing traffic flow prediction models in capturing cross-regional dependencies and spatio-temporal features, and significantly improving the prediction accuracy and the generalization ability of the model. The construction of the regional graph is based on a clustering technique of geographical correlation, effectively making up for the problem that traditional traffic network models ignore cross-regional dependencies. Combining the graph convolutional network (GCN) and Chebyshev polynomial convolution further enhances the ability to capture the correlation features between cross-regional nodes and improves the adaptability of the model in complex traffic networks. Through the recursive dynamic graph convolution module, this application can flexibly capture the dynamic changes of traffic flow in time and space. By using multi-step time signal input, it realizes the accurate modeling of short-term and long-term changes in traffic flow, greatly enhancing the prediction ability. This application introduces a self-supervised learning mechanism, which further improves the learning effect of the model by maximizing the mutual information between the features of the dynamic graph and the regional graph. This mechanism not only enhances the robustness of the model in various complex traffic scenarios but also improves the interpretability of the model, enabling it to comprehensively consider the spatio-temporal characteristics of traffic flow from both global and local perspectives and ensuring more comprehensive and accurate traffic flow prediction. As the creative auxiliary evidence of the claims of this application, it is also reflected in the following important aspects: (1) The expected benefits and commercial value after the transformation of the technical solution of this application are as follows: In terms of smart city construction: This application can be applied to the urban traffic management system to optimize traffic signal control and reduce congestion. For example, in the dynamic vehicle flow scheduling during peak hours, using the model of this application, it is possible to predict future traffic flow changes, intelligently adjust the traffic signal timing sequence, reduce the average waiting time, and improve the overall traffic efficiency. For instance, in the downtown area of a large city, the model of this application can predict in advance the traffic flow on a certain main road during the morning rush hour, and dynamically adjust the switching frequency of traffic lights according to the real-time traffic conditions and historical data, thus alleviating traffic pressure and reducing vehicle queuing time. In terms of autonomous driving and intelligent transportation: This application can provide high-precision traffic flow prediction data for autonomous vehicles, enabling the vehicles to conduct autonomous scheduling and route planning according to real-time traffic conditions, avoiding entering traffic jam areas, and improving the stability and safety of the autonomous driving system. For example, autonomous vehicle companies can use the technology of this application to intelligently select the fastest route on crowded urban roads, thereby reducing vehicle travel time and improving the operation efficiency of the vehicle fleet. In terms of optimizing public transportation: This application can help urban public transportation management departments reasonably allocate vehicles and human resources, optimize route planning, and avoid problems such as resource waste or improper scheduling by accurately predicting the passenger flow of buses and subways. For example, in the subway system of a certain city, through the accurate prediction of passenger flow, it is possible to allocate extra trains to peak-hour lines in advance, reducing waiting time and improving the passenger experience.
[0126] The present application overcomes the limitations of traditional methods in capturing complex spatiotemporal dependencies and can accurately capture and predict subtle changes in traffic flow in dynamically changing traffic environments. Traditional GCN models are usually based on static graph structures, which limits their adaptability in highly dynamic environments. For example, when emergencies or traffic patterns change rapidly, the fixed graph structure may not be able to adapt in time, resulting in the model being unable to fully capture new dynamic dependencies, thereby affecting the accuracy of the prediction. In addition, since the convolution operation of GCN is mainly concentrated on local nodes and their adjacent nodes, the information of inter-regional dependencies gradually decays during the propagation process, resulting in the model's poor performance in capturing long-distance inter-regional dependencies. This limitation makes it difficult for GCN to fully utilize important information between functionally related but spatially distant regions. (3) The technical solution of the present application solves a technical problem that people have long been eager to solve but have never been successful: The present application adopts a hierarchical structure to simulate a dynamic graph of geographical regions and traffic networks. The construction of the regional graph mainly utilizes the traffic network, and clustering methods are used to aggregate road sections or regional nodes with similar geographical locations or functions into regional graph nodes. This method effectively overcomes the limitation of traditional traffic network models that ignore inter-regional dependencies through cross-regional modeling. In this way, the SDSC model is able to capture the cross-regional dependencies between different regions, thereby improving the performance of the model in global traffic flow prediction. In addition, the SDSC model also combines temporal information with dynamic signals to generate a dynamic graph without prior knowledge. Then, it extracts the spatiotemporal correlations in the dynamic graph through a recursive dynamic graph convolution module. This dynamic graph modeling method avoids the limitation of predefined graph structure and can flexibly cope with the dynamic changes of the traffic network. Compared with the traditional method based on static adjacency matrix, the SDSC model can better cope with the fluctuations of the traffic network, thereby improving the robustness of the prediction. Finally, by designing a self-supervised learning module based on dynamic graph and regional graph, the SDSC model can maximize the mutual information between the two views, so that the SDSC model can effectively learn traffic flow characteristics from multiple perspectives, thereby improving the generalization ability and accuracy of the model. This design is not only applicable to urban areas with similar functions but dispersed geographical locations (such as similar traffic patterns between commercial and business districts), but also to urban traffic environments with complex and heterogeneous traffic patterns.
[0127] In an exemplary embodiment, a computer device is provided, which may be a server or a terminal. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a self-supervised dynamic spatio-temporal graph traffic flow prediction method is implemented.
[0128] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, which when executed by a processor implements the steps in the above method embodiments.
[0129] In an exemplary embodiment, a computer program product is provided, including a computer program, which when executed by a processor implements the steps in the above method embodiments.
[0130] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0131] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random-access memories (ReRAM), magnetoresistive random-access memories (MRAM), ferroelectric random-access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0132] The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.
[0133] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0134] Specific examples are used in this article to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A self-supervised dynamic spatiotemporal graph traffic flow prediction method, characterized in that: include: Acquire a current traffic flow sequence; the current traffic flow sequence is constructed based on traffic flow data within a first preset time period before the current moment; Input the current traffic flow sequence into the traffic flow prediction model to obtain the current traffic flow prediction sequence; The current traffic flow prediction sequence includes: traffic flow prediction data within a second preset time period after the current moment; the traffic flow prediction model is obtained by training a self-supervised dynamic spatiotemporal graph convolutional network using historical traffic flow data; the self-supervised dynamic spatiotemporal graph convolutional network includes: a dual-branch graph feature extraction structure and a self-supervised learning module connected in sequence; the dual-branch graph feature extraction structure includes a parallel spatiotemporal graph branch and a regional graph branch.
2. The self-supervised dynamic spatiotemporal graph traffic flow prediction method according to claim 1, characterized in that: The spatiotemporal graph branch includes a spatiotemporal graph construction unit and a spatiotemporal graph feature learning module connected in sequence; the spatiotemporal graph feature learning module is a recursive dynamic graph convolutional network; the recursive dynamic graph convolutional network includes multiple spatiotemporal dynamic graph convolution gating mechanisms.
3. The self-supervised dynamic spatiotemporal graph traffic flow prediction method according to claim 2, characterized in that: The region graph branch includes a region graph construction unit and a region graph feature learning unit connected in sequence; the region graph feature learning unit is a graph convolution network based on Chebyshev polynomials.
4. The self-supervised dynamic spatiotemporal graph traffic flow prediction method according to claim 3, characterized in that: Before obtaining the current traffic flow sequence, it also includes: A total data set is constructed based on historical traffic flow data; the total data set includes data pairs corresponding to multiple historical moments; any of the data pairs includes a historical sequence and a predicted sequence; the historical sequence is constructed based on traffic flow data within a first preset time period before the corresponding historical moment; the label of the historical sequence is the time information of the historical sequence; the predicted sequence is constructed based on traffic flow data within a second preset time period after the corresponding historical moment; the label of the predicted sequence is the time information of the predicted sequence; Dividing the total data set into a training data set, a validation data set and a test data set according to a preset ratio; Constructing a self-supervised dynamic spatiotemporal graph convolutional network; Determine any historical sequence in the training data set as the current historical sequence; Input the current historical sequence into the spatiotemporal graph construction unit to obtain an initial spatiotemporal traffic signal graph; Divide the current historical sequence and the initial spatiotemporal traffic signal graph into multiple time steps to obtain multiple dynamic graphs; Using the K-means clustering algorithm to cluster all features in the original graph structure diagram to obtain multiple clusters; the original graph structure diagram is an intermediate quantity generated by the spatiotemporal graph construction unit; Constructing a plurality of region maps; the region maps correspond one-to-one to the clusters; Input multiple dynamic graphs into the spatiotemporal graph feature learning module to obtain dynamic graph features; Inputting multiple region maps into a region map feature learning unit to obtain region map features; Inputting the spatiotemporal graph features and the regional graph features into a self-supervised learning module to obtain a predicted traffic flow prediction history sequence; Update the current historical sequence, and return to the step of "inputting the current historical sequence into the spatiotemporal graph construction unit to obtain an initial spatiotemporal traffic signal graph" until the training data set is traversed and one iteration of training is completed; Update the parameters of the self-supervised dynamic spatiotemporal graph convolutional network and return to the step "determine any historical sequence in the training data set as the current historical sequence" until the number of iterations reaches the preset number of iterations and the pending traffic flow prediction model is achieved; Using the verification data set to verify and adjust the pending traffic flow prediction model to obtain a traffic flow prediction model; The traffic flow prediction model is tested using the test data set.
5. The self-supervised dynamic spatiotemporal graph traffic flow prediction method according to claim 4, characterized in that: The space-time graph construction unit is: L i =MLP(X′ i ); W i =Attention(L i ) DG i =tanh(W i ×G i ); Among them, L i represents the feature matrix output after the fused input data is input to the MLP layer; MLP(*) represents the multi-layer perceptron; X i ′ represents the fused input data of the i-th time step, and the fused input data is the input data X of the i-th time step i and the dynamic feature H of the i-1th time step i-1 After combining; W i represents the weight matrix of the i-th time step; Attention(*) represents the Attention module; DG i represents the space-time graph of the i-th time step; tanh(*) represents the cross-feature method; G i Represents the traffic graph at the i-th time step.
6. The self-supervised dynamic spatiotemporal graph traffic flow prediction method according to claim 5, characterized in that: The spatiotemporal graph feature learning module is: r i =σ([x i ,h i-1 ]S i W r +b r ); z i =σ([x i ,h i-1 ]S i W z +b z ); c i =tanhh([x i ,h i-1 ⊙r i ]S i W c +b c ); F D i =from i ☉h i-1 +(1-z i )☉c i ; Among them, D i represents the diagonal matrix of the i-th time step; A represents the adjacency matrix of the graph; ReLU(*) represents the ReLU activation function; S i Represents the output features of spatiotemporal dynamic graph convolution operation; I N represents the identity matrix; X∈R N×D Represents the input features of dynamic graph convolution; G i ⊙W Ni Represents the weight tensor W Ni With the traffic signal graph G containing time information i Update changes; ⊙ represents the splicing operation; G i ⊙b Ni Represents the weight tensor b Ni With the traffic signal graph G containing time information i Update changes; i represents the reset gate of the current time step; σ represents the sigmoid activation function, x i represents the input data of the i-th time step; h i-1 represents the hidden state of the previous time step; W r represents the first learnable parameter; b r represents the second learnable parameter; z i represents the update gate of the current time step; W z represents the third learnable parameter; b z represents the fourth learnable parameter; c i Indicates an intermediate temporary variable; W c represents the fifth learnable parameter; b c represents the sixth learnable parameter; F D i represents the dynamic characteristics of the i-th time step; F D represents the dynamic graph features; m represents the number of time steps.
7. The self-supervised dynamic spatiotemporal graph traffic flow prediction method according to claim 6, characterized in that: The regional map feature learning unit is: T k =2G E T k-1 -T k-2 ,k≥2; F E =X g W Ei +b Ei ; Among them, T k represents the support set of Chebyshev polynomials; G E Represents a regional graph; T k-1 represents the k-1 order approximation of the Chebyshev polynomials of the region graph adjacency matrix; similarly, T k-2 Represents the k-2 order approximation of the Chebyshev polynomial of the region graph adjacency matrix; k represents the order of the Chebyshev polynomial currently being calculated; K represents the total order of the calculated Chebyshev polynomial, which is usually a hyperparameter used to control the "receptive field" of the graph convolution (that is, the maximum adjacency distance that can propagate information); X g represents the output features of the regional graph convolution; H represents the input features of the regional graph convolution; F E Represents the regional map features; W Ei represents the regional weight; b Ei Represents the regional bias term.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the self-supervised dynamic spatiotemporal graph traffic flow prediction method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the self-supervised dynamic spatiotemporal graph traffic flow prediction method described in any one of claims 1 to 7 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the self-supervised dynamic spatiotemporal graph traffic flow prediction method described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Transportation junction crowd counting method and system based on multi-scale cross-region graph convolution driving
CN121392731A
Traffic hub crowd counting method and system based on multi-scale cross-region graph convolution driving
CN121392731B