Traffic flow prediction method and system based on delay modeling

By constructing a traffic flow prediction model based on latency modeling, the problem that traditional methods are difficult to deal with complex traffic data is solved, and more efficient and accurate traffic flow prediction is achieved.

CN120199081AActive Publication Date: 2025-06-24OCEAN UNIV OF CHINA

Patent Information

Application Number
CN202510685568.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-06-24
Estimated Expiration
2045-05-27

AI Technical Summary

Technical Problem

Traditional traffic prediction methods are difficult to effectively handle nonlinear and complex dynamic changes in real traffic data, and have low computing efficiency and poor scalability, which cannot meet the needs of real-time prediction.

Method used

Delay modeling is adopted to construct traffic flow prediction models through data embedding layer, dynamic graph neural network layer, spatiotemporal coding layer and multi-layer stacking, and use historical data and road topology for prediction.

Benefits of technology

It improves the timeliness and accuracy of traffic flow prediction, can effectively handle complex traffic data changes, avoids cumulative errors, improves the accuracy of multi-step prediction, and has the ability to continuously optimize.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120199081A_ABST
    Figure CN120199081A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of traffic flow prediction, in particular to a traffic flow prediction method and system based on delay modeling. The method comprises the following steps: acquiring traffic historical time sequence data and a road topological structure; defining a traffic flow prediction problem based on traffic historical time sequence data and a road topology structure; constructing a traffic flow prediction model of delay modeling, wherein the traffic flow prediction model comprises data embedding layer modeling, dynamic graph neural network layer modeling, space-time coding layer modeling, delay modeling, multi-layer stacking of space-time coding and data output layer construction; compared with a traditional statistical model and machine learning method, the deep learning method based on delay modeling can effectively process nonlinear and complex dynamic changes in real traffic data, and meanwhile, the problems that machine learning is low in calculation efficiency and poor in expansibility are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of traffic flow prediction, and in particular to a traffic flow prediction method and system based on delay modeling. Background Art

[0002] With the continuous acceleration of the urbanization process, people's travel demand has increased significantly, the urban motor vehicle ownership has grown rapidly, and the problem of road congestion has become increasingly serious. Congestion not only reduces travel efficiency, but also increases the risk of traffic accidents and environmental pollution, bringing many inconveniences to urban management and residents' lives. At the same time, the rapid development of modern technology has enabled various sensors such as electronic police cameras, checkpoint detectors, GPS devices, etc. to be widely deployed in the urban traffic network. These devices collect a large amount of traffic data in real time, such as traffic flow, vehicle speed, vehicle density and other information. The rapid accumulation of these data provides a rich information resource basis for traffic prediction and management, making traffic prediction technology an important means to alleviate traffic congestion and optimize traffic resource allocation. How to utilize these rich data resources, effectively predict future traffic conditions, and timely adjust traffic signal control strategies and optimize the operation efficiency of the road network has become one of the hot topics in the research of intelligent transportation systems (ITS).

[0003] Traditional traffic prediction methods mainly include statistical models and traditional machine learning methods. Statistical models are represented by autoregressive integrated moving average (ARIMA). This method can effectively predict future traffic flow by analyzing historical traffic data and has been widely used in past traffic prediction practices. In addition, methods such as exponential smoothing method and regression analysis have also been widely used in traffic flow prediction. However, these methods generally assume that the data presents simple linear or stationary characteristics and are difficult to cope with the complex dynamic changes in real traffic flow data.

[0004] Traditional machine learning methods include feature-based methods, Gaussian process models and state space models. Feature-based methods usually construct prediction models by extracting and selecting artificially designed traffic features; Gaussian process models can better capture spatial and temporal correlations; state space models use the relationship between observed data and hidden states for prediction and have unique advantages in modeling the uncertainty of traffic systems. However, when dealing with large-scale data and high-dimensional feature spaces, these methods often face problems of excessive computational complexity and storage requirements.

[0005] By analyzing and summarizing existing prediction methods, the traditional traffic prediction methods have the following main deficiencies: 1) Statistical models assume that data has simple linear or stationary characteristics, and it is difficult to effectively handle the non-linearity and complex dynamic changes of real traffic data. 2) Traditional machine learning methods have obvious computational efficiency and scalability problems when the data dimension is high or the data volume is large, and it is difficult to meet the requirements of real-time prediction. 3) Existing methods usually ignore the delay characteristics and spatio-temporal correlations between different nodes in the traffic network, and fail to effectively utilize the spatio-temporal coupling information of traffic data, affecting the prediction accuracy. Summary of the Invention

[0006] To solve the above-mentioned problems, the present invention provides a traffic flow prediction method and system based on delay modeling. It can effectively solve the above problems, achieve more effective state updates, and improve the timeliness and accuracy of traffic flow prediction.

[0007] In the first aspect, a traffic flow prediction method based on delay modeling provided by the present invention adopts the following technical solutions: A traffic flow prediction method based on delay modeling includes: Obtain traffic historical time series data and road topology structure; Define a traffic flow prediction problem based on the traffic historical time series data and road topology structure; Construct a traffic flow prediction model based on delay modeling, which includes data embedding layer modeling, dynamic graph neural network layer modeling, spatio-temporal encoding layer modeling, multi-layer stacking of delay modeling and spatio-temporal encoding, and construction of a data output layer; Train the model based on the defined traffic flow prediction problem; Use the trained model to predict traffic flow.

