Bidirectional traffic flow dynamic modeling method based on deep spatio-temporal graph neural network

By constructing a traffic flow dynamic graph based on a deep spatiotemporal graph neural network, local spatiotemporal dependencies are captured and temporal and spatial features are extracted. This solves the problem of insufficient bidirectional traffic modeling in existing technologies, improves the accuracy and applicability of traffic flow prediction, and can be applied to path planning and congestion management in smart cities.

CN119694117BActive Publication Date: 2026-03-17HANGZHOU DIANZI UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing technologies lack sufficient modeling of two-way traffic flow and capture of dynamic dependencies in traffic flow prediction, and are not adaptable enough to complex traffic scenarios, resulting in poor prediction accuracy and model applicability.

Method used

A method based on deep spatiotemporal graph neural network is adopted to construct a dynamic traffic flow graph, capture local spatiotemporal dependencies, extract temporal features using temporal convolutional layers, filter effective information using selection gates, extract spatial features using composite graph convolutional modules, and fuse bidirectional traffic through prediction layers. Finally, the model is optimized through loss calculation.

Benefits of technology

It improves the accuracy and applicability of traffic flow forecasting, providing efficient and accurate traffic flow forecasting solutions for smart city route planning, congestion management, and risk assessment, thereby enhancing the operational efficiency of the transportation system and the scientific nature of management decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119694117B_ABST
    Figure CN119694117B_ABST
Patent Text Reader

Abstract

This invention discloses a method for dynamic modeling of bidirectional traffic flow based on a deep spatiotemporal graph neural network, belonging to the field of intelligent transportation and data mining. The method includes the following steps: S1, constructing a dynamic traffic flow graph to capture the local spatiotemporal dependencies of the traffic flow; S2, after obtaining the local spatiotemporal dependencies, using a temporal convolutional layer to extract temporal features; S3, after obtaining the temporal features, using a selection gate to filter the effective information obtained in S2 to obtain the final output; S4, after obtaining the result in S3, using a composite graph convolutional module to extract spatial features; S5, fusing the bidirectional traffic flow and obtaining the final prediction result through a prediction layer; S6, calculating the model loss to determine whether the model meets the requirements. This invention addresses the problems of insufficient bidirectional traffic flow modeling, inadequate capture of dynamic dependencies, and poor adaptability to complex traffic scenarios faced by existing technologies in traffic flow prediction, thereby improving the accuracy and applicability of traffic flow prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of intelligent transportation and data mining technology, and in particular to a method for dynamic modeling of bidirectional traffic flow based on deep spatiotemporal graph neural networks. Background Technology

[0002] Intelligent Transportation Systems (ITS) are frequently used to analyze, manage, and improve traffic conditions. With the acceleration of urbanization in recent years, the role of ITS in modern urban traffic management has been increasing annually. Traffic forecasting, as a core technology of ITS, has been extensively studied in recent years and is used to predict future traffic conditions using real-time traffic data from roadside sensors. Although predicting real-time dynamic changes in traffic and the occurrence of abnormal road conditions remains a challenging task, research indicates that current traffic flow forecasting can already be used in various traffic-related applications, such as route selection, congestion reduction, and traffic scheduling.

[0003] The challenges of traffic forecasting mainly fall into two categories: capturing the spatiotemporal correlation of data and distinguishing between data correlation and heterogeneity. These complex features make feature extraction still very difficult. In the past decade, applying convolutional neural networks (CNNs) and recurrent neural networks (RNNs) to traffic forecasting has provided new ideas for solving this problem. However, this method still has its limitations; it cannot learn from non-Euclidean data in urban systems. Later, graph neural networks (GNNs) were widely used in traffic forecasting due to their excellent performance and their better suitability for modeling the underlying graph structure of traffic data.

[0004] With the widespread development of traffic data and the increasing maturity of artificial intelligence, Spatiotemporal Graph Neural Networks (STGNNs) have been proposed to extract features from traffic data and capture temporal and spatial dependencies. Structurally, STGNNs combine spreading graph convolutions with temporal models. Effectively, STGNNs model the traffic system as a spreading process, using spreading graph convolutions to extract spatial dependencies and temporal models to extract temporal dependencies. Spreading graph convolutions are a variant of Graph Convolutional Networks (GCNs) and are more suitable for processing traffic data. Sequence models such as GRU, LSTM, and TCN are also frequently used as the temporal module of graph neural networks to model temporal dependencies.

