Deep learning traffic flow prediction method based on meteorological information fusion

Through the time alignment module and the enhanced spatiotemporal convolution network synchronously process traffic and weather data, combined with the graph attention network and comparison learning module, the problems of spatiotemporal dependence and multi-source data fusion in traffic flow prediction are solved, significantly improving prediction accuracy and voluntary Great.

CN119181256AActive Publication Date: 2024-12-24NANJING UNIV OF INFORMATION SCI & TECH

Patent Information

Application Number
CN202411693544.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2024-12-24
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

Existing traffic flow prediction models are difficult to fully capture the spatial and temporal dependence, especially in complex road network structures and external factors such as time misalignment under weather conditions, resulting in insufficient accuracy of prediction results.

Method used

Using deep learning method based on meteorological information, the traffic data and weather data are synchronized through the time alignment module, combined with enhanced spatiotemporal convolution network and graph attention network, the spatiotemporal features are extracted, and the multi-source data feature fusion is optimized through the comparative learning module. .

Benefits of technology

It effectively solves the shortcomings of multi-source data integration, long-term dependency capture and feature fusion in traffic flow prediction, and significantly improves prediction accuracy and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119181256A_ABST
    Figure CN119181256A_ABST
Patent Text Reader

Abstract

The invention provides a deep learning traffic flow prediction method based on meteorological information fusion, and the method comprises the following steps: 1, carrying out the preprocessing of traffic data and weather data; step 2, establishing a time alignment module to solve the time dislocation problem of traffic data and weather data; step 3, carrying out embedded coding on the traffic data and the weather data; step 4, establishing an enhanced space-time convolutional network, extracting space-time features from the traffic data through the enhanced space-time convolutional network, and extracting time sequence features from the meteorological data through the enhanced space-time convolutional network; 5, establishing a comparative learning module, and performing feature fusion and comparative learning on the spatio-temporal features and the time sequence features; and step 6, generating a predicted value of the traffic flow. According to the method, the defects of an existing traffic flow prediction method in the aspects of multi-source data integration, long-time dependence capture, feature fusion and the like are effectively overcome, and a new technical approach is provided for improving the precision of traffic flow prediction and the universality of practical application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of information processing technology, and specifically relates to a deep learning traffic flow prediction method based on meteorological information fusion. Background Art

[0002] With the accelerated development of urbanization and the evolution of intelligent transportation systems, traffic flow prediction has become a core task of modern traffic management. However, existing prediction models have shown great limitations in the face of the following technical problems:

[0003] First, traffic flow has a high degree of spatiotemporal dependence, but existing models often have difficulty in fully capturing this complex dependency. Especially when dealing with complex road network structures, traditional models have limited understanding of spatial relationships and find it difficult to accurately capture the non-Euclidean spatial associations between road nodes.

[0004] Secondly, traffic flow is also affected by many external factors, especially weather conditions. Bad weather such as rain and haze can significantly change the road capacity and vehicle flow pattern, but traditional prediction models find it difficult to integrate traffic data and weather data at the same time, and often ignore the time misalignment between the two, resulting in inaccurate prediction results.

[0005] Traffic flow prediction has always been a key task in intelligent transportation systems (ITS). Traditional prediction methods mainly rely on statistical models and time series analysis methods, such as autoregressive integrated moving average model (ARIMA) and support vector regression (SVR). These methods are simple and direct to model through historical traffic data, but they show obvious limitations when faced with complex spatiotemporal dependencies and nonlinear data. In particular, traditional statistical models often have difficulty in providing sufficient prediction accuracy when dealing with long-term dependencies and changeable traffic dynamics. In addition, these models usually cannot effectively utilize the potential impact of external data (such as weather) on traffic flow.

[0006] With the rise of deep learning technology, traffic flow prediction methods have been significantly improved. In recent years, deep learning-based models such as recurrent neural networks (RNNs), long short-term memory networks (LSTMs), and temporal convolutional networks (TCNs) have gradually become mainstream. Models such as LSTMs can better capture long-term dependencies by introducing memory units, and perform better than traditional statistical models. However, despite their obvious advantages in temporal modeling, RNNs and LSTMs are not good at dealing with complex spatial relationships of traffic flow, especially when faced with road networks with complex topological structures.

[0007] To solve this problem, in recent years, graph neural networks (GNNs) and their variants have been introduced into the field of traffic flow prediction and have made significant progress. Diffused convolutional recurrent neural network (DCRNN) is one of the representative works, which combines diffuse convolution and recurrent neural network and can effectively model the spatiotemporal dependencies in traffic flow. Subsequently, Graph WaveNet further enhanced the model's modeling ability for non-Euclidean space by introducing a learnable static adjacency matrix. At the same time, models such as STGCN (Spatio-Temporal Graph Convolutional Network) and ASTGCN (Attention-Based Spatio-Temporal Graph Convolutional Network) combine graph convolutional networks with time series analysis, capture the spatiotemporal characteristics of traffic flow through spatiotemporal convolution, and provide a new method for traffic prediction.