[0008] Further, the obtaining of the traffic historical time series data and road topology structure includes defining the traffic network as a directed graph , where represents a set of nodes composed of sensor nodes in the urban traffic road network, and each node corresponds to a traffic monitoring device at a specific location in the road network, represents a set of edges representing the connection relationship between nodes; is an adjacency matrix, which is used to represent the connection strength or interaction strength between nodes; and the historical traffic time series data is represented as a three-dimensional tensor , where represents the historical observation time step, is the number of nodes, is the traffic feature dimension of each node.

[0009] Furthermore, defining the traffic flow prediction problem based on traffic historical time series data and road topology includes assuming known historical traffic time series data , where is the length of the historical observation window, is the total number of nodes, is the node feature dimension. The goal of the prediction task is to construct a prediction function , using the historical observation data and the traffic network structure , to predict the future traffic flow data, that is, to predict the data of the future time steps, expressed as: , where represents the prediction result of the traffic flow at the th future time step, and .

[0010] Furthermore, the data embedding layer modeling includes using a data embedding method that fuses time information and space information to generate a high-dimensional embedding representation of each node at each time step. Among them, in the time dimension, the original input is converted to through a fully connected layer MLP, where is the specified embedding dimension. By performing one-hot encoding on the discrete time variable and processing it through a fully connected layer, an initial time embedding representation is generated; in the space dimension, a normalized Laplacian matrix is constructed based on the adjacency matrix, and its eigenvalue decomposition is performed to obtain eigenvalues and eigenvectors; finally, an element-wise summation operation is performed after aligning the embedding representation and the tensor in dimensions to obtain the output of the data embedding layer.

[0011] Furthermore, the dynamic graph neural network layer modeling includes designing a dynamic graph neural network to achieve delay-aware modeling. First, a normalized adjacency matrix is used in the graph neural network, and the symmetric normalization method is adopted to adjust the contribution of each neighbor to an average weight. On the input data of delay modeling, a delayed version is constructed, such that each time step corresponds to the node features at the previous moment , and they are concatenated in the feature dimension with the original sequence to obtain the combined input ; then, a graph structure is independently constructed at each time step , the input feature matrix of each time step is extracted, and a graph convolutional neural network GCN is used for graph feature extraction. Finally, an output sequence is obtained based on the output of each time step, and a fully connected mapping layer is used to restore the hidden feature dimension to the input feature dimension.

[0012] Furthermore, the spatio-temporal encoding layer modeling includes constructing a multi-head self-attention mechanism to extract spatio-temporal features of traffic data. Among them, in the temporal encoding attention, the features of the input data in the temporal dimension are mapped to the reference point representation space through multi-head self-attention, and then the reference point is used to capture the long-term dynamic correlations between each time slice; in the spatial encoding attention, the features of the input data in the spatial dimension are mapped to the reference point representation space, so as to capture the spatial correlations between nodes; finally, the outputs of the two attention mechanisms are fused through an MLP to form a unified spatio-temporal encoding output representation: , wherein, are learnable parameters, is an offset, is an activation function, is the output of the temporal encoding attention, is the output of the spatial encoding attention, is the final output representation of the spatio-temporal encoding layer.

[0013] Furthermore, the multi-layer stacking of the delay modeling and spatio-temporal encoding includes, in the delay modeling layer, according to the dynamic characteristics of the traffic network, capturing the information transfer delay features between different time steps through a dynamic graph convolutional network DGCN; then taking the output of the delay modeling layer as the input of the spatio-temporal encoding layer, and the spatio-temporal encoding layer calculates the attention in parallel in the temporal dimension and the spatial dimension respectively, and mines the intrinsic correlations between nodes and time steps through the multi-head self-attention mechanism of the Transformer, and outputs a unified spatio-temporal feature representation; on the output features of each stacking unit, a next-layer stacking unit is connected, and continuous iterative modeling is performed, so as to extract more abstract and high-order spatio-temporal delay feature representations layer by layer.

[0014] Furthermore, the construction of the data output layer includes the high-level feature representation obtained through multi-layer stacking, and adding the outputs of each layer to obtain the final hidden state ; in order to obtain multi-step predictions, the output layer is used to convert the final hidden state to the required dimension, and the predicted step traffic flow data is obtained through two 1×1 convolutional kernels. Here, a direct method rather than a recursive method is selected for multi-step prediction, which is considered in terms of cumulative error and model efficiency.

[0015] Further, the model training based on the defined traffic flow prediction problem includes dividing the input data into a training set and a test set, adopting the batch gradient descent algorithm, dividing the data in the training set into multiple small batches, updating the model parameters batch by batch, traversing all the data in the training set in each round of training, calculating the value of the loss function, and then adjusting the model parameters according to the gradient of the loss function. Among them, the mean absolute error is selected as the loss function, and the prediction error of the model is measured by calculating the average of the absolute values of the differences between the predicted values and the true values. The expression is: where represents the traffic flow predicted by node at time, represents the actual traffic flow of node at time.

