A traffic data interpolation method based on self-supervised learning algorithm
Through the self-supervised learning algorithm and the attenuation-aware adaptive spatiotemporal graph convolution module, the problem of insufficient utilization of missing pattern information in traffic data interpolation is solved, high-precision data reconstruction is achieved, and the application of spatiotemporal graph neural networks is expanded to serve the intelligent transportation system.
Patent Information
- Application Number
- CN202211142625.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-20
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-09-20
AI Technical Summary
Existing traffic data interpolation methods cannot effectively utilize the pattern information in missing data, resulting in low interpolation precision and accuracy. In addition, the true values of missing locations cannot be obtained in real scenarios, making supervised training difficult.
A self-supervised learning algorithm is used to artificially construct missing nodes and missing mask matrices, and an attenuation-aware adaptive spatiotemporal graph convolution module is designed to learn spatiotemporal correlations from missing data. Convolution operations are used to reconstruct data and interpolate traffic data.
It improves the precision and accuracy of traffic data interpolation, expands the application scenarios of spatiotemporal graph neural networks, and is suitable for data processing in intelligent transportation systems.
Smart Images

Figure CN115618180B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent transportation, and in particular relates to a traffic data interpolation method based on a self-supervised learning algorithm. Background Art
[0002] With the rapid development of the Internet of Things (IoT) and information technology, an increasing amount of traffic data is being collected and stored. For example, circular coil vehicle detectors installed on roads can capture data such as traffic flow, occupancy, and speed on the monitored road surface. This data can be used to build intelligent transportation systems and improve traffic conditions. However, traffic data collected in the real world is often incomplete. This can be caused by detector failures, storage device failures, or distortion in data transmission from detectors to storage devices. These data gaps can severely impact overall data quality and hinder the effective use of data by higher-level applications in intelligent transportation systems. Therefore, traffic data interpolation is necessary.
[0003] In the prior art, traffic data interpolation methods can be divided into traditional methods and methods based on deep learning. Among them, traditional methods include the mean method, the majority method, the historical value method, and traditional machine learning methods (including but not limited to missing forest, K nearest neighbor, tensor decomposition and EM algorithm). These methods cannot establish spatiotemporal correlation well, or even ignore spatiotemporal correlation, and their data interpolation effect is not ideal; traffic data interpolation methods based on deep learning have made certain progress. For example, the Chinese patent with application number 201910687642.6 combines convolutional neural networks and generative adversarial networks to interpolate traffic flow data. However, when implementing this patent, missing values are treated as valid values, which will lead to deviations in the hidden state of the model. In addition, this patent uses a generative adversarial network to generate interpolated data, which has problems of difficulty in training and generalization.
[0004] However, existing deep learning-based traffic data interpolation methods still have the following shortcomings: on the one hand, existing methods usually fill missing positions with 0 or historical statistical characteristic values and then input them into the model. This missing value preprocessing method is not flexible enough, introduces redundant and biased data, and ignores the rich missing information in the data, making it impossible to effectively utilize missing patterns; on the other hand, in real missing scenarios, the true values of the missing positions are often unavailable, making supervised training impossible, resulting in relatively low interpolation precision and accuracy. Summary of the Invention
[0005] In view of the above problems, an embodiment of the present invention proposes a traffic data interpolation method based on a self-supervised learning algorithm. First, the attenuation information of the missing position is obtained from the representation of the missing data and the missing pattern to realize the preprocessing of the missing data. Then, the attenuation-aware adaptive spatiotemporal graph convolution module is used to learn the spatiotemporal correlation from the preprocessed missing data and the missing pattern. Finally, the convolution operation is used as a linear transformation to realize the reconstruction of the traffic data. Finally, the reconstructed data is used to replace the missing values to complete the interpolation, which effectively improves the interpolation accuracy and improves the integrity and accuracy of the interpolated data.
[0006] In order to achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows:
[0007] A traffic data interpolation method based on a self-supervised learning algorithm comprises the following steps:
[0008] Step S1: obtaining original missing traffic data, and artificially constructing missing nodes with real label information by randomly deleting observable values according to a predetermined ratio, as artificially constructed missing nodes, to obtain pseudo missing traffic data;
[0009] Step S2: constructing a missing mask matrix that can indicate whether traffic data is missing based on the artificially constructed missing nodes and the original missing nodes, and constructing a missing interval matrix using the missing mask matrix;
[0010] Step S3: Set a sliding window, preset the window time length and sliding step size; use the sliding window to process the original missing traffic data, pseudo-missing traffic data, missing mask matrix, and missing interval matrix respectively; for the pseudo-missing traffic data, missing mask matrix, and missing interval matrix, each sliding window corresponds to the input of a sample, and the artificially constructed missing nodes under each sliding window correspond to the real label data in the original missing traffic data as the supervision information of the sample; then divide all the constructed samples into training set and validation set according to a predetermined ratio;
[0011] Step S4: constructing a data interpolation model, which includes: a sample preprocessing module, an interpolation coding module, and a linear transformation module; the sample preprocessing module is used to preliminarily fill in the pseudo-missing traffic data of each sample input based on the missing mask matrix and the missing interval matrix in an attenuation-aware manner to obtain a filled sample; the interpolation coding module includes an embedding layer, an attenuation-aware adaptive spatiotemporal graph convolution layer, and L-1 adaptive spatiotemporal graph convolution layers, and is used to learn the spatiotemporal pattern of traffic data from the filled sample and the missing interval matrix to obtain interpolated data; the linear transformation module is used to use the interpolated data to interpolate the original missing traffic data corresponding to the sample to obtain the expected traffic data;
[0012] Step S5, inputting the training set and the validation set into the data interpolation model for model training to obtain optimal model parameters, and saving the trained data interpolation model;
[0013] Step S6: collecting traffic data to be interpolated, dividing the data to be interpolated into a number of traffic data samples to be interpolated according to the length of the sliding window, and constructing a missing mask matrix and a missing interval matrix for each traffic data sample to be interpolated;
[0014] Step S7: input the traffic data samples to be interpolated and the corresponding missing mask matrix and missing interval matrix into the trained data interpolation model to obtain the expected traffic data after interpolation.
[0015] As a preferred embodiment of the present invention, the missing mask matrix The construction method is:
[0016]
[0017] In formula (1), represents the cth traffic data feature of the nth traffic detector at the tth time slice, Used to measure Is it missing? Elements in a matrix; T represents the time length of the observation data, N represents the number of traffic detectors in the spatial dimension, and C represents the number of traffic data features;
[0018] The missing interval matrix in is the missing interval matrix of the t-th time slice, t∈{1, 2, ..., T}, The construction method for any value in is:
[0019]
[0020] In formula (2), represents the time interval between the cth traffic data feature of the nth traffic detector at the tth time slice and its last non-missing record, s t represents the observation time of the t-th time slice,
[0021] As a preferred embodiment of the present invention, the traffic data characteristics include flow rate, occupancy rate, and vehicle speed.
[0022] As a preferred embodiment of the present invention, the pseudo-missing traffic data corresponding to a sliding window length in the sample input is a three-dimensional matrix in is the eigenvalue matrix of traffic data at the t-th time slice, t∈{1, 2, ..., T}, represents the set of real numbers, It is a graph signal matrix with missing values; the output of the sample contains the true values of the artificially constructed missing nodes.
[0023] As a preferred embodiment of the present invention, the sample preprocessing module preliminarily fills the pseudo-missing traffic data of each sample input based on the missing mask matrix and the missing interval matrix in an attenuation-aware manner. The calculation formula is:
[0024]
[0025]
[0026] In formulas (3) and (4), It is X t The weight matrix used when performing the initial filling, Yes The weights used when filling, is a learnable parameter, represents the last non-missing value of the cth traffic data feature of the nth spatial dimension traffic detector at the tth time slice, Represents the historical average value of the c-th traffic data feature.
[0027] As a preferred embodiment of the present invention, the interpolation coding module learns the spatiotemporal pattern of traffic data from the padded samples and the missing interval matrix to obtain interpolated data, specifically comprising the following steps:
[0028] Step S41: The attenuation-aware adaptive spatiotemporal graph convolution layer is composed of a plurality of attenuation-aware adaptive graph convolutional recurrent units that share parameters in the time dimension. The output of the attenuation-aware adaptive graph convolutional recurrent unit is attenuated in the time dimension using a missing interval matrix.
[0029] Step S42, calculating an adaptive adjacency matrix based on the embedding representation of the traffic detector in the embedding layer;
[0030] Step S43: Calculate the attenuated update gate, reset gate, and candidate state according to the adaptive adjacency matrix, and obtain the hidden state at the next moment; return to step S41 until the last unit obtains the output of the attenuation-aware adaptive spatiotemporal graph convolution layer;
[0031] In step S44, the output of the attenuation-aware adaptive spatiotemporal graph convolution layer is used as the input of the first layer of L-1 adaptive spatiotemporal graph convolution layers, and the adaptive adjacency matrix is calculated. Then, the update gate, reset gate, and candidate state are calculated according to the adaptive adjacency matrix, and the hidden state at the next moment is obtained as the input of the next layer. A total of L-1 layers of adaptive spatiotemporal graph convolution are stacked, and the input of the previous layer is used as the input of the next layer. Finally, the output of the last layer of adaptive spatiotemporal graph convolution layer is recorded as Take the last time slice As the input of the linear transformation module.
[0032] As a preferred embodiment of the present invention, the attenuation formula is as follows:
[0033]
[0034]
[0035] In formulas (5) and (6), It is H t-1 The attenuation intensity matrix, is a learnable parameter, F represents the output dimension, H t-1 is the output of the attenuation-aware adaptive graph convolutional recurrent unit at time t-1, and H0 is an all-zero matrix.
[0036] As a preferred embodiment of the present invention, the formula for calculating the adaptive adjacency matrix is as follows:
[0037] A=I N +softmax(ReLU(EE T )) (19)
[0038] In formula (7), is the parameter matrix of the embedding layer, which represents the embedding representation of each traffic detector, and d represents the embedding dimension of the traffic detector; I N is the N-th order identity matrix; is the adaptive adjacency matrix.
[0039] As a preferred embodiment of the present invention, the formula for calculating the attenuated update gate, reset gate, candidate state and hidden state is as follows:
[0040] Z t =σ(A[X t , H t-1 ]EW z +Eb z ) (20)
[0041] R t =σ(A[X t , H t-1 ]EWr +Eb r ) (twenty one)
[0042]
[0043]
[0044] In formulas (8)-(11), W z 、W r 、 is the weight pool, b z 、b r 、 is the bias pool; [·] represents the connection operation; Z t is the update gate, R t It is the reset gate. is a candidate state, H t It is a hidden state.
[0045] As a preferred embodiment of the present invention, the linear transformation module uses a convolution operation to implement the linear transformation:
[0046]
[0047] In formula (12), is the interpolation result of the model output, Φ is the convolution kernel, the convolution kernel shape is (1, F), the number of output channels is T×C, and reshape means that the output of the convolution has the same dimension as the input data after reshaping.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] The embodiment of the present invention provides a traffic data interpolation method based on a self-supervised learning algorithm. It adopts an adaptive missing data preprocessing method, which can use the attenuation information learned from the missing data and missing pattern representation as the missing position representation to reduce the introduction of redundant and biased data; an attenuation-aware adaptive spatiotemporal graph convolution module is designed, which can accurately learn the spatiotemporal correlation within the traffic data based on the original missing traffic data. At the same time, the adaptive graph structure learning method solves the problem that the graph structure between traffic nodes in real scenarios may not be obtained. The learned graph structure can more accurately reflect the correlation between traffic nodes and avoid the discrepancy between the real adjacency matrix and the actual correlation between traffic nodes; a self-supervised method is designed to artificially construct missing traffic nodes with real label information, which solves the problem that the real value of missing traffic data in real scenarios cannot be obtained, and improves the precision and accuracy of traffic data interpolation. This self-supervised learning framework also expands the scope of application of the spatiotemporal graph neural network. After processing the missing traffic data using the self-supervised learning framework provided by the embodiment of the present invention, the spatiotemporal graph neural network model originally suitable for spatiotemporal prediction can be applied to traffic data interpolation, expanding the application scenarios of this type of algorithm.
[0050] Of course, it is not necessary to achieve all of the advantages described above simultaneously in order to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0052] Figure 1 A flow chart of a traffic data interpolation method based on a self-supervised learning algorithm provided in an embodiment of the present invention;
[0053] Figure 2 Schematic diagram of data flow of a data interpolation model in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] Below, by reference to exemplary embodiments, and in conjunction with the accompanying drawings, technical problems, technical solutions and advantages of the present invention are explained in detail. The exemplary embodiments described below are only used to explain the present invention and are not to be construed as limiting the present invention. It will be appreciated by those skilled in the art that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as the general understanding of those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have a meaning consistent with the meaning in the context of the prior art, and unless defined here, will not be interpreted with an idealized or overly formal meaning.
[0055] See also Figure 1 and Figure 2 , an embodiment of the present invention provides a traffic data interpolation method based on a self-supervised learning algorithm, comprising the following steps:
[0056] Step S1, obtain the original missing traffic data, and artificially construct missing nodes with real label information by randomly deleting observable values according to a predetermined ratio, as artificially constructed missing nodes, to obtain pseudo missing traffic data.
[0057] In this step, the artificially constructed missing nodes correspond to randomly deleted observable values. Since they have real label information, they can be used for self-supervised training. A self-supervised task is constructed based on the artificially constructed missing nodes, and the self-supervised results are passed to the original missing data nodes through model parameters, thereby completing the data interpolation.
[0058] Step S2: constructing a missing mask matrix that can indicate whether traffic data is missing or not based on the artificially constructed missing nodes and the original missing nodes, and constructing a missing interval matrix using the missing mask matrix.
[0059] In this step, the missing mask matrix and missing interval matrix are both corresponding to the corresponding data length. If the data contains all values of the original missing data, the missing mask matrix and missing interval matrix for all data are obtained. If a data segment consisting of several data points is obtained using a sliding window, the missing mask matrix and missing interval matrix for the corresponding data segment are obtained.
[0060] The missing mask matrix The construction method is:
[0061]
[0062] In formula (1), represents the cth traffic data feature of the nth traffic detector at the tth time slice, Used to measure Is it missing? Elements in a matrix; T represents the observation time duration, N represents the number of spatial traffic detectors, and C represents the number of traffic data features. Traffic data features include flow rate, occupancy rate, and vehicle speed. When the corresponding data is a window of data, T represents the sliding window length.
[0063] The missing interval matrix in is the missing interval matrix of the t-th time slice, t∈{1, 2, ..., T}, The construction method for any value in is:
[0064]
[0065] In formula (2), represents the time interval between the cth traffic data feature of the nth traffic detector at the tth time slice and its last non-missing record, s t represents the observation time of the t-th time slice,
[0066] Step S3: Set a sliding window, preset the window time length and sliding step size; use the sliding window to process the original missing traffic data, pseudo-missing traffic data, missing mask matrix and missing interval matrix respectively; for the pseudo-missing traffic data, missing mask matrix and missing interval matrix, each sliding window corresponds to the input of a sample, and the artificially constructed missing nodes under each sliding window correspond to the real label data in the original missing traffic data as the supervision information of the sample; then divide all the constructed samples into training set and validation set according to the predetermined ratio.
[0067] In this step, the sample includes two parts: input and supervision information. The input of each sample includes pseudo-missing traffic data corresponding to a sliding window, missing mask matrix and missing interval matrix. The pseudo-missing traffic data corresponding to the length of a sliding window in the sample input is a three-dimensional matrix in is the eigenvalue matrix of traffic data at the tth time slice, represents the set of real numbers, It is a graph signal matrix with missing values; the output of the sample contains the true value of the artificially constructed missing nodes; by comparing the true value of the artificially constructed missing nodes in the output with the corresponding value after interpolation, the degree of optimization of the model is calculated to complete the self-supervision task of model training.
[0068] The missing mask matrix and the missing interval matrix correspond to pseudo missing traffic data within a corresponding window time length.
[0069] Step S4, constructing a data interpolation model, which includes: a sample preprocessing module, an interpolation coding module and a linear transformation module; the sample preprocessing module is used to preliminarily fill in the pseudo-missing traffic data of each sample input based on the missing mask matrix and the missing interval matrix in an attenuation-aware manner to obtain the filled sample; the interpolation coding module includes an embedding layer, an attenuation-aware adaptive spatiotemporal graph convolution layer and L-1 adaptive spatiotemporal graph convolution layers, which are used to learn the spatiotemporal pattern of traffic data from the filled sample and the missing interval matrix to obtain interpolated data; the linear transformation module is used to use the interpolated data to interpolate the original missing traffic data corresponding to the sample to obtain the expected traffic data.
[0070] In this step, the sample preprocessing module preliminarily fills the pseudo-missing traffic data of each sample input based on the missing mask matrix and the missing interval matrix in an attenuation-aware manner. The calculation formula is:
[0071]
[0072]
[0073] In formulas (3) and (4), γx t It is X t The weight matrix used when performing the initial filling, Yes The weights used when filling, is a learnable parameter, represents the last non-missing value of the cth traffic data feature of the nth spatial dimension traffic detector at the tth time slice, Represents the historical average value of the c-th traffic data feature.
[0074] The interpolation coding module learns the spatiotemporal pattern of traffic data from the filled samples and the missing interval matrix to obtain interpolated data, specifically including the following steps:
[0075] In step S41, the attenuation-aware adaptive spatiotemporal graph convolution layer is composed of a plurality of attenuation-aware adaptive graph convolutional recurrent units that share parameters in the time dimension. The output of the attenuation-aware adaptive graph convolutional recurrent unit is attenuated in the time dimension using a missing interval matrix. The attenuation formula is as follows:
[0076]
[0077]
[0078] In formulas (5) and (6), It is H t-1The attenuation intensity matrix, is a learnable parameter, F represents the output dimension, H t-1 is the output of the attenuation-aware adaptive graph convolutional recurrent unit at time t-1, and H0 is an all-zero matrix.
[0079] Step S42, calculate the adaptive adjacency matrix based on the embedding representation of the traffic detector in the embedding layer:
[0080] A=I N +softmax(ReLU(EE T )) (7)
[0081] In formula (7), is the parameter matrix of the embedding layer, which represents the embedding representation of each traffic detector, and d represents the embedding dimension of the traffic detector; I N is the N-th order identity matrix; is the adaptive adjacency matrix.
[0082] In step S43, the attenuated update gate, reset gate, and candidate state are calculated according to the adaptive adjacency matrix, and the hidden state at the next moment is obtained; and the process returns to step S41 until the last unit obtains the output of the attenuation-aware adaptive spatiotemporal graph convolution layer.
[0083] The formulas for calculating the attenuated update gate, reset gate, candidate state, and hidden state are as follows:
[0084] Z t =σ(A[X t , H t-1 ]EW z +Eb z ) (8)
[0085] R t =σ(A[X t , H t-1 ]EW r +Eb r ) (9)
[0086]
[0087]
[0088] In formulas (8)-(11), W z 、W r 、 is the weight pool, b z 、b r 、 is the bias pool; [·] represents the connection operation; Z t is the update gate, R t It is the reset gate. is a candidate state, H t is the hidden state; Z t 、R t 、 and H t Adaptive graph convolution is used in the calculation formula to replace the matrix multiplication in the traditional gated recurrent unit. The adaptive graph convolution can adaptively learn the correlation strength between nodes, thereby aggregating more effective information from neighboring nodes and obtaining richer node representations.
[0089] In this step, the padded samples and missing interval matrix are input into the attenuation-aware adaptive spatiotemporal graph convolution layer. Based on the traditional gated recurrent unit, the attenuation-aware adaptive graph convolutional layer is applied to the update gate, reset gate, candidate state and hidden state acquisition. At the same time, an attenuation mechanism is designed to learn the attenuation strength from the missing pattern and apply it to the output of the attenuation-aware adaptive graph convolutional recurrent unit.
[0090] In step S44, the output of the attenuation-aware adaptive spatiotemporal graph convolution layer is used as the input of the first layer of L-1 adaptive spatiotemporal graph convolution layers, and the adaptive adjacency matrix is calculated. Then, the update gate, reset gate, and candidate state are calculated according to the adaptive adjacency matrix, and the hidden state at the next moment is obtained as the input of the next layer. A total of L-1 layers of adaptive spatiotemporal graph convolution are stacked, and the input of the previous layer is used as the input of the next layer. Finally, the output of the last layer of adaptive spatiotemporal graph convolution layer is recorded as Take the last time slice As the input of the linear transformation module.
[0091] In this step, the calculation formula of the adaptive spatiotemporal graph convolution layer is basically the same as the calculation formula of the attenuation-aware adaptive spatiotemporal graph convolution layer, except that it does not include the attenuation mechanism implemented by the missing time interval matrix, that is, it only includes formulas (7)-(11).
[0092] The linear transformation module uses convolution operation to implement linear transformation:
[0093]
[0094] In formula (12), is the interpolation result of the model output, Φ is the convolution kernel, the convolution kernel shape is (1, F), the number of output channels is T×C, and reshape means that the output of the convolution has the same dimension as the input data after reshaping.
[0095] Step S5: input the training set and the validation set into the data interpolation model for model training to obtain optimal model parameters, and save the trained data interpolation model.
[0096] In this step, when training the model, the loss function used is the mean square error corresponding to the supervisory signal, and the optimization algorithm used is the Adam algorithm.
[0097] Step S6: collecting traffic data to be interpolated, dividing the data to be interpolated into a number of traffic data samples to be interpolated according to the length of the sliding window, and constructing a missing mask matrix and a missing interval matrix for each traffic data sample to be interpolated.
[0098] In this step, the traffic data samples to be interpolated, the corresponding missing mask matrix and the missing interval matrix constructed by the data to be interpolated together constitute data with the same structural form as the input in the missing traffic data samples.
[0099] Step S7: input the traffic data samples to be interpolated and the corresponding missing mask matrix and missing interval matrix into the trained data interpolation model to obtain the expected traffic data after interpolation.
[0100] The present invention is further described in detail below using a specific example. This example uses the PeMS04 dataset (traffic data collected by the Caltrans Performance Measurement System in the San Francisco Bay Area, California, USA) as an example. The dataset spans 58 days from January to February 2018, with 307 sensors and three observation parameters: total traffic flow, average speed, and average road occupancy. Each time slice is 5 minutes. 30% of the data is randomly selected and replaced with 0 to indicate missing data. The resulting missing data has the shape of (16704, 307, 3).
[0101] By randomly deleting 10% of the observable values, and knowing the true labels of the deleted observables, the true labels of this deleted data can be used as a supervisory signal to obtain pseudo-missing traffic data by removing the artificially missing nodes. Based on the artificially constructed missing nodes and the original missing nodes, a missing mask matrix is constructed to indicate whether the traffic data is missing. This missing mask matrix is then used to construct a missing margin matrix.
[0102] A sliding window with a length of T=12 and a sliding step of 1 is used. The sliding window is used to process the original missing traffic data, pseudo missing traffic data, missing mask matrix and missing interval matrix respectively to obtain missing data samples, and all samples are divided into training set and validation set in a ratio of 8:2. The sample includes two parts: input and supervision information, and the input of each sample includes pseudo missing traffic data corresponding to a sliding window. Missing mask matrix And the missing interval matrix δ three-dimensional data, the output is the expected traffic data after interpolation, and the supervision information is the original missing traffic data under the corresponding sliding window.
[0103] Among them, each sample Missing mask matrix The construction method is:
[0104]
[0105] In formula (1), represents the cth traffic data feature of the nth traffic detector at the tth time slice, Used to measure Is it missing?
[0106] Missing Interval Matrix in, is the missing interval matrix of the t-th time slice, t∈{1, 2, ..., 12}, constructed as follows:
[0107]
[0108] In formula (2), represents the time interval between the cth traffic data feature of the nth traffic detector at the tth time slice and its last non-missing record, s t represents the observation time of the tth time slice.
[0109] Build a data interpolation model, including a sample preprocessing module, an interpolation encoding module, and a linear transformation module.
[0110] In the sample preprocessing module, set d = 16, F = 64. Use the adaptive method to pre-fill the missing data in the pseudo-missing traffic data. The calculation formula is:
[0111]
[0112]
[0113] Among them, γx t It is X t The weight matrix used when performing the initial filling, Yes The weights used when filling, is a learnable parameter, represents the last observable value of the cth traffic data feature at the nth observation point in the tth time slice, Represents the historical average value of the c-th traffic data feature.
[0114] In the interpolation coding module, the attenuation coefficient is calculated using the missing interval matrix to attenuate the output of the attenuation-aware adaptive graph convolutional recurrent unit in the time dimension:
[0115]
[0116]
[0117] in It is H t-1 The attenuation intensity matrix, is a learnable parameter, H t-1 is the output of the adaptive graph convolutional cycle unit at time t-1, and H0 is all 0.
[0118] Then calculate the adaptive adjacency matrix:
[0119]
[0120] In formula (7), is the node embedding matrix, which is the shared parameter of all layers in the time dimension, I N is the identity matrix; Check Adaptive adjacency matrix.
[0121] Finally, the update gate, reset gate, and candidate state are calculated, and the hidden state at the next moment is obtained:
[0122] Z t =σ(A[X t , H t-1 ]EW z +Eb z ) (20)
[0123] R t =σ(A[X t , H t-1 ]EW r +Eb r ) (twenty one)
[0124]
[0125]
[0126] Where W z 、W r 、 is the weight pool, b z 、b r 、 is the bias pool; [·] represents the connection operation; Z t is the update gate, R t is the reset gate, H t is a candidate state, H t is the hidden state; Z t 、R t 、 and H tAdaptive graph convolution is used in the calculation formula to replace the matrix multiplication in the traditional gated recurrent unit. The adaptive graph convolution can adaptively learn the correlation strength between nodes, thereby aggregating more effective information from neighboring nodes and obtaining richer node representations.
[0127] Then the output of the attenuation-aware adaptive spatiotemporal graph convolution layer is used as the input of the adaptive spatiotemporal graph convolution layer, and finally the output of the last layer of adaptive spatiotemporal graph convolution layer is obtained. Take the last time slice As input to the output module.
[0128] Finally, the output module is used to complete the data interpolation, and the output module is implemented using two-dimensional convolution:
[0129]
[0130] In formula (12), y is the interpolation result of the model output, Φ is the convolution kernel, the convolution kernel shape is (1, 64), the number of output channels is 12×3, and reshape means that the output of the convolution has the same dimension as the input data after reshaping.
[0131] The model was trained using the training set, and the real label data corresponding to the artificially constructed missing nodes were used as supervision information. The Adam algorithm was used to calculate the loss function, which was the mean square error of the supervision signal. The learning rate was 0.003, and the number of training rounds was 100. The generalization performance was tested on the validation set in each training round, and the set of parameters with the best effect on the validation set was retained for data interpolation.
[0132] Finally, the data to be interpolated is collected. In the time dimension, the traffic data of each T = 12 time slice is used as a sample to be interpolated. The data set is divided into 1392 samples. The samples do not overlap in the time dimension. Each sample is input into the trained model to obtain a reconstructed sample. The reconstructed data is used to interpolate the missing positions, and the original data is used to represent the non-missing positions. In this way, the expected traffic data after interpolation is obtained.
[0133] The interpolated expected traffic data obtained through the above process takes into account spatiotemporal correlation. By learning attenuation information as a representation of missing locations, the introduction of redundant and biased data is reduced, ensuring the accuracy of the interpolation results and improving the integrity of traffic data. It can be directly applied to downstream tasks such as prediction and classification, which can improve the accuracy of downstream tasks, serve the construction of intelligent transportation systems, improve traffic conditions, and promote the development of transportation services.
[0134] The foregoing description is a preferred embodiment of the present invention. It should be noted that the present invention is not limited to the exemplary embodiments disclosed above. The essence of this description is merely to help those skilled in the relevant art comprehensively understand the specific details of the present invention. For those skilled in the art, various improvements and modifications, as well as readily conceivable changes or substitutions made within the technical scope of the present invention without departing from the principles of the present invention, should be included within the scope of protection of the present invention.
Claims
1. A traffic data interpolation method based on a self-supervised learning algorithm, characterized in that: The method comprises the following steps: Step S1: obtaining original missing traffic data, and artificially constructing missing nodes with real label information by randomly deleting observable values according to a predetermined ratio, as artificially constructed missing nodes, to obtain pseudo missing traffic data; Step S2: constructing a missing mask matrix that can indicate whether traffic data is missing based on the artificially constructed missing nodes and the original missing nodes, and constructing a missing interval matrix using the missing mask matrix; Step S3: Setting a sliding window, presetting the window time length and sliding step size; using the sliding window to process the original missing traffic data, the pseudo missing traffic data, the missing mask matrix, and the missing interval matrix respectively; For pseudo-missing traffic data, missing mask matrix, and missing interval matrix, each sliding window corresponds to the input of a sample, and the artificially constructed missing nodes under each sliding window correspond to the true label data in the original missing traffic data as the supervision information of the sample; Then divide all constructed samples into training set and validation set according to the predetermined ratio; Step S4: constructing a data interpolation model, which includes: a sample preprocessing module, an interpolation coding module, and a linear transformation module; the sample preprocessing module is used to preliminarily fill in the pseudo-missing traffic data of each sample input based on the missing mask matrix and the missing interval matrix in an attenuation-aware manner to obtain a filled sample; the interpolation coding module includes an embedding layer, an attenuation-aware adaptive spatiotemporal graph convolution layer, and L-1 adaptive spatiotemporal graph convolution layers, and is used to learn the spatiotemporal pattern of traffic data from the filled sample and the missing interval matrix to obtain interpolated data; the linear transformation module is used to use the interpolated data to interpolate the original missing traffic data corresponding to the sample to obtain the expected traffic data; Step S5, inputting the training set and the validation set into the data interpolation model for model training to obtain optimal model parameters, and saving the trained data interpolation model; Step S6: collecting traffic data to be interpolated, dividing the data to be interpolated into a number of traffic data samples to be interpolated according to the length of the sliding window, and constructing a missing mask matrix and a missing interval matrix for each traffic data sample to be interpolated; Step S7: input the traffic data samples to be interpolated and the corresponding missing mask matrix and missing interval matrix into the trained data interpolation model to obtain the expected traffic data after interpolation.
2. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 1 is characterized in that: The missing mask matrix The construction method is: In formula (1), represents the cth traffic data feature of the nth traffic detector at the tth time slice, Used to measure Is it missing? Elements in a matrix; T represents the time length of the observation data, N represents the number of traffic detectors in the spatial dimension, and C represents the number of traffic data features; The missing interval matrix in is the missing interval matrix of the t-th time slice, t∈{1,2,...,T}, represents the set of real numbers, The construction method for any value in is: In formula (2), represents the time interval between the cth traffic data feature of the nth traffic detector at the tth time slice and its last non-missing record, s t represents the observation time of the t-th time slice, 3. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 2 is characterized in that: The traffic data characteristics include flow rate, occupancy rate, and vehicle speed.
4. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 2 is characterized in that: The pseudo-missing traffic data corresponding to a sliding window length in the sample input is a three-dimensional matrix in is the eigenvalue matrix of traffic data at the t-th time slice, t∈{1,2,...,T}, It is a graph signal matrix with missing values; the output of the sample contains the true values of the artificially constructed missing nodes.
5. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 4 is characterized in that: The sample preprocessing module preliminarily fills the pseudo-missing traffic data of each sample input based on the missing mask matrix and the missing interval matrix in an attenuation-aware manner. The calculation formula is: In formulas (3) and (4), It is X t The weight matrix used when performing the initial filling, Yes The weights used when filling, is a learnable parameter, represents the last non-missing value of the cth traffic data feature of the nth spatial dimension traffic detector at the tth time slice, Represents the historical average value of the c-th traffic data feature.
6. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 5 is characterized in that: The interpolation coding module learns the spatiotemporal pattern of traffic data from the filled samples and the missing interval matrix to obtain interpolated data, specifically including the following steps: Step S41: The attenuation-aware adaptive spatiotemporal graph convolution layer is composed of a plurality of attenuation-aware adaptive graph convolutional recurrent units that share parameters in the time dimension. The output of the attenuation-aware adaptive graph convolutional recurrent unit is attenuated in the time dimension using a missing interval matrix. Step S42, calculating an adaptive adjacency matrix based on the embedding representation of the traffic detector in the embedding layer; Step S43, calculating the attenuated update gate, reset gate, and candidate state according to the adaptive adjacency matrix, and obtaining the hidden state at the next moment; Return to step S41 until the last unit obtains the output of the attenuation-aware adaptive spatiotemporal graph convolutional layer; In step S44, the output of the attenuation-aware adaptive spatiotemporal graph convolution layer is used as the input of the first layer of L-1 adaptive spatiotemporal graph convolution layers, and the adaptive adjacency matrix is calculated. Then, the update gate, reset gate, and candidate state are calculated according to the adaptive adjacency matrix, and the hidden state at the next moment is obtained as the input of the next layer. A total of L-1 layers of adaptive spatiotemporal graph convolution are stacked, and the input of the previous layer is used as the input of the next layer. Finally, the output of the last layer of adaptive spatiotemporal graph convolution layer is recorded as Take the last time slice As the input of the linear transformation module.
7. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 6 is characterized in that: The attenuation formula is as follows: In formulas (5) and (6), It is H t-1 The attenuation intensity matrix, is a learnable parameter, F represents the output dimension, H t-1 is the output of the attenuation-aware adaptive graph convolutional recurrent unit at time t-1.
8. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 7 is characterized in that: The formula for calculating the adaptive adjacency matrix is as follows: A=I N +softmax(ReLU(EE T )) (7) In formula (7), is the parameter matrix of the embedding layer, which represents the embedding representation of each traffic detector, and d represents the embedding dimension of the traffic detector; I N is the N-th order identity matrix; is the adaptive adjacency matrix.
9. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 8 is characterized in that: The formulas for calculating the attenuated update gate, reset gate, candidate state, and hidden state are as follows: Z t =σ(A[X t ,H t-1 ]EW z +Eb z ) (8) R t =σ(A[X t ,H t-1 ] EW r +Eb r ) (9) In formulas (8)-(11), is the weight pool, is the bias pool; [·] represents the connection operation; Z t is the update gate, R t It is the reset gate. is a candidate state, H t It is a hidden state.
10. The traffic data interpolation method based on the self-supervised learning algorithm according to claim 9 is characterized in that: The linear transformation module uses convolution operation to implement linear transformation: In formula (12), is the interpolation result of the model output, Φ is the convolution kernel, the convolution kernel shape is (1, F), the number of output channels is T×C, and reshape means that the output of the convolution has the same dimension as the input data after reshaping.
Citation Information
Patent Citations
A Traffic Flow Completion and Prediction Method
CN110555018B
Power distribution network synchronous measurement missing data restoration method, terminal and storage medium
CN113936192A
Traffic data missing value interpolation method based on space-time integrated learning
CN114004421A