Traffic flow prediction system and method based on adaptive gated spatiotemporal graph convolutional network

By adopting an adaptive gating spatiotemporal graph convolution network in the traffic flow prediction model, combining feature fusion module and one-way graph edge-cut mechanism, the oversmoothing and overfitting problems of existing models when dealing with complex traffic networks and long-term predictions are solved, and more accurate traffic flow prediction is achieved.

CN119358841BActive Publication Date: 2025-04-18JILIN UNIVERSITY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411896287.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-18
Estimated Expiration
2044-12-23

AI Technical Summary

Technical Problem

The existing traffic flow prediction model has problems of oversmoothing and overfitting when dealing with the complex topological structure and long-term prediction of the traffic network, making it difficult to extract higher-order neighbor node information, limiting its application in medium- and long-term traffic flow prediction.

Method used

The traffic flow prediction system based on an adaptive gated spatio-temporal graph convolution network is adopted. By adding a feature fusion module to the starting part of the network, the node input features are smoothly processed, and a one-way graph edge-cutting mechanism is introduced to make the graph structure more sparse. Combining the adaptive gating graph convolution mechanism and attention mechanism, adaptively update and forget node features, and effectively aggregate local and global information in the road network.

Benefits of technology

It effectively alleviates the problems of oversmoothing and overfitting, enhances the model's ability to extract the spatial characteristics of the road network, improves the accuracy of prediction of traffic flow changes, and can accurately predict the traffic flow conditions in the next 12 time steps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119358841B_ABST
    Figure CN119358841B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of traffic control systems and relates to a traffic flow prediction system and method based on an adaptive gated spatiotemporal graph convolutional network. The system is obtained by training an AG‑STGCN model, and the AG‑STGCN model includes a feature fusion module, a causal convolutional layer, an adaptive gated graph convolutional layer, and an output module. A feature fusion module is added to the beginning of the AG‑STGCN model to smooth the node input features. In constructing the road network structure, a unidirectional graph trimming mechanism is proposed to make the graph structure more sparse and alleviate the problems of over-smoothing and over-fitting. Then, the idea of ​​gating is used to adaptively update and forget node features using an adaptive gated graph convolutional network. The features of gated graph convolutional networks at different layers are further aggregated using an attention method to make full use of local and global information of the road network. A traffic flow prediction spatiotemporal model is constructed in combination with lightweight temporal causal convolution. The model can predict the traffic flow conditions for the next 12 time steps, and the prediction results are accurate and reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of traffic control systems and relates to smart transportation. Specifically, it relates to a traffic flow prediction system and method based on an adaptive gated spatiotemporal graph convolutional network. Background Art

[0002] In the field of Intelligent Transportation Systems (ITS), accurate traffic flow prediction is of great significance for optimizing traffic management. The accelerated pace of urbanization and the increase in population density have led to a surge in the number of vehicles in cities, which in turn has caused traffic congestion. This phenomenon not only prolongs travel time, but may also have a negative impact on the environment and public safety. Therefore, accurate prediction of traffic flow is the basis for traffic management agencies to implement dynamic monitoring and planning of road resources. This prediction capability is a key strategy to improve urban traffic mobility and reduce congestion.

[0003] Using historical data collected by sensors, accurate traffic flow prediction models can be built. These models can guide drivers to avoid congestion, optimize travel plans, and assist traffic managers in allocating resources to ease traffic pressure and improve road safety.

[0004] In the field of traffic flow research, traffic flow prediction is usually divided into two categories: short-term prediction and long-term prediction according to the prediction time range. Traditional statistical methods, such as linear regression, perform well in short-term prediction, but their effectiveness in long-term prediction is significantly reduced in the face of the uncertainty and complexity of traffic flow.

[0005] Autoregressive Integrated Moving Average Model (ARIMA) and non-parametric methods are applied to the task of predicting highway traffic data, including traditional machine learning models such as Bayesian networks.

[0006] In the field of traffic flow prediction, the application of deep learning models is increasing, including stacked autoencoders and convolutional long short-term memory networks. However, traditional convolution operations are mainly suitable for processing regular grid structure data (such as images and videos), and have limitations when processing irregular structure data such as road network maps. With the advancement of computing power and data storage technology, researchers have begun to explore more advanced network structures to adapt to the complexity and diversity of traffic flow prediction.

[0007] Deep belief networks and deep recurrent neural networks have also been applied to traffic speed and flow prediction tasks. However, these fully connected neural networks have difficulty extracting spatial and temporal features from their inputs. Moreover, the strict restrictions or even complete lack of spatial attributes severely limit the representation capabilities of these networks.

[0008] Urban traffic data is essentially defined on a graph domain due to the complex topological structure of traffic networks. Unlike grid-like data, the number of neighbors in a traffic network is different at different locations. Most of these traditional methods either process each node individually or simply concatenate signals at different locations into a vector, ignoring the underlying spatial traffic topological information.

