A full-cycle traffic flow prediction method based on spatio-temporal feature deep fusion
By using a deep fusion method based on spatiotemporal features, combined with a bidirectional gated temporal convolutional network and a multi-neighbor graph convolutional model, the shortcomings of existing traffic flow prediction models in capturing spatiotemporal dependencies are addressed, resulting in more efficient traffic flow prediction.
Patent Information
- Application Number
- CN202411604504.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-11-12
AI Technical Summary
Existing traffic flow prediction models struggle to fully capture spatiotemporal dependencies when dealing with complex and ever-changing traffic flow patterns. They also lack multi-granular perception and identification of dynamic environmental factors, resulting in insufficient prediction accuracy and effectiveness.
By adopting a deep fusion method based on spatiotemporal features, and designing a bidirectional gated temporal convolutional network, a time-varying multi-neighbor graph convolution and a contextual multi-graph perception attention model, and a deep deconstruction of a high-dimensional traffic data model, we comprehensively model the multi-neighbor interactions and complex temporal interactions of traffic flow to form a composite traffic situation perception.
It improves the accuracy and sensitivity of traffic flow forecasting, better adapts to complex traffic environments, and enhances the accuracy and robustness of short-term and medium-to-long-term forecasts.
Smart Images

Figure CN119541195B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of traffic flow prediction, and in particular to a full-cycle traffic flow prediction method based on spatiotemporal feature deep fusion. The method is from the spatiotemporal dimension and faces multiple cycles of short, medium and long periods, combines different scale time series features and different granularity spatial relationships, and is used to realize full-cycle digital urban traffic flow prediction of multi-dimensional, multi-scale and multi-granularity comprehensive elements. BACKGROUND
[0002] With the promotion of automatic driving, Internet of Things, cloud computing and 5G / 6G communication technology, the urban transportation system is undergoing profound changes. At the same time, global climate change has prompted carbon neutralization and sustainable development to become a global consensus, further increasing the demand for resource optimization and emergency management. In this context, the application of intelligent transportation systems (ITS) has been proven to effectively solve urban traffic problems, among which traffic flow prediction plays a crucial role. Good traffic flow prediction can provide scientific and effective decision support for traffic managers, optimize traffic resource allocation, reduce congestion, and improve urban operation efficiency. With the expansion of cities and the concentration of population, the complexity of traffic demand increases, and the flow of commuting, logistics and other travel activities surges, leading to increased load on road networks and increasingly serious urban traffic congestion problems. Therefore, efficient and accurate traffic flow prediction is the key to solving these problems, which not only improves the efficiency and responsiveness of the transportation system, but also provides scientific support for achieving the goal of sustainable urban development, which is of great significance for building future intelligent and green urban transportation systems.
[0003] The field of traffic flow prediction has continued to develop and has made many research achievements. Early research mainly relied on human experience and basic statistical models such as seasonal autoregressive integrated moving average (SARIMA) and hidden Markov model (HMM). These schemes usually assume that traffic flow time series are linear, making it difficult to handle large-scale data, so early traffic prediction schemes are difficult to cope with the growing mass of data. With the rapid development of machine learning, non-linear processing schemes such as support vector regression (SVR) and K-nearest neighbors (KNN) have emerged, improving the level of technology but lacking the ability to model time series information, making it difficult to adapt to changing traffic scenarios, relying on features or external algorithms to introduce time series information, and difficult to meet the demand for real-time traffic flow prediction, limiting the prediction ability of complex traffic environments.
[0004] The emergence of deep learning techniques has significantly improved the prediction capabilities of complex data, especially in handling temporal dependencies. Recurrent Neural Networks (RNN), Long Short-Term Memory (LSTM), and Gated Recurrent Unit (GRU) have advantages in time feature extraction, enabling them to capture the dependence of traffic flow changes over time. Due to the trend and periodicity of traffic flow, temporal features are important, but relying solely on time information in traffic flow prediction is insufficient to fully predict the comprehensive changes of traffic flow. Graph Neural Networks (GNN) are introduced due to their good adaptability to non-Euclidean space, enabling flexible modeling of complex relationships between nodes and edges. However, as traffic flow patterns become more diverse and unpredictable, and due to the lack of effective spatio-temporal traffic integration patterns, existing models still face many challenges in capturing long-range dependencies of traffic flow and handling the dynamic nature of time series and the multi-periodic trends of traffic data.
[0005] As the complexity of the model increases, a single model cannot fully meet the actual needs, so scholars explore integrated models to achieve more accurate traffic flow prediction by combining the advantages of multiple deep learning models. These models integrate graph structure modeling, sequence modeling, and attention mechanisms to form a multi-level spatio-temporal dependency processing framework. However, they still have limitations in capturing temporal features, especially in the fine-grained mining of time scales, which may affect the model's sensitivity to traffic flow changes and limit its accuracy and effectiveness in real-time prediction. Additionally, they fail to fully consider dynamic environmental factors and lack the ability to perceive and identify spatial information at multiple granularities, limiting their application potential in traffic flow prediction. Although these integrated solutions gradually strengthen spatio-temporal feature modeling, they only simulate the adjacency matrix representing the connection of spatial nodes and attempt to integrate it into traffic flow prediction models. Although the results have improved, they have not fully addressed the complex and diverse spatial interactions of traffic flow, and there is still room for improvement in capturing dynamic and complex traffic flow. SUMMARY
[0006] Invention purposes: The current traffic flow prediction problem faces the characteristics of strong integration and high complexity, and is accompanied by many problems such as more complex spatiotemporal dependence and temporal interaction, and mutual influence of different spatial regions on traffic flow, which still makes traffic prediction research face many challenges. Therefore, in order to solve the above problems, on the basis of fully considering the spatiotemporal relationship mode, a full-cycle traffic flow prediction method based on deep fusion of spatiotemporal characteristics is proposed, which can deeply integrate the complex spatiotemporal dependence of traffic flow, capture the change rule of traffic flow in multiple dimensions, multiple scales and multiple granularities, form a composite traffic situation awareness, and realize the comprehensive traffic flow prediction of multiple cycles. Experiments show that the method is better than similar models.
[0007] To achieve the above purpose, the technical scheme adopted by the present application is:
[0008] A full-cycle traffic flow prediction method based on deep fusion of spatiotemporal characteristics, comprising the following steps:
[0009] S1: The traffic network data is represented by spatiotemporal information. First, an adjacency matrix of the road network is constructed based on the distance and local neighborhood density, and the influence relationship between adjacent nodes is captured more accurately by comprehensively considering the spatial distance and local density relationship between road nodes. At the same time, a multi-dimensional temporal cycle fusion method is designed to fuse multiple time scales, which is represented by five feature matrices, namely the recent feature matrix F m (t) based on multi-level time window, the feature matrix F w (t) based on the time period of the week, the interactive feature matrix F td (t) based on time-date, the feature matrix F p (t) based on sliding window periodicity, and the feature matrix F res (t) based on time resolution. These temporal features not only help to improve the prediction performance of the model, but also provide a basis for revealing the potential law of traffic flow. Then, the spatiotemporal information fusion is used as the preliminary input of the model;
[0010] S2: A bidirectional gated temporal convolutional network Bi-Gated TCN is designed to capture short-term temporal dependence and effectively extract short-term potential patterns in historical and future traffic data, thereby improving the response ability to instantaneous traffic changes;
[0011] S3: A model TVMGCN-CAMGA based on time-varying multi-neighbor graph convolution and context multi-graph attention is designed to capture short-term multi-attribute neighborhood interaction, aggregate short-term spatial dependence through multi-layer fusion between multi-functional neighborhoods, and reduce the dimensionality of short-term spatiotemporal features;
[0012] S4: Design TVFormer to deeply mine long-term trends in historical traffic data, ensure that the model adapts to traffic flow changes under different time scales, and improve the feature recognition ability of long-period traffic flow fluctuations;
[0013] S5: Design SpaGraphFormer to deeply deconstruct key areas in high-dimensional traffic data, fully mine the topological structure in complex road networks, improve the model's perception of regional traffic changes, and reduce the dimensionality of medium and long-term spatiotemporal features;
[0014] S6: Reduce the dimensionality of short-term and medium and long-term spatiotemporal features and organically integrate multiple periodicities to perform multi-period traffic flow prediction;
[0015] S7: Compare and evaluate the prediction analysis results with the original traffic flow data in terms of mean absolute error, mean absolute percentage error, and root mean square error.
[0016] Compared with the prior art, the beneficial effects of the present application are:
[0017] (1) The spatiotemporal information comprehensive representation strategy designed in the present application, on the one hand, comprehensively considers the real regional spatial distance and neighborhood traffic density to construct an adjacency matrix, which can adapt to the perception of different spatial granularities, more comprehensively reflect the structural characteristics of the traffic network, and help to improve the sensitivity and prediction ability of the model to traffic flow changes; on the other hand, starting from multiple periodic features, a multi-dimensional time series cycle fusion strategy is designed to make the model fully represent the change trend of traffic flow at different time scales, providing the model with more robust time dimension information, thereby improving the full-cycle traffic prediction performance.
[0018] (2) The bidirectional gated temporal convolution network Bi-GatedTCN designed in the present application for capturing short-term time series dependence provides the model with the ability to dynamically control information flow through the bidirectional gating mechanism, ensuring that the model can fully utilize bidirectional time series dependence; the bidirectional dilated causal convolution captures long-range temporal dependence by expanding the receptive field while maintaining causality, so that the model can better capture the time-varying characteristics of traffic flow.
[0019] (3) The TVMGCN-CAMGA model designed in the present application for capturing short-term multi-attribute neighborhood interaction is based on time-varying multi-neighborhood graph convolution and context multi-graph perception attention, which can capture the dynamic changes of traffic flow in different spatial neighborhoods through multi-neighborhood graphs, and dynamically adjust the importance of different neighborhood nodes in feature learning through context multi-graph perception attention, thereby ensuring that the model can still maintain accurate prediction accuracy in rapidly changing traffic environments.
[0020] (4) The TVFormer model designed by the application for deeply mining long-term trends in historical traffic data can effectively store and update key features of historical traffic data, deeply extract time sequence dependencies under different time scales, mine long-term time sequence trends, and dynamically adjust the size of the time window according to the state of traffic flow, optimize the timeliness and relevance of input data, and ensure that the model can adapt to traffic flow changes under complex time scales.
[0021] (5) The SpaGraphFormer model designed by the application for deeply decomposing key areas in high-dimensional traffic data can fully consider key areas, adapt to the real physical characteristics of real-world traffic networks, extract multi-granularity spatial features by mining the topological structure in complex road networks, and thus can improve the accuracy of medium and long-term traffic prediction. BRIEF DESCRIPTION OF DRAWINGS
[0022] Figure 1 is a flowchart of the method of the application;
[0023] Figure 2 is a schematic diagram of spatiotemporal information comprehensive representation;
[0024] Figure 3 is a schematic diagram of a short-term time sequence dependency capture model: bidirectional gated temporal convolutional network (Bi-Gated TCN);
[0025] Figure 4 is a schematic diagram of a short-term multi-attribute neighborhood interaction capture model: time-varying multi-neighborhood graph convolution and context multi-graph awareness attention model (TVMGCN-CAMGA);
[0026] Figure 5 is a schematic diagram of a medium and long-term time sequence dependency capture model (TVFormer);
[0027] Figure 6 is a schematic diagram of a medium and long-term high-dimensional traffic data capture model (SpaGraphFormer);
[0028] Figure 7 is a comparison chart of MAE experimental indicators of the application and multiple traffic flow prediction algorithms;
[0029] Figure 8 is a comparison chart of MPE experimental indicators of the application and multiple traffic flow prediction algorithms;
[0030] Figure 9 is a comparison chart of RMSE experimental indicators of the application and multiple traffic flow prediction algorithms. DETAILED DESCRIPTION
[0031] The application discloses a full-cycle traffic flow prediction method based on spatiotemporal feature deep fusion.Figures 1 to 9 To make the purpose, technical solutions and advantages of the present invention clearer, a complete and clear description will be given below in conjunction with the accompanying drawings and experimental index comparisons.
[0032] Figure 1 The implementation flowchart of the full-cycle traffic flow prediction method based on the deep fusion of spatiotemporal features is presented, and the implementation steps are described in detail based on this flowchart.
[0033] like Figure 2 As shown, in step S1, the present invention comprehensively characterizes the spatiotemporal information of the traffic network data in order to enable the model to accurately capture the spatiotemporal variation characteristics of traffic flow, and at the same time better understand and predict the dynamic characteristics of traffic flow. Accurately characterizing the complex spatiotemporal relationship of the traffic network is the key to improving prediction accuracy. Designing a method based on distance and local neighborhood density to construct the adjacency matrix of the road network is to more accurately model the spatial relationship of traffic flow and the local road network structure, because the change in traffic flow is not only affected by time, but also closely related to the spatial position, connectivity and relative distance of the road; designing a multi-dimensional time series cycle fusion method to fuse multiple time scales is to more comprehensively and multi-levelly capture the multi-scale time series characteristics of traffic flow, so as to improve the accuracy and generalization ability of the prediction; the technical advantage of this is that it can comprehensively consider the changes in traffic flow at different scales, accurately capture the spatiotemporal dependence of traffic flow, enhance the local and global adaptability of the model, and improve the accuracy of the model in predicting full-cycle traffic flow.
[0034] The formula for constructing the adjacency matrix is as follows:
[0035]
[0036] Among them, dist(v i ,v j ) is the node v in the real traffic node i and node v j distance; σ m is the standard deviation of all road network distances; is node v i The local density of the node v i The quotient of the distance of nodes within a certain range and the standard deviation is calculated by taking the average value through the natural exponential function; κ is the overall threshold.
[0037] The five time series feature matrices constructed are as follows:
[0038] Recent feature matrix F based on multi-level time windows m (t): Focuses on capturing recent changes in traffic flow by using two different time windows (short time window T s and long time window Tl ) to focus on short-term and long-term traffic trends respectively. Specifically, for each time point t, the feature matrix F m (t) includes the time point t and its previous T s Hours of traffic flow data, and the previous T l This design allows the model to learn both short-term fluctuations and long-term changes, thereby improving the accuracy of predictions. The formula for the recent feature matrix based on multi-level time windows is as follows:
[0039]
[0040] Where R(t) represents the traffic flow data at time point t; T s is the size of the shorter time window; T l is the size of the larger time window.
[0041] Feature matrix F based on time periods within a week w (t): Traffic flow is usually affected by different time periods within a week. In order to model this influence more accurately, a weekly time period feature matrix is introduced. This matrix takes into account the traffic flow changes at each hour within a week. This method can capture the significant impact of time periods on traffic flow, thereby improving the prediction model's sensitivity to periodic fluctuations. Based on the weekly time period feature matrix, we focus on capturing traffic flow data at different time periods within a week. For each time point t, the feature matrix F w (t) contains hourly traffic flow data for the past week, reflecting traffic patterns in different time periods, helping the model identify and utilize the impact of time period changes on traffic flow. The characteristic matrix formula based on time periods within a week is as follows:
[0042] F w (t)=[W i (t),W i (t-1),...,W i (tT w +1)]
[0043] Among them, W i (t) represents the traffic flow data at time point t in the time period of week i; T w Indicates the size of the time window.
[0044] Time-date based interaction feature matrix F td(t): Note that traffic flow is influenced by the interaction of date and time, for example, the flow patterns on weekends and weekdays can be different, and the time of day also affects the flow. By considering the interactive features of date and time, these complex patterns can be more comprehensively modeled, thus improving the accuracy of prediction. The time-date interaction feature matrix captures the interaction effect by combining date features and time features. Specifically, for each time point t, the feature matrix F td (t) contains the product of date features D(t) and time period features T(t), reflecting the joint influence of date and time, which can help identify and utilize the complex interaction of date and time on traffic flow. The time-date interaction feature matrix formula is as follows:
[0045] F td (t) = [D(t) · T(t), D(t) · T(t-1),..., D(t) · T(t-T t +1)]
[0046] Where D(t) represents the date feature of time point t (specifically, the week number or date number); T(t) represents the time period feature of time point t (i.e., the hour number); T(t) represents the size of the time window.
[0047] Feature matrix F p (t) based on sliding window periodicity features: Traffic flow has significant periodicity features, such as daily and weekly cycles. In order to effectively capture these periodic patterns, a sliding window periodicity feature matrix is introduced, which can help the model identify and utilize the flow patterns within different periods, thus improving the prediction ability of periodic fluctuations. The sliding window periodicity feature matrix combines daily and weekly periodicity features, capturing these periodic patterns through a sliding window. For each time point t, the feature matrix F p (t) contains daily and weekly periodicity data within the past T p hours, which can help the model identify and utilize the periodic fluctuations of traffic flow. The feature matrix based on sliding window periodicity features is as follows:
[0048]
[0049] Where P d (t) represents the daily periodicity feature of time point t; P w (t) represents the weekly periodicity feature of time point t; T p represents the size of the periodic window.
[0050] Feature matrix F res(t): Traffic flow data can be recorded at different time resolutions, such as hourly and daily level data. To further capture the traffic flow changes at different time resolutions, a time resolution feature matrix is introduced, which can help the model to consider the traffic flow information at different time resolutions comprehensively, thereby improving the prediction performance. The time resolution feature matrix combines the hourly and daily level traffic flow data, and considers these different resolutions through a time window. For each time point t, the feature matrix F res (t) contains the hourly and daily level data within the past T r hours. This design can help the model to understand the traffic flow changes more comprehensively. The formula of the time resolution based feature matrix is as follows:
[0051]
[0052] where R hr (t) represents the hourly level traffic flow data at time point t; R d (t) represents the daily level traffic flow data at time point t; T r represents the size of the time window.
[0053] Combining the above five kinds of time series based feature representations, these features will be formalized as time series input x(t), the formula is as follows:
[0054]
[0055] where, is the sum of the feature dimensions.
[0056] As shown in Figure 3 , in the step S2, the application designs a bidirectional gated temporal convolutional network Bi-Gated TCN to capture short-term temporal dependencies. Bi-Gated TCN combines bidirectional gating mechanism and bidirectional convolution, which is good at capturing local and short-term temporal dependencies. The advantage is that it can better understand the short-term complex correlation of time series in traffic data. The bidirectional structure fully considers the past and future information in the time series data, enhances the prediction ability of the model, and the gating mechanism helps the model to filter the input information, enhances the learning ability of the model, and improves the generalization ability of the model. Bi-Gated TCN is composed of bidirectional gating mechanism, bidirectional dilated causal convolution and residual connection, etc. In the bidirectional gating mechanism, input gate and forget gate are designed to dynamically control information flow, and bidirectional dilated causal convolution is used to improve the performance of the network on long-term temporal dependencies. Then residual connection is introduced to ensure that the network does not lose the features of the original input due to the transmission of information layer by layer in the deep structure, thereby enhancing the short-term temporal dependency modeling ability of the model.
[0057] The bidirectional gating mechanism enhances the expression ability of the network by introducing gating units on the basis of the time convolution. Specifically, the bidirectional gating mechanism includes two key gating units: an input gate and a forget gate, which are similar to the mechanism in the long short-term memory network (LSTM) but are implemented in the convolutional network. The input gate controls the amount of new information input at each time step and adjusts the input activation value through the gating mechanism. The forget gate controls the amount of old information retained at each time step and aims to dynamically adjust the weight of each time convolution layer so that the network can adapt to features of different time scales. The formulas of the input gate and the forget gate are as follows:
[0058] i(t) = σ(Wix(t) + Uih(t-1) + b) i i t-1 i )
[0059] f(t) = σ(Wfx(t) + Ufh(t-1) + b) f f t-1 f )
[0060]
[0061]
[0062] wherein σ is a sigmoid activation function; tanh is a hyperbolic tangent activation function; W i ,W f , and U i ,U f , are weight matrices; b i ,b f , are bias terms; i(t) and f(t) represent the outputs of the input gate and the forget gate at time step t, respectively; x(t) is the feature of the input sequence at time step t; h t-1 is the hidden state of the previous time step.
[0063] Compared with the unidirectional dilated convolution, the bidirectional dilated convolution can more comprehensively capture the long-period variation trend of traffic flow. By setting different dilation rates, it can quickly capture information of different time scales without increasing the computational complexity, thereby enabling the network to effectively capture complex patterns and dependencies in long-time traffic sequences. At the same time, it can extract useful features from historical and future information, which is particularly important for short-term traffic flow fluctuation prediction. The formula of the bidirectional dilated causal convolution is as follows:
[0064] DilatedConv fwd (x(t))=σ(W dilated,fwd * d x(t)+b dilated,fwd )
[0065] DilatedConv bwd (x(t))=σ(W dilated,bwd * d x(t)+b dilated,bwd )
[0066] wherein, d denotes the convolution operation with dilation rate d; W dilated,fwd and W dilated,bwd are the weight matrices of the forward and backward dilated convolution respectively; b dilated,fwd and b dilated,bwd are the corresponding bias terms; DilatedConv fwd (x(t)) and DilatedConv bwd (x(t)) are the feature representations of the forward and backward dilated convolution respectively.
[0067] The output features of the bidirectional dilated causal convolution are fused by:
[0068] H(t)=ReLU(DilatedConv fwd (x(t))+DilatedConv bwd (x(t)))
[0069] wherein, H(t) is the fused short-term time sequence feature; ReLU() is an activation function.
[0070] As shown in Figure 4 , in the step S3, the model TVMGCN-CAMGA based on time-varying multi-neighbor graph convolution and context multi-graph attention is designed to capture short-term multi-attribute neighborhood interaction, aggregate short-term spatial dependence through multi-layer fusion between multi-functional neighborhoods, and reduce the dimension of short-term spatio-temporal features. First, multiple different adjacency graphs are designed, including physical adjacency, functional adjacency, and social adjacency, and then a time-varying multi-graph convolution network TVMGCN-FMNG is designed to fuse multiple adjacency graphs to comprehensively consider the multi-time sequence changes and dependence relationships between the adjacency graphs and capture spatial dependencies of different granularities.
[0071] The formula of multi-graph convolution is as follows:
[0072]
[0073] wherein, H f(l) denotes the node feature matrix of the l-th layer; A (k) denotes the adjacency matrix of the k-th graph; W (l,k) is the convolution weight matrix of the l-th layer corresponding to the k-th graph; σ(·) is a nonlinear activation function.
[0074] A (k) is expressed as three kinds of adjacency graphs, physical adjacency graph (A phy ): based on the physical connection relationship of road sensors, that is, the connection between traffic nodes constitutes a physical adjacency graph; functional adjacency graph (A fun ): the neighborhood graph constructed based on the functional similarity between traffic nodes; social adjacency graph (A soc ): the adjacency graph constructed based on the relationship between traffic flow and social and economic activities (such as commercial buildings, residential areas, etc.).
[0075] Due to the complex nonlinearity and non-stationarity of the spatio-temporal characteristics of traffic flow, relying only on the static adjacency matrix may not accurately reflect the traffic flow pattern changing over time. In order to further capture the spatio-temporal dynamic changes of traffic flow, a temporal-varying convolution (TVC) operation is designed and combined with the above multi-neighborhood graph convolution to form a temporal-varying multi-neighborhood multi-graph convolution (TVMGCN-FMNG), so that the convolution weight can be dynamically adjusted over time. This is because traffic data has significant spatio-temporal dynamics, for example, the traffic around schools on weekdays is obviously different from the traffic during holidays. Specifically, a time-dependent weight matrix W (l,k) (t) is introduced, where t represents the time step, and the formula of the temporal-varying convolution is as follows:
[0076]
[0077] where W (l,k) (t) = f(W (l,k) , t) is a function of time, which is modeled by a parameterization strategy based on time step t, and the time dependence is modeled by position encoding, and the formula is as follows:
[0078] W (l,k) (t) = W (l,k) ⊙ PE(t)
[0079] where ⊙ denotes Hadamard product; PE(t) is the position encoding of time step t; by this method, not only the current time features are captured, but also the dynamic change trend in the time series is implicitly considered, so that the short-term spatial features are more accurately extracted.
[0080] In order to further enhance the model's understanding and capture of spatiotemporal relationships and fully tap into the potential information in traffic flow data, a context-aware multi-graph attention mechanism (CAMGA) is designed and introduced into the multi-neighborhood graph convolution framework. This mechanism captures more complex spatial dependencies by dynamically adjusting the attention weights between different nodes. First, a context-aware attention mechanism is designed, where the attention weight of a node depends not only on the features of neighboring nodes but also on their global context information. Assume that the attention weight between node i and node j is α ij (t), which is calculated as follows:
[0081]
[0082] Among them, h i (t) and h j (t) are the hidden feature representations of node i and node j respectively; is the linear transformation matrix; is the attention vector; || || represents the vector concatenation operation; C ij (t) is a context-aware feature used to capture the context information between nodes.
[0083] Context-aware feature C ij The calculation of (t) is based on the historical interaction information between nodes, and the formula is as follows:
[0084]
[0085] Among them, g φ (·) is a parameterized function used to measure the interaction strength between node i and node j in history.
[0086] Furthermore, we introduce the Multi-Head Graph Attention strategy to concatenate the outputs of multiple attention heads to further improve the model's expressiveness. The Multi-Head Graph Attention mechanism computes multiple attention heads in parallel, concatenates the results, and then performs a nonlinear transformation. The formula is as follows:
[0087]
[0088] Where M represents the number of attention heads; represents the attention weight of the mth attention head at time step t.
[0089] like Figure 5As shown, in step S4, the TVFormer designed by the application deeply mines the long-term trend in historical traffic data, and improves the feature recognition capability for long-periodic fluctuations of traffic flow. On the basis of the traditional Transformer, the TVFormer contains several components such as dynamic memory network (DMN), multi-scale time series convolution and fusion (MSTC), sparse attention mechanism (SAM), and adaptive time window (ATW), which comprehensively improve the model's ability to capture medium and long-term time series features.
[0090] First, a dynamic memory network (DMN) is designed to enhance the memory capability of the time series model to better capture long-term dependencies. DMN stores historical information by maintaining a dynamically updated memory bank and uses the memory bank to improve current time series prediction. The memory update formula used is as follows:
[0091]
[0092] where Gate(·) is a gating mechanism that controls the proportion of memory update, and by taking the square root of it, the gating value is standardized to ensure that its value is within the range of 0 to 1; NewMemory(·) is used to generate new memory; and by normalizing operation ||W n x t +b n ||, it is ensured that the generated memory has a proper scale.
[0093] Further, a multi-scale time series convolution (MSTC) is designed to extract features of different time scales, and the long-term dependency features output by DMN are fused with the multi-scale features output by the MSTC module to achieve comprehensive extraction of traffic flow time series features. The formula used by multi-scale time series convolution is as follows:
[0094]
[0095] where Conv s (·) represents a multi-scale convolution operation; and by taking the form of , the scale adjustment is performed to ensure the standardization of the convolution features.
[0096] Then, feature fusion is performed, and the formula used is as follows:
[0097]
[0098] where, is the standardized coefficient in the fusion process, which is used to ensure the consistency of the scale after the fusion of different scale features. This process enables the model to integrate more comprehensive time series information when facing data of different time scales, enriching the feature representation. In addition, MSTC takes over DMN, which can continuously adjust the weights of the convolution kernel through the dynamic memory network, thereby further improving the adaptability to traffic flow changes.
[0099] After obtaining rich time series information, in order to selectively strengthen the focus on key moments (such as peak traffic periods) and to address the problem of high computational complexity of the standard attention mechanism, a sparse attention mechanism (Sparse Attention Mechanism) is designed to focus only on the most relevant part of the current time step. First, the attention score is calculated, as follows:
[0100]
[0101] where score ij represents the attention score; then the sparsification strategy is applied, which only retains the top k largest scoring attention weights, using the following formula:
[0102]
[0103] where, is the standardized coefficient, which is used to adjust the distribution of the score to conform to the normal distribution; only the top k largest scores are retained, which can significantly reduce the computational complexity.
[0104] In order to further adapt to the feature weights output by the SAM module, in order to capture more historical information and enhance the model's sensitivity to different time features, and to accurately capture long-term time series dependencies, an adaptive temporal window mechanism (Adaptive Temporal Window, ATW) is designed, which can adjust the size of the time window according to the dynamic characteristics of the input sequence. Assuming that the current time step is t, the size of the time window is w t , which can be learned, as follows:
[0105] w t = NN window (X multi-scale,t )
[0106] where NN window (·) is used to generate the size of the time window, and the result is an integer to ensure that the window is an integer; in the adaptive window, the time series features are extracted through a weighted operation, as follows:
[0107]
[0108] where, is the standardization coefficient of weighted convolution, which ensures the scale consistency of the convolution result; is the weighting factor, which ensures that the time steps far away have lower weights but not no weight; σ is the parameter to control the window width.
[0109] As shown in Figure 6 , in the step S5, the SpaGraphFormer designed by the application disassembles the key area in the high-dimensional traffic data, improves the perception of the model to the comprehensive change of the traffic in the area, and reduces the dimension of the medium and long-term spatio-temporal features. On the basis of the traditional Transformer, several components such as spatial feature extraction network (OSFEN), spatial adaptive pooling (OSAP), spatial perception weight distribution network (SPWDN), spatial graph convolution (OSGC), and spatial attention weighting (OSAWF) are designed in the SpaGraphFormer to improve the model's ability to capture the spatial dependence of complex road network structure and long-distance traffic flow.
[0110] In order to extract preliminary spatial features from the original traffic data, first, the spatial feature extraction network (Optimized Spatial Feature Extraction Network, OSFEN) is designed, so that when capturing long-term spatial features, the input spatial features can be dynamically adjusted. The network can adaptively adjust the spatial position of the features, thereby enhancing the modeling ability of long-distance traffic flow relationship. The flexibility of feature extraction is improved by introducing nonlinear operation, which is conducive to capturing local and global spatial features. The spatial features are preliminarily extracted by the following formula:
[0111]
[0112] wherein, is the feature map output by the l(th) layer; σ(·) is a nonlinear activation function used to improve the diversity of feature expression; is the standardization coefficient used to adjust the scale of the convolution output to keep the features stable; is the convolution kernel of the l(th) layer; k l is the size of the convolution kernel; is the bias term.
[0113] In order to enhance the depth of the network, the convolution operation is stacked layer by layer, and the skip connection is introduced to further enhance the feature extraction, which is as follows:
[0114] X L =X l +α·(X l *X l-1 )
[0115] wherein, a is a trainable weight parameter used to control the proportion of the skip connection, which helps to alleviate the gradient vanishing problem and promote the training effect of deep networks.
[0116] To further enhance the multi-scale capture of spatial features, an optimized spatial adaptive pooling (OSAP) is designed to introduce adaptability in the multi-scale processing of spatial features. OSAP introduces a dynamically adjusted pooling window to process spatial features at different scales, thereby not only adaptively capturing local details, but also controlling the contribution of different spatial regions through dynamic weights, so that the network can still accurately capture long-term dependencies when facing complex spatial structures. The formula is as follows:
[0117]
[0118] wherein, Pool j represents the pooling operation of the jth window; is a normalization term, which uses this weighted summation mechanism to allow the model to dynamically adjust the pooling weights according to the input features, thereby adaptively capturing spatial features in different regions; β j is the weight of the pooling window, which is dynamically generated by the network, and the generation method is as follows:
[0119]
[0120] wherein, W p is a parameter matrix used to generate weights.
[0121] Further, in order to capture the mutual dependency between different regions, a spatial perception weight distribution network (SPWDN) is designed to introduce dynamically adjusted spatial perception ability in feature similarity calculation, ensuring that the network can identify and focus on key regions during weight distribution. For a specific position (i,j), the spatial perception weight is generated by the following operation:
[0122]
[0123] wherein, represents the weight generation matrix; b a represents the bias term used to adjust the weight; is a normalization coefficient used to balance the scale of the inner product.
[0124] After having the weight A ij , the features of different key region positions can be weighted according to it, and the formula is as follows:
[0125]
[0126] wherein X SPWDN,i represent the features of different key area positions.
[0127] After obtaining the spatial weight distribution from the SPWDN, it is necessary to combine these weights with the spatial features to effectively capture the relationship between nodes in the traffic network. In order to solve the problem of dependence on graph structure in spatial network, considering the nonlinearity of graph structure, an optimized spatial graph convolution network (OSGC) is designed. OSGC constructs a graph structure on the feature map and performs convolution operation to capture the spatial dependence between regions. When constructing graph convolution, not only the direct neighbors are considered, but also the nodes farther away. The adjacency matrix is dynamically generated in the following way:
[0128]
[0129] wherein exp() represents the exponential function operation with e as the base.
[0130] The graph convolution operation is performed through matrix multiplication and nonlinear activation, and the formula is as follows:
[0131]
[0132] wherein, is the weight matrix of graph convolution; σ(·) is a nonlinear activation function.
[0133] After OSGC processing, the model has obtained a feature expression that fully considers the spatial structure and the relationship between nodes. The next step is how to further fuse these features and strengthen the role of important features in the final prediction. Therefore, an optimized spatial attention weighted features (OSAWF) module is proposed. In this module, the features after graph convolution are combined with the features generated by the spatial perception weight distribution network, and feature fusion is performed through weighted summation. The final weighted feature map calculation formula is as follows:
[0134] X final,i =γ·X SPWDN,i +(1-γ)·X gc,i
[0135] wherein γ is a learnable fusion parameter used to control the proportion of graph convolution features and spatial perception weight features; X SPWDN,i is the weighted feature calculated by the spatial perception weight distribution network; X gc,iare features obtained by spatial graph convolution.
[0136] In step S6, short-term and medium-term spatio-temporal features are reduced in dimension and organically fused in multiple cycles to perform multi-cycle traffic flow prediction. The detailed steps are as follows:
[0137] Spatial-temporal fusion encoding: through a double-flow network structure, spatial and temporal features are jointly encoded. Let the spatial encoding be E s,t (t), and the temporal encoding be E t,s (t), the formula is as follows:
[0138] E s,t (t) = SpatialEncoder(X(t)) + TemporalEncoder(x(t))
[0139] Wherein, SpatialEncoder and TemporalEncoder are spatial and temporal encoding modules respectively.
[0140] Mixed self-attention mechanism: the spatial-temporal mixed attention weight matrix A s,t (t) is calculated in the following manner:
[0141]
[0142] Wherein, Q s,t (t) = W q,s,t E s,t (t); K s,t (t) = W k,s,t E s,t (t); V s,t (t) = W v,s,t E s,t (t); Where Q s,t (t) = W q,s,t E s,t (t); K s,t (t) = W k,s,t E s,t (t); V s,t (t) = W v,s,t E s,t (t).
[0143] Spatial-temporal multi-head attention: multi-head attention mechanism is used for spatio-temporal joint feature learning:
[0144] H s,t (t) = Concat(Z s,t,1 (t), Z s,t,2 (t),..., Z s,t,H (t))W h,s,t
[0145] spatio-temporal mixed feature output: final mixed feature output O s,t (t) is represented as:
[0146] O s,t (t) = FeedForward(H s,t (t)) + E s,t (t)
[0147] fusion and prediction of spatio-temporal features: after obtaining the spatial feature O s (t), the time series feature O t (t) and the spatio-temporal mixed feature O s,t (t), nonlinear fusion is performed through a feature fusion layer to obtain the final prediction value
[0148]
[0149] wherein, represents the predicted traffic flow data at the future time point.
[0150] In the step S7, the mean absolute error (MAE) represents the average of the absolute errors between the predicted value and the true value, and is used to measure the average deviation degree between the predicted value and the true value; the mean absolute percentage error (MAPE) represents the average of the absolute percentage errors between the predicted value and the true value, and is used to measure the average error degree of the predicted value relative to the true value, considering the proportion of the error relative to the true value; the root mean square error (RMSE) represents the square root of the average of the square errors between the predicted value and the true value, and is used to measure the average deviation degree between the predicted value and the true value, and to punish large errors. The corresponding formulas are as follows:
[0151]
[0152]
[0153]
[0154] wherein, n is the number of samples; y i is the true value of the i-th sample; is the predicted value of the i-th sample; the three evaluation indexes can be used to evaluate the accuracy and performance of the traffic flow prediction model, and the smaller the MAE and RMSE, the better, and the closer the MAPE to 0, the smaller the prediction error.
[0155] The prediction effect of the present application is further illustrated in combination with the comparison of a plurality of experimental indexes of a plurality of models as follows:
[0156] The application uses four different data sets to evaluate the effectiveness of the proposed method, namely PEMS03 data set, PEMS04 data set, PEMS07 data set and PEMS08 data set. As shown in Table 1, Table 1 lists detailed information of the collected data of the four data sets;
[0157] Table 1
[0158]
[0159] The four data sets are all real traffic data collected by the Performance Measurement System (PEMS) of the California Department of Transportation, USA, and each contains hundreds of sensor sampling nodes and tens of thousands of time steps, and each time span is as long as several months, and each time the sensor collects data containing three-dimensional features, namely traffic flow, average speed and average occupancy, and the feature mainly used by the application is traffic flow. Taking PEMS04 and PEMS08 data sets as examples, PEMS04 is traffic flow data collected by 307 sensors every 5 minutes, a total of 59 days; PEMS08 is traffic data collected by 170 sensors every 5 minutes, a total of 62 days. In order to make the research results of the application comparable with the previous research results, the same data set division method is used for the four data sets, specifically, the proportion of the training set is set to 80%, and the proportion of the validation set and the test set is each 10%.
[0160] The application adopts the GPU version of PyTorch1.13.1 framework, and the host uses a 16GB memory NVIDIA GTX 1060 (Intel(R) Core(TM) i7-8750H CPU@2.20GHz 2.21GHz); the learning rate of the Adam optimizer is set to 0.001; in order to more accurately train the model, the size of each batch is set to 8 or 16; 2 residual connection units are selected and stacked with 6 bidirectional time series dilated causal convolution layers to capture short-term time series dependencies; 4 context-aware attention and multi-head attention are selected to cooperate with two layers of multi-graph convolution layers to capture short-term spatial dependencies;
[0161] The effectiveness of the traffic flow prediction method proposed by the application is evaluated by comparing with eighteen existing methods. The eighteen existing methods include:
[0162] (1) HA: The historical average method predicts the future value by calculating the average value of a period of time in the past, which is suitable for smooth time series and the method is relatively simple, but cannot capture complex time dependence.
[0163] (2) ARIMA: A linear method combining autoregression, difference and moving average, suitable for processing time series with trends and seasonality.
[0164] (3) LSTM: A special type of recurrent neural network (RNN) that effectively maintains and updates memory states by introducing a gating mechanism, solving the gradient vanishing problem in RNNs, and excels at capturing long-term dependencies, suitable for sequence data with long-term dependencies.
[0165] (4) FC-LSTM: Based on the standard LSTM, it adds a fully connected layer for higher-level feature extraction. Suitable for complex time series tasks, further enhancing the predictive ability of the model.
[0166] (5) GRU: A simplified LSTM that uses a gating mechanism to manage information flow, with relatively low computational cost. Compared to LSTM, GRU can achieve similar results in many applications.
[0167] (6) TCN: Uses causal convolution structure to process time series, with parallel computing advantages. By extending the convolution kernel, it can effectively capture long-term dependencies and avoid the defects of recursive structure.
[0168] (7) GCN: Processes non-Euclidean data through graph convolution operations, extracting features through the connection between nodes. It can model the dependencies between nodes in traffic flow and effectively capture local and global structural information.
[0169] (8) STGCN: Combines spatio-temporal convolution and graph convolution, modeling the spatio-temporal characteristics of traffic flow by introducing a time dimension. It can be used for dynamic traffic flow prediction tasks and can consider both spatial dependencies and temporal changes.
[0170] (9) DCRNN: Combines diffusion convolution and recurrent neural networks, using graph structure and time series information for traffic flow prediction. The diffusion process enhances information propagation capabilities and can effectively capture long-term and short-term dependencies.
[0171] (10) Graph WaveNet: Combines graph convolution and time convolution to model spatio-temporal relationships using graph wave characteristics. It uses a learnable adjacency matrix and attention mechanism to enhance the model's adaptability to dynamic changes.
[0172] (11) ASTGCN: Introduces a self-attention mechanism based on STGCN, improving the ability to focus on important moments and spatial regions, allowing for more accurate capture of key changes in traffic flow.
[0173] (12) STSGCN: Models through smooth graph convolution and time series, reducing the impact of noise on prediction and enhancing the ability to capture underlying trends in data, suitable for handling high-noise traffic data.
[0174] (13) STFGNN: Integrates multiple features, predicts traffic flow through graph convolution and time feature extraction, can handle complex traffic patterns, and improves model expression ability and prediction accuracy.
[0175] (14) STTN: Integrates time and space Transformer modules to effectively capture time and spatial dependencies.
[0176] (15) STFGCN: Learns specific traffic patterns for each node through node-specific graph convolution operations, learns dynamic spatial interdependencies between traffic sequences through adaptive adjacency matrices, and uses a Transformer-based global time correlation learning module to learn global dependencies of traffic sequences.
[0177] (16) TPGraph: Effectively utilizes upstream and downstream road information by integrating three parts, can generate accurate predictions of future traffic conditions using only multi-scale historical traffic conditions and spatial factors as inputs.
[0178] (17) MTDLTFP: Combines Transformer models, uses multiple encoders and decoders to extract features from initial traffic data, reduces the time required for manual feature construction, and constructs more effective hidden features.
[0179] (18) RPConvFormer: Based on the Transformer framework, improved by introducing relative position encoding and 1D convolution layers to address the limitations of Transformers in handling traffic flow prediction tasks.
[0180] To verify the effectiveness of the method proposed in the application for full-cycle traffic flow prediction, a large number of comparative experiments were conducted on four data sets for three indicators compared with existing methods and the latest methods. Taking the PEMS04 data set as an example, the overall experimental results of MAE, MAPE, and RMSE three indicators at multiple different time periods are shown in Figure 7 、 Figure 8 and Figure 9 .
[0181] From Figures 7 to 9It can be seen that the full-cycle traffic flow prediction method proposed in the present application exceeds the compared method in the prediction results of each time period in three experimental indicators, which fully verifies the effectiveness of the present application in processing complex dynamic traffic flow prediction tasks. On the one hand, this is due to the fact that the bidirectional gated temporal convolutional network can fully mine the interaction between different time nodes in such long time series of road network data, so that a large amount of future node information can be used to assist the prediction of the current or next time step, instead of wasting these information. On the other hand, the context-aware attention with multiple heads further refines the weights of the nodes, even the nodes far away from the current node, the present application can also take into account its prediction for the next time step, because even if the interaction influence is very small, when the time series is long, there are quite a number of nodes, no matter how far apart they are, when aggregated, they can also play a "four ounces move a thousand catties" role in the prediction of the next step. And the use of the spatial-aware weight distribution network also further ensures that the nodes with "important influence" in the spatial domain, their information will play their own role in the traffic flow prediction of the next moment. Thanks to the use of the above components, the present application has better performance in the overall full-cycle traffic flow prediction.
[0182] The above is a detailed description of the embodiments of the present application in conjunction with the drawings, and the specific embodiments of the present application are only used to help understand the method of the present application. For ordinary skilled in the art, according to the idea of the present application, the specific embodiments and application range can be changed and modified, therefore the specification should not be understood as limiting the present application.
Claims
1. A full-cycle traffic flow prediction method based on deep fusion of spatiotemporal features, characterized by: The following steps are involved: S1: The traffic network data is comprehensively represented in terms of spatiotemporal information. First, a method based on distance and local neighborhood density is designed to construct the adjacency matrix of the road network. By comprehensively considering the spatial distance and local density relationship between road nodes, the influence relationship between adjacent nodes can be captured more accurately. At the same time, a multi-dimensional time series cycle fusion method is designed to integrate multiple time scales, which are represented by five feature matrices: the recent feature matrix F based on multi-level time windows, m (t), the feature matrix F based on the time period within the week w (t), time-date interaction feature matrix F td (t), feature matrix F based on the periodic characteristics of the sliding window p (t), feature matrix F based on time resolution res (t), these time series features not only help improve the prediction performance of the model, but also provide a basis for revealing the underlying laws of traffic flow, and then the spatiotemporal information fusion is used as the preliminary input of the model; S2: Design a bidirectional gated temporal convolutional network (Bi-GatedTCN) to capture short-term temporal dependencies, effectively extract short-term potential patterns in historical and future traffic data, and improve the ability to respond to instantaneous traffic changes; S3: Design a model based on time-varying multi-neighborhood graph convolution and context-aware multi-graph attention, TVMGCN-CAMGA, to capture short-term multi-attribute neighborhood interactions, aggregate short-term spatial dependencies through multi-layer fusion between multifunctional neighborhoods, and reduce the dimensionality of short-term spatiotemporal features; S4: Design TVFormer to deeply explore long-term trends in historical traffic data, ensure that the model adapts to traffic flow changes at different time scales, and improve the ability to identify the characteristics of long-term fluctuations in traffic flow; S5: Design SpaGraphFormer to deeply deconstruct key areas in high-dimensional traffic data, fully explore the topological structure of complex road networks, improve the model's perception of comprehensive changes in regional traffic flow, and reduce the dimensionality of medium- and long-term spatiotemporal features; S6: Reduce the dimensionality of short-term and medium-term and long-term spatiotemporal features and perform multi-periodic organic fusion to perform multi-period traffic flow prediction; S7: Compare and evaluate the prediction analysis results with the original traffic flow data in terms of mean absolute error, mean absolute percentage error, and root mean square error.
2. The full-cycle traffic flow prediction method based on deep fusion of spatiotemporal features according to claim 1 is characterized by: In step S1, the traffic network data is subjected to a comprehensive temporal and spatial information representation, which includes the following steps: Step 1-1: Considering the spatial location, connectivity, and relative distance of roads in the traffic network data, a method based on distance and local neighborhood density is designed to construct an adjacency matrix for the road network. Step 1-2: Design a multi-dimensional time series cycle fusion method to fuse multiple time scales, specifically including: recent feature matrix F based on multi-level time windows m (t), the feature matrix F based on the time period within the week w (t), time-date based interaction feature matrix F td (t), Feature matrix F based on sliding window periodicity p (t), feature matrix F based on time resolution res (t); Steps 1-3: Fusion of spatiotemporal information as initial input to the model.
3. The full-cycle traffic flow prediction method based on deep fusion of spatiotemporal features according to claim 1 is characterized by: In step S2, a bidirectional gated temporal convolutional network (Bi-GatedTCN) is designed to capture short-term temporal dependencies, including the following steps: Step 2-1: Design a bidirectional gating mechanism, which includes two key gating units: input gate and forget gate. The input gate controls the amount of new information input at each time step and adjusts the input activation value through the gating mechanism. The forget gate controls the amount of old information retained at each time step, aiming to dynamically adjust the weights of each temporal convolutional layer so that the network can adapt to characteristics at different time scales. Step 2-2: Design a bidirectional dilated causal convolutional module to enable the network to effectively capture the complex patterns and dependencies in long-term traffic sequences. While capturing long-range dependencies that increase over time, it can also extract useful features from both historical and future information, ensuring that the model is more sensitive to short-term traffic flow fluctuations. Step 2-3: Fuse the short-term temporal features output by the bidirectional dilated causal convolution.
4. The full-cycle traffic flow prediction method based on deep fusion of spatiotemporal features according to claim 1 is characterized by: In step S3, a model TVMGCN-CAMGA based on time-varying multi-neighborhood graph convolution and contextual multi-graph-aware attention is designed to capture short-term multi-attribute neighborhood interactions, including the following steps: Step 3-1: Design multiple different adjacency graphs, including physical adjacency graphs (A phy ): Based on the physical connection relationship of road sensors, that is, the connection between traffic nodes constitutes a physical adjacency graph; functional adjacency graph (A fun ): Neighborhood graph based on functional similarity between transportation nodes; Social adjacency graph (A soc ): an adjacency graph based on the relationship between traffic flow and socioeconomic activities; Step 3-2: Perform multi-graph convolution on the adjacency graph, design a time-varying convolution (TVC) operation, and fuse it with the above multi-neighborhood graph convolution to form a time-varying multi-neighborhood multi-graph convolution (TVMGCN-FMNG), so that the convolution weights can be dynamically adjusted over time; Step 3-3: Design context-aware attention, that is, the attention weight of a node depends not only on the features of neighboring nodes, but also considers its global context information; Step 3-4: Introduce the MultiHeadGraphAttention strategy to concatenate the outputs of multiple attention heads to form the ContextAwareMultiGraphAttention (CAMGA) mechanism. By dynamically adjusting the attention weights between different nodes, it captures more complex spatial dependencies to further improve the expressiveness of the model.
5. The full-cycle traffic flow prediction method based on deep fusion of spatiotemporal features according to claim 1 is characterized by: In step S4, TVFormer is designed to deeply mine the long-term trends in historical traffic data, including the following steps: Step 4-1: Design a Dynamic Memory Network (DMN) to store historical information by maintaining a dynamically updated memory bank. This memory bank is used to improve current time series predictions and enhance the memory capacity of the time series model to better capture long-term dependencies. Step 4-2: Design a Multi-Scale Temporal Convolution (MSTC) to extract features at different time scales. The long-term dependency features output by the DMN are integrated with the multi-scale features output by the MSTC module to fully extract the temporal features of traffic flow. Step 4-3: Design a sparse attention mechanism (SAM) to focus only on the most relevant parts of the current time step, selectively strengthening attention to key moments while solving the problem of high computational complexity of the standard attention mechanism. Step 4-4: Design an adaptive temporal window mechanism (ATW) to adjust the time window size according to the dynamic characteristics of the input sequence, further adapt the feature weights output by the SAM module, so as to capture more historical information, enhance the model's sensitivity to different temporal features, and accurately capture medium- and long-term temporal dependencies.
6. The full-cycle traffic flow prediction method based on deep fusion of spatiotemporal features according to claim 1 is characterized by: In step S5, SpaGraphFormer is designed to deeply deconstruct key areas in high-dimensional traffic data, including the following steps: Step 5-1: Design an Optimized Spatial Feature Extraction Network (OSFEN) to dynamically adjust the input spatial features while capturing long-term spatial features. The network can adaptively adjust the spatial position of features, thereby enhancing the ability to model long-distance traffic flow relationships. The introduction of nonlinear operations improves the flexibility of feature extraction, thereby facilitating the capture of local and global spatial features. Step 5-2: Design Optimized Spatial Adaptive Pooling (OSAP) to introduce adaptivity in the multi-scale processing of spatial features. OSAP processes spatial features at different scales by introducing a dynamically adjusted pooling window. This not only allows for adaptive capture of local details, but also controls the contribution of different spatial regions through dynamic weights, enabling the network to accurately capture long-term dependent features even in the face of complex spatial structures. Step 5-3: Design the Spatial Perception Weight Distribution Network (SPWDN) to introduce dynamically adjusted spatial perception capabilities into feature similarity calculations, ensuring that the network can identify and focus on key areas during the weight distribution process. Step 5-4: Design an Optimized Spatial Graph Convolution Network (OSGC). OSGC builds a graph structure on the feature graph and performs convolution operations to capture the spatial dependencies between regions. When constructing the graph convolution, it considers not only direct neighbors but also more distant nodes. Step 5-5: We further propose an optimized spatial attention weighted features enhancement module (OSAWF), in which the features after graph convolution are combined with the features generated by the spatial weight distribution network, and feature fusion is performed through weighted summation.
7. The full-cycle traffic flow prediction method based on deep fusion of spatiotemporal features according to claim 1 is characterized by: In step S6, the short-term and medium-term spatiotemporal features are reduced in dimension and organically integrated into multiple periods to perform multi-period traffic flow prediction, including the following steps: Step 6-1: Design spatial-temporal fusion encoding: Jointly encode spatial and temporal features through a two-stream network structure; Step 6-2: Use the hybrid self-attention mechanism to calculate the spatial-temporal hybrid attention weight matrix; Step 6-3: Design spatial-temporal multi-head attention and use the multi-head attention mechanism to perform spatiotemporal joint feature learning; Step 6-4: Execute spatiotemporal mixed feature output; Step 6-5: Perform fusion and prediction of spatiotemporal features, and perform nonlinear fusion through the feature fusion layer to obtain the final prediction value.
8. The full-cycle traffic flow prediction method based on deep fusion of spatiotemporal features according to claim 1 is characterized by: In step S7, the prediction analysis results are compared and evaluated with the original traffic flow data in terms of mean absolute error, mean absolute percentage error and root mean square error. The mean absolute error (MAE) represents the average of the absolute errors between the predicted value and the true value, and is used to measure the average degree of deviation between the predicted value and the true value; the mean absolute percentage error (MAPE) represents the average of the absolute percentage errors between the predicted value and the true value, and is used to measure the average degree of error of the predicted value relative to the true value, taking into account the proportion of the error relative to the true value; the root mean square error (RMSE) represents the square root of the average of the square errors between the predicted value and the true value, and is used to measure the average degree of deviation between the predicted value and the true value, and penalizes large errors; these three evaluation indicators can be used to evaluate the accuracy and performance of the traffic flow prediction model. The smaller the MAE and RMSE, the better. The closer the MAPE is to 0, the smaller the prediction error.
Citation Information
Patent Citations
Traffic prediction method based on multi-scale space-time fusion graph network
CN115240425A
Traffic flow forecasting method based on multi-mode dynamic residual graph convolution network
US20230334981A1