A traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time transformer
By using multi-scale dynamic decomposition and spatiotemporal Transformer methods, traffic flow data is decomposed into trend and seasonal components. Multilayer perceptron and spatiotemporal Transformer are used for modeling, which solves the problems of prediction error accumulation and insufficient adaptability to dynamic topological relationships in existing methods, and achieves high-precision traffic flow prediction.
Patent Information
- Application Number
- CN202511554144.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2045-10-29
AI Technical Summary
Existing traffic flow prediction methods struggle to effectively distinguish between short-term fluctuations and long-term trends, neglect non-Euclidean structural dependencies between traffic nodes, and are ill-suited to dynamic topological relationships, leading to accumulated prediction errors and insufficient modeling of complex spatiotemporal dependencies.
A multi-scale dynamic decomposition method is adopted to decompose traffic flow data into trend components and seasonal components. Multilayer perceptron and spatiotemporal Transformer are used for modeling respectively. Noise and signal are separated by multi-scale decomposition method, and the dynamic spatiotemporal dependency modeling capability is enhanced by adaptive SwiGLU gating mechanism and unified spatiotemporal self-attention coding.
It significantly improves the accuracy and robustness of traffic flow prediction, better captures the complex dynamic spatiotemporal dependencies of traffic flow, and enhances road traffic efficiency and traffic management effectiveness.
Smart Images

