A traffic flow prediction method for multi-modal traffic data
By constructing a multimodal spatiotemporal encoder, the problem of difficulty in characterizing the cooperative and competitive relationships among multiple traffic modes was solved, enabling efficient and accurate prediction of multimodal traffic flow and improving prediction accuracy and computational efficiency.
Patent Information
- Application Number
- CN202611180685.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-11-27
AI Technical Summary
Existing traffic flow prediction methods are unable to fully characterize the cooperative and competitive relationships among multiple traffic modes, and are unable to adapt to the differentiated temporal variation characteristics and long-distance spatial dependencies in multimodal traffic flows, resulting in insufficient prediction accuracy.
A multimodal spatiotemporal encoder is constructed, including a linearized global spatial dependency module, a static-dynamic fusion modal interaction graph module, and a modality-aware temporal hybrid expert module. Through global spatial correlation modeling, cross-modal interaction modeling, and temporal dependency modeling, it adaptively generates multi-scale temporal evolution laws. Combined with global self-supervised learning and modal self-supervised learning, it enhances feature representation capabilities.
It improves the accuracy and efficiency of multimodal traffic flow prediction, effectively captures the spatiotemporal correlation features and cross-modal collaborative relationships among multiple traffic modes, reduces computational complexity, and improves prediction accuracy.
Smart Images

