Urban traffic flow prediction method based on data collected by intelligent traffic system

Through the DSTTN model, combined with dynamic spatiotemporal embedding, dynamic random graph attention and dynamic time transformer module, the existing traffic flow prediction methods are difficult to capture spatiotemporal characteristics and high computational complexity, and achieve more accurate traffic flow prediction and lower computational complexity.

CN119886211AInactive Publication Date: 2025-04-25WUXI UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510378245.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-04-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing traffic flow prediction methods are difficult to effectively capture the nonlinear spatiotemporal characteristics of traffic flow, resulting in poor prediction performance and high computational complexity, making it difficult to adapt to large-scale traffic prediction.

Method used

A method for predicting urban traffic flow based on DSTTN model is proposed. Through the dynamic spatiotemporal embedding module, dynamic random graph attention module and dynamic time transformer module, the spatiotemporal characteristics of the traffic network are dynamically learned, adaptively adjusted the correlation between nodes, and reduced the computational complexity.

Benefits of technology

It improves the performance of long-term traffic flow prediction, can capture the complex spatial correlation in traffic flow data more accurately, adapt to complex traffic networks, and significantly reduces the computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119886211A_ABST
    Figure CN119886211A_ABST
Patent Text Reader

Abstract

The invention discloses an urban traffic flow prediction method based on data acquired by an intelligent traffic system. Belongs to the technical field of intelligent traffic, and particularly relates to the technical field of urban traffic flow prediction based on Internet of Things acquisition equipment. The problems that a traditional traffic flow prediction method is poor in long-term prediction capability, high in model complexity and incapable of adapting to large-scale traffic prediction are solved. The method comprises the following steps: counting monitoring data, obtaining a flow sequence, and preprocessing the flow sequence; a DSTTN model is constructed, the DSTTN model sequentially passes through a linear layer, a connection and linear layer, a space-time block and an output layer from an input layer to an output layer, and a dynamic space-time embedding module is added between the input layer and the connection and linear layer; according to the trained DSTTN model; obtaining a prediction result of the model; and inputting a traffic sequence to be predicted into the trained DSTTN model to generate a prediction result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart transportation technology, and in particular to the field of urban traffic flow prediction technology based on Internet of Things collection equipment. Background Art

[0002] With the continuous development of data collection technology, spatiotemporal data generated in various fields are constantly accumulating. Using spatiotemporal data to mine the spatiotemporal characteristic information is very important for applications such as smart transportation and urban planning. Traffic flow is a spatiotemporal data with complex nonlinear relationships, which contains characteristic information of time and space dimensions. In the process of modeling traffic flow, it is necessary to fully consider its temporal correlation, spatial correlation and spatiotemporal correlation; current related research is limited to the public transportation data set of American highways, which is different from the characteristics of Chinese urban transportation and cannot well consider the spatiotemporal correlation of Chinese cities themselves.

[0003] Traditional traffic flow prediction methods simply treat data as independent time series and make predictions based on classical statistical methods. Such methods do not take into account the nonlinear spatiotemporal characteristics of traffic flow, cannot accurately simulate its spatiotemporal correlation, and find it difficult to explore deeper relationships. Nowadays, deep learning methods based on neural networks have been widely used and have achieved many results in the fields of image recognition, sequence prediction, and text translation. For traffic flow data with complex spatiotemporal relationships, more and more scholars choose to use deep learning methods to model and analyze them, explore the spatiotemporal correlations they contain, overcome the shortcomings of traditional prediction methods, and have better prediction performance. Most of the current traffic flow prediction models are based on knowledge on predefined graphs, ignoring the long-term dynamic spatiotemporal characteristics of the data, making it difficult to learn its global spatiotemporal correlation information, resulting in poor prediction performance and difficulty in adapting to different traffic networks.

