Traffic flow prediction method based on space-time decomposition and attention mechanism

Through the traffic flow prediction method based on spatiotemporal decomposition and attention mechanism, the problem of failure to effectively deal with different frequency characteristics and time lag effects in the prior art is solved, and higher prediction accuracy and robustness are achieved.

CN119479288AInactive Publication Date: 2025-02-18CHONGQING UNIV OF POSTS & TELECOMM

Patent Information

Application Number
CN202411608791.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing traffic flow prediction methods fail to effectively separate and process the characteristics of different frequencies, and fail to fully capture the time lag effect of traffic flow, and rely too much on graph information, resulting in insufficient prediction accuracy and robustness.

Method used

The traffic flow prediction method based on spatiotemporal decomposition and attention mechanism is adopted to decompose the time series data into trend terms and event terms through fast Fourier transform, and introduce spatiotemporal information through the data embedding layer. The time convolution and time attention modules are designed to capture time information, and the multi-time slice space attention gating modules capture space information, and perform adaptive fusion.

Benefits of technology

Through frequency separation and spatiotemporal information processing, dynamic changes in traffic flow can be accurately captured, noise interference is reduced, and prediction accuracy is improved. The designed category module and delay transmission mechanism effectively capture different frequency characteristics and time lag effects, improving the generalization ability and robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119479288A_ABST
    Figure CN119479288A_ABST
Patent Text Reader

Abstract

The invention provides a traffic flow prediction method based on space-time decomposition and an attention mechanism. The method comprises the following steps: firstly, decomposing original traffic flow data into a low-frequency trend item and a high-frequency event item through Fourier transform and inverse transform thereof, and introducing time embedded information to enhance the expression ability of time sequence characteristics; secondly, for a trend term, constructing a trend processing branch by using time convolution, a time attention module and a trend category learning module, and emphatically extracting trend information of a single node; for an event item, a time convolution and multi-time slice space attention gating module is adopted, an event processing branch is constructed, and event influence and spatial dependence between different nodes are emphasized to be captured. And finally, performing weighted fusion on the features of the trend item and the event item through an adaptive fusion module to obtain a more accurate and robust traffic flow prediction result. The method can improve the prediction precision while effectively processing the spatio-temporal information, and is suitable for flow prediction in a complex traffic scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of traffic flow prediction, and in particular relates to a traffic flow prediction method based on spatiotemporal decomposition and attention mechanism. Background Art

[0002] With the acceleration of urbanization, urban traffic systems are facing increasingly serious congestion problems, resulting in reduced traffic efficiency, increased air pollution and an increase in traffic accidents. To meet these challenges, the application of intelligent transportation systems is becoming more and more widespread. Traffic flow prediction, as one of the core technologies, can help traffic management departments intervene in advance and optimize the distribution and control of traffic flow. However, the task of traffic flow prediction is extremely challenging due to the complex spatiotemporal dependence, nonlinearity and dynamics of traffic data.

[0003] Traditional traffic flow prediction methods, such as statistical time series analysis or regression analysis, can achieve certain results when processing simple or linear data, but their prediction capabilities are insufficient when faced with actual complex nonlinear traffic data. Further, deep learning technology is applied to traffic flow prediction. Convolutional neural networks can capture the spatial characteristics of urban traffic networks by converting traffic data into gridded images, but they are weak in capturing global spatiotemporal relationships; while recurrent neural networks and their variants can capture the temporal dependency of traffic flow data, but they face challenges in learning long-term dependencies. These models still have certain limitations when predicting complex traffic flow data.

[0004] Existing graph convolutional network-based methods, such as spatiotemporal graph convolutional networks, can combine the topological structure and spatiotemporal dependencies of traffic networks for prediction, but these methods usually rely on fixed graph structures and are difficult to adapt to traffic flow prediction in the absence of graph structures.

[0005] In addition, existing traffic prediction methods generally fail to fully consider the diversity and complexity of traffic flow data. Traffic data not only has significant spatiotemporal dependencies, but also contains a variety of change patterns at different frequencies. High-frequency components often represent occasional events, while low-frequency components are more able to reflect long-term trends. Most existing methods fail to effectively separate and process the characteristics of these different frequencies, making it difficult to improve prediction accuracy. Secondly, there is delayed transmission in traffic data, that is, the traffic conditions in some areas will have an impact on other areas after a certain period of time. However, many models based on spatiotemporal neural networks or graph convolutional networks fail to fully capture this delayed transmission, only considering the synchronous spatiotemporal relationship and ignoring the time lag effect.