[0016] In a second aspect, a traffic flow prediction system based on delay modeling includes: A data acquisition module configured to acquire traffic historical time series data and road topology; A definition module configured to define a traffic flow prediction problem based on traffic historical time series data and road topology; A model construction module configured to construct a traffic flow prediction model based on delay modeling, including data embedding layer modeling, dynamic graph neural network layer modeling, spatio-temporal encoding layer modeling, multi-layer stacking of delay modeling and spatio-temporal encoding, and construction of a data output layer; A model training module configured to perform model training based on the defined traffic flow prediction problem; A prediction module configured to perform traffic flow prediction using the trained model.

[0017] In a third aspect, the present invention provides a computer-readable storage medium, in which multiple instructions are stored, and the instructions are adapted to be loaded and executed by a processor of a terminal device to perform the traffic flow prediction method based on delay modeling.

[0018] In a fourth aspect, the present invention provides a terminal device, including a processor and a computer-readable storage medium. The processor is used to implement each instruction; the computer-readable storage medium is used to store multiple instructions, and the instructions are adapted to be loaded and executed by the processor to perform the traffic flow prediction method based on delay modeling.

[0019] In summary, the present invention has the following beneficial technical effects: Compared with traditional statistical models and machine learning methods, the deep learning method based on latency modeling can effectively handle the non-linearity and complex dynamic changes in real-world traffic data, while compensating for the problems of low computational efficiency and poor scalability in machine learning.

[0020] The deep learning method based on latency modeling can directly perform multi-step predictions without recursively using the single-step prediction results. By directly converting the final hidden state into the multi-step prediction results, the model can avoid the influence of cumulative errors and improve the accuracy of multi-step predictions.

[0021] The deep learning model based on latency modeling learns completely based on data, can automatically extract useful features and patterns from large-scale historical data without manual feature design. At the same time, by regularly retraining and fine-tuning, the model parameters are continuously updated to adapt to the changes in the traffic network and new data. This continuous optimization ability enables the model to always maintain a high prediction accuracy. Brief Description of the Drawings

[0022] Figure 1 is a schematic diagram of a traffic flow prediction method based on latency modeling according to the present invention; Figure 2 is a flowchart of a dynamic graph neural network layer based on latency modeling according to the present invention; Figure 3 is a flowchart of a spatio-temporal encoding layer; Figure 4 is a flowchart of multi-layer latency modeling and spatio-temporal encoding; Figure 5 is an overall framework diagram for realizing traffic prediction; Figure 6 is a diagram for verifying experimental effects. Detailed Embodiments

[0023] The present invention will be further described in detail below with reference to the accompanying drawings.

[0024] Embodiment 1 Referring to Figure 1 , a traffic flow prediction method based on latency modeling in this embodiment includes: Obtain traffic historical time-series data and road topology; Define the traffic flow prediction problem based on the traffic historical time-series data and road topology; Construct a traffic flow prediction model based on latency modeling, which includes data embedding layer modeling, dynamic graph neural network layer modeling, spatio-temporal encoding layer modeling, multi-layer stacking of latency modeling and spatio-temporal encoding, and construction of a data output layer; Train the model based on the defined traffic flow prediction problem; Use the trained model to predict traffic flow.

[0025] Specifically: Step 1: Construct a traffic network and input data This step aims to solve the problem of how to effectively model the complex traffic network structure and input data in real - time traffic flow prediction. In actual traffic flow prediction tasks, the structural complexity of the traffic network and the diversity of input data pose great challenges to model construction and optimization. To address these challenges, the present invention proposes a systematic solution. By defining the traffic network and the structure of input data clearly, it can effectively capture the spatio - temporal relationships and delay characteristics between nodes in the traffic network, thus achieving high - precision traffic flow prediction.

[0026] According to the actual traffic scenario, the present invention defines the traffic network as a directed graph , where represents the set of nodes composed of sensor nodes in the urban traffic road network. Each node corresponds to a traffic monitoring device at a specific location in the road network, such as an electronic police camera or a checkpoint detector, etc.; represents the set of edges indicating the connection relationships between nodes, reflecting the traffic flow paths and their interactions between nodes; is the adjacency matrix, used to represent the connection strength or interaction strength between nodes, where the matrix elements can reflect the connectivity, distance, or traffic flow intensity between roads.

[0027] In terms of input data, the present invention uses historical traffic time - series data and road topology as the input of the model. Specifically, the historical traffic time - series data is represented as a three - dimensional tensor , where represents the historical observation time steps, is the number of nodes, is the traffic feature dimension of each node, such as traffic flow, speed, vehicle density, etc. Through this structured input data, the present invention can efficiently mine the spatio - temporal features of the traffic network, the delay effect between nodes, and the overall traffic trend.

[0028] Step 2: Define the traffic flow prediction problem The core task of this module is to transform the complex traffic flow prediction problem into a clear and operable mathematical problem, thus providing a solid foundation for subsequent model design, training, and optimization. Based on the traffic network and input data constructed in Step 1, the present invention further defines the specific traffic flow prediction problem. The core objective of traffic flow prediction is to predict the traffic flow conditions of each node in a future period through known historical traffic data and traffic network topology. With the predicted traffic flow data, it can effectively guide the traffic department or individual users to better organize travel modes and travel times.

[0029] Specifically, assume that historical traffic time-series data is known , where is the length of the historical observation window, is the total number of nodes, is the node feature dimension. The goal of the prediction task is to construct a prediction function , using the historical observation data and the traffic network structure , to predict future traffic flow data, that is, to predict the data for the next time steps: , (1) where represents the prediction result of the traffic flow for the th future time step, and . Through this problem definition, the prediction task of the present invention clarifies the input-output relationship of traffic flow prediction, providing clear goals and method guidance for the subsequent design of the prediction model.

