Space-time graph attention based urban road network travel time prediction method and related device

By constructing a weighted directed graph and a dynamic directed graph attention mechanism, combined with topology-aware temporal attention, the spatial dependency staticization and gradient vanishing problems of existing highway network prediction methods are solved, achieving high-precision travel time prediction for urban highway networks and improving the robustness and adaptability of the model.

CN122452884APending Publication Date: 2026-07-24湖南工商大学
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
湖南工商大学
Filing Date
2026-06-26
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing technologies struggle to process non-Euclidean spatial data. Traditional prediction methods disrupt the natural linear physical connection structure of highway networks, fail to effectively capture key information over long time periods, and exhibit static spatial dependency modeling, neglecting the complex topological connections of urban highway networks.

Method used

A method for predicting travel time in urban road networks using spatiotemporal graph attention is proposed. This method constructs a weighted directed graph and historical time-series data, and combines topological sensing time attention mechanism and dynamic directed graph attention mechanism to perform feature fusion and prediction. The model is trained using a total loss function consisting of the masked mean absolute error and the sum of L2 regularization terms.

Benefits of technology

It achieves high-precision travel time prediction for urban expressway networks, solves the static problem of spatial dependency modeling in traditional methods, improves the ability to capture complex topological structures, prevents gradient vanishing and pseudo-label interference, and improves the robustness and adaptability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122452884A_ABST
    Figure CN122452884A_ABST
Patent Text Reader

Abstract

The present application belongs to the field of intelligent transportation system and data processing technology, and relates to a kind of space-time graph attention's urban road network travel time prediction method and related equipment, wherein the method comprises: constructing the weighted directed graph and historical time series data of target city highway network;Based on the topological perception time attention mechanism of highway network node physical bottleneck constraint processing, the global dependence characteristics of historical time series data are obtained;Dynamic directed graph attention mechanism based on physical prior and data-driven state linkage decoupling is used for processing, and high-dimensional space-time feature representation is obtained;Based on the gating mechanism, the obtained complete output tensor is fused to predict;The total loss function of the sum of the average absolute error with mask and L2 regularization term is used for model training, and the space-time graph attention's urban road network travel time prediction model is obtained and prediction is carried out, and the road network travel time prediction accuracy is improved by the above scheme.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent transportation systems and data processing technology, and in particular to a method and related equipment for predicting travel time in urban road networks using spatiotemporal graph attention. Background Technology

[0002] Travel time, as a core indicator for measuring the operational status of a highway transportation system, can provide travelers with reasonable route planning suggestions, help managers formulate scientific traffic control measures such as ramp control, lane management, and dynamic speed limits, improve the traffic efficiency of urban highway networks, and is of great significance for alleviating urban highway congestion.

[0003] However, existing prediction methods still have significant shortcomings in real-world, complex urban highway network scenarios. Early prediction techniques mostly employed statistical methods such as autoregressive moving average models and Kalman filtering, or traditional machine learning methods such as support vector regression. However, these methods are largely based on linear assumptions and struggle to capture the complex nonlinear characteristics of highway traffic flow influenced by nodes such as toll booths and ramps. With the development of deep learning, models based on convolutional neural networks (CNNs) and recurrent neural networks (RNNs) have been widely used. While these have improved prediction accuracy to some extent, standard CNNs are only suitable for Euclidean grid data and cannot handle linearly distributed highway network data. RNNs, on the other hand, suffer from the gradient vanishing problem when processing long sequences, making it difficult to effectively handle the temporal dependencies between long-distance upstream and downstream highway segments. Currently, spatiotemporal prediction models based on graph neural networks have become mainstream. They utilize graph convolution operators to extract spatial features and combine sequence models to extract temporal features, significantly improving prediction performance. However, their ability to model dynamic spatial correlations such as ramp inflows and outflows and toll booth queues in highway networks remains insufficient.

[0004] The aforementioned prior art has the following drawbacks: (1) It is difficult to process non-Euclidean space data. Traditional prediction methods usually require dividing urban areas into regular grids, which destroys the natural linear physical connection structure of the highway network and leads to deviations in the extraction of spatial distribution characteristics of highway traffic flow on different levels of road segments. (2) The capture of key information in long time series is weak. Traditional recurrent neural networks often suffer from the gradient vanishing problem when processing long-sequence historical data, and they treat all historical moments the same, making it difficult to accurately select the time segments that have the most influence on the current prediction from the historical records of long-lasting morning and evening peak hours on highways and tidal traffic fluctuations during holidays. (3) Spatial dependency modeling is static. Existing graph convolutional networks mostly rely on predefined fixed adjacency matrices. Actual high-speed traffic flow changes dynamically due to the influence of real-time events. Fixed weights cannot adaptively adjust the influence of neighboring nodes according to real-time traffic conditions. (4) Ignoring the spatial topology of the highway network, traditional time series forecasting methods often treat each highway segment as an independent entity and use only a single historical data for modeling. They ignore the complex upstream and downstream topological connections in the urban highway network and cannot capture the spatial dependence of mutual influence between road segments in scenarios such as ramp merging and merging. Summary of the Invention

[0005] Aimed at at least in solving one of the technical problems existing in the prior art, the present invention provides a method and related equipment for predicting travel time in urban road networks using spatiotemporal graph attention.

[0006] One aspect of the present invention provides a method for predicting travel time in urban road networks using spatiotemporal graph attention, comprising: Acquire historical traffic data collected by sensors in the highway network of the target city, including historical travel time, historical speed, historical traffic flow and sensor coordinates; Based on the historical traffic data, a weighted directed graph of the target city's expressway network and historical time-series data are constructed. The historical time series data is processed using a topology-aware time attention mechanism based on the physical bottleneck constraints of highway network nodes to obtain the global dependency features of the historical time series data. A dynamic directed graph attention mechanism based on physical prior and data-driven state linkage decoupling is used to process the global dependency features to obtain a high-dimensional spatiotemporal feature representation. We perform feature fusion on global dependency features and high-dimensional spatiotemporal features based on a gating mechanism, and use the resulting complete output tensor for travel time prediction. The model is iteratively trained using a total loss function consisting of the masked mean absolute error and the sum of L2 regularization terms to obtain a spatiotemporal graph attention-based urban road network travel time prediction model. The travel time prediction model for urban road networks using spatiotemporal graph attention is used to predict the travel time of the target city's expressway network, and the travel time prediction results are obtained.

[0007] The urban road network travel time prediction method based on spatiotemporal graph attention further includes preprocessing historical traffic data. If historical traffic data shows anomalies, the data should be processed within the valid data threshold range. Detect and remove outliers from historical traffic data; If historical traffic data is missing, the data will be filled in segments according to the missing time period and the preset time step: If the missing time period is less than or equal to the preset time step, the missing status is inferred based on the valid observations before and after it. The calculation formula is as follows: ; in, For nodes At any moment Observations The missing state, and They are respectively and The corresponding true valid observations, This represents the total number of time steps between two valid observations. This represents the relative time step offset between the current missing time and the previous valid time. If the missing time period is longer than the preset time step, the missing state is filled in according to the average value of the sensor's historical time periods; Z-score data standardization was performed on the historical traffic data after missing data filling: ; in, These are the standardized eigenvalues. To train the global average of historical traffic data, This represents the standard deviation of the historical traffic data in the training set.

