Traffic flow prediction method and system based on double-flow multi-scale space-time collaboration

By employing a dual-flow, multi-scale, spatiotemporal collaborative traffic flow prediction method, a meta-graph is dynamically generated and a multi-level G-Mamba module is used to extract spatial dependency features. Combined with a temporal unwrapping module and a cross-scale interaction module, this approach addresses the shortcomings of existing models in multi-granularity temporal dynamics and multi-scale spatial dependencies, achieving higher accuracy in traffic flow prediction.

CN122067408APending Publication Date: 2026-05-19ANHUI NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ANHUI NORMAL UNIV
Filing Date
2026-03-26
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing traffic prediction models cannot effectively capture multi-granular temporal dynamics and multi-scale spatial dependencies, resulting in insufficient prediction accuracy in complex traffic scenarios.

Method used

A traffic flow prediction method based on dual-flow multi-scale spatiotemporal collaboration is adopted. Through multi-scale spatial encoder and multi-granularity temporal mixer, metagraph is dynamically generated and spatial dependency features are extracted by multi-level G-Mamba module. Combined with temporal unwrapping module and cross-scale interaction module, deep fusion of spatiotemporal features is achieved.

Benefits of technology

It improves the accuracy and robustness of traffic flow prediction, enabling more accurate prediction of traffic dynamics in complex traffic scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122067408A_ABST
    Figure CN122067408A_ABST
Patent Text Reader

Abstract

The invention discloses a traffic flow prediction method and system based on double-flow multi-scale space-time collaboration. The system comprises a multi-scale space encoder module, a multi-granularity time mixer module and a space-time fusion device module. The multi-scale space encoder module dynamically constructs a multi-level metagraph from a sensor to a community through a metagraph learner, and captures multi-scale space dependence of local graph convolution and global state space diffusion in combination with the multi-level G-Mama module; the multi-granularity time mixer module is used for decomposing a time sequence into trend, season and abnormal components under multiple resolutions and realizing cross-granularity information interaction by utilizing the bidirectional exchange module, so that rich multi-granularity time characteristics are extracted; and the space-time fusion device module performs deep collaborative fusion on the multi-scale spatial features and the multi-granularity time features through intra-domain self-enhancement and cross-domain bridging mechanisms, and finally outputs a traffic flow prediction result. The system can improve the precision and robustness of traffic flow prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and intelligent transportation technology, specifically to a traffic flow prediction method and system based on dual-flow multi-scale spatiotemporal coordination. Background Technology

[0002] With the rapid development of the Internet of Things and smart cities, massive amounts of heterogeneous traffic data (such as sensor traffic flow, GPS trajectories, LBSN check-ins, etc.) are continuously generated, forming a complex networked spatiotemporal data ecosystem. Today, traffic faces real problems such as regular congestion, local congestion leading to regional spread, and a lack of global perspective in local traffic decision-making.

[0003] In recent years, spatiotemporal deep learning models, especially those based on graph neural networks (GNNs), have significantly improved prediction accuracy by jointly modeling the propagation of traffic states within the network. However, most existing state-of-the-art models typically follow a "single-resolution" paradigm, operating at a fixed temporal granularity (e.g., 5 minutes) and a fixed spatial scale (e.g., a road segment-level map). This paradigm inevitably discards crucial dynamic information that exists only at coarser or finer scales, such as commuter tidal patterns visible on an hourly scale, or corridor-level congestion spanning dozens of road segments.

[0004] Single-granularity spatiotemporal modeling methods typically employ fixed sampling intervals and a single spatial scale, failing to capture the hierarchical structure of traffic dynamics, such as the difference between hourly trends and minute-level fluctuations, and the multi-scale spatial relationships between main roads and community roads, resulting in insufficient release of representation potential. Temporal multi-granularity methods only perform multi-resolution modeling of the time axis, ignoring the characteristic of spatial dependence changing with resolution; while spatial multi-scale methods do not effectively combine temporal representations of corresponding granularities, making it difficult to achieve spatiotemporal collaborative modeling.

[0005] This demonstrates that existing technologies have failed to fully exploit the multi-scale interactions across spatiotemporal dimensions, resulting in limited prediction accuracy and an inability to meet the precise prediction needs of complex traffic scenarios. Therefore, there is an urgent need for a traffic prediction method capable of jointly modeling multi-granularity temporal dynamics and multi-scale spatial dependencies to improve prediction accuracy and practicality. Summary of the Invention

[0006] This invention addresses the problem that existing traffic prediction models cannot effectively capture multi-granularity temporal dynamics and multi-scale spatial dependencies, resulting in insufficient prediction accuracy when faced with complex traffic flow information. It provides a traffic flow prediction method and system based on dual-flow multi-scale spatiotemporal collaboration, which can improve the accuracy and robustness of traffic flow prediction.

[0007] To achieve the above objectives, a first aspect of the present invention provides a traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination, the method comprising: S1: Acquire historical traffic data and input it into a multi-scale spatial encoder. Through a metagraph learner, a set of metagraphs and their soft assignment matrices corresponding to different spatial scales are dynamically generated by combining node location information and time information. The multi-level G-Mamba module is used to alternately perform local graph convolution and global state space scanning on the metagraphs at each scale to extract spatial dependency features at that scale and generate scale-specific spatial embeddings. Through the cross-scale interaction module, the spatial embeddings at different scales are upsampled and fused using the soft assignment matrix to generate a multi-scale spatial feature vector that integrates multi-scale spatial information. S2: Historical traffic data is synchronously input into the multi-granularity temporal mixer. The multi-resolution representation module performs multi-level average pooling downsampling on the original sequence to generate multiple subsequences with different time resolutions. The time unwrapping module explicitly decomposes each resolution subsequence into trend components, seasonal components, and anomaly components. Then, the bidirectional exchange module performs bidirectional information transfer between corresponding components at different resolutions, both top-down and bottom-up. Through the cross-granularity alignment module, the dynamic time warping mechanism performs temporal alignment and adaptive fusion of features at different resolutions after exchange, generating a multi-granularity temporal feature vector that incorporates multi-granularity temporal dynamics. S3: The multi-scale spatial feature vector obtained in S1 and the multi-granularity temporal feature vector obtained in S2 are input in parallel into the spatiotemporal fusion module. Through the intra-domain self-enhancement module, the key features are enhanced and noise is suppressed in the spatial and temporal domains respectively using the local self-attention mechanism to obtain enhanced spatial features and enhanced temporal features. Through the cross-domain bridging module, the cross-domain correlation between the enhanced spatial features and the enhanced temporal features is calculated using the cross-attention mechanism to realize the bidirectional deep fusion of spatial and temporal information and obtain an enhanced spatiotemporal joint representation. S4: The enhanced spatiotemporal joint representation obtained in S3 is input into a prediction head composed of a multilayer sensing mechanism. The prediction head is the last part of the spatiotemporal fusion unit. After linear transformation, the final traffic prediction result is output.