[0030] Step 3, data embedding layer modeling method To effectively extract the temporal and spatial features in the input traffic data, we propose a data embedding method that fuses temporal information and spatial information to generate a high-dimensional embedding representation for each node at each time step. The goal of this embedding layer is to fully combine the context characteristics of the source data and improve the model's ability to model spatio-temporal dynamics.

[0031] First, the original input is transformed into through a fully connected layer (MLP), where is the specified embedding dimension.

[0032] In the time dimension, we consider two temporal information highly related to traffic flow changes: the specific "time of day" and the "day of week". By performing one-hot encoding on these two discrete time variables and processing them through a fully connected layer (MLP), an initial temporal embedding representation is generated, where is the specified embedding dimension. This representation can reflect the pattern changes of traffic flow in different time periods, that is, traffic flow is highly correlated with the time at which the flow occurs. The additional temporal information is designed because traffic flow is highly affected by periodic changes. For example, the traffic volume on major roads during morning and evening rush hours in the city is very high, and the volume at other times will decrease. At the same time, the intensity of morning and evening rush hours on weekends is lower than that on weekdays. This time factor affected by periodicity should be taken into account.

[0033] In the spatial dimension, we construct a normalized Laplacian matrix based on the adjacency matrix , and perform eigen decomposition on it to obtain its eigenvalues and eigenvectors. Select the first smallest non-trivial eigenvectors to construct the initial spatial position embedding to express the global structural features of nodes in the traffic network. The spatial dimension information is designed because there are also significant differences in traffic flow at different locations. For example, there are certain differences in the morning and evening rush hours between industrial areas and residential areas, and the traffic flow near shopping areas is always at a relatively high level. The spatial information is designed for this consideration.

[0034] Finally, to enhance the model's ability to model the original input, we further perform an element-wise addition operation on the aligned dimensions of this embedding representation and the tensor to obtain the output of the data embedding layer: (2) will be used as the input for subsequent delay modeling to further improve the model's ability to model the dynamic evolution process of traffic flow. For convenience of processing, we use to replace .

[0035] Step 4, Modeling method of the dynamic graph neural network layer for delay modeling In the traffic system, the traffic impact between different nodes does not occur synchronously, but there is a certain propagation delay. To capture this asynchrony, we design a dynamic graph neural network structure based on delay modeling.

[0036] This method realizes delay-aware modeling through the design of a dynamic graph neural network. First, in the graph neural network, we use a normalized adjacency matrix. To prevent high-order nodes from dominating information propagation, that is, high-degree nodes in the original adjacency matrix may accumulate a large amount of neighbor information, resulting in serious information imbalance and problems such as unstable gradients or training failure. The symmetric normalization method can adjust the contribution of each neighbor to an "average" weight, effectively preventing the "degree hegemony" problem. We use to represent the normalized symmetric adjacency matrix: , (3) where is the original adjacency matrix, is the identity matrix, and is the degree matrix.

[0037] For the input data of delay modeling, we construct a delayed version , and let each time step correspond to the previous moment The node features (copy itself at the first moment), and concatenate them with the original sequence in the feature dimension to obtain the combined input . Specifically, when , = . When , = . The additional sequence obtained through delay modeling can fully reflect the time information of the previous step, that is, how the time information of the previous step affects the current step. Generally speaking, the delay time of nodes with an adjacency relationship is not fixed, that is, due to the different distances between different nodes, the delay relationship also changes with the distance and the traffic state in reality.

[0038] After obtaining the delayed data, we concatenate the current and delayed features (along the last dimension) to get: (4) To adapt to the dynamically changing traffic state, we independently construct a graph structure at each time step , that is, extract the input feature matrix of each time step , and use a graph convolutional neural network (GCN) for graph feature extraction. Specifically, for the single-layer GCN of the first time step : , (5) Among them, represents the output of the single-layer GCN, is the learnable weight matrix. GCN can learn the influence of the adjacency relationship, and thus further learn the delay relationship of the current step number.

[0039] For the GCN of subsequent time steps , that is, , the information transfer process is similar to that of the single-layer GCN of the first time step . For the input graph convolution of the current time step: (6) Based on the output of each time step to obtain the output sequence , finally .

[0040] Finally, use a fully connected mapping layer to restore the hidden feature dimension to the input feature dimension: (7) This dynamic graph neural network with delay modeling not only considers the influence relationship of the previous step on the current step number, but also considers multiple time steps The dynamics of which means that this structure effectively integrates the current input and the evolution of delayed features, enhancing the model's ability to model temporal state changes and spatial delays while maintaining input-output alignment.

[0041] Step 5, the modeling method of the spatio-temporal encoding layer To further enhance the model's ability to capture the complex spatio-temporal dynamic relationships of the traffic network, the present invention introduces an efficient modeling method for the spatio-temporal encoding layer. This method draws on the attention mechanism and performs attention calculations separately in the time dimension and the spatial dimension, thereby extracting the spatio-temporal features of traffic data in parallel. Finally, the outputs of the two attention mechanisms are fused through a multi-layer perceptron (MLP) to achieve a unified representation of spatio-temporal encoding.

