Traffic flow prediction method and system based on graph neural networks and diffusion models

By combining graph neural networks and diffusion models and integrating external condition information, the problem of insufficient spatiotemporal dependence in existing traffic flow prediction methods is solved, achieving more accurate traffic flow prediction and intelligent traffic management.

CN120216864BActive Publication Date: 2025-11-14SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510179972.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-11-14
Estimated Expiration
2045-02-19

AI Technical Summary

Technical Problem

Existing traffic flow prediction methods fail to fully consider the impact of external conditions on traffic flow, resulting in limited predictive and generalization capabilities of the models in real-world environments, and making it difficult to effectively capture spatiotemporal dependencies and complex traffic data characteristics.

Method used

By combining graph neural networks and diffusion models, hidden spatiotemporal representations are extracted through multi-layer embedding. A backward denoising network is constructed using graph attention networks to fuse external condition information, capture spatiotemporal dependencies, and perform traffic flow prediction.

Benefits of technology

It improves the accuracy and generalization ability of traffic flow forecasting, enhances decision support for traffic management, and optimizes traffic signal control and route planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216864B_ABST
    Figure CN120216864B_ABST
Patent Text Reader

Abstract

This invention discloses a traffic flow prediction method and system based on graph neural networks and a diffusion model, relating to the field of intelligent transportation technology. The method includes: acquiring time-series traffic flow data of a target area and preprocessing it; constructing a diffusion model, using forward diffusion to progressively add noise to the preprocessed traffic flow time-series data; in the diffusion model, utilizing external conditional information to extract hidden spatiotemporal representations through multi-layer embedding; constructing a backward denoising network for the diffusion model based on a graph attention network; using the noisy traffic flow time-series data as input; fusing the hidden spatiotemporal representations with spatial features obtained through graph convolution; and combining multi-layer attention to denoise the noisy traffic flow time-series data to obtain the traffic flow prediction result. This invention proposes a traffic flow prediction framework combining graph neural networks and a conditional diffusion model, providing decision support for traffic management through accurate traffic flow prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent transportation technology, and more specifically, to a traffic flow prediction method and system based on graph neural networks and diffusion models. Background Technology

[0002] The spatiotemporal characteristics of traffic flow forecasting data are particularly complex. First, traffic flow varies over time, exhibiting clear periodicity and trends, influenced by factors such as different times of day, days of the week, and holidays. Second, traffic flow also demonstrates significant spatial dependence; traffic flow and traffic conditions between different roads, road segments, and intersections influence each other. Therefore, effectively modeling and capturing the spatiotemporal dependencies of traffic datasets has become a core challenge in traffic flow forecasting. Traditional spatiotemporal forecasting methods are typically based on regression or state-space models, usually assuming that time and space dependencies can be decoupled and modeling the time and space dimensions separately. While these methods perform well in some simple forecasting tasks, their performance gradually declines for complex high-dimensional data, especially when the interaction between time and space becomes more intense. The development of deep learning technology has provided new solutions for spatiotemporal forecasting. Graph Convolutional Networks (GCNs), with their advantages in modeling graph-structured data, are widely used in traffic flow forecasting tasks. By utilizing the adjacency matrix or dynamic graph structure of the road network, GCNs can effectively capture the spatial dependencies between nodes in the road network. However, these methods still face certain limitations when dealing with fine-grained fusion of spatiotemporal interactions.

[0003] In recent years, diffusion models have been introduced into spatiotemporal prediction tasks with promising results. Through a progressive denoising generation process, diffusion models can effectively capture the complex distribution characteristics of spatiotemporal data. For example, in traffic flow prediction, diffusion models can simulate traffic flow changes at different time steps and on different road segments through a multi-step noise diffusion process, capturing spatiotemporal dependencies. However, existing generative models often do not fully consider external conditions (such as holidays, weather changes, and special events), which have a significant impact on traffic flow changes. The lack of external conditions may limit the predictive and generalization abilities of the model when facing real-world traffic environments. Therefore, how to integrate graph neural networks and conditional diffusion models, and embed external conditions and their implicit relationships as knowledge into the model's reasoning process to improve the accuracy and generalization ability of traffic flow prediction, has become a crucial problem that urgently needs to be solved. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention proposes a traffic flow prediction method and system based on graph neural networks and diffusion models. By deeply integrating spatial structure and temporal dynamic information, it achieves accurate prediction of spatiotemporal sequences and enhances the accuracy of traffic flow prediction.