[0008] The urban road network travel time prediction method based on spatiotemporal graph attention includes constructing a weighted directed graph of the target city's expressway network and historical time-series data based on the historical traffic data, including: The weighted directed graph is ,in This represents the set of nodes, indicating the locations of sensors within the target city's highway network. This represents the total number of sensors; This represents a set of edges, describing the connection relationships between sensor nodes; It is an adjacency matrix used to quantitatively describe the spatial proximity between nodes in the road network; The upstream and downstream flow directions between nodes are identified based on the topological relationships of the weighted directed graph road network. These directions are determined using a directed adjacency matrix, with weights calculated using a Gaussian kernel function. The directed adjacency matrix is ​​as follows: ; in, Represents a node and The directed adjacency matrix, Represents a node and The topological shortest path distance, It is the standard deviation of the distance, calculated based on the overall node spacing distribution of the urban expressway network; This is a distance threshold used to filter out irrelevant nodes that are too far away; The traffic data of the target city's expressway network over the historical observation period are integrated into a three-dimensional global feature tensor. ,in This represents the number of nodes in the spatial structure of the urban expressway network. The traffic characteristic dimension of each node at a single moment. This represents the total time steps included in the dataset; The input sequence tensor is obtained by truncating along the time axis using a sliding window method with a fixed step size. for: ; in, For the current moment, The length of the historical observation window. To predict the length of the time window; With time At the time The actual travel time data is used as the actual target label tensor. for: ; The real target label tensor and input sequence tensor Determine historical time-series data.

[0009] According to the urban road network travel time prediction method based on spatiotemporal graph attention, the historical time-series data is processed using a topology-aware time attention mechanism based on physical bottleneck constraints of highway network nodes to obtain global dependency features of the historical time-series data, including: Global dependency modeling is constructed based on historical time-series data, where the neural network... The input feature tensor of the layer is The three-dimensional feature tensor of historical time series data Preserve along the time dimension, and preserve the spatial node dimension. With feature channel dimension Flattening and merging yields a reconstructed two-dimensional matrix. ; Employing a learnable time-dependent strength matrix For any two time steps and Calculate the correlation score, where the time dependence strength matrix is... for: ; in, This is the transpose of the input matrix; This is the topological constraint projection matrix for the urban expressway network, used to project the global state of the high-dimensional urban expressway network onto a low-dimensional manifold with the physical nodes of the urban expressway network as the basis vectors. The feature transformation matrix is ​​used for feature interaction within the hidden space, and the correlation score is used to characterize the result of the co-evolution of the states of all nodes. This is the inverse projection matrix, used to map the interactive features back to the original spatial dimension; This is the output projection matrix, used to adjust the final dimension of the attention score; This is the bias matrix, used to enhance the model's fitting ability; Use the Sigmoid activation function; time dependence strength matrix The event attention matrix is ​​obtained by normalization using the Softmax function. for: ; in, The range of is (0,1), and The matrix represents the extraction of the current time step. When providing information, historical time steps The degree of importance; Through attention matrix By reconstructing and enhancing the input feature tensor, we obtain the global dependency features of historical time series data. for: ; Among them, global dependency features Enhanced features for characterizing global temporal context.

[0010] According to the urban road network travel time prediction method based on spatiotemporal graph attention, the globally dependent features are processed using a dynamic directed graph attention mechanism based on the decoupling of physical priors and data-driven state linkage, resulting in a high-dimensional spatiotemporal feature representation, including: Global dependency features Slice at each time Extraction is performed to obtain the spatial feature matrix. The spatial feature matrix is ​​obtained through the attention head. Mapping to the feature subspace yields the mapped intermediate features. for: ; in, Spatial characteristic matrix The middle corresponds to the node The Row feature vector, including the node at time t. All channel attributes, For the number of attention heads, For attention head index; Nodes are computed independently in each feature subspace Its neighboring nodes correlation coefficient A single-layer feedforward neural network is used as the attention scoring function, and the calculation formula is as follows: ; in, This represents a vector concatenation operation; It is the first Learnable attention weight vectors within each subspace This represents the dimension of the feature subspace after mapping a single attention head; is a learnable, adjustable parameter; LeakyReLU is a non-linear activation function; compute nodes First-order neighbor nodes Attention coefficients, where the neighbor set From the adjacency matrix It is determined that the coefficients in each subspace are normalized using the Softmax function to obtain the first... Normalized attention weights from each perspective for: ; in, Indicates the first In each feature subspace, neighbor nodes For the central node The degree of impact; Based on normalized attention weights In each subspace, the features of neighboring nodes are aggregated independently to obtain the spatial feature representation of the central node from the corresponding perspective. for: ; in The LeakyReLU nonlinear activation function is used. Only including the first Spatial information from one perspective; By splicing operations The output vectors of each attention head are merged to obtain the output features of the spatial graph attention layer. : ; in, The flattened one-dimensional vector represents a high-dimensional spatiotemporal feature representation that integrates complex spatial topology and dynamic traffic flow correlation.

[0011] According to the urban road network travel time prediction method based on spatiotemporal graph attention, the global dependency features and high-dimensional spatiotemporal features are fused using a gating mechanism, and the resulting complete output tensor is used for travel time prediction, including: A multi-head dynamic spatial graph attention mechanism is employed to output high-dimensional feature vectors through concatenation operations. A linear transformation is used to map high-dimensional feature vectors back to the core feature dimensions of the model. : ; in, This represents the spatial context features after dimensionality reduction. For a learnable parameter matrix, It is the bias vector; Based on the spatiotemporal gating fusion mechanism, spatial context features Fusion is performed, where the control coefficient of the fusion gate is... for: ; in, Output tensors for the time attention module At the node With time eigenvectors; This represents the splicing of temporal and spatial features along the channel dimension; This is the gated weight matrix; For bias terms; Use the Sigmoid activation function to ensure that the gating coefficient is in the range [0,1]. Through control coefficients Perform weighted fusion: ; in, It represents the Hadamah accumulation. The spatiotemporal characteristics after fusion; The fused spatiotemporal features are then subjected to residual connections and normalization to obtain the final output features of each layer of the neural network. for: ; in, The latest spatiotemporal features of the current layer output by the gating fusion mechanism. To enter the The initial raw input vector during layer feature extraction; LayerNorm is the layer normalization function. Use two layers Convolution is used for travel time prediction, including the final output features. In the time dimension and feature dimensions The above is recombined and flattened to obtain the reconstructed three-dimensional feature tensor. Through the first layer Convolution performs cross-channel information recombination and feature dimensionality reduction, represented as: ; in, This represents the convolution operator. The learnable weight matrix of the first convolutional kernel. The number of hidden layer channels is set. For bias terms, It is a non-linear activation function; Through the second layer Convolution maps hidden layer features to target prediction stride. for: ; in, These are the weights of the second-layer convolutional kernel. As the bias term, the calculated shape of the prediction tensor is as follows: After the spatial dimension reduction operation, the final output prediction tensor Among them, the prediction tensor elements in Representing the city's expressway network The node in the future The predicted travel time for each time step.

[0012] According to the spatiotemporal graph attention-based urban road network travel time prediction method, the model is iteratively trained using a total loss function consisting of a masked mean absolute error and an L2 regularization term, resulting in a spatiotemporal graph attention-based urban road network travel time prediction model, including: The total loss function for: ; in, Indicates the future The actual time-labeled tensor of each time step. It is a binary mask matrix; and Representing the prediction tensor respectively and the real label tensor Numerical elements in This represents the set of all learnable parameters in the model. This is the preset L2 regularization coefficient.

[0013] Another aspect of the present invention provides an urban road network travel time prediction device with spatiotemporal graph attention, comprising: The first module is used to acquire historical traffic data collected by sensors in the highway network of the target city. The historical traffic data includes historical travel time, historical speed, historical flow and sensor coordinates. The second module is used to construct a weighted directed graph of the target city's expressway network and historical time-series data based on the historical traffic data. The third module is used to process historical time series data using a topology-aware time attention mechanism based on the physical bottleneck constraints of highway network nodes, so as to obtain the global dependency features of historical time series data. The fourth module is used to process the global dependent features using a dynamic directed graph attention mechanism based on the decoupling of physical priors and data-driven state linkage, so as to obtain a high-dimensional spatiotemporal feature representation. The fifth module is used to perform feature fusion on global dependent features and high-dimensional spatiotemporal feature representations based on a gating mechanism, and to predict travel time using the obtained complete output tensor. The sixth module is used to perform iterative training of the model using the total loss function of the sum of the masked mean absolute error and the L2 regularization term, to obtain the urban road network travel time prediction model with spatiotemporal graph attention. The seventh module is used to predict the travel time of the target city's expressway network using a city road network travel time prediction model based on spatiotemporal graph attention, and obtain the travel time prediction results.