[0009] A new deep learning method, Graph Convolutional Network (GCN), was developed to process signals embedded in the graph domain. The network extends the convolution operation to make it suitable for graph-structured data, thus showing excellent performance in multiple research fields such as molecular feature analysis, text classification, and point cloud recognition. Given its advantages in processing graph-structured data, GCN is considered suitable for traffic flow prediction tasks. GCN can capture the complex topological relationships of traffic networks and provide a new solution for the spatiotemporal dynamic modeling of traffic flow. For example, the Diffusion Convolutional Recurrent Neural Network (DCRNN) combines the diffusion process and the gated recurrent unit to achieve high prediction accuracy; however, the training cost of this model is relatively high, which limits its application on large-scale datasets. Spatio-Temporal Graph Convolutional Networks (STGCN) effectively capture the spatial correlation of traffic data and achieve a fast training process by adopting a generalized form of Chebyshev networks; however, shallow graph convolutional networks (GCN) have limitations in processing long-distance dependencies between nodes, which affects the model's understanding of the global structure of the traffic network.

[0010] At present, there are many spatiotemporal graph convolutional networks that consider the spatiotemporal characteristics of road networks, such as: Attention Based Spatial-Temporal Graph Convolutional Networks (ASTGCN) for traffic flow prediction; Spatial-Temporal Synchronous Graph Convolutional Networks (STSGCN) taking into account the heterogeneity problem in traffic flow prediction and synchronously capturing complex spatiotemporal correlations; Spatial-Temporal Fusion Graph Neural Networks (STFGNN) using the Dynamic Time Warping (DTW) algorithm to construct a "spatial-temporal graph" to aggregate long-distance node information. However, the shallow graph neural network model of the above-mentioned prior art is difficult to extract the high-order neighbor node information of the road network. As the number of layers of ordinary graph convolution increases, it is easy to cause over-smoothing and over-fitting risks, which is a great challenge for medium and long-term traffic flow prediction. Summary of the invention

[0011] In view of the above-mentioned technical problems and defects, the purpose of the present invention is to provide a traffic flow prediction system based on an adaptive gated spatiotemporal graph convolutional network. The system initially adds a feature fusion module to smooth the node input features. In constructing the road network structure, a unidirectional graph trimming mechanism is proposed to make the graph structure more sparse and alleviate the problems of over-smoothing and over-fitting. Then, the idea of ​​gating is used to adaptively update and forget node features using an adaptive gated graph convolutional network. The features of gated graph convolutional networks at different layers are further aggregated using the attention method to make full use of local and global information of the road network. A traffic flow prediction spatiotemporal model is constructed in combination with lightweight temporal causal convolution. The model can predict the traffic flow conditions for the next 12 time steps, and the prediction results are accurate and reliable.

[0012] To achieve the above object, the present invention adopts the following technical solution:

[0013] A traffic flow prediction system based on an adaptive gated spatiotemporal graph convolutional network, wherein the system is obtained by training an AG-STGCN model, wherein the AG-STGCN model comprises a feature fusion module, a causal convolutional layer, an adaptive gated graph convolutional layer, and an output module;

[0014] The feature fusion module is used to smoothly process the features of road network nodes, including a feature input layer, a feature convolution layer, and a feature reconstruction layer; the feature input layer is used to input traffic flow data collected by sensors at different locations in the road network; the feature convolution layer performs feature convolution operations; the feature reconstruction layer performs feature reconstruction operations to transform the node The original input feature vector is filled with 0 elements between every two elements, and then the node Each element of the feature convolutional layer output vector is filled with 0 elements before and after, thereby obtaining the node The output result of the feature fusion module;

[0015] The causal convolution layer is used to perform causal convolution on the features output by the feature fusion module to extract the time series features of the same node;

[0016] The adaptive gated graph convolution layer is used to extract local and global road network spatial features. Before extracting the road network spatial features, a road network adjacency matrix is ​​first constructed; then the road network is regarded as an undirected graph ,in It is the representation of sensors deployed in the road network; represents the edge set, indicating the connectivity between two sensors; is an adjacency matrix; when constructing the graph structure, a unidirectional graph trimming operation is introduced to form an enhanced graph; finally, the graph structure undergoes an adaptive gated graph convolution operation;

[0017] The output module combines the attention mechanism to aggregate the information output by different adaptive gated graph convolutional layers, that is, the output results of multiple layers of adaptive gated graph convolutional layers are aggregated in an attention manner, making full use of the local and global information of the road network, outputting the prediction results, and realizing the traffic flow prediction task.

[0018] As a preferred embodiment of the present invention, the data processing method of the feature convolution layer is: ;in, and Node The input and output of the feature convolution layer, is the feature convolution operation, is the convolution kernel of feature convolution, is the kernel width;

[0019] The data processing method of the feature reconstruction layer is: first becomes , and then becomes , the reconstructed features are added as the output result of the feature fusion module ;

[0020]

[0021] As a preferred embodiment of the present invention, the causal convolution formula of the causal convolution layer is ;

[0022] in, Represents the output after a layer of causal convolution. elements, For Node All the characteristics of is the causal convolution kernel, is the convolution kernel width, is the number of convolution kernel channels, is the causal convolution operation, is the causal convolution kernel Channel No. elements, For Node No. elements, Represents the number of causal convolution layers.

[0023] As a preferred embodiment of the present invention, the method for constructing the road network adjacency matrix is ​​as follows: a Gaussian kernel function with a threshold is introduced based on the distance between nodes to establish a flexible adjacency matrix;

[0024] ;