[0004] The existing technology has the following disadvantages in its solution to this problem: Over-smoothing problem: When stacking multiple layers, the features of the nodes will undergo multiple aggregation operations, which may lead to over-smoothing of the node features and information loss. Especially in deeper networks, this over-smoothing makes it difficult for the model to capture the fine-grained spatial relationship between nodes, affecting the accuracy of traffic flow prediction. Although existing technologies can extract the spatial features of graphs, they may not be able to express the differences between different nodes well in complex graph structures, especially when the relationships between nodes are very different.

[0005] Fixed weights of adjacency matrix: Existing techniques usually rely on predefined adjacency matrices, which may not perfectly capture the actual spatial correlation in transportation networks, especially urban road networks with complex traffic relationships. When traffic flows have complex interactions between nodes, the predefined adjacency matrix may be too coarse.

[0006] Computational efficiency: Existing technologies require matrix operations and adjacency matrix multiplication, which requires a lot of computation. In particular, in order to improve the accuracy of predictions, the self-attention mechanism is directly used, which greatly increases the complexity of the model. Summary of the invention

[0007] In view of the above problems, the purpose of the present invention is to propose a method for predicting urban traffic flow based on data collected by an intelligent transportation system. This method effectively solves the problems of poor long-term prediction ability, high model complexity, and inability to adapt to large-scale traffic prediction in traditional traffic flow prediction methods, and improves the performance of long-term prediction of traffic flow under reasonable cost.

[0008] The method comprises the following steps: S1. Collect monitoring data, obtain traffic sequence, and perform preprocessing; S2. Construct a DSTTN model. The DSTTN model passes through a linear layer, a connection and a linear layer, a spatiotemporal block, and an output layer from the input layer to the output layer. A dynamic spatiotemporal embedding module is added between the input layer and the connection and linear layer. The spatiotemporal block includes a dynamic random graph attention module and a dynamic time transformer module. The dynamic random graph attention module passes through a first normalization layer, a feedforward layer, and a second normalization layer in sequence and is connected to the dynamic time transformer module. The dynamic time transformer module passes through a first normalization layer, a feedforward layer, and a second normalization layer in sequence and is connected to the output layer. The first normalization layer and the second normalization layer each contain a residual connection. The feedforward layer contains two linear transformation layers and a nonlinear activation function. ; S3, train the DSTTN model; S4. DSTTN model training is completed and the prediction results of the model are obtained; S5. Input the traffic sequence to be predicted into the trained DSTTN model to generate a prediction result.

[0009] Furthermore, the monitoring data includes N road nodes in the time period The flow data and delay data within the time frame are as follows: and The specific method of obtaining the traffic sequence is as follows: the monitoring data of each road node is counted into the traffic sequence, and the traffic sequence is obtained in the time period Statistics of traffic data are collected. If If the data is delayed by seconds, skip time steps and continue to count traffic data until the time period There is no traffic data to be counted within the period, and the traffic sequence acquisition of the road node is completed; the frequency of the traffic sequence after statistics is 5 minutes, and the time step of the traffic data to be counted within the 5 minutes is: , ; The pretreatment is specifically: The traffic sequence of the road nodes is deleted and supplemented using linear interpolation The missing values ​​of the traffic sequence of the road nodes are obtained to obtain the traffic data set ;in Represents the time step threshold used to filter traffic series.

[0010] Further, the training DSTTN model is specifically as follows: S31, the dynamic spatiotemporal embedding module uses the preprocessed traffic sequence to generate the input of the first layer of the spatiotemporal block; S32, the dynamic random graph attention module constructs a multi-head random attention matrix, and sequentially passes through the first normalization layer, the feedforward layer, and the second normalization layer to obtain the input of the dynamic time transformer module; S33, the dynamic time transformer module maps the standardized multi-head attention mechanism to Groups Q, K, and V, and concatenate them to get the output of the dynamic time transformer module; represents the number of parallel attention mechanism heads, Q, K and V are query matrix, key matrix and value matrix respectively; S34, the output of the dynamic time transformer module passes through the first normalization layer, the feedforward layer and the second normalization layer in sequence to obtain the output of the spatiotemporal block.

