An ETC traffic flow prediction method based on microcosmic trajectory reconstruction and time-frequency spectrum fusion
By using a method that combines micro-trajectory reconstruction with time-frequency map fusion, the problems of coarse feature embedding and lack of physical constraints in existing traffic flow prediction are solved, achieving efficient and accurate traffic flow prediction that can handle complex nonlinear relationships and conforms to physical laws.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGSHA UNIVERSITY OF SCIENCE AND TECHNOLOGY
- Filing Date
- 2026-01-22
- Publication Date
- 2026-04-14
AI Technical Summary
Existing traffic flow prediction methods suffer from poor robustness and are prone to vehicle transients when dealing with complex nonlinear relationships due to their coarse feature embedding methods, neglect of frequency domain information, and lack of physical constraints.
A method combining micro-trajectory reconstruction and time-frequency graph fusion is adopted. Discrete gantry IDs and continuous speeds and time differences are mapped to the same high-dimensional feature space through a learnable embedding matrix. By combining graph attention mechanism and physical correction layer, road network topology constraints and frequency domain features are extracted. Transformer encoder and Fourier transform are used for feature extraction. Finally, traffic flow is predicted through fully connected layer.
It achieves full feature fusion, enhances noise resistance, ensures that the prediction results conform to physical laws, and improves the accuracy and robustness of traffic flow prediction.
Smart Images

