A traffic flow prediction method based on multi-dimensional temporal and spatial dependency mining
By introducing adaptive time feature extraction module and composite graph convolution module in traffic flow prediction, the problem that the prior art is difficult to effectively capture complex features of traffic flow is solved, and higher prediction accuracy is achieved.
Patent Information
- Application Number
- CN202211721955.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-12-30
AI Technical Summary
When the existing traffic flow prediction method deals with the multivariate time series prediction problem, it is difficult to effectively capture the complex characteristics of traffic flow in the time and space dimensions, resulting in insufficient prediction accuracy.
Adaptive time feature extraction module based on time convolution network (TCN) and self-attention mechanism is adopted, and the multi-dimensional time and spatial characteristics of traffic flow data are combined with composite graph convolution module (CGCM).
By extracting the fusion of high-dimensional local implicit features and non-local features, the accuracy of traffic flow prediction is significantly improved and the model's perceived ability of temporal and spatial features is enhanced.
Smart Images

Figure CN115953900B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a traffic flow prediction method based on multi-dimensional time and space dependency mining. Background Art
[0002] Traffic flow prediction has been a hot topic in the research of intelligent transportation in recent years. Deep learning tools are used to analyze the characteristic change trend of traffic flow on the time axis and the spatial interaction relationship between traffic nodes, and more accurate prediction results are obtained based on the extracted spatiotemporal features. The traffic flow prediction method based on deep learning not only completely avoids the manual analysis and processing of data, but also obtains implicit spatiotemporal correlation features through the integration of multiple groups of modules, thereby improving the accuracy of traffic flow prediction. Therefore, it has attracted widespread attention from scholars at home and abroad.
[0003] Specifically, given traffic flow data Where T his represents the number of historical time slices used, N represents the number of traffic monitoring nodes, and F represents the dimension of the characteristic data sampled at each time slice of each node. Since both the characteristic change trend of the traffic node itself in the time dimension and the interaction of traffic flow between nodes in the spatial dimension are considered at the same time, the traffic flow prediction problem is a typical multivariate time series prediction problem. Formula (1) defines the prediction process of the traffic prediction problem:
[0004]
[0005] Among them, X h Represents historical information. represents the prediction result, f(·) represents the prediction model, and Φ represents additional information such as road width, weather conditions, etc. In general, multivariate time series prediction is a type of regression problem, that is, the relationship between variables is analyzed by modeling. Regression problems are usually predictions of specific values. Therefore, the training process of deep learning models for regression problems is to find a set of parameters that minimize the error between the prediction result and the real data. The prediction problem is thus transformed into an optimization problem of the loss function. The model training process is equivalent to formula (2):
[0006]
[0007] Where Opimizer(·) represents the optimization process, Loss(·) represents the selected loss function, and X pTo predict the real data of the target period. The optimization process of the loss function of the deep learning model is generally carried out in the back propagation algorithm. Common back propagation algorithms include Stochastic Gradient Descent (SGD), momentum method and Adam, etc. This method calculates the gradient of the parameters based on the loss value obtained by forward propagation, so that the model converges to the global optimal solution in the direction of minimizing the error. Summary of the invention
[0008] The embodiment of the present invention provides a traffic flow prediction method based on time and space feature dependency mining, which can predict traffic flow more accurately and improve the robustness of the intelligent transportation system.
[0009] The solution of the present invention to solve the above problems is as follows: a traffic flow prediction method based on multi-dimensional time and space feature dependency mining, characterized in that: in the traffic flow prediction model, a heterogeneous component adaptive time feature extraction module is introduced, and an adaptive time feature extraction module based on a temporal convolution network (TCN) and a multivariate time feature fusion module (SFMM) based on a self-attention mechanism are used to expand the model's perception space for key time features and improve the model's feature extraction capability in the time dimension, that is, the following model is used to extract time features:
[0010]
[0011] in is the original input data, where T h represents the length of the input data, N represents the number of traffic nodes in the road network, C i Indicates the number of channels of the input data. The module SATCN is a Self-adaption Temporal Convolution Network (SATCN). is the output of the module, C h is the number of channels of high-dimensional features. SATCN is used to obtain high-dimensional temporal features of data, so X h It is the high-dimensional feature representation of traffic data in the time dimension. SFMM is the Self-attention Features Merge Module (SFMM). is the obtained mixed traffic time characteristics, T p is the number of time slices in the target forecast period.
[0012] The specific SATCN module can be decomposed into the following specific operation process. First, we define multi-layer time convolution to extract features in the time dimension:
[0013]
[0014] in is the input of the current layer, T l is the length of the current time series, in the first layer of the model X l =X i , is the output of the current layer. Conv(*) k is a 1D convolution with a kernel size of k, n is the difference in sequence length between the input and output, and the value of n varies depending on the value of k. Since k is a positive value greater than 1, T l -n is always less than T l When T l -n is less than k, then if T l If -n is equal to 1, the convolution process ends, otherwise SATCN adaptively adjusts the convolution kernel size to T l -n performs the last convolution operation to obtain a high-dimensional time feature representation X of size 1 h .
[0015] At the same time, we use SFMM to expand the model's temporal feature extraction domain. SFMM uses a multi-head self-attention mechanism to fuse features of different dimensions. Generally speaking, the self-attention mechanism uses different transformations of a single input as Query, Key, and Value to calculate the output. Query and Key are used to calculate the attention score. The product of the attention score and the Value is the final output result. Here, SFMM uses the original input sequence X i As a query, use the high-dimensional time feature X h As Key and Value. The advantage of this is that the model can obtain time feature information from different dimensions at the same time when fusing features, which enhances the model's ability to perceive time features. h The sequence length is converted to T through Conv1x1 h , X i The number of features is obtained from C through Conv1x1 i Convert to C h .
[0016]
[0017] in and is the high-dimensional feature and the original input sequence after Conv1x1 conversion. Conv1x1 represents the convolution operation with a convolution kernel size of 1x1. The result of (5) is fed into the self-attention mechanism as shown in (6):
[0018]
[0019] in is X′ i As a result of linear changes, is the linear transformation matrix. K and is X′ h As a result of linear changes, the linear transformation matrices are and Softmax is responsible for normalizing the attention points. At the same time, the multi-head mechanism is used to further expand the model's ability to extract temporal features.
[0020]
[0021] Where Q i , K i and V i is the Query, Key and Value corresponding to the i-th attention head. Then a linear layer is used to convert the length of the traffic flow data into the length to be predicted.
[0022]
[0023] in This is the output result of SFMM. Linear(·) is a linear transformation layer that can transform the length of traffic flow data from T h Convert to T p . ReLU is the activation function.
[0024] The use of SATCN and SFMM effectively extracts features from traffic flow data in the time dimension. The spatial features between traffic nodes also play a decisive role in the changes in traffic flow. In our proposed model, the Compound Graph Convolution Module (CGCM) is used to extract spatial features of data from multiple domains.
[0025] CGCM consists of two graph convolution networks (GCNs) and a gating unit. The two GCNs are used to extract spatial features from known node spatial topology information and traffic flow data itself. GCN uses graph Fourier transform to convert the original graph node information from the spatial domain to the spectral domain for convolution operation.
[0026]
[0027] in is a learnable parameter and X is graph structure data. is the Fourier bias, which is the normalized graph Laplacian operator The eigenvector matrix of . is the identity matrix, is a diagonal matrix, where D ii =∑ j A ij . A is the adjacency matrix representing the relationship between graph nodes. is the diagonal matrix of eigenvalues of L.
[0028] The Chebyshev polynomial is introduced to reduce the computational complexity of formula (9):
[0029]
[0030] where λ max is the maximum eigenvalue of the Laplace matrix L, Represents the scaled Laplacian matrix.
[0031] The node space topology information is contained in the adjacency matrix One of the graph convolutions included in CGCM uses the adjacency matrix to model the interaction mechanism between nodes based on real topological relationships.
[0032]
[0033] Where X s Represents the traffic flow characteristic matrix containing realistic topological associations.
[0034] In another GCN, node embedding is used to learn the node interaction pattern exhibited by the data itself, where node embedding can be expressed as Where e represents the dimension of node embedding. The selection of this dimension depends on the number of traffic nodes that need to be predicted and can be selected according to formula (12).
[0035] e=min{e|2 e ≥N} (12)
[0036] The spatial correlation representation between nodes contained in the traffic data can then be obtained according to formula (13).
[0037]
[0038] Among them A l represents the spatial correlation matrix between nodes containing the data, X lrepresents the traffic feature matrix containing the spatial associations of nodes learned directly from the data.
[0039] In order to avoid the artificial errors contained in the actual topological relationship matrix and the interference spatial association learned from the noise data affecting the final prediction results, a gating unit is used to fuse X s and X l , and by adding X l The output result of the gated unit is directly added to form a residual network to improve the nonlinearity of the model and thus improve the accuracy of the prediction.
[0040]
[0041] Where X g It is the spatiotemporal feature representation matrix, which can get the final prediction result by outputting the linear layer.
[0042]
[0043] in is the parameter matrix of the prediction layer, is the bias of the prediction layer, is the parameter matrix of the output layer, is the bias of the output layer. The traffic conditions for the predicted future period.
[0044] The beneficial effects of the present invention are as follows: the traffic flow prediction method based on multi-dimensional time and space dependency mining described in the present invention first converts historical traffic flow data into the form required for model processing, uses a self-adaptive temporal convolutional network (SATCN) as an encoder to obtain high-dimensional local implicit features of traffic flow data, introduces a self-attention mechanism to obtain non-local features and integrates local and non-local features to extract traffic time features. At the same time, a composite graph convolution module (CGCM) of a two-way graph convolutional network is used to explore the actual topological characteristics between traffic nodes and the data endogenous node associations. Afterwards, a gating unit is used to impose certain restrictions on the flow of data, thereby avoiding errors in the data collection and processing process, and further improving the model's prediction accuracy for future traffic flow.
[0045] On the basis of the above technical solution, the present invention can also be improved as follows:
[0046] Furthermore, the spatiotemporal feature capture model is based on constructing time-sharing feature associations. On the basis of obtaining a spatial feature matrix that represents the associations between nodes, a subnetwork based on proximity cycle mapping is used to construct a time-sharing representation of the spatial feature adjacency matrix to model the spatial associations between traffic nodes at different times. The specific steps are as follows:
[0047] First, we build a time slice embedding based on the daily time slices where e t is the dimension of time slice embedding, which is selected according to formula (16).
[0048]
[0049] Timestamps is the number of time slices collected every day. If the sampling frequency is calculated every five minutes, its value is 288. The time slice is embedded by perturbing the mapping matrix According to the following formula, map it to the adjacent time slice to generate the pooling parameter matrix P t , while utilizing the periodicity of traffic time, it mitigates the impact of non-perfect alignment of traffic cycles.
[0050]
[0051] Using matrix P t The adjacency matrix with time-related mapping is obtained by operating the two matrices representing the relationship between different nodes used in CGCM, so as to model the spatial correlation of traffic nodes under periodic time states.
[0052]
[0053] in is the real topological matrix with time-related mapping, A ln is the endogenous correlation matrix of the data with time association. Subsequently, the spatiotemporal features with time association features are generated according to formula (19) to generate the final traffic prediction results.
[0054]
[0055] in and is a feature matrix with time correlation. It is a spatiotemporal feature matrix with time association. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 This is a structural diagram of a traffic flow prediction method based on multi-dimensional time and space dependency mining involved in the present invention;
[0057] Figure 2 This is a general flow chart of a traffic flow prediction method based on multi-dimensional time and space dependency mining according to the present invention;
[0058] Figure 3 This is a flow chart of the feature extraction steps of the time feature extraction submodule used in the present invention:
[0059] Figure 4This is a flow chart of the steps of the composite graph neural network used in the present invention to capture the spatial features between traffic nodes: DETAILED DESCRIPTION
[0060] The principles and features of the present invention are described below in conjunction with the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0061] Figure 1 This is a structural diagram of a traffic flow prediction method based on multi-dimensional time and space dependency mining involved in the present invention;
[0062] Figure 2 A general flow chart of a traffic flow prediction method based on multi-dimensional time and space dependency mining designed for the present invention;
[0063] Figure 3 This is a flow chart of the feature extraction steps of the time feature extraction submodule used in the present invention, Figure 4 This is a flow chart of the steps of the composite graph neural network used in the present invention to capture the spatial features between traffic nodes. Figure 2 , 3, 4, the specific steps of a traffic flow prediction method based on time and space dependency mining are as follows:
[0064] The user provides specific raw data of traffic characteristics:
[0065] Step 1: First, the original traffic sequence is regularized into a spatiotemporal feature sequence matrix, the sequence data on the multivariate traffic detection nodes are aligned, and then a set of spatiotemporal feature sequence values are generated by performing preprocessing such as normalization. Where N represents the total number of traffic nodes in the detection data, T represents the total number of time slices, and F represents the traffic feature dimension, that is, This group of spatiotemporal features is used as the initial multivariate feature sequence for model processing.
[0066] Step 2: Send the acquired features to the first fully connected linear layer for dimensionality increase, expand the information representation dimension of the data to obtain a high-dimensional feature matrix Among them C h Represents the feature dimension after dimensionality increase.
[0067] Step 3: The model determines how many time convolution layers to generate and whether to generate an adaptive convolution layer to generate the final high-dimensional local time features based on T and the size of the convolution kernel. With a sampling frequency of once every five minutes, one hour of historical data is taken as the value of T, that is, T = 12, and the convolution kernel is 3. At this time, each layer of convolution will reduce the length of the time series of that layer by 2. After stacking five layers of time convolution, the remaining sequence length is 2, and an adaptive layer is required to further generate the final time feature representation. That is, the convolution kernel size is 2 at this time.
[0068] Step 4: Use the generated temporal convolutional layer and adaptive layer to train the sequence X h Perform multiple iterations until the sequence length is compressed to 1, that is, generate an intermediate hidden state The operation of each layer is shown in formula (20):
[0069]
[0070] Among them, BatchNormal represents the batch normalization operation, and Dropout represents the random dropout operation. The random dropout probability selected here is 0.5, and this operation is only effective in the model training stage, not in the model use and prediction stage. l represents the hidden state generated by each layer and H0=X h .
[0071] Step 5: Use the self-attention mechanism to further observe the time dimension characteristics of traffic from a global dimension and convert X h and H to generate a traffic sequence feature matrix containing local and non-local time features. h As the Query sequence in the self-attention mechanism, H is calculated as the Key and Value sequence of the self-attention mechanism. The calculation method is as follows:
[0072]
[0073] Among them, due to X h The sequence length is 1, so Conv1×1 is first used to expand the feature matrix in the time dimension. It contains a multi-dimensional traffic time feature matrix. Then, a linear layer is used to convert the sequence length of XTH from the historical sequence length T to the predicted target sequence length T p Get the traffic time characteristic matrix that meets the predicted target length
[0074] Step 6: X PH Make two copies and send one to GCN s The spatial features between nodes are captured from the node native spatial topology information, and the other is sent to GCN d In this paper, GCN is used to mine spatial associations between nodes from raw data. s The adjacency matrix A used s Based on real-world properties such as the distance between nodes. GCN d The adjacency matrix A used dIt is generated through node embedding, which is used to learn the representation of each node from the data, thereby building the relationship between nodes. The outputs of the two are then fused through the gating unit to filter out possible error information. The specific operation steps are as follows:
[0075]
[0076] in Represents the node embedding matrix, e is the dimension of node embedding, which is generally selected according to the global number of nodes. is the acquired spatiotemporal feature matrix.
[0077] X st Send it to the final two fully connected layers, prediction layer and output layer, and output the final prediction result
[0078]
[0079] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A traffic flow prediction method based on multi-dimensional temporal and spatial feature dependency mining, characterized by: In the traffic flow prediction model, a heterogeneous component adaptive time feature extraction module is introduced. The adaptive time feature extraction module based on the temporal convolution network (TCN) and the multi-temporal feature fusion module (SFMM) based on the self-attention mechanism are used to expand the model's perception space for key time features and improve the model's feature extraction capability in the time dimension: in, is the original input data, where T h represents the length of the input data, N represents the number of traffic nodes in the road network, C i Indicates the number of channels of input data. The module SATCN is a Self-adaption Temporal Convolution Network (SATCN). is the output of the module, C h is the number of channels of high-dimensional features; SATCN is used to obtain high-dimensional time features of data, so X h It is the high-dimensional feature representation of traffic data in the time dimension. SFMM is the Self-attention Features Merge Module (SFMM). is the obtained mixed traffic time characteristics, T p The number of time slices for the target period to be predicted; Specifically, the SATCN module in the above operation process is decomposed into the following operation process. First, multi-layer time convolution is defined to extract features in the time dimension: in is the input of the current layer, T l is the length of the current time series, in the first layer of the model X l =X i , is the output of the current layer, Conv(*) k is a 1D convolution with a kernel size of k. n is the difference in sequence length between the input and output. The value of n varies depending on the value of k. Since k is a positive value greater than 1, T l -n is always less than T l , when T l -n is less than k, then if T l If -n is equal to 1, the convolution process ends, otherwise SATCN adaptively adjusts the convolution kernel size to T l -n performs the last convolution operation to obtain a high-dimensional time feature representation X of size 1 h ; SFMM provides the model with a global perspective of the traffic sequence in the time dimension, further expanding the model's ability to extract traffic features in the time dimension. SFMM uses a multi-head self-attention mechanism to fuse features of different dimensions. Generally speaking, the self-attention mechanism uses different transformations of a single input as Query, Key, and Value to calculate the output. Query and Key are used to calculate the attention score, and the product of the attention score and Value is the final output result. Here, SFMM uses the original input sequence X i As a query, use the high-dimensional time feature X h As Key and Value, the advantage of this is that the model can obtain time feature information from different dimensions at the same time when fusing features, which enhances the model's ability to perceive time features. h The sequence length is converted to T through Conv1x1 h , X i The number of features is obtained from C through Conv1x1 i Convert to C h ; in and is the high-dimensional feature and the original input sequence after Conv1x1 conversion. Conv1x1 represents the convolution operation with a convolution kernel size of 1x1. The result of formula (3) is sent to the operation of the self-attention mechanism as shown in formula (4): in is X′ i As a result of linear changes, is the linear transformation matrix, K and is X′ h As a result of linear changes, the linear transformation matrices are and Softmax is responsible for normalizing the attention points, and the multi-head mechanism is used to further expand the model's temporal feature extraction capabilities: Where Q i , K i and V i is the Query, Key and Value corresponding to the i-th attention head, and then a linear layer is used to convert the length of the traffic flow data into the length to be predicted; in This is the output result of SFMM. Linear(·) is a linear transformation layer that transforms the length of traffic flow data from T h Convert to T p , ReLU is the activation function, X p That is, the extracted multivariate spatiotemporal feature matrix containing local and non-local time features; After obtaining a multivariate spatiotemporal matrix X containing local and non-local time features p Afterwards, the Compound Graph Convolution Module (CGCM) based on multi-spatial domain feature extraction is used to extract the spatial features of the data. The specific steps are as follows: 1) Use graph Fourier transform to convert the original spatiotemporal graph structure data from the spatial domain to the spectral domain to perform graph convolution operations: in is a learnable parameter, X is the graph structure data, is the Fourier bias, which is the normalized graph Laplacian operator The eigenvector matrix of is the identity matrix, is a diagonal matrix, where D ii =∑ j A ij , A is the adjacency matrix representing the relationship between graph nodes, is the eigenvalue diagonal matrix of L, and Chebyshev polynomials are used to simplify the time complexity of the above operations: where λ max is the maximum eigenvalue of the Laplace matrix L, represents the scaled Laplacian matrix; 2) Apply the above operation to two different graph convolution operations. The main difference between the two is that the adjacency matrices used in the graph convolution process come from different feature spaces. The node space topology information is contained in the adjacency matrix In ,the construction of the matrix is based on the collected real traffic node features and the ,relationships between nodes, such as the distance between nodes; Where X s Represents the traffic flow characteristic matrix containing realistic topological associations; In another composite unit, the node interaction pattern exhibited by the data itself is learned through node embedding, where the node embedding can be expressed as Where e represents the dimension of node embedding. The selection of this dimension depends on the number of traffic nodes that need to be predicted and is selected according to formula (10); e=min{e|2 e ≥N} (10) The spatial correlation representation between nodes contained in the traffic data can be obtained according to formula (11); Among them A l represents the spatial correlation matrix between nodes containing the data, X l represents the traffic feature matrix containing the spatial associations of nodes learned directly from the data; 3) Furthermore, in order to avoid the artificial errors contained in the actual topological relationship matrix and the interference spatial association learned from the noise data affecting the final prediction results, a gated unit is used to fuse X s and X l , and by adding X l The output of the gated unit is then directly added to form a residual network to improve the nonlinearity of the model and thus improve the accuracy of the prediction. Where X g That is, the spatiotemporal feature representation matrix, which can obtain the final prediction result by outputting the linear layer; in is the parameter matrix of the prediction layer, is the bias of the prediction layer, is the parameter matrix of the output layer, is the bias of the output layer, The traffic conditions for the predicted future period.
Citation Information
Patent Citations
Traffic prediction method based on adaptive spatial self-attention map convolution
CN112801404A
Multi-fusion graph network collaborative multi-channel attention model and application and application method thereof
CN113283581A