[0006] In practical applications, traffic flow prediction also faces many challenges such as missing data, outlier processing, and real-time requirements. These problems have prompted researchers to continuously explore more advanced modeling methods to improve the accuracy and robustness of traffic flow prediction. Summary of the invention

[0007] The purpose of the present invention is to solve the problems in existing traffic flow prediction methods, such as failure to effectively separate and process features of different frequencies, failure to fully capture the time lag effect of traffic flow, and over-reliance on graph information, and to provide a traffic flow prediction method based on spatiotemporal decomposition and attention mechanism.

[0008] To achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0009] S1. Collect historical traffic data over a period of time through traffic sensors in the area to obtain the original input data of the model.

[0010] S2. Use fast Fourier transform and its inverse transform to decompose time series information into trend items and event items, and introduce spatiotemporal information into event items and trend items through the data embedding layer.

[0011] S3. Construct a trend item processing branch and input the trend item into the trend item processing branch, focusing on capturing the time information in the traffic data.

[0012] S4. Construct an event item processing branch and input the event item into the event item processing branch, focusing on capturing the spatial information in the traffic data.

[0013] S5. Adaptively fuse the processed event item and trend item to obtain the final result.

[0014] Specifically, the step S2 includes:

[0015] The present invention uses fast Fourier transform and its inverse transform to perform frequency domain analysis and decoupling on the time series data of traffic flow, decomposing the complex time series into low-frequency trend items and high-frequency event items. The trend items mainly reflect the long-term change trend, while the event items capture sudden or short-term change information.

[0016] In order to better process these decomposed components, the spatiotemporal information is introduced into the trend items and event items through the data embedding layer, thereby improving the accuracy and robustness of traffic flow prediction. The information embedded in the data embedding layer includes the day of the week, the specific time period of the day, and the periodic characteristics of the timestamp.

[0017] Furthermore, the step S3 comprises:

[0018] S3.1 Preliminary extraction of timing information through time convolution;

[0019] Since the data processed is time series information, time series has a natural temporal order, that is, the information at a certain moment should not contain time information from the future. In order to better capture this characteristic of time series, time convolution processes data by stacking multiple convolution layers with dilated causal convolution. In this convolution structure, the output at each moment depends only on the past input and does not introduce information from future moments, ensuring that causality is maintained. For the i-th convolution layer, the dilation rate is d i =2 i , the convolution formula is as follows:

[0020]

[0021] Where k is the convolution kernel size, t is the time step, is the weight matrix of the i-th convolution kernel at the j-th offset, is the bias term, and causality is determined by td i ·jGuarantee.

[0022] S3.2 Temporal Attention Module Extracts Temporal Information:

[0023] For this module input The time slice of the nth sensor is represented as

[0024] In order to effectively model the relationship between time slices within a node, this method applies the self-attention mechanism in the time dimension. Specifically, the time dependency between all time slices in the nth sensor is first calculated through the self-attention mechanism; then, the information of different time slices is aggregated through the attention weight to model the long-term time dependency between all time slices. Finally, the output of the time attention module about the nth sensor is obtained

[0025]

[0026] in, is a learnable parameter.

[0027] S3.3 Trend category learning module integrates trend category information;

[0028] In order to better extract the node trend information in the low-frequency component, the present invention designs a trend category learning module, which can effectively capture the trend change patterns of different nodes by adaptively learning the trend characteristics of each node.

[0029] For input Get category attention score

[0030]

[0031] in, is a learnable parameter and K is the number of trend categories.

[0032] Use the attention weight A c Perform weighted summation on the category data to obtain an output that incorporates category information

[0033]

[0034] in, is a learnable parameter, As the final output of step S3.

[0035] Further, step S4 includes:

[0036] S4.1 Preliminary extraction of timing information through time convolution;

[0037] The operations involved here are the same as step S3.1 except for the input.

[0038] S4.2 Multi-time slice spatial attention gating module extracts spatial information;

[0039] For this module input The data of all sensors in time slice t is expressed as

[0040] Given data Applying the self-attention mechanism in the spatial dimension, we first calculate the dependencies of all sensors in time slice t, and capture the spatial correlation between sensors through the self-attention mechanism. Then, we further model the spatial dependencies between these sensors to capture their mutual influence. Finally, we get the output of the spatial attention module about the internal relationship of sensors in time slice t.

[0041]

[0042] in, is a learnable parameter.

[0043] We will then enter The first time step of Then remove the input The last time slice of Finally in front After splicing, the time slice delay input can be obtained

[0044] Will As the key matrix and value matrix of the attention mechanism, we can get the spatial dependency relationship between the sensor in time slice t and the sensor in time slice t-1.

[0045] Then will and Splicing, get the gate weight through the fully connected layer And separate the weights to get g1 and g2. Finally, perform weighted summation:

[0046]

[0047] by As the final output of step S4.

[0048] Further, step S5 includes:

[0049] The main purpose of this step is to convert the The result obtained in step S4 Perform adaptive fusion.

[0050] For data and Apply the attention mechanism to first obtain the adaptive preliminary fusion result and compare it with Add and pass through the fully connected layer to get the final fusion result:

[0051]

[0052] in, is a learnable parameter.

[0053] The beneficial effects of the present invention are as follows:

[0054] 1) By performing frequency separation on the traffic flow sequence and processing high-frequency and low-frequency information separately, the dynamic changes of traffic flow can be captured more accurately, noise interference can be reduced, and the accuracy of prediction can be improved.

[0055] 2) A specific category module is designed to process data of different categories or modes in traffic flow. This module enables the model to adaptively learn traffic characteristics of different categories.

[0056] 3) A multi-time slice module is designed to process event information and capture the time lag effect of traffic data through a delayed transmission mechanism.

[0057] 4) The design does not rely on a fixed graph structure, which avoids the limitations of static graphs in traffic flow prediction and improves the generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 It is a schematic diagram of the method flow of the present invention.

[0059] Figure 2 It is a schematic diagram of the model framework of the present invention. DETAILED DESCRIPTION

[0060] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0061] Define historical traffic data and traffic flow forecast:

[0062] Definition 1: Historical traffic data. For a given Where C = 1, which represents the traffic flow value recorded by the i-th sensor in the road network at time slice t. Furthermore, the historical traffic flow value recorded by all sensors on the road network at time slice t can be expressed as Where N represents the number of sensors.

[0063] Definition 2: Traffic flow prediction. Given all sensors in the history T h Historical traffic data recorded on time slices The traffic flow prediction task is to use the function pass Predict all sensors in the future T f Traffic data on time slices It corresponds to the real future T f Real traffic data on time slices The process of traffic flow prediction can be expressed as:

[0064]

[0065] The present invention proposes a traffic flow prediction method based on spatiotemporal decomposition and attention mechanism. The main process of the method is as follows: Figure 1 The specific implementation process is as follows:

[0066] S1. Collect historical traffic data over a period of time through traffic sensors in the area to obtain the original input data of the model.

[0067] S2. Use fast Fourier transform and its inverse transform to decompose time series information into trend items and event items, and introduce spatiotemporal information into event items and trend items through the data embedding layer.

[0068] S3. Construct a trend item processing branch and input the trend item into the trend item processing branch, focusing on capturing the time information in the traffic data.

[0069] S4. Construct an event item processing branch and input the event item into the event item processing branch, focusing on capturing the spatial information in the traffic data.

[0070] S5. Adaptively fuse the processed event item and trend item to obtain the final result.

[0071] Specifically, the step S2 includes:

[0072] The present invention uses fast Fourier transform and its inverse transform to perform frequency domain analysis and decoupling on the time series data of traffic flow, decomposing the complex time series into low-frequency trend items and high-frequency event items. The trend items mainly reflect the long-term change trend, while the event items capture sudden or short-term change information.

[0073] In order to better process these decomposed components, the spatiotemporal information is introduced into the trend items and event items through the data embedding layer, thereby improving the accuracy and robustness of traffic flow prediction. The information embedded in the data embedding layer includes the day of the week, the specific time period of the day, and the periodic characteristics of the timestamp.

[0074] Furthermore, the step S3 comprises:

[0075] S3.1 Preliminary extraction of timing information through time convolution;

[0076] Since the data processed is time series information, time series has a natural temporal order, that is, the information at a certain moment should not contain time information from the future. In order to better capture this characteristic of time series, time convolution processes data by stacking multiple convolution layers with dilated causal convolution. In this convolution structure, the output at each moment depends only on the past input and does not introduce information from future moments, ensuring that causality is maintained. For the i-th convolution layer, the dilation rate is d i =2 i , the convolution formula is as follows:

[0077]

[0078] Where k is the convolution kernel size, t is the time step, is the weight matrix of the i-th convolution kernel at the j-th offset, is the bias term, and causality is determined by td i ·jGuarantee.

[0079] S3.2 Temporal Attention Module Extracts Temporal Information:

[0080] For this module input The time slice of the nth sensor is represented as

[0081] In order to effectively model the relationship between time slices within a node, this method applies the self-attention mechanism in the time dimension. Specifically, the time dependency between all time slices in the nth sensor is first calculated through the self-attention mechanism; then, the information of different time slices is aggregated through the attention weight to model the long-term time dependency between all time slices. Finally, the output of the time attention module about the nth sensor is obtained

