Traffic flow prediction method based on CATform model
Through the vehicle flow prediction method based on the CATformer model, the autocorrelation attention mechanism and sequence decomposition module are used to capture the spatiotemporal characteristics of vehicle flow data. Combined with the CNN and TCN modules, the problem of inaccurate vehicle flow prediction in the existing technology is solved, and more efficient vehicle flow prediction and better traffic management support is achieved.
Patent Information
- Application Number
- CN202510339765.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-06-27
AI Technical Summary
Existing traffic flow prediction technologies are difficult to accurately predict traffic flow changes, which affects decision-making support for traffic management and road planning.
The vehicle flow prediction method based on the CATformer model is adopted. The model consists of a data embedding layer, a multi-layer encoder and a decoder. It captures spatiotemporal features, periodicity and trend characteristics through the autocorrelation attention mechanism and sequence decomposition module, and introduces CNN and TCN modules to enhance sequence decomposition capabilities.
It improves the accuracy of traffic forecasting and has a wide range of application prospects, providing strong technical support for traffic management and road planning.
Smart Images

Figure CN120220398A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of traffic flow prediction and relates to a traffic flow prediction method based on the CATformer model. Background Art
[0002] Accurate traffic flow prediction helps to achieve intelligent traffic management. By collecting and analyzing a large amount of traffic data, such as vehicle trajectories, road conditions, historical traffic flows, etc., effective prediction models can be established. These models can predict the changing trends of traffic flow at different times and locations, thereby providing decision-making support for road traffic managers. For example, according to the prediction results, the timing scheme of traffic lights can be reasonably planned to optimize the traffic capacity at intersections; the bus lines and schedules can be adjusted to improve the efficiency of public transportation; the expressway roads can be reasonably planned to make full use of cost control; at the same time, for peak hours and congested sections, traffic guidance measures can be taken in a timely manner to reduce traffic congestion.
[0003] Traffic flow prediction is also very valuable for road planning and design. By predicting the traffic flow of different regions and different road types, it can provide reference for road construction and renovation. For example, for the planning of new roads or expanded roads, the future traffic flow can be predicted to determine the design standards, the number of lanes, and the requirements for supporting facilities of the roads. This can ensure that the roads can meet the growing traffic demand in the future and improve the sustainability of the traffic system.
[0004] The research on traffic flow prediction has important practical significance and practical application value. By accurately predicting the traffic flow, the operation and management of the traffic system can be optimized, the traffic efficiency can be improved, the operation cost can be reduced, and important data support and decision-making basis can be provided for road planning and design. This will bring more intelligent, efficient and sustainable development to road traffic. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a traffic flow prediction method based on the CATformer model.
[0006] To achieve the above purpose, the present invention provides the following technical solutions:
[0007] A traffic flow prediction method based on the CATformer model, comprising the following steps:
[0008] Input traffic flow data into the CATformer model, and the CATformer model consists of a data embedding layer, multiple layers of encoders and a decoder;
[0009] The data embedding layer is used to perform dimensional transformation on the input data before the encoder;
[0010] The input of the first-layer encoder is traffic flow data, and the output is the encoded results of the spatio-temporal features, periodicity, and trend features of the input data; the input of each subsequent layer of the encoder is the encoded result output by the previous layer of the encoder, and the output is the encoded results of the spatio-temporal features, periodicity, and trend features of this layer;
[0011] The input of the first-layer decoder is the encoded result output by the encoder of this layer and the initialized trend-cycle part and seasonal part features, and the output is the encoded result of this layer and the trend part; the input of each subsequent layer of the decoder is the decoded result output by the previous layer of the decoder and the output of the encoder; the output is the encoded result of this layer and the trend part;
[0012] After the traffic flow data is encoded and decoded through multiple layers of encoders and decoders, the traffic flow prediction results for a period of time are obtained.
[0013] Further, the encoder is composed of a CNN module, a self-correlation attention mechanism module, a sequence decomposition module, a TCN module, and a sequence decomposition module connected in sequence;
[0014] The CNN module is used to extract and combine the local spatio-temporal features of the data and reduce the dimension of the input data;
[0015] The self-correlation attention mechanism module discovers period-based dependencies by calculating the self-correlation of the sequence and aggregating similar subsequences through time delays;
[0016] The sequence decomposition module uses the moving average method to decompose the sequence into two parts: trend-cycle and seasonal, to smooth the periodic fluctuations and emphasize the long-term trend;
[0017] The TCN module is used to capture the long-term trends in time series.
[0018] Further, the CNN module includes two two-dimensional convolutional layers, each two-dimensional convolutional layer is connected with a ReLU function, and finally connected with a max-pooling layer to extract and combine the local spatio-temporal features of the data and reduce the dimension of the input data. The specific formula is as follows:
[0019] X enc =Conv2D(X en )
[0020] X enc =Embed(X enc ,X mark_enc )
[0021] where X en is the past I time steps, X en ∈RI ×d , Embed(·) is the data embedding layer, which is used to embed Xen and the marked data X Maek_enc embedded into the model vector space of dimension d
[0022] Furthermore, the decoder consists of a self - correlation attention mechanism module, a sequence decomposition module, an attention mechanism module, a sequence decomposition module, a TCN module, a sequence decomposition module, and a TCN module connected in sequence.
[0023] Furthermore, the self - correlation attention mechanism module uses the self - correlation R(τ) as the unnormalized confidence of the estimated period length τ; then the k most likely period lengths τ1,..., τk are selected; the period - based dependencies are derived from the above - estimated periods and weighted by the corresponding self - correlations;
[0024] The input of the self - correlation attention mechanism module is the past I time steps X en ∈R I×d of the convolution; in the decoder, the input includes the seasonal part X des ∈R (I / 2+p)×d that needs to be improved and the trend - cycle part X det ∈R (I / 2+o)×d ; the two parts represent respectively: the components decomposed from the second half X enI / 2:I of the encoder input to provide the most recent information; the placeholder of length O is filled with scalars; the specific formulas are as follows:
[0025] X ens , X ent = SeriesDecomp(X en I / 2:I )
[0026] X des = Concat(X ens , X0)
[0027] X det = Concat(X ent , X Mean )
[0028] where, X ens and X ent ∈R I / 2×d represent the seasonal and trend - cycle parts of X en , X0 and X Mean ∈R o×d represent the placeholders filled with zeros and the mean of X en respectively;
[0029] The self - correlation attention mechanism period dependencies are discovered by calculating the sequence self - correlation. For the real - valued discrete - time process {Xt}, the autocorrelation R is obtained through the following formula XX (τ):
[0030]
[0031] R XX (τ) reflects the time-delay similarity between {X t} and its τ-lagged sequence {X t-τ};
[0032] The formula of the autocorrelation attention mechanism is as follows:
[0033]
[0034] where argTopk(.) is the parameter for obtaining the Topk autocorrelation, and let k = |c × logL|, c is a hyperparameter; R Q,K is the autocorrelation between sequences Q and K; Roll(X, τ) represents the operation of delaying X by τ in time, and during this process, the elements shifted beyond the first position will be re-introduced to the last position.
[0035] Furthermore, in the sequence decomposition module, for the input sequence X ∈ R L×d with length L, the process is as follows:
[0036] X t = AvgPool(Padding(X))
[0037] X s = X - X t
[0038] where, X s and X t represent the seasonal and the extracted trend-cycle parts respectively.
[0039] Furthermore, the TCN module uses causal convolution and dilated convolution to improve the ability to capture long-term trends in time series; the TCN module consists of four dilated convolutional layers, four normalization layers, and four Dropout layers, and they are connected through a residual structure;
[0040] Each layer in the TCN module is padded with 0, and the padding size is the dilation rate of a convolutional kernel minus 1. The operation of dilated convolution on the time series S is defined as F, and its mathematical expression is as follows:
[0041]
[0042] where F(s) and X(* d f)(s) are the results of the convolution operation output, f(i) is the weight of the convolutional kernel, Xs-d·i is an element of the input sequence, and d is the dilation rate.
[0043] Furthermore, for the encoder of the l-th layer, its input is the encoded result output by the encoder of the (l - 1)-th layer and the output is the encoded result of this layer The specific calculation method is as follows:
[0044]
[0045] where is the result after convolution, Auto-Correlation(·) is the Auto-Correlation layer, SeriesDecomp(·) is the sequence decomposition layer, and TCN(·) is the fully connected layer.
[0046] Furthermore, for the decoder of the l-th layer, its input is the decoded result of the (l - 1)-th decoder and the output of the entire encoder and the output is the encoded result of this layer and the trend part of this layer The specific calculation method is as follows:
[0047]
[0048] where represents the output of the l-th decoding layer, represents the final output of the N-layer encoder, i ∈ {1, 2, 3} represents the seasonal part and the trend cycle part respectively after being processed by the i-th sequence decomposition module in the l-th decoding layer. ω l,i , i ∈ {1, 2, 3}, represents the weight of the i-th extracted trend and represents the summation of the final results.
[0049] The beneficial effects of the present invention are as follows: The traffic flow prediction method based on the CATformer model proposed by the present invention performs well in traffic flow prediction, not only improving the prediction accuracy but also having a wide application prospect. This model provides strong technical support for traffic management and related fields and is expected to play an important role in more practical scenarios in the future. The present invention has the following advantages:
[0050] (1) Accuracy: Through its own autocorrelation attention mechanism and sequence decomposition ability, it can improve the accuracy in traffic flow prediction.
[0051] (2) Wide application prospect: The model has good robustness and has a certain application prospect in many fields involving time series.
[0052] Other advantages, objectives, and features of the present invention will be elaborated to some extent in the subsequent description, and to some extent, will be obvious to those skilled in the art based on the study of the following text, or can be learned from the practice of the present invention. The objectives and other advantages of the present invention can be achieved and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be described in detail preferably with reference to the accompanying drawings, where:
[0054] Figure 1 is the architecture diagram of CATformer;
[0055] Figure 2 is the structural diagram of the CNN module;
[0056] Figure 3 is the structural diagram of the self - correlation attention mechanism;
[0057] Figure 4 is the difference between traditional convolution and dilated convolution;
[0058] Figure 5 is the convolution operation of TCN on one - dimensional data;
[0059] Figure 6 is the structural diagram of the TCN module;
[0060] Figure 7 is the prediction comparison of each model under traffic flow data. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0061] The following uses specific specific examples to illustrate the embodiments of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present invention schematically. Without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0062] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present invention schematically. Therefore, only the components related to the present invention are shown in the diagrams, rather than being drawn according to the number, shape, and size of the components during actual implementation. The types, quantities, and proportions of the components during actual implementation can be arbitrarily changed, and the component layout type may also be more complex.
[0063] In the following description, a large number of details are explored to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0064] The present invention aims to provide a traffic flow prediction method based on the CATformer model. The Auto-Correlation and Series decomposition modules are used to process the data, and at the same time, the CNN and TCN modules are introduced to enhance the sequence decomposition ability of the model and achieve efficient prediction of traffic flow.
[0065] ① The basic principle of traffic flow predictability
[0066] Within a certain period of time, traffic flow can be regarded as a time series data. The prediction of traffic flow is to infer the future trend or state of traffic flow based on the historical data of traffic flow, and the efficiency of its prediction results can help to make better decisions.
[0067] A time series refers to a series of data points arranged in chronological order. Each data point is usually collected and recorded at a specific timestamp, and it can reflect the change trend or behavior pattern of a variable in different time periods.
[0068] The core feature of time series data lies in time dependence, that is, there is usually an inherent time series relationship between data points. The data at the current moment is often affected by the data at the previous moment. This dependence relationship is the key to time series analysis and prediction.
[0069] The characteristics of time series mainly include the following points:
[0070] Sequencing: Time series data has the characteristic of time order. Time is an important dimension of data. Data points are not independent, and their sequencing is crucial for analysis. Each data point is associated with a timestamp and usually has a certain order according to the passage of time.
[0071] Time dependence: The data points in a time series are usually interdependent, that is, the data at a certain moment usually has a statistical relationship with the time points before or after. This dependence relationship determines how to predict future data.
[0072] Periodicity: Many time series data show cyclic and repetitive periodic changes.
[0073] Trend: Trend refers to the upward or downward trend shown by time series data over a long period of time.
[0074] Seasonality and Noise: Seasonal fluctuations are usually regular changes caused by factors such as seasons and holidays, while noise refers to the random fluctuation part in the data, which usually does not carry meaningful information.
[0075] The dataset used in this embodiment is the PEMS04 dataset, which is a high-quality dataset widely used in traffic flow prediction and traffic management research. The data statistics time is 59 days in total, including 3,848 detectors on 29 highways, and the traffic flow data, that is, the number of vehicles passing through the detectors, is recorded every 5 minutes.
[0076] Example 1:
[0077] In the present invention, the prediction of vehicle flow is based on the CATformer model. This model is based on the seq2seq architecture and uses the Auto-Correlation attention mechanism and the Series decomposition module to process the data. At the same time, the CNN and TCN modules are introduced to enhance the sequence decomposition ability of the model.
[0078] Specifically, the Auto-Correlation attention mechanism calculates the self-correlation of the sequence and uses time delay to aggregate similar subsequences, thereby discovering period-based dependencies.
[0079] The Series decomposition module uses the moving average method to decompose the sequence into two parts: trend-cycle and season, to smooth the periodic fluctuations and emphasize the long-term trend. In addition, the CNN and TCN modules introduced in CATformer are used to capture local features and long-term trends to enhance the sequence decomposition ability of the model. Through multi-scale information fusion, CATformer has excellent performance in vehicle flow prediction. The overall structure of the model includes two parts: the encoder Encoder and the decoder Decoder, as Figure 1 shown.
[0080] Next, each module in the model will be introduced in turn, and then the connection relationship of each module in the Encoder layer and the Decoder layer will be introduced.
[0081] (1) CNN module
[0082] In order to improve the spatio-temporal feature extraction ability of the model for vehicle flow data and the speed of result prediction, this paper uses the CNN model to extract and combine the local spatio-temporal features of the data, and can also reduce the dimension of the input data and improve the processing speed of the model. The constructed convolutional layer structure is as Figure 2As shown, the neural network contains two two-dimensional convolutional layers: convolutional layer 1 and convolutional layer 2, with the convolutional kernel sizes being [5×6] and [3×3] respectively, and the padding parameters of the convolutional layers being [1×3] and [1×1] respectively. Secondly, the neural network contains a max pooling layer, with the convolutional kernel size being [2×2] and the stride parameter being [2×2].
[0083] (2) Sequence decomposition module
[0084] The sequence decomposition module uses the moving average method to decompose the sequence into two parts: trend-cycle and season. This method can smooth the periodic fluctuations and emphasize the long-term trend.
[0085] (3) Autocorrelation attention mechanism module
[0086] The autocorrelation attention mechanism discovers period-based dependencies by calculating the autocorrelation of the sequence and aggregates similar subsequences through time delay. Its structure diagram is as Figure 3 shown. The present invention uses the autocorrelation R(τ) as the unnormalized confidence of the estimated period length τ. Then, the k most likely period lengths τ1,...,τk are selected. The period-based dependencies are derived from the above-estimated periods and can be weighted by the corresponding autocorrelations.
[0087] For the single-head case and a time series X of length L, after projecting the data processed by the convolutional layer, query Q, key K, and value V are obtained.
[0088] (4) TCN module
[0089] The TCN neural network is a time series prediction model based on the convolutional neural network. Compared with traditional sequence processing models such as RNN and LSTM, it has the advantages of high computational efficiency, strong parallelism, and strong ability to process long sequences.
[0090] The TCN neural network has good performance and advantages in dealing with time series prediction problems. Compared with the traditional convolutional layer in CNN, TCN uses causal convolution and dilated convolution to improve the model's ability to capture long-term trends in time series.
[0091] Figure 4 Shows the differences in convolutional kernel design between traditional convolution and dilated convolution. The size of the traditional convolutional kernel is fixed, the weights are the same, and the receptive field is limited. While dilated convolution can introduce a dilation parameter, allowing intervals inside the convolutional kernel, so that the weights can expand unrestrictedly, thereby obtaining more extensive context information, better capturing long-term dependencies in time series data, and without increasing the model complexity.
[0092] Figure 5It shows the causal convolution and dilated convolution adopted by the TCN when processing one-dimensional time series data. Causal convolution ensures that the value at each time step in each layer only depends on the value at the previous time step in the previous layer, so it only uses known information. In dilated convolution, the extraction of information from the previous layer in each layer is in a skip manner, and the dilation rate (span) increases exponentially with a base of 2 layer by layer.
[0093] To enhance the ability of the CATformer model to capture long-term trends in time series data and at the same time expand the model's perception range of local features, a TCN module is introduced. It consists of four dilated convolution layers, four normalization layers, and four Dropout layers, and they are connected through a residual structure. Figure 6 It shows the TCN structure in the model.
[0094] (5) Encoder
[0095] The Encoder mainly encodes the spatio-temporal features, periodic features, and trend features of multivariate data through an N-layer branch structure to improve the model's feature expression ability and prediction accuracy. Specifically, the Encoder layer of CATformer contains multiple CNN layers, Auto-Correlation layers, sequence decomposition layers, and TCN layers.
[0096] (6) Decoder
[0097] The Decoder mainly decodes the features of the trend part and the seasonal part through an M-layer branch structure, with a focus on decoding the features of the trend part. Specifically, the Decoder layer of CATformer contains multiple Auto-Correlation layers, sequence decomposition layers, and TCN layers.
[0098] Model evaluation:
[0099] To evaluate the performance of the traffic flow prediction model, the mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE) are used.
[0100]
[0101] To verify the effectiveness of the CATformer model in traffic flow prediction, several other mainstream models are selected for comparison in this study. They mainly include the Autoformer model, Informer model, Reformer model, and Transformer model. The experimental results are shown in Table 1.
[0102] Table 1
[0103]
[0104] According to the results in the table, the CATformer model performs best in the dataset and achieves the optimal results in all evaluation metrics (MAE, RMSE, MAPE). Compared with other models, the overall performance of this method in traffic flow prediction has been improved, and it also has obvious advantages compared with other models in predicting the dataset.
[0105] Figure 7 The comparison between the prediction results of the traffic flow data-based model and the true values is shown. It can be seen that the model based on the attention mechanism can better maintain the shape of the original curve compared with other models such as Informer and Reformer. In addition, it can be seen that the predicted values of CATformer are closest to the true values, indicating that its prediction accuracy is more obvious and the prediction results are more stable.
[0106] Example 2:
[0107] Optionally, a data embedding layer is provided before the Encoder of the CATformer model for dimensional transformation of the input data X en and then input it into the Encoder for feature extraction. The specific formula is as follows:
[0108] X enc = Conv2D(X en )
[0109] X enc = Embed(X enc , X mark_enc )
[0110] where X en is the past I time steps X en ∈R I×d , and Embed(·) is the data embedding layer for embedding X en and the labeled data X Maek_enc into the vector space of dimension d model .
[0111] In the sequence decomposition module of the CATformer model, for the input sequence X ∈ R of length L L×d , the process is as follows:
[0112] X t = AvgPool(Padding(X))
[0113] X s = X - X t
[0114] where, X s and X tRepresent the seasonal and the extracted trend-cycle components respectively.
[0115] In the autocorrelation attention mechanism of the CATformer model, the input of the autocorrelation attention mechanism part is the past I time steps X en ∈R I×d of the convolution. In the Decoder part, the input includes the seasonal part Xd es∈ R (I / 2+o)×d that needs to be improved and the trend-cycle part X det ∈R (I / 2+o)×d . Each initialization includes two parts: the components decomposed from the second half of the Encoder input X enI / 2:I , providing the most recent information; the placeholder of length O is filled with scalars. The specific formula is as follows:
[0116] X ens , X ent = SeriesDecomp(X en I / 2:I )
[0117] X des = Concat(X ens , X0)
[0118] X det = Concat(X ent , X Mean )
[0119] where X ens and X ent ∈R I / 2×d represent the seasonal and trend-cycle components of X en , X0 and X Mean ∈R o×d represent the placeholders filled with zeros and the mean of X en respectively.
[0120] The autocorrelation attention mechanism's periodic dependencies can be discovered by calculating the sequence autocorrelation. For the real-valued discrete-time process {X t}, the autocorrelation R XX (τ) can be obtained through the following formula:
[0121]
[0122] R XX (τ) reflects the time-delay similarity between {X t} and its τ-lagged sequence {X t-τ}.
[0123] The formula of the autocorrelation attention mechanism itself is as follows:
[0124]
[0125] Among them, argTopk(.) is the parameter for obtaining the Topk autocorrelation, and let k = |c×logL|, where c is a hyperparameter. R Q,K is the autocorrelation between sequences Q and K. Roll(X,τ) represents the operation of delaying X by time τ. During this process, the elements shifted beyond the first position will be reintroduced to the last position.
[0126] In the TCN module of the CATformer model, due to the use of dilated convolution, each layer needs to be padded, generally padded with 0, and the padding size is the dilation rate of a convolution kernel minus 1. The operation of dilated convolution on the time series S is defined as F, and its mathematical expression is as follows:
[0127]
[0128] In the CATformer model, for the Encoder of the l-th layer, its input is The output is the encoding result of this layer The specific calculation method is as follows:
[0129]
[0130] Among them is the result after convolution, Auto-Correlation(·) is the Auto-Correlation layer, SeriesDecomp(·) is the sequence decomposition layer, and TCN(·) is the fully connected layer.
[0131] For the Decoder of the l-th layer, its input is the output of the previous layer and the output of the Encoder The output is the encoding result of this layer and the trend part of this layer The specific calculation method is as follows:
[0132]
[0133] Therefore, the entire model can be described as follows: This model is based on the Seq2Seq architecture, and deeply processes the data through the autocorrelation attention mechanism and the sequence decomposition module to capture the key features in the time series. At the same time, the model introduces the convolutional neural network (CNN) and the temporal convolutional network (TCN) modules to further enhance its sequence decomposition ability, thus significantly improving the accuracy of traffic flow prediction.
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the present technical solution, and they should all be covered within the scope of the claims of the present invention.
Claims
1. A vehicle flow prediction method based on a CATformer model, characterized in that: The following steps are involved: Input the traffic flow data into a CATformer model, wherein the CATformer model consists of a data embedding layer, a multi-layer encoder and a decoder; The data embedding layer is used to transform the dimension of the input data before the encoder; The input of the first layer encoder is traffic flow data, and the output is the encoding result of the spatiotemporal characteristics, periodicity and trend characteristics of the input data; The input of each subsequent layer of encoder is the encoding result output by the previous layer of encoder, and the output is the encoding result of the spatiotemporal features, periodicity and trend features of this layer; The input of the first layer decoder is the encoding result output by the encoder of this layer and the initialized trend-cycle part and seasonal part features, and the output is the encoding result and trend part of this layer; The input of each subsequent layer of decoders is the decoding result output by the previous layer of decoders and the output of the encoder; The output is the coding result and trend part of this layer; After the traffic flow data is encoded and decoded by multiple layers of encoders and decoders, the traffic flow prediction results within a period of time are obtained.
2. The method for predicting vehicle flow based on the CATformer model according to claim 1, characterized in that: The encoder is composed of a CNN module, an autocorrelation attention mechanism module, a sequence decomposition module, a TCN module, and a sequence decomposition module connected in sequence; The CNN module is used to extract and combine local spatiotemporal features of data to reduce the dimension of input data; The autocorrelation attention mechanism module discovers period-based dependencies by computing the autocorrelation of the sequence and aggregating similar subsequences through time delays; The series decomposition module uses the moving average method to decompose the series into two parts: trend-cycle and seasonality, so as to smooth the periodic fluctuations and emphasize the long-term trend; The TCN module is used to capture the mid- to long-term trends in time series.
3. The method for predicting vehicle flow based on the CATformer model according to claim 1, characterized in that: The CNN module includes two two-dimensional convolutional layers, each of which is connected to a ReLU function and finally to a maximum pooling layer to extract and combine the local spatiotemporal features of the data and reduce the dimension of the input data. The specific formula is as follows: X enc =Conv2D(X en ) X enc =Embed(X enc ,X mark_enc ) Where X en is the past I time steps, X en ∈R I×d , Embed(·) is the data embedding layer used to embed X en and labeled data X Maek_enc Embedded in d model dimensional vector space.
4. The method for predicting vehicle flow based on the CATformer model according to claim 1, characterized in that: The decoder consists of an autocorrelation attention mechanism module, a sequence decomposition module, an attention mechanism module, a sequence decomposition module, a TCN module, a sequence decomposition module, and a TCN module connected in sequence.
5. The method for predicting vehicle flow based on the CATformer model according to claim 1, characterized in that: The autocorrelation attention mechanism module uses the autocorrelation R(τ) as the unnormalized confidence of the estimated period length τ; then selects the most likely k period lengths τ1,...,τk; the period-based dependencies are derived from the above estimated periods and weighted by the corresponding autocorrelations; The input of the autocorrelation attention mechanism module is the past I time steps X en ∈R I×d convolution; in the decoder, the input includes the seasonal part X that needs to be improved des ∈R (I / 2+o)×d and the trend-cycle part X det ∈R (I / 2+o)×d ; The two parts represent: the second half of the encoder input X enI / 2:I The components decomposed from are used to provide the most recent information; the placeholder of length O is filled by a scalar; the specific formula is as follows: X ens ,X ent =SeriesDecomp(X enI / 2:I ) X des =Concat(X ens ,X0) X det =Concat(X ent ,X Mean ) Among them, X ens and X ent ∈R I / 2×d Represents X en The seasonal and trend-periodic parts of X0 and X Mean ∈R o×d Respectively indicate filling with zeros and Xs en Placeholder for the mean; Autocorrelation attention mechanism The periodic dependency is found by calculating the sequence autocorrelation. For a real discrete time process {X t }, the autocorrelation R is obtained by the following formula XX (τ): R XX (τ) reflects {X t } and its τ-lag sequence {X t-τ } time delay similarity between; The formula of the self-correlation attention mechanism is as follows: where argTopk(.) is the parameter to obtain the Topk autocorrelation, and let k = |c×logL|, c is a hyperparameter; R Q,K is the autocorrelation between sequences Q and K; Roll(X,τ) represents an operation of subjecting X to a time delay of τ, during which elements shifted beyond the first position are reintroduced to the last position.
6. The method for predicting vehicle flow based on the CATformer model according to claim 1, characterized in that: In the sequence decomposition module, for an input sequence X∈R with a length of L L×d , the process is as follows: X t =AvgPool(Padding(X)) X s =X-X t Among them, X s and X t denote the seasonality and the extracted trend-period part, respectively.
7. The method for predicting vehicle flow based on the CATformer model according to claim 1, characterized in that: The TCN module uses causal convolution and dilated convolution to improve the ability to capture long-term trends in time series; the TCN module consists of four dilated convolution layers, four normalization layers, and four Dropout layers, which are connected by a residual structure; Each layer in the TCN module is padded with 0, and the padded size is the expansion rate of a convolution kernel minus 1. The operation of the dilated convolution on the time sequence S is defined as F, and its mathematical expression is as follows: Where F(s) and X(* d f)(s) is the output of the convolution operation, f(i) is the weight of the convolution kernel, and X s-d·i are the elements of the input sequence and d is the dilation rate.
8. The method for predicting vehicle flow based on the CATformer model according to claim 1, characterized in that: For the encoder of layer l, its input is the encoded result output by the encoder of layer l-1 The output is the encoding result of this layer The specific calculation method is as follows: in is the result after convolution, Auto-Correlation(·) is the Auto-Correlation layer, SeriesDecomp(·) is the sequence decomposition layer, and TCN(·) is the fully connected layer.
9. The method for predicting vehicle flow based on the CATformer model according to claim 1, characterized in that: For the decoder of layer l, its input is the decoding result of decoder l-1 and the output of the entire encoder The output is the encoding result of this layer and the trend part of this layer The specific calculation method is as follows: in represents the output of the lth decoding layer, represents the final output of the N-layer encoder, i∈{1,2,3} represents the seasonal part and trend cycle part after being processed by the i-th sequence decomposition module in the l-th decoding layer respectively; ω l,i , i∈{1,2,3}, represents the i-th extracted trend The weight of Indicates the final sum of results.