[0008] Although these improved models have enhanced the ability to capture spatiotemporal dependencies, existing models still have deficiencies in long-term dependencies, external data fusion (such as weather), and data time misalignment. First, the time misalignment between traffic data and external factors such as weather is a long-standing problem. Existing models often have difficulty handling these time differences, resulting in limited effectiveness in the use of external data. Second, most models perform poorly when dealing with long-term series dependencies and cannot fully capture dynamic changes in traffic over long spans. Finally, existing multi-source data fusion methods lack an effective feature fusion mechanism and usually only use simple splicing or weighting methods, failing to deeply explore the deep relationships between different modal data. Summary of the invention

[0009] Purpose of the invention: The technical problem to be solved by the present invention is to provide a deep learning traffic flow prediction method based on meteorological information fusion in view of the shortcomings of the prior art, which includes the following steps:

[0010] Step 1, preprocessing traffic data and weather data;

[0011] Step 2: Establish a time alignment module to solve the time misalignment problem between traffic data and weather data;

[0012] Step 3, embedding and encoding traffic data and weather data;

[0013] Step 4: Establish an enhanced spatiotemporal convolutional network. The traffic data is extracted from the spatiotemporal features through the enhanced spatiotemporal convolutional network, and the meteorological data is extracted from the time series features through the enhanced spatiotemporal convolutional network.

[0014] Step 5: Establish a contrastive learning module to perform feature fusion and contrastive learning on spatiotemporal features and temporal features;

[0015] Step 6: Generate predicted values ​​of traffic flow.

[0016] Step 1 includes: time alignment of traffic data and weather data, handling of missing values, and then normalization.

[0017] Step 2 includes: the time alignment module includes a cross-correlation estimator and a time shift adjuster;

[0018] The cross-correlation estimator calculates the cross-correlation between traffic data features and weather data features by the following formula:

[0019] ,

[0020] in, Represents weather data characteristics Traffic data characteristics Offset in time The correlation coefficient when is the length of the sliding window, It indicates a point in time. Indicates time Weather data characteristics at that time , which is a subtraction operation used to indicate moving forward (or backward) by δ time units based on time t. and They are weather data features The mean and standard deviation of Representing traffic data characteristics In time The value of and are the mean and standard deviation of traffic data characteristics, respectively.

[0021] In step 2, by maximizing , find the optimal time offset.

[0022] In step 2, the time shift adjuster is used to adjust the time of the weather data. The characteristics of the adjusted weather data are expressed by the following formula:

[0023] ,

[0024] in, Is the weather data feature After adjustment, Represents the original weather data characteristics , Is the weather data feature The optimal time shift for the ; Shift indicates the time shift operation.

[0025] Step 3 includes: embedding and encoding traffic data and weather data through linear transformation and ReLU activation function respectively. The embedding process of traffic data is expressed as:

[0026] ,

[0027] in, represents the embedded traffic data features, is the weight matrix of the embedding layer, is the original traffic data feature, is a bias term for traffic data; ReLU is an activation function used to introduce nonlinearity, and the formula is:

[0028] ,

[0029] in Represents a variable;

[0030] The embedding process of weather data is expressed as:

[0031] ,

[0032] in, is the embedded weather data feature, is the weight matrix for weather data, Represents the weather data after time alignment, is a bias term for weather data.

[0033] Step 4 includes: the enhanced spatiotemporal convolutional network first uses the enhanced temporal convolutional network ETCN to extract the temporal features in the traffic data. The enhanced temporal convolutional network ETCN uses a combination of deep convolution DWConv and point convolution PWConv. By using deep convolution DWConv, each channel will perform convolution operations independently. The formula is:

[0034] ,

[0035] in, is the input feature, is the depth convolution kernel;

[0036] The point convolution PWConv achieves cross-channel feature fusion through 1×1 convolution:

[0037] ,

[0038] ,

[0039] in, is the batch normalization operation, is an activation function, ConvFFN1(x) represents a composite function including point convolution, batch normalization and activation function; PWConv1 represents a point convolution operation; represents another composite function that includes point convolution, batch normalization, and activation function; PWConv2 represents another point convolution operation.

[0040] In step 4, the enhanced spatiotemporal convolutional network also introduces a graph attention network, which dynamically allocates the connection weights of different nodes in the traffic network through the attention mechanism. The specific formula is:

[0041] ,

[0042] ,

[0043] ,

[0044] ,

[0045] in, is the feature vector of node p, representing the attributes of node p; is the feature vector of node q, which represents the attribute of another node q adjacent to node p; Indicates calculating the relevance of all neighbors y of node p; The representative point y is a node adjacent to the node p. The above formula is used to calculate the relevance of all nodes adjacent to the node p. This calculated feature step reflects the information aggregation of each node by GAT, so that the features of each node not only contain its own information, but also integrate the information of neighboring nodes, forming a spatial dependency representation of the relationship between nodes in the entire transportation network.

[0046] LeakyReLU is a leaky linear rectifier unit, which is used to introduce nonlinearity to improve the model's ability to express features; Is a node The linear transformation of features can project the features into a new space for better subsequent similarity calculation and attention weight allocation; Is a node and The attention coefficient between Is a node The attention coefficient between and k; represents the linear transformation weight matrix for node features; is the weight vector in the attention mechanism; Is a node The neighbor set of is the attention weight after softmax normalization; exp is the natural exponential function; T represents the matrix transpose. represents the new feature representation of node p, It is the final output of GAT, representing node features, that is, the spatial information of traffic data. It will be combined with the time series information of traffic, and the final output of GETCN is the spatiotemporal characteristics of traffic data, that is, traffic characteristics.