Figure CN123182402A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent transportation and deep learning technology, and in particular relates to a traffic flow prediction method for multimodal traffic data applicable to scenarios such as traffic resource allocation, smart city traffic scheduling, and regional traffic operation monitoring. Background Technology
[0002] With the continuous advancement of urbanization, urban transportation systems are gradually exhibiting characteristics of multi-modal integrated development. Shared bicycles, electric bicycles, taxis, and other transportation modes collectively constitute a complex urban travel network, and the resulting traffic flow data can be viewed as different traffic modes from a data representation perspective. Accurately predicting the inflow and outflow volumes of different traffic modes in various urban areas is of great significance for optimizing the allocation of transportation resources, managing travel demand, and refining urban traffic governance.
[0003] Most existing traffic flow prediction methods focus on a single traffic mode, such as independently predicting the traffic flow of shared bicycles, electric bicycles, and taxis. While these methods can uncover the spatiotemporal evolution patterns of a single traffic mode, they neglect the prevalent correlations between different traffic modes. In reality, multiple traffic modes collectively serve urban travel needs, and their traffic flow changes are correlated and complementary in both time and space. Jointly modeling multimodal traffic data helps to fully utilize the correlation information between modes and improve the accuracy of traffic flow prediction.
[0004] However, existing multimodal traffic flow prediction methods still have certain limitations. First, existing methods typically use a uniform temporal modeling mechanism to process time series of different traffic modes, assuming that different modes and spatial nodes have similar temporal evolution patterns, which makes it difficult to adapt to the differentiated temporal variation characteristics existing in multimodal traffic flows. Second, existing methods cannot fully characterize the complex cooperative and competitive relationships between different traffic modes, resulting in insufficient mining of cross-modal correlation features and limiting the improvement of prediction performance. In addition, existing graph convolution-based methods are limited by local neighborhood aggregation mechanisms, making it difficult to fully characterize long-distance spatial dependencies between regions. Although self-attention-based methods have the ability to model global spatial correlations, their high computational complexity limits their efficient application in large-scale traffic networks.
[0005] Therefore, there is an urgent need for a traffic flow prediction method for multimodal traffic data, which can improve the accuracy of traffic flow prediction by collaboratively mining the shared patterns and differences among different traffic modes. Summary of the Invention
[0006] This invention proposes a traffic flow prediction method for multimodal traffic data. The method takes multimodal traffic data as input, constructs a multimodal flow tensor, generates an initial multimodal spatiotemporal feature representation, and simultaneously completes temporal attribute embedding encoding. Subsequently, a multimodal spatiotemporal encoder is constructed to perform spatial correlation modeling, cross-modal interaction modeling, and temporal dependency modeling. Specifically, a linearized global spatial dependency module is used to capture global spatial correlations between regions; a static-dynamic fusion modal interaction graph module is constructed to achieve adaptive interaction and fusion of cross-modal information; a modality-aware temporal hybrid expert module is constructed, which adaptively generates selection weights for each temporal modeling expert by combining temporal context information and modality-space differences through a modality-space-aware temporal router, and dynamically selects and weights multiple types of temporal modeling experts to achieve adaptive modeling of multi-scale temporal evolution laws, obtaining a multimodal spatiotemporal encoded representation. Simultaneously, global self-supervised learning and modality self-supervised learning are introduced to constrain the latent space representation, enhancing the distinguishing and representational capabilities of different traffic modal features. Finally, the predictor outputs the traffic flow prediction results for each region and each traffic modality at future time steps. This invention can fully explore the spatiotemporal correlation features and cross-modal collaborative relationships in multimodal traffic data, and effectively improve the accuracy of traffic flow prediction while maintaining low computational overhead.
[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A traffic flow prediction method for multimodal traffic data includes: S1. Collect traffic flow data of multiple traffic modes, construct a multimodal traffic flow tensor and generate an initial multimodal spatiotemporal feature representation, and at the same time acquire and encode time attributes to obtain a time attribute embedded representation; S2. Construct a multimodal spatiotemporal encoder that includes a linearized global spatial dependency module, a static-dynamic fusion modal interaction graph module, and a modality-aware temporal hybrid expert module. Capture spatiotemporal and modal dependency associations based on the initial multimodal spatiotemporal feature representation to generate a multimodal spatiotemporal encoded representation; use it as input to the predictor to generate multimodal traffic flow prediction results.
[0008] Preferably, S2 includes: S21. Using the linearized global spatial dependency module, capture the global spatial dependency relationship between regions and generate a global spatial dependency feature representation; S22. The correlation between different traffic modes is modeled by the static and dynamic fusion modal interaction graph module to obtain the modal interaction feature representation; S23. Based on modal interaction feature representation and current coding layer input features, a modal-aware temporal hybrid expert module is adopted. By constructing a time modeling expert library composed of multiple time modeling experts with differentiated time modeling capabilities, multi-scale time evolution features are adaptively modeled for different traffic modalities. S24. Construct a modality-space-aware temporal router to adaptively fuse the outputs of each temporal modeling expert. The fusion result is then transformed by the output mapping layer, and the spatiotemporal feature representation of the current coding layer is updated by combining the residual connection.
[0009] Preferably, in S2, the global spatial dependency module, the static-dynamic fusion modal interaction graph module, and the modal-aware temporal hybrid expert module constitute a coding layer; the multimodal spatiotemporal encoder has multiple coding layers stacked; the spatiotemporal feature representations generated by each coding layer are updated through residual connections, and finally output multimodal spatiotemporal coded representations.
[0010] Preferably, S21 includes: The initial multimodal spatiotemporal feature representation at time step t is mapped to a high-dimensional feature space using a nonlinear feature mapping method. A dynamic spatial correlation matrix is constructed based on the mapped feature representation. The quadratic complexity of attention computation in traditional spatial attention is transformed into linear complexity using the kernel function approximation idea, thus achieving efficient modeling of spatial correlation features.
[0011] Preferably, S22 includes: A learnable global static modal relationship matrix is introduced, whose elements represent the background correlation between different traffic modes; For the spatial feature representations corresponding to each traffic mode at each time step, query features, key features, and value features are generated through linear mapping. Scaled dot product attention is used to calculate the dynamic modal association score between different traffic modes. The dynamic modal association score is nonlinearly mapped and fused with the global static modal relationship matrix to construct the static-dynamic fused modal interaction graph for the current time step. The edge weights between different traffic modes in the modal interaction graph are the values of the dynamic modal association scores activated by the hyperbolic tangent function plus the corresponding element values in the global static modal relationship matrix. The value features of each traffic mode are weighted and aggregated using the edge weights between modes to obtain the modal interaction features corresponding to each traffic mode at each time step; the modal interaction features are then concatenated along the modal dimension to obtain a unified modal interaction feature representation.
[0012] As a preferred embodiment, S23 includes: Spatial feature representation, modal interaction feature representation, and current coding layer input features are concatenated to obtain hybrid input features. These hybrid input features are then input in parallel to various time-modeling experts for feature extraction, learning the evolutionary characteristics of traffic flow from different time scales. The time-modeling experts include: Trend experts are used to extract long-term trends in traffic flow; they generate trend feature representations based on mixed input features. Periodic experts are used to model the periodic variation patterns of traffic flow. They achieve the conversion between the time domain and the frequency domain through fast Fourier transform, and after completing feature learning in the frequency domain, they restore it to the time domain to generate a periodic feature representation. Wave expert is used to model the dynamic changes of traffic flow on a short time scale. Wave expert adaptively enhances the short-time wave feature response through short-time dynamic feature extraction and gating modulation mechanism to obtain wave feature representation. Direct connection experts are used to retain the basic temporal information in the input features and generate direct connection feature representations.
[0013] Preferably, S24 includes: The temporal attribute embedding representation is input into the GRU network to encode the temporal context, obtaining the temporal context representation corresponding to the current time step. A temporal routing representation is generated by linearly mapping the temporal context representation using the temporal routing projection matrix and bias parameters. A learnable modality-spatial routing bias is defined. The temporal routing representation is extended along the modality and spatial dimensions and added element-wise with the modality-spatial routing bias to obtain the expert routing score. Softmax normalization is performed on the expert routing score in the expert dimension to generate expert routing probabilities, which characterize the selection weights of different traffic modes for each temporal modeling expert at different spatial nodes. Based on the generated expert routing probabilities, the outputs of the modeling experts at each time are weighted and fused to obtain the fused time features of each traffic mode at each spatial node. The fusion temporal features corresponding to each traffic modality and spatial node are combined to form the overall output features of the modality-aware temporal hybrid expert module. The overall output features are transformed by the output mapping layer and the spatiotemporal feature representation of the current coding layer is updated by combining the residual connection. After multiple coding layers are stacked in sequence, the final multimodal spatiotemporal coding representation is obtained.
[0014] As a preferred embodiment, the method further includes: S3, using a modality-aware data augmentation mechanism to enhance the multimodal spatiotemporal coding representation, specifically: extracting the latent space representation between different traffic modes along the traffic modality dimension of the multimodal spatiotemporal coding representation, and calculating the modal similarity between different traffic modes using cosine similarity; based on the feature retention probability obtained by mapping the modal similarity; adaptively generating a random mask using Bernoulli distribution based on the feature retention probability; applying the random mask to the multimodal flow tensor to obtain an enhanced view and sending it to the multimodal spatiotemporal encoder for feature extraction to obtain the enhanced spatiotemporal coding representation.
[0015] As a preferred option, it also includes: S4, defining global self-supervised loss and modal self-supervised loss, and applying self-supervised constraints to multimodal spatiotemporal coding representation and augmented spatiotemporal coding representation.
[0016] As an alternative, it also includes: S5, combining supervised prediction loss, global self-supervised loss and modal self-supervised loss to construct a joint training objective; and using the trained model to output future multimodal traffic flow prediction results.
[0017] Compared with the prior art, the beneficial effects of the present invention are reflected in: 1. Unlike traditional techniques that model individual traffic modalities separately, which struggle to fully depict the complex collaborative and competitive relationships between multiple traffic modalities, this invention proposes a static-dynamic fusion modal interaction graph module. This module integrates global static modal relationships and dynamic modal association features to construct a modal interaction graph that simultaneously represents both long-term stable associations between traffic modalities and dynamic associations within different scenarios. Furthermore, it adaptively adjusts the intensity of cross-modal information transmission based on the modal interaction relationships under different traffic scenarios, achieving efficient information interaction and feature fusion among multiple traffic modalities.
[0018] 2. Unlike traditional technologies that use a single fixed temporal modeling unit to depict the temporal dependencies of traffic flow and are difficult to adapt to the differentiated temporal evolution patterns of different traffic modes and spatial nodes, this invention proposes a modality-aware temporal hybrid expert module. This module divides the modeling work among multiple temporal modeling experts to model the long-term trends, periodic changes, short-term fluctuations, and basic temporal information of traffic flow. Furthermore, it utilizes a modality-space-aware temporal router to adaptively generate expert fusion weights based on the temporal context and modality-space differences, thereby achieving dynamic modeling and adaptive fusion of features at multiple time scales and improving the prediction accuracy of multimodal traffic flow.
[0019] 3. Unlike traditional techniques that use quadratic complexity self-attention mechanisms to model global spatial relationships, leading to excessive computational and storage overhead, this invention proposes a linearized global spatial dependency module. This module transforms self-attention computation into linear complexity computation through stochastic feature mapping and adaptively constructs spatial relationships between regions based on input features. It can effectively capture long-distance spatial dependencies of multi-modal traffic flows across different regions, providing more comprehensive global spatial information for multi-modal traffic prediction. Attached Figure Description
[0020] Figure 1 This is a model structure diagram of Embodiment 1 of the present invention; Figure 2 This is a structural diagram of the multimodal spatiotemporal encoder of Embodiment 1 of the present invention; Figure 3 This is a schematic diagram showing the comparison between the predicted value and the actual value in Embodiment 1 of the present invention. Detailed Implementation
[0021] To make the technical means, inventive features, objectives, and effects of the invention readily understandable, the invention is further described below with reference to specific illustrations. However, the invention is not limited to the embodiments described below.
[0022] It should be noted that the structures, proportions, sizes, etc., illustrated in the accompanying drawings of this specification are only used to complement the content disclosed in the specification for those skilled in the art to understand and read, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0023] The model structure is shown in the figure. First, a multimodal flow tensor is constructed based on the input multimodal traffic data, and feature mapping is performed to obtain the initial multimodal spatiotemporal feature representation. Z The initial multimodal spatiotemporal feature representation and the time attribute embedding representation are combined with time attributes such as hour, day of the week, and holidays to generate a time attribute embedding representation. Then, the initial multimodal spatiotemporal feature representation and the time attribute embedding representation are input into the multimodal spatiotemporal encoder to obtain the spatiotemporal encoded representation. H This system is used for traffic flow prediction tasks. The multimodal spatiotemporal encoder includes a linearized global spatial dependency module, a static / dynamic fusion modal interaction graph module, and a modal-aware temporal hybrid expert module. Simultaneously, to enhance the model's ability to represent multimodal traffic data, modal-aware data augmentation is performed on the input data to construct an augmented view. and the initial multimodal spatiotemporal feature representation Encoding is performed using the same multimodal spatiotemporal encoder. Based on the original spatiotemporal coding representation. H Enhanced spatiotemporal coding representation This paper defines global self-supervised loss and modal self-supervised loss, and constrains the latent space representation from two aspects: global distribution consistency and modal feature discriminability. Finally, the supervised prediction loss, global self-supervised loss and modal self-supervised loss are jointly optimized to improve prediction accuracy and enhance the model's generalization ability to complex multimodal traffic scenarios.
[0024] Example 1: A traffic flow prediction method for multimodal traffic data includes the following steps: Step 1: Construct a multimodal flow tensor and generate an initial multimodal spatiotemporal feature representation, while simultaneously completing the temporal attribute embedding encoding; Collect traffic flow data from multiple transportation modes and divide the urban area into... N Each region is analyzed. The inflow and outflow volumes for each region under different traffic modes are statistically analyzed and uniformly represented as a multimodal flow tensor. ,in, T Indicates the number of historical time steps. Indicates the number of regions. Indicates the number of traffic modes. This represents the feature dimensions corresponding to each traffic mode, such as inflow and outflow. The multimodal flow tensor is input into the feature projection layer, and the original features are projected onto the hidden feature space through linear mapping. Three-dimensional convolution is then used to encode local spatiotemporal correlations and modal correlations, generating an initial multimodal spatiotemporal feature representation. Z .
[0025] The time attributes such as hour, day of the week, and holidays corresponding to each time step are obtained and mapped into embedding vectors through learnable embedding encoding. Then, the embedding vectors of each time attribute are concatenated to obtain the time attribute embedding representation. .
[0026] Step 2: Construct a multimodal spatiotemporal encoder to capture complex spatiotemporal and modal dependency relationships.
[0027] like Figure 2 As shown, a multimodal spatiotemporal encoder is used to jointly model spatial dependencies, modal interactions, and temporal evolution patterns in transportation networks. The encoder consists of multiple cascaded coding layers, obtaining the final multimodal spatiotemporal encoded representation through layer-by-layer feature updates. In each coding layer, spatial dependency features and modal interaction features are first extracted using a linearized global spatial dependency module and a static-dynamic fusion modal interaction graph module, respectively. Then, these two types of features are concatenated with the current layer's spatiotemporal features and input into a modality-aware temporal hybrid expert module to adaptively model evolutionary features at different time scales. Finally, the current layer's spatiotemporal features are updated through residual connections, providing input for the next coding layer.
[0028] Step 2.1: Use the linearized global spatial dependency module to capture the global spatial dependencies between regions.
[0029] To capture global spatial dependencies in transportation networks and reduce the computational and storage overhead of traditional Transformer self-attention mechanisms due to the construction of a global attention matrix, a random feature mapping function is introduced using the initial multimodal spatiotemporal feature representation as input. The kernel function is used to approximate the original quadratic complexity attention computation into a linear complexity computation, thereby achieving efficient global information interaction between regional nodes.
[0030] Specifically, through the random feature mapping function The first t Initial multimodal spatiotemporal feature representation at each time step Mapping to the kernel feature space and constructing a dynamic spatial correlation matrix. Among them, matrix elements Indicates the first t Time step region iWith the region j The spatial correlation strength between them. To avoid the computational and storage overhead of explicitly constructing and storing the spatial correlation matrix, the associative law of matrix multiplication is used to transform the spatial propagation process. Convert to linear complexity calculation: in, Indicates the first t The spatial feature representation after global spatial dependency modeling at each time step (i.e., global spatial dependency feature representation). First, the features of all regional nodes are globally aggregated to extract the global spatial context information of the transportation network. Then, the left-multiplication method is used. The aggregated global context information is adaptively distributed to each region node, enabling each node to perceive the state information of other nodes in the global scope, thereby effectively capturing the global spatial dependencies between regions.
[0031] To improve the numerical stability of model training, a normalization matrix is introduced. The spatial propagation results are normalized. Represents a column vector consisting entirely of 1s, a matrix The diagonal elements represent the cumulative association strength between each node and the global spatial context information. Through... Left multiplication of normalized matrix This ensures that the characteristic responses of different nodes remain within a similar numerical range, preventing some nodes from having abnormally amplified characteristic values due to excessive cumulative correlation strength.
[0032] Step 2.2: Model the relationships between different traffic modes using the static-dynamic fusion modal interaction graph module.
[0033] To adaptively learn the collaborative and competitive relationships between different travel modalities under different regional and temporal conditions, a static-dynamic fusion modal interaction graph module is constructed.
[0034] First, a learnable global static modal relation matrix is introduced. , where matrix elements Indicates the first Traffic modes and the first The matrix represents a relatively stable background correlation among various traffic modes. It is orthogonally initialized and jointly optimized with other network parameters during model training.
[0035] Next, regarding the first The first time step Spatial feature representation of traffic modes Query features are generated through linear mapping. Key features Sum value characteristics : in, Depend on Sliced along the traffic modal dimension, , , and It is a learnable projection matrix.
[0036] Subsequently, the scaled dot product attention is used to compute the first... m Traffic modes and the first n Dynamic modal association scores for various traffic modes: in, This represents the inner product operation. d This is the feature dimension scaling factor.
[0037] To simultaneously characterize both long-term stable and time-varying dynamic correlations among traffic modes, a nonlinear mapping is applied to the dynamic mode correlation scores, which are then fused with the global static mode relation matrix to construct the current time step. t The static and dynamic fusion modal interaction diagram, the first in the modal interaction diagram m Traffic modes and the first n Edge weights between different traffic modes It is used to characterize the comprehensive interaction intensity between different traffic modes.
[0038] Subsequently, using Value characteristics of each traffic mode Perform weighted aggregation to obtain the first... t The first time step m Modal interaction features corresponding to various traffic modes : Finally, the modal interaction features corresponding to each traffic mode are concatenated along the modal dimension to obtain a unified modal interaction feature representation. .
[0039] Step 2.3: Adopt the modality-aware temporal hybrid expert module to adaptively model the multi-scale temporal evolution characteristics of different traffic modes.
[0040] To integrate spatial correlation, cross-modal interaction and temporal evolution information, a modal-aware temporal hybrid expert module is constructed to jointly model the traffic flow evolution patterns at different time scales.
[0041] First, the spatial features obtained in step 2.1 are represented. The modal interaction feature representation obtained in step 2.2 With the input features of the current coding layer By concatenating the features, we obtain the mixed input features. Then, a time modeling expert pool is constructed, consisting of multiple experts with differentiated time modeling capabilities, and... Parallel input is used from various time-based modeling experts to extract features, learning the evolutionary characteristics of traffic flow at different time scales. The time-based modeling expert database can include the following four types of experts: Trend experts are used to extract long-term trends in traffic flow. By suppressing short-term random fluctuations and highlighting long-term change information, they generate trend feature representations. Here, AvgPool3D represents the average pooling operation performed along the time dimension, and Conv3D represents three-dimensional convolution, which is used to map features to the hidden feature space.
[0042] Periodicity experts are used to model the periodic variations in traffic flow. They can achieve the conversion between the time and frequency domains using Fast Fourier Transform, and after feature learning in the frequency domain, the data is restored to the time domain to generate a periodic feature representation. in, This represents the frequency domain feature learning module. FFT and iFFT represent Fast Fourier Transform and Inverse Fast Fourier Transform, respectively.
[0043] Wave expert theory is used to model the dynamic changes of traffic flow on short timescales. By adaptively enhancing the short-time wave characteristic response through short-time dynamic feature extraction and gating modulation mechanisms, the wave characteristic representation is obtained: in, This indicates the short-term dynamic feature extraction branch. Indicates the gated modulation branch, This indicates element-wise multiplication.
[0044] Directly connected experts are used to preserve the basic temporal information in the input features. Directly connected features are represented as follows: .
[0045] Step 2.4: Construct a modal-space-aware temporal router to achieve adaptive fusion of multiple temporal modeling experts.
[0046] To adaptively allocate computational weights for different time modeling experts based on temporal context and to fuse the output features of different time modeling experts, a modality-space-aware temporal router is constructed.
[0047] First, the temporal attributes of multiple consecutive historical time steps obtained in step 1 are embedded into a representation sequence. The input is processed by a GRU network to encode the time context, thus obtaining the time context representation corresponding to the current time step. Subsequently, a time-routing representation is generated through a linear mapping. .in, and These are the time-route projection matrix and the bias parameter, respectively.
[0048] To enable temporal routing to perceive the differentiated temporal evolution characteristics of different traffic modes and spatial nodes, a learnable modality-spatial routing bias is introduced. ,in M Indicates the number of traffic modes. N Indicates the number of regions. K This represents the number of time modeling experts. It also represents the time routing. Extend along the modal and spatial dimensions, and with E The expert routing score is obtained by adding each element together. Softmax normalization is performed on the expert routing scores at the expert dimension to generate expert routing probabilities, which are used to characterize the selection weights of different traffic modes for modeling experts at different spatial nodes and time periods.
[0049] Based on the generated expert routing probabilities, the modeling expert outputs at each time point are weighted and fused to obtain the... m Traffic modes in the first n Fusion time features corresponding to each spatial node: in, Indicates the first m Traffic modes in the first n The spatial node is selected as the first k Routing probabilities of a time modeling expert Indicates the first k The output features of a time modeling expert at the corresponding traffic modes and spatial nodes.
[0050] Finally, the fused temporal features corresponding to each traffic modality and spatial node are combined to form the overall output feature of the modality-aware temporal hybrid expert module. This output feature undergoes feature transformation through an output mapping layer and is combined with residual connections to update the spatiotemporal feature representation of the current coding layer. After multiple coding layers are stacked sequentially, the final multimodal spatiotemporal coded representation is obtained. This is used for subsequent self-supervised constraint learning and flow prediction.
[0051] Step 3: Employ a modal-aware data augmentation mechanism to obtain an augmented view for self-supervised learning, and feed it into a multimodal spatiotemporal encoder to obtain an augmented spatiotemporal encoded representation.
[0052] For multimodal spatiotemporal coding representation Extracting the first mode along the traffic modal dimension m species and first n The latent space representations corresponding to the three traffic modes are denoted as follows: and Calculate the modal similarity between different traffic modes using cosine similarity: in, Indicates the first m Traffic modes and the first n Modal similarity between different traffic modes. Larger... This indicates that the two traffic modes have a stronger correlation, while the smaller correlation indicates a weaker correlation. This indicates that the two traffic modes have more significant differences.
[0053] Subsequently, a random mask is adaptively generated based on modal similarity. ,in Indicates the Bernoulli distribution. Indicates based on modal similarity The probability of feature retention obtained from mapping. When two traffic modes have high similarity, the corresponding features are more likely to be masked; while when two traffic modes have low similarity, the corresponding features are more likely to be retained, thereby enhancing the model's ability to learn the differences in features between different traffic modes.
[0054] Then, the generated mask Acting on multimodal flow tensor Get an enhanced view .Will The data is fed into a multimodal spatiotemporal encoder for feature extraction to obtain an enhanced spatiotemporal coded representation. .
[0055] Step 4: Construct global self-supervised loss and modal self-supervised loss for global self-supervised learning and modal self-supervised learning, respectively.
[0056] To characterize the global latent distribution features in multimodal traffic data, a global self-supervised learning mechanism is introduced. Considering that traffic flow features are usually composed of multiple latent spatiotemporal patterns, a Gaussian mixture model is used to enhance the spatiotemporal encoding representation. The probability distribution is modeled, and the learned global distribution is used as a self-supervised constraint to guide the original spatiotemporal encoding representation to maintain a consistent global distribution structure with the enhanced spatiotemporal encoding representation. The global self-supervised loss is defined as: in, , , These represent the number of time steps, the number of regions, and the number of traffic modes, respectively. C This represents the number of Gaussian components in the Gaussian mixture model. and They represent and At time step t ,area n and traffic modes m The corresponding latent vector, express Belongs to the c The probability of a Gaussian component. and They represent the first c The mean vector and covariance matrix of each Gaussian component. This represents the Gaussian probability density function.
[0057] To learn the unique latent representation patterns of each traffic mode and enhance the model's ability to represent inter-modal differences, a modal self-supervised learning mechanism is introduced. The original spatiotemporal encoding representation and the enhanced spatiotemporal encoding representation are fused to obtain the local modal representation, and the corresponding global modal representation is obtained by aggregating features from all time steps and regional nodes. Samples within the same traffic mode are considered positive sample pairs, and samples from different traffic modes are considered negative sample pairs. The consistency between the local and global modal representations is measured using a modal discriminant function. Modal self-supervised loss is employed. Defined as: in, This represents the modal discrimination function, which calculates the degree of matching between the local modal representation and the global modal representation, and outputs the probability that the input sample belongs to the current traffic mode. It is composed of local mode representation and global mode representation. The first term in the loss function. The second item is used to improve the discrimination score of samples of the same modality. Used to reduce the discrimination score of sample pairs of different traffic modes.
[0058] Step 5: Construct a joint training objective and output the future multimodal traffic flow prediction results. The spatiotemporal code representation of the output of the multimodal spatiotemporal encoder The input predictor performs feature transformation through multiple nonlinear mappings and maps it to the target prediction space, outputting traffic flow prediction results for different traffic modes in each region at future time steps. The prediction process is as follows: in, Represents the hidden layer mapping function. This represents the output layer mapping function. Represents a non-linear activation function. This indicates the model's prediction results.
[0059] To enhance the model's ability to represent the latent structure and modal relationships of multimodal traffic data, a joint training objective is constructed by combining supervised prediction loss, global self-supervised loss, and modal self-supervised loss: in, and Indicates the weighting coefficient. Indicates monitoring and predicting losses. Represents actual traffic flow. This indicates the model's prediction results. This represents the set of samples used in the loss calculation. During training, the model parameters are optimized by minimizing the joint training objective. After the model is trained, inputting historical multimodal traffic flow sequences allows for the prediction of traffic flow for different traffic modes in various regions at multiple future time steps.
[0060] The implementation process of this invention is described using a shared transportation dataset from Manhattan, New York City. The dataset contains data on the inflow and outflow of shared bicycles and electric motorcycles in various areas of Manhattan from January to December 2024. The raw data is aggregated at an hourly granularity, and time attributes such as hour, day of the week, and holidays are extracted as auxiliary features for each time step. Subsequently, the data is divided into training, validation, and test sets in a 7:2:1 ratio for model training and performance evaluation.
[0061] Table 1 presents the performance comparison results of the method of this invention with several mainstream traffic flow prediction models. STID, STAEformer, MegaCRN, BigST, and STDN are unimodal traffic flow prediction models, while MoSSL is a multimodal traffic flow prediction model. For the unimodal prediction model, shared bicycles and electric bicycles are trained and predicted as independent tasks; for the multimodal prediction model, both traffic modal data are used for joint modeling. Through comparison with the aforementioned representative methods, the method of this invention achieves the lowest MAE and RMSE in both bicycle inflow / outflow and electric bicycle inflow / outflow prediction tasks, demonstrating its ability to effectively improve the accuracy of multimodal traffic flow prediction.
[0062] Table 1. Model Comparison Results
[0063] Figure 3 This figure illustrates the comparison between the predicted and actual traffic flow values of shared bicycles and e-bikes at a specific time step using the method of this invention. The left side of the figure represents the comparison for shared bicycles, and the right side represents the comparison for shared e-bikes. The traffic flow values are encoded using a purple-red-yellow-green gradient, with purple indicating higher traffic and green indicating lower traffic. As can be seen from the figure, the predicted results for both shared bicycles and e-bikes show a high degree of consistency with the actual values, indicating that the method of this invention can achieve high-precision traffic flow prediction.
Claims
1. A traffic flow prediction method for multimodal traffic data, characterized in that, include: S1. Collect traffic flow data of multiple traffic modes, construct a multimodal traffic flow tensor and generate an initial multimodal spatiotemporal feature representation, and at the same time acquire and encode time attributes to obtain a time attribute embedded representation; S2. Construct a multimodal spatiotemporal encoder that includes a linearized global spatial dependency module, a static-dynamic fusion modal interaction graph module, and a modality-aware temporal hybrid expert module. Capture spatiotemporal and modal dependency associations based on the initial multimodal spatiotemporal feature representation to generate a multimodal spatiotemporal encoded representation; use it as input to the predictor to generate multimodal traffic flow prediction results.
2. The traffic flow prediction method for multimodal traffic data according to claim 1, characterized in that, S2 include: S21. Using the linearized global spatial dependency module, capture the global spatial dependency relationship between regions and generate a global spatial dependency feature representation; S22. The correlation between different traffic modes is modeled by the static and dynamic fusion modal interaction graph module to obtain the modal interaction feature representation; S23. Based on modal interaction feature representation and current coding layer input features, a modal-aware temporal hybrid expert module is adopted. By constructing a time modeling expert library composed of multiple time modeling experts with differentiated time modeling capabilities, multi-scale time evolution features are adaptively modeled for different traffic modalities. S24. Construct a modality-space-aware temporal router to adaptively fuse the outputs of each temporal modeling expert. The fusion result is then transformed by the output mapping layer, and the spatiotemporal feature representation of the current coding layer is updated by combining the residual connection.
3. The traffic flow prediction method for multimodal traffic data according to claim 1, characterized in that, In S2, a coding layer is formed by a global spatial dependency module, a static-dynamic fusion modal interaction graph module, and a modal-aware temporal hybrid expert module; the multimodal spatiotemporal encoder has multiple coding layers stacked on top of each other; the spatiotemporal feature representations generated by each coding layer are updated through residual connections, and finally output multimodal spatiotemporal coded representations.
4. The traffic flow prediction method for multimodal traffic data according to claim 2, characterized in that, S21 includes: The initial multimodal spatiotemporal feature representations at each time step are mapped to a high-dimensional feature space through a nonlinear feature mapping method. A dynamic spatial correlation matrix is constructed based on the mapped feature representations. The quadratic complexity of attention calculation in traditional spatial attention is transformed into linear complexity by using the kernel function approximation idea, thereby achieving efficient modeling of spatial correlation features.
5. A traffic flow prediction method for multimodal traffic data according to claim 2, characterized in that, S22 includes: A learnable global static modal relationship matrix is introduced, whose elements represent the background correlation between different traffic modes; For the spatial feature representations corresponding to each traffic mode at each time step, query features, key features, and value features are generated through linear mapping. Scaled dot product attention is used to calculate the dynamic modal association score between different traffic modes. The dynamic modal association score is nonlinearly mapped and fused with the global static modal relationship matrix to construct the static-dynamic fused modal interaction graph for the current time step. The edge weights between different traffic modes in the modal interaction graph are the values of the dynamic modal association scores activated by the hyperbolic tangent function plus the corresponding element values in the global static modal relationship matrix. The value features of each traffic mode are weighted and aggregated using the edge weights between modes to obtain the modal interaction features corresponding to each traffic mode at each time step; the modal interaction features are then concatenated along the modal dimension to obtain a unified modal interaction feature representation.
6. A traffic flow prediction method for multimodal traffic data according to claim 5, characterized in that, S23 includes: Spatial feature representation, modal interaction feature representation, and current coding layer input features are concatenated to obtain hybrid input features. These hybrid input features are then input in parallel to various time-modeling experts for feature extraction, learning the evolutionary characteristics of traffic flow from different time scales. The time-modeling experts include: Trend experts are used to extract long-term trends in traffic flow; they generate trend feature representations based on mixed input features. Periodic experts are used to model the periodic variation patterns of traffic flow. They achieve the conversion between the time domain and the frequency domain through fast Fourier transform, and after completing feature learning in the frequency domain, they restore it to the time domain to generate a periodic feature representation. Wave expert is used to model the dynamic changes of traffic flow on a short time scale. Wave expert adaptively enhances the short-time wave feature response through short-time dynamic feature extraction and gating modulation mechanism to obtain wave feature representation. Direct connection experts are used to retain the basic temporal information in the input features and generate direct connection feature representations.
7. A traffic flow prediction method for multimodal traffic data according to claim 2, characterized in that, S24 includes: The temporal attribute embedding representation is input into the GRU network to encode the temporal context, obtaining the temporal context representation corresponding to the current time step. A temporal routing representation is generated by linearly mapping the temporal context representation using the temporal routing projection matrix and bias parameters. A learnable modality-spatial routing bias is defined. The temporal routing representation is extended along the modality and spatial dimensions and added element-wise with the modality-spatial routing bias to obtain the expert routing score. Softmax normalization is performed on the expert routing score in the expert dimension to generate expert routing probabilities, which characterize the selection weights of different traffic modes for each temporal modeling expert at different spatial nodes. Based on the generated expert routing probabilities, the outputs of the modeling experts at each time are weighted and fused to obtain the fused time features of each traffic mode at each spatial node. The fusion temporal features corresponding to each traffic modality and spatial node are combined to form the overall output features of the modality-aware temporal hybrid expert module. The overall output features are transformed by the output mapping layer and the spatiotemporal feature representation of the current coding layer is updated by combining the residual connection. After multiple coding layers are stacked in sequence, the final multimodal spatiotemporal coding representation is obtained.
8. A traffic flow prediction method for multimodal traffic data according to claim 1, characterized in that, Also includes: S3. A modality-aware data augmentation mechanism is used to enhance the multimodal spatiotemporal coding representation. Specifically, the latent space representation between different traffic modes is extracted along the traffic mode dimension of the multimodal spatiotemporal coding representation, and the modal similarity between different traffic modes is calculated using cosine similarity; the feature retention probability is obtained by mapping the modal similarity. Based on the feature preservation probability, a random mask is adaptively generated using the Bernoulli distribution; the random mask is applied to the multimodal flow tensor to obtain an enhanced view, which is then fed into a multimodal spatiotemporal encoder for feature extraction to obtain an enhanced spatiotemporal coded representation.
9. A traffic flow prediction method for multimodal traffic data according to claim 8, characterized in that, Also includes: S4. Define global self-supervised loss and modal self-supervised loss to apply self-supervised constraints to multimodal spatiotemporal coding representation and augmented spatiotemporal coding representation.
10. A traffic flow prediction method for multimodal traffic data according to claim 9, characterized in that, Also includes: S5. Combine supervised prediction loss, global self-supervised loss, and modal self-supervised loss to construct a joint training objective; The trained model is used to output future multimodal traffic flow predictions.