[0025] in, Is a node To Node The distance Representation Node With Node There is a connection relationship. is the threshold value, is the variance of the distances between nodes, is the first OK The value of the column.

[0026] As a preferred embodiment of the present invention, the specific method of the unidirectional graph edge trimming operation is: the degree matrix is ​​calculated according to the adjacency matrix ;

[0027] ;

[0028] in, Representation and Node The number of associated edges;

[0029] Arrange them according to their degree and take out the one with the largest degree The index of the node, is a hyperparameter, Represents the number of nodes in the road network. If the node To remove the node, let , is a randomly selected node There are nodes with edges, , repeat this process Second-rate, is a hyperparameter, and the adjacency matrix after trimming the unidirectional graph is obtained .

[0030] As a preferred embodiment of the present invention, the specific steps of the adaptive gated graph convolution operation are:

[0031] Compute adaptive adjacency matrix , ;

[0032] Calculate gate value , ;

[0033] Calculate the Laplacian matrix of the road network , ;

[0034] Calculating the road network self-attention score , ;

[0035] Calculate the final road network adjacency matrix , ;

[0036] Aggregate road network neighborhood information, the formula is: ;

[0037] Calculate the neighborhood information of different orders of road network , the formula is as follows:

[0038] ;

[0039] in, is the Hadamard product operation, for The degree matrix of is a trainable parameter, is the number of convolution layers, representing aggregation Neighborhood information of order; for of The inverse matrix of the power, represents graph convolution combined with attention mechanism, Representative The input of the layer adaptive gated graph convolution, when When the input is , which is the output of causal convolution, represents the adjacency matrix of the unidirectional graph after edge pruning, represents the transpose operation of the matrix, represent Channels in ,parameter In The channel is becomes , is a hyperparameter.

[0040] As a preferred embodiment of the present invention, the output module combines the attention mechanism to aggregate the information of different layers of adaptive gated graph convolution layers:

[0041] ;

[0042] ;

[0043] ;

[0044] in, For the The features after the layer-adaptive gated graph convolution are fully connected through two layers. is the trainable parameter of the two fully connected layers; then the output of the fully connected layer Convert to a one-dimensional vector , and then make a full connection. is a trainable parameter, is bias; For the corresponding The attention score of the layer, is the final prediction output of the model, is the total number of layers of the adaptive gated graph convolutional neural network.

[0045] As a preferred embodiment of the present invention, the specific steps for training the AG-STGCN model are:

[0046] S1. Deploy sensors for collecting traffic flow data at different locations in the road network, set the time interval for collection, and after a certain period of time, each sensor collects the vehicle flow sequence information at the current location, and the information collected by all sensors is sorted to obtain vehicle flow statistics sorted by time;

[0047] S2. Number the sensors and organize the nodes with connectivity between two sensors into a set according to the connection relationship of the road network, so as to construct a road network adjacency relationship graph;

[0048] S3. Use the pandas tool to preprocess the traffic flow data obtained in S1, including data cleaning, data filling, data outlier detection, data partitioning, and data standardization; use the node-to-node distance relationship data in S2 to obtain the road network adjacency matrix;

[0049] S4. Use the traffic statistics data and road network adjacency matrix obtained in S3 to train the AG-STGCN model, use the back propagation algorithm to optimize the model parameters, obtain the final traffic flow prediction model, and use the traffic flow prediction model to predict the traffic flow; the traffic flow prediction model is based on the road network nodes The traffic flow data of time steps is used to predict the future Traffic flow situation of time steps, traffic flow prediction is expressed as:

[0050] ;

[0051] in, for Traffic flow data at historical moments, is the traffic flow prediction model, for The predicted value at a certain moment, is an undirected road network graph.

[0052] As a further preferred embodiment of the present invention, the specific method for preprocessing the traffic flow data in S3 is:

[0053] Use linear interpolation to fill missing data. The missing data set part that needs to be filled is expressed as:

[0054] ;

[0055] in, Represents at a point in time The missing parts of the dataset that need to be filled, and They correspond to the nearest and non-missing data before and after the missing data;

[0056] After confirming that there are no missing data sets, outlier detection will be performed; outlier detection uses a threshold judgment method. When the vehicle is driving along the route, the carrying capacity of each section of the road has an upper limit, which is calculated by the following formula:

[0057] ;

[0058] in, Indicates the maximum carrying capacity of the road section. is the correction coefficient, and its value range is [1.3, 1.5], represents the upper limit of the road section’s traffic capacity. is the time interval for collecting road network sensor data; the upper limit value calculated by the above formula is Determine whether the traffic flow dataset contains outliers; if the data is not greater than If it exceeds When The data points are removed and the data filling process is performed;

[0059] After obtaining a reliable road network data set, it is divided into training set, validation set and test set in a ratio of 6:2:2. After the training set, validation set and test set are divided, the Z-Score method is used to standardize the traffic flow data, and its expression is:

[0060] ;

[0061] in, Refers to the complete traffic flow data after missing values ​​are filled. and Represent the mean and standard deviation of the traffic flow dataset, respectively. These are the data after being standardized.

[0062] The present invention also provides a traffic flow prediction method based on an adaptive gated spatiotemporal graph convolutional network, the method comprising the following steps:

[0063] S1. Obtained through sensors Traffic flow data at historical moments;