[0005] While these methods have achieved remarkable results, they all focus on predicting overall traffic flow or one-way traffic flow, neglecting to model two-way traffic flow and failing to capture the correlation between two-way traffic data. Modeling the spatiotemporal correlation of traffic flow using only partial data may negatively impact the model. Furthermore, most work on modeling dynamic spatial dependencies is limited to exploring dynamic spatial dependencies using one-way data.

[0006] Based on this, the present invention provides a method for dynamic modeling of bidirectional traffic flow based on a deep spatiotemporal graph neural network. Summary of the Invention

[0007] The purpose of this invention is to provide a bidirectional traffic flow dynamic modeling method based on deep spatiotemporal graph neural networks, which provides efficient and accurate traffic prediction solutions for smart city scenarios such as path planning, congestion management, and risk assessment, thereby improving the operational efficiency of the traffic system and the scientific nature of management decisions.

[0008] To achieve the above objectives, this invention provides a method for dynamic modeling of bidirectional traffic flow based on a deep spatiotemporal graph neural network, comprising the following steps:

[0009] S1. Construct a dynamic traffic flow diagram to capture the local spatiotemporal dependence of traffic flow;

[0010] S2. After obtaining the local spatiotemporal dependence, use a temporal convolutional layer to extract temporal features;

[0011] S3. After obtaining the time features, use a selection gate to filter the valid information obtained in S2 to obtain the final output.

[0012] S4. After obtaining the results from S3, use the composite graph convolution module to extract spatial features;

[0013] S5. Merge the bidirectional traffic and obtain the final prediction result through the prediction layer;

[0014] S6. Calculate the loss of the model and determine whether the model meets the requirements.

[0015] Preferably, the process of constructing a traffic flow dynamic graph in S1 to capture the local spatiotemporal dependence of traffic flow is as follows:

[0016] S11. Use the dynamic graph construction module to build IO graphs and OI graphs for different flow directions;

[0017] S12. After obtaining the IO and OI graphs for different flow directions, integrate the static and dynamic information from the traffic spatiotemporal data to construct a dynamic embedding matrix that changes over time for each node. The process is as follows:

[0018] ;

[0019] ;

[0020] in, The dynamic embedding feature matrix representing the inflow flow. The dynamic embedding feature matrix representing outflow traffic. , , and Depend on and Obtained through broadcasting mechanism. , These represent two time embedding matrices, and This indicates two time characteristics: time in day and day in week. Represents a static spatial embedding matrix. This indicates the dynamic characteristics of the inflow flow. This represents the dynamic characteristics of outflow. This represents a non-linear fully connected layer;

[0021] S13. After obtaining the two dynamic embedding matrices from S12, the graph attention mechanism is used to calculate the correlation between different nodes. The process is as follows:

[0022] ;

[0023] ;

[0024] ;

[0025] ;

[0026] in, and This represents the attention matrix for OI and IO at time t. , This is the parameter matrix of the attention mechanism in OI. , It is the parameter matrix of the attention mechanism for I / O. , , , These are dynamic graphs showing the usage of OI and IO within the time range [t-T+1:t]. Represent a constant. ( ) represents the normalization function. Represents a static matrix;

[0027] S14. After obtaining the correlation, aggregate traffic data over a longer period and expand the number of nodes. We also define a joint spatiotemporal distribution graph, and obtain the local spatiotemporal dependencies through the joint spatiotemporal distribution graph. The joint spatiotemporal distribution graph is as follows:

[0028] ;

[0029] ;

[0030] in, and The elements in the spatiotemporal joint distribution graph have the following dependencies: ( ), indicating that point j in time The impact on node i at the current time t.

[0031] Preferably, the process of extracting time features in S2 is as follows:

[0032] S21. Parallel computation is used for temporal convolutional layers, and the convolutional layers are expanded by a dilation factor to increase the model's receptive field of view. The l-th layer is the input temporal convolutional layer. Represented as:

[0033] ;

[0034] in ( ) represents the activation function. It is the sigmoid function. It is a dilation convolution operation. It is element-wise multiplication. and These are the self-learnable parameters of the convolutional layer. This represents the output of the l-th layer;

[0035] S22. Input zero-padding into the temporal convolutional layer to preserve the temporal causal order.

[0036] Preferably, the process of filtering valid information in S3 is as follows:

[0037] The selection gate is used to filter out coupled, unidirectional traffic, and the remaining traffic is uncoupled, unidirectional traffic. The process is as follows:

[0038] ;

[0039] ;

[0040] in, , , and Let D represent two time embedding matrices, where D represents the number of time slots in a day and W=7 represents the number of days in a week. and This indicates that two nodes are embedded. This indicates that the coupled flow routes have been filtered out. This represents uncoupled, out-of-direction traffic. This represents the selection matrix for each time step t. , indicating that the hidden feature is the final output of the selection gate.

[0041] Preferably, the process of extracting spatial features using the composite graph convolution module in S4 is as follows:

[0042] S41. In the dynamic graph convolution process of the composite graph convolution module, construct the feature matrix of local time combination, and process each segment of local features within [t-T+1:t]. and The definition is performed as follows:

[0043] ;

[0044] ;

[0045] in, and These represent the hidden features of traffic inflow and outflow, respectively. The eigenvalues ​​at time t+k , , and These represent the local time feature matrices of inflow and outflow, respectively. It is a learnable parameter matrix It is the ReLU activation function;

[0046] S42. Aggregate the local information of higher-order neighboring nodes to obtain local features. Use hidden states and dynamic graphs to summarize the hidden states of neighboring nodes, then update the hidden states of the nodes. At the same time, multiply the dynamic graph by itself to obtain a higher-order dynamic graph. The process is as follows:

[0047] ;

[0048] ;

[0049] in, and These represent the local outputs of the inflow and outflow of the dynamic graph convolution part of the composite graph convolution module, respectively. Indicates the first node between the outflow node and the inflow node. 1-order parameter matrix, Indicates the first node between the inflow node and the outflow node. Order parameter matrix Indicates the maximum diffusion step size. This represents the spatial relationship of traffic flow between outflow nodes and inflow nodes within the time period t-T+1:t. This represents the spatial relationship of traffic flow between the inflow node and the outflow node within the time period t-T+1:t.

[0050] S43. Concatenate the local features obtained in S42 to obtain the final hidden state. The process is as follows:

[0051] ;

[0052] ;

[0053] in, , These represent the final outputs of the inflow and outflow of the opposite flow in the dynamic graph convolution part of the composite graph convolution module, respectively.

[0054] S44. In the co-directional flow graph convolution process of the composite graph convolution module, the same method as dynamic graph convolution is used to obtain the co-directional flow hidden features in the inflow and outflow flows. and ;

[0055] S45. Merge the out-of-direction flow output of the dynamic graph convolution module with the in-direction flow to obtain the first... Layer-differentiable aggregation functions that maintain high characterization power and The process is as follows:

[0056] ;

[0057] ;

[0058] Wherein, Fusion represents the fusion function. and They represent the first The final output of the inflow and outflow of the opposite flow in the dynamic graph convolution part of the composite graph convolution module in the layer. and They represent the first Hidden characteristics of unidirectional flow in the inflow and outflow of the layer.

[0059] Preferably, the process of obtaining the final result through the prediction layer in S5 is as follows:

[0060] S51, Obtain the output of the first layer of the hybrid graph convolutional module. Save it and use it as input to the next layer to obtain... The process is as follows:

[0061] ;

[0062] ;

[0063] in, and The outputs of the first layer represent the inflow and outflow flows, respectively. and The parameter matrices represent the inflow and outflow flows, respectively. and These represent the original input data for the inflow and outflow of the first layer, respectively. and These represent the offsets of inflow and outflow, respectively;

[0064] S52. After obtaining the results of the first layer, starting from the second layer, residual connections are added after the convolutional module of the blended graph in each layer. The final result is saved and used as the input of the next layer. The process is as follows:

[0065] ;

[0066] ;

[0067] in, and The first two terms represent the inflow and outflow flows, respectively. The output of the layer, and The first two terms represent the inflow and outflow flows, respectively. The output of the layer, and These represent the residuals of the inflow and outflow at the l-th layer, respectively.

[0068] S53. After the temporal convolutional module of each layer, a skip connection is added to the output layer to pass the output of each layer to the fully connected layer to obtain the final prediction result. The process is as follows:

[0069] ;

[0070] ;

[0071] in, This is the final inflow forecast result; This is the final outflow prediction result. The reshape() function is a dimensionality change method that connects the results from different layers.

[0072] Preferably, in S6, MAE is used as the objective function, and the model is trained end-to-end, resulting in the following model:

[0073] ;

[0074] in This represents the model's loss.

[0075] Preferably, the convolution of the same-direction flow graph in S44 is achieved through matrix multiplication of the adaptive graph, the hidden state of the same-direction flow, and the learnable parameters.

[0076] Therefore, this invention adopts a bidirectional traffic flow dynamic modeling method based on a deep spatiotemporal graph neural network with the above-mentioned structure, which solves the problems of insufficient bidirectional flow modeling, inadequate dynamic dependency capture, and poor adaptability to complex traffic scenarios faced by existing technologies in traffic flow prediction. This improves the accuracy of traffic flow prediction and the applicability of the model, while providing efficient and accurate flow prediction solutions for smart city scenarios such as route planning, congestion management, and risk assessment, thereby improving the operational efficiency of the traffic system and the scientific nature of management decisions.

[0077] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0078] Figure 1 This is an overall model diagram of the bidirectional traffic flow dynamic modeling method based on deep spatiotemporal graph neural network of the present invention;

[0079] Figure 2 This is a model diagram of the composite graph convolution module of the bidirectional traffic flow dynamic modeling method based on deep spatiotemporal graph neural network of the present invention;

[0080] Figure 3 This diagram illustrates the process of capturing spatiotemporal dependencies in the bidirectional traffic flow dynamic modeling method based on deep spatiotemporal graph neural networks of this invention. Detailed Implementation

[0081] Example

[0082] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0083] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0084] like Figures 1-3 As shown, the present invention provides a bidirectional traffic flow dynamic modeling method based on a deep spatiotemporal graph neural network, comprising the following steps:

[0085] S1. Construct a dynamic traffic flow diagram to capture the local spatiotemporal dependence of traffic flow;

[0086] S11. Use the dynamic graph construction module to build IO graphs and OI graphs for different flow directions;

[0087] S12. After obtaining the IO and OI graphs for different flow directions, integrate the static and dynamic information from the traffic spatiotemporal data to construct a dynamic embedding matrix that changes over time for each node. The process is as follows:

[0088] ;

[0089] ;

[0090] in, The dynamic embedding feature matrix representing the inflow flow. The dynamic embedding feature matrix representing outflow traffic. , , and Depend on and Obtained through broadcasting mechanism. , These represent two time embedding matrices, and This indicates two time characteristics: time in day and day in week. Represents a static spatial embedding matrix. This indicates the dynamic characteristics of the inflow flow. This represents the dynamic characteristics of outflow. This represents a non-linear fully connected layer;

[0091] S13. After obtaining the two dynamic embedding matrices from S12, the graph attention mechanism is used to calculate the correlation between different nodes. The process is as follows:

[0092] ;

[0093] ;

[0094] ;

[0095] ;

[0096] in, and This represents the attention matrix for OI and IO at time t. , This is the parameter matrix of the attention mechanism in OI. , It is the parameter matrix of the attention mechanism for I / O. , , , These are dynamic graphs showing the usage of OI and IO within the time range [t-T+1:t]. Represent a constant. ( ) represents the normalization function. Represents a static matrix;

[0097] S14. After obtaining the correlation, aggregate traffic data over a longer period and expand the number of nodes. We also define a joint spatiotemporal distribution graph, and obtain the local spatiotemporal dependencies through the joint spatiotemporal distribution graph. The joint spatiotemporal distribution graph is as follows:

[0098] ;