[0011] Furthermore, the process of obtaining the input of the first layer of the spatiotemporal block is as follows: first, the traffic data set Feed it into a linear layer to get the raw flow feature embedding , ,in, Represents the linear layer function, and then and the embedded output Feed it into the concatenation and linear layers to get the input of the first layer of the spatiotemporal block , ,in, represents the set of real numbers, Indicates the batch size, represents the step size of historical data, Indicates the number of nodes, represents the dimension of the final embedding, Represents the connection function.

[0012] Furthermore, the multi-head random attention matrix is ​​specifically: , ,in, Represents a splicing operation, represents the linear transformation matrix, represents a random attention matrix; the random attention matrix is: ,in, Indicates the current space-time block layer number, , Indicates the number of space-time block stacking layers, represents the input of the dynamic random graph attention module of the current layer and the output of the previous layer of the spatiotemporal block of the current layer, represents the activation function, represents spatial attention, represents the output of the current layer's random attention, represents the time step, , represents a random attention weight matrix; ,in Indicates The attention matrix for time steps, Represents a mask, Represents the normalization function.

[0013] Furthermore, the dynamic time is obtained by sequentially passing through the first normalization layer, the feedforward layer and the second normalization layer. The input of the module is as follows: The formula is calculated through the first normalization layer: , and get the output of the first normalization layer , Includes the input of the feedforward layer and the residual of the second normalization layer; where, and represents the mean and variance of the input features, Represents a small constant to prevent division by zero errors, and denote the scaling parameter and the bias term respectively, represents the residual, The output representing attention includes and , Represents dynamic time The output of the module; Substitute into the calculation formula of the feedforward layer: , and get the output of the feedforward layer ;in, represents a nonlinear activation function, are the weight matrices of the first and second layer linear transformations, respectively. are the bias terms of the two linear layers respectively; and Substitute into the second normalization layer calculation formula: , and get the output of the second normalization layer , This includes the input of the dynamic temporal transformer module and the output of the spatiotemporal block.

[0014] Further, the , and in, represents the dimension after H attentions are spliced ​​together; the output of the dynamic time transformer module obtained by splicing them is specifically: ,in, represents the trainable weight matrix, express Dimension.

[0015] Furthermore, the output of the dynamic time transformer module is sequentially passed through the first normalization layer, the feedforward layer, and the second normalization layer to obtain the output of the spatiotemporal block: Enter the first normalization layer and get ,Will Input feed-forward layer to get , and then and Substituting into the second normalization layer, we get .

[0016] Further, the DSTTN model training is completed, and the prediction results of the model are obtained as follows: , DSTTN model training is completed, Input the output layer to get the model's prediction results , ,in, represents the shape adjustment function, Represents a reshape function.

[0017] The beneficial effects of the method of the present invention are: (1) The data of the present invention are all from the original traffic flow and delay data collected from the intelligent transportation system in Xishan District, Wuxi City. Compared with the existing detection method based on the public transportation data set of American highways, it is more in line with the domestic traffic conditions and the prediction results are more accurate.

[0018] (2) On the problem of over-smoothing, the present invention uses a random graph attention mechanism to dynamically assign different weights to neighbor nodes, thereby reducing the over-smoothing of information. Each node can adjust information propagation according to the importance of its neighbor nodes, avoiding the over-fusion of node features in traditional detection methods. The random graph attention mechanism can automatically adjust the weights of adjacent nodes according to the characteristics of the nodes, so that each node has stronger expression ability when aggregating neighbor node information. Therefore, the present invention can better capture the complex spatial correlation in traffic flow data and provide more accurate predictions.

[0019] (3) In terms of the adjacency matrix weight problem, the present invention can adaptively learn the adjacency relationship, and its attention mechanism allows the model to dynamically adjust the association between nodes based on the characteristics of the current node and the characteristics of the neighboring nodes. This makes the present invention more flexible in traffic flow prediction and better able to adapt to the complexity of the traffic network.