[0042] Specifically, the spatio-temporal encoding layer contains two core attention mechanisms: Temporal Encode Attention (TEA) and Spatial Encode Attention (SEA). Both attention mechanisms are implemented based on the multi-head self-attention (MHSA) of Transformer. The Transformer architecture uses the multi-head attention mechanism. First, the query, key, and value are projected into different dimensional subspaces, and then the attention function is executed in parallel: , (8) where , are trainable parameters, Q, K, and V represent the query, key, and value respectively, is the spatial dimension, and softmax is the activation function.

[0043] According to Step 4, we can obtain the output of the delay modeling layer . Using to represent the input regarding node in all time slices, and using to represent all node inputs regarding time slice .

[0044] First, in the temporal encoding attention, we map the features of the input data in the time dimension to the reference point representation space through multi-head self-attention, and then use these reference points to capture the long-term dynamic associations between each time slice. Specifically, we use two multi-head attention mechanisms. The first attention is expressed as follows: (9) The second attention uses the output of the first attention as input, i.e.: , (10) where represents the features of node in the input data at all time steps, represents the output after temporal attention for the th layer. is the temporal encoded representation over all spatial nodes. In this way, we perform the attention mechanism in the temporal dimension, that is, we learn the influence relationships between different steps of the same node and obtain the multi-step temporal representation.

[0045] Secondly, in the spatial encoded attention, in a similar way, the features of the input data in the spatial dimension are mapped to the reference point representation space to capture the spatial correlations between nodes, which is specifically expressed as follows: (11) , (12) where represents the features of all nodes in the input data at time step , represents the output after spatial attention. is the spatial encoded representation over all time steps. In this way, we perform the attention mechanism in the spatial dimension, that is, we learn the influence relationships between different nodes at the same step and obtain the multi-point spatial representation.

[0046] Finally, the outputs of the above two attention mechanisms are fused by an MLP to form a unified spatio-temporal encoded output representation: , (13) where are learnable parameters, is the offset, is the activation function, and are the outputs of the temporal encoded attention and the spatial encoded attention respectively. is the final output representation of the spatio-temporal encoding layer proposed by the present invention, which can effectively capture and express the long-term spatio-temporal dynamic relationships of the traffic network and provide accurate spatio-temporal feature support for subsequent traffic flow prediction tasks.

[0047] Step 6, multi-layer stacking and data output layer of delay modeling and spatio-temporal encoding, To more deeply capture the long-term dynamic characteristics in the traffic flow prediction process, the present invention further proposes a multi-layer stacking method for delay modeling and spatio-temporal encoding layers. In the traffic flow prediction task, the spatio-temporal characteristics of the traffic network are complex and multi-scale. Although single-layer delay modeling and spatio-temporal encoding can capture certain characteristics, for the complex dynamic changes of the traffic network, especially the long-term delay effect and the complex dynamic relationship between nodes, single-layer models are often difficult to fully express. Therefore, the present invention deepens the model's understanding of the spatio-temporal characteristics of the traffic network layer by layer through a multi-layer stacking method, and enhances the modeling depth of the delay effect and the dynamic relationship between nodes.

[0048] Specifically, each layer stacking unit includes a delay modeling layer and a spatio-temporal encoding layer. First, according to the dynamic characteristics of the traffic network, the delay modeling layer captures the information transfer delay characteristics between different time steps through a dynamic graph convolutional network (DGCN), so as to output a traffic representation with delay evolution characteristics.

[0049] Subsequently, the output of the delay modeling layer is used as the input of the spatio-temporal encoding layer. The spatio-temporal encoding layer calculates the attention in parallel in the time dimension and the space dimension respectively, and deeply excavates the internal correlation between nodes and between time steps through the multi-head self-attention mechanism of the Transformer, and outputs a unified spatio-temporal feature representation.

[0050] The present invention connects the next layer stacking unit on top of the output features of each stacking unit for continuous iterative modeling, so as to extract more abstract and high-order spatio-temporal delay feature representations layer by layer. The multi-layer stacking design enables the model to adaptively learn and aggregate spatio-temporal information at different scales, effectively improving the prediction ability for the complex evolution trend of traffic flow data.

[0051] Finally, through the high-level feature representation obtained after multi-layer stacking, and by adding the outputs of each layer, the final hidden state is obtained ; To obtain multi-step predictions, we use the output layer to convert the final hidden state into the required dimension, and obtain the predicted step traffic flow data through two 1×1 convolutional kernels: (15) where is the prediction result of the

[0052] step, and Conv is a 1×1 convolution.

[0053] Step 7, model training, To ensure the effectiveness and reliability of model training, we have made a scientific and reasonable division of the traffic flow data. Specifically, we divide the traffic flow data into a training set, a validation set, and a test set according to the ratios of 60%, 20%, and 20%. Among them, the training set is used for the parameter learning and optimization of the model, the validation set is used to monitor the performance of the model in real time during the training process to prevent the model from overfitting or underfitting, and the test set is used to finally evaluate the generalization ability and practical application performance of the model. This way of dividing the dataset can make full use of data resources and at the same time ensure the stability and consistency of the model on different datasets.