[0099] ;

[0100] in, and The elements in the spatiotemporal joint distribution graph have the following dependencies: ( ), indicating that point j in time The impact on node i at the current time t.

[0101] S2. After obtaining the local spatiotemporal dependence, use a temporal convolutional layer to extract temporal features;

[0102] S21. Parallel computation is used for temporal convolutional layers, and the convolutional layers are expanded by a dilation factor to increase the model's receptive field of view. The l-th layer is the input temporal convolutional layer. Represented as:

[0103] ;

[0104] in ( ) represents the activation function. It is the sigmoid function. It is a dilation convolution operation. It is element-wise multiplication. and These are the self-learnable parameters of the convolutional layer. This represents the output of the l-th layer;

[0105] S22. Input zero-padding into the temporal convolutional layer to preserve the temporal causal order.

[0106] S3. After obtaining the time features, a selection gate is used to filter the valid information obtained in S2 to obtain the final output. The process is as follows:

[0107] The selection gate is used to filter out coupled, unidirectional traffic, and the remaining traffic is uncoupled, unidirectional traffic. The process is as follows:

[0108] ;

[0109] ;

[0110] in, , , and Let D represent two time embedding matrices, where D represents the number of time slots in a day and W=7 represents the number of days in a week. and This indicates that two nodes are embedded. This indicates that the coupled flow routes have been filtered out. This represents uncoupled, out-of-direction traffic. This represents the selection matrix for each time step t. , indicating that the hidden feature is the final output of the selection gate.

[0111] S4. After obtaining the results from S3, use the composite graph convolution module to extract spatial features;

[0112] S41. In the dynamic graph convolution process of the composite graph convolution module, construct the feature matrix of local time combination, and process each segment of local features within [t-T+1:t]. and The definition is performed as follows:

[0113] ;

[0114] ;

[0115] in, and These represent the hidden features of traffic inflow and outflow, respectively. The eigenvalues ​​at time t+k , ; and These represent the local time feature matrices of inflow and outflow, respectively. It is a learnable parameter matrix It is the ReLU activation function;

[0116] S42. Aggregate the local information of higher-order neighboring nodes to obtain local features. Use hidden states and dynamic graphs to summarize the hidden states of neighboring nodes, then update the hidden states of the nodes. At the same time, multiply the dynamic graph by itself to obtain a higher-order dynamic graph. The process is as follows:

[0117] ;

[0118] ;

[0119] in, and These represent the local outputs of the inflow and outflow of the dynamic graph convolution part of the composite graph convolution module, respectively. Indicates the first node between the outflow node and the inflow node. 1-order parameter matrix, Indicates the first node between the inflow node and the outflow node. Order parameter matrix Indicates the maximum diffusion step size. This represents the spatial relationship of traffic flow between outflow nodes and inflow nodes within the time period t-T+1:t. This represents the spatial relationship of traffic flow between the inflow node and the outflow node within the time period t-T+1:t.

[0120] S43. Concatenate the local features obtained in S42 to obtain the final hidden state. The process is as follows:

[0121] ;

[0122] ;

[0123] in, , These represent the final outputs of the inflow and outflow of the opposite flow in the dynamic graph convolution part of the composite graph convolution module, respectively.

[0124] S44. In the co-directional flow graph convolution process of the composite graph convolution module, matrix multiplication of the adaptive graph, co-directional flow hidden state, and learnable parameters is used to obtain the co-directional flow hidden features in the inflow and outflow flows using the same method as dynamic graph convolution. and ;

[0125] S45. Merge the out-of-direction flow output of the dynamic graph convolution module with the in-direction flow to obtain the first... Layer-differentiable aggregation functions that maintain high characterization power and The process is as follows:

[0126] ;

[0127] ;

[0128] Wherein, Fusion represents the fusion function. and They represent the first The final output of the inflow and outflow of the opposite flow in the dynamic graph convolution part of the composite graph convolution module in the layer. and They represent the first Hidden characteristics of unidirectional flow in the inflow and outflow of the layer.

[0129] S5. Merge the bidirectional traffic and obtain the final prediction result through the prediction layer;