[0020] (4) On the issue of computational efficiency: This invention significantly reduces the computational complexity of the attention mechanism by improving the method of generating attention weights. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is a flow chart of the method described in an embodiment of the present invention; Figure 2 This is a schematic diagram of the DSTTN model structure in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a dynamic random graph attention module in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of the spatiotemporal block module in an embodiment of the present invention; Figure 5 (a) and (b) are schematic diagrams of traffic flow changes at two random nodes within 9 days in an embodiment of the present invention, where the horizontal axis represents the time step and the vertical axis represents the traffic flow. DETAILED DESCRIPTION

[0022] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0023] Embodiment 1, This embodiment provides a method for predicting urban traffic flow based on data collected by a smart transportation system. The flowchart of the method is as follows: Figure 1 , the method comprises the following steps: S1. Collect monitoring data, obtain traffic sequence, and perform preprocessing.

[0024] The relevant operations of step S1 are introduced with a specific example: The traffic network can be modeled as a directed weighted graph ,in, V and E Represent the set of nodes and edges of a directed weighted graph, respectively. represents the number of road nodes, The adjacency matrix represents the weight of the edge and describes the relationship between nodes. The adjacency matrix is ​​usually determined based on connectivity or distance. represents a set of real numbers; the goal of traffic flow prediction is to and historical traffic data, learning a mapping , the past data Mapping to future data , the mapping can be expressed as follows ,in, represents the time step, , is the prediction step length, is the step size of historical data. In Example 1, .

[0025] The original data of Example 1 is the monitoring data of the intelligent transportation system in Xishan District, Wuxi City. The monitoring data includes the traffic volume and average vehicle delay time of 482 road nodes, with a time span from March 28 to April 21, 2024. In Example 1, the number of road nodes is , time period , the frequency of traffic data , the frequency of delayed data , the time step threshold for filtering traffic sequences ; Considering the traffic lights and congestion issues, we use delay data to reduce the error caused by repeated counting. Specifically, after merging the flow data with the delay data, In the statistics of traffic data, first count the traffic of the first step. If you encounter If the data is delayed by seconds, skip time steps, and continue to count traffic data, then skip a number of time steps based on the current delay, and so on, until the time period There is no traffic data to be counted within , and the traffic sequence acquisition of the road node is completed. The frequency of the traffic sequence is 5 minutes. Substitution Formula, get is 30. After all the traffic data are counted according to the above method, the missing values ​​are deleted ( ) traffic series, and finally retained 392 road traffic data, and used linear interpolation to supplement The missing values ​​of the traffic sequence of the road nodes are finally made into a traffic data set , whose shape is ["392,6624"], where Indicates the batch size.

[0026] Randomly select a node traffic and draw its traffic change trend within nine days starting from the early morning of March 29, such as Figure 5 As shown in (a) and (b), each 288 time steps is one day's data. It can be clearly seen that the time correlation of traffic flow is obvious. During holidays and weekends, the traffic scale will be significantly smaller, and the traffic flow at different nodes is similar. Two areas with similar functions may have the same traffic pattern.

[0027] S2. Build the DSTTN model.

[0028] The relevant operations of step S2 are introduced with a specific example: like Figure 2 As shown, the DSTTN model passes through a linear layer, a connection and a linear layer, and a spatiotemporal block from the input layer to the output layer, and a dynamic spatiotemporal embedding module is added between the input layer and the connection and the linear layer. The time block includes a dynamic random graph attention module and a dynamic time transformer module. The dynamic random graph attention module passes through the first normalization layer, the feedforward layer, and the second normalization layer in sequence and is connected to the dynamic time transformer module. The dynamic time transformer module passes through the first normalization layer, the feedforward layer, and the second normalization layer in sequence and is connected to the output layer. The first normalization layer and the second normalization layer each contain a residual connection, and the feedforward layer contains two linear transformation layers and a nonlinear activation function. The input layer contains a linear transformation, which projects the traffic data into a higher-dimensional space, thereby enhancing the network’s expressive power. The dynamic random graph attention module is used to extract spatial features, the dynamic time transformer is used to extract temporal features, and the dynamic spatiotemporal embedding module also extracts spatiotemporal patterns and periodicity through spatiotemporal blocks.