[0005] The first aspect of this invention provides a traffic flow prediction method based on graph neural networks and diffusion models, comprising the following steps:

[0006] Acquire traffic flow time-series data from various time-series sensors in the target area within a preset time period, and preprocess the traffic flow time-series data.

[0007] A diffusion model is constructed, and forward diffusion is used to gradually add noise to the preprocessed traffic flow time series data, so that the traffic flow time series data is close to pure noise with a Gaussian distribution.

[0008] In the diffusion model, hidden spatiotemporal representations are extracted through multi-layer embedding using external condition information, and these hidden spatiotemporal representations are then embedded into the diffusion model.

[0009] The backward denoising network of the diffusion model is constructed based on the graph attention network. The noisy traffic flow time series data is taken as input and converted into graph data format. The hidden spatiotemporal representation corresponding to the external condition information is fused with the spatial features obtained by graph convolution. The noisy traffic flow time series data is denoised by combining multi-layer attention to obtain the traffic flow prediction result of the target area.

[0010] In this scheme, traffic flow time-series data monitored by various time-series sensors in the target area within a preset time period are obtained, and the traffic flow time-series data is preprocessed, specifically as follows:

[0011] Traffic flow time series data within a preset time period is obtained from preset time series sensors in the target area, and missing values ​​are processed by linear interpolation.

[0012] The format of the supplemented traffic flow time series data is standardized, the time format is unified and the time steps are aligned. For multiple data points that appear during the sampling process, the mean aggregation method is adopted to enhance the consistency of traffic flow time series data.

[0013] Finally, the formatted traffic flow time series data is normalized to obtain preprocessed traffic flow time series data.

[0014] In this scheme, a diffusion model is constructed, and forward diffusion is used to gradually add noise to the preprocessed traffic flow time series data, making the traffic flow time series data approximate pure noise with a Gaussian distribution. Specifically:

[0015] A diffusion model is constructed by setting hyperparameters, and Gaussian noise is added to each time step of the preprocessed traffic flow time series data according to a preset noise ratio using a noise intensity scheduler.

[0016] As the time step increases, the traffic flow time series data gradually loses its original structure and characteristics through noise accumulation, and in the final time step, the traffic flow time series data is converted into pure noise with a Gaussian distribution.

[0017] In this scheme, within the diffusion model, hidden spatiotemporal representations are extracted using external condition information through multi-layer embedding, and these hidden spatiotemporal representations are then embedded into the diffusion model. Specifically:

[0018] In the diffusion model, a preliminary feature embedding layer, a periodic embedding layer, and a spatiotemporal adaptive embedding layer are constructed. The preliminary feature embedding layer uses a fully connected layer to perform preliminary feature embedding representation on the input preprocessed traffic flow time series data.

[0019] The periodic embedding layer sets up a learnable embedding dictionary to represent the seven days of the week and different time points within a day. Based on the timestamp information of traffic flow time series data, it extracts the corresponding embedding representation from the embedding dictionary, obtains weekly and daily cycle features based on the corresponding embedding representation, and generates periodic embedding representations using the weekly and daily cycle features.

[0020] The spatiotemporal adaptive embedding layer learns the spatiotemporal relationship features between different traffic flow time series data and embeds features, sharing the spatiotemporal relationship features across all traffic flow time series data, capturing complex spatiotemporal dependencies across sequences, and generating a spatiotemporal adaptive embedding representation.

[0021] By concatenating the initial feature embedding, periodic embedding, and spatiotemporally adaptive embedding, the final hidden spatiotemporal representation of traffic flow time series data is generated.

[0022] In this scheme, a backward denoising network for the diffusion model is constructed based on a graph attention network, specifically as follows:

[0023] A backward denoising network is constructed based on a graph attention network. The input is noisy traffic flow time series data, which includes time series sensor node features and time dimension. The input data is converted into graph data format, and the time series sensors are used as nodes. An edge structure is set according to the spatial association between the time series sensors, and an adjacency matrix is ​​constructed to represent the graph data.