[0130] S51, Obtain the output of the first layer of the hybrid graph convolutional module. Save it and use it as input to the next layer to obtain... The process is as follows:

[0131] ;

[0132] ;

[0133] in, and The outputs of the first layer represent the inflow and outflow flows, respectively. and The parameter matrices represent the inflow and outflow flows, respectively. and These represent the original input data for the inflow and outflow of the first layer, respectively. and These represent the offsets of inflow and outflow, respectively;

[0134] S52. After obtaining the results of the first layer, starting from the second layer, residual connections are added after the convolutional module of the blended graph in each layer. The final result is saved and used as the input of the next layer. The process is as follows:

[0135] ;

[0136] ;

[0137] in, and The first two terms represent the inflow and outflow flows, respectively. The output of the layer, and The first two terms represent the inflow and outflow flows, respectively. The output of the layer, and These represent the residuals of the inflow and outflow at the l-th layer, respectively.

[0138] S53. After the temporal convolutional module of each layer, a skip connection is added to the output layer to pass the output of each layer to the fully connected layer to obtain the final prediction result. The process is as follows:

[0139] ;

[0140] ;

[0141] in, This is the final inflow forecast result; This is the final outflow prediction result. The reshape() function is a dimensionality change method that connects the results from different layers.

[0142] S6. Calculate the loss of the model and determine whether the model meets the requirements. The process is as follows:

[0143] Using MAE as the objective function, the model is trained end-to-end, and the final model is as follows:

[0144] ;

[0145] in This represents the model's loss.

[0146] The experiment began with data selection, using four large real-world datasets. These datasets contained traffic inflow and outflow data collected by sensors. Each dataset contained hundreds of sensor nodes and thousands of time steps. The four datasets were divided into two types: traffic flow datasets based on taxi trajectories and traffic flow datasets based on bicycle payment records. BIKEDC was the traffic flow dataset based on bicycle payment records, while the others were traffic flow datasets based on taxi trajectories. See Table 1 for details.

[0147] Table 1

[0148]

[0149] The model was then trained and parameters were set, with the dataset divided into training, validation, and test sets in a 7:1:2 ratio. Furthermore, data from the past six time steps were used to predict traffic inflow and outflow for the next time step.

[0150] The Adam optimizer was used for training, with a learning rate of 0.0001, a batch size of 32, a step size of 1, and an inflation factor of 2. An early stopping strategy with a patience level of 50 was employed during training. The accuracy on the validation set was calculated after each epoch. Training was stopped if the validation set accuracy did not improve after several consecutive epochs. Changes in training and validation losses were recorded during training. For example, in the early stages of training, the training loss decreased rapidly, indicating that the model was quickly learning the data features, but there was a potential risk of overfitting. As the number of training epochs increased, the loss gradually stabilized, and the model gradually converged.

[0151] The model was then evaluated and the results analyzed using three metrics: Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and Root Mean Square Error (RMSE). When calculating these metrics, samples with a flow rate of 0 were filtered out as missing values ​​and excluded from the calculation. All experiments were repeated ten times, and the average result was obtained. The formula is as follows:

[0152] ;

[0153] ;

[0154] ;

[0155] By comparing the results with those collected by other models, it was found that the model of this invention achieved state-of-the-art performance across all datasets, demonstrating the effectiveness of our model.

[0156] Finally, the model was processed in three different ways: without out-of-direction traffic fusion and with dynamic graph convolution of out-of-direction traffic, without selection gates, and without dynamic graph constructors. This verified the overall role of each component and strategy in the proposed model and highlighted the complex interdependencies in traffic prediction models. These interdependencies must be carefully captured to optimize performance.

