Traffic flow prediction method based on double attention and depth separable graph convolution
By employing dual attention and depthwise separable graph convolution, the problems of redundant feature interference and parameter size limitations in traditional traffic flow prediction are solved. This approach enables multi-scale feature extraction of traffic flow and accurate capture of long-range contextual information, thereby improving prediction accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2026-01-14
- Publication Date
- 2026-05-08
AI Technical Summary
Traditional traffic flow prediction methods are susceptible to redundancy and limited by a finite number of parameters, making it difficult to take into account the multi-scale characteristics required by short-term sudden fluctuations and long-term trends, as well as local road segment changes and global road network linkages.
A method based on dual attention and depthwise separable graph convolution is adopted. A sparse adjacency graph is generated by sparse adjacency matrix. By combining spatial attention and channel attention mechanisms, feature aggregation and multi-scale feature extraction are performed to generate the final embedding graph for traffic flow prediction.
It significantly improves the model's ability to represent features of road network traffic scenarios, enhances its resistance to sensor noise and sporadic events, and enables the synchronous extraction of multi-scale features and accurate capture of long-range contextual information.
Smart Images

Figure CN121505880B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation technology, and in particular to a traffic flow prediction method based on dual attention and depth-separable graph convolution. Background Technology
[0002] Traffic flow prediction, as a core supporting task of intelligent transportation systems, directly impacts the effectiveness of downstream applications such as road network management and travel guidance. Since traffic networks inherently possess topological interconnectivity, prediction methods based on graph neural networks (GNNs) abstract the road network into a graph structure and model road segment topological relationships through node-edge connections. This approach better reflects the spatial characteristics of traffic systems and has become a mainstream research direction in this field.
[0003] However, in the face of the complexity of real-world traffic scenarios, such as long-distance congestion spread, multi-feature coupling, and variable spatiotemporal scales, traditional GNNs still have significant limitations in traffic flow prediction tasks, which restricts the improvement of prediction performance and scenario adaptability. First, in terms of spatial correlation modeling, traditional GNNs rely on fixed adjacency matrices built based on physical road connections, which can only capture local or pre-defined spatial correlations of nodes, but cannot effectively characterize long-range spatial dependencies between non-adjacent road segments. In actual traffic, such long-range correlations, such as traffic flow linkages across regional road networks and chain-like spread of congestion, are crucial to the accuracy of prediction results. Second, in terms of feature channel utilization, traditional GNNs treat multi-dimensional features of traffic flow as equally important inputs, such as flow rate, speed, and occupancy, without exploring the differentiated prediction value of different feature channels. This can easily lead to redundant features interfering with key information and reducing feature utilization efficiency. In addition, in terms of complex feature extraction and scenario adaptation, the convolutional operations of traditional GNNs are limited by the limited parameter scale, and can only extract traffic features at a single scale. It is difficult to take into account the multi-scale feature requirements of short-term sudden fluctuations and long-term periodic trends, as well as local road segment changes and global road network linkages. Summary of the Invention
[0004] To address the technical challenges of traditional traffic flow prediction methods, such as susceptibility to redundant features, limitations in parameter size, and the inability to extract traffic features at a single scale, thus failing to meet the multi-scale feature requirements of short-term sudden fluctuations and long-term periodic trends, as well as local road segment changes and global road network linkages, this invention provides a traffic flow prediction method and system based on dual attention and depthwise separable graph convolution.
[0005] To achieve the above objectives, the present invention adopts the following technical solution, including:
[0006] A traffic flow prediction method based on dual attention and depthwise separable graph convolution includes the following steps:
[0007] S1, Represent the historical road network traffic data in the form of a graph structure to obtain the set of nodes and adjacency matrix of the road network, Represent the historical observation value of each node in the form of a signal matrix, and extract the input signal matrix from the signal matrix according to a preset time step;
[0008] S2, initialize the input signal matrix and generate node embedding features; sparsify the adjacency matrix to generate a sparse adjacency matrix; perform feature aggregation on the node embedding features based on the graph topology represented by the sparse adjacency matrix to generate a feature aggregation matrix;
[0009] S3: Perform spatial attention and channel attention mechanisms on the feature aggregation matrix respectively, output and fuse the spatial attention matrix and channel attention matrix to generate a dual attention map;
[0010] S4, perform calibration operation on the feature aggregation matrix to generate multiple two-dimensional tensors, perform kernel combination processing and feature combination processing on the multiple two-dimensional tensors respectively, output and fuse the kernel combination matrix and the feature combination matrix to generate a depth separable graph;
[0011] S5 fuses the dual attention map, the depthwise separable map, and the feature aggregation matrix to generate the final embedding map;
[0012] S6 generates traffic flow prediction data through the final embedded graph calculation.
[0013] Preferably, the spatial attention matrix and the channel attention matrix are spliced and fused to generate a dual attention map;
[0014] Furthermore, the kernel combination matrix and the feature combination matrix are weighted and fused to generate a depth-separable graph;
[0015] Furthermore, the dual attention map, the depth separable map, and the feature aggregation matrix are weighted and fused to generate the final embedding map.
[0016] Preferably, the specific process of step S1 is as follows:
[0017] S11. The historically observed road network traffic data is represented using a graph structure, resulting in a graph structure B=(V,E,A), where V represents the set of nodes in the road network, E represents the set of edges in the road network, and A represents the adjacency matrix of the road network. , when A ji When A = 1, it indicates that the two nodes j and i are connected; when A ji =0 indicates that the two nodes j and i are not connected; where j∈{1,2,...,N}, i∈{1,2,...,N}; A ji Let represent the element in the j-th row and i-th column of the adjacency matrix A. N represents the number of nodes in the road network. The number of nodes in the road network is the same as the number of sensors in the road network, and each node in the road network has a number of observations of D.
[0018] S12, Represent the historical observations of each node in the road network using a signal matrix to obtain the signal matrix of the road network. , among which, T zong Given the total number of time steps in historical observations, when predicting future traffic flow at time t, the input signal matrix is constructed using the historical observation data from the most recent T consecutive time steps. Where C = T × D, T is the time dimension, and D is the feature dimension, and ; ,in, Let v represent the eigenvector of node v at time t, where v∈{1,2,...,N}.
[0019] Preferably, the specific process of step S2 is as follows:
[0020] S21, for the input signal matrix Initialization processing is performed to obtain node embedding features. Where C = T × D, T is the time dimension, D is the feature dimension, N is the number of nodes in the road network, the number of nodes in the road network is the same as the number of sensors in the road network, and each node in the road network has D observations.
[0021] S211, for the input signal matrix Feature extraction and nonlinear activation are performed to obtain node feature representations. :
[0022] ;
[0023] ;
[0024] Where tanh is the hyperbolic tangent activation function, and tanh is a nonlinear activation function. Indicates the model training parameters, These are hyperparameters used to control the activation function;
[0025] S212, construct the asymmetric interaction matrix between J1 and J2. ,in, They are respectively transpose;
[0026] S213, for Nonlinear activation and ReLU activation are performed to obtain node embedding features. :
[0027] ;
[0028] in, For hyperparameters;
[0029] S22, regarding the adjacency matrix Sparsification is performed to obtain a sparse adjacency matrix. ;
[0030] S221, Index each node in the adjacency matrix:
[0031] ;
[0032] S222, find the index set adx of the h neighbor nodes with the largest connection weight among all neighbor nodes of node a, where a∈{1,2,...,N}, h∈{1,2,...,N};
[0033] ;
[0034] S223, keep the connection weights of the neighboring nodes in the index set adx of node a unchanged, and set the connection weights of all neighboring nodes of node a except for the index set adx to zero:
[0035] ;
[0036] After indexing each node, a sparse adjacency matrix is obtained. Where -adx is the set of indices of all neighboring nodes of node a, excluding the index set;
[0037] S23, based on the sparse adjacency matrix The graph topology represented provides node embedding features. Feature aggregation is performed on each node by aggregating its features with those of its neighboring nodes, resulting in a feature aggregation matrix. Where C = T × D, the feature aggregation matrix Remodeling .
[0038] Preferably, the specific operational steps of the spatial attention mechanism in step S3 are as follows:
[0039] S301, aggregate the feature matrix The input is fed into the convolutional layer, generating feature map b and feature map c, where, T represents the time dimension, D represents the feature dimension, and N represents the number of nodes in the road network. Each node in the road network has D observations.
[0040] S302, Perform a reshaping operation on feature map b and feature map c to obtain the reshaped feature map. and the reshaped feature map , Where M = T × D, and M is the number of time series data;
[0041] S303, the reshaped feature map Transpose the image to obtain the transposed feature map. ;
[0042] S304, transpose the feature map and the reshaped feature map Perform matrix multiplication to obtain a matrix ,matrix ;
[0043] S305, input matrix L1 into the Softmax layer to obtain the spatial attention map. ;
[0044] S306, aggregate the feature matrix The input is fed into a convolutional layer to generate a feature map. ;
[0045] S307, Perform a reshaping operation on feature map e to obtain the reshaped feature map. ,in ;
[0046] S308, Transpose the spatial attention map S to obtain the transposed spatial attention map. ;
[0047] S309, for the reshaped feature map Spatial attention map after transposition Perform matrix multiplication to obtain a matrix ,matrix ;
[0048] S310, reshape matrix L2 to obtain the reshaped matrix. ;
[0049] S311, the reshaped matrix Multiply by a scaling parameter λ and combine with the feature aggregation matrix By performing element-wise addition, we obtain the spatial attention matrix. .
[0050] Preferably, the specific operation steps of the channel attention mechanism in step S3 are as follows:
[0051] S321, on the characteristic aggregation matrix The feature aggregation matrix is reshaped to obtain the reshaped feature aggregation matrix. Where M = T × D, M is the number of time series data; T is the time dimension, D is the feature dimension, and N is the number of nodes in the road network. Each node in the road network has D observations.
[0052] S322, the reshaped feature aggregation matrix Transpose the matrix to obtain the transposed feature aggregation matrix. ;
[0053] S323, the reshaped feature aggregation matrix and the eigenaggregate matrix after transpose Perform matrix multiplication to obtain a matrix And matrix ;
[0054] S324, input matrix L3 into the Softmax layer to obtain the channel attention map. ;
[0055] S325, transpose the channel attention map G to obtain the transposed channel attention map. ;
[0056] S326, transpose the channel attention map and the reshaped feature aggregation matrix Perform matrix multiplication to obtain a matrix And matrix ;
[0057] S327, Reshape matrix L4 to obtain the reshaped matrix. ,and ;
[0058] S328, the reshaped matrix Multiply by a scaling parameter β and aggregate with the feature matrix By adding elements one by one, we obtain the channel attention matrix. .
[0059] Preferably, the specific steps of step S4 are as follows:
[0060] S41, processing the feature aggregation matrix using a sliding window approach. And apply a set of convolution kernels at each window location; treat each window as a two-dimensional tensor. Multiple two-dimensional tensors are obtained. ,in, It is the number of channels in the input feature map. Depthwise separable graph convolutions include a trainable convolutional kernel. and a trainable convolutional kernel as ,in, It is the number of channels in the output feature map. For depth multipliers, T represents the time dimension, D represents the feature dimension, and N represents the number of nodes in the road network. Each node in the road network has D observations.
[0061] S42, for multiple two-dimensional tensors Kernel combination processing is performed: First, the two trainable kernels Q and K contained in the depthwise separable convolution are merged into a standard convolution kernel. Then, the standard convolution kernel is used to perform convolution operations on multiple two-dimensional tensors P to obtain multiple kernel combination vectors. For each of the multiple two-dimensional tensors, the following operations are performed:
[0062] S421, for trainable convolutional kernels and trainable convolutional kernels Perform a depthwise convolution operation to obtain a standard convolution kernel. , ;
[0063] Among them, trainable convolutional kernels It is a trainable convolutional kernel Transpose on the first and second axes; This is the depthwise convolution operator;
[0064] S422, for standard convolutional kernels and two-dimensional tensors Perform a regular convolution operation to obtain the kernel combination vector. ,and ;in, This is a standard convolution operator;
[0065] S43, for multiple two-dimensional tensors Perform feature combination processing: for multiple two-dimensional tensors Perform depthwise convolution to obtain multiple depthwise convolutional features. Then, perform ordinary convolution on these features to obtain multiple feature combination vectors. For each of the multiple two-dimensional tensors, perform the following operations:
[0066] S431, for trainable convolutional kernels and two-dimensional tensors Perform depthwise separable convolution operations to obtain the features after depthwise convolution. ,and ;
[0067] S432, for trainable convolutional kernels Features after depthwise convolution Perform a regular convolution operation to obtain the feature combination vector. ,and ;
[0068] S44 combines multiple kernel vectors Perform weighted fusion to generate a kernel combinatorial representation. Combine multiple feature vectors Perform weighted fusion to generate a feature combination representation. ;
[0069] S45 represents the kernel combination through 1×1 convolution, batch normalization, and ReLU activation. Remodeling into a core combination matrix , representing feature combination Reshaping into a feature combination matrix ;
[0070] S46, the kernel combination matrix and feature combination matrix Weighted fusion is performed to generate a depth-separable graph.
[0071] Preferably, in step S5, the dual attention map and the depthwise separable map are first weighted and fused to obtain the dual attention separable map; then the dual attention separable map and the feature aggregation matrix are... Weighted fusion is performed to obtain the final embedded graph. Where T is the time dimension, D is the feature dimension, and N is the number of nodes in the road network. Each node in the road network has D observations.
[0072] Preferably, the specific steps of step S6 are as follows:
[0073] S61, from the final embedded graph Extract the time feature sequence of each node Where T is the time dimension, D is the feature dimension, and N is the number of nodes in the road network. Each node in the road network has D observations.
[0074] S62, Multi-scale Convolution: Features are extracted in parallel from the same temporal feature sequence r using convolutional kernels of different sizes, and then concatenated and fused to obtain multi-scale fused features. :
[0075] ;
[0076] S63, Gating Mechanism: A gating mechanism is used to process multi-scale fused features. Perform convolution to obtain traffic flow prediction data y, where:
[0077] ;
[0078] in, and It is a one-dimensional convolutional kernel with learnable properties, and and Different σ represents the element-wise multiplication operator, tanh is the hyperbolic tangent activation function, and σ is the sigmoid activation function. This represents the convolution operator;
[0079] Furthermore, the convolution operations in multi-scale convolution and gating mechanisms both employ dilated convolution. The mathematical definition of dilated convolution is as follows: for a node's temporal feature sequence r and a trainable one-dimensional convolution kernel... The convolution output value at time t is:
[0080] ;
[0081] Where t is time; s is the position index within the convolution kernel; k is the convolution kernel size; and d is the dilation factor, k×d=T; For the input sequence in time The value; The weight parameters of the convolution kernel at the s-th position of the input sequence; To use a convolution kernel of size k with dilation rate d at time t. f The output value obtained after convolving the sequence r.
[0082] This invention also provides a traffic flow prediction system based on dual attention and depthwise separable graph convolution, applicable to the aforementioned traffic flow prediction method based on dual attention and depthwise separable graph convolution. The traffic flow prediction system includes:
[0083] Graph structure construction module: Represents the historical road network traffic data in the form of a graph structure, obtains the set of nodes and adjacency matrix of the road network, represents the historical observation value of each node in the form of a signal matrix, and extracts the input signal matrix from the signal matrix according to a preset time step;
[0084] The graph convolution module is used to initialize the input signal matrix to obtain node embedding features; to sparsify the adjacency matrix to obtain a sparse adjacency matrix; and to aggregate the node embedding features based on the graph topology represented by the sparse adjacency matrix to generate a feature aggregation matrix.
[0085] Dual attention module: It is used to perform spatial attention mechanism and channel attention mechanism on feature aggregation matrix respectively to obtain spatial attention matrix and channel attention matrix. The spatial attention matrix and channel attention matrix are concatenated and fused to obtain dual attention map;
[0086] The depth-separable graph convolution module performs calibration operations on the feature aggregation matrix to generate multiple two-dimensional tensors. Kernel combination and feature combination are performed on the multiple two-dimensional tensors respectively. The kernel combination matrix and feature combination matrix are output and fused to generate a depth-separable graph.
[0087] Data processing module: used to perform weighted fusion of dual attention map, depth separable map, and feature aggregation matrix to obtain the final embedding map;
[0088] Temporal convolution module: Used to generate traffic flow prediction data through the final embedding graph.
[0089] The advantages of this invention are:
[0090] 1. This invention proposes a dual attention module to establish global correlation of temporal data, breaking through the limitation of the fixed adjacency matrix of traditional GNNs. It accurately captures long-range contextual information of road segments at arbitrary spatial locations, analyzes the interdependence of various feature channels, dynamically weights key features, and filters out redundant channel interference. This significantly improves the model's ability to represent features in road network traffic scenarios and solves the technical problem that traditional traffic flow prediction methods are susceptible to interference from redundant features.
[0091] 2. This invention proposes a depthwise separable graph convolution module, which increases the number of convolution kernels and expands the parameter dimensions through a separable design. This enables the simultaneous extraction of multi-scale, refined traffic features. Simultaneously, by leveraging parameter redundancy, it enhances the model's resistance to sensor noise and sporadic events, improving feature robustness and adaptability to complex scenarios. This solves the technical problem of traditional traffic flow prediction methods struggling to simultaneously address the multi-scale feature requirements of short-term sudden fluctuations and long-term trends, as well as local road segment changes and global road network linkages.
[0092] 3. This invention uses multiple convolutional kernels of different sizes to extract features from the time feature sequence r, which solves the technical problem that the convolutional operation of traditional GNN is limited by the finite parameter scale and can only extract traffic features at a single scale. Attached Figure Description
[0093] Figure 1 This is a schematic diagram of the spatiotemporal correlation in the transportation network.
[0094] Figure 2 This is a schematic diagram of the traffic flow prediction system in Example 1.
[0095] Figure 3 for Figure 2 Block diagram of the mid-position attention module.
[0096] Figure 4 for Figure 2 Block diagram of the mid-channel attention module.
[0097] Figure 5 This is a schematic diagram of a normal convolution operation.
[0098] Figure 6 This is a schematic diagram of a depthwise convolution operation.
[0099] Figure 7 This is a schematic diagram illustrating the operation of the kernel combination path in depthwise separable convolution.
[0100] Figure 8 This is a schematic diagram illustrating the operation of feature combination paths in depthwise separable convolution.
[0101] Figure 9 This is a schematic diagram of the framework of a traffic flow prediction model based on dual attention and depthwise separable graph convolution.
[0102] Figure 10 This is a diagram showing the comparison of the mean absolute error (MAE) performance of each model across 12 prediction time steps on the PEMS08 dataset.
[0103] Figure 11 This diagram illustrates the performance comparison of the mean squared error (RMSE) of each model across 12 prediction time steps on the PEMS08 dataset.
[0104] Figure 12 This is a comparison chart of the short-term prediction results of the DADSGCN model of this invention on a certain node in the PeMS08 dataset.
[0105] Figure 13 This is a comparison chart of the long-term prediction results of the DADSGCN model of this invention on a certain node in the PeMS08 dataset.
[0106] Figure 14 This is a flowchart of the traffic flow prediction method in Example 2. Detailed Implementation
[0107] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0108] It should be noted that when a component is said to be "installed on" another component, it can be directly on the other component or it may be in a component that is centered on it. When a component is said to be "set on" another component, it can be directly set on the other component or it may also be in a component that is centered on it. When a component is said to be "fixed to" another component, it can be directly fixed to the other component or it may also be in a component that is centered on it.
[0109] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "or / and" as used herein includes any and all combinations of one or more of the associated listed items.
[0110] Example 1
[0111] Please see Figure 1 , Figure 1 This is a schematic diagram of the spatiotemporal correlation in the transportation network. Figure 1 The solid black lines represent the spatial correlation of different road nodes, and the dashed black lines represent the temporal correlation. t1 and t2 represent two consecutive time steps. The spatial characteristics, temporal characteristics, and spatiotemporal correlations of the traffic network are as follows:
[0112] (1) Spatial characteristics: At a specific moment, the traffic conditions of different nodes in the road network may be highly similar or show significant spatial correlation characteristics. Spatial correlation can be divided into two types: short-distance correlation and long-distance correlation. Short-distance correlation is affected by vehicle driving dynamics, and the traffic conditions of adjacent road segments are highly interdependent: if the traffic flow of adjacent road segments decreases, the traffic flow of this road segment may increase accordingly; long-distance correlation refers to the strong correlation between roads that are far apart in space. For example, two schools that are far apart but have the same functional attributes will also show a high degree of consistency in the traffic conditions of the surrounding roads due to the similar activity patterns of the surrounding people. This phenomenon is actually an important manifestation of traffic data heterogeneity.
[0113] (2) Temporal characteristics: The traffic status of each node in the road network evolves dynamically over time. The process of change can be abstracted into a continuous time series, which constitutes the temporal characteristics of traffic flow data. The traffic status of each node in the road network includes flow rate, speed, density, etc. The core of the temporal characteristics is the strong correlation between traffic flow status and historical time. Based on the difference in time scale, it can be further divided into short-term correlation and long-term correlation. Short-term correlation is mainly reflected in the close dependence between adjacent time steps. For example, the traffic flow at the current moment is directly affected by the flow status at the previous moment. At the same time, short-term correlation also includes the instantaneous impact of sudden disturbances, such as traffic accidents, extreme weather and other occasional events that cause sudden changes in flow rate or sudden drops in speed. Long-term correlation encompasses more macro-level time patterns: on the one hand, it manifests as trend changes, that is, the scale of traffic flow increases or decreases over a long period of time with factors such as urban population growth and regional functional adjustments, such as the annual increase in urban commuter traffic as the built-up area expands; on the other hand, it manifests as periodic patterns, including repetitive characteristics in the time dimension such as intraday cycles (such as the recurrence of traffic peaks during morning and evening rush hours on weekdays) and intraweekly cycles (such as the stable difference in traffic patterns between weekdays and weekends).
[0114] (3) Spatiotemporal correlation: Traffic data belongs to the typical category of spatiotemporal data, which contains complex spatiotemporal relationships. As can be seen from the time dependence and spatial correlation mentioned above, at a specific moment, the traffic state of a node may be affected by the historical state of adjacent nodes. This phenomenon constitutes spatiotemporal correlation. Therefore, providing more comprehensive spatiotemporal feature information for traffic prediction tasks can provide strong support for further improvement of model performance.
[0115] In summary, the core objective of traffic flow prediction is to uncover the hidden spatiotemporal patterns within traffic data, model and analyze the complex nonlinear relationships within the data, and extract the most effective spatiotemporal features to improve the accuracy of traffic prediction results. Specifically, this involves constructing a deep network model based on historical traffic flow time-series data to mine the dependencies between data points and predict future traffic flow conditions. This is achieved by learning from historical data [X]. t-p+1 ,X t-p+2 ,…,X t ], predicting data for a future period of time [X] t+1 ,X t+2 ,…,X t+q ], where p represents the length of historical data, q represents the length of predicted data, and t represents the current time.
[0116] Therefore, this embodiment 1 provides a traffic flow prediction system based on dual attention and depthwise separable graph convolution. This system effectively solves the technical problem that traditional traffic flow prediction methods struggle to simultaneously address the multi-scale feature requirements of short-term sudden fluctuations and long-term trends, as well as local road segment changes and global road network linkages. Please refer to [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic diagram of the modules of a traffic flow prediction system. The traffic flow prediction system includes:
[0117] I. Graph Structure Construction Module.
[0118] The graph structure construction module represents the historical road network traffic data in the form of a graph structure, obtains the set of nodes and adjacency matrix of the road network, represents the historical observation value of each node in the form of a signal matrix, and extracts the input signal matrix from the signal matrix according to a preset time step.
[0119] II. Graph Convolution Module.
[0120] The graph convolution module initializes the input signal matrix to generate node embedding features; it sparsifies the adjacency matrix to generate a sparse adjacency matrix; and it aggregates the node embedding features based on the graph topology represented by the sparse adjacency matrix to generate a feature aggregation matrix.
[0121] III. Dual Attention Module.
[0122] The dual attention module performs spatial attention and channel attention mechanisms on the feature aggregation matrix respectively, generating spatial attention matrix and channel attention matrix. The spatial attention matrix and channel attention matrix are then concatenated and fused to obtain the dual attention map.
[0123] IV. Depth-Separable Graph Convolution Module.
[0124] The depthwise separable graph convolution module calibrates the feature aggregation matrix to generate multiple two-dimensional tensors. Kernel combination and feature combination processing are then performed on these multiple two-dimensional tensors respectively. Finally, the kernel combination matrix and the feature combination matrix are output and fused to generate a depthwise separable graph.
[0125] V. Data Processing Module.
[0126] The data processing module performs weighted fusion of the dual attention map, the depth separable map, and the feature aggregation matrix to obtain the final embedding map.
[0127] VI. Temporal Convolution Module.
[0128] The temporal convolution module calculates traffic flow prediction data using the final embedding graph.
[0129] This embodiment 1 addresses the performance limitations of traditional traffic flow prediction systems based on graph neural networks (GNNs) in complex traffic scenarios. It proposes a traffic flow prediction system based on a dual attention mechanism and a deep separable graph convolutional network, which effectively improves the system's ability to capture long-range spatial dependencies, the efficiency of utilizing multi-dimensional features, and the robustness of extracting multi-scale features.
[0130] The following will provide a detailed introduction to each module:
[0131] I. Graph Structure Construction Module.
[0132] The graph structure construction module represents the road network traffic data obtained from historical observations in the form of a graph structure, obtaining the set of nodes and adjacency matrix of the road network. It then represents the historical observation values of each node in the road network using a signal matrix, obtaining the signal matrix of the road network. Finally, it extracts the input signal matrix from the signal matrix of the road network according to a preset time step.
[0133] S11. Represent the historically observed road network traffic data using a graph structure, resulting in the graph structure B=(V,E,A), where V represents the set of road network nodes, E represents the set of road network edges, and A represents the adjacency matrix of the road network. , when A ji When A = 1, it indicates that the two nodes j and i are connected; when A ji =0 indicates that the two nodes j and i are not connected; where j∈{1,2,...,N}, i∈{1,2,...,N}; A ji Let represent the element in the j-th row and i-th column of the adjacency matrix A. N represents the number of nodes in the road network. The number of nodes in the road network is the same as the number of sensors in the road network, and each node in the road network has D observations, including speed, flow rate, occupancy rate, etc.
[0134] S12, Represent the historical observations of each node in the road network using a signal matrix to obtain the signal matrix of the road network. , among which, T zong Given the total number of time steps in historical observations, when predicting future traffic flow at time t, the input signal matrix is constructed using the historical observation data from the most recent T consecutive time steps. Where C = T × D, T is the time dimension, and D is the feature dimension, and ; ,in, Let v represent the feature vector of node v at time t, where v∈{1,2,...,N}. The feature vector of node v contains all the traffic features of node v over the past T consecutive time steps.
[0135] II. Graph Convolution Module.
[0136] The graph convolution module initializes the input signal matrix and generates node embedding features; it sparsifies the adjacency matrix to generate a sparse adjacency matrix; and it aggregates the node embedding features based on the graph topology represented by the sparse adjacency matrix to generate a feature aggregation matrix.
[0137] In this embodiment, the graph convolution module processes the input signal matrix. Perform initialization operations to obtain node embedding features. For the adjacency matrix Sparsification is performed to obtain a sparse adjacency matrix. Based on the sparse adjacency matrix The graph topology represented provides node embedding features. Perform feature aggregation operations to generate a feature aggregation matrix. and aggregate the feature matrix Remodeling The specific operating steps are as follows:
[0138] S21, for the input signal matrix Initialization processing is performed to obtain node embedding features. ;
[0139] S211, for the input signal matrix Feature extraction and nonlinear activation are performed to obtain node feature representations. :
[0140] ;
[0141] ;
[0142] Where tanh is the hyperbolic tangent activation function, and tanh is a nonlinear activation function. Indicates the model training parameters, These are hyperparameters used to control the activation function;
[0143] S212, construct the asymmetric interaction matrix between J1 and J2. ,in, They are respectively transpose;
[0144] S213, for Nonlinear activation and ReLU activation are performed to obtain node embedding features. :
[0145] ;
[0146] in, For hyperparameters;
[0147] S22, regarding the adjacency matrix Sparsification is performed to obtain a sparse adjacency matrix. ;
[0148] S221, Index each node in the adjacency matrix:
[0149] ;
[0150] S222, find the index set adx of the h neighbor nodes with the largest connection weight among all neighbor nodes of node a, where a∈{1,2,...,N}, h∈{1,2,...,N};
[0151] ;
[0152] S223, keep the connection weights of the neighboring nodes in the index set adx of node a unchanged, and set the connection weights of all neighboring nodes of node a except for the index set adx to zero:
[0153] ;
[0154] After indexing each node, a sparse adjacency matrix is obtained. , where -adx is the index set of all neighboring nodes of node a, excluding the index set.
[0155] S23, based on the sparse adjacency matrix The graph topology represented provides node embedding features. Feature aggregation is performed on each node by aggregating its features with those of its neighboring nodes, resulting in a feature aggregation matrix. Where C = T × D, the feature aggregation matrix Remodeling .
[0156] III. Dual Attention Module.
[0157] The dual attention module performs spatial attention and channel attention mechanisms on the feature aggregation matrix respectively, outputting spatial attention matrix and channel attention matrix, and then concatenates and merges the spatial attention matrix and channel attention matrix to generate a dual attention map.
[0158] In this embodiment, the dual attention module aggregates the feature matrix. Spatial attention and channel attention mechanisms are executed separately to obtain spatial attention matrix O and channel attention matrix U. These two matrices are then concatenated and fused to generate a dual attention map. The dual attention module includes a positional attention module and a channel attention module, wherein:
[0159] 1. Location Attention Module.
[0160] Please see Figure 3 , Figure 3 This is a block diagram of the positional attention module. The positional attention module aggregates the feature matrix. The spatial attention mechanism is executed to obtain the spatial attention matrix O. The specific steps of the spatial attention mechanism are as follows:
[0161] S301, aggregate the feature matrix The input is fed into a regular convolutional layer, generating different feature maps b and c, where, ;
[0162] S302, Perform a reshaping operation on feature map b and feature map c to obtain the reshaped feature map. and the reshaped feature map , Where M = T × D, and M is the number of time series data;
[0163] S303, the reshaped feature map Transpose the image to obtain the transposed feature map. ,and ;
[0164] S304, transpose the feature map and the reshaped feature map Perform matrix multiplication to obtain a matrix ,matrix ;
[0165] S305, input matrix L1 into the Softmax layer to obtain the spatial attention map S, and ,in:
[0166] ;
[0167] in, Represents the transposed feature map The i-th column, Represents the reshaped feature map The j-th line above, S ji Represents the transposed feature map The i-th column on the reshaped feature map The degree of influence of the j-th row on the graph, where j∈{1,2,...,M}, i∈{1,2,...,M};
[0168] S306, aggregate the feature matrix The input is fed into the convolutional layer, generating a new feature map e. Feature map e is different from feature maps b and c, and ;
[0169] S307, Perform a reshaping operation on feature map e to obtain the reshaped feature map. ,in ;
[0170] S308, Transpose the spatial attention map S to obtain the transposed spatial attention map. ;
[0171] S309, for the reshaped feature map Spatial attention map after transposition Perform matrix multiplication to obtain a matrix ,matrix ;
[0172] S310, reshape matrix L2 to obtain the reshaped matrix. ;
[0173] S311, the reshaped matrix Multiply by a scaling parameter λ and combine with the feature aggregation matrix By performing element-wise addition, we obtain the spatial attention matrix. ,in:
[0174] ;
[0175] O j This represents the j-th row of the spatial attention graph matrix. Spatial attention map after transposition The element in the j-th row and i-th column, For the reshaped feature map The i-th column, H j Let λ be the j-th row of the feature aggregation matrix, where j∈{1,2,...,M}, i∈{1,2,...,M}, λ is initialized to 0, and more weights are gradually learned to be assigned.
[0176] 2. Channel Attention Module.
[0177] Please see Figure 4 , Figure 4 This is a block diagram of the channel attention module. The channel attention module aggregates the feature matrix. The channel attention mechanism is executed to obtain the channel attention matrix U. The specific steps of the channel attention mechanism are as follows:
[0178] S321, on the characteristic aggregation matrix The feature aggregation matrix is reshaped to obtain the reshaped feature aggregation matrix. And the reshaped feature aggregation matrix , where M = T × D, and M is the number of time series data;
[0179] S322, the reshaped feature aggregation matrix Transpose the matrix to obtain the transposed feature aggregation matrix. ;
[0180] S323, the reshaped feature aggregation matrix and the eigenaggregate matrix after transpose Perform matrix multiplication to obtain the matrix And matrix ;
[0181] S324, input matrix L3 into the Softmax layer to obtain the channel attention map G, and ,Right now:
[0182] ;
[0183] in, The reshaped feature aggregation matrix The i-th column, The characteristic aggregation matrix after transpose The j-th row, Represented as the reshaped feature aggregation matrix The i-th column is the eigenvalue aggregation matrix after transpose. The influence of the j-th row, where j∈{1,2,...,N}, i∈{1,2,...,N};
[0184] S325, transpose the channel attention map G to obtain the transposed channel attention map. ;
[0185] S326, transpose the channel attention map and the reshaped feature aggregation matrix Perform matrix multiplication to obtain the matrix And matrix ;
[0186] S327, Reshape matrix L4 to obtain the reshaped matrix. ,and ;
[0187] S328, the reshaped matrix Multiply by a scaling parameter β and aggregate with the feature matrix By adding elements one by one, we obtain the channel attention matrix. ,in:
[0188] ;
[0189] Among them, U j This represents the j-th row of the channel attention matrix U. The transposed channel attention map The element in the j-th row and i-th column, The reshaped feature aggregation matrix The i-th column, H j Let be the j-th row of the feature aggregation matrix H, where j∈{1,2,...,N} and i∈{1,2,...,N}, and β is the weight learned gradually from 0.
[0190] Finally, the dual attention module concatenates and merges the spatial attention matrix O and the channel attention matrix U to obtain a dual attention map.
[0191] The spatial attention matrix output by the location attention module is a fusion representation of the weighted aggregation of all location features and the original features; the channel attention matrix output by the channel attention module is a fusion representation of the weighted aggregation of all channel features and the original features. Specifically, in traffic flow prediction scenarios, the spatial attention map... S The contribution weights of traffic flow features at different locations within the road network are dynamically adjusted to fuse road network context information. Features of road segments with similar traffic states are mutually reinforced through attention weights, improving the effectiveness and accuracy of traffic flow feature representation. The channel attention matrix models the long-range semantic dependencies between feature maps, helping to improve the discriminative ability of road segment features. Location attention dynamically captures the long-range spatial dependencies of non-adjacent road segments in the road network, while channel attention dynamically weights multi-dimensional traffic features such as flow rate and speed in the road network to filter redundant interference. The two work together to improve the model's feature representation ability for complex traffic scenarios, thereby improving the accuracy of traffic flow prediction.
[0192] IV. Depth-Separable Graph Convolution Module.
[0193] The depthwise separable graph convolution module processes the feature aggregation matrix using a sliding window approach, applying a set of convolutional kernels at each window position. Each window is treated as a two-dimensional tensor, resulting in multiple two-dimensional tensors. Kernel combination processing and feature combination processing are performed on these multiple two-dimensional tensors respectively, outputting multiple kernel combination vectors and multiple feature combination vectors. The multiple kernel combination vectors are then weighted and fused to generate a kernel combination representation. Similarly, the multiple feature combination vectors are weighted and fused to generate a feature combination representation. The kernel combination representation and the feature combination representation are then reshaped into a kernel combination matrix and a feature combination matrix through 1×1 convolution, batch normalization, and ReLU activation, respectively. Finally, the kernel combination matrix and the feature combination matrix are weighted and fused to obtain the depthwise separable graph.
[0194] Both kernel combination and feature combination processing in depthwise separable convolution include depthwise convolution and pointwise convolution (ordinary convolution). The following will introduce ordinary convolution, depthwise convolution, and depthwise separable convolution:
[0195] 1. Ordinary convolution.
[0196] Ordinary convolutional layers process feature aggregation matrices using a sliding window approach. A set of convolution kernels is applied at each window location, treating each window as a two-dimensional tensor. This yields multiple two-dimensional tensors. ,in, It is the number of channels in the input feature map, and The trainable kernel of a regular convolutional layer is a three-dimensional tensor. ,in, This represents the number of channels in the output feature map. The following section uses a two-dimensional tensor P as an example to illustrate ordinary convolution operations.
[0197] The output feature vector of a two-dimensional tensor P after a regular convolution operation is E=W P, and ,in For ordinary convolution operators, the calculation formula is:
[0198] ;
[0199] in, This represents the eigenvalue of the g-th element in the output eigenvector E, where g∈{1,2,..., }; This represents the weight parameter in the g-th convolutional kernel corresponding to the z-th input position, where the index z is the result of the two-dimensional tensor P with dimensions (T×D) and N. in The expanded one-dimensional index, z, traverses all elements of the two-dimensional tensor P, z∈{1,2,...,(T×D)×N}. in}; This represents the input feature value at the z-th position of the flattened two-dimensional tensor P.
[0200] Please see Figure 5 , Figure 5 This is a schematic diagram of a standard convolution operation. Where T×D=4, N in =3, N out =2, each element of the output feature vector E is composed of a kernel ( The kernel is generated by performing a dot product operation between the three-dimensional tensor W and the two-dimensional tensor P. The kernel is the three-dimensional tensor W in the first dimension (…). ) slices, For a three-dimensional tensor W in the first dimension ( The g-th slice of ) and It is a unit with dimensions (T×D)×N in A two-dimensional matrix, denoted as Where g∈{1,2,..., During the computation, each slice of the 3D tensor W is vectorized and dot-producted with the 2D tensor P to generate scalar elements in the output feature vector E, which are the N values of the 3D tensor W in the convolutional layer. out Each convolution kernel (slice) performs a dot product operation with the entire two-dimensional tensor P.
[0201] 2. Depthwise convolution.
[0202] Deep convolutional layers process feature aggregation matrices using a sliding window approach. A set of convolution kernels is applied at each window location. Each window is treated as a two-dimensional tensor. This yields multiple two-dimensional tensors. ,in, It is the number of channels in the input feature map, and The trainable kernel of a deep convolutional layer is represented as a three-dimensional tensor. ,in, For depth multipliers, The following section uses a two-dimensional tensor P as an example to introduce the depthwise convolution operation.
[0203] The feature matrix output by a two-dimensional tensor P after a depthwise convolution operation is: , ,in, For depthwise convolution operators, the output of a depthwise convolution operation is a... The characteristic of dimension, its calculation formula is:
[0204] ;
[0205] in, Output feature matrix for depthwise convolution operation The element in the m-th row and n-th column, where m∈{1,2,..., }, n∈{1,2,..., }; For three-dimensional kernel tensor The weight parameters for the position (u,m,n) in the middle, where u∈{1,2,...,(T×D)}; For two-dimensional tensors The element in the u-th row and n-th column;
[0206] Please see Figure 6 , Figure 6 This is a schematic diagram of a depthwise convolution operation. Where T×D=4, N in =3, Nout =2, each element of the feature matrix F output by the depthwise convolution operation. Both are obtained by performing a dot product between the nth channel vector in the two-dimensional tensor P and the weight column vector corresponding to channel n in the three-dimensional tensor Y. In depthwise convolution operations, each N of the two-dimensional tensor P... in All channels will participate Each independent dot product operation, that is, each input channel of the two-dimensional tensor P is converted into a single dot product. A feature is a feature of a two-dimensional tensor P; one input channel of a two-dimensional tensor P is a feature of the two-dimensional tensor P. Dimensional features.
[0207] 3. Depth-separable graph convolution.
[0208] Depth-separable graph convolutional layers process feature aggregation matrices using a sliding window approach. A set of convolution kernels is applied at each window location. Each window is treated as a two-dimensional tensor. This yields multiple two-dimensional tensors. ,in, It is the number of channels in the input feature map, and A depthwise separable graph convolutional layer consists of a trainable convolutional kernel. and a trainable convolutional kernel as ,in, The feature vectors output by depthwise separable graph convolutional layers have the same characteristics as those output by ordinary convolutional layers. 3D features. The following will detail the steps of depthwise separable convolution:
[0209] S41, processing the feature aggregation matrix using a sliding window approach. A set of convolution kernels is applied at each window location. Each window is treated as a two-dimensional tensor. This yields multiple two-dimensional tensors. ,in, It is the number of channels in the input feature map, and .
[0210] S42, for multiple two-dimensional tensors Kernel combination processing is performed: First, the two trainable kernels Q and K contained in the depthwise separable convolution are merged into a standard convolution kernel. Then, the standard convolution kernel is used to perform convolution operations on multiple two-dimensional tensors P to obtain multiple kernel combination vectors, such as... Figure 7 As shown. For each of the plurality of two-dimensional tensors P, the following operation is performed:
[0211] S421, for trainable convolutional kernels and trainable convolutional kernels Perform a depthwise convolution operation to obtain a standard convolution kernel. ,and ;
[0212] Among them, trainable convolutional kernels It is a trainable convolutional kernel Transpose on the first and second axes;
[0213] S422, for standard convolutional kernels and two-dimensional tensors Perform a regular convolution operation to obtain the kernel combination vector. ,and ,in, This is a standard convolution operator;
[0214] S43, for multiple two-dimensional tensors Perform feature combination processing: for multiple two-dimensional tensors Perform depthwise convolution to obtain multiple feature vectors, then perform regular convolution on these feature vectors to obtain a combined feature vector, such as... Figure 8 As shown. For each of the plurality of two-dimensional tensors, the following operation is performed:
[0215] S431, for trainable convolutional kernels and two-dimensional tensors Perform depthwise convolution to obtain the features after depthwise convolution. ,and ;
[0216] S432, for trainable convolutional kernels Features after depthwise convolution Perform a regular convolution operation to output a feature combination vector. ,and ;
[0217] S44 combines multiple kernel vectors Perform weighted fusion to generate a kernel combinatorial representation. Combine multiple feature vectors Perform weighted fusion to generate a feature combination representation. ;
[0218] S45 represents the kernel combination through 1×1 convolution, batch normalization, and ReLU activation, respectively. and feature combination representation Remodeling into a core combination matrix and feature combination matrix ;
[0219] Specifically, 1×1 convolution expands the number of channels in the kernel combination representation and the feature combination representation to N; batch normalization (BN) and ReLU activation are used to optimize the features of the expanded kernel combination representation and the feature combination representation; the optimized kernel combination representation and the feature combination representation are then reshaped into kernel combination matrices. and feature combination matrix .
[0220] S46, the kernel combination matrix and feature combination matrix Weighted fusion is performed to generate a depth-separable graph.
[0221] V. Data Processing Module.
[0222] The data processing module integrates dual attention maps, depthwise separable maps, and feature aggregation matrices. The final embedded graph is obtained by weighted fusion. In this embodiment, the data processing module includes a block graph fusion module and a feature fusion module. The graph fusion module first performs a weighted fusion of the dual-attention map and the depthwise separable map to obtain the dual-attention separable map. The feature fusion module combines the dual-attention separable map and the feature aggregation matrix. Weighted fusion is performed to obtain the final embedded graph. .
[0223] VI. Temporal Convolution Module.
[0224] The temporal convolution module calculates traffic flow prediction data through the final embedding graph. In this embodiment, the temporal convolution module uses a gated TCN as the temporal dimension feature extraction module to capture multi-scale temporal patterns of traffic flow and efficiently process long time series. Unlike traditional temporal modeling approaches based on Long Short-Term Memory (LSTM) networks, which rely on a serial recursive mechanism, leading to a significant increase in training time for long sequences and being prone to gradient explosion or vanishing problems, the gated mechanism, through multi-scale convolutional kernels and dilated convolution mechanisms, can capture features from different time periods in a parallel computing manner.
[0225] S61, Extract the temporal feature sequence of each node from the final embedded graph R. The temporal convolution module independently processes the final embedded graph. For each node in the graph, specifically for the a-th node, where a∈{1,2,...,N}, the corresponding temporal feature sequence is extracted from the final embedded graph R. Perform calculations;
[0226] S62, Multi-scale Convolution: Features are extracted in parallel from the same temporal feature sequence r using convolutional kernels of different sizes, and then concatenated and fused to obtain multi-scale fused features. Convolutional kernels of various sizes include 1×3, 1×4, 1×7, and other sizes.
[0227] ;
[0228] in, This represents the convolution operator, and concat represents the concatenation operation.
[0229] S63, Gating Mechanism: A gating mechanism is used to process multi-scale fused features. Convolution is performed to obtain traffic flow prediction data y. The gating mechanism is defined as follows:
[0230] ;
[0231] in, and To provide a one-dimensional convolutional kernel with learnable characteristics, and and Different σ represents the element-wise multiplication operator, tanh is the hyperbolic tangent activation function, and σ is the sigmoid activation function.
[0232] In this embodiment, the temporal convolution module uses dilated convolution to efficiently capture long-range temporal dependencies, and both multi-scale convolution and gating mechanisms employ dilated convolution for computation. The mathematical definition is as follows: for a node's temporal feature sequence r and a trainable one-dimensional convolution kernel... The convolution output value at time t is:
[0233] ;
[0234] Where t is the current time; s is the position index within the convolution kernel (0 to k-1); k is the convolution kernel size (length); and d is the dilation factor (dilation rate), k×d=T; For the input sequence in time The value; The weight parameters of the convolution kernel at the s-th position of the input sequence; To use a convolution kernel of size k with dilation rate d at time t. f The output value obtained after convolving the sequence r.
[0235] As the inflation factor d increases, the receptive field in the time dimension expands exponentially. This characteristic allows the model to capture longer time series information with fewer stacked causal convolutions.
[0236] In other embodiments, a traffic flow prediction model based on dual attention and depthwise separable graph convolution, the DADSGCN model, is proposed. This model aims to capture the complex spatiotemporal correlation features in traffic flow data, providing support for improving prediction accuracy in complex traffic scenarios. The DADSGCN model includes: a graph convolution module (GCN), a dual attention module (DA-attention), a depthwise separable graph convolution module (DS-Conv), and a temporal convolution module (TCN), as follows: Figure 9 As shown.
[0237] The inputs to the DADSGCN model are the adjacency matrix A and the input signal matrix at time t. Output traffic flow prediction data y. The input signal matrix... The adjacency matrix A is input into the graph convolution module of the DADSGCN model to capture the node features of the fused graph structure. After preliminary processing, a feature aggregation matrix is obtained. This feature aggregation matrix is then input into both the depthwise separable convolution module and the dual attention module. The depthwise separable convolution module enhances the model's feature representation ability to improve the fitting effect on complex spatial features, resulting in a depthwise separable graph. The dual attention module dynamically allocates feature weights to focus on key spatiotemporal information for prediction, resulting in a dual attention map. The depthwise separable graph, dual attention map, and feature aggregation matrix are concatenated and fused to generate the final embedding graph. This final embedding graph is then input into the temporal convolution module, which, combined with the road network structure matrix, completes the modeling of spatial topological relationships, ultimately outputting the traffic flow prediction result.
[0238] The DADSGCN model also includes 1×1 convolution, BN units, and ReLU units. These units are used to process the depthwise separable map, the dual attention map, and the feature aggregation matrix, unifying their dimensions and standardizing their feature distributions. Important features are selected and activated, enabling weighted fusion of the depthwise separable map, the dual attention map, and the feature aggregation matrix.
[0239] To verify the effectiveness of the DADSGCN model, this Example 1 selected four large public datasets—PEMS03, PEMS04, PEMS07, and PEMS08—to conduct experiments on the DADSGCN model. The PEMS dataset is a commonly used dataset in the field of traffic flow prediction and analysis, and it was provided by the Department of Transportation Engineering and Urban Planning at the University of California, Berkeley. It covers real-time traffic information collected from multiple traffic detectors in California. The dataset records key indicators such as vehicle flow, speed, and traffic density, covering the traffic conditions of multiple major highways, expressways, and urban roads within the state.
[0240] It should be noted that PEMS03, PEMS04, PEMS07 and PEMS08 were all extracted from the PEMS main dataset. PEMS03, PEMS04, PEMS07 and PEMS08 are shown in Table 1. In this study, all datasets were divided into training set, validation set and test set in a ratio of 6:2:2.
[0241] In this experimental design, three traffic measurement methods were used, which correspond to the traffic data feature dimensions mentioned above, specifically including total flow, average speed, and average occupancy rate.
[0242] Table 1: Description of the dataset
[0243]
[0244] The main parameter settings for the DADSGCN model are shown in Table 2:
[0245] Table 2: Parameter Settings and Explanations for the DADSGCN Model
[0246]
[0247] To evaluate the prediction accuracy of the DADSGCN model, this experiment selected three evaluation metrics: Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and Mean Absolute Percentage Error (MAPE). The corresponding evaluation formulas are shown below:
[0248] ;
[0249] in, It is the actual observation value of the o-th sample. is the predicted value of the o-th sample, and w is the number of samples. A smaller MAE value indicates better predictive performance, as it represents the magnitude of the average prediction error. Furthermore, since MAE uses absolute error, it is insensitive to outliers, which is an advantage for datasets with unstable data.
[0250] ;
[0251] in, It is the actual observation value of the o-th sample. is the predicted value of the o-th sample, and w is the number of samples. The smaller the RMSE value, the better the model's predictive performance. Compared to MAE, RMSE pays more attention to large errors because it sums and averages the squared errors. However, RMSE also has a similar drawback to MAE, namely, it is sensitive to outliers.
[0252] ;
[0253] in, It is the actual observation value of the o-th sample. Here, is the predicted value for the o-th sample, and w is the number of samples. MAPE is calculated by averaging the ratios of the absolute difference between the true and predicted values to the true values. It reflects the proportion of prediction error relative to the true value. A smaller MAPE value indicates higher prediction accuracy and better model performance.
[0254] The DADSGCN model primarily integrates a graph convolution module, a dual attention module, and a depthwise separable graph convolution module. This experiment designed four different variants to compare and analyze each component in the model: positional attention module (PA), channel attention module (CA), dual attention module (DA), and depthwise separable graph convolution module (DS-Conv). Ablation experiments were conducted on the PEMS07 and PEMS08 datasets to evaluate their respective contributions to model performance. The performance comparison of each module is shown in Table 3.
[0255] Table 3: Performance Comparison of Each Module
[0256]
[0257] The data in the table shows that adding any module improves the prediction accuracy of the DADSGCN model, indicating that the modules used all contribute to improving prediction accuracy in traffic flow prediction tasks.
[0258] The dual-attention module effectively establishes long-range spatial relationships between non-adjacent road segments at the spatial association modeling level. The location attention module, by establishing global relationships between temporal data, overcomes the limitations of the fixed adjacency matrix in traditional GNNs, accurately capturing long-range contextual information of road segments at any spatial location in spatiotemporal data, thus achieving effective modeling of global spatial relationships in the traffic network. The channel attention module fully leverages the differentiated value of different feature channels, dynamically weights key channel features, filters redundant channel interference, and fully releases the value of multi-dimensional traffic features, improving feature utilization.
[0259] The depthwise separable graph convolution module achieves refined extraction of multi-scale traffic features by increasing the number of convolution kernels and expanding the parameter dimensions. At the same time, parameter redundancy improves the model's ability to resist interference (such as traffic flow changes during morning and evening peak hours). Compared with the convolution operation of traditional GNN, which is limited by the limited parameter scale and can only extract traffic features at a single scale, depthwise separable graph convolution can take into account the needs of complex features and improve prediction accuracy.
[0260] To verify the performance of the DADSGCN model, this experiment compares the proposed model with several mainstream models. The average prediction results of different models on different datasets are compared in the table. The core characteristics of each compared model are as follows:
[0261] ARIMA: Autoregressive Integral Moving Average Model. This method uses an autoregressive mechanism to capture time series dependencies and is a classic method in the field of traditional time series forecasting.
[0262] LSTM: Long Short-Term Memory model. This model, with its internal memory units, can learn and remember long-lasting regular patterns in traffic flow data to predict future traffic flow.
[0263] VAR: Vector Autoregression model. This model treats the traffic flow of multiple nodes in a traffic network as endogenous variables and jointly predicts future traffic conditions by analyzing their own historical values and the lagged effects between them.
[0264] DCRNN: Diffusion Convolutional Recurrent Neural Network model, which integrates diffusion convolution and encoder-decoder architecture, is specifically designed to build predictive models for nonlinear traffic flow to achieve accurate predictions.
[0265] STGCN: Spatiotemporal Graph Convolutional Neural Network Model, which mines the spatial correlation of road network through graph convolution operations, and at the same time uses a time series module to model the temporal dynamic characteristics of traffic flow.
[0266] ASTGCN: A spatiotemporal graph convolutional network based on attention mechanism. It models temporal dependencies through multi-periodic branches and integrates spatiotemporal attention and graph convolution operations to capture the spatial correlation and temporal fluctuations of the road network.
[0267] GraphWaveNet: This model learns an adaptive dependency matrix through node embedding techniques to capture the dynamic spatial relationships of the road network, while combining stacked dilated convolutions to extract long-term temporal dependency features.
[0268] STSGCN: Spatiotemporally Separated Graph Convolutional Network. Based on the spatiotemporal separation convolutional design, it captures the spatial relationships of the road network through graph convolution on the one hand, and models the temporal dynamics of traffic flow through temporal convolution on the other hand, and finally fuses features to complete traffic flow prediction.
[0269] AGCRN: Adaptive Graph Convolutional Recurrent Network. It learns and discovers unique patterns in road segments by adapting node parameters, dynamically constructs road network connections by using a data adaptive graph generation mechanism, and combines a recurrent network to model temporal dynamics. Finally, it integrates spatiotemporal features to complete traffic flow prediction.
[0270] MTGNN: A graph neural network for multivariate time series prediction, capable of capturing the unidirectional spatial dependencies of sensor nodes in traffic networks through adaptive learning, while extracting multi-scale temporal dynamic features.
[0271] STFGNN: Spatiotemporal Fusion Graph Neural Network, as a traffic flow prediction framework, generates a temporal graph through a dynamic time warping algorithm and fuses it with a spatial graph and a temporal connectivity graph to construct a spatiotemporal fusion graph; at the same time, it combines a gated dilated convolution module to capture long-distance temporal dependencies, and finally achieves parallel learning of local and global spatiotemporal dependencies.
[0272] DSTAGNN: Dynamic Spatiotemporal Aware Graph Neural Network. By integrating dynamic spatial attention mechanism, gated temporal attention module and graph convolution operation, it can effectively characterize dynamic spatiotemporal relationships and improve prediction accuracy in complex scenes.
[0273] The average prediction results of each model on datasets PEMS03, PEMS04, PEMS07, and PEMS08 are compared in Tables 4 and 5.
[0274] Table 4: Performance comparison of each model on datasets PEMS03 and PEMS04
[0275]
[0276] Table 5: Performance comparison of each model on datasets PEMS07 and PEMS08
[0277]
[0278] Tables 4 and 5 show the performance results of the DADSGCN model and other traffic flow prediction models in predicting traffic flow data for the next hour using traffic flow data from the past hour. The DADSGCN model performs well on most metrics across multiple datasets. In particular, on the PEMS08 dataset, the DADSGCN model achieves the best results across all metrics.
[0279] Analysis of the data in the table reveals that traffic flow prediction requires simultaneously modeling spatial road network relationships and temporal traffic dynamics, making it a typical complex spatiotemporal prediction problem. Traditional methods have significant limitations. Pure time-series methods (such as ARIMA) rely solely on historical traffic flow patterns, completely ignoring spatial transmission relationships between road segments within the road network. While single spatial modeling methods can capture local spatial features, they cannot handle long-range dependencies across regions and multi-dimensional feature redundancy. Therefore, these traditional methods generally exhibit high MAE (Modulation Error) on multiple datasets and have significant prediction errors for complex urban road networks, failing to meet practical needs.
[0280] Among the mainstream deep learning methods compared, the DADSGCN model demonstrates comprehensive and stable performance advantages. Compared to single-attention optimization models such as ASTGCN, GraphWaveNet, and AGCRN, the DADSGCN model uses a dual-attention mechanism to optimize features from both position and channel dimensions. This overcomes the limitations of traditional models that filter multiple feature channels and redundant features, significantly improving the model's ability to represent features in road network traffic scenarios. Furthermore, the parameter redundancy of deep separable graph convolution enhances its robustness against interference, addressing the issues of insufficient value release from multiple features and sensitivity to noise. Its effectiveness has been demonstrated on datasets, fully validating the superiority of the proposed architecture.
[0281] This experiment also compared the multi-step prediction performance of the DADSGCN model and the baseline model on the PEMS07 / 08 dataset, specifically comparing the short-term, medium-term, and long-term prediction performance of different models on the dataset. The short-term prediction performance was 0-15 minutes, the medium-term performance was 15-45 minutes, and the long-term performance was 45-60 minutes. The prediction results of the DADSGCN model and the baseline model are shown in Tables 6, 7, and 8.
[0282] Table 6: Short-term prediction results of the DADSGCN model and the baseline model on the dataset
[0283]
[0284] Table 7: Interim Prediction Results of the DADSGCN Model and Baseline Model on the Dataset
[0285]
[0286] Table 8: Long-term prediction results of the DADSGCN model and the baseline model on the dataset.
[0287]
[0288] To more clearly demonstrate the multi-step prediction results, this experiment presents the prediction results of the DCRNN, STGCN, ASTGCN, and DADSGCN models at 12 time steps on the PEMS08 dataset, as follows: Figure 10 and Figure 11 As shown, the overall trend analysis shows that with the increase of time steps, the MAE and RMSE of all models are on the rise. This indicates that as the prediction time length increases, the prediction difficulty of spatiotemporal series gradually increases, and the model's ability to capture and predict long-term time series information faces a more severe challenge.
[0289] The DADSGCN model exhibits significantly lower MAE and RMSE values than other comparative models across all time steps, with the smallest increase in MAE and RMSE over time, demonstrating superior prediction accuracy and long-term prediction stability. This advantage stems from the model's design in its dual attention mechanism and depthwise separable graph convolution module, which more accurately captures complex spatiotemporal dependencies in spatiotemporal sequences, thus maintaining good performance in long-term prediction tasks and providing a superior technical approach for long-term prediction of spatiotemporal sequences.
[0290] To fully verify the effectiveness of the model's predictive performance, a single node was selected on the PEMS08 dataset, and the prediction results of the DADSGCN model were visualized and compared with real traffic flow data. The results are as follows: Figure 12 and Figure 13 As shown, the predicted curve closely matches the actual curve numerically with minimal error. Furthermore, the traffic flow data exhibits significant periodicity, with the model's predicted values showing a high degree of consistency with the actual values' periodic trends, fully demonstrating the model's excellent ability to fit traffic flow time-series data.
[0291] Example 2
[0292] This embodiment 2 proposes a traffic flow prediction method based on dual attention and depthwise separable graph convolution. Please refer to [link to relevant documentation]. Figure 14 , Figure 14 This is a flowchart of the traffic flow prediction method in Example 2. The operation steps of the traffic flow prediction method are as follows:
[0293] S1, Represent the historical road network traffic data in the form of a graph structure to obtain the set of nodes and adjacency matrix of the road network, Represent the historical observation value of each node in the form of a signal matrix, and extract the input signal matrix from the signal matrix according to a preset time step;
[0294] S2, initialize the input signal matrix and generate node embedding features; sparsify the adjacency matrix to generate a sparse adjacency matrix; perform feature aggregation on the node embedding features based on the graph topology represented by the sparse adjacency matrix to generate a feature aggregation matrix;
[0295] S3: Perform spatial attention and channel attention mechanisms on the feature aggregation matrix respectively, output and fuse the spatial attention matrix and channel attention matrix to generate a dual attention map;
[0296] S4, perform calibration operation on the feature aggregation matrix to generate multiple two-dimensional tensors, perform kernel combination processing and feature combination processing on the multiple two-dimensional tensors respectively, output and fuse the kernel combination matrix and the feature combination matrix to generate a depth separable graph;
[0297] S5, weighted fusion of the dual attention map, the depth separable map, and the feature aggregation matrix to generate the final embedding map;
[0298] S6 generates traffic flow prediction data through the final embedded graph calculation.
[0299] In summary, the core advantages of this invention are:
[0300] 1. This invention proposes a dual attention module. The spatial dimension location attention module establishes global correlations between temporal data, overcoming the limitations of the fixed adjacency matrix in traditional GNNs. It accurately captures long-range contextual information of road segments at any spatial location in the spatiotemporal data, achieving effective modeling of global spatial correlations in the traffic network. The feature channel dimension channel attention module analyzes the interdependencies between feature channels, dynamically weights key channel features, filters redundant channel interference, and fully releases the value of multi-dimensional traffic features. Fusing the output features of the two modules significantly improves the model's ability to represent road network traffic scenarios.
[0301] 2. This invention proposes a depthwise separable graph convolution module. This module is designed with depthwise separable operations to address the characteristics of graph structures. By splitting the spatial correlation learning and feature transformation process of graph convolution, and combining multiple sets of lightweight graph convolution kernels with fine-tuning of parameter dimensions, it achieves simultaneous extraction of traffic features of different ranges and granularities in the road network. At the same time, through appropriate redundancy of the parameter space, it reduces the impact of occasional interference such as sensor noise and temporary traffic control on feature extraction, effectively avoiding the limitations of traditional graph convolution in feature extraction under fixed adjacency relationships, and further enhancing the model's feature robustness and dynamic adaptability to complex traffic scenarios.
[0302] 3. This invention uses multiple convolutional kernels of different sizes to extract features from the time feature sequence r, which solves the technical problem that the convolutional operation of traditional GNN is limited by the finite parameter scale and can only extract traffic features at a single scale.
[0303] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0304] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A traffic flow prediction method based on dual attention and depthwise separable graph convolution, characterized in that, Includes the following steps: S1, Represent the historical road network traffic data in the form of a graph structure to obtain the set of nodes and adjacency matrix of the road network, Represent the historical observation value of each node in the form of a signal matrix, and extract the input signal matrix from the signal matrix according to a preset time step; S2, perform feature extraction and nonlinear activation on the input signal matrix to obtain node feature representations, construct an asymmetric interaction matrix between node feature representations, and perform nonlinear activation and ReLU activation on the asymmetric interaction matrix to obtain node embedding features; Index each node in the adjacency matrix to obtain the index set of each node, and set the connection weights of all neighboring nodes of each node except its index set to zero to obtain the sparse adjacency matrix; perform feature aggregation on the node embedding features based on the graph topology represented by the sparse adjacency matrix to generate a feature aggregation matrix. S3: Perform spatial attention and channel attention mechanisms on the feature aggregation matrix respectively, output and fuse the spatial attention matrix and channel attention matrix to generate a dual attention map; S4, perform calibration operation on the feature aggregation matrix to generate multiple two-dimensional tensors, perform kernel combination processing and feature combination processing on the multiple two-dimensional tensors respectively, output and fuse the kernel combination matrix and the feature combination matrix to generate a depth separable graph; S5 fuses the dual attention map, the depthwise separable map, and the feature aggregation matrix to generate the final embedding map; S6 generates traffic flow prediction data through the final embedded graph calculation.
2. The traffic flow prediction method based on dual attention and depthwise separable graph convolution according to claim 1, characterized in that, The spatial attention matrix and the channel attention matrix are spliced and fused to generate a dual attention map; Furthermore, the kernel combination matrix and the feature combination matrix are weighted and fused to generate a depth-separable graph; Furthermore, the dual attention map, the depth separable map, and the feature aggregation matrix are weighted and fused to generate the final embedding map.
3. The traffic flow prediction method based on dual attention and depthwise separable graph convolution according to claim 1, characterized in that, The specific process of step S1 is as follows: S11. The historically observed road network traffic data is represented using a graph structure, resulting in a graph structure B=(V,E,A), where V represents the set of nodes in the road network, E represents the set of edges in the road network, and A represents the adjacency matrix of the road network. , when A ji When A = 1, it indicates that the two nodes j and i are connected; when A ji =0 indicates that the two nodes j and i are not connected; where j∈{1,2,...,N}, i∈{1,2,...,N}; A ji Let represent the element in the j-th row and i-th column of the adjacency matrix A. N represents the number of nodes in the road network. The number of nodes in the road network is the same as the number of sensors in the road network, and each node in the road network has a number of observations of D. S12, Represent the historical observations of each node in the road network using a signal matrix to obtain the signal matrix of the road network. , among which, T zong Given the total number of time steps in historical observations, when predicting future traffic flow at time t, the input signal matrix is constructed using the historical observation data from the most recent T consecutive time steps. Where C = T × D, T is the time dimension, and D is the feature dimension, and ; ,in, Let v represent the eigenvector of node v at time t, where v∈{1,2,...,N}.
4. The traffic flow prediction method based on dual attention and depthwise separable graph convolution according to claim 1, characterized in that, The specific process of step S2 is as follows: S21, for the input signal matrix Initialization processing is performed to obtain node embedding features. Where C = T × D, T is the time dimension, D is the feature dimension, N is the number of nodes in the road network, the number of nodes in the road network is the same as the number of sensors in the road network, and each node in the road network has D observations. S211, for the input signal matrix Feature extraction and nonlinear activation are performed to obtain node feature representations. : ; ; Where tanh is the hyperbolic tangent activation function, and tanh is a nonlinear activation function. Indicates the model training parameters, These are hyperparameters used to control the activation function; S212, construct the asymmetric interaction matrix between J1 and J2. ,in, They are respectively Transpose of; S213, for Nonlinear activation and ReLU activation are performed to obtain node embedding features. : ; in, For hyperparameters; S22, regarding the adjacency matrix Sparsification is performed to obtain a sparse adjacency matrix. ; S221, Index each node in the adjacency matrix: ; S222, find the index set adx of the h neighbor nodes with the largest connection weight among all neighbor nodes of node a, where a∈{1,2,...,N}, h∈{1,2,...,N}; ; S223, keep the connection weights of the neighboring nodes in the index set adx of node a unchanged, and set the connection weights of all neighboring nodes of node a except for the index set adx to zero: ; After indexing each node, a sparse adjacency matrix is obtained. Where -adx is the set of indices of all neighboring nodes of node a, excluding the index set; S23, based on the sparse adjacency matrix The graph topology represented provides node embedding features. Feature aggregation is performed on each node by aggregating its features with those of its neighboring nodes, resulting in a feature aggregation matrix. Where C = T × D, the feature aggregation matrix Remodeling .
5. The traffic flow prediction method based on dual attention and depthwise separable graph convolution according to claim 1, characterized in that, The specific steps of the spatial attention mechanism in step S3 are as follows: S301, aggregate the feature matrix The input is fed into the convolutional layer, generating feature map b and feature map c, where, T represents the time dimension, D represents the feature dimension, and N represents the number of nodes in the road network. Each node in the road network has D observations. S302, Perform a reshaping operation on feature map b and feature map c to obtain the reshaped feature map. and the reshaped feature map , Where M = T × D, and M is the number of time series data; S303, the reshaped feature map Transpose the image to obtain the transposed feature map. ; S304, transpose the feature map and the reshaped feature map Perform matrix multiplication to obtain a matrix ,matrix ; S305, input matrix L1 into the Softmax layer to obtain the spatial attention map. ; S306, aggregate the feature matrix The input is fed into a convolutional layer to generate a feature map. ; S307, Perform a reshaping operation on feature map e to obtain the reshaped feature map. ,in ; S308, Transpose the spatial attention map S to obtain the transposed spatial attention map. ; S309, for the reshaped feature map Spatial attention map after transposition Perform matrix multiplication to obtain a matrix ,matrix ; S310, reshape matrix L2 to obtain the reshaped matrix. ; S311, the reshaped matrix Multiply by a scaling parameter λ and combine with the feature aggregation matrix By performing element-wise addition, we obtain the spatial attention matrix. .
6. The traffic flow prediction method based on dual attention and depthwise separable graph convolution according to claim 1, characterized in that, The specific steps of the channel attention mechanism in step S3 are as follows: S321, on the characteristic aggregation matrix The feature aggregation matrix is reshaped to obtain the reshaped feature aggregation matrix. Where M = T × D, M is the number of time series data; T is the time dimension, D is the feature dimension, and N is the number of nodes in the road network. Each node in the road network has D observations. S322, the reshaped feature aggregation matrix Transpose the matrix to obtain the transposed feature aggregation matrix. ; S323, the reshaped feature aggregation matrix and the eigenaggregate matrix after transpose Perform matrix multiplication to obtain a matrix And matrix ; S324, input matrix L3 into the Softmax layer to obtain the channel attention map. ; S325, transpose the channel attention map G to obtain the transposed channel attention map. ; S326, transpose the channel attention map and the reshaped feature aggregation matrix Perform matrix multiplication to obtain a matrix And matrix ; S327, Reshape matrix L4 to obtain the reshaped matrix. ,and ; S328, the reshaped matrix Multiply by a scaling parameter β and aggregate with the feature matrix By adding elements one by one, we obtain the channel attention matrix. .
7. The traffic flow prediction method based on dual attention and depthwise separable graph convolution according to claim 1, characterized in that, The specific steps for step S4 are as follows: S41, processing the feature aggregation matrix using a sliding window approach. And apply a set of convolution kernels at each window location; treat each window as a two-dimensional tensor. Multiple two-dimensional tensors are obtained. ,in, It is the number of channels in the input feature map. Depthwise separable graph convolutions include a trainable convolutional kernel. and a trainable convolutional kernel as ,in, It is the number of channels in the output feature map. For depth multipliers, T represents the time dimension, D represents the feature dimension, and N represents the number of nodes in the road network. Each node in the road network has D observations. S42, for multiple two-dimensional tensors Kernel combination processing is performed: First, the two trainable kernels Q and K contained in the depthwise separable convolution are merged into a standard convolution kernel. Then, the standard convolution kernel is used to perform convolution operations on multiple two-dimensional tensors P to obtain multiple kernel combination vectors. For each of the multiple two-dimensional tensors, the following operations are performed: S421, for trainable convolutional kernels and trainable convolutional kernels Perform a depthwise convolution operation to obtain a standard convolution kernel. , ; Among them, trainable convolutional kernels It is a trainable convolutional kernel Transpose on the first and second axes; This is the depthwise convolution operator; S422, for standard convolutional kernels and two-dimensional tensors Perform a regular convolution operation to obtain the kernel combination vector. ,and ;in, This is a standard convolution operator; S43, for multiple two-dimensional tensors Perform feature combination processing: for multiple two-dimensional tensors Perform depthwise convolution to obtain multiple depthwise convolutional features. Then, perform ordinary convolution on these features to obtain multiple feature combination vectors. For each of the multiple two-dimensional tensors, perform the following operations: S431, for trainable convolutional kernels and two-dimensional tensors Perform depthwise separable convolution operations to obtain the features after depthwise convolution. ,and ; S432, for trainable convolutional kernels Features after depthwise convolution Perform a regular convolution operation to obtain the feature combination vector. ,and ; S44 combines multiple kernel vectors Perform weighted fusion to generate a kernel combinatorial representation. Combine multiple feature vectors Perform weighted fusion to generate a feature combination representation. ; S45 represents the kernel combination through 1×1 convolution, batch normalization, and ReLU activation. Remodeling into a core combination matrix , representing feature combination Reshaping into a feature combination matrix ; S46, the kernel combination matrix and feature combination matrix Weighted fusion is performed to generate a depth-separable graph.
8. The traffic flow prediction method based on dual attention and depthwise separable graph convolution according to claim 1, characterized in that, In step S5, the dual attention map and the depthwise separable map are first weighted and fused to obtain the dual attention separable map; then the dual attention separable map and the feature aggregation matrix are... Weighted fusion is performed to obtain the final embedded graph. Where T is the time dimension, D is the feature dimension, and N is the number of nodes in the road network. Each node in the road network has D observations.
9. The traffic flow prediction method based on dual attention and depthwise separable graph convolution according to claim 1, characterized in that, The specific steps for step S6 are as follows: S61, from the final embedded graph Extract the time feature sequence of each node Where T is the time dimension, D is the feature dimension, and N is the number of nodes in the road network. Each node in the road network has D observations. S62, Multi-scale Convolution: Features are extracted in parallel from the same temporal feature sequence r using convolutional kernels of different sizes, and then concatenated and fused to obtain multi-scale fused features. : ; S63, Gating Mechanism: A gating mechanism is used to process multi-scale fused features. Perform convolution to obtain traffic flow prediction data y, where: ; in, and It is a one-dimensional convolutional kernel with learnable properties, and and Different σ represents the element-wise multiplication operator, tanh is the hyperbolic tangent activation function, and σ is the sigmoid activation function. This represents the convolution operator; Furthermore, the convolution operations in multi-scale convolution and gating mechanisms both employ dilated convolution. The mathematical definition of dilated convolution is as follows: for a node's temporal feature sequence r and a trainable one-dimensional convolution kernel... The convolution output value at time t is: ; Where t is time; s is the position index within the convolution kernel; k is the convolution kernel size; and d is the dilation factor, k×d=T; For the input sequence in time The value; The weight parameters of the convolution kernel at the s-th position of the input sequence; To use a convolution kernel of size k with dilation rate d at time t. f The output value obtained after convolving the sequence r.
10. A traffic flow prediction system based on dual attention and depthwise separable graph convolution, characterized in that, A traffic flow prediction method based on dual attention and depthwise separable graph convolution, applicable to any one of claims 1-9, comprises: Graph structure construction module: Represents the historical road network traffic data in the form of a graph structure, obtains the set of nodes and adjacency matrix of the road network, represents the historical observation value of each node in the form of a signal matrix, and extracts the input signal matrix from the signal matrix according to a preset time step; The graph convolution module is used to initialize the input signal matrix to obtain node embedding features; to sparsify the adjacency matrix to obtain a sparse adjacency matrix; and to aggregate the node embedding features based on the graph topology represented by the sparse adjacency matrix to generate a feature aggregation matrix. Dual attention module: It is used to perform spatial attention mechanism and channel attention mechanism on feature aggregation matrix respectively to obtain spatial attention matrix and channel attention matrix. The spatial attention matrix and channel attention matrix are concatenated and fused to obtain dual attention map; The depth-separable graph convolution module performs calibration operations on the feature aggregation matrix to generate multiple two-dimensional tensors. Kernel combination and feature combination are performed on the multiple two-dimensional tensors respectively. The kernel combination matrix and feature combination matrix are output and fused to generate a depth-separable graph. Data processing module: used to perform weighted fusion of dual attention map, depth separable map, and feature aggregation matrix to obtain the final embedding map; Temporal convolution module: Used to generate traffic flow prediction data through the final embedding graph.
Citation Information
Patent Citations
Flow prediction method based on parallel attention network and stacked gating circulation unit
CN117313930A