[0008] Preferably, the generated metagraph and its node assignment matrix in S1 include: Receive historical traffic data Adjacency matrix of the original graph ,in, Indicates batch size. Indicates the number of nodes. Indicates the number of time steps; For the input raw traffic data By using a linear projection layer to map it to a high-dimensional hidden space, the fundamental feature tensor is obtained. ,in To hide the dimension. At this point... It only includes the numerical state of traffic flow and has not yet captured the spatial topological location of nodes in the network or their position on the time axis. To enable the model to have spatiotemporal awareness, a learnable spatial location encoding is introduced. and time location encoding Through a broadcast operation, it is expanded into a tensor with the same dimension as the input features. and Basic features Deeply integrated with spatiotemporal coding, it evolves into a spatiotemporal location-aware feature tensor. Its evolutionary relationship is shown in formula (1): (1) in, This indicates a splicing operation. For a learnable projection matrix, For layer normalization operation, For activation functions; position-aware feature tensors Enter to S A parallel, differentiable pooling head, each pooling head corresponding to a spatial scale; In each pooling head, a soft allocation matrix is ​​calculated according to formula (2) through an attention mechanism based on feature similarity and geographic proximity. : (2) in, The original number of nodes. Let be the number of supernodes at the s-th scale. and For a learnable projection matrix, based on the soft assignment matrix For the original graph adjacency matrix Coarsening is performed to obtain the metagraph adjacency matrix at this scale. : (3) At the same time, using soft allocation matrix Node features Aggregation is performed to obtain the coarsened feature matrix at this scale. : (4) Preferably, in S1, a multi-level G-Mamba module is used to alternately perform local graph convolution and global state space scanning on the metagraph at each scale to extract spatial dependency features at that scale and generate scale-specific spatial embeddings, including: Scale-specific features of the input First, adaptive graph convolution is performed to capture local spatial dependencies, and local features are obtained according to formula (5). : (5) in, This is the adjacency matrix of the metagraph. It is the identity matrix. For degree matrix, For learnable convolution kernel parameters, For activation functions; Local features Linear mapping to the input of the state space ,in, It is a learnable parameter matrix; A causal cumulative sum operation is performed along the node sequence sorted by the Fiedler vector to simulate global information diffusion, and the global hidden state is obtained according to formula (6). : (6) in, To sum up cumulatively, This represents the node sequence dimension. It is the hyperbolic tangent activation function.

[0009] A modulation gate is generated through a gated branch. ,in, The parameter matrix is ​​learnable and used to represent the global hidden state. Modulation; The modulated state is projected back into the original feature space and compared with local features. Perform residual connections and obtain the final scale-specific spatial embedding according to formula (7). : (7) in, and is a learnable parameter matrix.

[0010] Preferably, in S1, the cross-scale interaction module uses sensor-level features as queries and embeds spatial data at different coarse scales using a soft allocation matrix. After upsampling to the sensor level, the data is used as keys and values, and then fused through a multi-head attention mechanism to obtain a multi-scale spatial feature vector according to formula (8): (8) Among them, query Q Embedded by fine-scale space Projection obtained, key K SumV It is obtained by upsampling, stitching and projecting after coarse-scale embedding.

[0011] Preferably, S2 includes: S21: Through the multi-resolution representation module, historical traffic data... Perform average pooling downsampling at different scales to generate a set of subsequences with different time resolutions. ,in, , This is the pooling window size; S22: Using the time unwrapping module, the signal is decomposed into trend components in each time-resolution subsequence. Seasonal portion and abnormal components ,satisfy Specifically, the trend component is extracted using a moving average filter. Seasonal components are extracted using truncated discrete Fourier transform. And high-frequency anomalies are located through wavelet transform to explicitly extract the original signal. Untangling , This is an abnormal component. For window size k The moving average filter, DFT For Fourier transform, IDFT For truncated inverse discrete Fourier transform; S23: Through a bidirectional exchange module, learnable upsampling and downsampling operations are used to perform bidirectional information transfer between decomposed components in a top-down and bottom-up manner between subsequences with different time resolutions, in order to model cross-granularity temporal interactions; specifically including: In the top-down path, the trend component of the coarse-grained layer and abnormal components After upsampling, the corresponding component of the fine-grained layer and The formula for addition is: , (9) in, This is a learnable upsampling operation; In the bottom-up path, the seasonal components of the fine-grained layer are... After downsampling, the seasonal components of the coarse-grained layer are compared. The formula for addition is: (10) in, This is a learnable downsampling operation; S24: Through the cross-granularity alignment module, dynamic time warping and scale-aware gating mechanisms are used to perform time-series alignment and adaptive fusion on the outputs of different granularities after bidirectional exchange, so as to obtain multi-granularity time feature vectors.

[0012] Preferably, S3 includes: S31: Through the intra-domain self-enhancement module, multi-scale spatial feature vectors and multi-granularity temporal feature vectors are input into the intra-domain self-enhancement module respectively. First, through a learnable mapping... and Time feature map and spatial feature map Each feature is projected onto a shared latent space to ensure scale alignment and feature comparability; subsequently, an intra-domain self-attention operator is applied within each domain. By selectively amplifying informative patterns while suppressing irrelevant fluctuations, content-aware gain control is achieved, resulting in enhanced temporal characteristics. and enhanced spatial features The calculation formula is: , (11) S32: Enhanced time characteristics are achieved through the cross-domain bridging module. and enhanced spatial features It enables two-way interaction and employs a cross-attention mechanism. By using features from one domain as queries and features from another domain as keys and values, asymmetric information flow is achieved. This preserves the identity of features from each domain while enriching their respective representations with complementary signals from the other domain, resulting in a final spatiotemporal joint representation. and The calculation formula is: , (12) in, and To enhance the spatiotemporal joint representation by incorporating cross-domain information, the input is fed into the prediction head for traffic prediction.

[0013] Preferably, the prediction head in S4 includes: Enhanced spatiotemporal joint characterization and To achieve fusion, through a learnable transformation. The fused representation is processed using the following calculation formula: (13) By using a domain-aware gating mechanism, raw time features are utilized. The transformed representation is modulated to obtain modulated features, and the original spatial features are then connected via residual connections. Add back to preserve spatial fidelity and obtain the final traffic prediction result. The calculation formula is: (14) Secondly, this invention provides a traffic flow prediction system based on dual-flow multi-scale spatiotemporal coordination, which includes a multi-scale spatial encoder module, a multi-granularity temporal mixer module, and a spatiotemporal fusion module; wherein... The multi-scale spatial encoder module is used to dynamically construct a multi-level metagraph from the sensor to the community through the metagraph learner. Combined with the multi-level G-Mamba module, it captures the multi-scale spatial dependence of local graph convolution and global state space diffusion, and outputs a spatial feature representation that integrates micro-road segment and macro-region information. The multi-granularity time mixer module is used to downsample the original time series into multiple subsequences with different time granularities through the multi-resolution representation module, decompose them into trend components, seasonal components and anomaly components through the time decoupling module, realize cross-granularity information interaction from top to bottom and from bottom to top through the bidirectional exchange module, and finally generate a unified multi-granularity time feature representation through the cross-granularity alignment module. The spatiotemporal fusion module is used to independently extract and enhance spatial and temporal features through the domain self-enhancement module, and then achieve bidirectional deep fusion of spatiotemporal features through the cross-domain bridging module using an asymmetric cross-attention mechanism. Finally, the traffic flow prediction result is output through domain-aware gating modulation and residual connection in the prediction head.