[0014] Another aspect of the present invention provides an electronic device, including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method as described above.

[0015] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the methods described above.

[0016] The beneficial effects of this invention are as follows: (1) The projection feature dimension in the time attention calculation is strictly constrained to the number of physical nodes "N" in the real road network. This design transforms the real topology of the road network into a "physical bottleneck layer" for time-dependent calculation, so that the correlation extraction of different time steps is transformed from traditional unconstrained numerical matching to topological co-evolution verification constrained by the spatial distribution of the road network. This mechanism avoids the distraction of attention caused by high-dimensional inner product, and fundamentally prevents the destruction of the relative spatial relationship of nodes during the dimensionality reduction process, thus realizing the topological purification of long-term key historical information of complex road networks.

[0017] (2) To address the limitations of existing technologies that rely solely on data-driven approaches or statically superimpose physical distance as a fixed bias, this invention constructs a state-triggered directed decoupling mechanism. First, by splicing asymmetric node features, the directed propagation physical characteristics of traffic flow upstream and downstream are accurately characterized. Second, a learnable adjustment parameter γ is introduced to interact with the aforementioned asymmetric splicing features. In free-flow conditions, physical priors and directed data features work synergistically; when sudden anomalies such as traffic accidents occur, causing the actual propagation logic to deviate from the static topology expectation, the model can learn to adaptively reduce the weight bias of the fixed topology when conflicts arise between the physical priors and real-time data through the global constraint of the physical priors by the parameter γ, thus achieving adaptive decoupling between topological constraints under normal conditions and dynamic evolution under extreme anomalies.

[0018] (3) Bimodal adaptive gating mechanism for oversmoothing defense in graph networks Unlike existing technologies that merely use gating units as conventional feature scaling regulators, this invention deeply mines the high-frequency independent components of nodes retained in temporal features that have not undergone cross-node spatial aggregation. When the model perceives that the features of the target node and its neighbors tend to converge due to oversmoothing during propagation in the deep network, the gradient signal adaptively drives the gating coefficients to cut off spatial pathways and amplify the weights of temporal features, actively injecting high-frequency independent temporal information into the fusion result to combat feature convergence. This mechanism, combined with residual connections, constructs a structured dual oversmoothing defense system, ensuring that the model can maintain the spatial heterogeneity of nodes in each road segment when extracting complex spatiotemporal features from stacked deep networks.

[0019] (4) To address the problem of pseudo-labels interfering with the model due to missing data filling in the real road network, this invention breaks through the limitations of conventional independent module splicing and constructs a collaborative immune closed-loop architecture. In the prediction output stage, a 1×1 convolutional channel mapping architecture is adopted, utilizing its mathematical characteristic that the receptive field is limited to a single node to cut off the lateral spatial transmission path of pseudo-labels to adjacent normal nodes from the physical link; in the gradient backpropagation stage, a masking mechanism is introduced to reconstruct the loss function, completely blocking the vertical gradient transmission path of pseudo-labels interfering with the global network parameters. This joint defense architecture endows the model with high robustness in real noisy environments such as sensor failures. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the urban road network travel time prediction process based on spatiotemporal graph attention, according to an embodiment of the present invention.

[0021] Figure 2 This is a schematic diagram of the model structure of an embodiment of the present invention.

[0022] Figure 3 This is a schematic diagram of a city road network travel time prediction device based on spatiotemporal graph attention according to an embodiment of the present invention. Detailed Implementation

[0023] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings. Throughout the description, the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions. In the following description, suffixes such as "module," "part," or "unit" used to denote elements are used only for the purpose of illustrative purposes and have no specific meaning in themselves. Therefore, "module," "part," or "unit" can be used interchangeably. Terms such as "first," "second," etc., are used only to distinguish technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the sequential relationship of the indicated technical features. In the following description, the consecutive reference numerals for method steps are for ease of review and understanding. Adjusting the implementation order of steps, in conjunction with the overall technical solution of the present invention and the logical relationship between the various steps, will not affect the technical effect achieved by the technical solution of the present invention. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0024] Figure 1 This is a schematic diagram of the urban road network travel time prediction process using spatiotemporal graph attention according to an embodiment of the present invention. Figure 2 This is a schematic diagram of the model structure of an embodiment of the present invention, namely, the network structure diagram of the urban road network travel time prediction model. It includes, in sequence, an input layer, a topology-aware temporal attention structure, a dynamic directed graph attention structure, a gated fusion structure, and a prediction output layer structure. Please refer to the diagram. Figure 1 and Figure 2 ,in Figure 1 Including but not limited to steps S100~S700: S100: Acquire historical traffic data collected by sensors in the target city's highway network, including historical travel time, historical speed, historical traffic flow, and sensor coordinates.

[0025] In some embodiments, such as Figure 2The input layer includes reading historical travel time, speed, traffic flow, and other time-series data from various sensors in the urban highway network. Outliers and missing values ​​caused by sensor malfunctions, communication interruptions, etc., are processed through the following steps: (1) Detection and removal of outliers First, set the effective data threshold range. For observations exceeding this physical threshold, and through 3 Outliers detected according to the principle (i.e., the observed value deviates from the mean by more than 3 times the standard deviation) are identified by the model as abnormal readings and removed, and treated as missing values.

[0026] (2) Segmented filling of missing data Because the input data needs to have strict continuity and structural integrity in the spatiotemporal dimensions, it is essential to effectively fill in naturally missing values ​​and outliers that have been removed. This invention, tailored to the characteristics of urban traffic flow, adopts a segmented filling strategy based on the length of consecutive missing time steps.

[0027] Short-term missing time steps (continuous missing time steps ≤ 3): Considering that traffic flow states usually transition smoothly within a short period, linear interpolation is used for filling. Let the nodes in the road network be... At any moment Observations For a missing state, let This is the last valid observation time before the missing segment. The current state is calculated using the first valid observation time after the missing segment, based on the valid observations before and after the missing segment. The calculation formula is as follows: ; in, and They are respectively and The corresponding true valid observations, This represents the total number of time steps between two valid observations. This represents the relative time step offset between the current missing time and the previous valid time.

[0028] Long-term missing time steps (continuously missing time steps > 3): When the missing time period is long, the local linear continuity trend of short-term traffic flow is often broken. Continuing to use linear interpolation will lead to severe data distortion. Therefore, for long-term missing time steps, historical average values ​​are used to fill in the gaps, i.e., sensor node values ​​are extracted. The average of valid traffic data from the same day of the week and the same time over several historical weeks (preferably the past four weeks) is used as the replacement. This method can preserve the periodic evolution characteristics of urban traffic flow at different time periods to the greatest extent, ensuring that the filled data conforms to the actual traffic physics.

[0029] (3) Z-score data standardization To eliminate the impact of absolute differences in traffic conditions across different road segments, accelerate model convergence, and prevent gradient explosion, this invention employs Z-score standardization for the padded continuous data. The specific calculation formula is as follows: ; in, These are the standardized eigenvalues. To train the global average of historical traffic data, This represents the standard deviation of the historical traffic data in the training set.

[0030] S200, Based on the historical traffic data, construct a weighted directed graph of the target city's expressway network and historical time-series data.