Figure CN121034085B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of intelligent transportation systems, and particularly relates to a traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transformer. BACKGROUND
[0002] Traffic flow prediction, as a core component of intelligent transportation systems, plays a crucial role in optimizing road resource allocation, alleviating traffic congestion, and improving urban transportation efficiency. Accurate traffic prediction can provide key data support for traffic signal control, path dynamic planning, and congestion management strategies, thereby effectively improving road traffic efficiency, reducing delays, and improving overall traffic conditions.
[0003] However, traffic data contains complex spatio-temporal dependencies, presenting significant prediction challenges: short-term fluctuations (such as accidents, sudden weather changes) and long-term trends (such as holiday traffic surges, commuting routines) are intertwined; spatial heterogeneity (such as the difference in traffic flow between main roads and branch roads) coexists with dynamic topological evolution (such as construction rerouting, changing congestion propagation paths). Traditional statistical methods, such as historical inference (HI) and autoregressive integrated moving average (ARIMA) models, have good performance in time series prediction, but they are difficult to fully capture the non-linear characteristics and complex patterns in traffic data. Machine learning methods such as support vector machines (SVM) and K-nearest neighbors (KNN) have improved prediction accuracy to some extent, but they often ignore the non-Euclidean structural dependencies between traffic nodes and have limited ability to model fine-grained temporal effects and dynamic changes.
[0004] In recent years, deep learning-based models such as Graph WaveNet (GWNet) and Diffusion Convolution Recurrent Neural Network (DCRNN) have integrated spatio-temporal features with graph convolution technology, but they still rely on predefined static graph structures, making it difficult to adapt to the dynamic evolution of topological relationships in the traffic network. Some Transformer-based models such as GTS and PDFormer have performed well in traffic prediction, but they are still mostly based on static or preset graph structures, and have limited ability to model complex dynamic spatio-temporal dependencies. Recent research such as STID and STAEformer attempts to introduce identity embedding to adaptively capture spatio-temporal features, but still faces the problem of failing to effectively separate noise and signal and revealing the internal evolution law of traffic flow.
[0005] The existing methods mainly face the following bottlenecks: on the one hand, short-term fluctuations and long-term trends are intertwined, making it difficult for the model to distinguish between effective information and noise, and the prediction error is prone to accumulate over time; on the other hand, the propagation path of traffic flow and the correlation between nodes change dynamically over time, and show obvious multi-periodicity, how to effectively model such complex and evolving spatio-temporal dependencies is still a key problem to be solved in the current traffic prediction field SUMMARY
[0006] The purpose of the present application is to provide a traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transformer, to overcome the shortcomings of the prior art in noise sensitivity, dynamic topology adaptability and multi-period modeling, and to improve prediction accuracy and robustness. To solve the above problems existing in the prior art, effectively improve the road traffic efficiency, reduce the delay and improve the overall traffic condition.
[0007] In order to achieve the above purpose, the present application provides the following scheme:
[0008] The present application provides a traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transformer, comprising the following steps:
[0009] S1: obtaining the input original traffic flow time series data, using a multi-scale dynamic decomposition method to decompose the original traffic flow data into trend components and seasonal components ;
[0010] S2: using a multi-layer perception to model the trend components to obtain global trend feature representation ;
[0011] S3: using a space-time Transformer to model the seasonal components to extract their dynamic space-time dependence features to obtain seasonal feature representation ; the space-time Transformer integrates an embedding layer, a time and space self-attention mechanism, an adaptive SwiGLU gated feedforward module and a unified space-time self-attention encoding method;
[0012] S4: fusing the global trend feature representation and seasonal feature representation , and generating the final traffic flow prediction result through an output layer ;
[0013] Further, in S1, the input original traffic flow time series data is obtained, and a multi-scale dynamic decomposition method is used to decompose the original traffic flow data into trend components and seasonal components :
[0014] Specifically, first, the original data of the traffic flow input is subjected to a sliding average operation of different kernel sizes to obtain candidate trend items . Subsequently, the time dimension of these candidate trend items is compressed by time average pooling, and a learnable parameter matrix The implicit relationship between the modeling node dimension and the kernel scale is then established. Next, the kernel scale dimension is... Normalization is used to generate dynamic weights, enabling adaptive fusion of multi-scale trend components. Finally, the dynamic weights are... With candidate trend items Perform channel-by-channel Hadamard products and weighted summation to generate the final trend term that integrates multi-scale information. The seasonal term can be obtained by subtracting the trend term from the original data. It can be formalized as:
[0015]
[0016] In the above formula It is a moving average operation. =12 is the time step size. It is Hadamaji.
[0017] Furthermore, in S2, a multilayer perceptron is used to model the trend components to obtain a global trend feature representation. :
[0018] Specifically, a multilayer perceptron (MLP) structure consisting of three fully connected layers is used to obtain the predicted output of the trend term. This simple structure is sufficient to effectively capture trend changes while avoiding introducing excessive model complexity; it can be formulated as follows:
[0019]
[0020] In the above formula For learnable weight matrix, This is the activation function.
[0021] Furthermore, in S3, the seasonal components are modeled using a spatiotemporal Transformer to extract their dynamic spatiotemporal dependency features, thus obtaining a seasonal feature representation. The spatiotemporal Transformer consists of three core components: an embedding layer, a spatiotemporal self-attention mechanism, and an adaptive SwiGLU gating mechanism. To enhance the interaction between temporal and spatial information, we integrate temporal and spatial self-attention within the same encoder structure to achieve unified spatiotemporal loop modeling. Specifically, this includes:
[0022] S3.1, Data Embedding Layer:
[0023] First, in order to retain seasonal items We map the raw feature information into feature embeddings using a linear layer. It can be formalized as:
[0024]
[0025] In the above equation, is the learnable weight matrix, is the bias vector.
[0026] Second, to model the periodicity in traffic flow, we design a dual embedding mechanism that combines the weekly pattern and the intra-day pattern. Specifically, we initialize two learnable embedding tables: the day-of-week embedding table and the timestamp embedding table . The day-of-week index and the intra-day timestamp data of a traffic time series are denoted as and , respectively, with the time range of . According to these indices, we extract the corresponding day-of-week and intra-day timestamp embeddings from the embedding tables. By concatenation and broadcasting operations, we fuse the two to obtain the periodic embedding to capture the spatio-temporal representation of the weekly period and the intra-day fine-grained time pattern.
[0027] To make the model adaptively learn the temporal and spatial information of each node and represent more complex dynamic spatio-temporal features, considering the indistinguishability of samples in time and space, we propose a linearly enhanced spatio-temporally adaptive embedding . Specifically, we first initialize a random embedding matrix , and then project it to a decoupled feature space through a linear layer to obtain the enhanced embedding , which improves the model's representation ability for complex spatio-temporal relationships. We model complex spatio-temporal relationships in a unified manner rather than using predefined or dynamic adjacency matrices for spatial modeling
[0028] Finally, by concatenating the above embeddings along the feature dimension, we obtain the hidden spatio-temporal representation , which is as follows:
[0029]
[0030] In the above equation, means concatenation, and the hidden dimension = .
[0031] S3.2, Temporal and Spatial Self-Attention Mechanism Layer:
[0032] First, the hidden spatio-temporal representation given by the embedding layer is , where is the number of time steps, is the number of spatial nodes. We query, key and value matrices through the spatial Transformer layer as follows:
[0033]
[0034] where is a learnable weight matrix. Then we compute the self-attention score as:
[0035]
[0036] where captures the temporal relationship in different spatial nodes. Finally, the output of the temporal self-attention layer is , computed as:
[0037]
[0038] Similarly, we obtain query, key and value matrices through the spatial Transformer layer as follows:
[0039]
[0040] where is a learnable weight matrix. Then we compute the self-attention score as:
[0041]
[0042] where only focuses on the spatial dimension, which is used to capture the spatial dependency between nodes. Finally, we obtain the output of the spatial self-attention layer as , which is computed as:
[0043]
[0044] It is worth noting that we also apply layer normalization, residual connections and multi-head mechanisms.
[0045] S3.3, Adaptive SwiGLU gated feed-forward layer:
[0046] We propose an Adaptive SwiGLU gated feed-forward layer to replace the FFN in vanilla transformer. It is a feed-forward unit that introduces a dynamic gating enhancement mechanism, aiming to improve the model's ability to capture effective signals in seasonal terms while effectively suppressing noise interference. First, let the input of this module be Z∈ We will input it through two independent linear transformations to generate a gating signal and a numerical vector, as follows:
[0047]
[0048] In the above formula is a learnable weight matrix, and the SiLU (Sigmoid Linear Unit) activation function is defined as
[0049]
[0050] This activation function has both smoothness and nonlinearity, which helps to improve the expressive ability of the model. Then we introduce a learnable scalar parameter to dynamically adjust the gating strength. After the gated output is subjected to a Dropout operation, it is input to the last linear layer to obtain the final output , as shown below:
[0051]
[0052] In the above formula is a learnable weight matrix.
[0053] Further, in S4, the global trend feature representation is fused with the seasonal feature representation , and the final traffic flow prediction result is generated through the output layer:
[0054] Specifically, first, we fuse the trend item predicted by the multi-layer perceptron module and the seasonal item predicted by the ST-Transformer module to obtain , as shown below:
[0055]
[0056] Finally, in order to adjust the amplitude and deviation of the prediction result, make it better adapt to the real data distribution and enhance the robustness and training stability of the model, we perform a simple linear transformation on , and then add a residual connection to obtain the final output of the model , as shown below:
[0057]
[0058] In the above formula is a learnable weight matrix.
[0059] In addition, the application also provides a traffic flow prediction system based on multi-scale dynamic decomposition and space-time Transformer, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the traffic flow prediction method based on multi-scale dynamic decomposition and space-time Transformer.
[0060] In addition, the application also provides a computer readable storage medium, wherein a computer program or instructions are stored in the computer readable storage medium, and the computer program or instructions are programmed or configured to execute the traffic flow prediction method based on multi-scale dynamic decomposition and space-time Transformer by a processor.
[0061] In addition, the application also provides a computer program product, comprising a computer program or instructions, which are programmed or configured to execute the traffic flow prediction method based on multi-scale dynamic decomposition and space-time Transformer by a processor.
[0062] Compared with the prior art, the application mainly has the following advantages: the application comprises decoupling the original traffic flow time series data into trend components and seasonal components by using a multi-scale dynamic decomposition method, and modeling the trend components and the seasonal components by using a multi-layer perceptron and a space-time Transformer, respectively, and finally fusing the output prediction results: obtaining the input original traffic flow time series data; decomposing the original traffic flow data into trend components and seasonal components by using a multi-scale dynamic decomposition method; modeling the trend components by using a multi-layer perceptron to obtain global trend feature representation; modeling the seasonal components by using a space-time Transformer to extract dynamic space-time dependence features thereof to obtain seasonal feature representation; and fusing the global trend feature representation and the seasonal feature representation to generate the final traffic flow prediction result. The application effectively separates noise and signal by using a multi-scale decomposition method, and significantly improves the modeling capability of complex dynamic space-time dependence in traffic flow by means of integrated linear enhancement space-time adaptive embedding, adaptive SwiGLU gate mechanism and unified space-time self-attention Transformer architecture, greatly improves the prediction accuracy and robustness, and can be applied to intelligent traffic control, dynamic path planning and urban traffic management and other fields. BRIEF DESCRIPTION OF DRAWINGS
[0063] Figure 1 FIG. 1 is a basic flowchart of the method of the embodiment of the application;
[0064] Figure 2 FIG. 1 is a basic flowchart of the method of the embodiment of the application;
[0065] Figure 3The model performance comparison under the PEMS03, PEMS04, PEMS07 and PEMS08 data sets in the embodiments of the present application;
[0066] Figure 4 The prediction effect visualization graph under the PEM08 data set in the embodiments of the present application;
[0067] Figure 5 The prediction effect visualization graph under the PEM08 data set in the embodiments of the present application;
[0068] Figure 6 The prediction effect visualization graph under the PEM08 data set in the embodiments of the present application; DETAILED DESCRIPTION
[0069] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.
[0070] The core of the present application is to provide a traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transformer to solve the problems in the prior art.
[0071] In order to enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0072] Figure 1 A basic flowchart of a traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transformer provided by the embodiments of the present application is shown as follows, including the following steps: Figure 1
[0073] S1: Obtain the input original traffic flow time series data, and decompose the original traffic flow data into trend components and seasonal components by using a multi-scale dynamic decomposition method
[0074] S2: Model the trend components by using a multi-layer perception machine to obtain global trend feature representation
[0075] S3: Model the seasonal components by using a space-time Transformer to extract dynamic space-time dependence features thereof, and obtain seasonal feature representation The spatiotemporal Transformer integrates an embedding layer, temporal and spatial self-attention mechanisms, an adaptive SwiGLU gated feedforward module, and a unified spatiotemporal self-attention coding method.
[0076] S4: Integrate the global trend feature representation Seasonal characteristics The final traffic flow prediction result is generated through the output layer. ;
[0077] Figure 2 This invention provides a traffic flow prediction method and system algorithm framework based on multi-scale dynamic decomposition and spatiotemporal Transformer. The invention includes decoupling the original traffic flow time series data into trend and seasonal components using a multi-scale dynamic decomposition method, and modeling these components using a multilayer perceptron and a spatiotemporal Transformer respectively. The final prediction result is then fused and output. The process involves: acquiring the input original traffic flow time series data; decomposing the original traffic flow data into trend and seasonal components using a multi-scale dynamic decomposition method; modeling the trend component using a multilayer perceptron to obtain a global trend feature representation; modeling the seasonal component using a spatiotemporal Transformer to extract its dynamic spatiotemporal dependency features to obtain a seasonal feature representation; and fusing the global trend feature representation and the seasonal feature representation to generate the final traffic flow prediction result. This invention effectively separates noise and signal through a multi-scale decomposition method and significantly improves the modeling ability for complex dynamic spatiotemporal dependencies in traffic flow by leveraging a Transformer architecture that integrates linearly enhanced spatiotemporal adaptive embedding, adaptive SwiGLU gating mechanism, and unified spatiotemporal self-attention. This greatly improves prediction accuracy and robustness and can be applied to fields such as intelligent traffic control, dynamic path planning, and urban traffic management. The specific implementation steps are as follows:
[0078] In step S1 of this embodiment, the original traffic flow time series data is obtained, and the original traffic flow data is decomposed into trend components using a multi-scale dynamic decomposition method. With seasonal ingredients :
[0079] Specifically, the first step is to analyze the raw data of traffic flow input. Apply Apply moving average operations with different kernel sizes to obtain candidate trend terms. Subsequently, the time dimension of these candidate trend terms is compressed using temporal average pooling, and a learnable parameter matrix is utilized. The implicit relationship between the modeling node dimension and the kernel scale is then established. Next, the kernel scale dimension is... Normalization is used to generate dynamic weights, enabling adaptive fusion of multi-scale trend components. Finally, the dynamic weights are... with candidate trend items Performing channel-wise Hadamard product and weighted summation to generate the final trend item that fuses multi-scale information ; By subtracting the trend item from the original data, the seasonal item can be obtained . It can be formulated as:
[0080]
[0081] In the above formula, is a moving average operation, =12 is the time dimension step, is the Hadamard product.
[0082] In step S2 of the embodiment, the trend component is modeled using a multi-layer perception to obtain a global trend feature representation ;
[0083] Specifically, a multi-layer perception (MLP) structure composed of three fully connected layers is adopted to obtain the prediction output of the trend item . This simple structure is sufficient to effectively capture the trend change while avoiding the introduction of excessive model complexity, which can be formulated as:
[0084]
[0085] In the above formula, is a learnable weight matrix, is an activation function.
[0086] In step S3 of the embodiment, the seasonal component is modeled using a space-time Transformer to extract its dynamic space-time dependency features, obtaining a seasonal feature representation ; The space-time Transformer is composed of three core components: an embedding layer, a space-time self-attention mechanism, and an adaptive SwiGLU gating mechanism. In order to enhance the interaction between time and space information, we fuse time and space self-attention in the same encoder structure to realize unified space-time recurrent modeling. Specifically, it includes:
[0087] S3.1, data embedding layer:
[0088] First, in order to preserve the original feature information of the seasonal item , we map it to feature embedding through a linear layer, which can be formulated as:
[0089]
[0090] In the above formula, is a learnable weight matrix, is the bias vector.
[0091] Second, to model the periodicity in traffic flow, we design a dual embedding mechanism that combines the weekly cycle and the intra-day pattern. Specifically, we initialize two learnable embedding tables: a day-of-week embedding table and a timestamp embedding table . The day-of-week index and the intra-day timestamp data of a traffic time series are denoted as and , respectively, with the time range of . According to these indices, we extract the corresponding day-of-week and intra-day timestamp embeddings from the embedding tables. By concatenation and broadcasting operations, we fuse the two to obtain the periodic embedding to capture the spatio-temporal representation of the weekly cycle and the intra-day fine-grained time pattern.
[0092] Considering the indistinguishability of samples in time and space, to enable the model to adaptively learn the temporal and spatial information of each node and represent more complex dynamic spatio-temporal features, we propose a linearly enhanced spatio-temporal adaptive embedding . Specifically, we first initialize a random embedding matrix , and then project it to a decoupled feature space through a linear layer to obtain the enhanced embedding , which improves the model’s representation ability for complex spatio-temporal relationships. We model complex spatio-temporal relationships in a unified manner, rather than using predefined or dynamic adjacency matrices for spatial modeling
[0093] Finally, by concatenating the above embeddings along the feature dimension, we obtain the hidden spatio-temporal representation , as follows:
[0094]
[0095] In the above equation, means concatenation, and the hidden dimension = .
[0096] S3.2, Time and Space Self-Attention Mechanism Layer:
[0097] First, the hidden spatio-temporal representation given by the embedding layer is , where is the number of time steps, is the number of spatial nodes. We query, key, and value matrices in advance through the time Transformer layer, as follows:
[0098]
[0099] where are learnable weight matrices. Then we compute the self-attention score as:
[0100]
[0101] where captures the temporal relationship in different spatial nodes. Finally, the output of the temporal self-attention layer is , which is computed as:
[0102]
[0103] Similarly, we obtain the query, key, and value matrices through the spatial Transformer layer as follows:
[0104]
[0105] where are learnable weight matrices. Then we compute the self-attention score as:
[0106]
[0107] where only focuses on the spatial dimension, which is used to capture the spatial dependency between nodes. Finally, we obtain the output of the spatial self-attention layer as , which is computed as:
[0108]
[0109] It is worth noting that we also apply layer normalization, residual connections, and the multi-head mechanism.
[0110] S3.3, Adaptive SwiGLU gated feed-forward layer:
[0111] We propose an adaptive SwiGLU gated feed-forward layer to replace the FFN in vanilla transformer. It is a feed-forward unit that introduces a dynamic gating enhancement mechanism, aiming to improve the model's ability to capture effective signals in seasonal terms while effectively suppressing noise interference. First, let the input of this module be Z∈ We will input it through two independent linear transformations to generate the gating signal and numerical vector, as follows:
[0112]
[0113] where For the learnable weight matrix, the SiLU (Sigmoid Linear Unit) activation function is defined as:
[0114]
[0115] The activation function has both smoothness and nonlinearity, which helps to improve the expression ability of the model. Then, we introduce a learnable scalar parameter to dynamically adjust the gating strength. The gated output is subjected to a Dropout operation and then input to the last linear layer to obtain the final output , as shown below:
[0116]
[0117] In the above formula, is a learnable weight matrix.
[0118] In step S4 of this embodiment, the global trend feature representation and the seasonal feature representation are fused, and the final traffic flow prediction result is generated through the output layer:
[0119] Specifically, first, we fuse the trend item predicted by the multi-layer perception module and the seasonal item predicted by the ST-Transformer module to obtain , as shown below:
[0120]
[0121] Finally, in order to adjust the amplitude and deviation of the prediction result, make it better adapt to the real data distribution and enhance the robustness and training stability of the model, we perform a simple linear transformation on , and then add a residual connection to obtain the final output of the model , as shown below:
[0122]
[0123] In the above formula, is a learnable weight matrix.
[0124] To verify the traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transformer, in the experiment, the data set used in the embodiment is PEMS data set, specifically including PEMS03 data set, PEMS04 data set, PEMS07 data set and PEMS08 data set, and the evaluation index used is mean absolute error (MAE), root mean square error (RMSE) and mean absolute percentage error (MAPE) Figure 3 The performance of different models on PEMS03 data set, PEMS04 data set, PEMS07 data set and PEMS08 data set in the embodiment is compared.
[0125] Referring to Figure 3 It can be seen that the traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transformer in the embodiment is superior to the existing traffic flow prediction method in various aspects of performance;
[0126] In order to further illustrate the effectiveness of the traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transformer in the embodiment, in order to further understand the performance of the model, we perform visual analysis on the true value and the predicted value. First, we randomly select node 012 from the PeMS08 data set, and draw the actual flow and predicted flow curve within 12 hours. As shown in FIG. 4, there is a long-term downward trend on the basis of obvious seasonal fluctuations. The experimental results show that our model can accurately capture the periodic changes and overall downward trend, effectively simulate the internal dynamics of traffic flow.
[0127] Secondly, we select two nodes 054 and 107 from the PeMS08 data set, which have significant seasonal fluctuations and large amplitude, to show the prediction curves of STAEfomer and our model respectively. As shown in FIG. 5 and FIG. 6, MDDSTFormer performs better in signal and noise separation, and more truly reveals the underlying pattern of traffic flow.
[0128] In summary, the traffic flow prediction method and system algorithm framework based on multi-scale dynamic decomposition and space-time Transformer of the embodiment, the application comprises decoupling the original traffic flow time series data into trend component and seasonal component by using the multi-scale dynamic decomposition method, and modeling by using multi-layer perception and space-time Transformer respectively, and finally fusing the output prediction result: obtaining the input original traffic flow time series data; decomposing the original traffic flow data into trend component and seasonal component by using the multi-scale dynamic decomposition method; modeling the trend component by using the multi-layer perceptron to obtain the global trend feature representation; modeling the seasonal component by using the space-time Transformer to extract its dynamic space-time dependence feature to obtain the seasonal feature representation; fusing the global trend feature representation and the seasonal feature representation to generate the final traffic flow prediction result. The application effectively separates noise and signal by the multi-scale decomposition dynamic method, and significantly improves the modeling ability of the complex dynamic space-time dependence relationship in the traffic flow by means of the integrated linear enhancement space-time adaptive embedding, the adaptive SwiGLU gate mechanism and the unified space-time self-attention Transformer architecture, greatly improves the prediction accuracy and robustness, and can be applied to the fields of intelligent traffic control, dynamic path planning and urban traffic management.
[0129] In addition, the application also provides a traffic flow prediction system based on multi-scale dynamic decomposition and space-time Transformer, comprising a microprocessor and a memory connected to each other, the microprocessor being programmed or configured to execute the traffic flow prediction method based on multi-scale dynamic decomposition and space-time Transformer.
[0130] In addition, the application also provides a computer readable storage medium, which stores a computer program or instructions, the computer program or instructions being programmed or configured to execute the traffic flow prediction method based on multi-scale dynamic decomposition and space-time Transformer by a processor.
[0131] In addition, the application also provides a computer program product, comprising a computer program or instructions, the computer program or instructions being programmed or configured to execute the traffic flow prediction method based on multi-scale dynamic decomposition and space-time Transformer by a processor
[0132] Those skilled in the art will appreciate that embodiments of the application can be readily used as software, hardware, or a combination of software and hardware. In a software embodiment, various software modules in accordance with embodiments of the application are stored in a memory such as a computer program product (e.g., a disk storage) and executed by a computer processor. As such, various program modules in accordance with embodiments of the application can be implemented in a variety of programming languages, including but not limited to C++ and Java. Also, the various program modules in accordance with embodiments of the application can be implemented as a computer program product that is executed on one or more computers in a network. In a hardware embodiment, various program modules in accordance with embodiments of the application are implemented as hardware logic and / or circuitry that is implemented as part of a hardware device, such as an application specific integrated circuit (ASIC) or field programmable gate array (FPGA). Figure 1 one or more functions specified in the flow or flows and / or blocks Figure 1 one or more functions specified in the flow or flows and / or blocks Figure 1 one or more functions specified in the flow or flows and / or blocks Figure 1 one or more functions specified in the flow or flows and / or blocks Figure 1 one or more functions specified in the flow or flows and / or blocks Figure 1 one or more functions specified in the flow or flows and / or blocks
[0133] The above description is only preferred embodiments of the application. The protection scope of the application is not limited to the above-mentioned embodiments. Any technical scheme falling within the concept of the application should be considered as falling within the protection scope of the application. It should be noted that any improvement and modification made by those skilled in the art without departing from the principle of the application should be considered as falling within the protection scope of the application.
Claims
1. A traffic flow prediction method based on multi-scale dynamic decomposition and spatiotemporal Transformer, characterized in that, This includes using a pre-trained multi-scale dynamic decomposition and spatiotemporal Transformer model to obtain output traffic flow prediction results from raw traffic flow time series data. The multi-scale dynamic decomposition and spatiotemporal Transformer model generates prediction results through the following steps: S1: Obtain the input raw traffic flow time series data, and use a multi-scale dynamic decomposition method to decompose the raw traffic flow data into trend components. With seasonal ingredients ; S2: Model the trend components using a multilayer perceptron to obtain a global trend feature representation. ; S3: Model the seasonal components using a spatiotemporal Transformer, extract their dynamic spatiotemporal dependency features, and obtain the seasonal feature representation. The spatiotemporal Transformer integrates an embedding layer, temporal and spatial self-attention mechanisms, an adaptive SwiGLU gated feedforward module, and a unified spatiotemporal self-attention coding method; specifically including: S3.1, Embedding layer fusion mechanism to construct hidden spatiotemporal representation: First, the seasonal term is mapped to feature embeddings through a linear layer. ,in It is the number of time steps. The first step is to determine the number of spatial nodes to preserve original feature information. The second step involves designing a dual embedding mechanism combining periodic and intraday patterns. This mechanism extracts periodic features from a learnable weekday embedding table and a timestamp embedding table and then fuses them into a single embedding. Furthermore, a linearly enhanced spatiotemporal adaptive embedding is proposed. By initializing a random embedding matrix and projecting it through a linear layer, the model can adaptively learn the spatiotemporal information of nodes and represent complex dynamic features. Finally, by concatenating the above embeddings along the feature dimension, a unified hidden spatiotemporal representation is formed. Hidden dimensions = This allows for the effective modeling of complex spatiotemporal relationships without relying on predefined graph structures; S3.2, the spatiotemporal self-attention mechanism layer, is used to capture complex temporal and spatial dependencies from the hidden spatiotemporal representation. This layer analyzes the dynamic correlation between different time steps through the temporal self-attention module, effectively identifying long-term and short-term temporal patterns in traffic flow. At the same time, the spatial self-attention module automatically learns the global spatial correlation between nodes without relying on a predefined graph structure. Both modules adopt layer normalization, residual connections, and multi-head mechanisms to enhance training stability and representational ability, and finally output an enhanced representation that integrates spatiotemporal features, providing key information support for subsequent predictions. S3.3, the adaptive SwiGLU-gated feedforward layer, replaces the standard feedforward network in the traditional Transformer. By introducing a dynamic gating mechanism, it enhances the model's ability to extract effective information from seasonal components and suppress noise. This module first uses the SiLU activation function and linear transformation to generate gating signals and numerical vectors, respectively, and then uses learnable scalar parameters to dynamically adjust the gating strength, thereby flexibly controlling the information flow. Finally, the enhanced feature representation is output through Dropout and linear projection, effectively improving the model's expressive ability and robustness to complex traffic time series patterns. S4: Integrate the global trend feature representation Seasonal characteristics The final traffic flow prediction result is generated through the output layer. .
2. The traffic flow prediction method based on multi-scale dynamic decomposition and spatiotemporal Transformer according to claim 1, characterized in that, In S1, the original traffic flow time series data is acquired, and the original traffic flow data is decomposed into trend components using a multi-scale dynamic decomposition method. With seasonal ingredients : S1.1, Multi-scale dynamic decomposition method: First, the raw data of traffic flow input. ,in It is the number of time steps. It is the number of spatial nodes, applied Apply moving average operations with different kernel sizes to obtain candidate trend terms. Subsequently, the time dimension of these candidate trend terms is compressed using temporal average pooling, and a learnable parameter matrix is utilized. Model the implicit relationship between the node dimension and the kernel scale; then, perform [further steps] on the kernel scale dimension. Normalization is used to generate dynamic weights, enabling adaptive fusion of multi-scale trend components; finally, the dynamic weights are... With candidate trend items Perform channel-by-channel Hadamard products and weighted summation to generate the final trend term that integrates multi-scale information. ; The seasonal term can be obtained by subtracting the trend term from the original data. .
3. The traffic flow prediction method based on multi-scale dynamic decomposition and spatiotemporal Transformer according to claim 1, characterized in that, In S2, a multilayer perceptron is used to model the trend components to obtain a global trend feature representation. : S2.1 employs a multilayer perceptron structure consisting of three fully connected layers to obtain the predicted output of the trend term. This simple structure is sufficient to effectively capture trend changes while avoiding the introduction of excessive model complexity.
4. The traffic flow prediction method based on multi-scale dynamic decomposition and spatiotemporal Transformer according to claim 1, characterized in that, In S4, the global trend feature representation is fused. Seasonal characteristics The final traffic flow prediction result is generated through the output layer. ; S4.1, the feature fusion and output layer, is used to integrate the trend prediction and seasonal prediction results and generate the final traffic flow prediction. This module first adds the trend term output by the multilayer perceptron and the seasonal term output by the spatiotemporal Transformer directly to achieve preliminary fusion of multi-scale features. Then, through a linear transformation layer with residual connections, the magnitude and bias of the prediction results are dynamically adjusted to better adapt to the real data distribution and effectively improve the accuracy, robustness and training stability of the model output.
5. A traffic flow prediction device based on multi-scale dynamic decomposition and spatiotemporal Transformer, comprising a microprocessor and a memory interconnected, characterized in that, The microprocessor is programmed or configured to execute the traffic flow prediction method based on multi-scale dynamic decomposition and spatiotemporal Transformer as described in any one of claims 1 to 4.
6. A computer-readable storage medium storing a computer program or instructions, characterized in that, The computer program or instructions are programmed or configured to execute, via a processor, the traffic flow prediction method based on multi-scale dynamic decomposition and spatiotemporal Transformer as described in any one of claims 1 to 4.
7. A computer program product, comprising a computer program or instructions, characterized in that, The computer program or instructions are programmed or configured to execute, via a processor, the traffic flow prediction method based on multi-scale dynamic decomposition and spatiotemporal Transformer as described in any one of claims 1 to 4.
Citation Information
Patent Citations
High-speed traffic flow prediction method based on long-short period Transform fusion trend and seasonal characteristics
CN119540887A