[0014] Thirdly, the present invention provides a machine-readable storage medium storing instructions for causing a machine to execute the traffic flow prediction method based on dual-stream multi-scale spatiotemporal coordination as described above.

[0015] Fourthly, the present invention provides a processor for running a program, wherein the program is run to execute the traffic flow prediction method based on dual-stream multi-scale spatiotemporal coordination as described above.

[0016] Based on the above technical solutions, the multi-scale spatial encoder, through dynamic metagraph generation and global-local fusion mechanisms, simultaneously captures short-range and long-range spatial correlations, enhancing the spatial feature representation capability. The multi-granularity temporal mixer, through temporal decoupling and bidirectional information exchange, accurately models trends, seasonalities, and anomaly patterns at different temporal granularities and captures their complex interactions, improving the understanding and prediction capabilities of temporal dynamics. The spatiotemporal fusion mixer achieves deep fusion of spatiotemporal features through intra-domain self-enhancement and cross-domain bridging modules, explicitly modeling the bidirectional influence between the temporal and spatial dimensions, thus improving prediction accuracy. The prediction head employs domain-aware gated modulation and residual connections, avoiding oversmoothing caused by simple addition. It utilizes the joint spatiotemporal context while retaining fine-grained information, improving model robustness and prediction accuracy.

[0017] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description

[0018] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings: Figure 1 This is an overall architecture diagram of the traffic flow prediction system based on dual-flow multi-scale spatiotemporal coordination provided by the present invention; Figure 2 This is a diagram illustrating the internal structure and workflow of a multi-level G-Mamba module; Figure 3 This is a schematic diagram illustrating the prediction performance of the present invention and the baseline on the PEMS04 dataset; Figure 4 This is a schematic diagram illustrating the prediction performance of the present invention and the baseline on the PEMS08 dataset; Figure 5 This is a schematic diagram illustrating the prediction performance of the present invention and the baseline on the Manchester dataset. Detailed Implementation

[0019] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.

[0020] It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of this application all comply with relevant laws and regulations. In the embodiments of this application, certain existing industry solutions such as software, components, and models may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.

[0021] This invention provides a traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination, the overall architecture of which is as follows: Figure 1 As shown, the framework mainly consists of three core modules: Multi-Scale Spatial Encoder (MSSE), Multi-Granularity Temporal Mixer (MGTM), and Spatio-Temporal Integrator (STI). These three modules are tightly coupled and work together to complete the traffic prediction task.

[0022] Specifically, the method includes the following steps: S1: Acquire historical traffic data and input it into the multi-scale spatial encoder; The multi-scale spatial encoder dynamically constructs multi-scale graph structures and performs efficient feature extraction and propagation on these graphs to generate multi-scale spatial feature vectors that can represent multi-scale spatial dependencies such as micro, meso and macro scales. S2: Synchronously, historical traffic data is input into the multi-granularity time mixer; the multi-granularity time mixer decomposes the complex time series into multiple sub-components with clear physical meaning through a series of operations such as multi-resolution decomposition, time component decoupling, bidirectional information exchange and cross-granularity alignment, and captures the cross-scale interaction between them, generating multi-granularity time feature vectors that can characterize multi-resolution time dynamics such as fine-grained, medium-grained and coarse-grained. S3: Input multi-scale spatial feature vectors and multi-granularity temporal feature vectors in parallel into the spatiotemporal fusion engine; the spatiotemporal fusion engine first extracts the features of each feature through the intra-domain self-enhancing module, and then explicitly models the bidirectional influence and causal relationship between spatiotemporal regions through the cross-domain bridging module to obtain an enhanced spatiotemporal joint representation rich in spatiotemporal coupling information; S4: Input the enhanced spatiotemporal joint representation into the prediction head, and output the final traffic prediction result after domain-aware gating modulation and residual connection.

[0023] The multi-scale spatial encoder in S1 is the core module responsible for spatial information processing. Its design goal is to overcome the limitations of traditional methods in spatial dependency modeling. The multi-scale spatial encoder achieves fine-grained capture of spatial dependencies by dynamically generating multi-scale graph structures and combining them with efficient local and global information propagation mechanisms. For example... Figure 2 As shown, the multi-scale spatial encoder mainly consists of three sub-modules: a meta-graph learner (MGL), a multi-level G-Mamba module (MLGM), and a cross-scale interaction module (CSI). Specifically, the meta-graph learner is the first sub-module of the multi-scale spatial encoder, and its core task is to dynamically generate a series of "metagraphs" that reflect different spatial granularities. Unlike traditional multi-scale learning methods that rely on predefined partitions or fixed grid pooling, the meta-graph learner adopts a differentiable, end-to-end learning approach: First, regarding the input raw traffic data Adjacency matrix of the original graph , Indicates batch size. Indicates the number of nodes. The time step number is represented by a linear projection layer and mapped to a high-dimensional hidden space to obtain the basic feature tensor. ,in To hide the dimension. At this point... It only includes the numerical state of traffic flow and has not yet captured the spatial topological location of nodes in the network or their position on the time axis. To enable the model to have spatiotemporal awareness, a learnable spatial location encoding is introduced. and time location encoding Through a broadcast operation, it is expanded into a tensor with the same dimension as the input features. and Basic features Deeply integrated with spatiotemporal coding, it evolves into a spatiotemporal location-aware feature tensor. : , in, This indicates a splicing operation. For a learnable projection matrix, For layer normalization operation, This is the activation function.

[0024] Subsequently, the location-aware feature tensor Enter to SThere are 3 parallel differentiable pooling heads, each corresponding to a spatial scale; within each pooling head, a soft assignment matrix is ​​computed through an attention mechanism based on feature similarity and geographic proximity. : , in, The original number of nodes. For the first s Number of supernodes at each scale and It is a learnable projection matrix.

[0025] Furthermore, the adjacency matrix of the metagraph at this scale is obtained through coarsening rules. and coarsened feature matrix , This is the adjacency matrix of the original graph. Since the assignment process is differentiable, the gradient can be backpropagated to node features and location embeddings, enabling the model to adaptively discover time-varying community structures, such as morning rush hour commuter corridors or evening rush hour recreational areas, based on the prediction task objective.

