Traffic data filling method and device based on space-time self-attention and diffusion model

By introducing space-time self-attention and diffusion models into traffic data filling, using conditional diffusion models and space-time self-attention mechanisms, the problem of missing value filling in traffic data is solved, and the quality and analysis ability of data are improved.

CN119474677APending Publication Date: 2025-02-18BEIJING WUZI UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411552577.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The prior art is difficult to effectively and accurately fill in missing values ​​in traffic data, resulting in reduced interpretability of the data and affect subsequent advanced analytical tasks.

Method used

The traffic data filling method based on the spatiotemporal self-attention and diffusion model is adopted, and the conditional diffusion model and the spatiotemporal self-attention mechanism are used to gradually denoise and generate missing data.

Benefits of technology

It improves the quality of missing data filling, can capture the spatio-temporal and spatial context characteristics of traffic data more accurately, and enhances the interpretability and analysis capabilities of the data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474677A_ABST
    Figure CN119474677A_ABST
Patent Text Reader

Abstract

According to the traffic data filling method and device based on the space-time self-attention and diffusion model, a JSTSACD model combines a conditional diffusion model and a module for modeling traffic data space-time characteristics for a traffic data filling task, and the JSTSACD model inputs observable traffic data as conditional information into a denoising function in a reverse process of the conditional diffusion model; the model is guided to gradually denoise to generate reasonable data for a missing position, and meanwhile, the model introduces bidirectional diffusion diagram convolution and a self-attention mechanism to construct a space-time diagram self-attention module as a core module of a denoising function, so that the model has the capability of modeling traffic data space-time context features, and the missing data filling quality is further improved. Meanwhile, a real value corresponding to missing data in the real world cannot be obtained, so that the filling loss of the artificial missing data is used for learning model parameters in a denoising function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of artificial intelligence technology and traffic spatiotemporal data mining, and in particular to a traffic data filling method based on spatiotemporal self-attention and diffusion model, and a traffic data filling device based on spatiotemporal self-attention and diffusion model. Background Art

[0002] The emergence of multimedia services and Internet-friendly portable devices has led to an increasing number of traffic flow detection methods, such as inductive loop detectors, microwave sensors, video detectors, and detection vehicles with GPS. Static detectors such as underground inductive loop coils and cameras have been widely deployed in many cities to collect and provide traffic information. On the other hand, traffic information collection by detection vehicles is more efficient due to the mobility of vehicles and the popularity of on-board GPS. This mobile approach avoids the need to deploy expensive static sensors on every city road. Therefore, real-time collection and analysis of various traffic information (e.g., speed, traffic flow, and occupancy rate) is achieved through intelligent transportation systems. In particular, accurate and complete traffic data is the basic information support in intelligent transportation systems, which helps intelligent transportation systems complete various analysis tasks. For example, basic data information can be used to monitor the current traffic status or predict the future status. Real-time or future status information can help drivers choose the best travel route to reduce travel time; traffic monitoring centers can use this data information to control the operation of the road network, provide information guidance to drivers or passengers, and avoid traffic congestion. However, all the information collected by all these infrastructures has a certain degree of data loss. Typically, data from static detectors is often lost due to hardware failure, weather interference, transmission failure, etc. In addition, detection vehicles are also affected by the lack of data records due to the reduction in the number of vehicles, uneven distribution, and limited lane restrictions. The problem of missing data weakens the interpretability of the data and brings certain challenges to subsequent advanced analysis tasks. This requires thinking in advance about how to deal with the missing parts before solving advanced traffic application problems. Therefore, how to effectively and accurately collect and estimate urban traffic information data has become an important issue in travel planning and management.

[0003] Traditional methods, such as historical interpolation, nearest neighbor interpolation, and regression interpolation, are mostly limited by the insufficient use of the temporal and spatial feature relationships of traffic data, and thus the filling effect is general. Compared with traditional methods, deep learning methods are an effective method. In recent years, the development of deep learning theory has also provided effective theoretical support for the analysis of complex spatiotemporal traffic data in urban road networks. In the field of transportation, deep learning methods are mostly used to study the short-term prediction problem of (relatively) complete traffic data. If the deep learning model for the short-term prediction task of traffic data is directly used for the task of filling missing traffic data, it is difficult to achieve the expected effect. The main reason is that when predicting short-term traffic data, it is only necessary to pay attention to the spatiotemporal relationship between the spatiotemporal information of historical moments and the data at the current moment; while the traffic missing data filling model needs to make full use of the association relationship of the spatiotemporal context to fill the missing values. In addition, the traffic data filling problem can be regarded as a data generation problem. Recently, a class of deep generative models, namely the conditional diffusion model, has gradually converted noise into reasonable data samples by introducing conditional information to guide denoising, and has achieved the most advanced sample quality in many tasks (such as image generation and audio synthesis tasks). The conditional diffusion model can also be used to impute missing values, which can directly learn the conditional distribution using the conditional diffusion model. Summary of the invention