[0029] S3. Train the DSTTN model, specifically: S31, the dynamic spatiotemporal embedding module uses the preprocessed traffic sequence to generate the input of the first layer of the spatiotemporal block; S32, the dynamic random graph attention module constructs a multi-head random attention matrix, and sequentially passes through the first normalization layer, the feedforward layer, and the second normalization layer to obtain the input of the dynamic time transformer module; S33, the dynamic time transformer module maps the standardized multi-head attention mechanism to Groups Q, K, and V, and concatenate them to get the output of the dynamic time transformer module; represents the number of parallel attention mechanism heads, Q, K and V are query matrix, key matrix and value matrix respectively; S34, the output of the dynamic time transformer module passes through the first normalization layer, the feedforward layer and the second normalization layer in sequence to obtain the output of the spatiotemporal block; The relevant operations of step S3 are introduced with a specific example: The periodicity of traffic data will significantly affect the performance of the model. In addition, the correlation between nodes also affects the extraction of features. Therefore, considering the positive impact of spatiotemporal information, a dynamic spatiotemporal embedding module is constructed to simulate the periodicity and complex spatiotemporal characteristics of traffic data. The periodic embedding includes daily embedding and weekly embedding: and ,in, represents the day embedding dimension, Represents the week embedding dimension; first initialize two trainable embedding matrices: and ;in, represents the day embedding matrix, represents the week embedding matrix, is the number of samples of the traffic time series in one day. The sampling frequency of the data set used in Example 1 is 5 minutes / time, so =288, is the day of the week =7; The input traffic dataset is used as the index of the embedding layer, and the final cycle embedding is obtained by extracting the daily embedding matrix and the weekly embedding matrix and ; Secondly, using adaptive spatiotemporal embedding Establish dynamic spatiotemporal dependencies, where Randomly initialized and trainable, represents the dimension of adaptive spatiotemporal embedding. During training, It will contain dynamic spatiotemporal information, thus helping the model to extract dynamic spatiotemporal features; finally, these embeddings will be broadcasted and concatenated together to obtain the embedded output ,in, represents the dimension of the final embedding, , the embedded output calculation formula is: ,in, Indicates a concatenation operation. Indicates a concatenation operation.

[0030] In order to extract the original features in the traffic data and obtain the input of the first layer of the spatiotemporal block, the traffic dataset needs to be Feed it into a linear layer to get ,in, is the original traffic feature embedding, represents the output dimension of the linear layer, and the input of the first layer of the spatiotemporal block is: ,in, represents the linear layer function, Represents the connection function.

[0031] The global attention mechanism focuses on all nodes, which will not be able to capture features based on the graph structure; in addition, when faced with a traffic network with a high number of nodes, global attention will face huge computational costs. The traditional graph attention mechanism GAT uses a learnable self-attention mechanism to calculate the correlation between the target node and its neighbor nodes. Each node will perform a weighted average of the features of its neighbor nodes according to the attention score to update the node's feature representation, but it still cannot avoid the huge computational cost brought by the dot product operation. Therefore, in order to obtain more reasonable attention weights and reduce computational costs, we designed a dynamic random graph attention module.

[0032] like Figure 3 As shown, the dynamic random graph attention module first generates a series of random matrices , whose weights are randomly initialized and trainable, corresponding to the attention matrices at different time steps, these values ​​can be trainable or fixed, and then by adding masks mask to preserve the graph structure, and use Normalized; the random attention weight matrix in the dynamic random graph attention module can be expressed as: ,in, Represents a mask, Indicates that only the weights of the nodes existing in the predefined graph structure are retained, that is, Only the weights of nodes that are related in the graph are retained; represents the normalization function, It can also be expressed as: ,in, express The collection of elements in Indicates OK, Indicates j List, express The attention weight between two nodes in express The set of all adjacent nodes, express No. neighboring nodes, represents the natural exponential function; the random attention weight matrix is ​​given by the formula: Compute the random attention matrix, where represents the random attention matrix, represents the activation function, Indicates the current space-time block layer number, , Indicates the number of space-time block stacking layers, represents the output of the random attention of the current layer, represents the input of the dynamic random graph attention module of the current layer and the output of the previous layer of the spatiotemporal block of the current layer, Represents spatial attention.