[0024] The adjacency matrix is ​​imported into a graph attention network. The weights of neighboring nodes are dynamically assigned to each node through a self-attention mechanism to capture the non-uniform dependencies between nodes. Graph convolution operations are used to extract the spatial features of the nodes.

[0025] The hidden spatiotemporal representation extracted through multi-layer embedding in the diffusion model is read, and the hidden spatiotemporal representation is combined with the spatial features to strengthen the spatiotemporal dependence between nodes and obtain an updated feature matrix containing spatiotemporal information.

[0026] In this scheme, the backward denoising network incorporates multi-layer attention to denoise the noisy traffic flow time-series data, thereby obtaining the traffic flow prediction result for the target area. Specifically:

[0027] The updated feature matrix containing spatiotemporal information is imported into the temporal layer of the backward denoising network. The information weights of different time steps are set through a multi-head self-attention mechanism to capture the temporal dependencies between different time steps and generate a feature matrix that enhances the temporal dependencies.

[0028] The feature matrix that enhances the time dependency is imported into the feature layer of the backward denoising network. The contribution of different features to traffic flow prediction is measured by a multi-head self-attention mechanism to obtain the feature weight distribution. The feature matrix output by the feature layer is obtained based on the feature weight distribution.

[0029] The feature matrix is ​​combined with external condition information by the gating activation module, and the original spatiotemporal structure of the traffic flow time series data is restored by the fully connected layer in the regression layer to obtain the traffic flow prediction results for the target area.

[0030] In this scheme, the traffic flow prediction results of the target area at a preset time step and the timing scheme of the current traffic lights in the target area are obtained. The number of vehicles passing through a unit time is read through real-time traffic flow data, and the degree of traffic congestion is assessed based on the number of vehicles passing through a unit time.

[0031] Calculate the traffic flow difference between real-time traffic flow data and traffic flow prediction results for the target area, generate traffic characteristics of the target area based on the traffic flow difference and the degree of traffic congestion, and perform similarity retrieval in historical timing instances based on the traffic characteristics;

[0032] Read the traffic flow change sequence and timing scheme from the historical timing instance corresponding to the highest similarity, compare the real-time traffic flow data of the target area with the traffic flow change sequence, generate an adjustment coefficient based on the deviation of the change trend, use the adjustment coefficient to correct the retrieved timing scheme, and generate the timing scheme of the traffic lights in the target area.

[0033] The second aspect of the present invention provides a traffic flow prediction system based on graph neural networks and diffusion models, the system comprising: a data preprocessing module, a forward diffusion module, a condition generation module, a backward denoising module, and an application module;

[0034] The data preprocessing module is used to preprocess the traffic flow time-series data of the target area obtained by each time-series sensor within a preset time period.

[0035] The forward diffusion module is used to convert the preprocessed traffic flow time series data into Gaussian distributed pure noise;

[0036] The condition generation module is used to integrate external condition information through multi-layer embedding, extract the hidden spatiotemporal representation of traffic flow time series data, and guide the generation of the denoising process;

[0037] The backward denoising module is used to capture complex dependencies in the spatiotemporal sequence by combining graph convolution operations with the attention mechanism of time and feature layers, and gradually restore the original spatiotemporal structure during the denoising process to achieve traffic flow prediction in the target area.

[0038] The application module is used to dynamically adjust the timing scheme of traffic lights based on real-time and predicted traffic flow data to adapt to the traffic flow needs of different road sections in the target area.

[0039] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0040] This invention proposes a traffic flow prediction framework that combines graph neural networks and conditional diffusion models. Through the collaborative work of conditional network and denoising network modules, it effectively handles complex dependencies in spatiotemporal data.

[0041] By using graph attention networks and multi-layer attention mechanisms, the model can effectively capture complex dependencies in spatiotemporal data, while integrating external time conditions to enhance the accuracy of traffic flow data prediction, provide decision support for traffic management, optimize traffic signal control, route planning and emergency dispatch, and improve the efficiency and intelligence of the traffic system. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments or examples of the present invention, the drawings used in the embodiments or examples will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained according to these drawings without creative effort.

[0043] Figure 1 A flowchart of a traffic flow prediction method based on graph neural networks and diffusion models is shown.

[0044] Figure 2 A flowchart is shown that utilizes external conditional information to extract hidden spatiotemporal representations through multi-layer embedding;

[0045] Figure 3 A flowchart is shown to illustrate traffic flow prediction using a backward denoising network.

