A traffic flow prediction method and system based on a diffusion model

By constructing a spatiotemporal dependency structure diagram and a diffusion model, the shortcomings of existing traffic flow prediction technologies in terms of long-term and short-term feature fusion and noise processing are addressed, achieving high-precision and robust prediction for complex road networks.

CN119889026BActive Publication Date: 2025-12-26TUOHENG TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411851701.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-12-26
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

Existing traffic flow prediction technologies struggle to integrate long-term characteristics with recent dynamics, lack sufficient understanding of complex spatiotemporal structures, and lack generative modeling capabilities under noisy data.

Method used

By constructing a spatiotemporal dependency structure graph, extracting periodic and target features, using dynamic time warping methods for selective transfer and weighted fusion, and training based on a diffusion model, multi-scale and multi-stage spatiotemporal feature distribution prediction is achieved.

Benefits of technology

It improves the accuracy and robustness of traffic flow forecasting, maintains robustness under noise and sudden events, adapts to the nonlinear interaction effects of complex road networks, and enhances the flexibility and accuracy of forecasting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119889026B_ABST
    Figure CN119889026B_ABST
Patent Text Reader

Abstract

The application discloses a traffic flow prediction method and system based on a diffusion model, which comprises the following steps: obtaining historical traffic data and performing data preprocessing to form a sample data set; taking a road section of a road network as a node, constructing an edge according to geographical adjacency and historical traffic correlation between road sections, and forming a space-time dependent structure graph; performing periodic feature extraction and target feature extraction; measuring the similarity of the periodic features and the target features in the time dimension by using a dynamic time warping method, and selectively migrating and weighting the periodic features based on the similarity to obtain fused features; inputting the fused features into a traffic flow prediction model constructed based on a diffusion model for training, and outputting a representation vector for predicting future traffic flow; and inputting traffic data at a current time into the trained prediction model for traffic flow prediction, and outputting a traffic flow prediction result for a future time period.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intelligent traffic prediction, and in particular to a traffic flow prediction method and system based on a diffusion model. BACKGROUND

[0002] Traditional traffic flow prediction methods mostly rely on statistical models or means based on classical time series analysis, such as autoregressive moving average model (ARIMA), seasonal ARIMA (SARIMA), and periodic decomposition method based on Fourier transform. These traditional methods can provide short-term prediction with certain accuracy under certain conditions, but their model structures are relatively simple, the robustness to abnormal data is weak, and it is difficult to fully exploit the inherent spatial correlation and nonlinear dynamic characteristics in the road network.

[0003] At present, although the prior art has solved the problem of poor capture of nonlinear characteristics by traditional statistical models, it still faces many challenges. In particular, most existing deep models cannot fully integrate long-term periodic characteristics and recent dynamic data, and usually need to manually or empirically decompose and fuse periodic and trend information, lacking an adaptive feature fusion mechanism under a unified framework.

[0004] The deficiencies of the prior art mainly lie in the inability to efficiently and uniformly integrate long-term periodic patterns and short-term dynamic changes, and to capture the multi-stage feature distribution under different time scales and spatial correlations in the prediction model. Specifically, traditional methods are difficult to cope with nonlinear interaction effects under complex road network structures, and it is difficult to simultaneously consider long-period stable patterns and recent period fluctuations in the same model framework. Even if some methods introduce graph neural network structures to extract spatial features using topological information, they still lack multi-scale representation and fusion in the time dimension. In addition, conventional deep prediction models often rely on simple regularization methods when dealing with data noise or uncertain data, and cannot model the underlying spatio-temporal distribution through a systematic diffusion and anti-diffusion process, thereby limiting the prediction accuracy and robustness.

[0005] Therefore, there is an urgent need for a technical solution that can capture long-term and short-term spatio-temporal feature changes from multiple perspectives and effectively reduce noise and improve prediction accuracy through an adaptive feature fusion and diffusion generation process. SUMMARY

[0006] This section is intended to summarize some aspects of the embodiments of the present application and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the abstract and title of the specification to avoid obscuring the purpose of this section, abstract and title, and such simplifications or omissions cannot be used to limit the scope of the present application.

[0007] In view of the above existing problems, the present application is proposed.

[0008] Therefore, the technical problem solved by the present application is that the existing traffic flow prediction technology has the problems of difficulty in comprehensively combining long-period characteristics and recent dynamics, lack of understanding of complex spatio-temporal structure, and lack of generative modeling ability under noisy data.

[0009] To solve the above technical problems, the present application provides the following technical solutions: obtaining historical traffic data and performing data preprocessing to form a sample data set containing traffic flow, traffic speed and road occupancy rate;

[0010] The road segments of the road network in the sample data set are taken as nodes, and the edges are constructed according to the geographical adjacency and historical traffic correlation between the road segments to form a spatio-temporal dependence structure graph describing spatio-temporal dependence;