[0026] like Figure 2 As shown, the multi-level G-Mamba module is the core computational unit of the multi-scale spatial encoder, responsible for efficient feature extraction and propagation on each metagraph generated by the metagraph learner. The multi-level G-Mamba module cleverly combines the local perception capability of graph convolution with the global modeling capability of the state-space model, achieving the fusion of local and global information within a single residual block. For each scale... s The metamap on the top will coarsen the features. (Right now The linear transformation is used as input. First, an adaptive graph convolution operation is performed to aggregate features in the local neighborhood of the supernode, capture local spatial patterns, and obtain local features. The calculation formula is as follows: , in, This is the adjacency matrix of the metagraph. It is the identity matrix. For degree matrix, For learnable convolution kernel parameters, This is the activation function.

[0027] Next, in order to globalize local evidence, local features... Linear mapping to the input of the state space ,in, is a learnable parameter matrix.

[0028] To avoid the problem of traditional GNNs requiring multiple layers to capture long-range dependencies, the multi-level G-Mamba module introduces a state-space operation inspired by the Mamba model. It sorts the supernodes according to the graph's Fiedler vectors to ensure that spatially adjacent nodes are also adjacent in the sequence. Then, a causal cumulative summation operation is applied to this node sequence to simulate global information diffusion, yielding the global hidden state. The calculation formula is as follows: , in, To sum up cumulatively, This represents the node sequence dimension. It is the hyperbolic tangent activation function.

[0029] Simultaneously, a modulation gate is generated through a gated branch. ,in, A learnable parameter matrix used for the global hidden state. Modulation is performed.

[0030] Finally, the modulated state is projected back into the original feature space and compared with local features. Perform residual connections to obtain spatial embeddings specific to this scale. The calculation formula is as follows: , in, and For a learnable parameter matrix, This represents the Hadamard product. Fiedler sorting ensures that spatially close supernodes remain adjacent in the sequence, allowing the one-dimensional cumulative sum to approximate the diffusion process on the graph while maintaining linear complexity.

[0031] The cross-scale interaction module is the final submodule of the multi-scale spatial encoder. Its function is to effectively fuse features extracted by the MLGM at different scales and inject macroscopic information into the microscopic sensor-level representation. The cross-scale interaction module employs a query-based attention mechanism to address the semantic gap problem in multi-scale feature fusion. First, utilize the soft allocation matrix generated in the MGL stage. This involves upsampling coarser-scale (e.g., community-level) feature representations back to the original sensor-level representation. Then, the sensor-level features are used as the query... The upsampled multi-scale features (such as road-level and community-level features) are concatenated and used as the key. Sum By performing multi-head attention computation, the correlation between each sensor and macroscopic features at different scales is dynamically evaluated, and weighted fusion is performed accordingly. , This mechanism allows the model to adaptively select the most relevant macroscopic information for different sensors, achieving seamless integration of multi-scale spatial knowledge and ultimately generating a multi-scale spatial feature vector that contains both fine local information and rich global context.

[0032] In this embodiment, the multi-granularity temporal mixer in S2 is a module specifically responsible for processing time series data. Its design goal is to address the problem that traditional time series models struggle to simultaneously capture multi-scale temporal patterns. The multi-granularity temporal mixer, through a series of carefully designed operations, decomposes, models, and fuses complex time series data, ultimately generating a feature representation that comprehensively reflects temporal dynamics. The multi-granularity temporal mixer mainly consists of four sub-modules: a multi-resolution representation module, a temporal decoupling module, a bidirectional exchange module, and a cross-granularity alignment module. The multi-resolution representation module is the first submodule of the multi-granularity temporal mixer. Its core task is to construct a multi-resolution representation hierarchy from the original traffic time series. This module argues that directly inputting the high-frequency raw sequences into a single deep model in the expectation that it will implicitly learn patterns across all time scales is inefficient and error-prone. Therefore, this module explicitly generates a series of subsequences with progressively decreasing temporal resolution through successive average pooling operations. ,in, , The pooling window size is used. This explicit multi-resolution construction not only reduces temporal redundancy, allowing the model at each resolution to focus on learning features at its corresponding scale, but also ensures that each resolution has a receptive field that matches its dynamic characteristics.

[0033] The time decoupling module is one of the core innovations of the multi-granularity time mixer. Its goal is to further decompose the time series at each resolution into three independent components with clear physical meaning: the trend component. Seasonal portion and abnormal components This explicit decoupling, compared to implicit learning by the model, offers better interpretability and generalization ability. This module employs a decomposition method based on classical signal processing theory: First, a moving average filter is used to extract the low-frequency trend components in the sequence, representing long-term changes in traffic flow: ; Then, after removing the trend component from the original sequence, a discrete Fourier transform is applied to the residual sequence to identify and extract the main periodic frequency components, which constitute the seasonal components: ; Finally, after removing the trend and seasonal components from the original sequence, the remaining portion is defined as the anomalous component, capturing fluctuations that deviate from regular patterns caused by sudden events: ; In this way, the original signal is explicitly unwrapped as follows: .

[0034] The bidirectional exchange module is a key component in the multi-granularity temporal mixer responsible for information exchange between different temporal granularities. Its design is based on an important observation: patterns at different time scales are not independent but rather exhibit complex interrelationships. To capture this cross-scale interaction, the module employs a mechanism that incorporates both "top-down" and "bottom-up" information flows. In the top-down path, learnable upsampling operations are used. This propagates coarse-grained trend and anomaly information to finer time scales, providing macro-context for fine-grained predictions: , ; In the bottom-up path, learnable downsampling operations are used. This aggregates fine-grained seasonal patterns onto a coarser time scale, injecting richer details into the macroscopic representation: ; This structured, two-way information exchange not only simulates the hierarchical influence of time dynamics in the real world, but also keeps computational complexity at a low level through parameter sharing and efficient sampling operations.

[0035] The cross-granularity alignment module is the final submodule of the multi-granularity temporal mixer. Its task is to fuse features from different temporal resolutions after bidirectional exchange processing and generate a unified temporal feature representation. Directly concatenating or averaging features from different resolutions often leads to performance degradation due to "phase shift" and "semantic inconsistency." To address this issue, this module introduces an alignment mechanism. Before fusion, a learned alignment function is used... Features of each resolution Mapping to a unified temporal and semantic space The alignment function is inspired by dynamic time warping, which can non-linearly adjust time series to achieve alignment.

[0036] In addition, this module introduces a scale-aware gating mechanism, using learnable gating weights. During fusion, weights are dynamically assigned to features at different resolutions, enabling the model to adaptively select the most relevant information based on the current task. .

[0037] In this way, the cross-granularity alignment module ensures that trend, seasonal, and anomaly information from different scales can be coherently and effectively integrated, ultimately generating a high-quality, information-rich multi-granularity temporal feature vector.

[0038] The spatiotemporal fusion unit in S3 is the final core module of DMNet, playing a crucial role in integrating all information and generating the final prediction. The design goal of the spatiotemporal fusion unit goes beyond simple feature concatenation, deeply mining and explicitly modeling the complex interactions and causal relationships between the spatial and temporal dimensions. The spatiotemporal fusion unit mainly consists of two sub-modules: an intra-domain self-enhancing module and a cross-domain bridging module. The intra-domain self-enhancement module is the first sub-module of the spatiotemporal fusion engine. Its design purpose is to process the temporal feature maps from the multi-granularity temporal mixer separately before performing cross-domain fusion. Spatial feature maps from multi-scale spatial encoders This module undergoes independent refinement and enhancement. It first utilizes learnable mappings. and Temporal and spatial features are projected into a shared latent space to ensure that their feature dimensions are consistent and comparable. Then, within each domain, a domain-specific self-attention operator is applied. It automatically identifies and amplifies the most informative patterns for the prediction task while suppressing irrelevant noise and fluctuations, achieving content-aware gain control. , ; Through this intra-domain enhancement, the model can ensure that the subsequent cross-domain fusion operates on the highest quality and most discriminative feature representations, thereby improving the fusion effect and the accuracy of the final prediction.

[0039] The cross-domain bridging module is the core of the spatiotemporal fusion engine. Its design goal is to explicitly model the bidirectional influence and causal relationships between the spatial and temporal domains. Unlike simply concatenating spatiotemporal features and feeding them into a joint network, the cross-domain bridging module employs an asymmetric cross-attention mechanism. This preserves the independent identity of each domain while achieving complementary and enhanced information. Specifically, the module performs two cross-attention operations: For the first time, the enhanced temporal features are used as the "query," and the enhanced spatial features are used as the "key" and "value," thereby calculating the dependency relationship between the temporal features and the spatial features, and injecting spatial information into the temporal representation: , This allows time-based forecasting to take spatial constraints into account.

[0040] The second operation, conversely, uses the enhanced spatial features as the "query" and the enhanced temporal features as the "key" and "value," thereby injecting temporal dynamic information into the spatial representation: , This allows the representation of spatial features to reflect temporal changes. Through this structured bridging rather than simple merging, the module is able to capture subtle, scale-aware dependencies that are often lost in symmetric fusion schemes.

[0041] In S4, the prediction head is responsible for transforming the enhanced spatiotemporal joint representation into the final traffic flow prediction. To avoid oversmoothing due to simple feature addition, the spatiotemporal joint representation... and To achieve fusion, and through a learnable transformation (Implemented by a multilayer perceptron) The fused representation is processed as follows: ; Then, through a domain-aware gating mechanism, the original temporal features are utilized. The transformed representation is modulated to obtain modulated features. This design enables the model to dynamically and adaptively adjust for the influence of spatial information over time. Finally, the original spatial features are connected via residual connections. Add back to preserve spatial fidelity and obtain the final traffic prediction result. The calculation formula is as follows: , Here, ⊙ represents element-wise product. This design utilizes the joint spatiotemporal context while preserving fine-grained original information, thereby improving the model's robustness and prediction accuracy.

[0042] Furthermore, this invention also provides a training method for a traffic prediction model based on a dual-flow multi-scale framework, comprising the following steps: Data preprocessing: Historical traffic data is filtered from the traffic sensor dataset, including flow rate, speed, timestamps and sensor location information; the data is preprocessed, and based on the pre-set historical data window and label window, the preprocessed historical traffic data is divided into historical spatiotemporal data and corresponding real labels, and the training set, validation set and test set are divided in a 6:2:2 ratio.

[0043] Iterative Training: Historical spatiotemporal data is input into the model constructed based on a dual-stream multi-scale framework for traffic prediction. Spatiotemporal features are extracted using a multi-scale spatial encoder and a multi-granularity temporal mixer, respectively. After fusion by a spatiotemporal fusion unit, the predicted traffic flow is output through the prediction head. Based on a pre-set loss function, the prediction loss between the predicted traffic flow and the actual labels is calculated, and the model parameters are adjusted using the backpropagation algorithm. The loss function uses the mean absolute error, and its calculation formula is as follows: , in, To predict the number of time steps, This represents the number of sensor nodes. For the first i The time step, the first k The actual traffic flow values ​​of each sensor node. This is the corresponding predicted value.

[0044] Based on the above technical solutions, the multi-scale spatial encoder, through dynamic metagraph generation and global-local fusion mechanisms, simultaneously captures short-range and long-range spatial correlations, enhancing spatial feature representation capabilities. Ablation experiments show that removing the metagraph learner or multi-level G-Mamba modules leads to a significant performance degradation, validating their necessity. The multi-granularity temporal mixer, through temporal decoupling and bidirectional information exchange, accurately models trends, seasonalities, and anomaly patterns at different temporal granularities and captures their complex interactions, improving the understanding and prediction capabilities of temporal dynamics. Ablation experiments on the bidirectional exchange module confirm the importance of cross-granularity information flow. The spatiotemporal fusion unit, through intra-domain self-enhancement and cross-domain bridging modules, achieves deep fusion of spatiotemporal features, explicitly modeling the bidirectional influence between time and space dimensions, improving prediction accuracy. The performance degradation of variants without the spatiotemporal fusion unit validates the necessity of jointly modeling spatiotemporal domain features. The prediction head employs domain-aware gated modulation and residual connections to avoid oversmoothing caused by simple addition, utilizing both joint spatiotemporal context and preserving fine-grained information, thus improving model robustness and prediction accuracy.

[0045] The following are several specific implementation methods to illustrate the present invention: Example 1: This embodiment describes in detail a traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination, the overall framework of which is as follows: Figure 1As shown, the method mainly comprises three core modules: a multi-scale spatial encoder (MSSE), a multi-granularity temporal mixer (MGTM), and a spatio-temporal integrator (STI). This method can jointly model the complex multi-scale spatial dependencies and multi-granularity temporal dynamics in traffic data, achieving high-precision prediction of traffic flow.

[0046] Step 1: Data Preprocessing First, historical traffic flow data is acquired from a traffic sensor network (such as the California Performance Measurement System (PEMS)) along with corresponding road network topology information, including sensor locations and connectivity. Each sensor records traffic conditions at 5-minute intervals, generating 288 time steps of data per day.

[0047] The collected raw data is preprocessed, and based on pre-set historical data windows and prediction windows, the preprocessed historical traffic data is constructed into a spatiotemporal input tensor. ,in, For batch size, This represents the number of sensor nodes. The historical time step is used. Simultaneously, the original graph adjacency matrix is ​​constructed. This indicates the spatial connection relationship between sensors.

[0048] The processed dataset is divided into training, validation, and test sets in a 6:2:2 ratio for model training and evaluation.

[0049] Step 2: Two-stream parallel feature extraction Preprocessed spatiotemporal input tensor The inputs are fed in parallel into two core feature extraction modules: a multi-scale spatial encoder and a multi-granularity temporal mixer, to extract deep, hierarchical features in the spatial and temporal dimensions, respectively.

[0050] Step 2.1: Multi-scale spatial encoder processing The multi-scale spatial encoder is responsible for extracting and fusing multi-level spatial dependencies from micro-level road segments to macro-level regions from complex traffic network data. Its processing flow includes the following three steps.

[0051] Step 2.1.1: Metagraph Construction The goal of this step is to automatically discover and construct a set of "metagraphs" reflecting different spatial granularities. First, the original sensor features are fused with learnable location and time codes to form an initial representation rich in spatiotemporal context information.

[0052] Specifically, historical traffic data Obtained through linear projection Then, it is encoded with learnable node positions. and time location encoding By concatenating and normalizing the data, we obtain the position-aware feature tensor. : ; Then, Enter to S Several parallel, differentiable pooling heads are used, each corresponding to a spatial scale (e.g., road segment, community, region). Within each pooling head, a soft assignment matrix is ​​computed using an attention mechanism. The original sensor nodes are soft-distributed across a smaller number of "supernodes": ; Using this soft allocation matrix, the original graph adjacency matrix is... Coarsening is performed to obtain the metagraph adjacency matrix at this scale. The node features are then aggregated to obtain a coarsened feature matrix. This process is completely differentiable, enabling the model to adaptively learn the optimal spatial hierarchy based on the prediction task.

[0053] Step 2.1.2: Multi-level G-Mamba feature extraction For each scale-specific metamap generated in the previous step, this step aims to extract spatial features that contain both local details and global context. These features will be coarsened. (Right now The linear transformation is used as input.

[0054] First, an adaptive graph convolution operation is performed on each metagraph to capture local spatial dependencies and obtain local features: ; Next, to overcome the limitation of traditional graph convolutions, which can only capture long-range dependencies by stacking multiple layers, a global information diffusion mechanism inspired by the state-space model is introduced. After linearly mapping the local features, a causal accumulation operation is performed on the node sequence sorted by the Fiedler vector of the graph to obtain the global hidden state: ; A modulation gate is generated through a gating mechanism to modulate the global state, and then residually connected with local features to obtain a spatial embedding specific to this scale. ; Step 2.1.3: Cross-scale feature interaction and fusion After obtaining independent feature representations at each scale, they need to be effectively fused, and coarser macroscopic information needs to be injected back into the original sensor level. This step employs a query-based attention mechanism to achieve this goal: First, using the soft assignment matrix learned in step 2.1.1, the coarse-scale spatial embedding is upsampled to the sensor level. Then, the sensor-level features are used as the query. The multi-scale features obtained from the above sampling are used as the key. Sum Perform multi-head attention calculation: ; Finally, the attention aggregation result is added to the original sensor-level features using residual summation and layer normalization to obtain the final feature representation of each sensor node that incorporates multi-scale spatial context information, denoted as . .

[0055] Step 2.2: Multi-particle time mixer processing The multi-granularity time mixer focuses on capturing the multi-level dynamic evolution patterns of traffic flow from short-term fluctuations to long-term trends over time. Its processing flow includes the following four steps: Step 2.2.1: Multi-resolution sequence generation This step explicitly constructs a temporal resolution pyramid. By performing multiple, progressively increasing average pooling operations along the time axis on the original time series, a set of subsequences with temporal resolutions ranging from fine to coarse is generated: ; in, This determines the pooling window size. This operation reduces temporal redundancy and ensures that the model at each resolution can focus on learning the temporal patterns at its corresponding scale.

[0056] Step 2.2.2: Decoupling of the time component For each time series obtained in the previous step at each resolution, this step further decomposes it into three independent components with clear physical meaning: trend component, seasonal component, and anomaly component.

[0057] The trend component is extracted using a moving average filter and represents long-term changes in traffic flow. ; The seasonal components are obtained by applying a discrete Fourier transform to the trend-removed sequence to extract its main periodic components: ; Outlier components are the residuals after subtracting trend and seasonal components from the original sequence, capturing non-periodic fluctuations caused by sudden events: ; In this way, the original signal is explicitly unwrapped into a sum of three independent components: ; Step 2.2.3: Cross-granularity bidirectional information exchange This step aims to model the interactions between components at different time granularities, and designs two-way information propagation pathways. These include: Top-down pathway: This approach integrates trend and anomaly information from the coarse-grained layer through a learnable upsampling operation. This is transferred and integrated into the corresponding components of adjacent fine-grained layers: ; Bottom-up approach: Integrating seasonal information from fine-grained layers through learnable downsampling operations. This aggregates and replenishes the seasonal components of the adjacent coarse-grained layer. ; This structured, bidirectional, iterative exchange enables information complementarity and collaborative correction across time scales.

[0058] Step 2.2.4: Cross-granularity feature alignment and fusion After bidirectional exchange, enhanced feature representations are obtained at each resolution. This step introduces alignment and gating mechanisms to fuse features from different resolutions: First, by learning resolution-specific alignment functions The features at each resolution are projected into a unified temporal and semantic space:

[0059] in, These are learnable gating weights used to dynamically control the contribution of features at different resolutions.

[0060] Finally, an information-rich and internally consistent comprehensive temporal feature representation is generated, denoted as... .

[0061] Step 3: Spacetime Fusion Processing The spatial representation obtained in step 2 and time representation The input is processed by the spatiotemporal fusion engine, which performs deep fusion and generates the final prediction. The spatiotemporal fusion engine's processing flow includes the following three steps: Step 3.1: Intra-domain self-reinforcement Before cross-domain fusion, spatial and temporal features are extracted and enhanced independently. First, the spatial feature map... and time feature map By projecting a learnable map onto a shared latent space, scale alignment and feature comparability are ensured. Then, an intra-domain self-attention operator is applied within each domain to selectively amplify informative patterns while suppressing irrelevant fluctuations. ; Step 3.2: Cross-domain bridging An asymmetric cross-attention mechanism is employed to explicitly model the bidirectional influence and causal relationship between the spatial and temporal domains.

[0062] First cross-attention: Using enhanced temporal features as queries and enhanced spatial features as keys and values, spatial information is injected into the temporal representation. ; Second cross-attention: Using enhanced spatial features as queries and enhanced temporal features as keys and values, temporal dynamic information is injected into the spatial representation. ; Step 3.3: Prediction Head Output First, enhance spatiotemporal joint representation Through learnable transformations deal with: ; Then, through a domain-aware gating mechanism, the transformed representation is modulated using the original temporal features, and the original spatial features are added back through residual connections to preserve spatial fidelity. ; in, Represents element-wise product. The final traffic forecast includes traffic flow values ​​for multiple future time steps.

[0063] Step 4: Model Training and Optimization The entire DMNet model is trained end-to-end, with the optimization objective being to minimize the error between the predicted and actual values. The loss function used is the mean absolute error.

[0064] in, To predict the number of time steps, This represents the number of sensor nodes. This represents the actual traffic flow value. This is the corresponding predicted value.

[0065] The Adam optimizer was used for parameter updates, with an initial learning rate of 0.001 and a batch size of 32. During training, early stopping was employed to prevent overfitting; training was stopped and the best model was saved when the performance on the validation set no longer improved for 10 consecutive epochs.

[0066] Example 2: This embodiment provides a traffic flow prediction system based on dual-flow multi-scale spatiotemporal coordination, which adopts a traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination, including a multi-scale spatial encoder module, a multi-granularity time mixer module, and a spatiotemporal fusion module.

[0067] The multi-scale spatial encoder module dynamically constructs a multi-level metagraph from sensors to the community through a metagraph learner. Combined with a multi-level G-Mamba module, it captures the multi-scale spatial dependence of local graph convolution and global state space diffusion, and outputs a spatial feature representation that integrates micro-level road segment and macro-level regional information.

[0068] The multi-granularity time mixer module downsamples the original time series into multiple subsequences with different time granularities through the multi-resolution representation module, decomposes them into trend components, seasonal components, and anomaly components through the time decoupling module, and then realizes cross-granularity information interaction from top to bottom and from bottom to top through the bidirectional exchange module. Finally, a unified multi-granularity time feature representation is generated through the cross-granularity alignment module.

[0069] The spatiotemporal fusion module independently extracts and enhances spatial and temporal features through the intra-domain self-enhancement module. Then, the cross-domain bridging module uses an asymmetric cross-attention mechanism to achieve bidirectional deep fusion of spatiotemporal features. Finally, the traffic flow prediction result is output through domain-aware gating modulation and residual connection in the prediction head.

[0070] This system jointly models multi-granular temporal dynamics and multi-scale spatial dependencies, and utilizes spatiotemporal dual-stream collaborative learning capabilities to comprehensively capture the hierarchical structural features of traffic data, thereby achieving high-precision and robust prediction of urban traffic flow.

[0071] Example 3: To verify the effectiveness of the method of this invention, comparative experiments were conducted on the PEMS04, PEMS08, and Manchester datasets (e.g., Figure 3 , Figure 4 , Figure 5(As shown). PEMS04 contains 307 sensors, covering traffic data from January to February 2018; PEMS08 contains 170 sensors, covering traffic data from July to August 2016. The Manchester dataset contains 277 sensors, covering traffic data from January to May 2022. The time intervals for PEMS04 and PEMS08 datasets are 5 minutes, while the time interval for the Manchester dataset is 15 minutes. All three datasets are divided into training, validation, and test sets in a 6:2:2 ratio. To evaluate the effectiveness of this invention, three metrics are used: Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and Mean Absolute Percentage Error (MAPE). Using this invention, the PEMS04 and PEMS08 datasets use traffic flow from the past 12 time steps to predict traffic flow from the next 12 time steps, while the Manchester dataset uses traffic flow from the past 4 time steps to predict traffic flow from the next 4 time steps.

[0072] This invention is compared with various advanced baseline models, including HA, FC-LSTM, ASTGCN, AGCRN, STGODE, STDN, TESTAM, and STEGCN. Figure 3-5 As can be seen, the method of this invention significantly outperforms all baseline models in terms of the three evaluation metrics: MAE, RMSE, and MAPE. On the PEMS04 dataset, DMNet's MAPE value is 11.65%, a reduction of 3.40% compared to the optimal baseline; on the PEMS08 dataset, DMNet's MAPE value is 8.96%, a reduction of 5.08% compared to the optimal baseline; and on the Manchester dataset, DMNet's MAPE value is 11.80%, a reduction of 22.57% compared to the optimal baseline. This fully demonstrates the superior performance of the method of this invention in traffic flow prediction tasks.

[0073] Simultaneously, extensive ablation experiments were conducted to further verify the effectiveness of each core module. In the ablation experiments, comparative experiments were performed by removing the multi-scale spatial encoder, multi-granularity temporal mixer, spatiotemporal fusion unit, metagraph learner, multi-level G-Mamba module, and bidirectional exchange module, respectively. The results show that the complete model outperforms all variants; removing any module leads to a performance degradation, with the removal of the metagraph learner causing the most significant performance degradation.

[0074] Robustness experiments show that the performance degradation of the proposed method is significantly less than that of the comparative models when Gaussian noise or random missing data is added. Under different data missing rates and noise rates, DMNet's MAPE value outperforms advanced models such as STEGCN, STDN, and TESTAM. This demonstrates that the proposed method possesses strong robustness and is suitable for complex real-world traffic environments.

[0075] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0076] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0077] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0078] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0079] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0080] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0081] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0082] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0083] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination, characterized in that, The method includes: S1: Acquire historical traffic data and input it into a multi-scale spatial encoder. Through a metagraph learner, a set of metagraphs and their soft assignment matrices corresponding to different spatial scales are dynamically generated by combining node location information and time information. The multi-level G-Mamba module is used to alternately perform local graph convolution and global state space scanning on the metagraphs at each scale to extract spatial dependency features at that scale and generate scale-specific spatial embeddings. Through the cross-scale interaction module, the spatial embeddings at different scales are upsampled and fused using the soft assignment matrix to generate a multi-scale spatial feature vector that integrates multi-scale spatial information. S2: Historical traffic data is synchronously input into the multi-granularity temporal mixer. The multi-resolution representation module performs multi-level average pooling downsampling on the original sequence to generate multiple subsequences with different time resolutions. The time unwrapping module explicitly decomposes each resolution subsequence into trend components, seasonal components, and anomaly components. Then, the bidirectional exchange module performs bidirectional information transfer between corresponding components at different resolutions, both top-down and bottom-up. Through the cross-granularity alignment module, the dynamic time warping mechanism performs temporal alignment and adaptive fusion of features at different resolutions after exchange, generating a multi-granularity temporal feature vector that incorporates multi-granularity temporal dynamics. S3: The multi-scale spatial feature vector obtained in S1 and the multi-granularity temporal feature vector obtained in S2 are input in parallel into the spatiotemporal fusion module. Through the intra-domain self-enhancement module, the key features are enhanced and noise is suppressed in the spatial and temporal domains respectively using the local self-attention mechanism to obtain enhanced spatial features and enhanced temporal features. Through the cross-domain bridging module, the cross-domain correlation between the enhanced spatial features and the enhanced temporal features is calculated using the cross-attention mechanism to realize the bidirectional deep fusion of spatial and temporal information and obtain an enhanced spatiotemporal joint representation. S4: The enhanced spatiotemporal joint representation obtained in S3 is input into a prediction head composed of a multilayer sensing mechanism. The prediction head is the last part of the spatiotemporal fusion unit. After linear transformation, the final traffic prediction result is output.