[0046] Figure 4A block diagram of a traffic flow prediction system based on graph neural networks and a diffusion model is shown. Detailed Implementation

[0047] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0048] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0049] Figure 1 A flowchart of a traffic flow prediction method based on graph neural networks and diffusion models is shown.

[0050] like Figure 1 As shown, the first embodiment of the present invention provides a traffic flow prediction method based on graph neural networks and diffusion models, including:

[0051] S102, acquire traffic flow time-series data monitored by various time-series sensors in the target area within a preset time period, and preprocess the traffic flow time-series data;

[0052] S104, Construct a diffusion model and use forward diffusion to gradually add noise to the preprocessed traffic flow time series data, so that the traffic flow time series data is close to pure noise with a Gaussian distribution.

[0053] S106, In the diffusion model, the hidden spatiotemporal representation is extracted through multi-layer embedding using external condition information, and the hidden spatiotemporal representation is embedded into the diffusion model;

[0054] S108, construct the backward denoising network of the diffusion model based on the graph attention network, take the noisy traffic flow time series data as input and convert it into graph data format, fuse the hidden spatiotemporal representation corresponding to the external condition information with the spatial features obtained by graph convolution, and combine multi-layer attention to denoise the noisy traffic flow time series data to obtain the traffic flow prediction result of the target area.

[0055] It should be noted that traffic flow time-series data within a preset time period is obtained from pre-set time-series sensors in the target area. Linear interpolation is used to handle missing values ​​in the traffic flow time-series data to ensure data integrity and continuity. Linear interpolation calculates missing values ​​based on the linear relationship between adjacent data points, effectively preserving the continuity of the time series while avoiding the impact of data anomalies on subsequent analysis. The imputed traffic flow time-series data undergoes format normalization, unifying the time format and aligning the time steps. The timestamps of the traffic flow time-series data are converted to a standardized format, and resampling is performed on a minute-by-minute basis, aligning the time steps. For multiple data points appearing during sampling, mean aggregation is used to ensure accurate representativeness of each time step, thereby enhancing the consistency of the time-series data. Finally, the formatted traffic flow time-series data is normalized to obtain pre-processed traffic flow time-series data. Normalization eliminates dimensional differences between features, and standardization methods are used to convert the data into a distribution with a mean of 0 and a standard deviation of 1. This not only improves the training efficiency of the model, but also avoids the impact of differences in feature range on the model results, thus providing high-quality input data for subsequent modeling and prediction.

[0056] It should be noted that diffusion models are a type of generative model. The purpose of generative models is to learn to generate data given some training data. Diffusion models start with random noise and gradually refine it through multiple steps until a target prediction result is obtained. A diffusion model is constructed by setting hyperparameters. A noise intensity scheduler adds Gaussian noise to each time step of the preprocessed traffic flow time-series data according to a preset noise ratio. The noise intensity scheduler defines the noise ratio for each time step. As the time steps increase, the traffic flow time-series data gradually loses its original structure and features through noise accumulation. In the final time step, the traffic flow time-series data is transformed into pure noise with a Gaussian distribution. The traffic flow time-series data approximates a standard normal distribution, providing a random starting point for the subsequent inverse diffusion generation process.

[0057] Figure 2 A flowchart is shown to extract hidden spatiotemporal representations using external conditional information through multi-layer embedding.

[0058] According to an embodiment of the present invention, in the diffusion model, a hidden spatiotemporal representation is extracted using external condition information through multi-layer embedding, and the hidden spatiotemporal representation is embedded into the diffusion model, specifically as follows:

[0059] S202, In the diffusion model, a preliminary feature embedding layer, a periodic embedding layer, and a spatiotemporal adaptive embedding layer are constructed. The preliminary feature embedding layer uses a fully connected layer to perform preliminary feature embedding representation on the input preprocessed traffic flow time series data.

[0060] S204, the periodic embedding layer sets a learnable embedding dictionary to represent the seven days of the week and different time points in a day. Based on the timestamp information of traffic flow time series data, it extracts the corresponding embedding representation from the embedding dictionary, obtains the weekly cycle features and daily cycle features based on the corresponding embedding representation, and generates a periodic embedding representation based on the weekly cycle features and daily cycle features.

