A traffic flow prediction method based on time convolution network and dynamic graph fusion
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-18
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]一是大多数方法不能建模交通流的长期依赖关系,使预测方法本身存在一定的局限性;
[0073] 1. This invention further improves the prediction accuracy of traffic flow forecasting.
Smart Images

Figure CN122548690A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic flow prediction, and more particularly to a traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs. Background Technology
[0002] Temporal Convolutional Networks (TCNs) are deep learning models for processing time-series data. They utilize one-dimensional convolutional structures to model sequences and capture long-term dependencies through causal convolution and dilated convolution. Dynamic graphs are graph structures that change over time, capable of depicting the topological relationships of road networks. Combining TCNs with dynamic graphs not only captures the long-term temporal dependencies of traffic flow but also effectively extracts spatially hidden feature information, improving the accuracy of traffic flow prediction. In real-world traffic scenarios, traffic data is often affected by sudden events in the traffic network, causing significant shifts in traffic pattern distribution. This makes it difficult to learn the periodic trends of traffic data, thus making accurate traffic flow prediction still challenging. While most current traffic flow prediction methods have achieved good results, they still suffer from the following problems:
[0003] First, most methods cannot model the long-term dependencies of traffic flow, which limits the predictive methods themselves.
[0004] Secondly, in complex traffic environments, most methods are insufficient in their ability to extract high-dimensional and complex data, and often tend to overlook hidden spatial feature information.
[0005] Third, most methods still treat traffic flow data as a whole, rather than performing spatiotemporal modeling of traffic data from a decoupling perspective.
[0006] In summary, based on the shortcomings of current traffic flow prediction methods, the inventors have developed a traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs. Summary of the Invention
[0007] The purpose of this invention is to address the shortcomings of the prior art by providing a traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs, which aims to further improve the prediction accuracy of traffic flow.
[0008] To solve the above problems, the technical solution adopted by the present invention is as follows:
[0009] A traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs includes the following steps:
[0010] S1, acquire raw traffic flow data and preprocess it to obtain preprocessed traffic flow data;
[0011] S2, in the wavelet decoupling layer, uses discrete wavelet transform to decompose the preprocessed traffic flow data into one low-frequency component and multiple high-frequency components, and then reconstructs them into stable trend signals through inverse discrete wavelet transform. and fluctuating event signals ;
[0012] S3 will provide trend signals and event signals Collectively referred to as signals , will signal Convert to And introduce a periodic embedding matrix and daily periodic embedding matrix ,based on , and Obtain time embedding output , include and ;
[0013] S4, sequentially embeds the output into the time frame. and Temporal and spatial features were extracted, and the results were obtained respectively. and ;
[0014] S5, and Perform feature fusion to obtain fused features And based on fusion features Predictive regression is used to obtain predicted traffic signals. .
[0015] Preferably, the original traffic flow data in S1 includes PeMS03, PeMS04, PeMS07 and PeMS08, which are preprocessed to obtain preprocessed PeMS03, preprocessed PeMS04, preprocessed PeMS07 and preprocessed PeMS08.
[0016] Preferably, the preprocessing in S1 includes redundant data removal, abnormal data repair, missing data completion, data denoising, data normalization and standardization, and data integration and partitioning.
[0017] Preferably, step S2 includes the following steps:
[0018] Assuming the preprocessed traffic flow signal is ,Will Decomposed into a low-frequency component and a high-frequency component Next, the low-frequency components Further decomposed into a low-frequency component and a high-frequency component Input preprocessed traffic flow signals The processing procedure is represented as follows:
[0019] ;
[0020] ;
[0021] ;
[0022] in, and These are the low-pass and high-pass filters for wavelets, respectively. This represents the convolution operation. This indicates that the output is downsampled by two times;
[0023] Convert all high-frequency components into a fluctuating event signal. The low-frequency components are then converted into a stable trend signal. The process is as follows:
[0024] ;
[0025] ;
[0026] in, and These represent the inverse low-pass filter and inverse high-pass filter of the wavelet, respectively, and the trend signal. Event signal .
[0027] Preferably, the S3 based on , and Obtain time embedding output The process is as follows:
[0028] ;
[0029] in, The total number of channel features, To expand the number of feature channels, The dimension representing the time embedding is 7, where 7 represents the number of days in a week, and 288 represents the number of records per day for a single traffic node at five-minute intervals.
[0030] Preferably, step S4 includes the following steps:
[0031] S41. Temporal feature extraction;
[0032] S411, Trend Signal Temporal features are extracted through multiple layers of dilated causal convolution, followed by activation functions and Dropout, and then residual connections are performed. The process is as follows:
[0033] ;
[0034] ;
[0035] ;
[0036] in, Represents the number of TCNBlocks. This represents the projection residual function, followed by the output result. After passing through a feedforward network and a layer normalization, a learned representation of the trend signal is obtained. The process is as follows:
[0037] ;
[0038] S412, Send event signal The process involves performing a causal convolution operation, followed by ReLU activation and Dropout, as follows:
[0039] ;
[0040] ;
[0041] in, For time steps, To use a convolution kernel size of A filter with a step size of 1;
[0042] Steps S413, S411, and S412 respectively obtain the learned representation of the long-term trend signal of traffic flow. Learning representations of short-term event signals ;
[0043] S42, Spatial Feature Extraction;
[0044] S421. Use a fully connected layer to process the trend signal with extracted time features. and event signals Perform a nonlinear mapping to obtain a hidden representation that eliminates the time dimension. The process is as follows:
[0045] ;
[0046] ;
[0047] in, , , and These represent the corresponding fully connected parameters. Represents the activation function;
[0048] S422, Trend Signal After passing through the dynamic adjacency matrix respectively and the adaptive adjacency matrix obtained through node learning The process is as follows:
[0049] ;
[0050] ;
[0051] in, Represents learnable parameters. Represents row index, Represents column index, This means retaining the row with the highest weight. The elements are set to zero, and the remainder is set to zero to ensure the sparsity of the adjacency matrix. This is achieved by dynamically adjusting the adjacency matrix. and adaptive adjacency matrix The outputs are fused into a dynamic trend adjacency matrix through a fully connected layer. The process is as follows:
[0052] ;
[0053] in, Indicates a fully connected layer;
[0054] Finally, output ;
[0055] S423, Send event signal After passing through the dynamic adjacency matrix respectively and the adaptive adjacency matrix obtained through node learning The process is as follows:
[0056] ;
[0057] ;
[0058] in, Represents learnable parameters. Represents row index, Represents column index, This means retaining the row with the highest weight. The elements are set to zero, and the remainder is set to zero to ensure the sparsity of the adjacency matrix. This is achieved by dynamically adjusting the adjacency matrix. and adaptive adjacency matrix The outputs are fused into a dynamic trend adjacency matrix through a fully connected layer. The process is as follows:
[0059] ;
[0060] in, Indicates a fully connected layer;
[0061] Final output ;
[0062] S424, output from S422 and S423 output Spatial correlations are captured using a spatiotemporal graph convolution module, as follows:
[0063] ;
[0064] ;
[0065] in, For activation function, and To add the adjacency matrix after adding self-loops, and They are respectively and The corresponding degree matrix, and It is a symmetric normalized Laplace matrix. and These are learnable parameters.
[0066] Preferably, step S5 includes the following steps:
[0067] The output of step S424 is then subjected to feature fusion, as follows:
[0068] ;
[0069] in, These represent the time steps. Trend characteristics and event characteristics, It is a spatiotemporal representation after feature fusion, making Predictive traffic signals are obtained through predictive regression using a predictive regression layer. The process is as follows:
[0070] ;
[0071] in, This indicates a predicted traffic signal.
[0072] The beneficial effects of adopting the above technical solution are as follows:
[0073] 1. This invention further improves the prediction accuracy of traffic flow forecasting.
[0074] 2. This invention can capture the long-term temporal dependencies of traffic flow through temporal convolutional networks, thus overcoming the limitation of the method itself in being unable to capture long-term dependencies.
[0075] 3. This invention integrates the learned adaptive adjacency matrix with the data-driven dynamic adjacency matrix, which can both utilize the prior knowledge of the static structure and dynamically adapt to real-time traffic changes, thereby improving the method's ability to mine spatial hidden information.
[0076] 4. This invention designs a dual-stream signal spatiotemporal encoder to independently model the trend signal and event signal decomposed by the wavelet decoupling layer. From a decoupling perspective, traffic data is processed more finely, further improving prediction performance. Attached Figure Description
[0077] Figure 1 This is a schematic diagram of the prediction model used in the prediction method of the present invention.
[0078] Figure 2 This is a schematic diagram of the preprocessing process in an embodiment of the present invention;
[0079] Figure 3 This is a schematic diagram of the architecture of the dual-stream signal spatiotemporal encoder in an embodiment of the present invention (temporal feature extraction and spatial feature extraction).
[0080] Figure 4 This is a schematic diagram of the prediction results given in an embodiment of the present invention. Detailed Implementation
[0081] The embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and should not be construed as limiting the scope of the invention.
[0082] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0083] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0084] This embodiment is disclosed with the aim of further improving the prediction accuracy of traffic flow forecasting.
[0085] To implement this method, this embodiment constructs a prediction model, referring to... Figure 1 The prediction model includes a wavelet decoupling layer, a time embedding layer, a two-stream signal spatiotemporal encoder, and a spatiotemporal decoder. The specific process of traffic prediction is illustrated below with concrete examples:
[0086] Specifically, refer to Figures 1 to 3 The traffic flow prediction method includes the following steps:
[0087] S1, acquire raw traffic flow data and preprocess it to obtain preprocessed traffic flow data;
[0088] Specifically, the original traffic flow data includes PeMS03, PeMS04, PeMS07, and PeMS08, which are then preprocessed to obtain preprocessed PeMS03, preprocessed PeMS04, preprocessed PeMS07, and preprocessed PeMS08.
[0089] Preprocessing includes redundant data removal, abnormal data repair, missing data completion, data denoising, data normalization and standardization, and data integration and partitioning.
[0090] PeMS03: This data originates from California, USA, and mainly records traffic flow data for 91 days from September 1, 2018 to November 30, 2018. There are 358 sensors, each with a time step of 5 minutes, for a total of 26,208 time steps.
[0091] PeMS04: This data originates from the San Francisco Bay Area in the United States and mainly records traffic flow data for 59 days, from January 1, 2018 to February 28, 2018. There are 307 sensors, each with a time step of 5 minutes, for a total of 16,992 time steps.
[0092] PeMS07: This data originates from California, USA, and mainly records traffic flow data for 123 days from May 1, 2017 to August 31, 2017. There are 883 sensors, each with a time step of 5 minutes, for a total of 28,224 time steps.
[0093] PeMS08: This dataset records traffic flow data for the San Bernardino area of the United States from July 1, 2016 to August 31, 2016, for a period of two months. It contains 170 sensors, each with a time step of 5 minutes, for a total of 17,856 time steps.
[0094] The preprocessed traffic flow data was divided into training, validation, and test sets in a 6:2:2 ratio.
[0095] S2, in the wavelet decoupling layer, uses discrete wavelet transform to decompose the preprocessed traffic flow data into one low-frequency component and multiple high-frequency components, and then reconstructs them into stable trend signals through inverse discrete wavelet transform. and fluctuating event signals ;
[0096] Traffic flow is decomposed into stable trend signals and fluctuating event signals using Discrete Wavelet Transform (DWT), with the two signals remaining independent of each other. For simplicity, a two-layer DWT will be used as an example for explanation.
[0097] Assuming the preprocessed traffic flow signal is ,Will Decomposed into a low-frequency component and a high-frequency component Next, the low-frequency components Further decomposed into a low-frequency component and a high-frequency component Input preprocessed traffic flow signals The processing procedure is represented as follows:
[0098] ;
[0099] ;
[0100] ;
[0101] in, and These are the low-pass and high-pass filters for wavelets, respectively. This represents the convolution operation. This indicates that the output is downsampled by two times;
[0102] Among them, subscript Indicates low frequency. High frequencies are represented by the frequency component. Low-frequency components correspond to stable trend signals in the traffic network, while high-frequency components correspond to fluctuating event signals in the traffic network. Therefore, multi-level DWTs and appropriate wavelet basis functions (such as Coiflets) can be used to obtain sufficiently smooth low-frequency components for constructing trend signals and high-frequency components for constructing event signals.
[0103] It is worth noting that the downsampling operation in DWT reduces the number of time slices for both low-frequency and high-frequency components. Therefore, to keep the length consistent with the input, an upsampling-based inverse discrete wavelet transform (IDWT) is used to reconstruct the data into a complete time-domain signal.
[0104] Convert all high-frequency components into a fluctuating event signal. The low-frequency components are then converted into a stable trend signal. The process is as follows:
[0105] ;
[0106] ;
[0107] in, and These represent the inverse low-pass filter and inverse high-pass filter of the wavelet, respectively, and the trend signal. Event signal .
[0108] Finally, the trend signal obtained through the wavelet decoupling layer and event signals Parallel processing will be performed in the following steps.
[0109] S3 will provide trend signals and event signals Collectively referred to as signals , will signal Convert to And introduce a periodic embedding matrix and daily periodic embedding matrix ,based on , and Obtain time embedding output , include and ;
[0110] The temporal embedding layer aims to transform the input signal into a higher-dimensional representation to enhance the method's ability to perceive complex spatiotemporal features.
[0111] and Collectively referred to as It is converted through a fully connected layer This paper introduces a learnable periodic embedding to integrate prior temporal knowledge into the model. Specifically, traffic data is mapped to a learnable periodic embedding matrix. and daily periodic embedding matrix Next, time indexing and broadcasting operations are performed on the input data, and the time embedding vector is obtained using these two time embedding matrices. and Finally, With two temporal embedding vectors and The splicing process is as follows:
[0112] based on , and Obtain time embedding output The process is as follows:
[0113] ;
[0114] in, The total number of channel features, To expand the number of feature channels, This indicates the dimension of time embedding, where 7 represents the number of days in a week, and 288 represents the number of records per day for a single traffic node at five-minute intervals. For ease of subsequent description, let's use... These are high-dimensional representations of the trend signal and event signal obtained after processing by the fully connected layer and the temporal embedding layer, respectively.
[0115] S4, sequentially embeds the output into the time frame. and Temporal and spatial features were extracted, and the results were obtained respectively. and ;
[0116] S41. Temporal feature extraction;
[0117] Unlike previous methods that used a single approach to extract temporal features, dual-flow signal spatiotemporal coding can independently model trend signals and event signals, because these two signals have fundamentally different temporal attributes. Specifically, trend signals are continuous and stable, containing long-term patterns and inherent periodicity in traffic flow; while event signals are fluctuating and sudden, reflecting short-term fluctuations in the traffic network. Therefore, this method uses temporal convolutional networks and causal convolutions with small kernels to extract the temporal features of trend signals and event signals, respectively.
[0118] On the one hand, trend signals are modeled by using temporal convolutional networks. This network stacks three TCNBlock modules, and each TCNBlock module itself contains three layers of dilated convolutions, thus forming a deep temporal network framework that can effectively extract hidden temporal features from trend signals. TCNBlocks can be computed in parallel, which has significant advantages, especially in processing long-term series data.
[0119] S411, Trend Signal Temporal features are extracted through multiple layers of dilated causal convolution, followed by activation functions and Dropout, and then residual connections are performed. The process is as follows:
[0120] ;
[0121] ;
[0122] ;
[0123] in, Represents the number of TCNBlocks. This represents the projection residual function, followed by the output result. After passing through a feedforward network and a layer normalization, a learned representation of the trend signal is obtained. The process is as follows:
[0124] ;
[0125] On the other hand, causal convolution with small kernels can be used to model event signals. Event signals typically manifest as brief and localized fluctuations (such as traffic accidents or sudden congestion), involving only a few consecutive time segments. Causal convolution, however, can effectively capture short-term dynamic changes in event signals by limiting the receptive field to historical data. Specifically, causal convolution is a one-dimensional convolution, which can be viewed as a local window filter sliding along the time dimension without altering the shape of the time series. It relies only on current and past time segments, ensuring the model is unaffected by future information.
[0126] S412, Send event signal The process involves performing a causal convolution operation, followed by ReLU activation and Dropout, as follows:
[0127] ;
[0128] ;
[0129] in, For time steps, To use a convolution kernel size of A filter with a step size of 1;
[0130] Steps S413, S411, and S412 respectively obtain the learned representation of the long-term trend signal of traffic flow. Learning representations of short-term event signals .
[0131] S42, Spatial Feature Extraction;
[0132] This method designs a dynamic graph fusion convolution module to capture the spatial hidden features of long-term trend signals and short-term event signals.
[0133] S421. Use a fully connected layer to process the trend signal with extracted time features. and event signals Perform a nonlinear mapping to obtain a hidden representation that eliminates the time dimension. The process is as follows:
[0134] ;
[0135] ;
[0136] in, , , and These represent the corresponding fully connected parameters. Represents the activation function;
[0137] Next, for the processing of trend signals, this method proposes a dynamic graph convolution strategy that integrates dynamic correlation and global structure.
[0138] Specifically, this strategy will use a data-driven dynamically generated adjacency matrix. and the adaptive adjacency matrix obtained through node learning Fusion is performed to capture spatial structure features in trend signals. Adaptive adjacency matrix. It is constructed using learnable node embeddings to model the static global structure of traffic networks. However, while it effectively captures static topology, its parameters become fixed after training, making it difficult to adapt to dynamically changing inputs, thus limiting the model's generalization ability. In contrast, dynamic adjacency matrices... This is generated based on the dynamic correlation of the input data, and can dynamically reflect changes in the road network structure. Fusing the two allows us to utilize prior knowledge of the static structure while dynamically adapting to real-time traffic changes, thereby improving the method's ability to model complex traffic scenarios. The fusion process is as follows:
[0139] S422, Trend Signal After passing through the dynamic adjacency matrix respectively and the adaptive adjacency matrix obtained through node learning The process is as follows:
[0140] ;
[0141] ;
[0142] in, Represents learnable parameters. Represents row index, Represents column index, This means retaining the row with the highest weight. The elements are set to zero, and the remainder is set to zero to ensure the sparsity of the adjacency matrix. This is achieved by dynamically adjusting the adjacency matrix. and adaptive adjacency matrix The outputs are fused into a dynamic trend adjacency matrix through a fully connected layer. The process is as follows:
[0143] ;
[0144] in, Indicates a fully connected layer;
[0145] Finally, output ;
[0146] S423, Send event signal After passing through the dynamic adjacency matrix respectively and the adaptive adjacency matrix obtained through node learning The process is as follows:
[0147] ;
[0148] ;
[0149] in, Represents learnable parameters. Represents row index, Represents column index, This means retaining the row with the highest weight. The elements are set to zero, and the remainder is set to zero to ensure the sparsity of the adjacency matrix. This is achieved by dynamically adjusting the adjacency matrix. and adaptive adjacency matrix The outputs are fused into a dynamic trend adjacency matrix through a fully connected layer. The process is as follows:
[0150] ;
[0151] in, Indicates a fully connected layer;
[0152] Final output ;
[0153] S424, output from S422 and S423 output Spatial correlations are captured using a spatiotemporal graph convolution module, as follows:
[0154] ;
[0155] ;
[0156] in, For activation function, and To add the adjacency matrix after adding self-loops, and They are respectively and The corresponding degree matrix, and It is a symmetric normalized Laplace matrix. and These are learnable parameters.
[0157] Thus, the dual-stream signal spatiotemporal encoder has captured the dynamic spatiotemporal correlation characteristics of long-term trend signals and short-term event signals, and the output results are then fed into the decoder for corresponding decoding.
[0158] S5, and Perform feature fusion to obtain fused features And based on fusion features Predictive regression is used to obtain predicted traffic signals. .
[0159] Trend features obtained from the encoder and event characteristics The data are input into gated linear units (LRUs) to enhance the method's selectivity and nonlinear representation of spatiotemporal features. Subsequently, an adaptive fusion module is designed to dynamically integrate trend features and event features processed by the LRUs. This process adaptively integrates fluctuating event features into stable trend features. Specifically, using trend features as queries and event features as keys and values, attention weights are calculated using a multi-head attention mechanism. These weights are then applied to the event features to obtain a weighted representation, which is then adaptively fused with the trend features. The weights are updated through backpropagation, adaptively extracting information useful for trend features from the event features to achieve feature fusion enhancement. The specific fusion process is as follows:
[0160] The output of step S424 is then subjected to feature fusion, as follows:
[0161] ;
[0162] in, These represent the time steps. Trend characteristics and event characteristics, It is a spatiotemporal representation after feature fusion, making Predictive traffic signals are obtained through predictive regression using a predictive regression layer. The process is as follows:
[0163] ;
[0164] in, This indicates a predicted traffic signal.
[0165] S6. Experimental verification;
[0166] Experimental setup:
[0167] Reference Figure 4 This method was implemented using the PyTorch framework, and all experiments were conducted on an NVIDIA GeForce RTX 3090 GPU. The CPU version was an Intel(R) Core(TM) i9-10900K CPU @3.70GHz, Python version was 3.9.18, and PyTorch framework version was 2.2.1.
[0168] During training, a dropout rate of 0.1 and a weight decay of 0.0001 were used. The initial learning rate was 0.001, the batch size for all datasets was 64, and the training epochs were 200. Hyperparameter settings were as follows: wavelet decomposition level (DWTlevel) was set to 1, the number of embedded feature channels was 64 for PeMS03, 128 for PeMS04, 256 for PeMS07, and 192 for PeMS08, and the number of stacked temporal convolutional layers was set to 3. Furthermore, the Ranger optimizer was used during training, the mean absolute error (MAE) loss function was employed, and Symlets wavelet decomposition was used. To improve generalization ability, an early stopping mechanism was also used during training to prevent overfitting.
[0169] Evaluation Metrics: Three effectiveness evaluation metrics were used to assess the predictive performance of the method: Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and Mean Absolute Percentage Error (MAPE). The mathematical formulas for these three metrics are shown below:
[0170] ;
[0171] ;
[0172] ;
[0173] in, and These represent the actual value and the predicted value at the nth timestamp, respectively. Represents the total number of samples.
[0174] Baseline methods: To verify the performance of this method, it is compared with 12 competitive baseline methods, which are briefly introduced below:
[0175] (1) Auto-Regressive Integrated Moving Average (ARIMA): ARIMA combines autoregressive and moving average models to predict future data by fitting time series.
[0176] (2) Support Vector Regression (SVR): SVR is a machine learning method that uses linear support vector machines for traffic prediction.
[0177] (3) Adaptive Graph Convolutional Recurrent Network (AGCRN): AGCRN captures the spatiotemporal correlation of traffic data by combining adaptive graphs and recurrent neural networks.
[0178] (4) Diffusion Convolutional Recurrent Neural Network (DCRNN): DCRNN captures spatial dependencies by employing bivariate random walks on the graph and captures temporal dependencies by utilizing an encoder-decoder structure.
[0179] (5) Spatial-Temporal Graph Convolutional Network (STGCN): STGCN captures spatiotemporal dependencies by combining graph convolution and one-dimensional convolution, with fewer parameters and faster training speed.
[0180] (6) Multivariate Time Series Forecasting with Graph Neural Networks (MTGNN): MTGNN proposes a learning layer based on data adaptive graphs to learn spatial features and capture temporal patterns through one-dimensional convolution.
[0181] (7) Historical Average (HA): HA makes predictions based on historical average traffic data.
[0182] (8) Dynamic Spatial-Temporal Aware Graph Neural Network (DSTAGNN): DSTAGNN introduces a dynamic spatial-temporal awareness graph based on a data-driven strategy, and combines spatiotemporal attention and multi-scale convolution modules to better simulate the topology of traffic networks.
[0183] (9) Spatial-Temporal Fusion Graph Neural Networks (STFGNN): STFGNN fuses the time graph generated by data-driven generation with the traditional spatial graph to form a more comprehensive spatiotemporal fusion graph, thereby capturing the dynamic spatiotemporal correlation of traffic data.
[0184] (10) Spatial-Temporal Graph Neural Controlled Differential Equation (STG-NCDE): STG-NCDE combines neural control differential equations with graph neural networks to simultaneously handle the temporal dynamics and spatial correlation of data.
[0185] (11) Dynamic Graph Convolutional Recurrent Network (DGCRN): DGCRN uses hyper-networks to extract dynamic features from node attributes and generates dynamic filters at each time step to create a dynamic adjacency matrix, so as to capture the fine dynamic changes of road network topology more comprehensively.
[0186] (12) Spatial-Temporal Wavelets (STWave): STWave uses Discrete Wavelet Transform (DWT) to decouple traffic data for modeling. In addition, it designs a novel full-map attention network to capture the spatiotemporal dynamic features of traffic data more efficiently.
[0187] Below is an example of a result based on the above method:
[0188] Method Comparison Experiments: The proposed method was compared with 12 baseline methods on four real-world traffic flow datasets. Tables 1 and 2 show the comparative experimental results of the proposed method and the baseline methods on different datasets. The experiments recorded the average prediction results for the next 60 minutes (i.e., 12 time steps). The best results are shown in bold, and the second-best results are indicated by underline. Overall, the proposed method outperforms the baseline model in most cases. Although it is slightly inferior in some metrics on the PeMS03 dataset, it still demonstrates strong competitiveness. Specifically, on the PeMS04 dataset, compared to the best baseline method, the proposed method improved MAE by approximately 2.35%, RMSE by approximately 2.84%, and MAPE by approximately 2.05%; on the PMS07 dataset, MAE improved by approximately 2.16%, RMSE by approximately 2.12%, and MAPE by approximately 0.12%; and on the PeMS08 dataset, RMSE improved by approximately 2.35% and MAPE by approximately 0.79%. These performance improvements are attributed to the unique design of the proposed method. This method utilizes discrete wavelet transform to separate traffic data into stable trend signals and fluctuating event signals, and designs corresponding modules for the unique spatiotemporal characteristics of each. In the time dimension, a temporal convolutional network and causal convolution with small kernels are designed to learn the long-term features of the trend signal and the short-term features of the event signal, respectively. In the spatial dimension, a novel dynamic fusion graph convolution module is designed. Specifically, a data-driven dynamic graph is fused with an adaptive graph generated by the model. The fused dynamic graph is then processed by the designed graph convolution module to extract more refined spatial feature information. Therefore, this method can comprehensively analyze and more effectively capture the spatiotemporal correlation of traffic flow, thereby improving its prediction accuracy.
[0189] Visual Case Studies: Case studies are conducted to explore the interpretability of this method and to visualize the model's actual predictive performance. For example... Figure 4As shown, different nodes were selected from the PeMS04 and PeMS08 datasets, and prediction curves for AGCRN, STWave, and DGDTCN were plotted. Overall, compared with other baseline methods, the prediction results of this method are closer to real traffic data. In particular, accurate predictions are achieved during both morning and evening peak hours (enlarged area), further demonstrating the superiority and effectiveness of this method. The accurate prediction results stem from its unique design. Specifically, the dual-stream temporal convolution module can extract stable trend features while avoiding interference from useless noise events. The dynamic fusion graph can calculate the spatial correlation between nodes in real time, thereby flexibly adjusting the spatial structure, which is particularly prominent during morning and evening peak hours. These phenomena indicate that this method has strong prediction and fitting capabilities, can adapt to the complex fluctuations of traffic data, and can accurately capture the dynamic changes in traffic flow under different spatiotemporal scenarios.
[0190] Table 1. Comparison of the proposed method with the baseline method on the PeMS03 and PeMS04 datasets.
[0191]
[0192] Table 2. Comparison of the proposed method with the baseline method on the PeMS07 and PeMS08 datasets.
[0193]
[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs, characterized in that, Includes the following steps: S1, acquire raw traffic flow data and preprocess it to obtain preprocessed traffic flow data; S2, in the wavelet decoupling layer, uses discrete wavelet transform to decompose the preprocessed traffic flow data into one low-frequency component and multiple high-frequency components, and then reconstructs them into stable trend signals through inverse discrete wavelet transform. and fluctuating event signals ; S3 will provide trend signals and event signals Collectively referred to as signals , will signal Convert to And introduce a periodic embedding matrix and daily periodic embedding matrix ,based on , and Obtain time embedding output , include and ; S4, sequentially embeds the output into the time frame. and Temporal and spatial features were extracted, and the results were obtained respectively. and ; S5, and Perform feature fusion to obtain fused features And based on fusion features Predictive regression is performed to obtain predicted traffic signals. .
2. The traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs according to claim 1, characterized in that, The original traffic flow data in S1 includes PeMS03, PeMS04, PeMS07 and PeMS08, which are preprocessed to obtain preprocessed PeMS03, preprocessed PeMS04, preprocessed PeMS07 and preprocessed PeMS08.
3. The traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs according to claim 2, characterized in that, The preprocessing in S1 includes redundant data removal, abnormal data repair, missing data completion, data denoising, data normalization and standardization, and data integration and partitioning.
4. The traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs according to claim 1, characterized in that, S2 includes the following steps: Assuming the preprocessed traffic flow signal is ,Will Decomposed into a low-frequency component and a high-frequency component Next, the low-frequency components Further decomposed into a low-frequency component and a high-frequency component Input preprocessed traffic flow signals The processing procedure is represented as follows: ; ; ; in, and These are the low-pass and high-pass filters for wavelets, respectively. This represents the convolution operation. This indicates that the output is downsampled by two times; Convert all high-frequency components into a fluctuating event signal. The low-frequency components are then converted into a stable trend signal. The process is as follows: ; ; in, and These represent the inverse low-pass filter and inverse high-pass filter of the wavelet, respectively, and the trend signal. Event signal .
5. The traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs according to claim 1, characterized in that, Based on the S3 , and Obtain time embedding output The process is as follows: ; in, The total number of channel features, To expand the number of feature channels, The dimension representing the time embedding is 7, where 7 represents the number of days in a week, and 288 represents the number of records per day for a single traffic node at five-minute intervals.
6. The traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs according to claim 1, characterized in that, S4 includes the following steps: S41. Temporal feature extraction; S411, Trend Signal Temporal features are extracted through multiple layers of dilated causal convolution, followed by activation functions and Dropout, and then residual connections are performed. The process is as follows: ; ; ; in, Represents the number of TCNBlocks. This represents the projection residual function, followed by the output result. After passing through a feedforward network and a layer normalization, a learned representation of the trend signal is obtained. The process is as follows: ; S412, Send event signal The process involves performing a causal convolution operation, followed by ReLU activation and Dropout, as follows: ; ; in, For time steps, To use a convolution kernel size of A filter with a step size of 1; Steps S413, S411, and S412 respectively obtain the learned representation of the long-term trend signal of traffic flow. Learning representations of short-term event signals ; S42, Spatial Feature Extraction; S421. Use a fully connected layer to process the trend signal with extracted time features. and event signals Perform a nonlinear mapping to obtain a hidden representation that eliminates the time dimension. and The process is as follows: ; ; in, , , and These represent the corresponding fully connected parameters. Represents the activation function; S422, Trend Signal Each through the dynamic adjacency matrix and the adaptive adjacency matrix obtained through node learning The process is as follows: ; ; in, Represents learnable parameters. Represents row index, Represents column index, This means retaining the row with the highest weight. The elements are set to zero, and the remainder is set to zero to ensure the sparsity of the adjacency matrix. This is achieved by dynamically adjusting the adjacency matrix. and adaptive adjacency matrix The outputs are fused into a dynamic trend adjacency matrix through a fully connected layer. The process is as follows: ; in, Indicates a fully connected layer; Finally, output ; S423, Send event signal Each through the dynamic adjacency matrix and the adaptive adjacency matrix obtained through node learning The process is as follows: ; ; in, Represents learnable parameters. Represents row index, Represents column index, This means retaining the row with the highest weight. The elements are set to zero, and the remainder is set to zero to ensure the sparsity of the adjacency matrix. This is achieved by dynamically adjusting the adjacency matrix. and adaptive adjacency matrix The outputs are fused into a dynamic trend adjacency matrix through a fully connected layer. The process is as follows: ; in, Indicates a fully connected layer; Final output ; S424, output from S422 and S423 output Spatial correlations are captured using a spatiotemporal graph convolution module, as follows: ; ; in, For activation function, and To add the adjacency matrix after adding self-loops, and They are respectively and The corresponding degree matrix, and It is a symmetric normalized Laplace matrix. and These are learnable parameters.
7. The traffic flow prediction method based on the fusion of temporal convolutional networks and dynamic graphs according to claim 1, characterized in that, S5 includes the following steps: The output of step S424 is then subjected to feature fusion, as follows: ; in, These represent the time steps. Trend characteristics and event characteristics, It is a spatiotemporal representation after feature fusion, making Predictive traffic signals are obtained through predictive regression using a predictive regression layer. The process is as follows: ; in, This indicates a predicted traffic signal.