[0031] In some embodiments, the urban highway network is abstracted as a weighted directed graph. ,in , representing the set of nodes, corresponding to the locations of various sensors in the urban expressway network; This represents a set of edges, describing the connection relationships between sensor nodes; It is an adjacency matrix used to quantitatively describe the spatial proximity between nodes in an urban expressway network.

[0032] This invention further identifies the upstream and downstream flow directions between nodes through the topological relationship of the urban expressway network. For any two nodes... and If it exists point to The topological connection path, and its topological shortest path distance If it is less than a preset threshold, then in the directed adjacency matrix... China establishes from arrive The unidirectional connections are weighted by a Gaussian kernel function. ; in, It is the standard deviation of distance, specifically expressed as the standard deviation calculated based on the overall node spacing distribution of the urban expressway network; This is a distance threshold used to filter out irrelevant nodes that are too far away, reducing computational complexity.

[0033] Historical time-series data was constructed, and after anomaly removal, segmentation, and standardization, the traffic state features of each sensor node in the urban expressway network across all continuous historical time steps were extracted and aligned. To meet the input requirements of the spatiotemporal graph attention model for high-dimensional batch data, this embodiment of the invention utilizes a sliding window mechanism to segment the global continuous data into applicable discrete samples (input features and predicted labels). The specific construction steps are as follows: (1) Global feature tensor integration First, traffic data from the entire city's expressway network over the historical observation period are integrated into a three-dimensional global feature tensor. ,in This represents the number of nodes in the spatial structure of the urban expressway network. Traffic characteristic dimensions (speed, flow) for each node at a single moment. This represents the total time steps included in the dataset.

[0034] (2) Time-series slicing based on sliding window To capture the temporal evolution of traffic flow, this embodiment of the invention employs a fixed-step sliding window method to extract data along the time axis. Let the current time be... Define the historical observation window length as The prediction time window length is Extracting data from time 1 to 2 according to chronological order. At the time The historical states are combined to form the input sequence tensor of the model. , denoted as: ; This tensor It includes the complete spatiotemporal physical state of the urban expressway network within the current time window.

[0035] (3) Construction of real label sequences Extract from time At the time The actual travel time data is used as the real target label tensor corresponding to this input sample. Since the prediction target is only a single travel time dimension, the label tensor is dimensionality reduced and denoted as: ; As the sliding window moves in a fixed step (usually set to 1) across the global tensor... By continuously swiping forward, pairs of input features and target label samples can be continuously generated. This provides data support for subsequent iterative training of the model and calculation of the loss function.

[0036] S300 uses a topology-aware time attention mechanism based on the physical bottleneck constraints of highway network nodes to process historical time series data, thereby obtaining the global dependency features of historical time series data.

[0037] Understandably, in existing technologies, traditional recurrent neural networks suffer from the vanishing gradient problem when processing long-sequence historical data, as well as the dilution of key information caused by treating all historical moments equally. This module performs global dependency modeling on the input historical time series and automatically identifies the historical time segments most relevant to the current prediction through attention weights.

[0038] The technical solution of this embodiment solves the proposed technical problem in the following ways, specifically including: (1) Input data, let the neural network be the first... The input feature tensor of the layer is ,when hour, This refers to the time-series data tensor initially constructed after data preprocessing. To compute global dependencies between time steps, we need to integrate data including spatial and feature dimensions. This involves combining the input 3D feature tensor... Preserve along the time dimension, and preserve the spatial node dimension. With feature channel dimension Flattening and merging yields a reconstructed two-dimensional matrix. Each row of this matrix represents an independent time step, including all feature information of all nodes in the urban expressway network at that moment, serving as the underlying input for subsequent time dependency strength calculations.

[0039] (2) Calculation of the time dependency strength matrix: In order to measure the dependency relationship between different time steps, this embodiment of the invention introduces a learnable parameter matrix to construct the attention scoring function. The model calculates the time dependency strength matrix for any two time steps. and Calculate its relevance score. Unlike traditional methods, in this embodiment of the invention, the target dimension of the projection matrix is ​​forcibly constrained to the number of physical nodes in the urban highway network. This constraint introduces the urban expressway network topology as the physical bottleneck layer for attention computation into the model, requiring the extraction of temporal dependencies to be performed under the spatial distribution constraints of the urban expressway network. (Temporal dependency strength matrix) The calculation formula is as follows: ; This is the transpose of the input matrix; This is the topological constraint projection matrix for the urban expressway network, used to project the global state of the high-dimensional urban expressway network onto a low-dimensional manifold with the physical nodes of the urban expressway network as the basis vectors. The feature transformation matrix is ​​used for feature interaction in the hidden space. Since this interaction occurs at the node dimension, the correlation calculation of any two time steps actually reflects the result of the co-evolution of the state of all nodes in the city's expressway network. This is the inverse projection matrix, used to map the interactive features back to the original spatial dimension; This is the output projection matrix, used to adjust the final dimension of the attention score; This is the bias matrix, used to enhance the model's fitting ability; The Sigmoid activation function is used to increase the non-linear expressive power.

[0040] Traditional self-attention directly performs inner product calculations in high-dimensional space, but the embodiments of this invention force the extraction of time dependencies to go through a process with a dimension equal to the number of physical nodes in the urban highway network. This design addresses the information bottleneck by transforming attention computation from unconstrained numerical matching into topological verification constrained by the spatial distribution of the urban highway network. Therefore, this embodiment fundamentally avoids the loss of spatial distribution information caused by random projection in traditional low-rank attention, ensuring that the capture process of long-distance time dependencies is always constrained by the physical topology of the urban highway network, and the relative spatial relationships between nodes are not disrupted. After the above linear transformation, the resulting time dependency intensity matrix... , of which elements This indicates that, considering the topological constraints of the entire city's expressway network, the time step... time step The original correlation strength.

[0041] (3) Attention coefficient normalization, due to the original dependency strength matrix The numerical range of these values ​​is not fixed. To convert them into probabilistic weights, this embodiment of the invention uses the Softmax function to apply the matrix... Each row is normalized to obtain a standardized time attention matrix. : ; in The range of its value is (0, 1), and This matrix intuitively reflects the extraction of the current time step. When providing information, historical time steps The importance of A larger value indicates a larger time step. Traffic conditions have a decisive impact on current forecasts. Weighting It is dynamically generated based on the input data. For morning and evening rush hours, the historical time window that the model focuses on will be automatically adjusted, demonstrating a high degree of flexibility.

[0042] (4) Weighted aggregation of temporal features. In the final embodiment of this invention, the calculated temporal attention matrix will be... It operates on the original input features to reconstruct and enhance those features. The calculation formula is as follows: ; The operation here is to convert the tensor Along the time dimension With matrix After performing multiplicative weighting and time-weighting, the output is a new feature tensor. Instead of simply listing individual time steps, this mechanism incorporates enhanced features that integrate the global temporal context. On one hand, it dynamically refines traffic flow features, amplifying key historical segments strongly correlated with the current prediction while suppressing random traffic noise. On the other hand, it completely overcomes the information forgetting problem in long sequences inherent in traditional neural network models, providing a high-quality feature base that includes temporal evolution patterns for subsequent spatial graph attention mechanisms, thereby significantly improving the accuracy of subsequent spatial topology modeling.

[0043] S400 employs a dynamic directed graph attention mechanism based on the decoupling of physical priors and data-driven state linkage to process global dependent features, resulting in a high-dimensional spatiotemporal feature representation.

[0044] The embodiments of the present invention employ a dynamic directed graph attention mechanism based on physical prior and data-driven state linkage decoupling. It can be understood that after capturing the global dependency features of historical time series through the time attention mechanism, although the key information in the time dimension is extracted, the nodes of the urban expressway network are still regarded as independent of each other, without considering the complex spatial topology of the urban expressway network and the dynamic effects of traffic flow in space.