[0064] S2. According to the connection relationship of the road network, the nodes with connectivity between two sensors are sorted into a set;

[0065] S3. preprocess the traffic flow data, obtain the road network adjacency matrix according to the node-to-node distance relationship data, and construct the road network graph structure;

[0066] S4. The traffic flow data of historical moments and the undirected graph of the road network are input into the above traffic flow prediction system based on the adaptive gated spatiotemporal graph convolutional network, and the output The predicted value at a certain moment.

[0067] Advantages and beneficial effects of the present invention:

[0068] (1) The present invention adds a feature fusion module at the beginning of the network to smooth the input features, which can alleviate the impact of missing data and unconventional traffic (weather changes, traffic accidents, etc.) on traffic flow prediction without destroying the sequence characteristics of the road network nodes, thereby enhancing the representation ability of the model.

[0069] (2) In order to speed up the response speed of the model and reduce the training cost, the present invention adopts multi-channel causal convolution in time series modeling. In addition, due to the deviation of graph structure distribution, a unidirectional graph pruning operation is introduced when constructing the graph structure. The unidirectional graph pruning operation can form an enhanced graph and enrich the spatial structure of the road network. The combination of the unidirectional graph pruning operation and the self-attention mechanism makes the graph structure more sparse, reduces unnecessary information transmission, effectively alleviates the over-smoothing and over-fitting phenomena, and enhances the representation ability of the spatial structure of the road network.

[0070] (3) The present invention introduces an adaptive gated graph convolution mechanism, which can adaptively update and forget node information according to the dynamic changes of traffic flow. This mechanism enhances the model's ability to extract spatial features of road networks and improves the accuracy of predicting traffic flow changes.

[0071] (4) The present invention effectively combines different levels of the gated graph convolutional network through the attention mechanism, making the road network graph structure more flexible and obtaining more effective spatial information when aggregating deep graph structure information. This method makes full use of spatial features and captures local and global information of the road network, further improving the model's ability to recognize and predict complex traffic flow patterns.

[0072] (5) The present invention combines the temporal module and the spatial module, and uses the attention mechanism to aggregate the information of different gated graph convolutional layers to enrich the spatiotemporal dependencies of the road network. This method can more accurately aggregate the neighborhood information of different orders of the road network, that is, the global and local spatial characteristics of the road network. Combined with the causal convolution of the temporal module, the spatiotemporal characteristics of the road network can be extracted simultaneously.

[0073] (6) Before model training, the present invention preprocesses node features, including data filling, data anomaly identification, data partitioning, data normalization, etc., to ensure data quality and further improve the generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] By referring to the following description in conjunction with the accompanying drawings, and with a more comprehensive understanding of the present invention, other objects and results of the present invention will become more apparent and easy to understand. In the accompanying drawings:

[0075] Figure 1 : is a schematic diagram of the structure of the model of the present invention; wherein, (a) is the overall structure of the adaptive gated spatiotemporal graph convolution (AG-STGCN); (b) is a schematic diagram of the adaptive gated graph convolutional neural network (AG-GCN);

[0076] Figure 2 It is a schematic diagram of the feature fusion module;

[0077] Figure 3Schematic diagram of the causal convolutional layer;

[0078] Figure 4 This is the process of traffic flow prediction of the present invention. DETAILED DESCRIPTION

[0079] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Therefore, the detailed description of the embodiments of the present application provided below in conjunction with the drawings is not intended to limit the scope of protection of the present application for which protection is claimed, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application. The present invention is further described below in conjunction with the drawings.

[0080] Before implementing the present invention, it is necessary to first deploy sensors at different locations in the road network to collect traffic flow data. These sensors can record vehicle flow sequence information and collect data at set time intervals. The collected data includes but is not limited to the number and speed of vehicles passing through. After the data collection is completed, the data needs to be preprocessed, including data cleaning, missing value processing, etc., to ensure the quality of the data.

[0081] like Figures 1 to 3 As shown, this embodiment provides a traffic flow prediction system based on an adaptive gated spatiotemporal graph convolutional network, wherein the system is obtained by training an AG-STGCN model, wherein the AG-STGCN model includes a feature fusion module, a causal convolutional layer, an adaptive gated graph convolutional layer, and an output module;

[0082] The feature fusion module (FF module) is used to smoothly process the characteristics of road network nodes, alleviate the impact of missing data and unconventional traffic (weather changes, traffic accidents, etc.) on traffic flow prediction, and enhance the expression ability of the model, including a feature input layer, a feature convolution layer, and a feature reconstruction layer; the feature input layer is used to input traffic flow data collected by sensors at different locations in the road network (i.e., data from different nodes); the feature convolution layer performs feature convolution operations; the feature reconstruction layer performs feature reconstruction operations to convert nodes The original input feature vector is filled with 0 elements between every two elements, and then the node Each element of the feature convolutional layer output vector is filled with 0 elements before and after, thereby obtaining the node The output result of the feature fusion module;

[0083] The causal convolution layer (Causal Conv) is used to perform a causal convolution operation on the features output by the feature fusion module to extract the time series features of the same node;

