Traffic flow prediction method
Processing traffic data through spatio-temporal multi-factor fusion graph neural network solves the shortcomings of existing methods in capturing the spatio-temporal characteristics and data missing of traffic flow, and achieves more accurate and complete traffic flow prediction.
Patent Information
- Application Number
- CN202410673399.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-06
AI Technical Summary
Existing traffic flow prediction methods are difficult to accurately capture spatiotemporal characteristics, especially in the spatial dependence and time dependence between sensor nodes, and ignore the impact of missing data on prediction.
The spatiotemporal multi-factor fusion graph neural network is used to process historical traffic data through the data completion layer, extract spatial dependencies and short-term and long-term time dependencies, and perform data fusion through the fusion layer to predict future traffic flow.
It improves the accuracy and completeness of traffic flow prediction, can effectively handle missing data, and comprehensively considers spatial and temporal dependencies to provide more accurate prediction results.
Smart Images

Figure CN118609353A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine learning, and in particular relates to a traffic flow prediction method. Background Art
[0002] With the continuous expansion of urban transportation networks, the increasing traffic volume, and the diversification of travel modes, accurately predicting traffic flow has become a crucial issue for optimizing traffic management and planning. Intelligent transportation systems, as an effective tool to alleviate traffic congestion, are attracting attention worldwide. Traffic flow prediction is an important part of ITS, and its purpose is to predict future traffic conditions in road networks based on historical observation data. However, road sensor nodes in road networks are spatially interconnected and influence each other, and the traffic flow data of a single node forms a long time series with dynamic temporal patterns. Therefore, traffic prediction has always been a challenging task due to its complex spatiotemporal characteristics.
[0003] In recent years, with the continuous development of graph neural networks, how to effectively model graphs on spatiotemporal data has become a focus of attention. Many methods, such as DCRNN and ASTGCN, usually use static adjacency matrices (either predefined or self-learned) to represent the spatial dependencies between nodes. An obvious disadvantage of these methods is that their spatial relationships are fixed. In fact, there are similarities between nodes from a global perspective, and the spatial dependencies may change dynamically over time. Fixed adjacency relationships cannot model the global similarities between nodes that change dynamically over time. Recently, such as STFGCN and DSTAGNN, these methods learn dynamic graphs in a data-driven way with days as the time unit to better reflect the dynamically changing spatial dependencies between nodes. However, these methods also have some defects. They may overemphasize the impact of globally similar nodes on a node, while ignoring the traffic fluctuations caused by the changes in the traffic of real adjacent nodes in a single time step. The above methods often use static adjacency matrices or dynamic similarity matrices alone to model the spatial dependencies between nodes, but do not fully consider the impact of multiple factors on traffic flow prediction. Due to the mutual mapping between sensor nodes, traffic flow is complex and cyclical in the long term, but sudden and fluctuating in the short term. Based on the long-term and global scale, the nodes are similar, and the data-driven dynamic adjacency matrix may select the most similar nodes in days as neighbors; in the short-term and local scale, for a single time step of a single node, the flow changes of the adjacent nodes in the real world at the previous moment still play an important role in its own flow fluctuations, which cannot be ignored. Ignoring the influence of any of the factors mentioned above will lead to incomplete modeling of the spatial dependence between nodes. Only comprehensive consideration can take into account the influence of real adjacent nodes and global similar nodes on traffic flow prediction.
[0004] Secondly, for the data of each node in the road network, since its nature is time series data, we need to pay attention to its short-term and long-term temporal dependencies at the same time. However, the current spatiotemporal prediction research has certain deficiencies in the learning of temporal dependencies. Some methods, such as STGCN, use Convolutional Neural Networks (CNN) to capture short-term temporal dependencies, while DCRNN uses Recurrent Neural Networks (RNN), and GraphWaveNet uses diffusion convolution to try to capture long-term temporal dependencies. However, these methods usually find it difficult to comprehensively consider short-term and long-term temporal correlations, which may lead to the omission of some key temporal features in terms of temporal dependency capture. In addition, traffic data usually relies on sensor collection, but due to sensor failure, communication errors, storage loss, etc., the data collected by the sensor inevitably has data missing. However, complete and correct data is crucial for subsequent data analysis tasks.
[0005] In other words, there is currently a lack of a solution that can accurately predict traffic attribute data. Summary of the invention
[0006] In order to solve the above problems existing in the prior art, the present invention provides a traffic flow prediction method.
[0007] The technical problem to be solved by the present invention is achieved through the following technical solutions:
[0008] The present invention provides a traffic flow prediction method, comprising:
[0009] Obtaining the traffic flow of a preset road network for S consecutive historical preset time steps; the preset road network includes N sensors for collecting traffic attribute data at each preset time step;
[0010] Input the traffic attribute data of the historical S consecutive preset time steps into the trained spatiotemporal multi-factor fusion graph neural network;
[0011] The trained spatiotemporal multi-factor fusion graph neural network performs data completion processing on the traffic attribute data of the historical S consecutive preset time steps through a data completion layer to obtain completed data;
[0012] The trained spatiotemporal multi-factor fusion graph neural network extracts the spatial dependency relationship and the short-term and long-term temporal dependency relationship between the traffic attribute data collected by different sensors in the supplemented data through multiple spatiotemporal multi-factor fusion blocks, and obtains multiple different sub-data accordingly;
[0013] The trained spatiotemporal multi-factor fusion graph neural network fuses the multiple different sub-data through a fusion layer to obtain fused data;
[0014] The trained spatiotemporal multi-factor fusion graph neural network processes the fusion data through a prediction block to predict traffic attribute data of S time steps; S is an integer greater than 1.
[0015] Compared with the prior art, the present invention has the following beneficial effects:
[0016] The present invention obtains the traffic attribute data of S consecutive preset time steps in the history of the preset road network, and uses the trained spatiotemporal multi-factor fusion graph neural network to first complete the traffic attribute data of S consecutive preset time steps in the history to obtain the completed data, and then extracts the spatial dependency and short-term and long-term time dependency between the traffic attribute data collected by different sensors in the completed data, and then fuses the extracted multiple different sub-data, and finally predicts the traffic attribute data of the next S time steps based on the fused data. The missing traffic data is completed through the completion process, thereby providing support for subsequent prediction work and indirectly improving the accuracy of the prediction; by extracting the spatial dependency and the short-term and long-term time dependency, a richer dependency is obtained, so that the data predicted based on the acquired dependency is more accurate.
[0017] The present invention will be further described in detail below with reference to the accompanying drawings and specific implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of a traffic flow prediction method provided by an embodiment of the present invention;
[0019] Figure 2 It is a schematic diagram of the structure of a spatiotemporal multi-factor fusion graph neural network provided by an embodiment of the present invention;
[0020] Figure 3 is a training principle diagram of a GAIN network provided by an embodiment of the present invention;
[0021] Figure 4 is a schematic diagram of the structure of each spatiotemporal multi-factor fusion block provided by an embodiment of the present invention;
[0022] Figure 5A It is a schematic diagram of prediction results of MFSTGNN and some baseline models at different time steps on PEMS04 provided by an embodiment of the present invention;
[0023] Figure 5B It is a schematic diagram of prediction results of different time steps of MFSTGNN and some baseline models on PEMS08 provided by an embodiment of the present invention;
[0024] Figure 6 It is the result of the non-complement variant ablation study on the PEMS08 dataset provided by the embodiment of the present invention;
[0025] Figure 7 It is the ablation study result of other variants on the PEMS08 dataset provided by the embodiment of the present invention;
[0026] Fig. 8A is the filling comparison result of node 10 including 2464 missing data points provided by an embodiment of the present invention;
[0027] Figure 8B is the filling comparison result of node No. 12 including 677 missing points provided by an embodiment of the present invention;
[0028] Fig. 9 It is the visualization result of the predefined static adjacency matrix of nodes No. 0 to No. 19 of the STMFGNN on the PEMS08 data set and the dynamic correlation matrix of the first day of recording provided by the embodiment of the present invention;
[0029] Fig.10 It is the experimental result of studying the number of module stacking layers parameters on the PEMS08 data set provided by the embodiment of the present invention;
[0030] Fig.11 It is the experimental result of studying the M-GTU time scale combination parameters on the PEMS08 data set provided by the embodiment of the present invention;
[0031] Fig.12 It is the experimental result of studying the data batch size parameter on the PEMS08 data set provided by the embodiment of the present invention;
[0032] Fig.13 It is a schematic diagram of the comparison results of the 15-minute prediction results of node 0 of the STMFGNN on the PEMS08 data set provided by an embodiment of the present invention;
[0033] Fig.14 It is a schematic diagram of the comparison results of the 30-minute prediction results of node 0 of the STMFGNN on the PEMS08 data set provided by an embodiment of the present invention;
[0034] Fig.15 It is a schematic diagram of the comparison results of the 60-minute prediction results of node 0 of the STMFGNN on the PEMS08 data set provided by an embodiment of the present invention;
[0035] Fig.16 It is a schematic diagram of the comparison results of the 60-minute prediction results of node 1 on the PEMS08 data set provided by the STMFGNN according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.
[0037] Traffic prediction has always been a challenging task due to its complex spatiotemporal characteristics. The present invention believes that nodes (sensors) on a road network mainly exhibit two types of spatial dependencies: one is the propagation of traffic flow due to the physical proximity between nodes; the other is similar changes due to the similar functions of nodes, even if there is no direct physical connection between them, or even if they are far apart. For example, when the first node on the road network is the main node, not only are there spatial correlations between the nodes that are actually adjacent to the first node and the first node, but nodes that are not directly adjacent to the first node may also have spatial correlations with the first node. Moreover, for the traffic on each node, as time series data, there is a certain time dependency between each time slice, whether it is close in time or a long time interval. Based on this, the present invention provides a spatiotemporal multi-factor fusion graph neural network, and a traffic flow prediction method based on the spatiotemporal multi-factor fusion graph neural network.
[0038] Figure 1 is a flow chart of a traffic flow prediction method provided by an embodiment of the present invention, such as Figure 1 As shown, the method includes:
[0039] S101, obtaining traffic attribute data of a preset road network for S consecutive historical preset time steps; the preset road network includes N sensors for collecting traffic attribute data at each preset time step.
[0040] In the present invention, the traffic attribute data may include one or more attribute data. For example, the traffic attribute data may include traffic flow data or speed data, or the traffic attribute data may also include both traffic flow data and speed data.
[0041] Here, the values of S and N can be set according to actual needs.
[0042] Here, the preset time step can be set according to actual needs, for example, it can be 5 minutes.
[0043] S102, inputting the traffic attribute data of S consecutive preset time steps in history into the trained spatiotemporal multi-factor fusion graph neural network.
[0044] S103. The trained spatiotemporal multi-factor fusion graph neural network performs data completion processing on the traffic attribute data of S consecutive preset time steps in history through a data completion layer to obtain completed data.
[0045] S104. The trained spatiotemporal multi-factor fusion graph neural network extracts the spatial dependency and short-term and long-term temporal dependency between the traffic attribute data collected by different sensors in the completed data through multiple spatiotemporal multi-factor fusion blocks, and obtains multiple different sub-data accordingly.
[0046] S105. The trained spatiotemporal multi-factor fusion graph neural network fuses multiple different sub-data through a fusion layer to obtain fused data.
[0047] S106. The trained spatiotemporal multi-factor fusion graph neural network processes the fusion data through the prediction block and predicts the traffic attribute data of S time steps; S is an integer greater than 1.
[0048] For example, when the preset time step is 5 minutes, the present invention can use historical traffic attribute data of the past hour (ie, 12 consecutive preset time steps) to predict traffic attribute data of the next hour (ie, 12 consecutive preset time steps).
[0049] In the present invention, the spatiotemporal multi-factor fusion graph neural network includes, in sequence: a data impute layer, A spatiotemporal multi-factor fusion blocks, a fusion layer and a prediction block. The input end of the data impute layer is used as the input of the spatiotemporal multi-factor fusion graph neural network, the output of the data impute layer is used as the input of the A spatiotemporal multi-factor fusion blocks, the output of the A spatiotemporal multi-factor fusion blocks is used as the input of the fusion layer, the output of the fusion layer is used as the input of the prediction block, and the output of the prediction block is used as the output of the spatiotemporal multi-factor fusion graph neural network. The data impute layer is a trained generator obtained by training the GAIN network using a random missing data set and a preset loss function, wherein the random missing data set is a data set obtained by deleting the traffic attribute data collected by any at least one sensor at least one preset time step in the original data set composed of traffic attribute data collected by Q sensors at q consecutive preset time steps; Q and q are both integers greater than 1. Among A spatiotemporal multi-factor fusion blocks, the input of the first spatiotemporal multi-factor fusion block is the complementary data, and the output of the ath spatiotemporal multi-factor fusion block is used as the input of the a+1th spatiotemporal multi-factor fusion block, where a ranges from 1 to A-1; and the output of each spatiotemporal multi-factor fusion block is used as an input of the first fusion layer; A is an integer greater than 1; each spatiotemporal multi-factor fusion block includes: a spatial fusion block, a temporal fusion block, a normalization processing block, and a 1*1 convolution layer. Exemplary, Figure 2 It is a schematic diagram of the structure of the spatiotemporal multi-factor fusion graph neural network. Figure 2As shown, the spatiotemporal multi-factor fusion graph neural network includes five spatiotemporal multi-factor fusion blocks, and the prediction block includes two fully connected layers.
[0050] In the present invention, the preset loss function used to train the GAIN network to obtain a trained generator includes: a filling loss term of a randomly missing data set, a reconstruction loss term of an original data set, a cross entropy loss term between the output of the discriminator in the GAIN network and the random missing matrix of the generator, and a cross entropy loss term between the output of the discriminator in the GAIN network and the complement of the random missing matrix of the generator; the random missing matrix is used to characterize the deletion of data in the original data set.
[0051] Exemplarily, the expression of the preset loss function is as follows:
[0052]
[0053]
[0054]
[0055]
[0056]
[0057] in, is the cross entropy loss term between the output of the discriminator in the GAIN network and the random missing matrix of the generator, and, For training the discriminator, is used to train the generator, and is the reconstruction loss term of the original dataset, is the filling loss term for the randomly missing data set, is the cross entropy loss term between the output of the discriminator in the GAIN network and the random missing matrix complement of the generator, x is the original dataset, s is a random vector, is the reconstructed data generated based on the original dataset and the output of the generator, m a is the random missing matrix, m D is the output of the discriminator, 1-m a is the complement of the random missing matrix, and α is the preset coefficient.
[0058] In the present invention, the method for training the GAIN network to obtain a trained generator as a data completion layer is as follows:
[0059] S1. Obtain the original data set, where the original data set is the traffic attribute data collected by Q sensors at d consecutive preset time steps, X = (x1, x2, ..., x Q )∈R d ; The traffic attribute data of some preset time steps of some sensors in the original data set are empty, indicating that the traffic attribute data of these preset time steps of these sensors have not been observed. For example, when the original data set is the traffic attribute data collected by Q sensors (recording points) every five minutes (i.e., 5 minutes is the preset time step) in a day, then d = 288, And x1 represents the traffic attribute data collected by the first sensor in 288 consecutive time steps. When an element in x1 is empty, it means that the first sensor is not working in the preset time step corresponding to the element.
[0060] S2. Generate the corresponding original binary mask vector according to the original data set as the original missing matrix to characterize the original missing data in the original data set. Specifically, the dimension of the binary mask vector is the same as the dimension of the original data set. When an element in the original missing matrix is 0, it represents that the corresponding element in the original data set is empty, that is, the traffic attribute data of a certain sensor at a certain preset time step is missing; conversely, when an element in the original missing matrix is 1, it represents that the corresponding element in the original data set is not empty, that is, the traffic attribute data of a certain sensor at a certain preset time step exists. For example, Figure 3 As shown, when the original data set is Figure 3 When the Naturalincomplete data is used, since the data in the blue area of the Naturalincomplete data is missing, the original missing matrix corresponding to the Naturalincomplete data is Figure 3 In the Natural mask, the value of the element corresponding to the blue area in the Naturallinc omplete data is 0, and the other values are 1.
[0061] S3: Randomly select and delete the traffic attribute data collected by at least one sensor at at least one preset time step from the original data set to obtain a random missing data set X′∈R d, and generate a binary mask vector corresponding to the random missing data set as a random missing matrix to characterize the deletion of data in the original data set; wherein, the dimension of the random missing data set is the same as that of the original data set, and the dimension of the random missing matrix is also the same as that of the original missing matrix. Specifically, when an element in the random missing matrix is 0, it represents that a corresponding element in the random missing data set is deleted, that is, the traffic attribute data of a certain sensor at a certain preset time step is deleted; conversely, when an element in the random missing matrix is 1, it represents that a corresponding element in the random missing data set is not empty, that is, the traffic attribute data of a certain sensor at a certain preset time step is not deleted. For example, Figure 3 As shown, when the random missing data set is Figure 3 When the Incomplete data is in the Incomplete data, the data in the yellow area in the Incomplete data is deleted. Therefore, the random missing matrix corresponding to the Incomplete data is Figure 3 In the Artificia mask, the value of the element corresponding to the yellow area in the Incomplete data is 0, and the other values are 1.
[0062] S4. Perform an AND operation on the original missing matrix and the random missing matrix to obtain the mask vector m corresponding to the random missing data set. For example, the mask vector corresponding to the random missing data set is Figure 3 The Mask in.
[0063] S5. Generate a noise vector z corresponding to the random missing data set according to the mask vector m corresponding to the random missing data set. The noise vector has the same dimension as the mask vector. Specifically, when an element in the mask vector is 1, the value of the corresponding element in the noise vector is 0; conversely, when an element in the mask vector is 0, the value of the corresponding element in the noise vector is a randomly generated value. For example, the noise vector corresponding to the random missing data set is as follows: Figure 3 Noise in the.
[0064] S6. Input the randomly missing data set X′, mask vector m and noise vector z into the generator in the GAIN network to generate an estimated vector x G Specifically, x G The expression of x is: G =G(X′,m,(1-m)⊙z) (6), ⊙ is the Hadamard product operation. For example, the estimated vector x G for Figure 3 Imputed data in.
[0065] S7, according to the estimated vector xG Calculate interpolation vector and the reconstruction vector Specifically, the interpolation vector and the reconstruction vector The calculation formula is as follows:
[0066]
[0067]
[0068] S8. Given a random vector s = {0, 1} d , generate a prompt vector based on the random vector s: h = {0, 0.5, 1} d (9). Specifically, the expression of the prompt vector h is: h = m⊙s + 0.5(1-s)(10). For example, the prompt vector h is Figure 3 Hint in.
[0069] S9, interpolation vector And the prompt vector h is input into the discriminator in the GAIN network to generate the predicted mask vector m D ,in, For example, the predicted mask vector m D for Figure 3 Estimated mask in.
[0070] S10. Calculate the loss values of the generator and the discriminator according to the above formulas (1) to (5) to update the network parameters of the generator and the discriminator. Train the GAIN network according to this training principle until the training is completed to obtain a trained generator. Specifically, when updating the network parameters of the generator and the discriminator, update the network parameters of the generator first each time, and then update the network parameters of the discriminator next time, and complete the training by alternating updates.
[0071] Here, the training objectives of the discriminator and the generator are as follows:
[0072]
[0073] In the present invention, Figure 4 As shown, each spatiotemporal multi-factor fusion block includes: a spatial fusion block, a temporal fusion block, a normalization processing block ( Figure 4 "Add+Relu+LayerNorm") and 1*1 convolution layer ( Figure 4The output of the spatial fusion block is used as the input of the temporal fusion block; the input of the 1*1 convolutional layer is the same as the input of the spatial fusion block; the output of the temporal fusion block and the output of the 1*1 convolutional layer are used as the input of the normalization processing block; the output of the normalization processing block is used as the output of the spatiotemporal multi-factor fusion block.
[0074] Specifically, for the spatial fusion block, such as Figure 4 As shown in Figure 1, the spatial fusion block includes: a spatiotemporal attention block (T-SAttention Block), a static graph convolution layer (Static Spatial Graph Conv), a dynamic graph convolution layer (Dynamic Spatial Graph Conv) and the first dynamic gating fusion block (i.e. Figure 4 The first green dotted line in the figure); the input of the spatiotemporal attention block is the input of the spatial fusion block; the output of the spatiotemporal attention block and the dynamic similarity matrix A corresponding to the completed data DSG , as the input of the dynamic graph convolution layer; the static adjacency matrix A corresponding to the input and completion data of the spatial fusion block SCG , as the input of the static graph convolution layer; the output of the static graph convolution layer and the output of the dynamic graph convolution layer are used as the input of the first dynamic gated fusion block; the output of the first dynamic gated fusion block is used as the output of the spatial fusion block; the first dynamic gated fusion block is used to use the first learnable parameter as δ as the weight to calculate the weighted sum of the two inputs.
[0075] Here, if Figure 4 As shown, the spatiotemporal attention block includes: a temporal attention mechanism (Temporal Attention) and a spatial attention mechanism (Spatial Attention). Exemplarily, the number of heads of the temporal attention mechanism and the spatial attention mechanism is 3. It should be noted that the temporal attention mechanism and the spatial attention mechanism are both existing attention mechanism modules, and the present invention does not provide a specific description of this.
[0076] Here, the static adjacency matrix corresponding to the completed data It is used to characterize the connection relationship between any two sensors among N sensors. When any two sensors are connected, the static adjacency matrix A SCG The value of the corresponding element in is 1. When any two sensors are not connected, the static adjacency matrix A SCG The value of the corresponding element in is 0. For example, Wherein, i′ and j′ represent the i′th sensor and the j′th sensor, respectively.
[0077] Dynamic similarity matrix A corresponding to the completed data DSGis the dynamic correlation matrix A based on Wasserstein distance for the completed data DRG The matrix obtained after binarization; A DRG The method is used to characterize at least one sensor most relevant to each sensor among the N sensors.
[0078] Specifically, the dynamic correlation matrix A based on Wasserstein distance of the completed data DRG Generate it using the following method:
[0079] Step 1: Divide the S consecutive preset time steps corresponding to the completed data into D specific time steps of data, where the data of each specific time step is composed of the data of N sensors in the specific time step; each specific time step contains multiple consecutive preset time steps among the S consecutive preset time steps; for example, when a preset time step is 5 minutes, a specific time step can be one day.
[0080] Step 2: Calculate the cosine distance between the traffic attribute data of every two sensors at every two specific time steps, and use the cosine distance as the conversion cost between the traffic attribute data of every two sensors at every two specific time steps. For example, when a specific time step is one day, the traffic attribute data of the n1th sensor on the i-th day is and the traffic attribute data of the n2th sensor on the jth day The conversion cost between them is: Where T represents the transpose of the matrix.
[0081] Step 3: The conversion cost between the traffic attribute data of every two sensors at every two specific time steps is calculated, and the dynamic correlation distance between every two sensors is calculated according to the dynamic correlation distance. The correlation degree matrix of the completed data is obtained.
[0082] For example, continuing with the above example, the dynamic correlation distance d between the n1th sensor and the n2th sensor is DRD (n1,n2) is expressed as:
[0083]
[0084] In this formula, x represents the above i, y represents the above j, and p n1 represents the distribution to which the traffic attribute data of the n1th sensor belongs, q n2 Indicates the distribution to which the traffic attribute data of the n2th sensor belongs.
[0085] For example, the degree of correlation between the n1th sensor and the n2th sensor is expressed as: ADRD [n1,n2]=1-d DRD (n1,n2)∈[0,1](16).
[0086] Step 4: For the correlation matrix A DRD For each row in the , keep the first N elements with the largest values in that row r elements, and the rest are set to 0 (which means that the most relevant N elements of each sensor are aggregated in the graph convolution). r sensors), and obtain the dynamic correlation matrix of the completed data Among them, N r =N×P sp , P sp is a hyperparameter.
[0087] Here, each specific time step corresponds to a dynamic correlation matrix A DRG . Here, after obtaining the completed data, a convolution operation is required to aggregate and update the features of the nodes (sensors). In order to make full use of the topological structure of the network and the information of the data itself, the present invention adopts parallel static and dynamic graph convolution based on ChebNet to learn the network structure and node information. During graph convolution, the present invention separately defines the Laplacian matrices used by the static graph convolution layer and the dynamic graph convolution layer. Specifically, the Laplacian matrix of the Chebyshev polynomial of the static graph convolution layer is defined as: Among them, A s =A SCG , I N is the identity matrix, is the degree matrix, with elements i and j represent the i-th specific time step and the j-th specific time step respectively. is the Laplace matrix L s =(D s -A s ). The Laplacian matrix of the Chebyshev polynomial of the dynamic graph convolutional layer is defined as: Among them A d =A dSG , I N is the identity matrix, is the degree matrix, with elements is the Laplace matrix L d =(D d -A d ) is the largest eigenvalue in .
[0088] In the present invention, the graph convolution layer uses K-order Chebyshev polynomials to aggregate the input data, that is, to perform graph convolution. For example, K is 3. The difference is that the static graph convolution layer directly processes the input data. The processing principle is: In order to fully utilize the dynamics between nodes and the nodes themselves, the dynamic graph convolution layer first allows the input data to be processed by the spatiotemporal attention block to obtain the attention matrix. After that, each term in the Chebyshev polynomial is adjusted with the help of the attention matrix and then multiplied with the input data. The processing principle of the dynamic graph convolution layer is expressed as follows: Among them, g θ Represents an approximate convolution kernel, which extracts the 0 to K-1 order surrounding neighbor information centered on each node. *G represents the graph convolution operation. is a vector of learnable polynomial coefficients, ⊙ represents the Haddam product, is the attention matrix, where x represents the input data. This definition can be extended to multi-channel input data, for example, when the input data is Each input feature of each node has C r-1 When there are feature channels, the convolution kernel parameters Finally, each node can aggregate the information of neighboring nodes of order 0 to k-1 to update its own node information.
[0089] Therefore, the static graph convolution layer adopts a predefined static adjacency matrix A based on the real sensor connectivity network. SCG , completing the aggregation of local neighbor node information. The dynamic graph convolution layer uses the dynamic similarity matrix A DSG , completing the information collection of the most relevant nodes globally. The output of the static graph convolution layer is The output of the dynamic graph convolution layer is The static and dynamic graph convolution layers consider the mutual influence between nodes from different local and global perspectives, so their influence on the final prediction should be different. As for how to influence them specifically, we should learn from historical data. To achieve this, the present invention introduces a first dynamic gated fusion block to reasonably allocate the importance weights of each, and adaptively fuses the output results of the static and dynamic graph convolution layers through the first learnable parameter δ: Among them, δ∈[0,1] reflects the contribution of the static graph convolution and the dynamic graph convolution to the result respectively. The traffic attributes predicted by the present invention have a total of R traffic attributes, r represents the rth traffic attribute, and the value of r ranges from 1 to R, and R is a value greater than or equal to 1. For example, when the traffic attributes predicted by the present invention are: flow and speed, here r represents flow or speed. is the output of the first dynamic gated fusion block, that is, the output of the spatial fusion block, which will be used as the input of the temporal fusion block. It should be noted that different r corresponds to different δ.
[0090] Specifically, Figure 4 As shown, the time fusion block includes: M-GTU block, GRU block, second dynamic gating fusion block ( Figure 4 The second green dashed line in the figure) and the additive activation block ( Figure 4 The input of the M-GTU block, the input of the GRU block, and one input of the addition activation block are all outputs of the spatial fusion block; the output of the M-GTU block and the output of the GRU block are used as two inputs of the second dynamic gated fusion block; the output of the second dynamic gated fusion block is used as another input of the addition activation block; the output of the addition activation block is used as the output of the time fusion block; the second dynamic gated fusion block is used to use the second learnable parameter λ as the weight to calculate the weighted sum of the two inputs; the addition activation block is used to add the two inputs and then use the Relu activation function for activation.
[0091] like Figure 4 As shown, the M-GTU block includes: three GTU units and a first splicing layer ( Figure 4 “⊕” in ); the inputs of the three GTU units are all the outputs of the spatial fusion block, and the outputs of the three GTU units are all used as the inputs of the first splicing layer; the output of the first splicing layer is used as the output of the M-GTU block. Each GTU unit is used to use the convolution layer Conv to convolve the input to obtain a convolution result, and then use the tanh function and the sigmoid function to process the convolution result respectively to obtain two processing results, and then the two processing results are fused; among them, the convolution kernel sizes of the convolution layers in different GTU units in the three GTU units are different. For example, the convolution kernel size of the convolution layer in the first GTU unit is 1×S1, the convolution kernel size of the convolution layer in the second GTU unit is 1×S2, and the convolution kernel size of the convolution layer in the third GTU unit is 1×S3. Continue to refer to Figure 4 , the GRU block includes: S GRU Cells (i.e. GRU units) and a second concatenation layer ( Figure 4 The “⊕” in ); the inputs of the S GRU units are all the outputs of the spatial fusion block, and the output of the sth GRU unit is also used as the input of the s+1th GRU unit, the outputs of the S GRU units are all the inputs of the second concatenation layer, and the output of the second concatenation layer is used as the output of the GRU block; the value of s ranges from 1 to S-1. For example, S can be 12, or other values can be used, which are determined according to actual needs.
[0092] Here, traffic flow is a typical spatiotemporal data. After the spatial dependency between road network nodes is extracted and processed by graph convolution, the temporal dependency of nodes needs to be further captured. Most traffic prediction models use convolution alone to extract temporal features, which will lose the dynamic long-term features of the data. With the development of deep learning methods, a large number of researchers have found that recurrent neural networks (RNNs) can learn time series features better than back propagation neural networks (BPs). As a variant of RNN, GRU has a stronger ability to extract dynamic long-term features of the time dimension, and has fewer parameters and is easier to train than LSTM, which can just make up for the shortcomings of the convolution method. Therefore, in order to grasp the multi-scale temporal features, the present invention introduces GRU on the basis of using M-GTU, and captures the temporal dependency more comprehensively with two different working modes of time series prediction methods. M-GTU uses gated convolutions with three different receptive fields to increase the model's perception of different degrees of temporal dependency in a short period. GRU uses a gating mechanism to control the flow of information in a sequence. It is suitable for deep learning to process long sequence data. It can better handle the flow of information between each stage in a long time series and provide stronger long-term time dependency modeling capabilities. By integrating multi-scale time features, we can better understand the law of data changes, thereby further enhancing the model's perception of time dependencies.
[0093] In the M-GTU block, the present invention uses the convolution kernel For input data The number of channels is doubled, where 1×S′ is the convolution kernel size of the convolution layer (i.e., 1×S′ here is any one of 1×S1, 1×S2, and 1×S3 mentioned above). After convolution, the input data becomes The GTU of traditional time convolution is defined as: in,* τ is a gated convolution operation, φ(·) and σ(·) are tanh and sigmoid functions respectively, and E and F correspond to the input data Z′ respectively. (r) In order to enhance the perception of different degrees of time dimensions in the GTU part, gated convolution modules with different receptive fields are used respectively, and then their outputs are fused and introduced into the residual structure as the output of the M-GTU part, which is defined as follows:
[0094] Among them, Γ1, Γ2, and Γ3 are convolution kernels 1×S1, 1×S2, and 1×S3 respectively. FC(·) represents the fully connected operation, which is used to adjust the different sizes of the same feature dimension caused by the Concat(·) operation to ensure that it matches the original input size of M-GTU, and the residual structure is realized through skip connections. Finally, the output of the M-GTU block is obtained through the Relu activation function Right now
[0095] In the present invention, the overall input data of the GRU block is the same as the input data of the M-GTU block. However, since GRU Cell is a single-step prediction, the data for each preset time step t is t represents the tth preset time step among S consecutive preset time steps, and the value of t ranges from 1 to S. Specifically, each GRU Cell is defined as:
[0096] z t =σ(W z ·[h t-1 ,x t ]) (241);
[0097] r t =σ(W r ·[h t-1 ,x t ]) (25);
[0098]
[0099]
[0100]
[0101] The input of the sth GRU Cell in the GRU block includes the data x of the tth preset time step in the overall input data of the GRU block. t And the output h of the s-1th GRU Cell in the GRU block t-1 , s ranges from 1 to S, and the output of the sth GRUCell is h t . Update the output z of the gate t Used to control the update degree of the current state; reset gate r t The output of is used to control the influence of the past state on the current state to filter out unnecessary information; the candidate hidden state It is formed by the superposition of the current input and the past state. The hidden state h at the current moment t The update is performed by updating the gate, the weighted average of the past states, and the weighted average of the candidate hidden states. After accumulating the prediction time step S, we get As the output of the GRU block.
[0102] Therefore, the M-GTU block mainly captures the short-range time dependency, and the output is The GRU block improves the capture of long-range temporal dependencies and outputs Similar to the static and dynamic image convolutions mentioned above, the M-GTU block and the GRU block also use a dynamic gated fusion module (i.e., the second dynamic gated fusion block) to adaptively fuse the output results of the two parts to achieve the purpose of self-learning the influence of short-term and long-term dependencies from historical data. The working principle of the second dynamic gated fusion block is expressed as: Among them, λ∈[0,1] is an adaptive learning parameter (i.e., the second learnable parameter), which still changes dynamically with the specific time step mentioned in the previous part, and reflects the influence of the short-term and long-term time series prediction part on the final prediction result. is the final output of the temporal fusion block.
[0103] In the present invention, Figure 4 As shown, the normalization processing block is used to add, activate and normalize the input in sequence.
[0104] The present invention can adopt the Huber loss function and data set, and use the Adam optimizer to train the spatiotemporal multi-factor fusion graph neural network of the present invention to obtain a trained spatiotemporal multi-factor fusion graph neural network. It should be noted that the data completion layer can be pre-trained by the above-mentioned training method before training the spatiotemporal multi-factor fusion graph neural network. Therefore, each time the spatiotemporal multi-factor fusion graph neural network is trained, only the learnable parameters in the spatiotemporal multi-factor fusion block and the prediction block need to be updated. Exemplarily, during training, the learning rate can be 0.0001, the epochs can be 100, and the setting of the Batchsize can be determined according to the adopted data set.
[0105] In order to verify the technical effect of the present invention, some simulation experiments and experimental results are provided below.
[0106] 1. Dataset
[0107] The experiments are conducted on four real road datasets (PEMS03, PEMS04, PEMS07, PEMS08). These datasets are collected in real time by the PEMS system every 30 seconds, and the raw data are aggregated into time intervals of every 5 minutes. In addition, the dataset also contains a spatial adjacency graph built based on the real road network. Table 1 shows the specific information about the dataset.
[0108] Table 1
[0109] Dataset Number of sensors Number of edges Total time steps Time Range Missing rate (%) PEMS03 358 547 26208 2018 / 9 / 1-2018 / 11 / 30 0.672 PEMS04 307 340 16992 2018 / 1 / 1-2018 / 2 / 29 3.182 PEMS07 883 866 28224 2017 / 5 / 1-2017 / 8 / 31 0.452 PEMS08 170 295 17856 2016 / 1 / 7-2016 / 8 / 31 0.696
[0110] 2. Baseline Method
[0111] We compare our STMFGNN with the following baseline works:
[0112] (1) DCRNN: Diffused Convolutional Recurrent Neural Network, which captures spatial correlation by modeling traffic flow changes as a one-dimensional convolutional diffusion process.
[0113] (2) STGCN: Spatiotemporal Graph Convolutional Network, which integrates graph convolution into 1D convolutional units and combines causal convolution to process temporal information.
[0114] (3) GraphWaveNet: GraphWaveNet: combines adaptive graph convolution and dilated causal convolution.
[0115] (4)ASTGCN: Attention-based spatiotemporal graph convolutional network, which introduces the attention mechanism before spatiotemporal convolution.
[0116] (5) STSGCN: Spatiotemporal Synchronous Graph Convolutional Network, which designs spatiotemporal subgraphs to capture the heterogeneity in local spatiotemporal graphs.
[0117] (6) AGCRN: Adaptive Graph Convolutional Recurrent Network, an adaptive graph convolutional recurrent network is proposed to unify information through node embedding to automatically capture the fine-grained spatiotemporal correlations of traffic sequences.
[0118] (7) STFGNN: A spatiotemporal fusion graph neural network, which proposes a "time graph" and uses the spatiotemporal fusion graph to make up for the correlation that the spatial graph may not be able to reflect.
[0119] (8) Z-GCNETS: Temporal Zigzag Graph Convolutional Networks, which introduce the concept of time-aware zigzag persistence into learning temporal conditional graph structures, and develop a zigzag topology layer (Z-GCNET) for time-aware graph convolutional networks (GCNs).
[0120] (9) DSTAGNN: Dynamic Spatiotemporal-Aware Graph Neural Network, which uses a dynamic spatiotemporal-aware graph to simulate the spatiotemporal interactions of road networks.
[0121] 3. Experimental Setup
[0122] In order to make a fair comparison with the previous baseline, we divide the PEMS dataset into training set, validation set and test set in the same 6:2:2 ratio as the baseline. The historical traffic flow data of the past hour (i.e. 12 consecutive time steps) is used to predict the traffic flow data of the next hour (i.e. 12 consecutive time steps). The experiments were conducted on AMD EPYC 7T83CPU and NVIDIARTX 4090 24GB GPU. We set the following hyperparameters: All experiments stacked 5 layers of spatiotemporal blocks. The number of Chebyshev polynomial terms K is 3. The number of heads of the spatiotemporal multi-head attention mechanism with dynamic graph convolution is 3. Dynamic graph spatiotemporal correlation diagram A DRG The sparsity P sp is 0.01. The convolution kernels of M-GTU along the time dimension are {S1, S2, S3} = {2, 5, 8}. When training the model, we adopted the Huber loss function (Huber, 1992) with a threshold parameter type of 1 and used the Adam optimizer with a learning rate of 0.0001. A total of 100 epochs were trained. The batch size settings vary depending on the dataset, and are 32, 32, 12, and 64 respectively.
[0123] IV. Evaluation Indicators
[0124] The experimental results use the Mean Absolute Error (MAE), the Mean Absolute Percentage Error (MAPE), and the Root Mean Square Error (RMSE) to measure model performance. Among the indicators, the lower the MAE and RMSE values, the smaller the prediction error of the model, while the lower the MAPE value, the smaller the relative error of the model. In addition, the results of some baseline methods (marked with * in Table 2) are obtained by running the corresponding open source code, while the other part is directly extracted from the published papers. The above mathematical formula is as follows:
[0125]
[0126]
[0127]
[0128] V. Experimental Results and Analysis
[0129] 1) Overall comparison
[0130] Table 2 shows the average results of the performance of STMFGNN (the spatiotemporal multi-factor fusion graph neural network of the present invention) and nine baseline methods for 60-minute prediction on the PEMS03, PEMS04, PEMS07, and PEMS08 datasets. The results show that our STMFGNN outperforms the baseline model in all indicators on the four datasets and achieves the best results. In Table 2, "*" indicates the results obtained by self-training and "___" indicates the best indicator in the baseline.
[0131] Table 2
[0132]
[0133] As shown in Table 2, GraphWaveNet performs relatively poorly, which may be because it cannot superimpose its spatiotemporal layer, resulting in a relatively small feature perception range. Methods such as DCRNN, STGCN, and ASTGCN are highly dependent on the predefined graph structure and ignore the dynamics of the spatial dependencies between nodes, so they perform poorly. STSGCN only extracts local spatial dependencies, and building subgraphs requires more data to train, so it performs generally and may perform better on large-scale graphs. On the contrary, methods such as STFGCN and DSATGNN use dynamic graph structures to model spatial dependencies, so they have significantly improved prediction performance, which shows that this method can indeed capture potential spatial dependencies that change over time. However, they abandon the predefined graph structure and only use dynamic graph structures that change in days, which leads to the neglect of the mutual transmission of traffic changes between real adjacent nodes at a single moment, so the effect is not as good as our STMFGNN. Secondly, in terms of temporal dependency modeling, the methods used by the above models are essentially still variants of one-dimensional convolutions, so the inaccurate prediction of time series data affects the overall prediction performance. Our method takes into account multiple factors and models spatial and temporal dependencies as completely as possible. It uses both predefined graph structures and dynamic graph structures to avoid the problem of missing spatial dependency modeling caused by over-reliance on a single factor; and fully considers short-term and long-term temporal dependencies in time series prediction to avoid incomplete capture of temporal dependencies. This makes our model perform better than these methods, which is more obvious on the PEME07 dataset with the largest graph size and the longest total time step.
[0134] We also selected some baseline algorithms and compared the prediction performance of our proposed MFSTGNN at different prediction steps under the same conditions. Specifically, Table 3 shows the performance comparison of STMFGNN and some baseline models on the PEMS04 and PEMS08 datasets for 15 minutes, 30 minutes and 60 minutes. In order to more intuitively show the performance of some baseline models and STMFGNN at different prediction time scales, the data in Table 3 are plotted as a line graph to obtain Figure 5A and Figure 5B Specifically, Figure 5A The prediction results of MFSTGNN and some baseline models at different time steps on PEMS04; Figure 5B The prediction results of MFSTGNN and some baseline models at different time steps on PEMS08. The results show that our STMFGNN outperforms the selected baseline models in all indicators, whether in short-term or long-term prediction. This may be because our model has corresponding complex modules that play a specialized role in the most needed situations in both short-term and long-term predictions. In Table 3, "*" indicates the results obtained by self-training and "___" indicates the best indicator in the baseline.
[0135] Table 3
[0136]
[0137]
[0138] 2) Ablation experiment
[0139] In order to verify the effectiveness of each part of the STMFGNN model, we conducted an ablation experiment on the PEMS08 dataset. We set the following variants for STMFGNN:
[0140] (1) RemDI: The data preprocessing layer is removed and the original traffic attribute data is directly used as input, that is, no missing data is filled in;
[0141] (2) RemSSC: In the graph convolution layer, the dynamic convolution module is retained, but the static graph convolution part using static graphs is removed;
[0142] (3)RemGRU: In the time series prediction layer, the M-GTU module is retained, but the GRU module is removed.
[0143] We conducted ablation experiments on PEMS08 and compared the results with the most advanced models in the baseline and ourselves. Table 4 shows the measurement results of various performance indicators. It can be clearly observed that our comprehensive model performs better than other variants and baselines, confirming the effectiveness of each module in our model.
[0144] Table 4
[0145] Model module composition MAE MAPE(%) RMSE DSATGNN 15.81 25.06 9.96 RemDI 15.76 24.90 9.88 RemSSC 15.72 24.81 9.93 RemGRU 15.73 24.82 9.90 STMFGNN 15.66 24.71 9.86
[0146] Table 4 uses the average results of 60-minute prediction performance for comparison. Figure 6 and Figure 7 We compared the prediction performance under different time settings, and selected 5 minutes, 20 minutes, 40 minutes and 60 minutes settings. These different prediction durations represent short-term predictions (5 minutes and 20 minutes) and long-term predictions (40 minutes and 60 minutes). The results of the ablation study are shown in Figure 2. Figure 6 and Figure 7 As shown by Figure 6 and Figure 7 It can be seen that each component of the model has a positive effect on improving the performance of the entire model. The conclusions are as follows:
[0147] 1) By Figure 6 As shown in , without data completion preprocessing, the model using other key designs also performs better than the baseline, which shows the effectiveness of other key designs. Figure 7 As shown in Figure 2, even the variants after data completion preprocessing outperform the baseline in all aspects, which shows the effectiveness of the data completion module. Figure 7 As shown in the figure, removing the static spatial convolution part of the graph convolution layer has a greater impact on the short-term prediction performance. However, since the time series prediction layer adopts a time series prediction method that combines long-term and short-term prediction, especially the GRU responsible for long-term time series prediction, the long-term prediction performance is better than that of the variant without GRU, which shows the effectiveness of the GRU part in capturing long-term temporal dependencies. 3) As shown in the figure, Figure 7 As shown in the figure, removing the GRU part of the time series prediction layer has a significant impact on the long-term prediction performance. However, due to the static local spatial convolution module of the graph convolution layer, the short-term prediction performance is better than the variant without static spatial convolution. This confirms the effectiveness of static spatial convolution for extracting local static spatial relationship dependencies and also verifies its effectiveness in improving short-term traffic prediction performance.
[0148] Overall, Figure 6 and Figure 7 It shows that the performance of our STMFGNN model is better than its variants and the baseline model, which confirms the effectiveness of the synergy of the various components in our model.
[0149] 3) Data completion visualization
[0150] The improvement of missing data point completion for the overall model prediction performance has been explained in detail in the ablation experiment section above. Given that the PEMS04 dataset has a higher missing rate among the four datasets, we take the nodes with missing data points in this dataset as an example to visually compare the completion effect to more comprehensively demonstrate the superiority of our method. Each node in the PEMS04 dataset contains 16,992 data points. Fig. 8A and Figure 8B The results of filling in node 10, which contains 2464 missing data points, and node 12, which contains 677 missing points, are shown. Fig. 8A and Figure 8B It can be seen that our completion method can accurately learn the distribution trend of the data and reasonably fill in the missing data points, whether for continuous missing points or discrete missing points. The filled data shows a more complete and consistent trend as a whole, which is significantly improved compared to the original data.
[0151] 4) Spatial Dependency Visualization
[0152] Fig. 9 The visualization results of the predefined static adjacency matrix of STMFGNN nodes 0 to 19 (i.e., a total of 20 nodes) on the PEMS08 dataset and the dynamic correlation matrix on the first day of recording are shown. As can be seen from the figure, in terms of days, two adjacent nodes are physically closest to each other, but they are not necessarily the most correlated nodes. On the contrary, even if two nodes are not adjacent or even far apart, they may be strongly correlated because they have similar change patterns. Fig. 9 Figure (a) shows the static adjacency matrix A of the nodes. SCG , Fig. 9 Figure (b) shows the dynamic correlation matrix A DRG , Fig. 9 Figure (c) shows the binarization of the dynamic correlation graph (i.e., the dynamic similarity matrix A) under a specific sparsity setting. DSG ).
[0153] 5) Parameter study
[0154] To further study the impact of hyperparameter settings on model performance, we conducted parameter study experiments on the PEMS08 dataset, including the number of STMF block stacking, the convolution kernel size (KS) along the time dimension in the M-GTU, and the control variables of the data batch size. KS represents the kernel size along the time dimension in the M-GTU module. Fig.10 , Fig.11 , Fig.12 The experimental results on the PEMS08 dataset are shown. Fig.10As can be seen from Figures (a) to (c) in Figure 3, stacking STMF blocks can improve the performance of our model, but the performance will decrease as the number of layers increases. Stacking 5 layers is the best. Fig.11 From Figures (a) to (c) in Figure 1, we can observe that the combination of {2,5,8} receptive fields that utilize both short-term and long-term temporal information can improve the prediction performance. Fig.12 As can be seen from Figures (a) to (c) in Figure 1, for the PEMS08 dataset, a batch size of 64 is the most conducive to training. Small batches of data will lead to large parameter update noise and easily fall into local minima. Large batches may cause the model to overfit the training data and perform poorly on the test set. This hyperparameter needs to be tested and tuned for different datasets.
[0155] 6) Visualization of prediction results
[0156] We compare the forecast results for one week on the PEMS08 dataset with the true values, and zoom in on the first, fourth, and seventh days. Fig.13 , 14 , 15 are the prediction results of the model on PEMS08 node 0 with prediction time of 15 minutes, 30 minutes and 60 minutes compared with the true value. In addition, in order to show that the model performs consistently at each node, Fig.16 The figure shows the comparison between the true value and the predicted result for 60 minutes at node 1. We observe that: (1) STMFGNN is consistent with the true value in the overall trend; (2) Some of the true values are obviously too low, which may be due to missing points. It can be seen that our model does not follow the results that are too deviated, but predicts values that are consistent with the overall distribution; (3) The peak data is further amplified, indicating that STMFGNN performs well in challenging situations. Therefore, STMFGNN can perform traffic flow prediction tasks excellently.
[0157] In summary, this paper proposes a new graph neural network STMFGNN for traffic flow prediction. This model considers the influence of multiple factors when modeling spatiotemporal dependencies, and fuses multiple factors by using a gated fusion mechanism to self-learn dynamic importance. When modeling spatial dependencies, we dynamically fuse the static adjacency graph as local prior knowledge and the dynamic similarity graph as global hidden knowledge to model complex spatial dependencies as completely as possible; in terms of temporal dependencies, we dynamically fuse the short-term temporal features of gated convolutions with different receptive fields and the information of long-term time scales captured by GRU, overcoming the trade-off problem between short-term and long-term temporal dependencies. In addition, we also use a generative adversarial filling network with improved masking mechanism and training process to complete the traffic data with incomplete observations. Experimental results on four real datasets (PEMS03, PEMS04, PEMS07, PEMS08) show that STMFGNN achieves state-of-the-art results.
[0158] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A traffic flow prediction method, It is characterized in that include: Obtaining historical traffic attribute data of S consecutive preset time steps of a preset road network; The preset road network includes N sensors for collecting traffic attribute data at each preset time step; Input the traffic attribute data of the historical S consecutive preset time steps into the trained spatiotemporal multi-factor fusion graph neural network; The trained spatiotemporal multi-factor fusion graph neural network performs data completion processing on the traffic attribute data of the historical S consecutive preset time steps through a data completion layer to obtain completed data; The trained spatiotemporal multi-factor fusion graph neural network extracts the spatial dependency relationship and the short-term and long-term temporal dependency relationship between the traffic attribute data collected by different sensors in the supplemented data through multiple spatiotemporal multi-factor fusion blocks, and obtains multiple different sub-data accordingly; The trained spatiotemporal multi-factor fusion graph neural network fuses the multiple different sub-data through a fusion layer to obtain fused data; The trained spatiotemporal multi-factor fusion graph neural network processes the fusion data through a prediction block to predict traffic attribute data of S time steps; S is an integer greater than 1.
2. The traffic flow prediction method according to claim 1, It is characterized in that The data completion layer is a trained generator obtained by training the GAIN network using a random missing data set and a preset loss function; wherein the random missing data set is a data set obtained by deleting the traffic attribute data collected by any at least one sensor at least one preset time step in the original data set consisting of traffic attribute data collected by Q sensors at d consecutive preset time steps; Q and q are both integers greater than 1; The preset loss function includes a filling loss term of the randomly missing data set, a reconstruction loss term of the original data set, a cross entropy loss term between the output of the discriminator in the GAIN network and the random missing matrix of the generator, and a cross entropy loss term between the output of the discriminator in the GAIN network and the complement of the random missing matrix of the generator; the random missing matrix is used to characterize the deletion of data in the original data set.
3. The traffic flow prediction method according to claim 2, It is characterized in that The expression of the preset loss function is as follows: in, is the cross entropy loss term between the output of the discriminator in the GAIN network and the random missing matrix of the generator, and, For training the discriminator, is used to train the generator, and is the reconstruction loss term of the original data set, is the filling loss term of the randomly missing data set, is the cross entropy loss term between the output of the discriminator in the GAIN network and the random missing matrix complement of the generator, x is the original data set, s is a random vector, is the reconstructed data generated according to the original data set and the output of the generator, m a is the random missing matrix, m D is the output of the discriminator, 1-m a is the complement of the random missing matrix, and α is a preset coefficient.
4. The traffic flow prediction method according to claim 1, It is characterized in that The spatiotemporal multi-factor fusion graph neural network includes A spatiotemporal multi-factor fusion blocks, wherein the input of the first spatiotemporal multi-factor fusion block is the supplementary data, the output of the ath spatiotemporal multi-factor fusion block is used as the input of the a+1th spatiotemporal multi-factor fusion block, and the value of a is 1 to A-1; the output of each spatiotemporal multi-factor fusion block is used as an input of the first fusion layer; A is an integer greater than 1; Each spatiotemporal multi-factor fusion block includes: a spatial fusion block, a temporal fusion block, a normalization processing block and a 1*1 convolution layer; wherein the output of the spatial fusion block serves as the input of the temporal fusion block; the input of the 1*1 convolution layer is the same as the input of the spatial fusion block; the output of the temporal fusion block and the output of the 1*1 convolution layer serve as the input of the normalization processing block; the output of the normalization processing block serves as the output of the spatiotemporal multi-factor fusion block.
5. The traffic flow prediction method according to claim 4, It is characterized in that The spatial fusion block includes: a spatiotemporal attention block, a static graph convolution layer, a dynamic graph convolution layer and a first dynamic gated fusion block; wherein the input of the spatiotemporal attention block is the input of the spatial fusion block; the output of the spatiotemporal attention block and the dynamic similarity matrix A corresponding to the completed data DSG , as the input of the dynamic graph convolution layer; the input of the spatial fusion block and the static adjacency matrix A corresponding to the completed data ScG , as the input of the static graph convolution layer; the output of the static graph convolution layer and the output of the dynamic graph convolution layer are used as the input of the first dynamic gated fusion block; the output of the first dynamic gated fusion block is used as the output of the spatial fusion block; the first dynamic gated fusion block is used to use the first learnable parameter as the weight to calculate the weighted sum of the two inputs.
6. The traffic flow prediction method according to claim 5, It is characterized in that The static adjacency matrix A corresponding to the completed data SCG It is used to characterize the connection relationship between any two sensors among the N sensors, wherein when any two sensors are connected, the static adjacency matrix A SCG The value of the corresponding element in is 1. When any two sensors are not connected, the static adjacency matrix A SCG The value of the corresponding element in is 0; The dynamic similarity matrix A corresponding to the completed data DSG is the dynamic correlation matrix A based on Wasserstein distance of the completed data DRG The matrix obtained after binarization processing; the A DRG The method is used to characterize at least one sensor most relevant to each sensor among the N sensors.
7. The traffic flow prediction method according to claim 4, It is characterized in that The time fusion block includes: an M-GTU block, a GRU block, a second dynamic gate fusion block and an addition activation block; Among them, the input of the M-GTU block, the input of the GRU block and one input of the addition activation block are all outputs of the spatial fusion block; the output of the M-GTU block and the output of the GRU block are used as two inputs of the second dynamic gated fusion block; the output of the second dynamic gated fusion block is used as another input of the addition activation block; the output of the addition activation block is used as the output of the time fusion block; The second dynamic gate fusion block is used to calculate the weighted sum of two inputs using a second learnable parameter as a weight; The addition activation block is used to add two inputs and then use the Relu activation function to perform activation processing.
8. The traffic flow prediction method according to claim 7, It is characterized in that The M-GTU block includes: three GTU units and a first splicing layer; the inputs of the three GTU units are all the outputs of the spatial fusion block, and the outputs of the three GTU units are all used as the inputs of the first splicing layer; the output of the first splicing layer is used as the output of the M-GTU block; each GTU unit is used to use a convolution layer to perform convolution processing on the input to obtain a convolution result, and the convolution result is processed by a tanh function and a sigmoid function respectively to obtain two processing results, and then the two processing results are fused; wherein the convolution kernel sizes of the convolution layers in different GTU units in the three GTU units are different; The GRU block includes: S GRU units and a second concatenation layer; the inputs of the S GRU units are all the outputs of the spatial fusion block, and the output of the sth GRU unit is also used as the input of the s+1th GRU unit, the outputs of the S GRU units are all the inputs of the second concatenation layer, and the output of the second concatenation layer is used as the output of the GRU block; the value of s is 1 to S-1.
9. The traffic flow prediction method according to claim 4, It is characterized in that The normalization processing block is used to perform addition, activation and normalization processing on the input in sequence.
10. The traffic flow prediction method according to claim 1, It is characterized in that The prediction block includes two fully connected layers.
Citation Information
Cited By
Traffic flow prediction method and device based on space-time diagram convolutional network
CN120748194A