[0047] Traffic features obtained from GETCN and weather features obtained from ETCN need to be fused to obtain a unified feature representation for comparative learning. The fusion method is splicing. The spliced ​​samples are used to construct sample pairs.

[0048] Positive sample pairs: represent similar samples, for example, traffic conditions on two different roads under similar weather conditions in the same time period.

[0049] Negative sample pairs: represent dissimilar samples, for example, traffic conditions in different time periods or under different weather conditions.

[0050] These positive and negative sample pairs are used to train the model so that it can learn that similar sample features are closer and dissimilar sample features are farther apart.

[0051] Step 5 includes: the loss function L of the contrastive learning is:

[0052] ,

[0053] in, represents the mth eigenvector and the nth eigenvector The cosine similarity of , V is the number of sample pairs (that is, the positive and negative sample pairs constructed previously). The temperature parameter that controls the feature separation scale.

[0054] Step 6 includes: converting the multidimensional feature vector into a specific output value through a fully connected layer:

[0055] ,

[0056] in, is the predicted traffic flow value, is the fusion feature output by the contrast learning module. and are the weight and bias of the fully connected layer respectively. The fused features are obtained by splicing and fusing weather features and traffic features in contrastive learning. The loss function L of the contrastive learning module is mainly used to optimize these fused features, making the features of similar samples closer and the features of dissimilar samples farther apart. Therefore, the role of the loss function L is to enhance the distinguishability of features by optimizing the similarity and difference of features, rather than directly fusing features.

[0057] The present invention proposes a multi-source spatio-temporal hybrid network (MSTHN). The network can effectively fuse traffic data and weather data from different sources. By introducing the temporal alignment module (TAM), the temporal misalignment problem between weather data and traffic data is solved, ensuring that the data is accurately aligned before feature extraction. At the same time, MSTHN uses the enhanced temporal convolutional network (ETCN) and the graph attention network (GAT) to effectively capture the spatiotemporal dependencies in traffic data. In order to further improve the prediction accuracy of the model, the system also optimizes the fused multi-source features through the contrastive learning module, so that the model shows higher accuracy and robustness when facing complex traffic flow prediction tasks.

[0058] The present invention addresses the limitations of the prior art through the following innovative features:

[0059] Temporal Alignment Module (TAM): This module can solve the time misalignment problem between traffic data and external data (such as weather data), ensuring that the data is accurately aligned before feature extraction, thereby effectively capturing the temporal correlation in multi-source data and improving the accuracy of prediction.

[0060] Enhanced Temporal Convolutional Network (ETCN): Through improved temporal convolution operations, ETCN is able to demonstrate stronger capture capabilities in modeling long-term dependencies, ensuring that the model can stably and effectively model complex dynamic relationships when facing long time series prediction tasks.

[0061] Contrastive Learning Module: This module is used to optimize the feature fusion of multi-source data, especially in the combination of traffic data and weather data. It uses contrastive learning to better capture the deep relationship between different data modalities and improve the robustness and generalization ability of fused features.

[0062] Beneficial effects: The present invention effectively solves the deficiencies of existing traffic flow prediction methods in terms of multi-source data integration, long-term dependency capture, and feature fusion, and provides a new technical approach to improve the accuracy of traffic flow prediction and the breadth of practical applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 It is a diagram of the architecture of the method of the present invention. DETAILED DESCRIPTION

[0064] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.

[0065] This embodiment provides a deep learning traffic flow prediction method based on meteorological information fusion, which integrates a time alignment module (TAM) to solve the time asynchrony problem between traffic data and meteorological data, and ensure accurate synchronization before feature extraction. Subsequently, an enhanced temporal convolutional network (ETCN) is used to capture the complex temporal patterns in traffic data, while a graph attention network (GAT) models the inherent spatial dependencies in traffic networks. In addition, a contrastive learning module is used to fuse the features of multi-source data, thereby improving the accuracy of traffic flow prediction. Figure 1 As shown, the method specifically comprises the following steps:

[0066] Step 1, data input and preprocessing: Traffic data and weather data are the two core data sources of the system, the former comes from road sensors and the latter comes from meteorological monitoring stations. In order to ensure that the system can eliminate the differences in data sources during the processing process, the data must first be time-aligned and normalized.

[0067] Figure 1 In , P1 represents a positive sample pair, which is usually a sample under similar conditions, such as traffic characteristics in the same time period or similar weather conditions.

[0068] N1 represents a negative sample pair, that is, a sample pair under dissimilar conditions.

[0069] Feature comparison ( ): through the function To extract the representation of the input features and calculate the similarity between positive and negative samples. The goal of contrastive learning is to make the distance between positive sample pairs closer and the distance between negative sample pairs farther.

[0070] , , Represents the attention weight, which represents the attention coefficient between nodes.

[0071] : represents N layers.