[0045] To comprehensively capture the multiple potential correlations existing in traffic flow and overcome the limitations of single attention mechanisms in capturing the characteristics of complex urban highway networks, embodiments of the present invention are set up... The system consists of independent attention heads that extract spatially dependent features from different "feature subspaces". The goal is to dynamically calculate the mutual influence weights between the central node and its neighboring nodes at each time step based on the real-time traffic conditions of the current urban expressway network, and aggregate spatial features accordingly.

[0046] The specific implementation steps are as follows: (1) The multi-head linear transformation and mapping of spatial features, after being processed by the time attention mechanism, results in the following output feature tensor: For each time slice (moment) Extracting spatial feature matrix .in, Spatial characteristic matrix The middle corresponds to the node The The row feature vector includes the node at time t. All channel attributes.

[0047] Set the number of attention heads to For the first A person's attention Define independent linear transformation matrices Input features Mapped to the From a feature subspace, we obtain the mapped intermediate features. : ; This mapping ensures that each attention head observes a different aspect of the input data, increasing the diversity and expressive power of the model's feature extraction. This represents the dimension of the feature subspace after a single attention head mapping.

[0048] (2) Dynamic spatial correlation coefficient calculation: Unlike traditional methods that use fixed urban highway network distances to define node relationships, this embodiment of the invention designs a dynamic attention scoring mechanism that balances physical priors and data-driven feature adversarial approaches. In each feature subspace... Internal, independent computing nodes Its neighboring nodes correlation coefficient A single-layer feedforward neural network is used as the attention scoring function, and the calculation formula is as follows: ; in, This represents a vector concatenation operation, where the center node is concatenated. Transformation characteristics and neighboring nodes The transformation features are concatenated along the channel dimension. This concatenation operation preserves the order of node features in the concatenated sequence, thus enabling the model to distinguish between "..." right "Impact" and " right The phrase "impact" describes the directional propagation characteristics of urban traffic flow. It is the first The learnable attention weight vectors within each subspace are responsible for extracting data-driven spatial correlations from the concatenated high-dimensional features. The directed physical adjacency weights, pre-calculated based on the topological flow direction and shortest path distance of the urban expressway network, characterize the prior spatial constraints determined by the actual connectivity of the urban expressway network. The magnitude of these weights represents the intensity of the physical influence of upstream nodes on downstream nodes. These are learnable, adjustable parameters that are automatically tuned by the backpropagation algorithm during model training. They are used to adjust the weight of prior information about physical topological distances. LeakyReLU is a non-linear activation function (with a negative slope typically set to 0.2) used to enhance the model's ability to handle non-linear spatial dependencies.

[0049] During the model training phase, when traffic flow on a road segment is in a free-flow state, data-driven terms and physical prior terms work together. When training samples include abnormal events such as traffic accidents and sudden congestion, causing the actual spatial propagation direction to deviate from the static topological expectation, parameters are dynamically adjusted through the backpropagation algorithm. This mechanism achieves a dynamic balance between the two. During the prediction application phase, it adaptively suppresses the weight bias of physical priors and proactively reduces the proportion of static topology in attention calculations, thereby allowing the model to accurately reallocate neighborhood aggregation weights based on real-time traffic conditions. This mechanism effectively overcomes two types of shortcomings: the inappropriate weighting of purely data-driven GAT when data is sparse, and the lag in response of fixed-bias GAT when traffic conditions change.

