A road network traffic state prediction method under limited observation conditions
By supplementing traffic data through a generative network framework and a multi-head attention mechanism, the problem of missing data in traffic condition prediction is solved, the prediction accuracy is improved, and traffic management and travel planning are enhanced.
Patent Information
- Application Number
- CN202311439931.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-01
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2043-11-01
AI Technical Summary
Existing traffic condition prediction methods struggle to effectively handle missing data under limited observation conditions, leading to decreased prediction accuracy.
A generative network framework is adopted, which combines spatial dynamic graph convolutional neural network and multi-head attention mechanism. The generator completes the missing data and a multi-task learning network model is constructed to predict traffic conditions.
It improves the accuracy of traffic condition prediction, provides more scientific and reasonable traffic control solutions and travel strategies, alleviates traffic congestion, improves road network operation efficiency, and reduces economic losses and carbon emissions.
Smart Images

Figure CN117576895B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of artificial intelligence, and relates to traffic state modeling and prediction technology, in particular to a road network traffic state prediction method under limited observation conditions. BACKGROUND
[0002] Traffic state generally refers to traffic flow, traffic density, traffic speed and travel time, etc. Accurate traffic state prediction can help traffic system managers effectively handle and control the traffic network to avoid traffic congestion. In addition, drivers can also use the current traffic state to better plan their departure time and travel route, improving travel efficiency.
[0003] Currently, traffic state prediction methods can be mainly divided into three categories: classical statistical methods, machine learning algorithms and deep learning algorithms. Since classical statistical methods usually have clear and simple calculation structures, they are often used in the early stages of research, but they are usually subject to certain assumptions (for example, stationarity assumption) and are suitable for smaller data sets. However, existing traffic data sets are usually large in size, which leads to unsatisfactory results when classical statistical methods are applied in actual traffic state prediction. Compared with statistical methods, machine learning algorithms are more suitable for capturing complex nonlinear relationships and high-dimensional information inherent in traffic data, so many machine learning algorithms for traffic state prediction have been proposed. However, due to the very complex spatiotemporal characteristics of traffic data, it is still difficult to represent its spatiotemporal information. Compared with machine learning algorithms, deep learning algorithms can usually use convolutional neural networks (CNN) and their variants to model the spatial information of data, and use recurrent neural networks (RNN) and their variants to model the temporal information of data, which can better capture the spatiotemporal characteristics of traffic data. Therefore, current traffic state prediction mostly uses deep learning algorithms. Due to the existence of traffic networks, traffic data is usually represented as non-Euclidean structured data, and graph neural networks can better capture the spatiotemporal characteristics of traffic information, thus achieving better results in traffic parameter prediction. It usually regards traffic detectors as nodes of a graph, and determines the adjacency matrix and edges of the graph according to the connectivity of these nodes, thereby forming a graph. However, most of the above methods require a complete traffic data set, and due to sensor failure, communication error, storage loss, etc., the data collected by sensors inevitably has data missing, which brings great challenges to traffic state prediction. SUMMARY
[0004] In view of the problems in the prior art, the application provides a road network traffic state prediction method under limited observation conditions, which uses a generative network framework to complete traffic data, thereby constructing a complete traffic data set, and then feeding into a traffic state detection framework for traffic state prediction, which can improve the accuracy of traffic state prediction under data missing conditions, avoid a significant decline in prediction accuracy due to data missing, and provide technical support for more scientific and reasonable traffic control schemes and travel strategies.
[0005] In order to achieve the above object, the application provides the following technical scheme:
[0006] A road network traffic state prediction method under limited observation conditions comprises the following steps:
[0007] Step 1: determining a data space-time coding method and a data mask matrix;
[0008] Step 2: establishing a dynamic graph convolutional neural network module and a multi-head attention module;
[0009] Step 3: establishing a generative network framework to complete missing data;
[0010] Step 4: constructing a multi-task learning network model to predict traffic state.
[0011] Further, the step 1 specifically comprises the following process:
[0012] A graph G=(V, E, A) is used to define the corresponding road network structure; wherein, V is a road network node, E is an edge connected to each node, A is an adjacency matrix, N is the number of nodes, M is the number of edges, represents a real number space set of dimension D;
[0013] Through a time position coding module E TP Generate time position coding The calculation method is as shown in formula (1) and (2):
[0014] E TP (t, 2d) = sin(t / 10000 2d / D ) (1)
[0015] E TP (t, 2d+1) = cos(t / 10000 2d / D ) (2)
[0016] Wherein, D is an output channel, T is a time period, 1≤d≤D, t∈[0, 1, …, (T-1)];
[0017] Through a space position coding module ESP Generating spatial position encoding First, generate the position encoding index using the standard encoding module, the input is [0, 1, …, (N-1)], and the output is Then, construct a standard graph convolutional neural network using the input adjacency matrix A and formula (3), with L1 layers, and obtain SE through convolution operation on EM; formula (3) is as follows:
[0018] GCN(X)=σ(AXW) (3)
[0019] wherein, is the input data, is the full connection layer weight matrix, and σ is the ReLU activation function;
[0020] Constructing a data mask matrix When , it indicates that the data of node i at time period j is missing, and when , it indicates that the data of node i at time period j is observable.
[0021] Further, the step 2 specifically includes the following process:
[0022] Establishing a spatial dynamic graph convolutional neural network module, the input data of which is and the output is First, calculate the attention score matrix S using formula (5) Then, element-wise multiply S and the adjacency matrix A, and finally perform matrix multiplication with the input X1 and the weight matrix , the formula of which is as follows:
[0023] DGCN(X1)=σ((A⊙S)X1W) (4)
[0024]
[0025] wherein, ⊙ is element-wise multiplication, and the trans(*, (dim1, dim2)) in the output calculation method is to exchange the two dimensions of the data *;
[0026] Establishing a multi-head attention module, each attention head head j Using formula (7) to extract weights, and using formula (6) to splice multiple attention heads and using a full connection layer to obtain the output Finally, through residual connection and layer normalization processing, the final output is obtained
[0027]
[0028]
[0029] where h is the number of attention heads, are query, key and value respectively, and Q, K and V are divided according to the number of attention heads, is a concatenation operation, and are related weight matrices, and softmax is an activation function.
[0030] Further, the step 3 specifically includes the following process:
[0031] A generative network framework is established, which includes a generator and a discriminator, and the initial data is processed by an input head before the generator for dimension increasing; the specific structures of the generator, the discriminator and the input head are as follows:
[0032] The input head input is traffic state data where N is the number of road network nodes, T1 is the number of time segments to be predicted, F in is the length of the input feature; for the position, it is set to 0 during training; the data is projected to a high-dimensional space by a fully connected layer FNN in to obtain an output The input channel of the fully connected layer is F in , and the output channel is D; then is concatenated with time position encoding TE and space position encoding SE in sequence to obtain an output
[0033] The generator input is and the output is which is sequentially passed through a multi-head attention module and a spatial dynamic graph convolutional neural network module to obtain an intermediate output then passed through a fully connected layer to obtain an output The input dimension of the fully connected layer is D, and the output dimension is F in ; finally, the output after completion is obtained by concatenating the data mask matrix with the original data The concatenation method is as shown in formula (8):
[0034]
[0035] where is element-wise multiplication, and + is element-wise addition.
[0036] The discriminator input is real data and data generated by the generator The discriminator is composed of three fully connected layers, and the input dimensions are F in, D, D, output dimensions are D, D, F in ; finally, the loss is calculated by formula (9)
[0037]
[0038] where G is the generator, D is the discriminator, and x is the real data G(z) is the data generated by the generator For the generated data, only the data at is counted when calculating the loss.
[0039] Further, in step 4, the structure of the multi-task learning network model includes:
[0040] 1) Encoder: The input of the encoder is the intermediate output of the generator Output low-dimensional features and high-dimensional features It is composed of L2 encoder layers, and each encoder layer first passes through a multi-head attention module, and then passes through a spatial dynamic graph convolution module; The encoder module passes through the first encoder layer to obtain low-dimensional features After passing through L2-1 encoder layers, high-dimensional features
[0041] 2) Decoder: The input of the decoder is low-dimensional features and high-dimensional features The output is It is composed of L3 decoder layers, and each decoder layer first passes through 2 multi-head attention modules, and then passes through a spatial dynamic graph convolution module for processing. These two types of modules have the same structure as the encoder module, except that the time segment length is modified to predict the time length T2.
[0042] For low-dimensional features It is obtained by splicing with time position encoding TE and spatial position encoding SE to obtain output Then it is used as the Q, K and V of the multi-head attention module to obtain the output Q F1 And it is used as the Q of the next multi-head attention module.
[0043] For high-dimensional features It is used as the K and V of the second multi-head attention module, and the output is calculated using Q F1 Finally, it is processed by the spatial dynamic graph convolution module to obtain the output After L3 decoder layers, the decoder output is obtained
[0044] 3) Output head: by a fully connected layer FNN out with input dimension D and output dimension F out ; decoder output through the fully connected layer to obtain the final output
[0045] 4) Loss function: the traffic state prediction loss function adopts loss, and the final multi-task learning loss function is wherein λ1= λ2= 0.5 is a hyperparameter.
[0046] Compared with the prior art, the present application has the following advantages and beneficial effects:
[0047] 1) The present application combines a spatial dynamic graph convolutional neural network and a multi-head attention mechanism to more effectively capture the spatio-temporal feature information of traffic data and improve the accuracy of traffic prediction.
[0048] 2) The present application uses a multi-task learning method, uses a generative network framework to complete missing data, and performs traffic state prediction based on this, considers the relevance and constraint between tasks, shares information between multiple tasks, and complements each other, thereby improving the prediction accuracy of each other.
[0049] 3) By capturing the data distribution of the road network traffic state through a generative neural network and completing the traffic data, the prediction accuracy of the road network traffic state under limited observation conditions is improved to a certain extent, which can provide more scientific and accurate reference for traffic system managers, and is conducive to relieving traffic congestion, improving road network traffic efficiency, reducing economic losses and reducing carbon emissions. BRIEF DESCRIPTION OF DRAWINGS
[0050] Figure 1 The present application provides a road network traffic state prediction method under limited observation conditions.
[0051] Figure 2 The present application provides a traffic state prediction framework diagram. DETAILED DESCRIPTION
[0052] The technical solutions provided by the present application will be described in detail below in combination with specific embodiments, and it should be understood that the following specific embodiments are only used to illustrate the present application and not to limit the scope of the present application.
[0053] As shown in Figure 1 , Figure 2 , the present application provides a road network traffic state prediction method under limited observation conditions, and the specific steps are as follows:
[0054] Step 1: Determine the spatiotemporal position encoding method according to traffic data and construct a data mask matrix;
[0055] Considering that the road network traffic state is spatiotemporal data, it is sensitive to the spatial position and time segment of the data, so additional position encoding is needed when processing related data. Under limited observation conditions, an additional data mask is needed to mark whether the data is missing during model training, and the mask can be ignored during inference. In addition, the road network structure is in a non-Euclidean space, so the graph G=(V, E, A) is used to define the corresponding road network structure; where, is the road network node, is the edge connected to each node, is the adjacency matrix, N is the number of nodes, M is the number of edges, represents a set of real number spaces of dimension D;
[0056] For time position encoding, the time position encoding module E Tp generates time position encoding The calculation method is as shown in formulas (1) and (2):
[0057] E TP (t, 2d) = sin(t / 10000 2d / D ) (1)
[0058] E TP (t, 2d+1) = cos(t / 10000 2d / D ) (2)
[0059] where D is the output channel, T is the time period, 1≤d≤D, t∈[0,1, …, (T-1)];
[0060] For spatial position encoding, the spatial position encoding module E SP generates spatial position encoding This module first generates a position encoding index using a standard encoding module (such as pytorch's nn.Embedding), with an input of [0, 1, …, (N-1)] and an output of Then, by inputting the adjacency matrix A and using formula (3), a standard graph convolutional neural network is constructed, with L1 layers, and SE is obtained after convolution operation on EM.
[0061] GCN(X) = σ(AXW) (3)
[0062] where, is the input data, is the fully connected layer weight matrix, and σ is the ReLU activation function;
[0063] Constructing a data mask matrix when The time interval indicates that data for node i in time interval j is missing. This indicates that the data for node i in time period j is observable.
[0064] Step 2: Establish a dynamic graph convolutional neural network module and a multi-head attention module. The dynamic graph convolutional neural network module captures spatial information, and the multi-head attention module captures temporal information, thereby improving the network model's ability to capture spatiotemporal information of data.
[0065] For the spatial dynamic graph convolutional neural network module, the input data is: Output It first uses formula (5) to calculate the attention score matrix. Next, multiply S element-wise with the adjacency matrix A, and finally multiply S with the input X1 and the weight matrix in the same way. The formula for matrix multiplication is as follows:
[0066] DGCN(X1)=σ((A⊙S)X1W) (4)
[0067]
[0068] Where ⊙ represents element-wise multiplication, and trans(*, (dim1, dim2)) in the output calculation method swaps the two dimensions of data*.
[0069] For a multi-head attention module, each attention head j The weights are extracted using formula (7), and then multiple attention points are concatenated using formula (6) and the output is obtained using a fully connected layer. Finally, the final output is obtained through residual connections and layer normalization.
[0070]
[0071]
[0072] Where h is the number of attention heads, These are respectively query, key, and value. Then, based on the number of attention heads, Q, K, and V are divided. For splicing operations, and Here is the relevant weight matrix, and softmax is the activation function.
[0073] Step 3: Establish a generative network framework, combine the generative network framework and the data mask matrix to complete the missing data, and thus build a complete traffic data set;
[0074] For the generative network framework, it is usually composed of a generator G and a discriminator D. In addition, since the initial data is usually in a low-dimensional space, it needs to be dimensionally processed by an input head before being sent to the generator. The specific structure is as follows:
[0075] 1) Input head: the input is traffic state data Where N is the number of road network nodes, T1 is the number of time segments to be predicted, F in is the length of the input feature; for the position, set it to 0 during training; Project the data to a high-dimensional space through a fully connected layer FNN in to get the output The input channel of this fully connected layer is F in , and the output channel is D; then concatenate the time position encoding TE and the space position encoding SE in sequence to get the output
[0076] 2) Generator: the input is The output is It goes through a multi-head attention module and a spatial dynamic graph convolutional neural network module in sequence to get the intermediate output Then pass through a fully connected layer to get the output The input dimension of this fully connected layer is D, and the output dimension is F in ; finally, according to the data mask matrix and the original data, the completed output is obtained by splicing Its splicing method is as formula (8):
[0077]
[0078] Where ⊙ is element-wise multiplication, and + is element-wise addition.
[0079] 3) Discriminator: the input is the real data and the data generated by the generator It is composed of 3 fully connected layers, with input dimensions of F in , D, D, and output dimensions of D, D, F in ; finally, the loss is calculated using formula (9)
[0080]
[0081] Where G is the generator, D is the discriminator, and x is the real data G(z) is the data generated by the generator For the generated data, only the data at is counted when calculating the loss.
[0082] Step 4: Construct a multi-task learning network model to predict the traffic state, and implicitly represent the internal constraints between tasks through multi-task learning, so as to improve the prediction accuracy of the model;
[0083] Considering the internal relationship between data completion and traffic state prediction, the multi-task learning method is used for training, and the structure is as follows:
[0084] 1) Encoder: The input of the encoder is the intermediate output of the generator Output low-dimensional features and high-dimensional features It is composed of L2 encoder layers, and each encoder layer will first pass through a multi-head attention module, and then pass through a spatial dynamic graph convolution module; The encoder module passes through the first encoder layer to obtain low-dimensional features After L2-1 encoder layers, high-dimensional features
[0085] 2) Decoder: The input of the decoder is low-dimensional features and high-dimensional features The output is It is composed of L3 decoder layers, and each decoder layer will first pass through 2 multi-head attention modules, and then pass through a spatial dynamic graph convolution module for processing. These two types of modules are consistent with the structure in the encoder module, except that the time segment length is modified to the prediction time length T2.
[0086] For low-dimensional features It is obtained by splicing with time position encoding TE and space position encoding SE to obtain output Then it is used as Q, K and V of the multi-head attention module to obtain output Q F1 And it is used as Q of the next multi-head attention module.
[0087] For high-dimensional features It is used as K and V of the second multi-head attention module, and Q F1 is used to calculate the output Finally, it is processed by the spatial dynamic graph convolution module to obtain the output After L3 decoder layers, the decoder output can be obtained
[0088] 3) Output head: a fully connected layer FNNout The input dimension is D and the output dimension is F out ; decoder output The final output is obtained through the full connection layer
[0089] 4) Loss function: the traffic state prediction loss function adopts Loss, the loss function of the final multi-task learning is Wherein λ1=λ2=0.5 is a hyperparameter.
[0090] The technical means disclosed in the present application scheme is not limited to the technical means disclosed in the above-mentioned embodiments, but also includes the technical solutions composed of any combination of the above technical features. It should be pointed out that for ordinary skilled in the art, without departing from the principle of the present application, some improvements and refinements can also be made, which are also considered as the protection scope of the present application.
Claims
1. A method for traffic state prediction of a road network under limited observation, characterized in that, Comprising the following steps: Step 1: determining the data space-time coding method and data mask matrix; Step 2: establishing a dynamic graph convolutional neural network module and a multi-head attention module; Step 3: establishing a generative network framework to complete the missing data; specifically Comprising the following processes: A generative network framework is established, which includes a generator and a discriminator, and the initial data is processed by dimensionality increasing before the generator through an input head; the specific structure of the generator, the discriminator and the input head is as follows: The input head inputs traffic state data wherein, is the number of road network nodes, is the number of time segments for prediction, is the length of input features; for the position, let it be 0 during training; project the data to a high-dimensional space through a fully connected layer to obtain an output , the input channel of the fully connected layer is , and the output channel is ; then is spliced with time position encoding and spatial position encoding in sequence to obtain an output ; The generator input is , and the output is ; sequentially passing through a multi-head attention module and a spatial dynamic graph convolutional neural network module, an intermediate output is obtained; then passing through a fully connected layer to obtain an output , the input dimension of the fully connected layer is , and the output dimension is ; finally, the completed output is obtained by splicing the data mask matrix and the original data , and the splicing method is as formula (8): (8) wherein, element-wise multiplication, is an element-wise addition, is a data mask matrix; The discriminator input is real data and the data generated by the generator ; the discriminator is composed of 3 fully connected layers, the input dimensions are , , , and the output dimensions are , , ; finally, the loss is calculated by formula (9) and marked as : (9) wherein, is a generator, is a discriminator, is real data , is data generated by the generator ; for the generated data, only data at is counted when computing the loss; Step 4: constructing a multi-task learning network model to predict the traffic state.
2. The method of claim 1, wherein, The step 1 specifically Comprising the following processes: Utilizing a graph to define a respective road network structure; wherein, is a road network node, is an edge connecting respective nodes, is an adjacency matrix, is a number of nodes, is a number of edges, denotes a set of real number spaces of dimension By time position encoding module Generating time position encoding ; its calculation method is as formulas (1) and (2): (1) (2) wherein is an output channel, is a time period, , ; By a spatial position coding module Generate spatial position coding ; first, use the standard coding module to generate position coding index, the input is , and the output is ; then through the input adjacency matrix and using formula (3) to construct a standard graph convolutional neural network, the number of layers is , and after convolution operation on , the result is ; formula (3) is as follows: (3) wherein, is the input data, is the fully connected layer weight matrix, is the ReLU activation function; Constructing a data mask matrix When 0 indicates that the data for a node is missing over a time period When indicates that the data for a node is observable over a time period .
3. The method of claim 1, wherein, The step 2 specifically comprises the following processes: A spatial dynamic graph convolutional neural network module is established, input data of the module is , and output ; firstly, an attention score matrix is calculated by using formula (5), then is multiplied with an adjacency matrix element by element, finally, matrix multiplication is performed according to the multiplication result, input and a weight matrix , and the formula is as follows: (4) (5) wherein, is an element-wise multiplication, and is an exchange data of two dimensions; A multi-head attention module is established, and each attention head The weight is extracted by using formula (7), and the multiple attention heads are spliced by using formula (6) and the output is obtained by using a full connection layer , and finally the final output is obtained through residual connection and layer normalization processing ; (6) (7) wherein, is the number of attention heads, are query, key and value, respectively, and is divided according to the number of attention heads , and , is a concatenation operation, and are related weight matrices, is an activation function.
4. The method of claim 1, wherein, In the step 4, the structure of the multi-task learning network model comprises: 1) Encoder: the input of the encoder is the intermediate output of the generator , the output is the low-dimensional feature and the high-dimensional feature ; it is composed of encoder layers, and each encoder layer is first passed through a multi-head attention module and then through a spatial dynamic graph convolution module; the encoder module obtains the low-dimensional feature after the first encoder layer, and obtains the high-dimensional feature after encoder layers; 2) Decoder: The decoder input is low-dimensional features. and high-dimensional features The output is Its origin The system consists of several decoder layers. Each decoder layer first passes through two multi-head attention modules, and then through a spatial dynamic graph convolution module. These two types of modules have the same structure as those in the encoder module, except that the temporal segment length is modified to change the prediction time length. ; For low-dimensional features , which are obtained by concatenating and spatial position encoding , and then inputting them into the multi-head attention module to obtain the output , which is then inputted into the multi-head attention module to obtain the output , and , and then inputting them into the multi-head attention module to obtain the output , which is then inputted into the multi-head attention module to obtain the output ; For high-dimensional features , as the second multi-head attention module and , and use to calculate the output , and finally use the spatial dynamic graph convolution module to process to get the output ; after decoder layers, the decoder output can be obtained 3) Output header: Consists of a fully connected layer The composition, its input dimension is The output dimension is Decoder output The final output is obtained after passing through this fully connected layer. ; 4) Loss function: The traffic state prediction loss function adopts loss, and the loss function of the final multi-task learning is ; wherein is a hyperparameter.
Citation Information
Patent Citations
Traffic prediction transfer learning method based on space-time diagram self-attention model
CN115409276A