[0011] Periodic feature extraction and target feature extraction are performed on the historical traffic data in the spatio-temporal dependence structure graph;

[0012] The similarity of the periodic features and the target features in the time dimension is measured by using a dynamic time warping method, and the periodic features are selectively migrated and weighted fused based on the similarity to obtain fused features;

[0013] The fused features are input into a traffic flow prediction model constructed based on a diffusion model for training, and through a forward noise adding and reverse diffusion restoration process, multi-scale and multi-stage spatio-temporal feature distribution is captured, and a representation vector of predicted future traffic flow is output;

[0014] The current traffic data is input into the trained prediction model for traffic flow prediction, and through the reverse diffusion process, the traffic flow prediction result of the future time period is output.

[0015] As a preferred scheme of the traffic flow prediction method based on the diffusion model, historical traffic data in a specified time period is derived from a traffic control system, and is subjected to missing value processing, abnormal value detection and normalization processing to obtain the sample data set.

[0016] As a preferred scheme of the traffic flow prediction method based on the diffusion model, the sample data set is represented as a three-dimensional tensor, and the mathematical expression formula is:

[0017] X∈R N×T s ×F

[0018] Wherein, N is the number of road segment nodes, T s is the number of time slices, F is the number of feature dimensions, and X is the sample data set.

[0019] As a preferred scheme of the traffic flow prediction method based on the diffusion model, the space-time dependent structure graph describing the space-time dependence is formed, comprising:

[0020] Taking the road segments as nodes, N road segments are taken as N nodes in a node set V;

[0021] According to the geographical adjacency relationship and the historical traffic correlation, edges are established between nodes to form an adjacency matrix A;

[0022] Based on the node set V and the adjacency relationship matrix A, a graph structure G describing the space-time dependence is formed.

[0023] As a preferred scheme of the traffic flow prediction method based on the diffusion model, the periodic feature and the target feature are extracted, comprising:

[0024] Selecting historical data with a longer time span as periodic data, defining the length of the periodic data as T cyc time slices, and obtaining periodic features Z cyc through feature extraction processing;

[0025] Selecting data in a recent time period as target data, defining the length of the target data as T tar time slices, and obtaining target features Z tar through feature extraction processing.

[0026] As a preferred scheme of the traffic flow prediction method based on the diffusion model, the fusion feature is obtained, comprising:

[0027] Z fus = αZ cyc +(1-α)Z tar

[0028]

[0029] Wherein, Z fus is the fusion feature, Z cyc is the periodic feature, Z tar is the target feature, T fu s is the number of time slices with unified length in the time dimension after fusion, N is the number of road segments, F* is the feature dimension, and α is the similarity.

[0030] As a preferred scheme of the traffic flow prediction method based on the diffusion model, the current traffic data is input into the trained prediction model, and the traffic flow prediction result of the future time period is output through the reverse diffusion process, comprising:

[0031]

[0032] Where Tpred represents the future Tpred time slices, and N is the number of road segments, i.e., the number of nodes. For the future T section of the road pred Traffic flow forecast for each time slot.

[0033] As a preferred embodiment of the traffic flow prediction system based on the diffusion model described in this invention, it includes:

[0034] One or more processors;

[0035] The memory stores operable instructions that, when executed by the one or more processors, cause the one or more processors to perform operations, including the flow of the traffic flow prediction method based on the diffusion model described above.

[0036] As a preferred embodiment of the computer-readable medium for storing software according to the present invention, the software includes instructions executable by one or more computers, the instructions causing the one or more computers to perform operations, the operations including the flow of the traffic flow prediction method based on the diffusion model described above.

[0037] The beneficial effects of this invention are:

[0038] 1. By constructing a graph structure, explicit modeling of complex road network topology is achieved, enabling the model to no longer rely solely on local time-series information, but to comprehensively consider the traffic behavior and potential influencing factors of adjacent road segments. This allows subsequent feature extraction and prediction models to more accurately understand the interaction and correlation between different road segments, thereby improving overall prediction accuracy and robustness. It effectively reduces the limitations of single-point prediction of traffic data and enables the model to better capture the collaborative evolution trend between multiple road segments.

[0039] 2. By flexibly matching on the time axis through DTW, the model can identify the correspondence between periodic patterns and recent data in time series. When the similarity is high, the system preferentially transfers periodic features and assigns them higher weights. When the similarity is low, it tends to strengthen the influence of recent dynamic features. This adaptive selective weighted fusion ensures that the model can refer to long-term stable periodic patterns and quickly respond to recent sudden changes and trend fluctuations. This achieves deep integration at the feature level, improves the overall perception ability of subsequent prediction models of features at different time scales, reduces information redundancy and bias caused by blindly superimposing features, and thus improves the flexibility and accuracy of prediction.