[0157] Therefore, this invention employs a bidirectional traffic flow dynamic modeling method based on a deep spatiotemporal graph neural network, as described above. It uses inflow and outflow data combined with temporal and node embeddings to generate two unique spatiotemporal joint dynamic graphs (IO and OI) for each sequence, constructing more detailed spatial relationships and thus improving the model's predictive performance. Simultaneously, it models bidirectional traffic data to capture the dependencies between traffic flows in different directions, improving prediction accuracy and enhancing the ability to predict multidirectional traffic flows. Furthermore, by utilizing the dynamic relationships of bidirectional traffic flows and propagating node states through a dynamic graph generator and ensemble graph convolutional units, it learns dynamic spatial correlations, improving adaptability to dynamic relationships in traffic flow patterns. Finally, by generating dynamic graphs based on traffic flow transformations, it refines the relationships between opposite traffic flows, enhances feature extraction of opposite traffic flows, and clarifies traffic flow transformation patterns.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method for dynamic modeling of bidirectional traffic flow based on deep spatio-temporal graph neural network, characterized in that, The method comprises the following steps: S1, constructing a traffic flow dynamic graph to capture the local space-time dependence of traffic flow; S11, using a dynamic graph construction module to build I-O and O-I graphs of different flow directions; S12, after obtaining the I-O and O-I graphs of different flow directions, integrating the static and dynamic information in the traffic space-time data to build a dynamic embedding matrix that changes over time for each node, the process being as follows: ; ; wherein, denotes a dynamic embedding feature matrix for the inflow traffic, denotes a dynamic embedding feature matrix for the outflow traffic, , , and are given by and are obtained by broadcasting mechanism, , denote two time embedding matrices respectively, and denote two time features of time in day and day in week, denotes a static spatial embedding matrix, denotes a dynamic feature for the inflow traffic, denotes a dynamic feature for the outflow traffic, denotes a nonlinear fully connected layer; S13, after obtaining the two dynamic embedding matrices in S12, using a graph attention mechanism to calculate the correlation between different nodes, the process being as follows: ; ; ; ; wherein, and denote the attention matrix at time t for O-I and I-O, respectively, , is a parameter matrix of the attention mechanism for O-I, , is a parameter matrix of the attention mechanism for I-O, , , , are dynamic graphs used by O-I and I-O, respectively, in the time range [t-T+1:t], denotes a constant, () denotes a normalization function, denotes a static matrix; S14、After obtaining the correlation, aggregate the traffic data for a longer time, expand the number of nodes to while defining a joint spatio-temporal distribution graph, obtain the local spatio-temporal dependency through the joint spatio-temporal distribution graph, and the joint spatio-temporal distribution graph is as follows: ; ; wherein, and denotes an element in the spatio-temporal joint distribution graph, the dependency is ( ), denotes the influence of point j on node i at time t; S2, after obtaining the local space-time dependence, using a time convolution layer to extract time features; S3, after obtaining the time features, using a selection gate to filter the effective information obtained in S2 to obtain the final output; S4, after obtaining the result in S3, using a composite graph convolution module to extract spatial features; S5, fusing the bidirectional flow and obtaining the final prediction result through a prediction layer; S6, calculating the loss of the model to determine whether the model meets the requirements.

2. The deep spatio-temporal graph neural network based bi-directional traffic flow dynamic modeling method according to claim 1, characterized in that, The process of extracting time features in S2 is as follows: S21, a time convolution layer using parallel computing, expanding the convolution layer by an expansion factor, increasing the receptive field of the model, wherein the input of the lth layer of the time convolution layer is represented as: ; wherein () represents an activation function, is a sigmoid function, is a dilated convolution operation, is an element-wise multiplication, and are self-learnable parameters of the convolutional layer, represents the output of the l-th layer; S22, inputting zero padding to the time convolution layer to preserve the time causal order.

3. The deep spatio-temporal graph neural network based bi-directional traffic flow dynamic modeling method according to claim 2, characterized in that, The process of filtering effective information in S3 is as follows: Using a selection gate to filter the coupled same-direction flow, and the remaining flow is the uncoupled opposite-direction flow, the process being as follows: ; ; where, , , and denote two time-embedding matrices, D denotes the number of time slots in a day, W = 7 denotes the number of days in a week, and denote two node-embeddings, denotes the filtered out-coupling traffic, denotes the uncoupled contraflow traffic, denotes the selection matrix for each time step t, denotes the final output of the selection gate.