[0033] In order to enhance the expressive power of the dynamic random graph attention module and enable it to capture rich information of input features from different angles and levels, the graph attention mechanism GAT is further extended to a multi-head mechanism. Specifically, Parallel attention mechanisms are connected to produce a multi-head random attention matrix: ,in ,in, Represents a linear transformation matrix.

[0034] like Figure 4 As shown, in the spatiotemporal block, the formula is calculated by the first normalization layer: , and get the output of the first normalization layer , Includes the input of the feedforward layer and the residual of the second normalization layer; where, and represents the mean and variance of the input features, Represents a small constant to prevent division by zero errors, and Represent the scaling parameters and bias terms, respectively, which are used to scale and move the output to enhance the expressiveness of the model. represents the residual, The output representing attention includes and , It is dynamic time The output of the module also indicates the H The output of the group attention mechanism; Substitute into the calculation formula of the feedforward layer: , and get the output of the feedforward layer ;in, represents a nonlinear activation function, are the weight matrices of the first and second layer linear transformations, respectively. are the bias terms of the two linear layers respectively; and Substitute into the second normalization layer calculation formula: , and get the output of the second normalization layer , This includes the input of the dynamic temporal transformer module and the output of the spatiotemporal block.

[0035] The dynamic random graph attention module assigns different weights to the input data, so that the importance between data points can be distinguished. When extended to the multi-head self-attention mechanism, the DSTTN model is able to simultaneously focus on information from multiple subspaces.

[0036] , and ,in, represents the dimension after H attentions are spliced ​​together; the output of the dynamic time transformer module obtained by splicing them is specifically: in, represents the trainable weight matrix, express The dimension of Indicates the number of heads paying attention.

[0037] The multi-head self-attention mechanism allows each data to be directly represented by all other data in the sequence, so the DSTTN model can obtain a global receptive field, but it also brings huge computational overhead. Only a few dot product pairs can make a large contribution to the attention score, so the most important ones are selected. The query is taken as input, and the output of any attention head can be expressed as: ,in, is a sparse matrix, express The transpose of; According to the sparsity measure reserve The largest query of the metric, for the query matrix Each query vector in , whose sparsity measure is relative entropy, the formula is as follows ,in, is the key matrix The key vector in , is the key matrix The length of the vector, represents the dimension of the attention head, e represents a natural constant, express The transpose of , represents the sequence of vectors in the key matrix, , represents the sequence of vectors in the query matrix, It represents the logarithm with the natural constant e as the base; indivual Constructing the query matrix , indivual Constructing the bond matrix ,set up , because Q and K are mapped from the same input, so , is the length of the input sequence, so the above formula reduces the computational complexity of the self-attention mechanism to , where O() represents the measure of complexity.

[0038] like Figure 4 As shown, the output of the dynamic time transformer module passes through the first normalization layer, the feedforward layer, and the second normalization layer in turn to obtain the output of the spatiotemporal block: Enter the first normalization layer and get ,Will Input feed-forward layer to get , and then and Substituting into the second normalization layer, we get .

[0039] S4. DSTTN model training is completed and the model prediction results are obtained.

[0040] The relevant operations of step S4 are introduced with a specific example: when After the DSTTN model training is completed, the DSTTN model merges the feature dimensions of all time steps together for linear transformation and reshapes the final result. Specifically, Input the output layer to get the model's prediction results , ,in, represents the shape adjustment function, represents the reshape function; Shape Converter , a linear layer is applied to This dimension, the output dimension is ,in, Represents the output dimension of the DSTTN model, and finally Reshape it into .

[0041] S5. Input the traffic sequence to be predicted into the trained DSTTN model, generate prediction results, and analyze and evaluate the prediction results.