2. The traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination according to claim 1, characterized in that, The generated metagraph and its node assignment matrix in S1 include: Receive historical traffic data Adjacency matrix of the original graph ,in, Indicates batch size. Indicates the number of nodes. Indicates the number of time steps; For the input raw traffic data By using a linear projection layer to map it to a high-dimensional hidden space, the fundamental feature tensor is obtained. ,in To hide the dimension; at this time It only contains numerical states of traffic flow, but has not yet captured the spatial topological location of nodes in the network or their location information on the time axis; by introducing learnable spatial location coding... and time location encoding This enables the model to have spatiotemporal awareness; furthermore, it is expanded into a tensor with the same dimension as the input features through a broadcast operation. and ; basic features Deeply integrated with spatiotemporal coding, it evolves into a spatiotemporal location-aware feature tensor. Its evolutionary relationship is shown in formula (1): ,(1) in, This indicates a splicing operation. The projection matrix is ​​learnable. For layer normalization operation, For activation functions; position-aware feature tensors Enter to S A parallel, differentiable pooling head, each pooling head corresponding to a spatial scale; In each pooling head, a soft allocation matrix is ​​calculated according to formula (2) through an attention mechanism based on feature similarity and geographic proximity. : ,(2) in, The original number of nodes. For the first s Number of supernodes at each scale and The projection matrix is ​​learnable; according to formula (3), the soft allocation matrix is ​​used. For the original graph adjacency matrix Coarsening is performed to obtain the metagraph adjacency matrix at this scale. : ,(3) At the same time, according to formula (4), the soft allocation matrix is ​​used. Node features Aggregation is performed to obtain the coarsened feature matrix at this scale. : ,(4)。 3. The traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination according to claim 1, characterized in that, In S1, a multi-level G-Mamba module is used to alternately perform local graph convolution and global state space scanning on the metagraph at each scale to extract spatial dependency features at that scale and generate scale-specific spatial embeddings, including: Scale-specific features of the input First, adaptive graph convolution is performed to capture local spatial dependencies, and local features are obtained according to formula (5). : ,(5) in, Let s be the adjacency matrix of the s-th scale. It is the identity matrix. For degree matrix, For learnable convolution kernel parameters, For activation functions; Local features Linear mapping to the input of the state space ,in, , is a learnable parameter matrix; A causal cumulative sum operation is performed along the node sequence sorted by the Fiedler vector to simulate global information diffusion, and the global hidden state is obtained according to formula (6). : ,(6) in, To sum up cumulatively, This represents the node sequence dimension. It is the hyperbolic tangent activation function; A modulation gate is generated through a gated branch. , The parameter matrix is ​​learnable and used to represent the global hidden state. Modulation; The modulated state is projected back into the original feature space and compared with local features. Perform residual connections and obtain the final scale-specific spatial embedding according to formula (7). : ,(7) in, and is a learnable parameter matrix.