4. The deep spatio-temporal graph neural network based bi-directional traffic flow dynamic modeling method according to claim 3, characterized in that, The process of extracting spatial features using a composite graph convolution module in S4 is as follows: S41、In the dynamic graph convolution process of the composite graph convolution module, a local time combined feature matrix is constructed, and each local feature in [t-T+1:t] is processed and are defined as follows: ; ; where, and denote the hidden features of the traffic flow in and out, respectively the feature value at time t+k, , ; and denote the local temporal feature matrices of the in-flow and out-flow, respectively, is a learnable parameter matrix is a ReLU activation function; S42, aggregating the local information of high-order adjacent nodes to obtain local features, using hidden states and dynamic graphs to summarize the hidden states of adjacent nodes, then updating the hidden states of the nodes, and simultaneously performing self-multiplication on the dynamic graph to obtain a higher-order dynamic graph, the process being as follows: ; ; in, and These represent the local outputs of the inflow and outflow of the dynamic graph convolution part of the composite graph convolution module, respectively. Indicates the first node between the outflow node and the inflow node. 1-order parameter matrix, Indicates the first node between the inflow node and the outflow node. 1-order parameter matrix, Indicates the maximum diffusion step size. This represents the spatial relationship of traffic flow between outflow nodes and inflow nodes within the time period t-T+1:t. This represents the spatial relationship of traffic flow between the inflow node and the outflow node within the time period t-T+1:t. S43, concatenating the local features obtained in S42 to obtain the final hidden state, the process being as follows: ; ; wherein, , respectively represent the final outputs of the hetero-flow in the inflow and outflow of the dynamic graph convolution part of the composite graph convolution module. S44, in the same direction flow graph convolution process of the composite graph convolution module, the same method as the dynamic graph convolution is used to obtain the same direction flow hidden features in the inflow and outflow and ; S45, fusing the final output of the dynamic graph convolution module with the same direction flow to obtain the first Layer-wise differentiable and high-representative capability preserving aggregation function and The process is as follows: ; ; wherein Fusion denotes a fusion function, and denote the final outputs of the hetero-flow in the inflow and outflow of the dynamic graph convolution part of the composite graph convolution module in the i-th layer, and denote the final outputs of the homo-flow in the inflow and outflow of the dynamic graph convolution part of the composite graph convolution module in the i-th layer, and denote the homo-flow hidden features in the inflow and outflow of the i-th layer.

5. The deep spatio-temporal graph neural network based bi-directional traffic flow dynamic modeling method according to claim 4, characterized in that, The process of obtaining the final result through a prediction layer in S5 is as follows: S51, obtaining the output of the first layer of the mixed graph convolution module , which is saved and taken as input to the next layer to obtain The process is as follows: ; ; wherein, and represent the output of the first layer for the inflow and outflow traffic, respectively, and represent the parameter matrix for the inflow and outflow traffic, respectively, and represent the raw input data for the inflow and outflow traffic of the first layer, respectively, and represent the offset for the inflow and outflow traffic, respectively; S52, after obtaining the first layer result, the second layer starts, a residual connection is added after each mixed graph convolution module of each layer, the final result is saved, and the final result is taken as the input of the next layer, the process being as follows: ; ; wherein, and respectively represent the input and output of the flow rate of the first layer, and respectively represent the input and output of the flow rate of the first layer, and respectively represent the input and output of the flow rate of the first l layer; S53, after each time convolution module of each layer, a skip connection is added to the output layer, and the output of each layer is transmitted to a fully connected layer to obtain the final prediction result, the process being as follows: ; ; wherein, is the final inflow flow prediction result; is the final outflow flow prediction result, and the reshape(·) function is a dimension changing method for connecting the results of different layers.

6. The deep spatio-temporal graph neural network based bi-directional traffic flow dynamic modeling method according to claim 5, characterized in that, In S6, MAE is taken as the target function to train the model end-to-end, and the final obtained model is as follows: ; wherein represents the loss of the model.

7. The deep spatio-temporal graph neural network-based bi-directional traffic flow dynamic modeling method according to claim 6, characterized in that: In S44, the same-direction flow graph convolution is realized through matrix multiplication of the adaptive graph, the same-direction flow hidden state and the learnable parameter.

Citation Information

Patent Citations

  • Traffic flow prediction method and system based on trend space-time diagram convolution, and medium

    CN116895157A