[0042] Embodiment 2, This embodiment provides a comparative test of a method for predicting urban traffic flow based on data collected by a smart transportation system; the test results are as follows: As shown in Table 1, to evaluate the performance of the model, the DSTTN model is compared with the existing advanced deep learning methods. The error in Table 1 is the average error for one hour (predicting the next 12 steps). The mean absolute error (MAE), mean absolute percentage error (MAPE), and root mean square error (RMSE) are used to evaluate the model. MAE, MAPE, and RMSE reflect the difference between the predicted value and the true value, respectively. The smaller the values ​​of MAE, MAPE, and RMSE, the better the performance of the prediction model.

[0043] As shown in Table 1, the performance parameters of the DSTTN model and advanced models in the field of traffic flow prediction, including diffusion graph convolutional recurrent network (DCRNN), spatiotemporal graph convolutional network (STGCN), graph wave network (GWNET), graph multi-attention network (GMAN), spatiotemporal synchronous graph convolutional network (STSGCN), attention-based spatiotemporal graph convolutional network (ASTGCN), multi-graph dynamic spatiotemporal graph convolutional network (DDSTGCN), spatiotemporal autoencoder (ST_AE) and decomposed dynamic graph convolutional network (DDGCRN) are provided. It can be seen that the mean absolute error and root mean square error of the DSTTN model are smaller than the results of other models, and the mean absolute percentage error is also smaller than the average of other models; the DSTNN model uses dynamic spatiotemporal embedding to simulate the inherent patterns of traffic flow and uses the spatiotemporal attention mechanism to extract them. Compared with the spatiotemporal graph model, it can obtain better long-term prediction performance. In addition, the complexity of the attention mechanism used by the DSTTN model is much lower than the self-attention mechanism, and it can also obtain excellent performance. Compared with attention models such as GMAN and ST_AE, the DSTTN model is superior to them in both computational time (complexity) and performance.

[0044] Table 1

Claims

1. A method for predicting urban traffic flow based on data collected by an intelligent transportation system, characterized in that: The method comprises the following steps: S1. Collect monitoring data, obtain traffic sequence, and perform preprocessing; S2. Construct a DSTTN model. The DSTTN model passes through a linear layer, a connection and a linear layer, a spatiotemporal block, and an output layer from the input layer to the output layer. A dynamic spatiotemporal embedding module is added between the input layer and the connection and linear layer. The spatiotemporal block includes a dynamic random graph attention module and a dynamic time transformer module. The dynamic random graph attention module passes through a first normalization layer, a feedforward layer, and a second normalization layer in sequence and is connected to the dynamic time transformer module. The dynamic time transformer module passes through a first normalization layer, a feedforward layer, and a second normalization layer in sequence and is connected to the output layer. The first normalization layer and the second normalization layer each contain a residual connection. The feedforward layer contains two linear transformation layers and a nonlinear activation function. ; S3, train the DSTTN model; S4. DSTTN model training is completed and the prediction results of the model are obtained; S5. Input the traffic sequence to be predicted into the trained DSTTN model to generate a prediction result.

2. The urban traffic flow prediction method based on data collected by the intelligent transportation system according to claim 1 is characterized in that: The monitoring data includes N road nodes in a time period The flow data and delay data within the time frame are as follows: and The specific method of obtaining the traffic sequence is as follows: the monitoring data of each road node is counted into the traffic sequence, and the traffic sequence is obtained in the time period In the statistics flow data, if you encounter seconds delayed data, then skip time steps and continue to count traffic data until the time period There is no traffic data to be counted within the period, and the traffic sequence acquisition of the road node is completed; the frequency of the traffic sequence after statistics is 5 minutes, and the time step of the traffic data to be counted within the 5 minutes is: , The pre-processing is specifically as follows: The traffic sequence of the road nodes is deleted and supplemented using linear interpolation The missing values ​​of the traffic sequence of the road nodes are obtained to obtain the traffic data set ;in, Represents the time step threshold used to filter traffic series.