[0082]

[0083] in, is a learnable parameter.

[0084] S3.3 Trend category learning module integrates trend category information;

[0085] In order to better extract the node trend information in the low-frequency component, the present invention designs a trend category learning module, which can effectively capture the trend change patterns of different nodes by adaptively learning the trend characteristics of each node.

[0086] For input Get category attention score

[0087]

[0088] in, is a learnable parameter and K is the number of trend categories.

[0089] Use the attention weight A c Perform weighted summation on the category data to obtain an output that incorporates category information

[0090]

[0091] in, is a learnable parameter, As the final output of step S3.

[0092] Further, step S4 includes:

[0093] S4.1 Preliminary extraction of timing information through time convolution;

[0094] The operations involved here are the same as step S3.1 except for the input.

[0095] S4.2 Multi-time slice spatial attention gating module extracts spatial information;

[0096] For this module input The data of all sensors in time slice t is expressed as

[0097] Given data Applying the self-attention mechanism in the spatial dimension, we first calculate the dependencies of all sensors in time slice t, and capture the spatial correlation between sensors through the self-attention mechanism. Then, we further model the spatial dependencies between these sensors to capture their mutual influence. Finally, we get the output of the spatial attention module about the internal relationship of sensors in time slice t.

[0098]

[0099] in, is a learnable parameter.

[0100] We then copy the first time step of the input x to get Then remove the input The last time slice of Finally in front After splicing, the time slice delay output can be obtained

[0101] Will As the key matrix and value matrix of the attention mechanism, we can get the spatial dependency relationship between the sensor in time slice t and the sensor in time slice t-1.

[0102] Then will and Splicing, get the gate weight through the fully connected layer And separate the weights to get g1 and g2. Finally, perform weighted summation:

[0103]

[0104] by As the final output of step S4.

[0105] Further, step S5 includes:

[0106] The main purpose of this step is to convert the The result obtained in step S4 Perform adaptive fusion.

[0107] For data and Apply the attention mechanism to first obtain the adaptive preliminary fusion result and compare it with Add and pass through the fully connected layer to get the final fusion result:

[0108]

[0109] in, is a learnable parameter.

[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the embodiments of the present invention have been shown and described, it is understood by those skilled in the art that various changes, modifications, substitutions and variations may be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. The traffic flow prediction method based on spatiotemporal decomposition and attention mechanism according to claim 1 is characterized in that: The corresponding step S3 includes: first, preliminarily extracting the time information of the trend item through the time convolution module, the time convolution module includes multiple layers of convolution layers with dilated causal convolutions, and the dilation rate increases layer by layer to capture long-term dependencies; then, further extracting the time dependency of the trend item using the time attention module, the time attention module applies the self-attention mechanism to model the long-term dependency between each time slice, and outputs the trend item representation containing the time information; finally, through the trend category learning module, the trend category information is fused to generate the category attention score, and the category attention is used to perform weighted summation on the trend categories to obtain the trend item output of the fused category information.

2. The traffic flow prediction method based on spatiotemporal decomposition and attention mechanism according to claim 1 is characterized in that: The corresponding step S4 includes: first, preliminarily extracting the timing information of the event item through the time convolution module, which has the same structure as the time convolution module in the trend item processing; then, extracting the spatial information of the event item using the multi-time slice spatial attention gating module, which applies the self-attention mechanism in the spatial dimension, models the spatial dependency between sensors in each time slice, and captures the spatial delay relationship between the previous and next time slices through the delay transfer mechanism, and then fuses the spatial information of multiple time slices through the gating mechanism.

3. The traffic flow prediction method based on spatiotemporal decomposition and attention mechanism according to claim 1 is characterized in that: The corresponding step S5 includes: first, taking the event item as the query and the trend item as the key and value, obtaining the preliminary fusion result through the attention mechanism; then adding the result to the trend item, and adjusting the fusion result through the fully connected layer to obtain the final prediction result.

Citation Information

Patent Citations

  • Traffic flow prediction model based on gated time convolutional network

    CN116596109A

  • Traffic flow prediction method based on discrete wavelet transform and space-time self-attention network

    CN118711360A

  • Multi-head attention space-time decoupling dual-channel MAE pre-training traffic flow calculation method

    CN118747959A

  • Tensorized LSTM with adaptive shared memory for learning trends in multivariate time series

    US20210064998A1

Cited By

  • Landslide catastrophe trend prediction method based on machine learning

    CN120632343A

  • Traffic flow prediction method based on multi-scale decomposition and dynamic graph modeling

    CN120998030A

  • Traffic flow prediction method and system based on multi-scale dynamic decomposition and space-time Transform

    CN121034085A