[0004] In order to overcome the defects of the prior art, the technical problem to be solved by the present invention is to provide a traffic data filling method based on spatiotemporal self-attention and diffusion model, which can improve the quality of missing data filling.

[0005] The technical solution of the present invention is: the traffic data filling method based on spatiotemporal self-attention and diffusion model comprises the following steps:

[0006] (1) Define the traffic data filling problem: x∈R T×N Represents a spatiotemporal traffic data sample with missing values, where N is the number of spatial nodes and T is the length of the time series, using a mask matrix m∈R T×N Indicates missing information in the data. If x t,n If missing, then m t,n =0, if x t,n is observable data, then m t,n =1; Given a traffic data sample x0 containing missing values, the traffic data filling method based on the conditional diffusion model uses the conditional observations Generate fill target The goal of the traffic data filling method based on the conditional diffusion model is to use the model distribution Estimating the true conditional data distribution

[0007] (2) Introducing the conditional diffusion model: Under unconditional conditions, the reverse process pθ (x 0:T ) is used to define the final data model p θ (x0), the conditional reverse process is extended from the unconditional reverse process as follows:

[0008]

[0009] Conditional diffusion model Consider the following with ∈ θ Parameterization:

[0010]

[0011] (3) Architecture of denoising function: The basic architecture of the denoising function is composed of multiple stacked residual layers. The residual layer in JSTSACD is constructed by temporal modules and spatial modules. A multi-head self-attention layer is used to construct the temporal module to capture the temporal context information in traffic data. A bidirectional diffusion graph convolution layer and a multi-head self-attention layer are integrated to construct the spatial module.

[0012] (4) Training the conditional diffusion model: Before training the model, construct the input data set, randomly or non-randomly select a random proportion of data from the samples of the original data set as artificially missing data, and update the denoising function through the filling error of this part of data. This strategy replaces this part of artificially missing data with 0. After this processing, the original data forms an observable data matrix as conditional information. m co The conditional information matrix The corresponding mask matrix; As the populated target matrix of the model:

[0013]

[0014] Based on the filled target matrix, the sampling of the noise target input to the model is defined as:

[0015]

[0016] in And finally update the denoising function ∈ by solving the following loss function θ :

[0017]

[0018] in After training is completed, the function ∈ θ ;

[0019] (5) Execute sampling of the conditional diffusion model: conditional information matrix The mask matrix m of the conditional observation data corresponding to the sample data x co Corresponding to the mask matrix m of the sample data, when sampling, the traffic data filling model JSTSACD first samples a noise from the standard Gaussian distribution Using the sampling in formula (6) and formula (7) By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target

[0020] The JSTSACD model of the present invention combines the conditional diffusion model with a module for modeling the spatiotemporal characteristics of traffic data for traffic data filling tasks. The JSTSACD model inputs observable traffic data as conditional information into the denoising function of the inverse process of the conditional diffusion model, guiding the model to gradually denoise and generate reasonable data for the missing positions. At the same time, the model introduces bidirectional diffusion graph convolution and self-attention mechanism to construct a spatiotemporal graph self-attention module as the core module of the denoising function, so that the model has the ability to model the spatiotemporal context characteristics of traffic data, further improving the quality of missing data filling. At the same time, considering that the true value corresponding to the missing data in the real world is unavailable, the filling loss of artificial missing data is used to learn the model parameters in the denoising function.

[0021] A traffic data filling device based on spatiotemporal self-attention and diffusion model is also provided, which includes: a definition module, which defines the traffic data filling problem: x∈R T×N Represents a spatiotemporal traffic data sample with missing values, where N is the number of spatial nodes and T is the length of the time series, using a mask matrix m∈R T×N Indicates missing information in the data. If x t,n If missing, then m t,n =0, if x t,n is observable data, then m t,n =1; Given a traffic data sample x0 containing missing values, the traffic data filling method based on the conditional diffusion model uses the conditional observations Generate fill target The goal of the traffic data filling method based on the conditional diffusion model is to use the model distribution Estimating the true conditional data distribution

[0022] The module is introduced, which introduces the conditional diffusion model: in the unconditional case, the reverse process p θ (x 0:T ) is used to define the final data model p θ (x0), the conditional reverse process is extended from the unconditional reverse process as follows:

[0023]

[0024] Conditional diffusion model Consider the following with ∈ θ Parameterization:

[0025]

[0026] Denoising function module, which constructs the architecture of the denoising function: the basic architecture of the denoising function is composed of multiple residual layers stacked together. The residual layer in JSTSACD is constructed by temporal modules and spatial modules. The multi-head self-attention layer is used to construct the temporal module to capture the temporal context information in the traffic data. The bidirectional diffusion graph convolution layer and the multi-head self-attention layer are integrated to construct the spatial module.

[0027] The training module trains the conditional diffusion model: before training the model, the input data set is constructed, and a random proportion of data is randomly or non-randomly selected from the samples of the original data set as artificially missing data. The denoising function is updated through the filling error of this part of data. This strategy replaces this part of artificially missing data with 0. After such a processing process, the original data forms an observable data matrix as conditional information. m co The conditional information matrix The corresponding mask matrix; As the populated target matrix of the model:

[0028]

[0029] Based on the filled target matrix, the sampling of the noise target input to the model is defined as:

[0030]

[0031] in And finally update the denoising function ∈ by solving the following loss function θ :

[0032]

[0033] in After training is completed, the function ∈ θ ;

[0034] Sampling module, which performs sampling of the conditional diffusion model: conditional information matrix The mask matrix m of the conditional observation data corresponding to the sample data x co Corresponding to the mask matrix m of the sample data, when sampling, the traffic data filling model JSTSACD first samples a noise from the standard Gaussian distribution Using the sampling in formula (6) and formula (7) By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a flow chart of the traffic data filling method based on spatiotemporal self-attention and diffusion model according to the present invention.

[0036] Figure 2 A training framework according to the present invention is shown.

[0037] Figure 3 A test framework according to the invention is shown.

[0038] Figure 4 The network structure design of the denoising function according to the present invention is shown. DETAILED DESCRIPTION

[0039] like Figure 1 As shown in FIG. 1 , this traffic data filling method based on spatiotemporal self-attention and diffusion model includes the following steps:

[0040] (1) Define the traffic data filling problem: x∈R T×N Represents a spatiotemporal traffic data sample with missing values, where N is the number of spatial nodes and T is the length of the time series, using a mask matrix m∈R T×N Indicates missing information in the data. If x t,n If missing, then m t,n =0, if x t,n is observable data, then m t,n =1; Given a traffic data sample x0 containing missing values, the traffic data filling method based on the conditional diffusion model uses the conditional observations Generate fill target The goal of the traffic data filling method based on the conditional diffusion model is to use the model distribution Estimating the true conditional data distribution

[0041] (2) Introducing the conditional diffusion model: Under unconditional conditions, the reverse process p θ (x 0:T ) is used to define the final data model p θ (x0), the conditional reverse process is extended from the unconditional reverse process as follows:

[0042]

[0043] Conditional diffusion model Consider the following with ∈ θ Parameterization:

[0044]

[0045] (3) Constructing the architecture of the denoising function: The basic architecture of the denoising function is composed of multiple residual layers stacked together. The residual layer in JSTSACD is constructed by temporal modules and spatial modules. A multi-head self-attention layer is used to construct the temporal module to capture the temporal context information in traffic data. The bidirectional diffusion graph convolution layer and the multi-head self-attention layer are integrated to construct the spatial module.

[0046] (4) Training the conditional diffusion model: Before training the model, construct the input data set, randomly or non-randomly select a random proportion of data from the samples of the original data set as artificially missing data, and update the denoising function through the filling error of this part of data. This strategy replaces this part of artificially missing data with 0. After this processing, the original data forms an observable data matrix as conditional information. m co The conditional information matrix The corresponding mask matrix; As the populated target matrix of the model:

[0047]

[0048] Based on the filled target matrix, the sampling of the noise target input to the model is defined as:

[0049]

[0050] in And finally update the denoising function ∈ by solving the following loss function θ :

[0051]

[0052] in After training is completed, the function ∈ θ ;

[0053] (5) Execute sampling of the conditional diffusion model: conditional information matrix The mask matrix m of the conditional observation data corresponding to the sample data x co Corresponding to the mask matrix m of the sample data, when sampling, the traffic data filling model JSTSACD first samples a noise from the standard Gaussian distribution Using the sampling in formula (6) and formula (7) By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target