3. The urban traffic flow prediction method based on data collected by the intelligent transportation system according to claim 2 is characterized in that: The training DSTTN model is specifically as follows: S31, the dynamic spatiotemporal embedding module uses the preprocessed traffic sequence to generate the input of the first layer of the spatiotemporal block; S32, the dynamic random graph attention module constructs a multi-head random attention matrix, and sequentially passes through the first normalization layer, the feedforward layer, and the second normalization layer to obtain the input of the dynamic time transformer module; S33, the dynamic time transformer module maps the standardized multi-head attention mechanism to Groups Q, K, and V, and concatenate them to get the output of the dynamic time transformer module; represents the number of parallel attention mechanism heads, Q, K and V are query matrix, key matrix and value matrix respectively; S34, the output of the dynamic time transformer module passes through the first normalization layer, the feedforward layer and the second normalization layer in sequence to obtain the output of the spatiotemporal block.

4. The urban traffic flow prediction method based on data collected by the intelligent transportation system according to claim 3 is characterized in that: The process of obtaining the input of the first layer of the spatiotemporal block is as follows: first, the traffic dataset Feed it into a linear layer to get the raw flow feature embedding , ,in, Represents the linear layer function, and then and the embedded output Feed it into the concatenation and linear layers to get the input of the first layer of the spatiotemporal block , ,in, represents the set of real numbers, Indicates the batch size, represents the step size of historical data, Indicates the number of nodes, represents the dimension of the final embedding, Represents the connection function.

5. The urban traffic flow prediction method based on data collected by the intelligent transportation system according to claim 4 is characterized in that: The multi-head random attention matrix is ​​specifically: , ,in, Represents a splicing operation, represents the linear transformation matrix, represents a random attention matrix; the random attention matrix is: ,in, Indicates the current space-time block layer number, , Indicates the number of space-time block stacking layers, represents the input of the dynamic random graph attention module of the current layer and the output of the previous layer of the spatiotemporal block of the current layer, represents the activation function, represents spatial attention, represents the output of the current layer’s random attention, represents the time step, , represents a random attention weight matrix; ,in Indicates The attention matrix for time steps, Represents a mask, Represents the normalization function.

6. The urban traffic flow prediction method based on data collected by the intelligent transportation system according to claim 5 is characterized in that: The dynamic time is obtained by sequentially passing through the first normalization layer, the feedforward layer and the second normalization layer The input of the module is as follows: The formula is calculated through the first normalization layer: , get the output of the first normalization layer , Includes the input of the feedforward layer and the residual of the second normalization layer; where, and represents the mean and variance of the input features, Represents a small constant to prevent division by zero errors, and denote the scaling parameter and the bias term respectively, represents the residual, The output representing attention includes and , Represents dynamic time The output of the module; Substitute into the calculation formula of the feedforward layer: , and get the output of the feedforward layer ;in, represents a nonlinear activation function, are the weight matrices of the first and second layer linear transformations, respectively. are the bias terms of the two linear layers respectively; and Substitute into the second normalization layer calculation formula: , and get the output of the second normalization layer , This includes the input of the dynamic temporal transformer module and the output of the spatiotemporal block.

7. The urban traffic flow prediction method based on data collected by the intelligent transportation system according to claim 6 is characterized in that: Said , and in, represents the dimension after H attentions are spliced ​​together; the output of the dynamic time transformer module obtained by splicing them is specifically: ,in, represents the trainable weight matrix, express Dimension.

8. The urban traffic flow prediction method based on data collected by the intelligent transportation system according to claim 7 is characterized in that: The output of the dynamic time transformer module is sequentially passed through the first normalization layer, the feedforward layer and the second normalization layer to obtain the output of the spatiotemporal block: Enter the first normalization layer and get ,Will Input feed-forward layer to get , and then and Substituting into the second normalization layer, we get .

9. The urban traffic flow prediction method based on data collected by the intelligent transportation system according to claim 8 is characterized in that: The DSTTN model training is completed, and the prediction results of the model are as follows: , DSTTN model training is completed, Input the output layer to get the model's prediction results , ,in, represents the shape adjustment function, Represents a reshape function.

Citation Information

Patent Citations

  • Traffic sequence prediction method based on multivariate time series data analysis

    CN115713155A