[0072] During the data input phase, the traffic data received by the system includes indicators such as vehicle speed and lane occupancy at each time point, and the time granularity is usually 5 minutes. Weather data includes environmental factors such as temperature, humidity, and precipitation. The time granularity of these data is inconsistent with traffic data, and there may be lags or asynchrony problems. To solve this problem, it is first necessary to time-align traffic and weather data and divide them into a unified time step so that the model can process data from different time steps.

[0073] In addition, the data preprocessing stage also includes the processing of missing values, such as using interpolation or data filling methods to ensure the integrity of the data. After that, the data is standardized using the following normalization formula:

[0074] (1)

[0075] in, is the raw input data, such as the raw values ​​of traffic flow or weather data features, represents the mean of the original input data, is the standard deviation of the original input data, Represents normalized data. By subtracting the mean from the original data and dividing it by the standard deviation, normalization ensures that the values ​​of different data features are scaled to the same scale, thereby preventing certain features from having too much influence on model training.

[0076] Step 2, establish a temporal alignment module (TAM). Changes in traffic flow are closely related to weather conditions, but the impact of weather often has a certain time lag effect. For example, rainfall may not immediately affect traffic flow in the short term, but over time, the slippery road surface will cause the vehicle speed to decrease. Therefore, this embodiment proposes a time alignment module (TAM), and its main technical solution is to solve the time misalignment problem between traffic data and weather data through a cross-correlation estimator (CCE) and a time shift adjuster (SA). After completing data preprocessing, the model solves the time offset problem between traffic data and weather data through a time alignment module (TAM). The correlation between the two types of data is calculated through a cross-correlation estimator (CCE) to determine the optimal time offset.

[0077] The cross-correlation estimator works by calculating the cross-correlation between traffic data features and weather data features using the following formula:

[0078] (2)

[0079] in, Represent weather data features and traffic data features at a time offset The correlation coefficient is the length of the sliding window, used to calculate the correlation within a certain period of time represents a time point represents time The weather data features , and are the mean and standard deviation of the weather data features respectively represents the traffic data features at time , and are the mean and standard deviation of the traffic data features respectively. By maximizing , the optimal time offset is found to achieve time synchronization between the weather data and the traffic data

[0080] After determining the offset, the system adjusts the weather data accordingly through a Shift Adjuster (SA) to ensure its synchronization with the traffic data. If there is a negative correlation between some weather data features and traffic data features, the "negative correlation" here can be determined by calculating the correlation coefficient, rather than relying entirely on human judgment. Specifically, statistical methods can be used to determine the relationship between the two sets of data. For example, during the data alignment process, the system can calculate the correlation coefficient between the traffic data and the weather data: R is the correlation coefficient. If the correlation coefficient is negative (i.e., -1 < r < 0), it indicates a negative correlation between the two features, which means that when one feature increases, the other feature tends to decrease. In this case, the system will flip the values of the negatively correlated weather features to ensure that their relationship can correctly match the input features of the traffic flow prediction model

[0081] The Shift Adjuster will flip the values of the relevant features to ensure data consistency. The adjusted weather data features are represented by the following formula

[0082] (3)

[0083] where is the adjusted feature of the weather data feature , represents the original weather data feature , is the weather data feature The Chinese meaning of Shift is "time offset" or "time shift".

[0084] Specifically, Shift means to transform the original weather data features Perform an offset operation in time. This offset is calculated by the optimal time offset This is done to align weather data with traffic data in time.

[0085] Step 3, embedding coding. After time alignment, the next step is to embed the traffic data and weather data. The role of the embedding layer is to convert high-dimensional data into low-dimensional vector representation to reduce computational complexity and ensure that the association between different features can be represented more effectively.

[0086] For traffic data and weather data, embedding encoding is performed through linear transformation and ReLU activation function respectively. The embedding process of traffic data is expressed as:

[0087] (4)

[0088] in, represents the embedded traffic data features, is the weight matrix of the embedding layer, which represents the trainable parameters that map traffic data features from high-dimensional space to low-dimensional space. is the original traffic data feature, is a bias term for traffic data. ReLU is a commonly used activation function used to introduce nonlinearity. The formula is: (5)

[0089] in Represents a variable;

[0090] The embedding process of weather data is expressed as:

[0091] (6)

[0092] in, is the embedded weather data feature, is the weight matrix for weather data, Represents the weather data after time alignment, It is a bias term for weather data. Embedding coding maps high-dimensional data into low-dimensional feature representation through linear transformation and activation function, which is convenient for subsequent processing.

[0093] Step 4: Establish an enhanced spatiotemporal convolutional network (Graph-Enhanced Temporal Convolutional Network, GETCN).

[0094] After embedding coding is completed, the enhanced spatiotemporal convolutional network (GETCN) is used to capture the temporal and spatial dependencies in the data. Although the traditional temporal convolutional network (TCN) can capture temporal dependencies, it ignores the spatial dependencies in the traffic network. The traffic network naturally has a graph structure, and there are complex spatial associations between road sections. Therefore, the present invention proposes an enhanced graph spatiotemporal convolutional network (GETCN). GETCN realizes the spatiotemporal joint modeling of the traffic network by combining temporal convolution and graph attention network.