[0061] S206, the spatiotemporal adaptive embedding layer embeds features by learning the spatiotemporal relationship features between different traffic flow time series data, shares the spatiotemporal relationship features with all traffic flow time series data, captures complex spatiotemporal dependencies across sequences, and generates a spatiotemporal adaptive embedding representation.

[0062] S208 combines preliminary feature embedding, periodic embedding, and spatiotemporally adaptive embedding to generate the final hidden spatiotemporal representation of traffic flow time series data.

[0063] It's important to note that in the periodic embedding layer, a learnable embedding dictionary is constructed to represent the seven days of the week. By querying the embedding dictionary, the day-of-the-week data is converted into corresponding embedding representations, thus capturing the cyclical features. Another learnable embedding dictionary is constructed to represent different times of day. Based on timestamp information, the corresponding timestamp embeddings are extracted by querying the embedding dictionary to characterize the periodic features of the day. The day-of-the-week embeddings and timestamp embeddings are concatenated to form a holistic representation of the periodic features, which is then extended to the data from all sensors to ensure that the diffusion model can capture the periodic patterns of time series. In the spatiotemporally adaptive embedding layer, a spatiotemporally shared embedding representation is designed to learn the spatiotemporal relationship features between different time series. Sharing the embeddings across all series helps the model capture complex spatiotemporal dependencies across series. Finally, the preliminary feature embeddings, periodic embeddings, and spatiotemporally adaptive embeddings are concatenated to generate the final hidden spatiotemporal representation. Because the temporal and spatial features of traffic flow time series data are comprehensively considered, it ensures that the model not only considers periodic features but also captures different temporal patterns from different sensors in the traffic flow time series data.

[0064] Figure 3 A flowchart illustrating traffic flow prediction using a backward denoising network is shown.

[0065] According to an embodiment of the present invention, a backward denoising network for the diffusion model is constructed based on a graph attention network, and multi-layer attention is used to denoise the noisy traffic flow time series data to obtain the traffic flow prediction result for the target area, specifically as follows:

[0066] S302, construct a backward denoising network based on a graph attention network, input noisy traffic flow time series data, the noisy traffic flow time series data includes time series sensor node features and time dimension, convert the input data into graph data format, use time series sensors as nodes and set edge structure according to the spatial association between time series sensors, construct an adjacency matrix to represent the graph data;

[0067] S304, The adjacency matrix is ​​imported into the graph attention network. The weights of the neighboring nodes are dynamically assigned to each node through the self-attention mechanism to capture the non-uniform dependencies between nodes. The spatial features of the nodes are extracted using graph convolution operations.

[0068] S306, Read the hidden spatiotemporal representation extracted through multi-layer embedding in the diffusion model, combine the hidden spatiotemporal representation with the spatial features, strengthen the spatiotemporal dependency between nodes, and obtain an updated feature matrix containing spatiotemporal information;

[0069] S308 imports the updated feature matrix containing spatiotemporal information into the temporal layer of the backward denoising network, sets the information weights of different time steps through a multi-head self-attention mechanism, captures the temporal dependencies between different time steps, and generates a feature matrix that enhances the temporal dependencies.

[0070] S310, the feature matrix that enhances the time dependency is imported into the feature layer of the backward denoising network, the contribution of different features to traffic flow prediction is measured by the multi-head self-attention mechanism, the feature weight distribution is obtained, and the feature matrix output by the feature layer is obtained according to the feature weight distribution.

[0071] S312, the feature matrix is ​​combined with external condition information through the gating activation module, and the original spatiotemporal structure of the traffic flow time series data is restored through the fully connected layer in the regression layer to obtain the traffic flow prediction results for the target area.

[0072] It should be noted that the graph attention network extracts the spatial features of each node and emphasizes the information of neighboring nodes that are highly relevant to the predicted target. The graph convolution operation can be represented as:

[0073] H (l) =GAT(X) (l-1) A)

[0074] Among them, H (l) Let X be the feature vector of the l-th layer space. (l-1) The input features of the previous layer (initially a mixture of spatial and temporal information) are denoted by A, which is the adjacency matrix representing the spatial relationships between nodes.

[0075] The hidden spatiotemporal representation extracted through multi-layer embedding in the diffusion model is read and mapped to a high-dimensional embedding vector to capture spatiotemporal information. This hidden spatiotemporal representation is then combined with the spatial features output by the graph attention network to enhance the model's ability to model spatiotemporal dependencies and provide richer contextual information for subsequent processing. The hidden spatiotemporal representation E(t) is:

[0076] E(t) = Embedding(t) c )

[0077] Where N is the number of nodes. For the conditional information of the current time step, Embedding(t) represents the embedding of t through multiple layers of embedding. c Convert it into a high-dimensional embedding vector.

[0078] Following the graph convolution operation, the hidden spatiotemporal representation E(t) obtained by diffusion embedding is combined with the output features of the graph neural network to enhance the model's ability to model temporal dependencies and generate a feature matrix that enhances temporal dependencies. Represented as:

[0079] The temporal layer of the backward denoising network captures the dependencies between time steps through a multi-head self-attention mechanism, uncovering long-term dependencies and short-term fluctuations in time-series data. By identifying key time steps, it dynamically adjusts the information weights of different time steps, generating feature representations that enhance temporal dependencies. In this process, the temporal layer captures the dependencies between different time steps through a self-attention mechanism, and the attention operation is represented as follows:

[0080]

[0081] Among them, Q time For querying the matrix, K time V is the key matrix. time Represents a value matrix, Based on these learnable parameters, the self-attention score A is calculated. time Capturing the temporal relationships between different spatial nodes:

[0082]

[0083] Where, d h The dimension is [missing information]. Finally, the output X of the time layer is obtained. time X time =A time V time .

[0084] The self-attention mechanism of the feature layer in the backward denoising network models the interaction relationships between features and measures the contribution of each feature to the prediction task. Through a multi-head attention mechanism, it focuses on the influence of different feature combinations, thereby optimizing the feature weight distribution, strengthening the focus on key features, and improving modeling accuracy. The self-attention mechanism of the feature layer is represented as follows:

[0085]

[0086] Among them, X feature Q is the feature matrix output by the feature layer. feature K feature V feature These represent the query matrix, key matrix, and value matrix of the attention mechanism in the feature layer, respectively. k For dimensions.

[0087] Finally, the feature matrix is ​​combined with the external conditional information sequence C through a gated activation unit to generate the final prediction result. The traffic flow prediction result for the target area is then calculated through a regression output layer. FC stands for fully connected layer.

[0088] It should be noted that the process involves obtaining the traffic flow prediction results for the target area at a preset time step and the current traffic light timing scheme for the target area. Real-time traffic flow data is used to read the number of vehicles passing through per unit time, and the degree of traffic congestion is assessed based on this number. The difference between the real-time traffic flow data and the traffic flow prediction results for the target area is calculated. Based on this difference and the degree of traffic congestion, traffic characteristics of the target area are generated. Similarity searches are performed on historical timing instances based on these traffic characteristics. The traffic flow change sequence and timing scheme corresponding to the historical timing instance with the highest similarity are read. The real-time traffic flow data of the target area is compared with the traffic flow change sequence in terms of trend. This trend comparison can be obtained through trend distance comparison, where the trend distance is the difference between the start and end points of the sequence segment. The trend deviation is obtained by segmenting the real-time traffic flow data and the traffic flow change sequence and then calculating the trend distance. An adjustment coefficient is generated based on the trend deviation, and this adjustment coefficient is used to correct the retrieved timing scheme, thus generating the traffic light timing scheme for the target area.

[0089] Figure 4 A block diagram of a traffic flow prediction system based on graph neural networks and a diffusion model is shown.

[0090] The second embodiment of the present invention provides a traffic flow prediction system 4 based on graph neural network and diffusion model. The system includes: a data preprocessing module 401, a forward diffusion module 402, a condition generation module 403, a backward denoising module 404, and an application module 405.

[0091] The data preprocessing module is used to preprocess the traffic flow time-series data of the target area obtained by each time-series sensor within a preset time period.

[0092] The forward diffusion module is used to convert the preprocessed traffic flow time series data into Gaussian distributed pure noise;

[0093] The condition generation module is used to integrate external condition information through multi-layer embedding, extract the hidden spatiotemporal representation of traffic flow time series data, and guide the generation of the denoising process;

[0094] The backward denoising module is used to capture complex dependencies in the spatiotemporal sequence by combining graph convolution operations with the attention mechanism of time and feature layers, and gradually restore the original spatiotemporal structure during the denoising process to achieve traffic flow prediction in the target area.