[0050] (3) Attention normalization based on graph structure: In order to reduce computational complexity, this embodiment of the invention only calculates the nodes. First-order neighbor nodes ( Attention coefficients of the neighbor set, where the neighbor set is... From the adjacency matrix Sure( (Nodes). To preserve the original traffic state of a node during feature aggregation, the neighbor set... Including nodes It is itself and its connected first-order neighbors.

[0051] Subsequently, using The function normalizes the coefficients in each subspace to obtain the first... Normalized attention weights for each perspective: ; Here Representative at the In each feature subspace, neighbor nodes For the central node The extent of the impact A larger value indicates an upstream or downstream node. Traffic conditions at the current node It has a significant impact.

[0052] (1) Spatial feature aggregation and multi-head information fusion, based on the calculated weights In each subspace, the features of neighboring nodes are independently aggregated to obtain the spatial feature representation of the central node from this perspective. : ; in for Non-linear activation function, at this time Only including the first Spatial information from a single perspective, The dimension of the spatial perspective features extracted from the model.

[0053] To integrate spatial information from all perspectives, embodiments of the present invention employ a stitching operation to... The output vectors of each attention head are merged, and the concatenated feature vector can simultaneously retain key information from different subspaces, avoiding information conflict or cancellation. The final spatial graph attention layer outputs the feature vector. Represented as: ; After concatenation, the output features are... The dimension is flattened into a one-dimensional long vector, that is This feature is a high-dimensional spatiotemporal representation that integrates the correlation between complex spatial topology and dynamic traffic flow.

[0054] S500 performs feature fusion on global dependency features and high-dimensional spatiotemporal features based on a gating mechanism, and uses the resulting complete output tensor for travel time prediction.

[0055] In some embodiments, through the multidimensional fusion of spatiotemporal features and the output of travel time prediction, it can be understood that, after processing by the aforementioned temporal attention mechanism and spatial graph attention mechanism, the model extracts the evolutionary features of the temporal dimension. Topological features with spatial dimensions We designed a feature fusion strategy based on a gating mechanism to filter redundant noise in the feature extraction process.

[0056] (1) Linear mapping of multi-head spatial features: The multi-head dynamic spatial graph attention mechanism outputs a high-dimensional feature vector through splicing operations. This dimension is much higher than the original hidden layer dimension of the model. Furthermore, the features of each attention point are in an independent state, requiring a linear transformation to map them back to the core feature dimension of the model. : ; in, This represents the spatial context features after dimensionality reduction. For a learnable parameter matrix, This is the bias vector.

[0057] (2) Spatiotemporal gating fusion mechanism: In order to actively suppress the inherent problem of oversmoothing of node features in deep graph neural networks while fusing temporal and spatial features, this embodiment of the invention designs a gating mechanism with feature fusion and spatial diversity. This mechanism utilizes temporal features... The advantage of retaining the independent temporal characteristics of nodes without undergoing multi-layer spatial neighborhood aggregation is used as a feature to combat spatial oversmoothing; when the model detects spatial aggregation features... When there is a tendency for oversmoothing, the spatial path is automatically weakened and the temporal path is strengthened by the gating coefficient, thereby maintaining the diversity of node representations.

[0058] First, the control coefficient of the fusion gate (range 0~1): ; in, Output tensors for the time attention module At the node With time The feature vector is modeled with global time dependency, but does not involve spatial mixing across nodes, thus fully preserving the temporal evolution characteristics of the node itself; This is a spatial context feature after multi-head spatial graph attention aggregation and linear mapping, which incorporates the traffic states of neighboring nodes; This represents the splicing of temporal and spatial features along the channel dimension; This is the gated weight matrix; For bias terms; Use the Sigmoid activation function to ensure that the gating coefficient is in the range [0,1].

[0059] Subsequently, this coefficient is used to perform weighted fusion of spatiotemporal features: ; in, This represents the Hadamard product (element-wise multiplication). These are the spatiotemporal characteristics after fusion.

[0060] Spatial features After multiple layers of neighbor aggregation, the features of each node tend to be smoother and more consistent, and the temporal features... The high-frequency independent components of the original nodes are preserved, and the model perceives the nodes during backpropagation. When the feature similarity with its neighboring nodes is too high, the gradient signal will drive... Approaching 1 increases the weight of time features, thereby injecting more high-frequency independent information into the fusion result and effectively resisting feature convergence.

[0061] (3) Residual connections and normalization: To prevent the gradient vanishing problem that occurs during training of multi-layer network models and to effectively alleviate the common phenomenon of overly smooth node features in deep graph neural networks, this embodiment of the invention further introduces residual connections and layer normalization mechanisms after spatiotemporal gating fusion to obtain the final output features of this layer. The specific calculation formula is as follows: ; in, The latest spatiotemporal features of the current layer output by the gating fusion mechanism. To enter the The initial raw input vector during the layer feature extraction module. This is the layer normalization function.

[0062] It should be noted that the residual connection here is not only used to alleviate gradient vanishing, but also can be fused with gating to form a dual oversmoothing defense system. Even if the gating coefficients fail to completely block the propagation of spatial oversmoothing, the original input directly transmitted through the residual connection can still be protected. It can still preserve an information channel for nodes that is independent of spatial aggregation, overcome the oversmoothing phenomenon common in deep graph networks, and ensure that the diversity of node features is maintained after multi-layer propagation.

[0063] After this step, in the spatial node Time step For all vectors Recombining the data yields a complete output tensor that includes global spatiotemporal information. This tensor is identical in dimension to the input of this layer and will be directly used as the input for the next layer. The input of the layer is used to achieve seamless stacking of multiple spatiotemporal graph attention feature extraction layers in the embodiments of the present invention.

[0064] (4) Travel time prediction output layer. Assume that the spatiotemporal graph attention prediction model of this embodiment of the invention stacks a total of... The feature extraction layer, when the first... After the layer calculation is completed, all Each node in all By aggregating the features at each time step, we can obtain the global comprehensive spatiotemporal feature tensor. This feature tensor integrates historical time windows. All valid spatiotemporal evolution information and topological structure within the system are the direct basis for predicting future states.

[0065] The embodiments of the present invention adopt Convolutional layers serve as output modules to map the extracted high-dimensional spatiotemporal features to the future. The module predicts travel time at each time step, treating each sensor node as an independent feature point and sharing mapping weights globally across the urban highway network. To integrate information from the time and feature dimensions, the tensor is first... In the time dimension and feature dimensions The above is recombined and flattened to obtain the reconstructed three-dimensional feature tensor. Under this structure, it is possible to The space size is considered as The number of channels is The feature maps are used to adapt to subsequent convolution operations.

[0066] To enhance the nonlinear fitting capability of the features and output the target prediction dimension, this embodiment of the invention applies two equivalent layers sequentially to the reconstructed feature map. convolution.

[0067] First layer Convolution is used for cross-channel information recombination and feature dimensionality reduction: ; in, This represents the convolution operator. The learnable weight matrix of the first convolutional kernel. The number of hidden layer channels is set. For bias terms, This is a non-linear activation function. This layer can achieve its... Within the receptive field, the potential nonlinear correlations between individual nodes at different time steps and with different feature attributes are fully explored.

[0068] Second floor Convolution directly maps hidden layer features to target prediction stride: ; in, These are the weights of the second-layer convolutional kernel. As the bias term, the calculated shape of the prediction tensor is as follows: After the spatial dimension reduction operation, the final output prediction tensor The elements in this tensor matrix Representing the city's expressway network The node in the future The predicted travel time for each time step.

[0069] The embodiments of the present invention adopt As the output module, the convolutional layer strictly limits the output of each node to be determined solely by its own channel features when dealing with noisy and missing data. This design eliminates the secondary coupling of global features that may be caused by conventional fully connected layers, ensuring that even after spatial aggregation, the final prediction mapping stage can still maintain logical isolation between nodes, thereby minimizing the interference of missing data on the overall prediction accuracy.

[0070] S600 uses a total loss function consisting of the mean absolute error with masking and the sum of L2 regularization terms for iterative model training to obtain a spatiotemporal graph attention-based urban road network travel time prediction model.

[0071] Loss function construction and model iterative training Although it has been passed at the output mapping layer Convolutional architecture achieves node independence and isolation in the prediction mapping stage. However, during the model backpropagation stage, pseudo-labels can still interfere with global network parameters through the loss function. Therefore, this embodiment of the invention introduces a masking mechanism to form a cooperative blocking mechanism in the loss function reconstruction stage. Addressing common noise scenarios such as sensor malfunctions in real urban highway networks, this masking mechanism allows the model to ignore padding data when calculating gradients, thus cutting off the vertical gradient propagation path of pseudo-labels from a mathematical optimization perspective. Combined with... The overall loss function constructed by convolution and L2 regularization in this embodiment of the invention achieves end-to-end pseudo-label isolation from the output structure to gradient backpropagation.

[0072] Assuming the model operates within a single historical time window, the future... The actual travel time label tensor for each time step is: ,go through The prediction tensor output by the convolutional layer is Define a binary mask matrix. When node In the future When the actual travel time data is valid, If the data is missing, then .

[0073] The overall loss function for a single input sample in this embodiment of the invention Defined as the sum of the masked mean absolute error (MAE) and the L2 regularization term, the calculation formula is as follows: ; in, and Representing the prediction tensor respectively and the real label tensor The specific numerical elements in Represents the set of all learnable parameters in the model ( wait), The L2 regularization coefficient is set to limit the absolute value of the parameters and prevent overfitting. In actual model iteration, the model typically reads data in batches, and the overall training loss is the loss of all samples within each batch. The average value.

[0074] In some embodiments, to ensure the efficiency and feasibility of training, the model training in this embodiment relies on the backpropagation algorithm, and the specific training steps are as follows: (1) The preprocessed temporal feature tensor is strictly divided into training set, validation set and test set (7:1:2) in chronological order to avoid future information leakage.

[0075] (2) In each training iteration cycle, data is input into the model in batches according to the set batch size, and then passes through the temporal attention module, spatial graph attention module, spatiotemporal feature fusion and output layer in sequence to calculate the predicted value. .

[0076] (3) Based on predicted values Compared with the true value The total loss function is calculated using the corresponding mask matrix, and the Adam optimizer is used to adaptively calculate the parameter update step size. The model network parameters are then updated via backpropagation. During backpropagation, the physical prior adjustment parameters... The prediction is updated iteratively by receiving the gradient signal of the prediction error. This is done as the actual traffic flow propagates in the direction relative to the static physical distance. When consistent, This is reinforced; when congestion hinders propagation, the gradient will be corrected. The range of values ​​allows the model to weaken the constraints of static topology in conflict scenarios, achieving an adaptive balance between data-driven approaches and physical priors.

[0077] (4) To prevent ineffective training and overfitting, the mean absolute error of the model on the validation set is calculated at the end of each cycle. If the error fails to decrease further in consecutive cycles, training is terminated early, and the set of parameters that performed best on the validation set is saved. This yields the final trained travel time prediction model.

[0078] S700 uses a spatiotemporal graph attention-based urban road network travel time prediction model to predict the travel time of the target city's expressway network and obtain the travel time prediction results.

[0079] To verify the effectiveness of the urban road network travel time prediction method proposed in this invention, which integrates a spatiotemporal graph attention mechanism, experiments were conducted to verify aspects such as long-term evolution pattern capture, complex road network topology representation, deep network oversmoothing suppression, and model robustness under noisy data. The experiments focused on verifying the core mechanisms of this invention: adaptively extracting historical key segments using a time-based attention mechanism based on the physical bottleneck constraints of highway network nodes; accurately calculating the dynamic influence weights between nodes using a dynamic directed graph attention mechanism based on the decoupling of physical priors and data-driven state linkage; proposing a bimodal adaptive gating mechanism for graph network oversmoothing defense; and combining a decoupled output and mask-immune joint architecture for bidirectional pollution blocking of pseudo-labels, effectively improving the prediction accuracy and generalization ability of the model in real complex traffic scenarios.

[0080] The experiments were conducted in a Windows 11 operating system environment, using Python 3.10 programming language, combined with the PyTorch deep learning framework and data processing libraries such as NumPy and Pandas to build a prediction model training and testing platform. The experiments used the PeMS-BAY traffic dataset, which realistically reflects the dynamic spatiotemporal evolution characteristics of traffic flow in non-Euclidean space. During the experiments, four core modules were validated and trained: temporal attention, directed graph attention, adaptive gating mechanism, and a decoupled output and masked immunity joint architecture for bidirectional pollution blocking of pseudo-labels.

[0081] Figure 3 This is a schematic diagram of a city road network travel time prediction device based on spatiotemporal graph attention according to an embodiment of the present invention. The device includes a first module 310, a second module 320, a third module 330, a fourth module 340, a fifth module 350, a sixth module 360, and a seventh module 370.

[0082] The system comprises the following modules: First, it acquires historical traffic data collected by sensors in the target city's expressway network, including historical travel time, historical speed, historical flow, and sensor coordinates. Second, it constructs a weighted directed graph and historical time-series data of the target city's expressway network based on the historical traffic data. Third, it processes the historical time-series data using a topology-aware temporal attention mechanism based on physical bottleneck constraints of expressway network nodes to obtain global dependency features. Fourth, it processes the global dependency features using a dynamic directed graph attention mechanism based on physical prior and data-driven state linkage decoupling to obtain a high-dimensional spatiotemporal feature representation. Fifth, it performs feature fusion of the global dependency features and the high-dimensional spatiotemporal feature representation using a gating mechanism, and uses the resulting complete output tensor for travel time prediction. Sixth, it iteratively trains the model using a total loss function consisting of the sum of the masked mean absolute error and L2 regularization terms to obtain a spatiotemporal graph attention-based urban road network travel time prediction model. Seventh, it uses the spatiotemporal graph attention-based urban road network travel time prediction model to predict the target city's expressway network and obtain the travel time prediction result.

[0083] For example, with the cooperation of the first, second, third, fourth, fifth, and sixth modules in the device, the embodiment device can implement any of the aforementioned spatiotemporal graph attention-based urban road network travel time prediction methods. Specifically, it acquires historical traffic data collected by sensors in the target city's expressway network, including historical travel time, historical speed, historical flow, and sensor coordinates. Based on the historical traffic data, it constructs a weighted directed graph of the target city's expressway network and historical time-series data. The historical time-series data is then processed using a topology-aware time-attention mechanism based on physical bottleneck constraints of expressway network nodes to obtain historical... The invention identifies global dependency features in time-series data. A dynamic directed graph attention mechanism based on physical prior and data-driven state linkage decoupling is used to process these global dependency features, resulting in a high-dimensional spatiotemporal feature representation. Feature fusion of the global dependency features and the high-dimensional spatiotemporal feature representation is performed using a gating mechanism, and the resulting complete output tensor is used for travel time prediction. Iterative training of the model is conducted using a total loss function consisting of the masked mean absolute error and the sum of L2 regularization terms, resulting in a spatiotemporal graph attention-based urban road network travel time prediction model. This model is then used to predict the travel time of a target city's expressway network, yielding the predicted travel time. The beneficial effects of this invention are: it achieves deep coupling of spatiotemporal features, significantly improving the model's prediction accuracy in real-world urban road network scenarios, and has significant practical implications for alleviating traffic congestion and optimizing urban traffic management.

[0084] This invention also provides an electronic device, which includes a processor and a memory; The memory stores the program; The processor executes a program to perform the aforementioned urban road network travel time prediction method based on spatiotemporal graph attention; the electronic device has the function of carrying and running the software system for urban road network travel time prediction based on spatiotemporal graph attention provided in the embodiments of the present invention, such as a personal computer, minicomputer, mainframe, workstation, network or distributed computing environment, standalone or integrated computer platform, or communicating with charged particle tools or other imaging devices, etc.

[0085] This invention also provides a computer-readable storage medium storing a program that is executed by a processor to implement the urban road network travel time prediction method for spatiotemporal graph attention as described above.

[0086] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented in the embodiments of this invention. Alternative embodiments are contemplated, in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.

[0087] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned spatiotemporal graph attention-based urban road network travel time prediction method.

[0088] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the described functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, considering the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed in the embodiments of the invention, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.

[0089] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0090] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can include, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0091] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0092] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0093] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0094] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