[0040] 3. The training strategy based on the diffusion process can capture fine-grained local changes and present hierarchical distribution of global spatio-temporal structure, making the final prediction result more robust and diverse. When the model faces noise, sudden events or abnormal data, the restoration mechanism of the diffusion process can effectively alleviate the impact of uncertainty, thereby significantly improving the prediction accuracy and stability. BRIEF DESCRIPTION OF DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor. Among them:

[0042] Figure 1 The flowchart of the traffic flow prediction method based on the diffusion model shown in the present application;

[0043] Figure 2 The traffic flow prediction accuracy comparison diagram of the traditional method and the method of the present application under the medium and high flow scene. DETAILED DESCRIPTION

[0044] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present application, not all embodiments.

[0045] Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0046] In the following description, many specific details are set forth in order to provide a thorough understanding of the present application, but the present application can also be implemented in other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the connotation of the present application. Therefore, the present application is not limited to the specific embodiments disclosed below.

[0047] According to the embodiments of the present application, combined with the flowchart shown in Figure 1 The traffic flow prediction method based on the diffusion model, specifically comprising the following steps:

[0048] S1, obtaining historical traffic data and pre-processing the data to form a sample data set containing traffic flow, traffic speed and road occupancy. Among them, the present step needs to be explained:

[0049] Deriving historical traffic data in a specified time period from a traffic control system (such as a sensor network deployed by a city traffic perception platform or intelligent traffic management department);

[0050] For example, if the time period is T days and the data collection system uses a fixed time interval Δt for data recording, such as recording data every 5 minutes, then there are T s time slices, which can be mathematically expressed as follows:

[0051]

[0052] Define that there are N road segments in the road network, then in each time slice t (t = 1, 2,..., T s ), the traffic index data of each road segment i (i = 1, 2,..., N) is recorded, including at least flow f i,t , speed d i,t , and occupancy o i,t ;

[0053] At this time, the collected historical traffic data is regarded as a three-dimensional data structure:

[0054] D raw = {(f i,t , d i,t , o i,t )|i = 1,..., N; t = 1,..., T s}

[0055] That is, for each road segment i and time slice t, there is a set of records (f i,t , d i,t , o i,t );

[0056] Performing adjacent time slice average value filling and outlier detection processing on missing traffic index values in the historical traffic data (such as missing flow data), if some road segments cannot be filled or have too many outliers in some time slices, then the road segments are excluded or the time slices are truncated, so that the data set remains consistent in time and space (road segment) dimensions;

[0057] Then performing normalization processing on the historical traffic data to map it to the [0, 1] interval;

[0058] After completing the normalization processing, each road segment i has a feature vector in time slice t:

[0059] x i,t = [f′ i,t , d′ i,t , l′ i,t ]

[0060] In a preferred embodiment, other indicators (such as weather conditions w i,t , emergency information) can be added and incorporated into the data vector, such as:

[0061] x i,t =[f′ i,t , d′ i,t , o′ i,t , w′ i,t ,...]

[0062] The final sample data set can be represented as a three-dimensional tensor X:

[0063]

[0064] where N is the number of road segment nodes, T s is the number of time slices, F is the number of feature dimensions (F≥3, at least including f′ i,t, , d′ i,t , o′ i,t ), x i,t represents the feature vector of the i-th road segment at time slice t, and X is the sample data set.

[0065] It should be noted that through the above data preprocessing process, the final sample data set X is a tensor structure, in which each row corresponds to a road segment (node), each column corresponds to a time slice, and each element in the row vector is a normalized traffic indicator (at least including f′ flow, d′ speed and o′ occupancy) of the road segment at the time slice, so that the data representation is clear and standardized, and can be directly input into subsequent spatio-temporal modeling and prediction model training, improving the accuracy and efficiency of model training.

[0066] S2, taking the road segments of the road network in the sample data set as nodes, constructing edges according to the geographical adjacency and historical traffic correlation between the road segments to form a spatio-temporal dependence structure graph describing spatio-temporal dependence. It should be noted that in this step:

[0067] Taking the road segments as nodes, the N road segments are taken as N nodes in the node set V;

[0068] As can be easily understood, a road network is composed of multiple road segments, each road segment is regarded as an independent spatial unit, and there are N road segments in the sample data set obtained in step S1, the numbers of these road segments are from 1 to N, each road segment is recorded as a node, and a node set V is obtained, represented as:

[0069] V={V1,V2,...,v N}

[0070] where v i represents the node corresponding to the i-th road segment;

[0071] Further, according to the geographical adjacency relationship and the historical traffic correlation, an edge is established between nodes to form an adjacency matrix A, and the above-mentioned nodes are used to represent the spatial correlation and potential space-time influence relationship between road segments through the established edge; wherein:

[0072] If two road segments are directly connected in the road network or the distance is within a set threshold range, an undirected edge can be established between the two nodes;

[0073] As an example, the start and end point coordinates (such as longitude and latitude) of the road segment are extracted from the urban road GIS (Geographic Information System) data, and the geographical distance between road segment i and road segment j is dist(i, j). When dist(i, j) is less than a set threshold D th , it is considered that v i has a geographical adjacency relationship with v j .