Figure CN121564994B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and intelligent transportation technology, specifically relating to an ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency map fusion. Background Technology
[0002] Early traffic flow prediction schemes mostly used statistical models such as ARIMA, which could not fit complex nonlinear relationships. With the development of intelligent transportation, traffic prediction based on deep learning has become mainstream. Recurrent Neural Networks (RNNs) and their variants (LSTM / GRU) have solved short-term time-series dependencies, but they suffer from the gradient vanishing problem when dealing with very long sequences, and their efficiency cannot be improved through parallel computing.
[0003] Current state-of-the-art methods typically employ a cascaded structure of Graph Convolutional Networks (GCNs) and Transformers. GCNs are used to extract spatial features of the road network, while Transformers extract temporal features. However, most existing GCN+Transformer schemes simply stack the spatial and temporal modules, neglecting the value of frequency domain information. Furthermore, these models fail to incorporate prior knowledge of the physical world (such as inertia and speed limitations), resulting in extremely poor robustness to predictions when data noise is high (e.g., missed ETC readings).
[0004] The main disadvantages of existing technologies are as follows:
[0005] (1) First, the existing methods have a crude feature embedding method, which often simply concatenates speed and time as scalars to the end of the vector without projecting them onto the same semantic dimension as the node features, resulting in insufficient feature fusion.
[0006] (2) Second, existing methods ignore global features in the frequency domain and only perform convolution or attention calculations in the time dimension. They cannot separate high-frequency noise (such as random acceleration and deceleration) and low-frequency trends (such as overall traffic flow in the road network) in the data, and have weak noise resistance.
[0007] (3) Thirdly, due to the lack of physical layer constraints, the existing methods may produce a “teleportation” phenomenon in which the vehicle crosses several gantries in a very short time. Summary of the Invention
[0008] The technical problem to be solved by this invention is to provide an ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency spectrum fusion, which addresses the above-mentioned problems of the prior art. It systematically constructs a "bottom-up" traffic flow prediction framework, which is different from the traditional method of directly predicting macro traffic flow. This invention realizes the physical reconstruction of micro-trajectories and the fusion of multi-domain features in traffic flow prediction.
[0009] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0010] An ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency map fusion includes the following steps:
[0011] Obtain ETC transaction data, and construct a vehicle micro-trajectory tensor containing discrete gantry ID sequence, normalized speed sequence and logarithmic time difference sequence as input tensor based on the ETC transaction data;
[0012] The predictive model is constructed, and the model's processing flow for the input data is as follows:
[0013] By using a learnable embedding matrix and a linear projection layer, different components in the input tensor are mapped to the same high-dimensional feature space and superimposed to obtain the initial features;
[0014] The road network adjacency matrix is used as the bias term of the graph attention mechanism. After calculating the attention score matrix based on the initial features, spatial features containing road network topological constraints are extracted. The spatial features are then superimposed with the initial features to obtain the first feature.
[0015] The first feature is input into a Transformer encoder containing a causal mask to extract temporal features that do not contain future information;
[0016] The temporal features are subjected to Fourier transform, and then the signal is restored from the frequency domain by multiplying it with the learnable complex weights in the frequency domain to achieve spectral domain filtering. The filtered features are then superimposed with the temporal features to obtain the second feature.
[0017] The physical inertial feature is calculated based on the second feature using the physical correction layer. and physical inertial characteristics Multiply by physical constraint coefficient The second feature is then superimposed and normalized to obtain the final hidden layer feature. ;
[0018] The final hidden layer features Input three parallel fully connected layer prediction heads, and output the probability distribution, travel time and speed of the next hop gantry respectively; decode the predicted gantry ID and arrival time of the vehicle based on the probability distribution and travel time of the next hop gantry; finally, use the indicator function to count the total number of vehicles arriving at a specific gantry at a specific time step, and aggregate to generate traffic flow prediction values.
[0019] The model is trained using the training set of the input tensor, and the model parameters are optimized during the training process using an asymmetric weighted multi-task loss function.
[0020] Obtain ETC transaction data for the vehicle samples to be predicted, construct the corresponding vehicle micro-trajectory tensor and input it into the trained model to obtain traffic flow prediction results.
[0021] Furthermore, when constructing the vehicle micro-trajectory tensor based on ETC transaction data, which includes a discrete gantry ID sequence, a normalized speed sequence, and a logarithmic time difference sequence, the specific steps include:
[0022] The discrete gantry ID index of the vehicle samples is obtained from the ETC transaction data, and the discrete gantry ID indices of all vehicle samples are combined into a discrete gantry ID sequence.
[0023] The vehicle speeds of vehicle samples are obtained from ETC transaction data, and the speeds of each vehicle sample are divided by a specified value to scale the values. The normalized speed is obtained from the data, and the normalized speeds of all vehicle samples are combined into a normalized speed sequence.
[0024] The time taken by a vehicle sample to travel between gantries is obtained from the ETC transaction data. The time taken by the vehicle sample is added to a specified value and the natural logarithm is calculated to obtain the logarithmic time difference. The logarithmic time differences of all vehicle samples are combined into a logarithmic time difference sequence.
[0025] Furthermore, when mapping different components of the input tensor to the same high-dimensional feature space using learnable embedding matrices and linear projection layers, the process includes:
[0026] A learnable matrix is established based on the total number of gantries in the road network. Furthermore, the total number of gantries in the road network is a learnable matrix. The row number is determined from the discrete gantry ID in the input tensor, from the learnable matrix. Select the vector corresponding to the row as the node vector;
[0027] The normalized velocity and logarithmic time difference in the input tensor are calculated using a linear transformation formula to obtain the corresponding velocity vector and time vector. The weight vector and bias vector used in the linear transformation formula have the same dimension as the node vector.
[0028] Furthermore, the road network adjacency matrix is , The total number of gantries in the road network, if the node Connected Otherwise, it is 0. The road network adjacency matrix is used as the bias term of the graph attention mechanism. When extracting spatial features containing road network topological constraints after calculating the attention score matrix based on the initial features, the specific steps include:
[0029] The road network adjacency matrix The logarithmic form of is used as a bias term in the graph attention mechanism:
[0030]
[0031] in, It is a very small positive number;
[0032] Project the initial features into a query matrix Key matrix Sum matrix Using a query matrix Key matrix The attention score matrix is calculated using the following mathematical expression:
[0033]
[0034] in, This is the scaling factor;
[0035] After softmax processing, the attention score matrix is compared with the value matrix. The spatial features are obtained by multiplication, and the corresponding spatial features are extracted based on the gantry ID index of the vehicle sample.
[0036] Furthermore, when the first feature is input into a Transformer encoder containing a causal mask to extract temporal features that do not contain future information, the Transformer encoder performs a stacking process on the first feature with a specified number of layers. After each layer obtains the input features, it is sequentially processed by a multi-head self-attention and feedforward neural network to obtain the output features and send them to the next layer. The mathematical expression for the multi-head self-attention processing is as follows:
[0037]
[0038] in, , For input features, For parameter matrices, This is an upper triangular causal mask;
[0039] The mathematical expression for the feedforward neural network processing is as follows:
[0040]
[0041] in, For output features, This is the weight matrix of the fully connected layer. and This is used as a bias for dimensionality-upgrading and dimensionality-reducing feature transformations.
[0042] Furthermore, when performing a Fourier transform on the time-series features and then multiplying them in the frequency domain with learnable complex weights to reconstruct the signal from the frequency domain, specifically, a real-valued Fast Fourier Transform is performed on the time dimension of the time-series features to obtain a complex tensor. Then the complex tensor With learnable complex weights The complex frequency domain signal is obtained by performing the Adama product operation. Finally, the complex frequency domain signal is transformed through inverse transformation. Restored to real time domain signal .
[0043] Furthermore, the physical correction layer is used to calculate the physical inertial characteristics based on the second feature. When, the mathematical expression is as follows:
[0044]
[0045] in, It is the hyperbolic tangent function; Represents real number time-domain signals Features superimposed with time-series features All of these are learnable fully connected layer parameters.
[0046] Furthermore, the three parallel fully connected layer prediction heads output the probability distribution, travel time, and travel speed of the next gantry as follows:
[0047]
[0048]
[0049]
[0050] in, This represents the predicted probability distribution value for the next gantry jump. , These are the fully connected layer parameters of the fully connected layer prediction head that outputs the probability distribution of the next hop gantry; This represents the predicted travel time. , These are the fully connected layer parameters of the fully connected layer prediction head that outputs the travel time prediction values; For activation function, ; This represents the predicted driving speed. , These are the fully connected layer parameters of the fully connected layer prediction head that outputs the predicted driving speed value. This is the activation function.
[0051] Furthermore, when decoding the predicted gantry ID and arrival time of the vehicle based on the probability distribution of the next gantry and the predicted travel time, specifically, the predicted gantry ID is obtained by taking the gantry ID index with the highest probability from the probability distribution of the next gantry. And by adding the travel time prediction value to the specified time step, the predicted arrival time step is obtained. When using an indicator function to count the total number of vehicles arriving at a specific gantry at a specific time step, the mathematical expression is as follows:
[0052]
[0053] in, Indicates at time step Passing through the gantry Traffic flow, The total number of vehicle samples participating in the prediction. For logic and symbols, This is an indicator function; the function value is 1 when the logical condition within the parentheses is true, and 0 otherwise.
[0054] Furthermore, the mathematical expression for the asymmetric weighted multi-task loss function is as follows:
[0055]
[0056] in, This represents the predicted probability distribution value for the next gantry jump. This represents the predicted travel time. This represents the predicted driving speed. This represents the true value of the probability distribution for the next gantry jump. This indicates the actual travel time. This represents the actual driving speed. For cross-entropy loss, This is a loss for Huber.
[0057] Compared with the prior art, the advantages of the present invention are as follows:
[0058] (1) This invention constructs a unified multimodal embedding space and proposes a parallel embedding projection mechanism to map and fuse discrete gantry IDs with continuous velocity and time difference respectively, laying the foundation for feature alignment.
[0059] (2) This invention introduces a spectral domain attention mechanism, which uses Fast Fourier Transform (FFT) to introduce features into the frequency domain, and enhances the effective frequency components through learnable filters to capture global periodic patterns.
[0060] (3) The present invention establishes a kinematic correction module and designs a nonlinear physical layer based on residual structure to explicitly simulate the inertial smoothing characteristics of object motion and force the prediction results to conform to the basic kinematic laws. Attached Figure Description
[0061] Figure 1 A simplified flowchart of the method according to an embodiment of the present invention.
[0062] Figure 2 This is a schematic diagram of the architecture of the prediction model in an embodiment of the present invention.
[0063] Figure 3 This is a schematic diagram illustrating the traffic flow prediction effect of an embodiment of the present invention. Detailed Implementation
[0064] The present invention will be further described below with reference to the accompanying drawings and specific preferred embodiments, but this does not limit the scope of protection of the present invention.
[0065] Before introducing specific embodiments of the present invention, relevant concepts or terms will be explained.
[0066] ETC (Electronic Toll Collection): Electronic toll collection system.
[0067] GNN (Graph Neural Network): A type of deep learning model specifically designed to process graph-structured data.
[0068] Transformer: A deep neural network architecture primarily based on self-attention, which excels at processing sequential data.
[0069] FFT (Fast Fourier Transform): An algorithm used to convert time-domain signals into frequency-domain signals.
[0070] Example
[0071] In highway traffic management, using ETC gantry data to predict vehicle trajectories and traffic flow is of great significance. However, existing technologies face the following specific challenges:
[0072] 1. Existing graph neural networks typically use static adjacency matrices for feature aggregation, which makes it difficult to adaptively adjust the association weights between gantries based on real-time traffic conditions (such as congestion and accidents) when processing dynamic traffic flow.
[0073] 2. Traditional time series models (such as LSTM or standard Transformer) mainly operate in the time domain, which easily ignores the inherent periodicity of traffic flow data in the frequency domain (such as the waveform characteristics of morning and evening peak hours), resulting in large cumulative errors in long-distance prediction.
[0074] 3. Existing methods lack physical kinematic constraints, and the prediction results generated by purely data-driven models often lack physical interpretability, frequently resulting in phenomena such as "excessive instantaneous displacement of the vehicle" or "sudden speed change".
[0075] 4. ETC data contains discrete gantry IDs and continuous time and speed values. Existing methods often process these data coarsely and fail to construct a unified high-dimensional semantic space for alignment.
[0076] To address the aforementioned issues, this embodiment proposes an ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency map fusion, such as... Figure 1 As shown, it includes the following steps:
[0077] S1) Obtain ETC transaction data, and construct a vehicle micro-trajectory tensor containing discrete gantry ID sequence, normalized speed sequence and logarithmic time difference sequence as input tensor based on the ETC transaction data;
[0078] S2) Construct a prediction model, such as Figure 2 As shown, this model is a deep processing module that includes four dimensions: "space-time-frequency domain-physics". The model's processing flow for input data is as follows:
[0079] S21) Using a learnable embedding matrix and a linear projection layer, different components in the input tensor are mapped to the same high-dimensional feature space and superimposed to obtain the initial features;
[0080] S22) The road network adjacency matrix is used as the bias term of the graph attention mechanism, and after calculating the attention score matrix based on the initial features, spatial features containing road network topological constraints are extracted. The spatial features are superimposed with the initial features to obtain the first feature.
[0081] S23) Input the first feature into the Transformer encoder containing the causal mask to extract the temporal features that do not contain future information;
[0082] S24) Perform Fourier transform on the time series features, and then multiply the signal in the frequency domain by the learnable complex weights to restore the signal from the frequency domain to achieve spectral domain filtering. The filtered features are then superimposed with the time series features to obtain the second feature.
[0083] S25) Calculate the physical inertial feature based on the second feature using the physical correction layer. and physical inertial characteristics Multiply by physical constraint coefficient The second feature is then superimposed and normalized to obtain the final hidden layer feature. ;
[0084] S26) Final hidden layer features Input three parallel fully connected layer prediction heads, and output the probability distribution, travel time and speed of the next hop gantry respectively; decode the predicted gantry ID and arrival time of the vehicle based on the probability distribution and travel time of the next hop gantry; finally, use the indicator function to count the total number of vehicles arriving at a specific gantry at a specific time step, and aggregate to generate traffic flow prediction values.
[0085] S3) Use the training set of the input tensor to train the model, and use an asymmetric weighted multi-task loss function to optimize the model parameters during the training process;
[0086] S4) Obtain the ETC transaction data of the vehicle sample to be predicted, construct the corresponding vehicle micro-trajectory tensor and input it into the trained model to obtain the traffic flow prediction result.
[0087] The following is a detailed explanation of each step.
[0088] In this embodiment, step S1 transforms the ETC transaction data into a mathematical tensor, constructing a vehicle micro-trajectory tensor from multi-source heterogeneous data. Specifically, the ETC transaction data refers to the ETC transaction data of vehicle samples, including the discrete gantry ID index of the vehicle sample (i.e., the ID of the gantry the vehicle passed through), the vehicle speed of the vehicle sample, and the time taken for the vehicle sample to travel between adjacent gantries. Specifically, this includes:
[0089] The discrete gantry ID index of the vehicle samples is obtained from the ETC transaction data, and the discrete gantry ID indices of all vehicle samples are combined into a discrete gantry ID sequence.
[0090] The vehicle speeds of vehicle samples are obtained from ETC transaction data, and the speeds of each vehicle sample are divided by a specified value to scale the values. The normalized speed is obtained from the data, and the normalized speeds of all vehicle samples are combined into a normalized speed sequence.
[0091] The time taken by a vehicle sample to travel between gantries is obtained from the ETC transaction data. The time taken by the vehicle sample is added to a specified value and the natural logarithm is calculated to obtain the logarithmic time difference. The logarithmic time differences of all vehicle samples are combined into a logarithmic time difference sequence.
[0092] For example, setting the batch size (Batch Size, set to 128), length of historical observation window (Take 12). Regarding the ETC transaction data, the first... The vehicle sample in the first Data from 1 time step is used to construct three input components:
[0093] 1. Discrete Gantry ID Index Each element represents a unique identification number (ID) for the toll station / gantry within the road network.
[0094] 2. Normalization speed The calculation formula is:
[0095] (1)
[0096] in: This is the original vehicle speed (km / h). Dividing by 120 is to scale the value to... Between these, large numbers can be used to prevent gradient explosion in neural networks.
[0097] 3. Logarithmic time difference The calculation formula is:
[0098] (2)
[0099] in: It is the time (in minutes) it takes for a vehicle to travel from the previous gantry to the current gantry. The function is the natural logarithm (with the constant e as the base). Since the time interval may range from 1 minute to several hundred minutes (long-tailed distribution), taking the logarithm can compress the numerical range, making its distribution smoother and facilitating subsequent model learning.
[0100] In step S21 of this embodiment, when the prediction model uses a learnable embedding matrix and a linear projection layer to map different components of the input tensor to the same high-dimensional feature space, it uses mathematical transformation to uniformly map the irregular ID and scalar values to... A high-dimensional feature space. Specifically, it includes:
[0101] S101) Discrete variable vectorization: Establish a learnable matrix based on the total number of gantries in the road network. Define a learnable matrix ,in: This represents the total number of gantries in the road network. This indicates that it is a... OK, A real matrix of columns; from the learnable matrix, based on the discrete gantry ID in the input tensor. The vector corresponding to the row is selected as the node vector. For example, for the input gantry number... Take it out directly The row vector .
[0102] S102) Linear Projection of Continuous Variables: The normalized velocity and logarithmic time difference in the input tensor are used to calculate the corresponding velocity and time vectors using a linear transformation formula. The weight vector and bias vector used in the linear transformation formula have the same dimensions as the node vectors. Specifically, for velocity... and time Using the linear transformation formula:
[0103] (3)
[0104] (4)
[0105] in: This is the weight vector. This is the bias vector.
[0106] S103) Feature stacking: Add the three 512-dimensional vectors element by element, and use Dropout (dropout rate of 0.1) to prevent overfitting to obtain the initial feature tensor. :
[0107] (5)
[0108] In step S22 of this embodiment, when the prediction model uses the road network adjacency matrix as a bias term of the graph attention mechanism and extracts spatial features containing road network topological constraints after calculating the attention score matrix based on the initial features, the specific steps include:
[0109] S201) Adjacency Matrix Preprocessing: Let the road network adjacency matrix be... If node Connected Otherwise, it is 0.
[0110] S202) Attention score calculation: According to formula (6), the road network adjacency matrix is... The logarithmic form of the term is used as the bias term in the graph attention mechanism, and then the initial features of the nodes in the entire graph are used. Projection as query matrix Key matrix Sum matrix . and Used to calculate the attention score matrix according to formula (7) :
[0111] (6)
[0112] (7)
[0113] in: It is a very small positive number to prevent the logarithmic independent variable from being 0, when there is no connection between nodes ( When biasing The tendency toward negative infinity forces the attention weight to zero, thereby blocking the transmission of information through non-physical connectivity paths at the mathematical level. A scaling factor of 512 is used to prevent the dot product result from becoming too large. Attention scores are used to forcibly cut off feature propagation between non-adjacent nodes, ensuring the model strictly adheres to the physical road network structure.
[0114] S203) Spatial Feature Fusion: After softmax processing, the attention score matrix is combined with the value matrix. Multiplication yields spatial characteristics:
[0115] (8)
[0116] The obtained full-map spatial features The features are extracted based on the gantry ID index of the current vehicle sample. The indexed results are then superimposed back onto the original features, and the superimposed features are called the first features. .
[0117] In step S23 of this embodiment, when the prediction model inputs the first feature into the Transformer encoder containing the causal mask and extracts the temporal features that do not contain future information, the Transformer encoder processes the first feature. Layer stacking processing. Each layer contains two sub-operations:
[0118] 1. Multi-head Self-Attention (MSA): Taking the first layer as an example, let the input feature be the first feature. The parameter matrix is The calculation formula is:
[0119] (9)
[0120] (10)
[0121] in: This is an upper triangular causal mask, where the elements of the upper triangular region are... The main diagonal and lower triangle are Masking operations ensure that predictions are accurate. At time 1, the model is "invisible". Real-time data to prevent future information leaks.
[0122] 2. Feedforward Neural Network:
[0123] (11)
[0124] in: This is the weight matrix of the fully connected layer. and The bias is used for dimensionality-upgrading and dimensionality-reducing feature transformations. The output features of the feedforward neural network are denoted as... .
[0125] In step S24 of this embodiment, the prediction model performs a Fourier transform on the time-series features, and then, when restoring the signal from the frequency domain after multiplying it with learnable complex weights in the frequency domain, high-frequency noise is removed in the frequency domain. Specifically, this includes:
[0126] S301) Discrete Fourier Transform: Temporal characteristics of the output of the feedforward neural network in the last layer of the Transformer encoder. Perform a real-number Fast Fourier Transform on the time dimension (dimension 0) to obtain a complex tensor. :
[0127] (12)
[0128] Where: input sequence length The number of frequency components output by the RFFT is .at this time It is a complex tensor.
[0129] S302) Frequency Domain Weighted Multiplication: Multiplying complex tensors With learnable complex weights The complex frequency domain signal is obtained by performing the Adama product operation. :
[0130] (13)
[0131] in: It is a learnable complex weight tensor containing real and imaginary weights; This represents the Hadamard product (element-wise multiplication). Here, the model learns how to scale the amplitude and rotate the phase of each frequency component, essentially learning an adaptive bandpass filter.
[0132] S303) Inverse Transform: Transforms complex frequency domain signals through inverse transformation. Restored to real time domain signal :
[0133] (14)
[0134] The complex frequency domain signal is restored to a real time domain signal, and the residual is superimposed. The feature obtained by superimposing the filtered feature and the time-series feature is called the second feature. .
[0135] In step S25 of this embodiment, the prediction model uses a physical correction layer to calculate the physical inertial feature based on the second feature. and physical inertial characteristics Multiply by physical constraint coefficient The second feature is then superimposed and normalized to obtain the final hidden layer feature. At that time, the hyperbolic tangent function is used to simulate physical inertia. This includes the following steps:
[0136] S401) Physical quantity simulation: Calculate the physical inertial characteristics based on the second characteristic using the physical correction layer. When, the mathematical expression is as follows:
[0137]
[0138] in: It is the hyperbolic tangent function; All of these are learnable fully connected layer parameters.
[0139] S402) Modification Item Injection:
[0140]
[0141] Among them: settings For fixed physical constraint coefficients, This is root mean square normalization. This means that only minor physical corrections are made to the main features, rather than complete coverage.
[0142] In this embodiment, step S26 is used to modify the physically corrected high-dimensional features. The process involves decoding specific micro-level vehicle behaviors and then aggregating them using statistical methods to generate macro-level traffic flow. This is divided into three sub-steps:
[0143] S501) Multi-task feature mapping: The prediction model will ultimately use hidden layer features Inputting three parallel fully connected layer prediction heads, and utilizing three independent neural network "prediction heads" to... Perform dimensionality reduction mapping.
[0144] (1) The probability distribution of the next gantry jump is as follows: ,in: , These are the weights of the fully connected layer, and the mapping result is the nonnormalized probability of each gantry.
[0145] (2) The predicted travel time is ,in: , These are the weights of the fully connected layer; This is the activation function, which forces the time interval of output to always be greater than 0.
[0146] (3) Predicted driving speed ,in: , These are the weights of the fully connected layer; the ReLU activation function is used to ensure that the prediction speed is non-negative.
[0147] S502) Micro-trajectory generation: The prediction model decodes the predicted gantry ID and arrival time of the vehicle based on the probability distribution of the next gantry and the predicted travel time, thereby decoding the mapping result to obtain specific vehicle prediction information. For the first gantry in the test set... Vehicle:
[0148] (1) Predict gantry ID ( Take the gantry ID index with the highest probability from the probability distribution of the next gantry:
[0149] (15)
[0150] (2) Predict the arrival time step ( ), based on the input time step Add the predicted travel time And round down.
[0151] S503) Macro-flow aggregation: This is the key shift from "micro-vehicles" to "macro-flow". The prediction model uses an indicator function to count the total number of vehicles arriving at a specific gantry at a given time step. It iterates through the predicted trajectories of all test vehicles to calculate the total number of vehicles arriving at the specific gantry at that time step. The calculation formula is as follows:
[0152] (16)
[0153] in: The final output result is the prediction at time step [missing information]. Passing through the gantry Traffic flow (vehicles / unit of time); The total number of vehicle samples participating in the prediction can be the total number of vehicle samples in the test set. This is an indicator function. The function evaluates to 1 when the logical condition within the parentheses is true, and 0 otherwise; it is used for counting. This is the logical AND operator. It means that the counter increments by 1 only if both of the following conditions are met simultaneously: that is, the traffic flow must satisfy the first condition... The car was indeed predicted by the model to go to the mast. ( ), and the first The time predicted by the model for the vehicle to arrive at the gantry is exactly... ( In this way, the model reconstructs the macroscopic road network cross-sectional flow map using the kinematic predictions of micro-individuals.
[0154] In step S3 of this embodiment, the model training and optimization strategy is as follows:
[0155] 1. Loss Function: Asymmetric weighted multi-task loss is used.
[0156]
[0157] in: For cross-entropy loss, For Huber's losses, , , These are the corresponding actual values.
[0158] 2. Optimizer: Use AdamW and set the weight decay factor to 1e-4.
[0159] 3. Learning rate strategy: OneCycleLR is used with a maximum learning rate of 1e-3, which increases in the first 30% of steps and then decreases, with a total training epoch of 150.
[0160] In step S4 of this embodiment, the comparison between the traffic flow prediction results of the trained model for the ETC transaction data of the vehicle samples to be predicted and the actual values is as follows: Figure 3 As shown, the predicted value changes in the same direction as the actual value, and the predicted value gradually approaches the actual value as time increases. This proves that the prediction model in this embodiment can achieve better traffic flow prediction results through the physical reconstruction of micro-trajectories and the fusion of multi-domain features.
[0161] In summary, this invention proposes an ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency map fusion. It systematically constructs a bottom-up traffic flow prediction framework, which differs from traditional methods that directly predict macro-level traffic flow. This approach focuses on the physical reconstruction of micro-trajectories and the fusion of multi-domain features. The technical points to be protected are as follows:
[0162] 1. Heterogeneous Feature Embedding Mechanism Based on Multimodal Alignment: This invention provides a method for parallel mapping of discrete spatial gantry IDs with continuous time differences and velocity values. Unlike the simple vector concatenation of existing technologies, this invention uses a learnable lookup table and a linear projection layer to uniformly map heterogeneous data to the same high-dimensional semantic space, solving the problem of feature misalignment between discrete and continuous variables.
[0163] 2. A graph attention calculation method incorporating logarithmic topological bias: This method protects a technique that introduces the logarithmic form of the adjacency matrix as a bias term when calculating graph attention scores. Mathematically, this method forces the disconnection of attention paths from non-physically connected nodes, ensuring that feature propagation strictly follows the actual physical topology of the highway network.
[0164] 3. Time-Spectrum Dual-Domain Joint Feature Extraction Architecture: This architecture preserves a processing flow that combines a cascaded time-domain Transformer and a frequency-domain RFFT filter. It utilizes Fast Fourier Transform to transform features into the frequency domain and performs global filtering through the Hadamard product operation with complex weights, thereby effectively separating long-period trends and high-frequency random noise in traffic flow data.
[0165] 4. Kinematic Correction Module Based on Hyperbolic Tangent Residual: This module protects a nonlinear physical correction layer embedded deep within the neural network. By connecting the saturation characteristics of the Tanh function with the residual, it simulates the inertia and velocity saturation constraints of object motion, physically constraining the deep features driven by pure data, and preventing the model from outputting values that violate kinematic common sense (such as instantaneous vehicle movement or sudden velocity changes).
[0166] 5. A statistical aggregation method for micro-trajectory to macro-flow: This method protects a flow generation logic based on indicator functions and logical AND operations. It first predicts the next-hop node and arrival time of a single vehicle, and then uses a specific aggregation formula to count the number of vehicles that overlap in time and space, achieving a technical closed loop of accurately deriving macro-sectional flow from micro-individual behavior prediction.
[0167] Compared with the current mainstream "Graph Convolutional Network (GCN) + Transformer" concatenated model, this invention has significant advantages in feature processing depth, noise resistance, and physical interpretability:
[0168] (1) This invention addresses the problem of insufficient feature fusion in heterogeneous data: Existing technologies typically normalize scalars such as speed and time and append them to the end of node vectors, resulting in large dimensional differences and difficulty in deep feature interaction. This invention employs a fully parameterized feature embedding strategy, projecting continuous variables into a high-dimensional space of equal width to the node embedding, enabling the model to capture the nonlinear coupling relationship between speed fluctuations, time intervals, and spatial locations during the input stage, thereby enhancing the richness of feature representation.
[0169] (2) It overcomes the limitation of pure time-domain models in effectively handling global noise: Although traditional Transformer models are good at capturing sequence dependencies, they are difficult to distinguish between effective periodic signals and randomly collected noise. This invention introduces a spectral domain filtering module, which uses Fourier transform to decompose the time-series signal into frequency components. By learning frequency domain weights, it automatically suppresses high-frequency noise that is ineffective for prediction, enabling the model to better capture the global periodicity of traffic flow in long-distance prediction and reduce cumulative errors.
[0170] (3) Overcoming the deficiency of purely data-driven models lacking physical rationality: Existing deep learning models rely entirely on data fitting, which can easily generate predictions that violate physical laws when data is sparse or abnormal. This invention designs a kinematic physics correction layer, which uses the saturation characteristics of the Tanh function to simulate the inertial constraints of vehicle motion, and combines the residual structure to perform "soft correction" on deep features. This ensures that the prediction results maintain high accuracy while strictly conforming to the kinematic logic of the vehicle, greatly improving the robustness of the model in complex real-world scenarios.
[0171] (4) Achieves accurate prediction of both micro-level individual data and macro-level total data: Existing technologies mostly focus on directly predicting the total flow rate of a cross-section, losing information about the behavior of individual vehicles. This invention adopts a "micro-level first, then macro-level" strategy, which not only obtains high-precision cross-sectional flow rates through aggregation formulas, but also outputs the predicted trajectory of each vehicle simultaneously. This fine-grained output provides highway managers with more dimensional decision support, such as single-vehicle route tracing and analysis of individual abnormal behavior.
[0172] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0173] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A traffic flow prediction method for ETC based on micro-trajectory reconstruction and time-frequency map fusion, characterized in that, Includes the following steps: Obtain ETC transaction data, and construct a vehicle micro-trajectory tensor containing discrete gantry ID sequence, normalized speed sequence and logarithmic time difference sequence as input tensor based on the ETC transaction data; The predictive model is constructed, and the model's processing flow for the input data is as follows: By using a learnable embedding matrix and a linear projection layer, different components in the input tensor are mapped to the same high-dimensional feature space and superimposed to obtain the initial features; The road network adjacency matrix is used as the bias term of the graph attention mechanism. After calculating the attention score matrix based on the initial features, spatial features containing road network topological constraints are extracted. The spatial features are then superimposed with the initial features to obtain the first feature. The first feature is input into a Transformer encoder containing a causal mask to extract temporal features that do not contain future information; The temporal features are subjected to Fourier transform, and then the signal is restored from the frequency domain by multiplying it with the learnable complex weights in the frequency domain to achieve spectral domain filtering. The filtered features are then superimposed with the temporal features to obtain the second feature. The physical inertial feature is calculated based on the second feature using the physical correction layer. and physical inertial characteristics Multiply by physical constraint coefficient The second feature is then superimposed and normalized to obtain the final hidden layer feature. The physical correction layer is used to calculate the physical inertial characteristics based on the second feature. When, the mathematical expression is as follows: in, It is the hyperbolic tangent function; Represents the filtered real-number time-domain signal The second feature, superimposed with the temporal features, All of these are learnable fully connected layer parameters; The final hidden layer features The system takes three parallel fully connected layer prediction heads as input and outputs the probability distribution, travel time, and speed of the next-hop gantry, respectively. Based on the probability distribution and travel time of the next-hop gantry, the predicted gantry ID and arrival time of the vehicle are decoded. Finally, an indicator function is used to count the total number of vehicles arriving at a specific gantry at a specific time step, and these are aggregated to generate traffic flow predictions. Specifically, when decoding the predicted gantry ID and arrival time of the vehicle based on the probability distribution and travel time predictions of the next-hop gantry, the index of the gantry ID with the highest probability is taken from the probability distribution of the next-hop gantry to obtain the predicted gantry ID. And by adding the travel time prediction value to the specified time step, the predicted arrival time step is obtained. When using an indicator function to count the total number of vehicles arriving at a specific gantry at a specific time step, the mathematical expression is as follows: in, Indicates at time step Passing through the gantry Traffic flow, The total number of vehicle samples participating in the prediction. For logic and symbols, This is an indicator function; the function value is 1 when the logical condition within the parentheses is true, and 0 otherwise. The model is trained using the training set of the input tensor, and the model parameters are optimized during the training process using an asymmetric weighted multi-task loss function. Obtain ETC transaction data for the vehicle samples to be predicted, construct the corresponding vehicle micro-trajectory tensor and input it into the trained model to obtain traffic flow prediction results.
2. The ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency spectrum fusion according to claim 1, characterized in that, When constructing a vehicle micro-trajectory tensor based on ETC transaction data, which includes a discrete gantry ID sequence, a normalized speed sequence, and a logarithmic time difference sequence, the specific steps include: The discrete gantry ID index of the vehicle samples is obtained from the ETC transaction data, and the discrete gantry ID indices of all vehicle samples are combined into a discrete gantry ID sequence. The vehicle speeds of vehicle samples are obtained from ETC transaction data, and the speeds of each vehicle sample are divided by a specified value to scale the values. The normalized speed is obtained from the data, and the normalized speeds of all vehicle samples are combined into a normalized speed sequence. The time taken by a vehicle sample to travel between gantries is obtained from the ETC transaction data. The time taken by the vehicle sample is added to a specified value and the natural logarithm is calculated to obtain the logarithmic time difference. The logarithmic time differences of all vehicle samples are combined into a logarithmic time difference sequence.
3. The ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency spectrum fusion according to claim 1, characterized in that, When mapping different components of an input tensor to the same high-dimensional feature space using learnable embedding matrices and linear projection layers, the following are included: A learnable matrix is established based on the total number of gantries in the road network. Furthermore, the total number of gantries in the road network is a learnable matrix. The row number is determined from the discrete gantry ID in the input tensor, from the learnable matrix. Select the vector corresponding to the row as the node vector; The normalized velocity and logarithmic time difference in the input tensor are calculated using a linear transformation formula to obtain the corresponding velocity vector and time vector. The weight vector and bias vector used in the linear transformation formula have the same dimension as the node vector.
4. The ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency spectrum fusion according to claim 1, characterized in that, The road network adjacency matrix is: , The total number of gantries in the road network, if the node Connected Otherwise, it is 0. The road network adjacency matrix is used as the bias term of the graph attention mechanism. When extracting spatial features containing road network topological constraints after calculating the attention score matrix based on the initial features, the specific steps include: The road network adjacency matrix The logarithmic form of is used as a bias term in the graph attention mechanism: in, It is a very small positive number; Project the initial features into a query matrix Key matrix Sum matrix Using a query matrix Key matrix The attention score matrix is calculated using the following mathematical expression: in, This is the scaling factor; After softmax processing, the attention score matrix is compared with the value matrix. The spatial features are obtained by multiplication, and the corresponding spatial features are extracted based on the gantry ID index of the vehicle sample.
5. The ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency spectrum fusion according to claim 1, characterized in that, When the first feature is input into a Transformer encoder containing a causal mask to extract temporal features that do not contain future information, the Transformer encoder performs a specified number of layer stacking processes on the first feature. After each layer obtains the corresponding input features, it is sequentially processed by a multi-head self-attention and feedforward neural network to obtain the output features and send them to the next layer. The mathematical expression for the multi-head self-attention processing is as follows: in, , The first feature is the input feature of the first layer of the Transformer encoder. For parameter matrices, This is an upper triangular causal mask; The mathematical expression for the feedforward neural network processing is as follows: in, As for the output features, the output features of the last layer of the Transformer encoder are temporal features. This is the weight matrix of the fully connected layer. and This is used as a bias for dimensionality-upgrading and dimensionality-reducing feature transformations.
6. The ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency spectrum fusion according to claim 1, characterized in that, When performing a Fourier transform on the time-series features and then multiplying them in the frequency domain with learnable complex weights to reconstruct the signal from the frequency domain, specifically, a real-valued Fast Fourier Transform is performed on the time dimension of the time-series features to obtain a complex tensor. Then the complex tensor With learnable complex weights The complex frequency domain signal is obtained by performing the Adama product operation. Finally, the complex frequency domain signal is transformed through inverse transformation. Restored to real time domain signal .
7. The ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency spectrum fusion according to claim 1, characterized in that, The mathematical expressions for the probability distribution, travel time, and travel speed of the next gantry, respectively, are output by the three parallel fully connected layer prediction heads as follows: in, This represents the predicted probability distribution value for the next gantry jump. , These are the fully connected layer parameters of the fully connected layer prediction head that outputs the probability distribution of the next hop gantry; This represents the predicted travel time. , These are the fully connected layer parameters of the fully connected layer prediction head that outputs the travel time prediction values; For activation function, ; This represents the predicted driving speed. , These are the fully connected layer parameters of the fully connected layer prediction head that outputs the predicted driving speed value. This is the activation function.
8. The ETC traffic flow prediction method based on micro-trajectory reconstruction and time-frequency spectrum fusion according to claim 1, characterized in that, The mathematical expression for the asymmetric weighted multi-task loss function is as follows: in, This represents the predicted probability distribution value for the next gantry jump. This represents the predicted travel time. This represents the predicted driving speed. This represents the true value of the probability distribution for the next gantry jump. This indicates the actual travel time. This represents the actual driving speed. For cross-entropy loss, This is a loss for Huber.
Citation Information
Patent Citations
Highway traffic flow prediction method based on Transform and graph attention network
CN116092294A
Fine-grained traffic state estimation method based on ETC portal data
CN117392845A