4. The traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination according to claim 1, characterized in that, In S1, the cross-scale interaction module uses sensor-level features as queries and embeds spatial data at different coarse scales using a soft allocation matrix. After upsampling to the sensor level, the data is used as keys and values, and then fused through a multi-head attention mechanism to obtain a multi-scale spatial feature vector according to formula (8): ,(8) Among them, query Q Embedded by fine-scale space Projection obtained, key K Sum V It is obtained by upsampling, stitching and projecting after coarse-scale embedding.

5. The traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination according to claim 1, characterized in that, S2 include: S21: Through the multi-resolution representation module, historical traffic data... Perform average pooling downsampling at different scales to generate a set of subsequences with different time resolutions. ,in, , This is the pooling window size; S22: Using the time unwrapping module, the signal is decomposed into trend components in each time-resolution subsequence. Seasonal portion and abnormal components ,satisfy Specifically, the trend component is extracted using a moving average filter. Seasonal components are extracted using truncated discrete Fourier transform. And high-frequency anomalies are located through wavelet transform to explicitly extract the original signal. Untangling , This is an abnormal component. For a moving average filter with a window size of k, DFT For Fourier transform, IDFT For truncated inverse discrete Fourier transform; S23: Through a bidirectional exchange module, learnable upsampling and downsampling operations are used to perform bidirectional information transfer between decomposed components in a top-down and bottom-up manner between subsequences with different time resolutions, in order to model cross-granularity temporal interactions; specifically including: In the top-down path, the trend component of the coarse-grained layer is determined according to formula (9). and abnormal components After upsampling, the corresponding component of the fine-grained layer and Add: , ,(9) in, For learnable upsampling operations; In the bottom-up path, the seasonal components of the fine-grained layer are determined according to formula (10). After downsampling, the seasonal components of the coarse-grained layer are compared. The formula for addition is: ,(10) in, This is a learnable downsampling operation; S24: Through the cross-granularity alignment module, dynamic time warping and scale-aware gating mechanisms are used to perform time-series alignment and adaptive fusion on the outputs of different granularities after bidirectional exchange, so as to obtain multi-granularity time feature vectors.