[0095] The above is a detailed description of the preferred embodiments of the present invention, but the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.

Claims

1. A method for predicting travel time in urban road networks using spatiotemporal graph attention, characterized in that, include: Acquire historical traffic data collected by sensors in the highway network of the target city, including historical travel time, historical speed, historical traffic flow, and sensor coordinates; Based on the historical traffic data, a weighted directed graph of the target city's expressway network and historical time-series data are constructed. The historical time series data is processed using a topology-aware time attention mechanism based on the physical bottleneck constraints of highway network nodes to obtain the global dependency features of the historical time series data. A dynamic directed graph attention mechanism based on physical prior and data-driven state linkage decoupling is used to process the global dependency features to obtain a high-dimensional spatiotemporal feature representation. We perform feature fusion on global dependency features and high-dimensional spatiotemporal features based on a gating mechanism, and use the resulting complete output tensor for travel time prediction. The model is iteratively trained using a total loss function consisting of the masked mean absolute error and the sum of L2 regularization terms to obtain a spatiotemporal graph attention-based urban road network travel time prediction model. The travel time prediction model for urban road networks using spatiotemporal graph attention is used to predict the travel time of the target city's expressway network, and the travel time prediction results are obtained.

2. The urban road network travel time prediction method based on spatiotemporal graph attention according to claim 1, characterized in that, The method also includes preprocessing historical traffic data: If historical traffic data shows anomalies, the data should be processed within the valid data threshold range. Detect and remove outliers from historical traffic data; If historical traffic data is missing, the data will be filled in segments according to the missing time period and the preset time step: If the missing time period is less than or equal to the preset time step, the missing status is inferred based on the valid observations before and after it. The calculation formula is as follows: ; in, For nodes At any moment Observations The missing state, and They are respectively and The corresponding true valid observations, This represents the total number of time steps between two valid observations. This represents the relative time step offset between the current missing time and the previous valid time. If the missing time period is longer than the preset time step, the missing state is filled in according to the average value of the sensor's historical time periods; Z-score data standardization was performed on the historical traffic data after missing data filling: ; in, These are the standardized eigenvalues. To train the global average of historical traffic data, This represents the standard deviation of the historical traffic data in the training set.

3. The urban road network travel time prediction method based on spatiotemporal graph attention according to claim 2, characterized in that, The construction of a weighted directed graph and historical time-series data of the target city's expressway network based on the historical traffic data includes: The weighted directed graph is ,in This represents the set of nodes, indicating the locations of sensors within the target city's highway network. This represents the total number of sensors; This represents a set of edges, describing the connection relationships between sensor nodes; It is an adjacency matrix used to quantitatively describe the spatial proximity between nodes in the road network; The upstream and downstream flow directions between nodes are identified based on the topological relationships of the weighted directed graph road network. These directions are determined using a directed adjacency matrix, with weights calculated using a Gaussian kernel function. The directed adjacency matrix is ​​as follows: ; in, Represents a node and The directed adjacency matrix, Represents a node and The topological shortest path distance, It is the standard deviation of the distance, calculated based on the overall node spacing distribution of the urban expressway network; This is a distance threshold used to filter out irrelevant nodes that are too far away; The traffic data of the target city's expressway network over the historical observation period are integrated into a three-dimensional global feature tensor. ,in This represents the number of nodes in the spatial structure of the urban expressway network. The traffic characteristic dimension of each node at a single moment. This represents the total time steps included in the dataset; The input sequence tensor is obtained by truncating along the time axis using a sliding window method with a fixed step size. for: ; in, For the current moment, The length of the historical observation window. To predict the length of the time window; With time At the time The actual travel time data is used as the real target label tensor. for: ; The real target label tensor and input sequence tensor Determine historical time-series data.