[0084] The adaptive gated graph convolutional layer (AG-GCN) is used to extract local and global road network spatial features. Before extracting the road network spatial features, a road network adjacency matrix is ​​first constructed; then the road network is regarded as an undirected graph ,in It is the representation of sensors deployed in the road network; represents the edge set, indicating the connectivity between two sensors; is an adjacency matrix; when constructing the graph structure, a unidirectional graph trimming operation is introduced to form an enhanced graph; finally, the graph structure undergoes an adaptive gated graph convolution operation;

[0085] The output module uses the attention mechanism to aggregate the information output by different adaptive gated graph convolutional layers, that is, to aggregate the output results of multiple layers of adaptive gated graph convolutional layers in an attention manner, fully utilize the local and global information of the road network, output the prediction results, and realize the traffic flow prediction task.

[0086] In this embodiment, the data input by the feature fusion module first passes through the feature convolution layer to perform feature convolution operation, with nodes For example, it can be expressed as: ;in, and Node The input and output of the feature convolution layer, is the feature convolution operation, is the convolution kernel of feature convolution, is the kernel width, ;

[0087] After that, the feature reconstruction layer is used to perform feature reconstruction, with nodes For example, first set the node The original input feature vector is filled with 0 elements between every two elements, that is, becomes , and then the node Each element of the feature convolutional layer output vector is filled with 0 elements before and after, that is, becomes , the reconstructed features are added as the output result of the feature fusion module , i.e. node The output result of the feature fusion module is:

[0088]

[0089] ;

[0090] For the road network nodes, the feature fusion module is expressed as: ;

[0091] in, is the input feature, For the feature fusion operation, For the The output of feature fusion operation; among them, , is the number of historical moments of traffic flow data.

[0092] In this embodiment, the causal convolution formula of the causal convolution layer is ;

[0093] in, Represents the output after a layer of causal convolution. elements, For Node All the characteristics of is the causal convolution kernel, is the convolution kernel width, is the number of convolution kernel channels, is the causal convolution operation, is the causal convolution kernel Channel No. elements, For Node No. elements, represents the number of causal convolution layers, when , which is represented as the original input feature of the causal convolution, and the final output of the causal convolution (sequential module) is Represents the number of nodes in the road network.

[0094] In this embodiment, the adaptive gated graph convolutional neural network (AG-GCN) with different numbers of layers is designed to solve the problem of over-smoothing and over-fitting caused by a large number of graph convolution layers when extracting spatial feature information. In order to alleviate the risk of over-smoothing and over-fitting, in this embodiment, an adjacency matrix is ​​first constructed; then a unidirectional graph trimming operation is introduced when constructing the graph structure to form an enhanced graph and enrich the spatial structure of the road network; finally, an adaptive gated graph convolution is performed;

[0095] Among them, the method for constructing the road network adjacency matrix is: constructing a road network adjacency relationship graph according to the deployment of sensors and the connection relationship of the road network; specifically, numbering the sensors, and organizing the sensor nodes with connectivity into a set, and using the distance relationship data between sensors to construct the road network adjacency matrix, the road network adjacency matrix will be used in the subsequent graph convolutional network.

[0096] In a traffic road network, the distance between nodes actually contains adjacency information, which has a substantial impact on the evolution of information related to traffic flow in the road network. To this end, this embodiment introduces a Gaussian kernel function with a threshold based on the distance between nodes to establish a flexible adjacency matrix.

[0097] ;

[0098] in, Is a node To Node The distance Representation Node With Node There is a connection relationship. is the threshold value, is the variance of the distances between nodes, is the first OK The value of the column.

[0099] The trimming method of the unidirectional graph trimming operation is: the degree matrix is ​​calculated based on the adjacency matrix ;

[0100] ;

[0101] in, Representation and Node The number of associated edges;

[0102] Arrange them according to their degree and take out the one with the largest degree The index of the node, is a hyperparameter. If the node To remove the node, let , is a randomly selected node There are nodes with edges, , repeat this process Second-rate, is a hyperparameter, and the adjacency matrix after trimming the unidirectional graph is obtained .

[0103] In this embodiment, during the adaptive gated graph convolution operation, the adaptive gating mechanism can selectively forget and update node information, making the road network graph structure more flexible and obtaining more effective spatial information when aggregating deep graph structure information.

[0104] The specific steps of the operation of the adaptive gated graph convolution are:

[0105] Computing the adaptive adjacency matrix through parameter training , ;

[0106] Calculate the gate value through graph convolution (GCN) , ;

[0107] According to the adjacency matrix after trimming the edges of the unidirectional graph Calculate the Laplacian matrix of the road network , ;

[0108] Calculate the road network self-attention score based on the features of the previous layer nodes , ;

[0109] Calculate the final road network adjacency matrix based on the road network self-attention score and the road network Laplacian matrix , ;

[0110] Combined with the attention mechanism to aggregate the road network neighborhood information, the formula is: ;

[0111] By aggregating the features of the previous layer nodes through the gated value and combining the features of the attention mechanism, the neighborhood information of different orders of the road network is calculated. , the formula is as follows:

[0112] ;

[0113] in, is the Hadamard product operation, for The degree matrix of is a trainable parameter, is the number of convolution layers, representing aggregation Neighborhood information of order; for of The inverse matrix of the power, represents graph convolution combined with attention mechanism, Representative The input of the layer adaptive gated graph convolution, when When the input is , which is the output of causal convolution, represents the adjacency matrix of the unidirectional graph after edge pruning, represents the transpose operation of the matrix, represent Channels in ,parameter In The channel is becomes , As a hyperparameter, set .