[0054] During the model training process, the selection of the loss function is crucial for the optimization of the model. After in-depth research and analysis, we chose the Mean Absolute Error (MAE) as the loss function. MAE is a commonly used regression loss function, which measures the prediction error of the model by calculating the average of the absolute values of the differences between the predicted values and the true values. Its mathematical expression is: (16) Where represents the traffic flow predicted by node at time, represents the actual traffic flow of node at time. The advantage of MAE is that it is relatively insensitive to outliers and can intuitively reflect the average level of the model prediction error.

[0055] The model training is carried out on the training set. We used an efficient deep learning framework to build the model and used the data in the training set to learn and optimize the parameters of the model. During the training process, we adopted the Batch Gradient Descent algorithm, divided the data in the training set into multiple small batches (batch), and updated the model parameters batch by batch. Each round of training (epoch) will traverse all the data in the training set, calculate the value of the loss function, and then adjust the model parameters according to the gradient of the loss function. To speed up the training speed and improve the convergence performance of the model, we also adopted the Learning Rate Decay strategy, gradually reducing the learning rate as the number of training rounds increases, so that the model can adjust the parameters more finely in the later stage of training.

[0056] After each round of training, we will detect the performance of the model on the validation set. By calculating the MAE value of the model on the validation set, we can monitor the performance change of the model in real time. During the whole training process, we will save the model with the best performance on the validation set. This model is the one with the smallest MAE value among all training rounds, and it represents the optimal performance of the model under the current training strategy. Finally, we apply this optimal model to the test set for a comprehensive evaluation of the model performance. On the test set, we also calculate the MAE value of the model, and at the same time, we will calculate the root mean square error (RMSE) and the mean absolute percentage error (MAPE) to evaluate the prediction ability of the model for unseen data.

[0057] Experimental verification: To verify the theoretical feasibility and practical effectiveness of the traffic flow prediction method based on delay modeling proposed in the present invention, we have made explanations both theoretically and experimentally.

[0058] To achieve high-precision traffic flow prediction, this system designs and integrates five key modules to systematically improve the modeling ability of the complex spatio-temporal dynamics of the traffic system and ensure the efficiency and accuracy of the model in practical applications. These five modules are: the traffic network and flow data construction module, the traffic flow prediction problem definition module, the data embedding layer module, the multi-layer delay modeling and spatio-temporal encoding module, and the data output layer module. The modules cooperate closely with each other, complement each other, and jointly build a powerful traffic flow prediction system.

[0059] After the system design is completed, based on the powerful training ability of deep learning, the entire model is systematically trained and optimized. Through training on a large-scale traffic flow dataset, the model can automatically learn the complex patterns and rules in the traffic flow data, continuously adjust and optimize its own parameters to achieve the best prediction effect.

[0060] As Figure 6 shown, the publicly available traffic datasets PEMS-04 and JiNan are selected for the experiment, which contain traffic flow data on the Los Angeles freeway and in Jinan city respectively. Some representative road segments are selected as nodes to construct the traffic graph topology. The prediction step size of 60 minutes is selected for training and testing, and the mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE) are used as evaluation metrics, as shown in the following bar chart. The results verify the feasibility of our method in the traffic flow data prediction task.

[0061] Compared with the historical average (HA) method, the method of the present invention does not rely on periodic assumptions and can adapt to complex and dynamically changing traffic patterns; compared with statistical methods such as ARIMA and VAR, this method breaks through the limitations of linear stationary assumptions and has stronger non-linear modeling capabilities; compared with traditional machine learning methods of support vector regression (SVR), the present invention has significant advantages in capturing traffic network structure information, modeling propagation delays and indirect dependencies between different nodes. A comparison with the above methods is shown in Table 1, and the effectiveness of the present invention is verified through data results.

[0062] Table 1 Comparison of the present solution with other methods

[0063] Example 2 This embodiment provides a traffic flow prediction system based on delay modeling. To achieve high-precision traffic flow prediction, this system is designed to include five key modules: a traffic network and traffic flow data construction module, a traffic flow prediction problem definition module, a data embedding layer module, a multi-layer delay modeling and spatio-temporal encoding module, and a data output layer module. As Figure 1 shown, each part works together to systematically improve the modeling ability of the complex spatio-temporal dynamics of the traffic system. The specific description is as follows: Module 1: Traffic network and traffic flow data construction module, This module is the basis of the entire traffic flow prediction system and is mainly responsible for processing the structured input information in the traffic system to provide high-quality and uniformly formatted data support for the subsequent deep learning model. Through carefully designed data preprocessing and structuring steps, this module ensures the accuracy and usability of the input data, laying a solid foundation for the efficient operation of the system.

[0064] In this module, the traffic network is abstracted into a directed graph structure, where nodes represent monitoring devices (such as bayonet detectors, cameras, etc.) distributed in the urban road network, and edges represent traffic flow paths and directions. The adjacency matrix is used to quantify the connection strength and spatial dependence relationship between nodes. In terms of input data, the system uses historical traffic time series data and topological structures as inputs, organized into a three-dimensional tensor (time step × number of nodes × feature dimension). This structure defines the input boundary of the model and provides a basis for subsequent delay modeling and graph neural operations.

[0065] Module 2: Traffic flow prediction problem definition module, This module mathematically models and formally defines the prediction task, providing a clear goal and direction for the operation of the entire system. The goal is to use a historical observation sequence of length to predict the traffic states of all nodes in the next time steps, that is, to construct a mapping function such that . Among them, is the historical sequence, is the adjacency matrix, is the prediction result. This definition clarifies the input and output formats and lays the functional boundaries and optimization goals for model design.