4. The urban road network travel time prediction method based on spatiotemporal graph attention according to claim 3, characterized in that, The process of processing historical time-series data using a topology-aware time attention mechanism based on physical bottleneck constraints of highway network nodes yields global dependency features of the historical time-series data, including: Global dependency modeling is constructed based on historical time-series data, where the neural network... The input feature tensor of the layer is The three-dimensional feature tensor of historical time series data Preserve along the time dimension, and preserve the spatial node dimension. With feature channel dimension Flattening and merging yields a reconstructed two-dimensional matrix. ; Employing a learnable time-dependent strength matrix For any two time steps and Calculate the correlation score, where the time dependence strength matrix is... for: ; in, This is the transpose of the input matrix; This is the topological constraint projection matrix for the urban expressway network, used to project the global state of the high-dimensional urban expressway network onto a low-dimensional manifold with the physical nodes of the urban expressway network as the basis vectors. The feature transformation matrix is ​​used for feature interaction within the hidden space, and the correlation score is used to characterize the result of the co-evolution of the states of all nodes. This is the inverse projection matrix, used to map the interactive features back to the original spatial dimension; This is the output projection matrix, used to adjust the final dimension of the attention score; This is the bias matrix, used to enhance the model's fitting ability; Use the Sigmoid activation function; time dependence strength matrix The event attention matrix is ​​obtained by normalization using the Softmax function. for: ; in, The range of is (0,1), and The matrix represents the extraction of the current time step. When providing information, historical time steps The degree of importance; Through attention matrix By reconstructing and enhancing the input feature tensor, we obtain the global dependency features of historical time series data. for: ; Among them, global dependency features Enhanced features for characterizing global temporal context.

5. The urban road network travel time prediction method based on spatiotemporal graph attention according to claim 4, characterized in that, The global dependency features are processed using a dynamic directed graph attention mechanism based on the decoupling of physical priors and data-driven state linkage, resulting in a high-dimensional spatiotemporal feature representation, including: Global dependency features Slice at each time Extraction is performed to obtain the spatial feature matrix. The spatial feature matrix is ​​obtained through the attention head. Mapping to the feature subspace yields the mapped intermediate features. for: ; in, Spatial characteristic matrix The middle corresponds to the node The Row feature vector, including the node at time t. All channel attributes, For the number of attention heads, For attention head index; Nodes are computed independently in each feature subspace Its neighboring nodes correlation coefficient A single-layer feedforward neural network is used as the attention scoring function, and the calculation formula is as follows: ; in, This represents a vector concatenation operation; It is the first Learnable attention weight vectors within each subspace This represents the dimension of the feature subspace after mapping a single attention head; is a learnable, adjustable parameter; LeakyReLU is a non-linear activation function; compute nodes First-order neighbor nodes Attention coefficients, where the neighbor set From the adjacency matrix It is determined that the coefficients in each subspace are normalized using the Softmax function to obtain the first... Normalized attention weights from each perspective for: ; in, Indicates the first In each feature subspace, neighbor nodes For the central node The degree of impact; Based on normalized attention weights In each subspace, the features of neighboring nodes are aggregated independently to obtain the spatial feature representation of the central node from the corresponding perspective. for: ; in The LeakyReLU nonlinear activation function is used. Only including the first Spatial information from one perspective; By splicing operation The output vectors of each attention head are merged to obtain the output features of the spatial graph attention layer. : ; in, The flattened one-dimensional vector represents a high-dimensional spatiotemporal feature representation that integrates complex spatial topology and dynamic traffic flow correlation.

6. The urban road network travel time prediction method based on spatiotemporal graph attention according to claim 5, characterized in that, The feature fusion of global dependency features and high-dimensional spatiotemporal features based on a gating mechanism, and the resulting complete output tensor for travel time prediction, includes: A multi-head dynamic spatial graph attention mechanism is employed to output high-dimensional feature vectors through concatenation operations. A linear transformation is used to map high-dimensional feature vectors back to the core feature dimensions of the model. : ; in, This represents the spatial context features after dimensionality reduction. For a learnable parameter matrix, It is the bias vector; Based on the spatiotemporal gating fusion mechanism, spatial context features Fusion is performed, where the control coefficient of the fusion gate is... for: ; in, Output tensors for the time attention module At the node With time eigenvectors; This represents the splicing of temporal and spatial features along the channel dimension; This is the gate weight matrix; For bias terms; Use the Sigmoid activation function to ensure that the gating coefficient is in the range [0,1]. Through control coefficients Perform weighted fusion: ; in, It represents the Hadamah accumulation. The spatiotemporal characteristics after fusion; The fused spatiotemporal features are then subjected to residual connections and normalization to obtain the final output features of each layer of the neural network. for: ; in, The latest spatiotemporal features of the current layer output by the gating fusion mechanism. To enter the The initial raw input vector during layer feature extraction; LayerNorm is the layer normalization function. Use two layers Convolution is used for travel time prediction, including the final output features. In the time dimension and feature dimensions The above is recombined and flattened to obtain the reconstructed three-dimensional feature tensor. Through the first layer Convolution performs cross-channel information recombination and feature dimensionality reduction, represented as: ; in, This represents the convolution operator. The learnable weight matrix of the first convolutional kernel. The number of hidden layer channels is set. For bias terms, It is a non-linear activation function; Through the second layer Convolution maps hidden layer features to target prediction stride. for: ; in, These are the weights of the second-layer convolutional kernel. As the bias term, the calculated shape of the prediction tensor is as follows: After the spatial dimension reduction operation, the final output prediction tensor Among them, the prediction tensor elements in Representing the city's expressway network The node in the future The predicted travel time for each time step.

7. The urban road network travel time prediction method based on spatiotemporal graph attention according to claim 6, characterized in that, The model is iteratively trained using a total loss function that combines the masked mean absolute error and the L2 regularization term to obtain a spatiotemporal graph attention-based urban road network travel time prediction model, including: The total loss function for: ; in, Indicates the future The actual time-labeled tensor of each time step. It is a binary mask matrix; and Representing the prediction tensor respectively and the real label tensor Numerical elements in This represents the set of all learnable parameters in the model. This is the preset L2 regularization coefficient.

8. A device for predicting travel time in urban road networks using spatiotemporal graph attention, characterized in that, include: The first module is used to acquire historical traffic data collected by sensors in the highway network of the target city. The historical traffic data includes historical travel time, historical speed, historical flow and sensor coordinates. The second module is used to construct a weighted directed graph of the target city's expressway network and historical time-series data based on the historical traffic data. The third module is used to process historical time series data using a topology-aware time attention mechanism based on the physical bottleneck constraints of highway network nodes, so as to obtain the global dependency features of historical time series data. The fourth module is used to process the global dependent features using a dynamic directed graph attention mechanism based on the decoupling of physical priors and data-driven state linkage, so as to obtain a high-dimensional spatiotemporal feature representation. The fifth module is used to perform feature fusion on global dependent features and high-dimensional spatiotemporal feature representations based on a gating mechanism, and to predict travel time using the obtained complete output tensor. The sixth module is used to perform iterative training of the model using the total loss function of the sum of the masked mean absolute error and the L2 regularization term, to obtain the urban road network travel time prediction model with spatiotemporal graph attention. The seventh module is used to predict the travel time of the target city's expressway network using a city road network travel time prediction model based on spatiotemporal graph attention, and obtain the travel time prediction results.

9. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the urban road network travel time prediction method based on spatiotemporal graph attention as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a program that is executed by a processor to implement the urban road network travel time prediction method based on spatiotemporal graph attention as described in any one of claims 1-7.