[0054] The JSTSACD model of the present invention combines the conditional diffusion model with a module for modeling the spatiotemporal characteristics of traffic data for traffic data filling tasks. The JSTSACD model inputs observable traffic data as conditional information into the denoising function of the inverse process of the conditional diffusion model, guiding the model to gradually denoise and generate reasonable data for the missing positions. At the same time, the model introduces bidirectional diffusion graph convolution and self-attention mechanism to construct a spatiotemporal graph self-attention module as the core module of the denoising function, so that the model has the ability to model the spatiotemporal context characteristics of traffic data, further improving the quality of missing data filling. At the same time, considering that the true value corresponding to the missing data in the real world is unavailable, the traffic data filling method uses the filling loss of artificially missing data to learn the model parameters in the denoising function, that is, a part of the data is randomly or non-randomly missing according to the random missing rate on the basis of the original sample data.

[0055] Preferably, in step (2), the diffusion probability model is a latent variable model consisting of two processes: a forward process and a reverse process; the forward process is to gradually add Gaussian noise to the data until the data becomes random noise, which is defined by a Markov chain:

[0056]

[0057] where β t is a small positive number, indicating the noise level, x t The sampling of can be written in closed form as follows:

[0058]

[0059] in and x t Expressed as

[0060] in

[0061] The reverse process starts from a random noise x t Start to gradually denoise until the original data x0 is restored, which is defined by the following Markov chain:

[0062]

[0063] The denoising diffusion probability model DDPM considers p θ (x t-1 ∣x t ) specific parameterization:

[0064]

[0065] in, ∈ θis a denoising function that can be trained, using μ DDPM (x t ,t,∈ θ (x t ,t)) represents μ θ (x t ,t), using σ DDPM (x t ,t) to represent σ θ (x t ,t), under this parameterization, the denoising function in the inverse process is trained by solving the following optimization problem:

[0066]

[0067] in In the unconditional case, once training is complete, the model samples x0 from equation (3).

[0068] like Figure 4 As shown, preferably, in step (3), the condition information matrix and As the input of the conditional diffusion model, the embedding time step t is part of the input in the conditional diffusion model. The traffic data filling model JSTSACD uses a 128-dimensional encoding vector to represent each diffusion time step t:

[0069] t embedding (t)

[0070] =(sim(10 0×4 / 63 t),…,sin(10 63×4 / 63 t),cos(10 0×4 / 63 t),…,cos(10 63×4 / 63 t)) (13)

[0072] In order to enable the model to distinguish which is the conditional information, JSTSACD transforms the conditional mask matrix m co

[0073] As auxiliary information, it is input into the denoising function.

[0074] Preferably, in step (3), the bidirectional diffusion graph convolution aggregates neighbor node information based on a predefined adjacency matrix, and the adjacency matrix is ​​constructed using the topological structure of the road network. The bidirectional diffusion graph convolution only aggregates explicit neighbor nodes in the road network structure; a multi-head self-attention layer is introduced into the model to capture implicit dependencies in the spatial dimension.

[0075] like Figure 2 As shown, preferably, in step (4), the conditional information matrix The corresponding mask matrix is ​​m co It is defined as follows:

[0076]

[0077] During training, the filled target matrix input to the model is given by To represent, it is defined as

[0078]

[0079] Based on the filled target matrix, the noise target is sampled by the following expression:

[0080]

[0081] in The original missing values ​​in the data have no corresponding missing values.

[0082] Based on the artificial missing values, the denoising function ∈ is updated by solving the following loss function θ :

[0083]

[0084] in In the case of conditional information, once training is complete, the filling model uses equations (6) and (7) to sample By iterating from t = T to t = 1

[0085] Sampling process, JSTSACD generates filling target

[0086] A person skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes the steps of the above-mentioned embodiment method, and the storage medium can be: ROM / RAM, disk, CD, memory card, etc. Therefore, corresponding to the method of the present invention, the present invention also includes a traffic data filling device based on spatiotemporal self-attention and diffusion model, which is usually represented in the form of functional modules corresponding to the steps of the method. The device includes:

[0087] Definition module, which defines the traffic data filling problem: x∈R T×N Represents a spatiotemporal traffic data sample with missing values, where N is the number of spatial nodes and T is the length of the time series, using a mask matrix m∈R T×N Indicates missing information in the data. If x t,n If missing, then m t,n=0, if x t,n is observable data, then m t,n =1; Given a traffic data sample x0 containing missing values, the traffic data filling method based on the conditional diffusion model uses the conditional observations Generate fill target The goal of the traffic data filling method based on the conditional diffusion model is to use the model distribution Estimating the true conditional data distribution

[0088] The module is introduced, which introduces the conditional diffusion model: in the unconditional case, the reverse process p θ (x 0:T ) is used to define the final data model p θ (x0), the conditional reverse process is extended from the unconditional reverse process as follows:

[0089]