6. The traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination according to claim 1, characterized in that, S3 include: S31: Through the intra-domain self-enhancement module, multi-scale spatial feature vectors and multi-granularity temporal feature vectors are input into the intra-domain self-enhancement module respectively. First, through a learnable mapping... and Time feature map and spatial feature map Project them separately into a shared latent space to ensure scale alignment and feature comparability; then, according to formula (11), apply the intra-domain self-attention operator within each domain. By selectively amplifying informative patterns while suppressing irrelevant fluctuations, content-aware gain control is achieved, resulting in enhanced temporal characteristics. and enhanced spatial features : , ,(11) S32: Through the cross-domain bridging module, the enhanced time characteristics are obtained according to formula (12). and enhanced spatial features It enables two-way interaction and employs a cross-attention mechanism. By using features from one domain as queries and features from another domain as keys and values, asymmetric information flow is achieved. This preserves the identity of features from each domain while enriching their respective representations with complementary signals from the other domain, resulting in a final spatiotemporal joint representation. and The calculation formula is: , ,(12) in, and To enhance the spatiotemporal joint representation by incorporating cross-domain information, the input is fed into the prediction head for traffic prediction.

7. The traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination according to claim 1, characterized in that, The prediction header in S4 includes: According to formula (13), the enhanced spatiotemporal joint characterization and To achieve fusion, through a learnable transformation. The fused characterization is then processed: ,(13) According to formula (14), the original time features are utilized through the domain-aware gating mechanism. The transformed representation is modulated to obtain modulated features. The original spatial features are then added back through residual connections to preserve spatial fidelity, resulting in the final traffic prediction result. The calculation formula is: ,(14)。 8. A traffic flow prediction system based on dual-flow multi-scale spatiotemporal coordination, characterized in that, The system includes a multi-scale spatial encoder module, a multi-granularity temporal mixer module, and a spatiotemporal fusion module; wherein... The multi-scale spatial encoder module is used to dynamically construct a multi-level metagraph from the sensor to the community through the metagraph learner. Combined with the multi-level G-Mamba module, it captures the multi-scale spatial dependence of local graph convolution and global state space diffusion, and outputs a spatial feature representation that integrates micro-road segment and macro-region information. The multi-granularity time mixer module is used to downsample the original time series into multiple subsequences with different time granularities through the multi-resolution characterization module, decompose them into trend components, seasonal components and anomaly components through the time decoupling module, realize cross-granularity information interaction from top to bottom and from bottom to top through the bidirectional exchange module, and finally generate a unified multi-granularity time feature representation through the cross-granularity alignment module. The spatiotemporal fusion module is used to independently extract and enhance spatial and temporal features through the intra-domain self-enhancement module, and then achieve bidirectional deep fusion of spatiotemporal features through the cross-domain bridging module using an asymmetric cross-attention mechanism. Finally, the final traffic flow prediction result is output through the domain-aware gating modulation and residual connection in the prediction head.

9. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores instructions for causing the machine to execute the traffic flow prediction method based on dual-stream multi-scale spatiotemporal coordination as described in any one of claims 1-7.

10. A processor, characterized in that, Used to run a program, wherein the program is run to perform the traffic flow prediction method based on dual-flow multi-scale spatiotemporal coordination as described in any one of claims 1-7.