[0114] In this embodiment, the output module combines the attention mechanism to aggregate the information of different adaptive gated graph convolutional layers as follows:

[0115] ;

[0116] ;

[0117] ;

[0118] in, For the The features after the layer-adaptive gated graph convolution are fully connected through two layers. is the trainable parameter of the two fully connected layers; then the output of the fully connected layer Convert to a one-dimensional vector , and then make a full connection. is a trainable parameter, is bias; For the corresponding The attention score of the layer, is the final prediction output of the model, is the total number of layers of adaptive gated graph convolution.

[0119] This embodiment trains the AG-STGCN model constructed above, and the specific steps are as follows:

[0120] S1. Deploy sensors for collecting traffic flow data at different locations in the road network, set the time interval for collection, and after a certain period of time, each sensor collects the vehicle flow sequence information at the current location, and the information collected by all sensors is sorted to obtain vehicle flow statistics sorted by time;

[0121] S2. Number the sensors and organize the nodes with connectivity between two sensors into a set according to the connection relationship of the road network, so as to construct a road network adjacency relationship graph;

[0122] S3. Use the pandas tool to preprocess the traffic flow data (vehicle flow statistics) obtained in S1, including data cleaning, data filling, data outlier detection, data partitioning, and data standardization (also known as normalization); use the node-to-node distance relationship data in S2 to obtain the road network adjacency matrix;

[0123] Specifically, due to the large number of sensors collecting data sets and long working time, it is inevitable that the data set storage will be missing. Therefore, the linear interpolation method is used in S3 to fill the missing data. The missing data set part that needs to be filled is expressed as:

[0124] ;

[0125] in, Represents at a point in time The missing parts of the dataset that need to be filled, and The data that are closest to the missing data and are not missing respectively correspond to the missing data. This method may lead to homogenization of node features when processing continuous missing data. In order to solve this problem, when constructing the model in this embodiment, a feature fusion module is added to the beginning of the network to enhance the data.

[0126] After confirming that there are no missing data sets, outlier detection will be performed next; outlier detection uses a threshold judgment method. When the vehicle is driving along the route, the carrying capacity of each section of the road has an upper limit, which is calculated by the following formula:

[0127] ;

[0128] in, Indicates the maximum carrying capacity of the road section. is the correction coefficient, and its value range is [1.3, 1.5], represents the upper limit of the road section’s traffic capacity. is the time interval for collecting road network sensor data; the upper limit value calculated by the above formula is Determine whether the traffic flow dataset contains outliers; if the data is not greater than If it exceeds When The data points are removed and the data filling process is performed;

[0129] After obtaining a reliable road network data set, it is divided into training set, validation set and test set in a ratio of 6:2:2. After the training set, validation set and test set are divided, the Z-Score method is used to standardize the traffic flow data, and its expression is:

[0130] ;

[0131] in, Refers to the complete traffic flow data after missing values ​​are filled. and Represent the mean and standard deviation of the traffic flow dataset, respectively. These are the data after being standardized.

[0132] S4. Use the traffic statistics data and road network adjacency matrix obtained in S3 to train the AG-STGCN model, use the back propagation algorithm to optimize the model parameters, obtain the final traffic flow prediction model, and use the traffic flow prediction model to predict the traffic flow. The traffic flow prediction model is based on the road network nodes. The traffic flow data of time steps is used to predict the future Traffic flow situation of time steps, traffic flow prediction is expressed as:

[0133] ;

[0134] in, for Traffic flow data at historical moments, is the traffic flow prediction model, for The predicted value at a certain moment, is an undirected graph of road network.

[0135] Specifically, the model hyperparameters described in this embodiment are set as follows:

[0136] Using 12 historical moments (i.e. ) traffic flow data to predict the next 12 moments (i.e. ) of traffic flow; among them, the step length of the feature fusion module of the first layer ; There are 2 layers of causal convolution, and the convolution kernel width , number of channels ; One-way trimming operation ; In gated graph convolution , number of channels ; The number of fully connected neurons in the two layers of the output module is 64 and 12, and the number of gated graph convolution layers is The model was trained using the AdamW optimizer and an initial learning rate of 0.001, with a learning rate reduction of 5% after 15 iterations, a batch size of 32, and 200 iterations.

[0137] Example 2

[0138] like Figure 4As shown, this embodiment provides a traffic flow prediction method based on an adaptive gated spatiotemporal graph convolutional network, the method comprising the following steps:

[0139] S1. Obtained through sensors Traffic flow data at historical moments;

[0140] Specifically, sensors for collecting traffic flow data are deployed at different locations in the road network, and the collection time interval is set. After a certain period of time, each sensor collects the vehicle flow sequence information at the current location. After the information collected by all sensors is sorted, the vehicle flow statistics data sorted by time are obtained;

[0141] S2. According to the connection relationship of the road network, the nodes with connectivity between two sensors are sorted into a set;

[0142] S3. preprocess the traffic flow data, obtain the road network adjacency matrix according to the node-to-node distance relationship data, and construct the road network graph structure;