[0095] The application module is used to dynamically adjust the timing scheme of traffic lights based on real-time and predicted traffic flow data to adapt to the traffic flow needs of different road sections in the target area.

[0096] In the several embodiments provided in this application, it should be understood that the disclosed methods can be implemented in other ways. The system embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be indirect coupling or communication connection through some interfaces, devices, or modules, and can be electrical, mechanical, or other forms. Furthermore, in the various embodiments of the present invention, all functional modules can be integrated into one processing module, or each module can be a separate module, or two or more modules can be integrated into one module; the integrated modules can be implemented in hardware or in the form of hardware plus software functional modules.

[0097] If the integrated modules of this invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.

[0098] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A traffic flow prediction method based on graph neural networks and diffusion models, characterized in that, Includes the following steps: Acquire traffic flow time-series data from various time-series sensors in the target area within a preset time period, and preprocess the traffic flow time-series data. A diffusion model is constructed, and forward diffusion is used to gradually add noise to the preprocessed traffic flow time series data, so that the traffic flow time series data is close to pure noise with a Gaussian distribution. In the diffusion model, hidden spatiotemporal representations are extracted through multi-layer embedding using external condition information, and these hidden spatiotemporal representations are then embedded into the diffusion model. The backward denoising network of the diffusion model is constructed based on the graph attention network. The noisy traffic flow time series data is taken as input and converted into graph data format. The hidden spatiotemporal representation corresponding to the external condition information is fused with the spatial features obtained by graph convolution. The noisy traffic flow time series data is denoised by combining multi-layer attention to obtain the traffic flow prediction result of the target area.

2. The traffic flow prediction method based on graph neural networks and diffusion models according to claim 1, characterized in that, The system acquires time-series traffic flow data from various time-series sensors in the target area within a preset time period, and preprocesses the traffic flow time-series data, specifically as follows: Traffic flow time series data within a preset time period is obtained from preset time series sensors in the target area, and missing values ​​are processed by linear interpolation. The format of the supplemented traffic flow time series data is standardized, the time format is unified and the time steps are aligned. For multiple data points that appear during the sampling process, the mean aggregation method is adopted to enhance the consistency of traffic flow time series data. Finally, the formatted traffic flow time series data is normalized to obtain preprocessed traffic flow time series data.

3. The traffic flow prediction method based on graph neural networks and diffusion models according to claim 1, characterized in that, A diffusion model is constructed, and forward diffusion is used to gradually add noise to the preprocessed traffic flow time series data, making the traffic flow time series data approximate pure noise with a Gaussian distribution. Specifically: A diffusion model is constructed by setting hyperparameters, and Gaussian noise is added to each time step of the preprocessed traffic flow time series data according to a preset noise ratio using a noise intensity scheduler. As the time step increases, the traffic flow time series data gradually loses its original structure and characteristics through noise accumulation, and in the final time step, the traffic flow time series data is converted into pure noise with a Gaussian distribution.

4. The traffic flow prediction method based on graph neural networks and diffusion models according to claim 1, characterized in that, In the diffusion model, hidden spatiotemporal representations are extracted using external conditional information through multi-layer embedding, and these hidden spatiotemporal representations are then embedded into the diffusion model, specifically as follows: In the diffusion model, a preliminary feature embedding layer, a periodic embedding layer, and a spatiotemporal adaptive embedding layer are constructed. The preliminary feature embedding layer uses a fully connected layer to perform preliminary feature embedding representation on the input preprocessed traffic flow time series data. The periodic embedding layer sets up a learnable embedding dictionary to represent the seven days of the week and different time points within a day. Based on the timestamp information of traffic flow time series data, it extracts the corresponding embedding representation from the embedding dictionary, obtains weekly and daily cycle features based on the corresponding embedding representation, and generates periodic embedding representations using the weekly and daily cycle features. The spatiotemporal adaptive embedding layer learns the spatiotemporal relationship features between different traffic flow time series data and embeds features, sharing the spatiotemporal relationship features across all traffic flow time series data, capturing complex spatiotemporal dependencies across sequences, and generating a spatiotemporal adaptive embedding representation. By concatenating the initial feature embedding, periodic embedding, and spatiotemporally adaptive embedding, the final hidden spatiotemporal representation of traffic flow time series data is generated.