[0090] Conditional diffusion model Consider the following with ∈ θ Parameterization:

[0091]

[0092] Denoising function module, which constructs the architecture of the denoising function: the basic architecture of the denoising function is composed of multiple residual layers stacked together. The residual layer in JSTSACD is constructed by temporal modules and spatial modules. The multi-head self-attention layer is used to construct the temporal module to capture the temporal context information in the traffic data. The bidirectional diffusion graph convolution layer and the multi-head self-attention layer are integrated to construct the spatial module.

[0093] The training module trains the conditional diffusion model: before training the model, the input data set is constructed, and a random proportion of data is randomly or non-randomly selected from the samples of the original data set as artificially missing data. The denoising function is updated through the filling error of this part of data. This strategy replaces this part of artificially missing data with 0. After such a processing process, the original data forms an observable data matrix as conditional information. m co The conditional information matrix The corresponding mask matrix; As the populated target matrix of the model:

[0094]

[0095] Based on the filled target matrix, the sampling of the noise target input to the model is defined as:

[0096]

[0097] in And finally update the denoising function ∈ by solving the following loss function θ :

[0098]

[0099] in After training is completed, the function ∈ θ ;

[0100] Sampling module, which performs sampling of the conditional diffusion model: conditional information matrix The mask matrix m of the conditional observation data corresponding to the sample data x co Corresponding to the mask matrix m of the sample data, when sampling, the traffic data filling model JSTSACD first samples a noise from the standard Gaussian distribution Using the sampling in formula (6) and formula (7) By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target

[0101] Preferably, in the building block, the diffusion probability model is a latent variable model consisting of two processes: a forward process and a reverse process; the forward process is to gradually add Gaussian noise to the data until the data becomes random noise, which is defined by a Markov chain:

[0102]

[0103] where β t is a small positive number, indicating the noise level, x t The sampling of can be written in closed form as follows:

[0104]

[0105] in and x t Expressed as in

[0106] The reverse process starts from a random noise x t Start to gradually denoise until the original data x0 is restored, which is defined by the following Markov chain:

[0107]

[0108] The denoising diffusion probability model DDPM considers p θ (x t-1 ∣x t ) specific parameterization:

[0109]

[0110] in, ∈ θ is a denoising function that can be trained, using μ DDPM (x t ,t,∈ θ (x t ,t)) represents μ θ (x t ,t), using σ DDPM (x t ,t) to represent σ θ (x t ,t), under this parameterization, the denoising function in the inverse process is trained by solving the following optimization problem:

[0111]

[0112] in In the unconditional case, once training is complete, the model samples x0 from equation (3).

[0113] Preferably, in the denoising function module, the conditional information matrix and As the input of the conditional diffusion model, the embedding time step t is part of the input in the conditional diffusion model. The traffic data filling model JSTSACD uses a 128-dimensional encoding vector to represent each diffusion time step t:

[0114] t embedding (t)

[0115] =(sim(10 0×4 / 63 t),…,sin(10 63×4 / 63 t),cos(10 0×4 / 63 t),…,cos(10 63×4 / 63 t)) (13)

[0117] In order to enable the model to distinguish which is the conditional information, JSTSACD transforms the conditional mask matrix m co As auxiliary information, it is input into the denoising function.

[0118] Preferably, in the denoising function module, the bidirectional diffusion graph convolution aggregates neighbor node information based on a predefined adjacency matrix. The adjacency matrix is ​​constructed using the topological structure of the road network, and the bidirectional diffusion graph convolution only aggregates explicit neighbor nodes in the road network structure; a multi-head self-attention layer is introduced into the model to capture implicit dependencies in the spatial dimension.

[0119] Preferably, in the training module, the conditional information matrix The corresponding mask matrix is ​​m co It is defined as follows:

[0120]

[0121] During training, the filled target matrix input to the model is given by To represent, it is defined as

[0122]

[0123] Based on the filled target matrix, the noise target is sampled by the following expression:

[0124]

[0125] in The original missing values ​​in the data have no corresponding missing values. Based on the artificial missing values, the denoising function ∈ is updated by solving the following loss function θ :

[0126]

[0127] in In the case of conditional information, once training is complete, the filling model uses formulas (6) and (7) to sample By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target