[0143] S4. The traffic flow data of each historical moment and the undirected graph of the road network are input into the traffic flow prediction system based on the adaptive gated spatiotemporal graph convolutional network described in Example 1, and the output The predicted value at a certain moment.

[0144] The present invention also provides an electronic device, comprising: one or more processors and a memory; wherein the memory is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the traffic flow prediction method based on the adaptive gated spatiotemporal graph convolutional network described in Example 2.

[0145] The present invention also provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, the traffic flow prediction method based on the adaptive gated spatiotemporal graph convolutional network described in Example 2 is implemented.

[0146] Those skilled in the art will appreciate that all or part of the functions of the various methods / modules in the above embodiments may be implemented by hardware or by computer programs. When all or part of the functions in the above embodiments are implemented by computer programs, the program may be stored in a computer-readable storage medium, which may include: a read-only memory, a random access memory, a disk, an optical disk, a hard disk, etc. The program is executed by a computer to implement the above functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above functions can be implemented.

[0147] In addition, when all or part of the functions in the above-mentioned embodiments are implemented by means of a computer program, the program can also be stored in a storage medium such as a server, another computer, a disk, an optical disk, a flash drive or a mobile hard disk, and saved to the memory of a local device by downloading or copying, or the system of the local device is updated. When the program in the memory is executed by the processor, all or part of the functions in the above-mentioned embodiments can be implemented.

[0148] The above specific examples are used to illustrate the present invention, which is only used to help understand the present invention and is not intended to limit the present invention. For those skilled in the art of the present invention, according to the idea of ​​the present invention, some simple deductions, deformations or substitutions can be made. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A traffic flow prediction system based on adaptive gated spatiotemporal graph convolutional network, characterized in that: The system is obtained by training the AG-STGCN model, which includes a feature fusion module, a causal convolution layer, an adaptive gated graph convolution layer, and an output module; The feature fusion module is used to smoothly process the node features of the road network, including a feature input layer, a feature convolution layer, and a feature reconstruction layer; the feature input layer is used to input the traffic flow data collected by sensors at different positions in the road network; the feature convolution layer performs feature convolution operations; the feature reconstruction layer performs feature reconstruction operations to transform the node v i The original input feature vector is filled with 0 elements between every two elements, and then the node v i Each element of the feature convolutional layer output vector is filled with 0 elements before and after, thereby obtaining the node v i The output result of the feature fusion module; The causal convolution layer is used to perform causal convolution on the features output by the feature fusion module to extract the time series features of the same node; the causal convolution formula of the causal convolution layer is Among them, F(s) represents the sth element output after a layer of causal convolution, For node v i All features of , Γ∈R k×c is the causal convolution kernel, k is the width of the convolution kernel, c is the number of convolution kernel channels, * τ is the causal convolution operation, is the jth element of the causal convolution kernel C channel, For node v i The s+jth element of , L1 represents the number of layers of causal convolution; The adaptive gated graph convolution layer is used to extract local and global spatial features of the road network. Before extracting the spatial features of the road network, an adjacency matrix of the road network is first constructed; then the road network is regarded as an undirected graph G = (V, E, A), where V∈R N is the representation of sensors deployed in the road network; E represents the edge set, which represents the connectivity between two sensors; A∈R N×N is an adjacency matrix; when constructing the graph structure, a unidirectional graph trimming operation is introduced to process the adjacency matrix to form an enhanced graph; finally, the graph structure of the enhanced graph is subjected to an adaptive gated graph convolution operation; The output module combines the attention mechanism to aggregate the information output by different adaptive gated graph convolution layers, that is, to aggregate the output results of multiple layers of adaptive gated graph convolution layers in an attention manner, making full use of the local and global spatial features of the road network, outputting the prediction results, and realizing the traffic flow prediction task; The data processing method of the feature convolution layer is as follows: in, and The nodes v i The input and output of the feature convolution layer, * F is the feature convolution operation, Γ κ is the convolution kernel of feature convolution, κ is the kernel width; The data processing method of the feature reconstruction layer is: first becomes Then becomes The reconstructed features are added as the output result of the feature fusion module The specific method of unidirectional graph edge trimming operation is: calculate the degree matrix D∈R according to the adjacency matrix N×N ; Among them, d(v i ) represents the node v i The number of associated edges; Arrange them according to their degree and take out the μ nodes with the largest degree, μ=N×M n , M n is a hyperparameter, N represents the number of nodes in the network, if node v i To remove the node, let A ij =0, A ij is the value of the i-th row and j-th column in the adjacency matrix, v j is a randomly selected node v i For nodes with edges, i≠j, repeat this process m times, where m is a hyperparameter, and we get the adjacency matrix A of the unidirectional graph after edge pruning. sd ; The specific steps of the adaptive gated graph convolution operation are: Compute adaptive adjacency matrix Calculate the gate value β l , Calculate the road network Laplace matrix L sd , Calculate the road network self-attention score SAT, Calculate the final road network adjacency matrix S sd , S sd =softmax(SAT)⊙L sd ; Aggregate road network neighborhood information, the formula is: Calculate the neighborhood information of different orders of road network The formula is as follows: Among them, ⊙ is the Hadamard product operation, D sd A sd The degree matrix of is a trainable parameter, is a trainable parameter, is a trainable parameter, is a trainable parameter, V∈R c×d is a trainable parameter, l is the number of convolution layers, representing the aggregation of the neighborhood information of order l; D sd The inverse matrix of 1 / 2, represents graph convolution combined with attention mechanism, Represents the input of the lth layer of adaptive gated graph convolution. When l = 1, the input is X τ , which is the output of causal convolution, A sd represents the adjacency matrix after trimming the unidirectional graph, T represents the transpose operation of the matrix, and c represents Channel c in, parameter V∈R c×d The c×d in the formula changes the channel from c to d. is a hyperparameter; The expression of the output module combining the attention mechanism to aggregate the information of different layers of adaptive gated graph convolutional layers is: Among them, Z l The features after the adaptive gated graph convolution of the first layer are fully connected through two layers. is the trainable parameter of the two fully connected layers; then the output Z of the fully connected layer l Convert to a one-dimensional vector H l , and then make a full connection, W l is a trainable parameter, b l is the bias; α l is the attention score corresponding to the lth layer, Z is the final prediction output of the model, and L is the total number of layers of the adaptive gated graph convolutional neural network.