5. The traffic flow prediction method based on graph neural networks and diffusion models according to claim 1, characterized in that, The backward denoising network for the diffusion model is constructed based on a graph attention network, specifically as follows: A backward denoising network is constructed based on a graph attention network. The input is noisy traffic flow time series data, which includes time series sensor node features and time dimension. The input data is converted into graph data format, and the time series sensors are used as nodes. An edge structure is set according to the spatial association between the time series sensors, and an adjacency matrix is ​​constructed to represent the graph data. The adjacency matrix is ​​imported into a graph attention network. The weights of neighboring nodes are dynamically assigned to each node through a self-attention mechanism to capture the non-uniform dependencies between nodes. Graph convolution operations are used to extract the spatial features of the nodes. The hidden spatiotemporal representation extracted through multi-layer embedding in the diffusion model is read, and the hidden spatiotemporal representation is combined with the spatial features to strengthen the spatiotemporal dependence between nodes and obtain an updated feature matrix containing spatiotemporal information.

6. The traffic flow prediction method based on graph neural networks and diffusion models according to claim 5, characterized in that, In the backward denoising network, multi-layer attention is used to denoise the noisy traffic flow time-series data to obtain the traffic flow prediction results for the target area, specifically: The updated feature matrix containing spatiotemporal information is imported into the temporal layer of the backward denoising network. The information weights of different time steps are set through a multi-head self-attention mechanism to capture the temporal dependencies between different time steps and generate a feature matrix that enhances the temporal dependencies. The feature matrix that enhances the time dependency is imported into the feature layer of the backward denoising network. The contribution of different features to traffic flow prediction is measured by a multi-head self-attention mechanism to obtain the feature weight distribution. The feature matrix output by the feature layer is obtained based on the feature weight distribution. The feature matrix is ​​combined with external condition information by the gating activation module, and the original spatiotemporal structure of the traffic flow time series data is restored by the fully connected layer in the regression layer to obtain the traffic flow prediction results for the target area.

7. The traffic flow prediction method based on graph neural networks and diffusion models according to claim 1, characterized in that, Obtain the traffic flow prediction results of the target area at a preset time step and the timing scheme of the current traffic lights in the target area. Read the number of vehicles passing through a unit time by real-time traffic flow data, and assess the degree of traffic congestion based on the number of vehicles passing through a unit time. Calculate the traffic flow difference between real-time traffic flow data and traffic flow prediction results for the target area, generate traffic characteristics of the target area based on the traffic flow difference and the degree of traffic congestion, and perform similarity retrieval in historical timing instances based on the traffic characteristics; Read the traffic flow change sequence and timing scheme from the historical timing instance corresponding to the highest similarity, compare the real-time traffic flow data of the target area with the traffic flow change sequence, generate an adjustment coefficient based on the deviation of the change trend, use the adjustment coefficient to correct the retrieved timing scheme, and generate the timing scheme of the traffic lights in the target area.

8. A traffic flow prediction system based on graph neural networks and a diffusion model, characterized in that, The traffic flow prediction method based on graph neural network and diffusion model as described in any one of claims 1-7 is provided, comprising: a data preprocessing module, a forward diffusion module, a condition generation module, a backward denoising module, and an application module. The data preprocessing module is used to preprocess the traffic flow time-series data of the target area obtained by each time-series sensor within a preset time period. The forward diffusion module is used to convert the preprocessed traffic flow time series data into Gaussian distributed pure noise; The condition generation module is used to integrate external condition information through multi-layer embedding, extract the hidden spatiotemporal representation of traffic flow time series data, and guide the generation of the denoising process; The backward denoising module is used to capture complex dependencies in the spatiotemporal sequence by combining graph convolution operations with the attention mechanism of time and feature layers, and gradually restore the original spatiotemporal structure during the denoising process to achieve traffic flow prediction in the target area. The application module is used to dynamically adjust the timing scheme of traffic lights based on real-time and predicted traffic flow data to adapt to the traffic flow needs of different road sections in the target area.

Citation Information

Patent Citations

  • Traffic flow prediction method based on de-noising attention enhancement cyclic multi-graph convolutional network

    CN118506589A

  • Traffic flow prediction method based on decoupling fusion network

    CN119049285A