[0128] like Figure 3As shown, the present invention uses the public PEMS-BAY dataset to evaluate the performance of the JSTSACD model. The PEMS-BAY dataset contains 6 months of data from 325 traffic sensors in the San Francisco Bay Area. The sampling rate of the dataset is 5 minutes. The data samples used in the present invention correspond to 2 hours of traffic data with a time step of 24. The adjacency matrix of this dataset is constructed based on geographic distance through a threshold Gaussian kernel. The PEMS-BAY dataset is divided into three groups, using 70% of the data for training, and the remaining 10% and 20% as validation and test sets, respectively. The missing scenarios are divided into two different settings: (1) random missing, that is, the input sample data is obtained by random missing in the data sample. (2) non-random missing, that is, the input sample data is obtained by continuous missing data in the data sample, and the duration of data missing is uniformly sampled in the interval [2,24]. In order to comprehensively evaluate the filling performance of the JSTSACD model on the traffic dataset PEMS-BAY, different missing rates are set for the test set, and the values ​​are [10%, 20%, 30%, 40%, 50%, 60%]. In order to make the trained filling model adapt to different missing rates, when generating the training set and the validation set, a certain ratio (the value is [10%, 20%, 30%, 40%, 50%, 60%]) of observable values ​​is randomly discarded for each data sample, and the remaining observable values ​​are used as the conditional information of the JSTSACD model. On the traffic dataset, the present invention selects five most advanced deep learning-based data filling models as benchmarks for comparison.

[0129] As can be seen from Table 1, the MAE values ​​of all models on the PEMS-BAY dataset range from 10% to 60% of the missing rate. The bold values ​​represent the best performance.

[0130] Table 1

[0131]

[0132]

[0133] From Table 2, we can see that all models have RMSE values ​​from 10% to 60% on the PEMS-BAY dataset. The bold values ​​represent the best performance.

[0134] Table 2

[0135]

[0136] From Table 3, we can see that all models have the best MRE values ​​from 10% to 60% on the PEMS-BAY dataset. The bold values ​​represent the best performance.

[0137] Table 3

[0138]

[0139] From Table 4, we can see that all models have RMSE values ​​from 10% to 60% on the PEMS-BAY dataset. The bold values ​​represent the best performance.

[0140] Table 4

[0141]

[0142] From Table 5, we can see that all models have MRE values ​​ranging from 10% to 60% on the PEMS-BAY dataset. The bold values ​​represent the best performance.

[0143] Table 5

[0144]

[0145] Experimental results: The deterministic filling results generated by the JSTSACD and CSDI models are the median of 100 generated samples. The filling performance of the JSTSACD model and other baseline models are compared based on two missing scenarios of the PEMS-BAY dataset. On the PEMS-BAY dataset, the performance of the two data filling models based on the conditional diffusion model (i.e., CSDI and JSTSACD) is significantly better than that of other non-generated models, which is sufficient to prove the advantages of the generative model in the traffic data filling task. Among the generative models, the spatial module of the CSDI model is the self-attention layer, while the spatial module of the JSTSACD model is the traffic self-attention layer that combines the bidirectional diffusion graph convolution with the spatial self-attention layer. The filling performance of the JSTSACD model is better than that of the CSDI model, which shows that the traffic self-attention layer can fully extract spatial context dependency features. From the perspective of missing patterns, the performance of the JSTSACD model is consistent with that of other baseline models, that is, the performance on random missing patterns is worse than that on non-random missing patterns. However, the performance improvement of the generative model on non-random missing patterns is more obvious, which shows that the generative model has more advantages in filling missing data on non-random missing patterns. From the perspective of missing rate, the performance of JSTSACD on the PEMS-BAY dataset is consistent with that of other baseline models, that is, as the missing rate increases, the filling performance of the JSTSACD model gradually deteriorates.

[0146] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention are still within the protection scope of the technical solution of the present invention.

Claims