[0074]

[0075] Among them, represents a temporary adjacency label obtained based on the geographical adjacency relationship;

[0076] Further, the statistical correlation of the historical traffic conditions between road segments is considered, that is, the sample data set X is statistically analyzed, for example, for road segment i and road segment j, the time series of a certain feature (such as the flow f′ i,t and f′ j,t ) at t = 1, 2,..., T s is taken, and the Pearson correlation coefficient is calculated:

[0077]

[0078] Among them, and are the average values of the flow of road segment i and j in the entire time range;

[0079] When p(i, j) is greater than a set threshold C th , it indicates that the historical flow of road segment i and j is significantly correlated, and an edge can be connected in the graph:

[0080]

[0081] On the contrary, it is ignored;

[0082] Considering the above-mentioned geographical adjacency relationship and historical flow correlation, the adjacency relationship matrix A is constructed:

[0083] A = [A ij ] N×N , A ij∈ {0, 1}

[0084] wherein, A ij = 1 represents that there is an undirected edge (e i ) between node v j , A ij = 0 represents that there is no direct spatial relationship or statistical correlation between the two; ij

[0085] Based on the node set V and the adjacency matrix A, a graph structure G describing the spatiotemporal dependence is formed:

[0086] G = (V, E)

[0087] wherein, E represents an edge set, including all node pairs (i, j) satisfying A ij = 1, at this time, the spatiotemporal dependence structure graph G is used to depict the spatial relationship of each road segment in the road network, and the time series characteristics implied by the node characteristics (the data set X provided by step S1), forming a "spatiotemporal dependence" data structure.

[0088] It should be noted that G describes the connection structure in space, and the sample data set X describes the evolution of characteristics in time series. In subsequent processing, the graph G and the data set X will be jointly used as input, so that the model can mine the spatiotemporal association patterns in the data, thereby improving the accuracy of traffic flow prediction.

[0089] S3, periodical feature extraction and target feature extraction are performed on the historical traffic data in the spatiotemporal dependence structure graph. It should be noted that in this step, the periodic features (periodical features) are extracted from long-term historical data (such as long-term statistics with a week as a period), and the features (target features) reflecting short-term dynamic changes are extracted from recent historical data (such as data in the last 7 days); the periodical features and the target features are used as inputs for subsequent steps (such as the dynamic time warping similarity measurement and feature fusion in step S4).

[0090] Specifically, the following steps are included:

[0091] Select historical data with a longer time span as periodical data (for example, in the past several weeks), and set the length of the periodical data as T cyc time slices, and the corresponding data subset is:

[0092]

[0093] A normalized Laplacian matrix L of the undirected graph G is constructed using the adjacency matrix A in step S2:

[0094] L = C - A

[0095] wherein, C is a diagonal matrix, and L is subjected to eigenvalue decomposition:​

[0096] L = UΛU T

[0097] where U is the eigenvector matrix, U T Λ is the eigenvalue diagonal matrix, U is regarded as the Fourier basis of the graph G;

[0098] Project the periodic data X cyc in the node dimension to the frequency domain of the graph G:

[0099]

[0100] where X cyc is regarded as the eigentensor unfolded by nodes, and the eigenvectors of N nodes are mapped under each time slice, and after transformation, is the representation form of the periodic data in the frequency domain, and the dimension is still [N, T cyc , F], but after U T mapping, the spatial component corresponding to each dimension has been converted into a frequency domain eigenvector component;

[0101] In the frequency domain space, different eigenvector components represent different levels of spatial correlation patterns. A set of trainable parameters W_Q and W_K are used to map each eigenvector component to the query (Q) and key (K) vector space, and then calculate the attention weight a f :

[0102]

[0103] where f represents the frequency index, F freq is the range of the number of frequencies considered, is the eigenvector of the periodic data at frequency f (containing time series information), W K , W Q are learning parameters;

[0104] Weighted sum of each frequency component using a f , highlights the frequency components with significant periodicity, and suppresses irregular noise frequencies, to get the eigenvector representation of the periodic data after frequency domain weighting:

[0105]

[0106] where Z cyc is the eigenvector representation of the periodic data after frequency domain weighting, and the dimension is represented as [N, T cyc , F′], F′ is the eigenvector dimension obtained after dimension reduction or projection, that is, F′ is the number of eigenvector dimensions;

[0107] Select the recent period of data as the target data (such as the last 7 days), and set the length of the target data as T tar , and the corresponding data subset is:

[0108]

[0109] The graph convolution network is used to perform graph convolution operation on the node features of each time slice t in the target data X tar

[0110]

[0111] wherein, is the extracted spatio-temporal feature, W (l) is the training parameter of the lth layer, and σ is a nonlinear activation function (such as ReLU), and A is an adjacency matrix. After multiple layers of superposition, the features of each time slice are embedded into high-level representations, and the T tar time series is processed, and the spatio-temporal representation of the recent data is obtained.