[0066] Module Three: Data Embedding Layer Module To fully extract the spatio-temporal semantic information in the original input, this module designs an embedding mechanism that integrates time periodicity and spatial topological structure. The time embedding is constructed through two periodic features, "Time of Day" and "Day of Week", using one-hot encoding and mapped to an embedding representation through an MLP; the spatial embedding is constructed by performing eigen-decomposition on the normalized Laplacian matrix and extracting the first non-trivial eigenvectors to construct the global node position encoding. The two are dimensionally aligned with the original input and fused element-wise to form a unified high-dimensional embedding tensor , which serves as the input to the delay modeling module.

[0067] Module Four: Multi-layer Delay Modeling and Spatio-temporal Encoding Module As Figure 2 and Figure 3 , this module is the core of the system's modeling ability, integrating the "delay-aware" and "spatio-temporal coupling" modeling strategies.

[0068] Figure 2 In terms of delay modeling, by concatenating the node features of the current time step and the previous time step, it simulates the propagation delay of traffic impacts in the network, and uses a symmetrically normalized dynamic graph convolutional network to independently build a graph and extract features for each time step, effectively preventing information overload caused by high node degrees.

[0069] Figure 3 In terms of spatio-temporal encoding, it introduces Time Encoding Attention (TEA) and Spatial Encoding Attention (SEA), and parallelly models the time series correlation and spatial structure dependence through the multi-head self-attention mechanism in the Transformer, and finally generates a unified spatio-temporal encoding representation through MLP fusion.

[0070] Figure 4 realizes the multi-layer stacking of delay modeling and spatio-temporal encoding, gradually deepening the model's understanding of the spatio-temporal characteristics of the traffic network and enhancing the modeling depth of the delay effect and the dynamic relationship between nodes.

[0071] Module Five: Data Output Layer Module As the terminal module of the system, the data output layer is responsible for mapping the high-order spatio-temporal feature representation back to the original traffic state space. Specifically, the output of the previous module is fed into a multi-layer perceptron (MLP) to generate a prediction tensor with the same dimension as the input features. This layer not only ensures the dimensional alignment of the prediction results, but also provides the capabilities of non-linear integration and feature compression. At the same time, residual connections and normalization strategies are supplemented to further improve the stability and robustness of the model in complex scenarios.

[0072] As Figure 5 shown, the entire system realizes a complete chain from data structure modeling, input embedding, spatio-temporal feature extraction to prediction generation through modular design, providing a systematic guarantee for improving the timeliness, accuracy and generalization ability of traffic flow prediction.

[0073] A computer-readable storage medium stores multiple instructions, and the instructions are adapted to be loaded and executed by a processor of a terminal device for the traffic flow prediction method based on delay modeling.

[0074] A terminal device includes a processor and a computer-readable storage medium. The processor is used to implement each instruction; the computer-readable storage medium is used to store multiple instructions, and the instructions are adapted to be loaded and executed by the processor for the traffic flow prediction method based on delay modeling.

[0075] The above are all preferred embodiments of the present invention, and the protection scope of the present invention is not limited accordingly. Therefore, all equivalent changes made according to the structure, shape and principle of the present invention shall be covered within the protection scope of the present invention.

Claims

1. A traffic flow prediction method based on delay modeling, characterized in that including: Obtain historical time-series traffic data and road topology; Define the traffic flow prediction problem based on the historical time-series traffic data and road topology; Construct a traffic flow prediction model with delay modeling, including data embedding layer modeling, dynamic graph neural network layer modeling, spatio-temporal encoding layer modeling, multi-layer stacking of delay modeling and spatio-temporal encoding, and construction of a data output layer; Train the model based on the defined traffic flow prediction problem; Use the trained model to predict traffic flow.

2. The traffic flow prediction method based on delay modeling according to claim 1, wherein The obtaining of traffic historical time-series data and road topology includes defining a traffic network as a directed graph , where represents a set of nodes composed of sensor nodes in the urban traffic road network, and each node corresponds to a traffic monitoring device at a specific location in the road network, represents a set of edges of the connection relationship between nodes; is an adjacency matrix, which is used to represent the connection strength or interaction strength between nodes; And represent the historical traffic time-series data as a three-dimensional tensor , where represents the historical observation time step, is the number of nodes, is the traffic feature dimension of each node.

3. A traffic flow prediction method based on delay modeling according to claim 2, characterized in that Define the traffic flow prediction problem based on traffic historical time - series data and road topology, including assuming known historical traffic time - series data , where is the length of the historical observation window, is the total number of nodes, is the node feature dimension. The goal of the prediction task is to construct a prediction function , using historical observation data and the traffic network structure , to predict future traffic flow data, that is, to predict the data of the next time steps, expressed as: , Among them, represents the prediction result of the traffic flow for the th future time step, and .