1. A traffic data filling method based on spatiotemporal self-attention and diffusion model, characterized by: The method comprises the following steps: (1) Define the traffic data filling problem: x∈R T×N Represents a spatiotemporal traffic data sample with missing values, where N is the number of spatial nodes and T is the length of the time series, using a mask matrix m∈R T×N Indicates missing information in the data. If x t,n If missing, then m t,n =0, if x t,n is observable data, then m t,n =1; Given a traffic data sample x0 containing missing values, the traffic data filling method based on the conditional diffusion model uses the conditional observations Generate fill target The goal of the traffic data filling method based on the conditional diffusion model is to use the model distribution Estimating the true conditional data distribution (2) Introducing the conditional diffusion model: Under unconditional conditions, the reverse process p θ (x 0:T ) is used to define the final data model p θ (x0), the conditional reverse process is extended from the unconditional reverse process as follows: Conditional diffusion model Consider the following with ∈ θ Parameterization: (3) Constructing the architecture of the denoising function: The basic architecture of the denoising function is composed of multiple residual layers stacked together. The residual layer in JSTSACD is constructed by temporal modules and spatial modules. A multi-head self-attention layer is used to construct the temporal module to capture the temporal context information in traffic data. The bidirectional diffusion graph convolution layer and the multi-head self-attention layer are integrated to construct the spatial module. (4) Training the conditional diffusion model: Before training the model, construct the input data set, randomly or non-randomly select a random proportion of data from the samples of the original data set as artificially missing data, and update the denoising function through the filling error of this part of data. This strategy replaces this part of artificially missing data with 0. After this processing, the original data forms an observable data matrix as conditional information. m co The conditional information matrix The corresponding mask matrix; As the populated target matrix of the model: Based on the filled target matrix, the sampling of the noise target input to the model is defined as: in And finally update the denoising function ∈ by solving the following loss function θ : in After training is completed, the function ∈ θ ; (5) Execute sampling of the conditional diffusion model: conditional information matrix The mask matrix m of the conditional observation data corresponding to the sample data x co Corresponding to the mask matrix m of the sample data, when sampling, the traffic data filling model JSTSACD first samples a noise from the standard Gaussian distribution Using the sampling in formula (6) and formula (7) By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target 2. The traffic data filling method based on spatiotemporal self-attention and diffusion model according to claim 1 is characterized by: In step (2), the diffusion probability model is a latent variable model consisting of two processes: a forward process and a reverse process; the forward process is to gradually add Gaussian noise to the data until the data becomes random noise, which is defined by a Markov chain: where β t is a small positive number, indicating the noise level, x t The sampling of can be written in closed form as follows: in and x t Expressed as in The reverse process starts from a random noise x t Start to gradually denoise until the original data x0 is restored, which is defined by the following Markov chain: The denoising diffusion probability model DDPM considers p θ (x t-1 ∣x t ) specific parameterization: in, ∈ θ is a denoising function that can be trained, using μ DDPM (x t ,t,∈ θ (x t ,t)) represents μ θ (x t ,t), using σ DDPM (x t ,t) to represent σ θ (x t ,t), under this parameterization, the denoising function in the inverse process is trained by solving the following optimization problem: in In the unconditional case, once training is complete, the model samples x0 from equation (3).