2. The traffic flow prediction system based on adaptive gated spatiotemporal graph convolutional network according to claim 1 is characterized in that: The method of constructing the adjacency matrix of the road network is: Among them, dist(v i , v j ) is the node v i To node v j The distance (v i , v j )∈E represents node v i With node v j There is a connection relationship, δ is the threshold, σ 2 is the variance of the distance between nodes, A ij is the value in the i-th row and j-th column of the adjacency matrix.

3. The traffic flow prediction system based on adaptive gated spatiotemporal graph convolutional network according to claim 1 is characterized in that: The specific steps for training the AG-STGCN model are: S1. Deploy sensors for collecting traffic flow data at different locations in the road network, set the time interval for collection, and after a certain period of time, each sensor collects the vehicle flow sequence information at the current location, and the information collected by all sensors is sorted to obtain vehicle flow statistics sorted by time; S2. number the sensors, and organize the nodes with connectivity between two sensors into a set according to the connection relationship of the road network, so as to construct an undirected graph of the road network; S3. Use the pandas tool to preprocess the traffic flow data obtained in S1, including data cleaning, data filling, data outlier detection, data partitioning, and data standardization; The adjacency matrix of the road network is obtained using the node-to-node distance relationship data in S2; S4. The AG-STGCN model is trained using the traffic statistics data obtained in S3 and the adjacency matrix of the road network, and the model parameters are optimized using the back propagation algorithm to obtain the final traffic flow prediction model, and the traffic flow is predicted using the traffic flow prediction model; the traffic flow prediction model predicts the traffic flow conditions of the road network node in the future q time steps based on the traffic flow data of the road network node in p time steps, and the traffic flow prediction is expressed as: (X t+1 ,...,X t+q )=f(G,(X t-p+1 ,....,X t-1 ,X t )); Among them, (X t-p+1 , ..., X t-1 , X t ) is the traffic flow data at p historical moments, f(·) is the traffic flow prediction model, (X t+1 , ..., X t+q ) is the predicted value at q moments, and G is the undirected graph of the road network.

4. The traffic flow prediction system based on adaptive gated spatiotemporal graph convolutional network according to claim 3 is characterized in that: The specific method for preprocessing traffic flow data in S3 is: Use linear interpolation to fill missing data. The missing data set part that needs to be filled is expressed as: Among them, x t represents the missing part of the dataset that needs to be filled at time point t, x t-1 and x t+1 They correspond to the nearest and non-missing data before and after the missing data; After confirming that there are no missing data sets, outlier detection will be performed; outlier detection uses a threshold judgment method. When the vehicle is driving along the route, the carrying capacity of each section of the road has an upper limit, which is calculated by the following formula: Among them, Q max Indicates the maximum carrying capacity of the road section, C P is the correction coefficient, and its value range is [1.3, 1.5], E R represents the upper limit of the traffic capacity of the road section, T is the time interval for collecting road network sensor data; the upper limit value calculated by the above formula is obtained through Q max Determine whether the traffic flow dataset contains outliers; if the data is not greater than Q max If it exceeds Q max When the Q max The data points are removed and the data filling process is performed; After obtaining a reliable road network data set, it is divided into training set, validation set and test set in a ratio of 6:2:

2. After the training set, validation set and test set are divided, the Z-Score method is used to standardize the traffic flow data, and its expression is: Among them, x refers to the complete traffic flow data after missing values ​​are filled, μ and σ represent the mean and standard deviation of the traffic flow data set, respectively. norm The data are processed after standardization.

5. A traffic flow prediction method based on adaptive gated spatiotemporal graph convolutional network, characterized in that: The method comprises the following steps: S1. Obtain traffic flow data at p historical moments through sensors; S2. According to the connection relationship of the road network, the nodes with connectivity between two sensors are sorted into a set; S3. preprocess the traffic flow data, obtain the adjacency matrix of the road network according to the node-to-node distance relationship data, and construct the road network graph structure; S4. Input the traffic flow data of p historical moments and the undirected graph of the road network into the traffic flow prediction system based on the adaptive gated spatiotemporal graph convolutional network as described in any one of claims 1 to 4, and output the predicted values ​​of q moments.