4. A traffic flow prediction method based on delay modeling according to claim 3, characterized in that The data embedding layer modeling includes using a data embedding method that fuses temporal information and spatial information to generate a high-dimensional embedding representation for each node at each time step. Among them, in the temporal dimension, the original input is transformed through a fully connected layer MLP into , where is the specified embedding dimension. By performing one-hot encoding on the discrete time variable and passing it through a fully connected layer, an initial temporal embedding representation is generated; in the spatial dimension, a normalized Laplacian matrix is constructed based on the adjacency matrix, and its eigenvalue decomposition is performed to obtain eigenvalues and eigenvectors; finally, the embedding representation and tensor are element-wise added after dimension alignment to obtain the output of the data embedding layer.

5. A traffic flow prediction method based on delay modeling according to claim 4, characterized in that The dynamic graph neural network layer modeling includes designing a dynamic graph neural network to achieve latency-aware modeling. First, a normalized adjacency matrix is used in the graph neural network, and the symmetric normalization method is adopted to adjust the contribution of each neighbor to an average weight. On the input data for latency modeling, a latency version is constructed. , such that each time step corresponds to the node features of the previous moment . The node features are concatenated with the original sequence in the feature dimension to obtain a combined input ; then, a graph structure is independently constructed at each time step , and the input feature matrix of each time step is extracted. The graph convolutional neural network (GCN) is used for graph feature extraction. Finally, an output sequence is obtained based on the output of each time step, and a fully connected mapping layer is used to restore the hidden feature dimension to the input feature dimension.

6. The traffic flow prediction method based on delay modeling according to claim 5, wherein, The spatio-temporal encoding layer modeling includes constructing a multi-head self-attention mechanism to extract spatio-temporal features of traffic data. Among them, in the time encoding attention, the features of the input data in the time dimension are mapped to the reference point representation space through multi-head self-attention, and then the reference point is used to capture the long-term dynamic correlation between each time slice; in the space encoding attention, the features of the input data in the space dimension are mapped to the reference point representation space to capture the spatial correlation between nodes; finally, the outputs of the two attention mechanisms are fused through an MLP to form a unified spatio-temporal encoding output representation: , Among them, are learnable parameters, is an activation function, which is the final output representation of the spatio-temporal encoding layer.

7. A traffic flow prediction method based on delay modeling according to claim 6, characterized in that, The multi-layer stacking of delay modeling and spatio-temporal encoding includes, in the delay modeling layer, capturing the information transfer delay characteristics between different time steps through the dynamic graph convolutional network DGCN according to the dynamic characteristics of the traffic network; Then, the output of the delay modeling layer is used as the input of the spatio-temporal encoding layer. The spatio-temporal encoding layer calculates the attention in parallel in the time dimension and the space dimension respectively, and mines the intrinsic correlation between nodes and time steps through the multi-head self-attention mechanism of the Transformer, and outputs a unified spatio-temporal feature representation; On top of the output features of each stacking unit, the next stacking unit is connected to perform continuous iterative modeling, so as to extract more abstract and high-order spatio-temporal delay feature representations layer by layer.

8. A traffic flow prediction method based on delay modeling according to claim 7, wherein, The construction of the data output layer includes the high-level feature representation obtained through multi-layer stacking, and the addition of the outputs of each layer to obtain the final hidden state ; Finally, for multi-step prediction, the output layer is directly used to convert the final hidden state to the required dimension, and two 1×1 convolutional kernels are used to obtain the predicted step traffic flow data, that is, the final traffic flow prediction result.

9. The traffic flow prediction method based on delay modeling according to claim 8, wherein, The model training based on the defined traffic flow prediction problem includes dividing the input data into a training set and a test set, adopting the batch gradient descent algorithm, dividing the data in the training set into multiple small batches, updating the model parameters batch by batch, traversing all the data in the training set in each round of training, calculating the value of the loss function, and then adjusting the model parameters according to the gradient of the loss function. Among them, the mean absolute error is selected as the loss function, and the prediction error of the model is measured by calculating the average value of the absolute value of the difference between the predicted value and the true value. The expression is: , Among them represents the traffic flow predicted by the node at time, represents the actual traffic flow of the node at time.

10. A traffic flow prediction system based on delay modeling, characterized in that, including: A data acquisition module configured to obtain historical time-series traffic data and road topology; A definition module configured to define the traffic flow prediction problem based on the historical time-series traffic data and road topology; A model construction module configured to construct a traffic flow prediction model with delay modeling, including data embedding layer modeling, dynamic graph neural network layer modeling, spatio-temporal encoding layer modeling, multi-layer stacking of delay modeling and spatio-temporal encoding, and construction of a data output layer; A model training module configured to train the model based on the defined traffic flow prediction problem; A prediction module configured to use the trained model to predict traffic flow.

Citation Information

Patent Citations

  • Deep neural network robust traffic prediction method based on multi-modal spatio-temporal data

    CN112289034A

  • Traffic flow prediction method based on adaptive generalized PageRank graph neural network

    CN115620514A

  • Traffic flow prediction method and system of attention time-space synchronization graph convolutional network

    CN117314703A

  • Traffic flow prediction method based on space-time meta-graph learning

    CN118379882A

  • Traffic flow forecasting method based on deep graph gaussian processes

    US20230058520A1

Cited By

  • Traffic flow prediction method based on multi-source fusion and multi-scale attention mechanism

    CN121564973A

  • Traffic big data intelligent analysis method based on topology compression and feature dimension reduction

    CN121938201A

  • Intelligent analysis method for traffic big data based on topology compression and feature dimension reduction

    CN121938201B