[0112] The time series modeling unit is combined to further capture the dynamic changes in the time dimension, and finally the target feature Z tar is obtained.

[0113] Z tar = GNN (X tar , A)

[0114] wherein, the dimension of the target feature Z tar is represented as [N, T tar , F″], and F″ is the feature dimension number.

[0115] In an optional embodiment, if F′≠F″, the periodic feature and the target feature are mapped to the same feature dimension space by a linear projection method, i.e. F′=F″=F * , so as to perform subsequent similarity measurement and fusion processing.

[0116] It should be noted that by combining the spatio-temporal dependence structure graph G with the data set X, the periodic feature is extracted from the long-term data, and the target feature is extracted from the recent data, and the feature representation reflecting the long-term regularity and short-term dynamics is obtained, which provides high-quality and usable feature input for subsequent feature fusion and prediction steps.

[0117] ​​S4, measure the similarity of the periodic features and the target features in the time dimension by using the dynamic time warping method, and selectively migrate and weightedly fuse the periodic features based on the similarity, to obtain the fused features. It needs to be explained that, by measuring the matching degree between the periodic features and the target features in the time dimension, the periodic features are selectively migrated and weightedly fused into the target features, and finally the fused features with long-term periodic patterns and recent dynamic changes are obtained, and the specific steps are as follows:

[0118] Z cyc and the features of Z tar are aggregated in the node dimension (such as averaging N road segments), to obtain two time series:

[0119]

[0120] The feature vector at each time step and are F * dimensional, and can be regarded as points in the F * dimensional Euclidean space;

[0121] The difference between the feature vectors is measured by the Euclidean distance formula:

[0122]

[0123] In the matrix, find a matching path p from D(1,1) to D(T cyc , T tar ) that meets the time sequence consistency (the path cannot be reversed, and can only move forward, downward or diagonally downward), so that the distance cumulative sum on the path is minimized:

[0124]

[0125] Wherein, P is the set of all possible matching paths;

[0126] The dynamic programming method is used to recursively solve D DTW :

[0127] γ(t,τ)=D(t,τ)+min{γ(t-1,τ),γ(t,T--1),γ(t-1,τ--1)}

[0128] Wherein, γ(t,τ) is the minimum cumulative distance from (1,1) to (t,τ), and finally γ(T cyc , T tar ) is DDTW(Z cyc , Z tar );

[0129] The distance D DTWAfter that, it is mapped to a similarity score, the smaller the distance, the higher the similarity should be, and the similarity a is defined as:

[0130] a (= exp(-D DTW (Z cyc , Z tar ))

[0131] When D DTW is small, a is close to 1; when D DTW is large, a is close to 0;

[0132] When the periodic feature is similar to the target feature (a is close to 1), it means that the periodic feature is similar to the recent data pattern, and the weight of the periodic feature in the fusion should be increased;

[0133] When the similarity is low (a is close to 0), it means that the periodic feature is different from the recent data, and the contribution of the periodic feature in the fusion should be reduced;

[0134] Then the calculation formula of the fusion feature Z fus is:

[0135] Z fus = a Z cyc + (1-a) Z tar

[0136]

[0137] Wherein, Z cyc and Z tar are feature tensors related to road sections and time, and the larger a is, the higher the migration degree is; by weighting Z cyc by a and weighting Z tar by (1-a), the selective migration of the periodic feature is realized, T fu s is the number of time slices after the fusion in the time dimension, N is the number of road sections, and F * is the feature dimension;

[0138] It should be noted that the time dimension matching degree of the periodic feature and the target feature is calculated by the DTW method to obtain the DTW distance, and then the similarity score is obtained by exponential mapping, the periodic feature is weighted and fused into the target feature to obtain the fusion feature, which is an adaptive feature representation that not only fuses long-term regularity but also retains recent dynamic change characteristics, and provides accurate calculation services for subsequent diffusion model training and final traffic flow prediction.

[0139] S5, input the fusion feature into the traffic flow prediction model based on the diffusion model to train, capture the multi-scale, multi-stage spatio-temporal feature distribution through the forward noise adding and reverse diffusion restoration process, and output the representation vector of the predicted future traffic flow. It should be noted that in this step:

[0140] Through the forward diffusion process in the diffusion model (from the initial input Z fus , adding Gaussian noise to the data step by step), the reverse diffusion model (a trainable neural network model for learning how to denoise and reconstruct noise-free data representation from high-noise data in the reverse direction, i.e. learning the latent distribution representation of the data, so as to realize future traffic flow prediction), a traffic flow prediction model is constructed;

[0141] Randomly extract a batch of data samples from the fusion feature data set, each sample being a slice of Z fus ;

[0142] For each sample in the batch, randomly select a diffusion time step t (1≤t≤T);

[0143] According to the selected t, add noise to the noise-free data x0=Z fus to x t (the data representation after adding noise at the t-th step in the diffusion process);

[0144] Input x t and the time step t into the model ∈ θ , to obtain the model predicted noise ∈ θ (x t , t);

[0145] Calculate the loss function L(θ) and update the model parameters θ using backpropagation and gradient descent algorithm;

[0146] Iterate through the entire data set to continuously optimize θ, and stop training when the maximum training epoch Epoch max is reached;

[0147] After training is completed, the model parameters are fixed as θ * , at this time, the reverse diffusion model is denoted as:

[0148]

[0149] The corresponding noise prediction function is:

[0150]

[0151] In prediction, given the initial noise distribution, the model will start from the noise and gradually denoise through the multi-step reverse diffusion restoration process, and finally generate the latent representation vector of future traffic flow. After proper mapping and inverse normalization, the traffic flow prediction value of the future time period can be obtained, i.e.

[0152]

[0153] wherein, Z is the sequence of predicted future traffic flow indicators for the model fus A is the adjacency matrix of the spatio-temporal dependency structure graph, and θ* is the final learned model parameters.

[0154] It should be noted that through the training process of forward noise addition and reverse diffusion restoration, the diffusion model learns the ability to reconstruct the spatio-temporal features of traffic flow from noise. After training, the model for prediction is obtained, and the predicted future traffic flow representation vector is output through the reverse diffusion generation process. This model takes the fusion features as input and can comprehensively utilize long-term periodic patterns and recent dynamic change features, thereby having high prediction accuracy and robustness.

[0155] S6, input the current traffic data into the trained prediction model to predict the traffic flow, and output the traffic flow prediction result of the future time period through the reverse diffusion process. It should be noted that in this step:

[0156] The current traffic data is obtained as input, and the current time is set as t0. The traffic indicators (flow, speed, occupancy) of all road segments at the current time are obtained from the traffic control system, denoted as:

[0157] X curr ∈R N×F

[0158] The current time data X curr is preprocessed in the same way as in step S1, and then the fusion feature processing of the aforementioned step S4 is performed to obtain the fusion feature which is the final fusion feature input into the prediction model, containing dynamic information of the current time and its short-term period before and after, and long-term periodic pattern information;

[0159] According to the diffusion step number T determined in the training phase, a random noise tensor x T is initialized.

[0160] The dimension of the random noise matches that of , i.e. (N, T fus , F * ), where T fus is set to include the length of the required prediction period in the future (such as the number of time slices required for the next 30 minutes or 1 hour);

[0161] Using the trained parameters θ * , at each diffusion step t, from t = T down to t = 1, the following is calculated: is the predicted noise, and then xt-1 ;

[0162] The update rule of the reverse diffusion model is represented as:

[0163]

[0164] After T-step iteration of denoising restoration, when t = 0, the following is obtained:

[0165]

[0166] wherein, is the latent representation matched with the fused feature distribution in the reverse diffusion generation process, and the latent representation contains prediction information of the future time period traffic flow;

[0167] Further, is the feature representation restored by the diffusion model, including the feature distribution of the future time slice, and the mapping defined by the model setting and training steps can map to the specific traffic flow prediction value sequence;

[0168] It should be further explained in this embodiment that since the input current time traffic data is subjected to the normalization processing as in the aforementioned step S1, it is necessary to perform inverse normalization on the prediction result, and map the normalized prediction value back to the actual magnitude, such as the prediction of the flow

[0169]

[0170] Finally, the predicted traffic flow of the future time period (for example, the future T pred time slices) is obtained:

[0171]

[0172] that is, the traffic flow prediction value of each road section in the future T pred time slices

[0173] Preferably, based on the trained diffusion model, the current time data is subjected to the same feature extraction and fusion process to obtain the latent feature representation of the future time period is generated through the reverse diffusion process starting from random noise, and finally mapped back to the actual magnitude of the traffic flow prediction sequence, which covers the flow of each road section in the future multiple time slices, thereby realizing accurate prediction of the future traffic state, and making the method of the present application have high prediction accuracy and robustness in complex space-time traffic environment.

[0174] In order to verify the beneficial effects and advantages of the method in traffic flow prediction, the method is compared with the traditional traffic flow prediction method, wherein the traditional method selects a time series statistical model (such as a seasonal autoregressive moving average model SARIMA) as a control object, the SARIMA method has certain advantages in dealing with periodic characteristics, but has disadvantages in dealing with complex road network space-time correlation, multi-scale dynamic change and data noise, the prediction performance of the two methods is compared under the same experimental conditions, so as to verify that the method can capture multi-scale space-time characteristics and improve robustness;

[0175] In the experiment, a central area road network of a second-tier city is selected as the experimental object, the area contains several key road sections, the geographical position and road grade of each road section are relatively fixed, but are significantly affected by seasonal changes, holidays, workday peak and low peak switching in actual operation;

[0176] The experimental environment includes a data acquisition and processing terminal (a high-performance computing server equipped with MATLAB and Python running environments), the time span is selected as 30 consecutive days of historical traffic data, wherein the flow data (N road sections in 30 days of flow time series (a total of 30 days x 24 hours x (60 / 5) = 8640 time slices)) (unit: vehicle / 5 minutes), speed data (unit: km / h), road occupancy rate data (unit: %) are recorded every 5 minutes, the training data is selected from the first 20 days, the verification and test data is selected from the last 10 days, and the prediction accuracy of future 1 hour (12 time slices) traffic flow is mainly investigated in the prediction task, and the method is trained through the steps described above; the traditional method (represented by SARIMA) is fitted according to the same data sequence parameters;

[0177] The implementation process of the method: extracting periodic features (such as long-term data patterns with a week as a period) and recent target features (such as the past 7 days of data as target features) on the space-time dependence structure diagram; the dynamic time warping (DTW) method is used to measure the time dimension similarity of the periodic features and the target features, and the periodic features are selectively migrated and weighted fused according to the similarity, to obtain the fused features; the fused features are input into the prediction model based on the diffusion model for training, and the multi-scale and multi-stage space-time feature distribution is captured through forward noise addition and reverse diffusion reduction, after training, for any selected time point in the test set, the current time features are input and the reverse diffusion process is performed, to predict the flow sequence in the future 1 hour;

[0178] The implementation process of the traditional method (taking SARIMA as an example): modeling the historical traffic sequence of each road segment separately, taking the data of the past several days as a training set, and performing grid search and order determination on the SARIMA model parameters; the model only predicts on the basis of single-road-segment single-dimensional traffic data, and extrapolates the traffic sequence of the future 1 hour;

[0179] Referring to Figure 2 As can be seen intuitively, in the high-flow scenario, the prediction curve (solid line) of the method of the application closely fits the real traffic curve, the error is small in the entire prediction period, the error rate is controlled at 3%-5%, the prediction curve of the traditional method (dashed line) obviously lags behind in the period of rapid flow increase, and the deviation is large at the high-flow peak, the error rate reaches 8%-12%, which shows that the traditional SARIMA method is difficult to adjust the prediction result in time when facing the nonlinear rapid change of the traffic trend, while the method of the application realizes higher flexibility and accuracy by virtue of the multi-scale space-time feature extraction and diffusion process;

[0180] In the medium-flow scenario, the method of the application always maintains small deviation from the real value, the error rate is controlled at 2%-4%, compared with this, the traditional method produces additional error due to the inability to effectively fuse the spatial correlation and multi-dimensional features, thus, the method of the application uses the similarity measurement and weighted fusion strategy of the periodic feature and the target feature, so that the model can quickly adapt to various complex road networks and multi-period features, and improve the stability and precision of prediction;

[0181] Preferably, the method of the application can provide more accurate and robust prediction performance in different scenarios of medium and high flow, compared with the traditional method which only relies on single time series statistical analysis, the method of the application embeds multi-dimensional features into a space-time dependent structure diagram, fuses periodic and recent features through dynamic time warping, and uses a diffusion model to capture multi-scale feature distribution, thereby significantly reducing the error rate and improving the adaptability to complex dynamic traffic environment.

[0182] The foregoing average value filling and outlier detection processing, normalization processing of the missing traffic indicator values (such as missing flow data) in the historical traffic data can be performed by using the methods and means in the prior art, which will not be described herein.

[0183] It should be further pointed out that the other aspects disclosed in the embodiments of the application also propose a traffic flow prediction system based on a diffusion model, comprising one or more processors and a memory.

[0184] The memory is used to store instructions that can be operated, which, when executed by the one or more processors, cause the one or more processors to perform operations, which include the flow of the traffic flow prediction method based on the diffusion model of the foregoing embodiments, especiallyFigure 1 the flow of the method shown.

[0185] The embodiments of the present application disclosed also propose a computer readable medium storing software, the software comprising instructions executable by one or more computers, the instructions causing the one or more computers to perform operations by such execution, the operations comprising the flow of the traffic flow prediction method based on diffusion model of the aforementioned embodiments, in particular Figure 1 the flow of the method shown.

[0186] It should be appreciated that embodiments of the present application can be realized or implemented by computer hardware, a combination of hardware and software, or through computer instructions stored in a non-transitory computer readable memory.

[0187] The method can be implemented in a computer program configured with a non-transitory computer readable storage medium, using standard programming techniques, including the use of a database to store data structures in computer-readable storage mediums configured with the computer program, wherein the storage medium so configured makes the computer operate in a specific and predefined manner.

[0188] Each program can be implemented in a high level procedural or object oriented programming language to communicate with a computer system, however, the programs can be implemented in assembly or machine language, if desired.

[0189] In any case, the language can be a compiled or interpreted language.

[0190] Also, the program can run on a specially programmed, dedicated integrated circuit.

[0191] The processes described herein (or variations and / or combinations thereof) can be performed under the control of one or more computer systems configured with executable instructions (e.g., computer programs, one or more computer programs, or one or more applications) to perform the processes, by hardware (e.g., circuitry, dedicated logic, etc.), or combinations thereof. The computer programs include machine executable instructions that, when executed by the one or more processors, enable the one or more processors to perform the processes.

[0192] Further, the methods can be implemented in any type of computing platform operably connected to a suitable, including but not limited to a personal computer, mini-computer, mainframe, workstation, network or distributed computing environment, separate or integrated computer platform, or in communication with a charged particle tool or other imaging device.

[0193] Aspects of the application can be implemented in machine readable code stored on a non-transitory storage medium or device, whether removable or integrated to a computing platform, such as a hard disk, optical read and / or write storage medium, RAM, ROM, etc., such that it can be read by a programmable computer to configure and operate the computer to perform the processes described herein when the storage medium or device is read by the computer.

[0194] Furthermore, the machine readable code, or portions thereof, can be transmitted over a wired or wireless network.

[0195] The application described herein includes these and other different types of non-transitory computer readable storage media when such media include instructions or programs to implement the steps described above in conjunction with a microprocessor or other data processor.

[0196] It should be noted that the above-mentioned embodiments are only used to illustrate the technical solutions of the present application, not to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or replaced by equivalent without departing from the spirit and scope of the present application, which should be covered by the claims of the present application.

Claims

1. A traffic flow prediction method based on a diffusion model, characterized in that, The method comprises: acquiring historical traffic data and performing data preprocessing to form a sample data set containing traffic flow, traffic speed and road occupancy; regarding road segments of a road network in the sample data set as nodes, and constructing edges according to geographical adjacency and historical traffic correlation between the road segments to form a spatiotemporal dependence structure graph describing spatiotemporal dependence; comprising: regarding road segments as nodes, and taking N road segments as N nodes in a node set V; establishing edges between nodes according to geographical adjacency and historical traffic correlation to form an adjacency matrix A; forming a graph structure G describing spatiotemporal dependence based on the node set V and the adjacency matrix A; performing periodic feature extraction and target feature extraction on the historical traffic data in the spatiotemporal dependence structure graph; the extraction of the periodic feature and the target feature comprises: Select a long time span of historical data as period data, define the length of the period data as T cyc time slices, obtain period characteristics Z cyc through feature extraction processing Select data in a recent time period as target data, define the length of the target data as T tar time slices, obtain target features Z via feature extraction processing tar ; measuring the similarity of the periodic feature and the target feature in the time dimension by using a dynamic time warping method, and performing selective migration and weighted fusion on the periodic feature based on the similarity to obtain a fused feature; comprising: ; ; Wherein, Z fus is a fusion feature, Z cyc is a periodic feature, Z tar is a target feature, T fus is the number of time slices after the fusion and the length of the time dimension is unified, N is the number of road segments, is a feature dimension, and α is a similarity degree. inputting the fused feature into a traffic flow prediction model constructed based on a diffusion model for training, capturing multi-scale and multi-stage spatiotemporal feature distribution through a forward noise adding and reverse diffusion restoration process, and outputting a representation vector of predicted future traffic flow; inputting traffic data at a current time into the trained prediction model for traffic flow prediction, and outputting a traffic flow prediction result of a future time period through a reverse diffusion process; comprising: ; where T pred is the future T pred time slice, N is the number of road segments, is the traffic flow prediction value of the road segment in the future T pred time slice, t0 is the current time. 2.The traffic flow prediction method based on diffusion model according to claim 1, characterized in that, deriving historical traffic data in a specified time period from a traffic control system, performing missing value processing, outlier detection and normalization processing on the historical traffic data to obtain the sample data set. 3.The traffic flow prediction method based on diffusion model according to claim 1 or 2, characterized in that, The sample data set is represented as a three-dimensional tensor, and its mathematical expression formula is: ; Wherein, N is the number of road segment nodes, T s is the number of time slices, F is the number of feature dimensions, and X is the sample data set.

4. A traffic flow prediction system based on diffusion model, characterized in that, comprising: one or more processors; a memory storing instructions operable to cause the one or more processors to perform operations when executed by the one or more processors, the operations comprising the flow of the traffic flow prediction method based on the diffusion model according to claim 1.

5. A computer readable medium storing software, characterized in that: The software comprises instructions executable by one or more computers, which, through such execution, cause the one or more computers to perform operations, the operations comprising the flow of the traffic flow prediction method based on the diffusion model according to claim 1.

Citation Information

Patent Citations

  • Signal transmission system for measuring traffic state by using road network sensor

    CN117037479A

  • Data processing method and device

    CN117217284A

  • Adaptive-based traffic flow prediction method, system and device, and storage medium

    CN118522155A