[0095] The enhanced spatiotemporal convolutional network first uses the enhanced temporal convolutional network (ETCN) to extract temporal features from traffic data. Although the traditional temporal convolutional network (TCN) can effectively model time series, it has a large computational overhead when processing complex multi-channel data. Therefore, this embodiment uses a combination of deep convolution (DWConv) and point convolution (PWConv) in ETCN to solve this problem.

[0096] DWConv is used to perform convolution operations independently on each channel. In convolutional neural networks, "channels" generally refer to different feature dimensions in the input feature map. In this embodiment, "channels" can be understood as various features of traffic data, such as vehicle speed, traffic flow, lane occupancy, etc. Each channel represents a dimension of traffic data. For example, vehicle speed is one channel and lane occupancy is another channel. By using deep convolution (DWConv), each channel will perform convolution operations independently, and the formula is:

[0097] (7)

[0098] in, is the input feature, which is obtained from the previous preprocessing step and the time alignment module (TAM). Specifically:

[0099] Traffic data is preprocessed and then aligned with weather data through a time alignment module to ensure time synchronization.

[0100] After these processing, the traffic data is passed to the enhanced temporal convolutional network (GETCN) for further feature extraction.

[0101] Before entering GETCN, the traffic data is embedded and encoded, becoming input features that can be directly used for GETCN.

[0102] DWConv is a deep convolution kernel. DWConv effectively reduces the computational complexity of the model and is suitable for the characteristics of a large number of sensor channels in traffic data.

[0103] PWConv achieves cross-channel feature fusion through 1×1 convolution:

[0104] (8)

[0105] (9)

[0106] in, is the batch normalization operation, It is an activation function that provides nonlinear modeling capabilities. By combining DWConv and PWConv, the model can capture long-term dependencies and perform effective channel-to-channel interactions. PWConv1: represents a point convolution operation. Point convolution is a 1×1 convolution used to fuse features across channels, usually used to reduce the dimension of feature maps.

[0107] The output of this formula is spatiotemporal features and time series features, which are the features used in contrastive learning later.

[0108] ConvFFN1(x): represents a composite function that includes point convolution, batch normalization, and activation function. The composite function here is used to enhance the nonlinear modeling ability of input features.

[0109] PWConv2: represents another point convolution operation. Similar to PWConv1, it is used to further fuse features across channels.

[0110] PWConv2: represents another point convolution operation, which has the same structure as PWConv1, but is used to further fuse features across channels.

[0111] ConvFFN2(x): It has the same structure as ConvFFN1(x), and is used to further enhance the nonlinear modeling capability of features, with independent weight parameters.

[0112] In order to further enhance the modeling of spatial features of traffic data, GETCN introduces the graph attention network (GAT). GAT dynamically allocates the connection weights of different nodes in the traffic network through the attention mechanism. The specific formula is:

[0113] (10)

[0114] (11)

[0115] (12)

[0116] (13)

[0117] in, Is a node The linearly transformed features are Is a node and The attention coefficient between them is calculated by the LeakyReLU activation function and is used to quantify the relationship between two nodes. Represents the linear transformation weight matrix for node features. It linearly transforms the original node features to adapt to the computational requirements of the Graph Attention Network (GAT). is the weight vector in the attention mechanism, which is usually used to calculate the correlation between nodes; Is a node The neighbor set of is the attention weight after softmax normalization; exp is the natural exponential function; T represents the matrix transpose; Compared with the traditional graph convolutional network (GCN), GAT can better handle dynamically changing spatial relationships, allowing the model to adaptively assign more weights to important nodes, thereby improving the prediction performance.

[0118] Traffic data and meteorological data have significant differences in characteristics. Traffic data has complex spatial dependencies, so GETCN is used to process traffic data. As for meteorological data, since it mainly reflects dynamic changes in time and lacks significant spatial dependencies, ETCN is used to extract its time series features.

[0119] Step 5, feature fusion and contrastive learning: After the spatiotemporal features of traffic data are extracted through GETCN and the time series features of meteorological data are extracted through ETCN, this embodiment designs a contrastive learning module to fuse these multi-source features. In the process of feature fusion of multi-source data, traditional methods often find it difficult to fully utilize the relationship between traffic and meteorological data. Therefore, a contrastive learning module is introduced to further optimize the fusion feature space. Contrastive learning improves the discrimination of feature representation by bringing similar data features closer and different data features farther away. The loss function L of contrastive learning is:

[0120] (14)

[0121] in, represents the mth eigenvector and the nth eigenvector The cosine similarity of these feature vectors is the output of traffic and weather data through enhanced graph convolutional temporal convolutional network (GETCN) and enhanced temporal convolutional network (ETCN). V is the number of sample pairs, (In the summation, this is equivalent to ) is to ensure that negative samples do not contain themselves, thus ensuring the rationality and effectiveness of the contrastive learning loss function. The temperature parameter is used to control the scale of feature separation. Through contrastive learning, it can ensure that traffic and meteorological features from similar environments are more closely integrated, while features with large differences are distinguished, thereby enhancing the model's predictive ability for complex scenarios.