3. The traffic data filling method based on spatiotemporal self-attention and diffusion model according to claim 2 is characterized by: In step (3), the conditional information matrix and As the input of the conditional diffusion model, the embedding time step t is part of the input in the conditional diffusion model. The traffic data filling model JSTSACD uses a 128-dimensional encoding vector to represent each diffusion time step t: t embedding (t) =(sim(10 0×4 / 63 t),…,sin(10 63×4 / 63 t),cos(10 0×4 / 63 t),…,cos(10 63×4 / 63 t) (13) In order to enable the model to distinguish which is the conditional information, JSTSACD transforms the conditional mask matrix m co As auxiliary information, it is input into the denoising function.

4. The traffic data filling method based on spatiotemporal self-attention and diffusion model according to claim 3 is characterized by: In the step (3), the bidirectional diffusion graph convolution aggregates neighbor node information based on a predefined adjacency matrix. The adjacency matrix is ​​constructed using the topological structure of the road network. The bidirectional diffusion graph convolution only aggregates explicit neighbor nodes in the road network structure. A multi-head self-attention layer is introduced into the model to capture implicit dependencies in the spatial dimension.

5. The traffic data filling method based on spatiotemporal self-attention and diffusion model according to claim 4 is characterized in that: In step (4), the conditional information matrix The corresponding mask matrix is ​​m co It is defined as follows: During training, the filled target matrix input to the model is given by To represent, it is defined as Based on the filled target matrix, the noise target is sampled by the following expression: in The original missing values ​​in the data have no corresponding missing values. Based on the artificial missing values, the denoising function ∈ is updated by solving the following loss function θ : in In the case of conditional information, once training is complete, the filling model uses formulas (6) and (7) to sample By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target 6. Traffic data filling device based on spatiotemporal self-attention and diffusion model, characterized by: It includes: Definition module, which defines the traffic data filling problem: x∈R T×N Represents a spatiotemporal traffic data sample with missing values, where N is the number of spatial nodes and T is the length of the time series, using a mask matrix m∈R T×N Indicates missing information in the data. If x t,n If missing, then m t,n =0, if x t,n is observable data, then m t,n =1; Given a traffic data sample x0 containing missing values, the traffic data filling method based on the conditional diffusion model uses the conditional observations Generate fill target The goal of the traffic data filling method based on the conditional diffusion model is to use the model distribution Estimating the true conditional data distribution The module is introduced, which introduces the conditional diffusion model: in the unconditional case, the reverse process p θ (x 0:T ) is used to define the final data model p θ (x0), the conditional reverse process is extended from the unconditional reverse process as follows: Conditional diffusion model Consider the following with ∈ θ Parameterization: Denoising function module, which constructs the architecture of the denoising function: the basic architecture of the denoising function is composed of multiple residual layers stacked together. The residual layer in JSTSACD is constructed by temporal modules and spatial modules. The multi-head self-attention layer is used to construct the temporal module to capture the temporal context information in the traffic data. The bidirectional diffusion graph convolution layer and the multi-head self-attention layer are integrated to construct the spatial module. The training module trains the conditional diffusion model: before training the model, the input data set is constructed, and a random proportion of data is randomly or non-randomly selected from the samples of the original data set as artificially missing data. The denoising function is updated through the filling error of this part of data. This strategy replaces this part of artificially missing data with 0. After such a processing process, the original data forms an observable data matrix as conditional information. m co The conditional information matrix The corresponding mask matrix; As the populated target matrix of the model: Based on the filled target matrix, the sampling of the noise target input to the model is defined as: in And finally update the denoising function ∈ by solving the following loss function θ : in After training is completed, the function ∈ θ ; Sampling module, which performs sampling of the conditional diffusion model: conditional information matrix The mask matrix m of the conditional observation data corresponding to the sample data x co Corresponding to the mask matrix m of the sample data, when sampling, the traffic data filling model JSTSACD first samples a noise from the standard Gaussian distribution Using the sampling in formula (6) and formula (7) By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target 7. The traffic data filling device based on spatiotemporal self-attention and diffusion model according to claim 6 is characterized in that: In the introduction module, the diffusion probability model is a latent variable model consisting of two processes: a forward process and a reverse process; the forward process is to gradually add Gaussian noise to the data until the data becomes random noise, which is defined by a Markov chain: where β t is a small positive number, indicating the noise level, x t The sampling of can be written in closed form as follows: in and x t Expressed as in The reverse process starts from a random noise x t Start to gradually denoise until the original data x0 is restored, which is defined by the following Markov chain: The denoising diffusion probability model DDPM considers p θ (x t-1 ∣x t ) specific parameterization: in, ∈ θ is a denoising function that can be trained, using μ DDPM (x t ,t,∈ θ (x t ,t)) represents μ θ (x t ,t), using σ DDPM (x t ,t) to represent σ θ (x t ,t), under this parameterization, the denoising function in the inverse process is trained by solving the following optimization problem: in In the unconditional case, once training is complete, the model samples x0 from equation (3).

8. The traffic data filling device based on spatiotemporal self-attention and diffusion model according to claim 7 is characterized in that: In the denoising function module, the conditional information matrix and As the input of the conditional diffusion model, the embedding time step t is part of the input in the conditional diffusion model. The traffic data filling model JSTSACD uses a 128-dimensional encoding vector to represent each diffusion time step t: t embedding (t) =(sim(10 0×4 / 63 t),…,sin(10 63×4 / 63 t),cos(10 0×4 / 63 t),…,cos(10 63×4 / 63 t)) (13) In order to enable the model to distinguish which is the conditional information, JSTSACD transforms the conditional mask matrix m co As auxiliary information, it is input into the denoising function.

9. The traffic data filling device based on spatiotemporal self-attention and diffusion model according to claim 8 is characterized in that: In the denoising function module, the bidirectional diffusion graph convolution aggregates neighbor node information based on a predefined adjacency matrix. The adjacency matrix is ​​constructed using the topological structure of the road network. The bidirectional diffusion graph convolution only aggregates explicit neighbor nodes in the road network structure; a multi-head self-attention layer is introduced into the model to capture implicit dependencies in the spatial dimension.

10. The traffic data filling device based on spatiotemporal self-attention and diffusion model according to claim 9, characterized in that: In the training module, the conditional information matrix The corresponding mask matrix is ​​m co It is defined as follows: During training, the filled target matrix input to the model is given by To represent, it is defined as Based on the filled target matrix, the noise target is sampled by the following expression: in The original missing values ​​in the data have no corresponding missing values. Based on the artificial missing values, the denoising function ∈ is updated by solving the following loss function θ : in In the case of conditional information, once training is complete, the filling model uses formulas (6) and (7) to sample By iterating the sampling process from t = T to t = 1, JSTSACD generates the filling target

Citation Information

Cited By

  • Geographic meteorological multi-mode fusion air pollutant monitoring data complementing method and device

    CN121764906A

  • Geographical meteorological multi-modal fusion air pollutant monitoring data completion method and device

    CN121764906B