[0122] Step 6, Generate Prediction: After feature extraction and fusion, the model maps these features to the predicted value of traffic flow through the fully connected layer. The function of the fully connected layer is to convert the multi-dimensional feature vector into a specific output value, that is, the final traffic flow prediction. The formula of the fully connected layer is:

[0123] (15)

[0124] in, is the predicted traffic flow value, is the fusion feature output by the contrast learning module. and are the weights and biases of the fully connected layer respectively.

[0125] Through the linear transformation of the fully connected layer, the fused features are mapped to the output space. This step can effectively integrate the spatiotemporal features extracted from different modules to generate accurate traffic flow prediction values. The design of the fully connected layer has low computational complexity while ensuring prediction accuracy, allowing the model to efficiently perform real-time predictions in practical applications.

[0126] In the process of solving the challenge of multi-source data fusion in traffic flow prediction, this embodiment constructs a traffic prediction model based on a multi-source spatiotemporal hybrid network (MSTHN). This model is specifically optimized for the accuracy and robustness issues when integrating and analyzing the spatiotemporal features of multi-source data such as traffic and meteorology. By combining deep learning technology and spatiotemporal feature fusion, this embodiment proposes a novel method to capture and understand the complex dynamics in the traffic system, thereby significantly improving the accuracy and effectiveness of traffic flow prediction.

[0127] First, this embodiment designs a time alignment module (TAM) for synchronous processing of traffic data and meteorological data. Since there are time differences between traffic and meteorological data, for example, the impact of meteorological conditions on traffic may be delayed, this embodiment realizes the time alignment processing of traffic and meteorological data through the combination of cross-correlation estimator and time step adjuster, so that the two data can reach the optimal synchronization state before feature extraction, providing an accurate basis for subsequent spatiotemporal feature analysis.

[0128] Secondly, this embodiment introduces an enhanced graph convolutional temporal convolutional network (GETCN) in MSTHN to extract complex spatiotemporal features in traffic data. Temporal features of meteorological data are extracted through an enhanced temporal convolutional network (ETCN), and GETCN combines an enhanced temporal convolutional network and a graph attention network (GAT) to model long-term and spatial dependencies in traffic data. In particular, ETCN effectively captures the long-term characteristics of traffic and meteorological data by combining deep convolution with point convolution, while GAT deeply models the spatial dependency of traffic flow by dynamically assigning weights to different traffic nodes. This structure enables the comprehensive extraction of features of traffic and meteorological data and enhances the sensitivity and adaptability of the model to data changes.

[0129] In order to further integrate the multi-source features from traffic and meteorological data, this embodiment introduces a contrastive learning module into the model. This module uses the contrastive learning method to bring feature vectors in similar environments closer and dissimilar features farther apart, thereby effectively distinguishing and integrating the features of multi-source data. This innovative feature fusion method enables the model to fully utilize the complementary information between the two types of data in the context of complex multi-source data, thereby enhancing the accuracy and robustness of traffic flow prediction.

[0130] Finally, the fully connected layer maps the multi-source data after feature extraction and fusion to generate the final traffic flow prediction results. This step enables the model to provide specific prediction outputs based on the efficient use of the extracted spatiotemporal features. Combining the advantages of multi-source data, our MSTHN model significantly improves the prediction performance of traffic flow through precise time alignment, effective spatiotemporal feature extraction, and innovative multi-source feature fusion.

[0131] This technical solution not only improves the performance of traffic flow prediction models in multi-source data processing, but also provides strong technical support for intelligent traffic management, which helps to accurately predict traffic flow and efficiently manage urban traffic systems.

[0132] The meanings of some terms in the embodiments of the present invention are as follows:

[0133] Traffic data: refers to the original traffic information data collected by traffic sensors, surveillance cameras, etc., including basic indicators reflecting traffic flow such as vehicle speed, lane occupancy, and vehicle volume.

[0134] Traffic data features: refers to the processed feature values ​​extracted from the original traffic data. These features are used as model input after preprocessing, normalization and other steps. For example, the speed and traffic volume data after time alignment and normalization are traffic data features.

[0135] Weather data: refers to the raw data collected by meteorological stations that reflects environmental conditions, including temperature, humidity, precipitation, etc.

[0136] Weather data features: refers to the preprocessed weather data features, which are used to merge with traffic data to improve the model's ability to predict traffic flow.

[0137] Feature vector: refers to the input vector formed by integrating traffic data features, weather data features and other processed features for the neural network model. This is the final input feature of the model.

[0138] In one embodiment of the present invention, the effectiveness of the method proposed in this embodiment is verified by using traffic flow and local meteorological data on a major road section in Nanjing. Traffic data comes from road sensors, including information such as vehicle speed and vehicle flow, with a time granularity of once every 5 minutes; meteorological data includes information such as temperature, rainfall, humidity, etc., with a time granularity of once every 10 minutes. This embodiment aims to improve the accuracy of traffic flow prediction by fusion of multi-source data, and specifically includes the following steps:

[0139] Step 1: Data input and preprocessing;

[0140] Traffic data:

[0141] The original data includes indicators such as vehicle speed (unit: km / h) and traffic volume (unit: vehicles / hour). The time period is from July 1 to July 31 and is recorded every 5 minutes.

[0142] For the vehicle speed data, the mean is 60 km / h and the standard deviation is 15 km / h.

[0143] Normalize the data using the formula: For example, for a vehicle speed value of 75km / h, the normalized value is for: .

[0144] Weather data:

[0145] The original data includes temperature (unit: ℃), rainfall (unit: mm), humidity (unit: %), and the time period is the same as the traffic data, recorded every 10 minutes.

[0146] In order to make the traffic data and weather data have the same time granularity, the weather data is firstly processed by linear interpolation to adjust its time granularity to every 5 minutes.

[0147] Time Alignment:

[0148] The cross-correlation estimator (CCE) calculates the correlation between traffic flow and rainfall and determines that the optimal time offset of rainfall is 15 minutes.

[0149] The time-shift adjuster (SA) shifts the rainfall data forward by 15 minutes to align the temporal relationship between traffic flow and rainfall impact.

[0150] Step 2: Application of the Time Alignment Module (TAM);

[0151] Use TAM to align traffic data and weather data. For example, during a certain period on July 10, the original rainfall had a lag in the impact on traffic flow. Through the time alignment module, the rainfall data was brought forward by 15 minutes to ensure that traffic and weather data were synchronized before model feature extraction.

[0152] Results: The aligned dataset includes synchronized traffic and weather features, both with a time granularity of 5 minutes.

[0153] Step 3: Weather data enters the enhanced temporal convolutional network (ETCN);

[0154] Since weather data mainly manifests itself in dynamic changes over time, it is only processed through the enhanced temporal convolutional network (ETCN).

[0155] ETCN uses a combination of deep convolution (DWConv) and point convolution (PWConv) to extract weather features.

[0156] The characteristics of weather data after ETCN processing are as follows: . (Timing characteristics)

[0157] Step 4: Traffic data enters the enhanced graph convolutional temporal convolutional network (GETCN);

[0158] For traffic data, since traffic flow not only has time dependence but also has significant spatial dependence, the enhanced graph convolutional temporal convolutional network (GETCN) is used for processing.

[0159] ETCN extracts temporal features from traffic data and reduces computational complexity through DWConv and PWConv.

[0160] The Graph Attention Network (GAT) further models the spatial relationship of the traffic network and assigns weights to important nodes through the attention mechanism.

[0161] Finally, the spatiotemporal features after GETCN processing are .

[0162] Step 5: Contrastive learning module (CL) performs feature fusion;

[0163] The comparative learning module combines weather characteristics and traffic characteristics Fusion is performed to ensure that the similar parts of the two types of features are close and the dissimilar parts are far away. that is , extracted by the enhanced graph convolutional temporal convolutional network (GETCN), which is used to extract spatiotemporal features from traffic data. In GETCN, GAT outputs node features, which are concatenated with the traffic data features output by deep convolution (DWConv) and point convolution (PWConv) to obtain the final spatiotemporal features.

[0164] that is , extracted by the enhanced temporal convolutional network (ETCN), which is used to extract temporal features from weather data, because weather data mainly shows dynamic changes in time. In ETCN, the output of deep convolution (DWConv) and point convolution (PWConv) is the weather feature, that is, the temporal feature.

[0165] Calculation of loss function: For example, for two segments with similar traffic and weather conditions, the cosine similarity of their fused feature vectors is 0.85, while the similarity under different traffic conditions is only 0.25.

[0166] Results: Through contrastive learning, fusion features are generated , its discrimination and robustness are significantly improved.

[0167] Step 6: Generate predictions;

[0168] The fused features Input to the fully connected layer to generate the predicted value of traffic flow.

[0169] Results: For example, during the morning rush hour on July 15, the predicted traffic volume was 500 vehicles / hour, and the actual observed value was 520 vehicles / hour, with a prediction error of 3.8%.

[0170] Experimental results and technical advantages:

[0171] Prediction accuracy: The deep learning traffic flow prediction method based on multi-source data fusion adopted in this embodiment reduces the average prediction error by 15.2% compared with the traditional ARIMA model, and reduces the error by 3.4% compared with the model that only uses traffic data.

[0172] Technical problems solved: The present invention solves the problem that weather data cannot be effectively used in traditional traffic flow prediction by fusing multi-source data; solves the problem of data time misalignment by using a time alignment module; and effectively captures the spatiotemporal dependencies in traffic flow by enhancing temporal convolution and graph attention networks, significantly improving the prediction accuracy in complex traffic scenarios.

[0173] This specific embodiment fully illustrates the effectiveness of the various modules of the present invention in actual traffic flow prediction tasks, as well as its technical innovation in solving the problems of multi-source data fusion and complex spatiotemporal dependency modeling.

[0174] The present invention provides a deep learning traffic flow prediction method based on meteorological information fusion. There are many methods and ways to implement the technical solution. The above is only a preferred implementation of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.

Claims

1. A deep learning traffic flow prediction method based on meteorological information fusion, characterized in that: The following steps are involved: Step 1, preprocessing traffic data and weather data; Step 2: Establish a time alignment module to solve the time misalignment problem between traffic data and weather data; Step 3, embedding and encoding traffic data and weather data; Step 4: Establish an enhanced spatiotemporal convolutional network. The traffic data is extracted from the spatiotemporal features through the enhanced spatiotemporal convolutional network, and the meteorological data is extracted from the time series features through the enhanced spatiotemporal convolutional network. Step 5: Establish a contrastive learning module to perform feature fusion and contrastive learning on spatiotemporal features and temporal features; Step 6: Generate predicted values ​​of traffic flow.

2. The method according to claim 1, characterized in that: Step 1 includes: time alignment of traffic data and weather data, processing of missing values, and then normalization.

3. The method according to claim 2, characterized in that Step 2 includes: the time alignment module includes a cross-correlation estimator and a time shift adjuster; The cross-correlation estimator calculates the cross-correlation between traffic data features and weather data features by the following formula: , in, Represents weather data characteristics Traffic data characteristics Offset in time The correlation coefficient when is the length of the sliding window, It indicates a point in time. Indicates time Weather data characteristics at that time , and They are weather data features The mean and standard deviation of Representing traffic data characteristics In time The value of and are the mean and standard deviation of traffic data characteristics, respectively.

4. The method according to claim 3, characterized in that In step 2, by maximizing , find the optimal time offset.

5. The method according to claim 4, characterized in that In step 2, the time shift adjuster is used to adjust the time of the weather data. The characteristics of the adjusted weather data are expressed by the following formula: , in, Is the weather data feature After adjustment, Represents the original weather data characteristics , Is the weather data feature The optimal time shift for the ; Shift indicates the time shift operation.

6. The method according to claim 5, characterized in that Step 3 includes: for traffic data and weather data, embedding coding is performed through linear transformation and ReLU activation function respectively. The embedding process of traffic data is expressed as: , in, represents the embedded traffic data features, is the weight matrix of the embedding layer, is the original traffic data feature, is a bias term for traffic data; ReLU is an activation function used to introduce nonlinearity, and the formula is: , in Represents a variable; The embedding process of weather data is expressed as: , in, is the embedded weather data feature, is the weight matrix for weather data, Represents the weather data after time alignment, is a bias term for weather data.

7. The method according to claim 6, characterized in that Step 4 includes: the enhanced spatiotemporal convolutional network first uses the enhanced temporal convolutional network ETCN to extract the temporal features in the traffic data. The enhanced temporal convolutional network ETCN uses a combination of deep convolution DWConv and point convolution PWConv. By using deep convolution DWConv, each channel will perform convolution operations independently. The formula is: , in, is the input feature, is the depth convolution kernel; The point convolution PWConv achieves cross-channel feature fusion through 1×1 convolution: , , in, is the batch normalization operation, is an activation function, ConvFFN1(x) represents a composite function including point convolution, batch normalization and activation function; PWConv1 represents a point convolution operation; represents another composite function that includes point convolution, batch normalization, and activation function; PWConv2 represents another point convolution operation.

8. The method according to claim 7, characterized in that In step 4, the enhanced spatiotemporal convolutional network also introduces a graph attention network, which dynamically allocates the connection weights of different nodes in the traffic network through the attention mechanism. The specific formula is: , , , , in, is the feature vector of node p, representing the attributes of node p; is the feature vector of node q, which represents the attribute of another node q adjacent to node p; Indicates that the correlation of all neighbors y of node p is calculated; LeakyReLU is a leaky linear rectifier unit; Is a node The linear transformation features of Is a node and The attention coefficient between Is a node The attention coefficient between and k; represents the linear transformation weight matrix for node features; is the weight vector in the attention mechanism; Is a node The neighbor set of is the attention weight after softmax normalization; exp is the natural exponential function; T represents the matrix transpose; Represents the new feature representation of node p.

9. The method according to claim 8, characterized in that Step 5 includes: the loss function L of the contrastive learning is: , in, represents the mth eigenvector and the nth eigenvector The cosine similarity of , V is the number of sample pairs, The temperature parameter that controls the feature separation scale.

10. The method according to claim 9, characterized in that Step 6 includes: converting the multidimensional feature vector into a specific output value through a fully connected layer: , in, is the predicted traffic flow value, is the fusion feature output by the contrast learning module. and are the weights and biases of the fully connected layer respectively.

Citation Information

Patent Citations

  • Big drilling data analytics engine

    CN107709700A

  • Traffic flow prediction method based on time and space and related equipment

    CN114360254A

  • Multi-source information space-time registration method and system based on joint similarity matching

    CN114913352A

  • Traffic flow prediction method and system based on multi-time-sequence convolutional gated graph neural network

    CN117238135A

  • Traffic volume prediction method under adverse weather conditions

    CN118015832A

Cited By

  • Expressway toll station flow prediction method and system

    CN119625994A

  • Intelligent road driving time prediction method based on multi-source data fusion and deep learning

    CN119992837A

  • Space-time diagram comparative learning method based on big kernel attention traffic flow prediction

    CN120472686A

  • A spatiotemporal graph contrastive learning method based on large kernel attention traffic flow prediction

    CN120472686B

  • Multi-source data processing method and device

    CN120708409A