Traffic flow prediction method based on time-space synchronization embedded graph Transform model
By introducing the spatial-temporal synchronous embedded graph Transformer model in the traffic flow prediction method, combining the adaptive coding mechanism and multi-dimensional feature fusion, the limitations of existing methods in spatial-temporal feature synchronization modeling and dynamic spatial dependency capture are solved, and the accuracy of traffic flow prediction and the generalization ability of the model are significantly improved.
Patent Information
- Application Number
- CN202510284614.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-05-30
AI Technical Summary
The existing traffic flow prediction methods have significant limitations in modeling spatial and temporal dependencies, and it is difficult to capture spatial and temporal characteristics simultaneously, and do not fully consider the dynamic characteristics of spatial dependencies in traffic systems.
A traffic flow prediction method based on the Transformer model of the space-time synchronous embedded graph is proposed. Through an innovative adaptive coding mechanism and multi-dimensional feature fusion method, the synchronous modeling of space-time features is realized. This method deeply integrates the original features, temporal features, periodic features and space-time features of traffic flow, and realizes deep interaction of multi-dimensional features through attention mechanism.
It effectively overcomes the limitations of space-time module separation in traditional methods, can capture dynamic spatial dependencies in the traffic system, significantly improves the accuracy of traffic flow prediction, and improves the generalization ability and prediction accuracy of the model.
Smart Images

Figure CN120071622A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of transportation technologies, and particularly to a traffic flow prediction method based on a spatio-temporal synchronous embedding graph Transformer model. Background Art
[0002] Due to different divisions of urban functions, different regions have different traffic patterns. Most existing models capture temporal and spatial dependencies using separate spatio-temporal blocks. For example, traditional methods capture temporal features through recurrent neural networks (RNNs) and combine graph convolutional networks (GCNs) to extract spatial dependencies. However, such methods have significant drawbacks. First, the separate modeling severs the correlation of spatio-temporal features, making it difficult for the model to capture such complex interactions. Second, to improve prediction accuracy, existing technologies usually adopt a strategy of stacking multiple spatio-temporal modules, but this brings a problem of a sharp increase in computational complexity, seriously restricting real-time requirements.
[0003] In summary, existing traffic flow prediction methods have significant limitations in modeling spatio-temporal dependencies. First, the extraction of spatio-temporal features often uses separate temporal and spatial modules, making it difficult to achieve synchronous capture of spatio-temporal features. Second, existing methods mainly model spatial dependencies based on static assumptions and fail to fully consider the dynamic characteristics of spatial dependencies in the traffic system, which are actually affected by multiple factors such as regional functional differences and changes in travel patterns. Summary of the Invention
[0004] Aiming at the above technical defects, the present invention provides a traffic flow prediction method based on a spatio-temporal synchronous embedding graph Transformer model, and proposes an innovative embedding mechanism. By deeply fusing the original features, temporal features, periodic features, and spatio-temporal features of traffic flow, adaptive modeling of multi-dimensional features is achieved. In particular, the present invention creatively introduces adaptive coding of traffic data into the prediction network. Through attention mechanism interaction with multi-dimensional features, not only synchronous modeling of spatio-temporal correlation is realized, but also the accuracy of traffic flow prediction is significantly improved.
[0005] The following is the first aspect of the present invention, which provides a traffic flow prediction method based on a spatio-temporal synchronous embedding graph Transformer model. The method includes:
[0006] Obtain the historical traffic flow sequence data of the target area and preprocess it to obtain the preprocessed historical traffic flow sequence data;
[0007] Define the traffic road network of the target area as an undirected graph, calculate the static adjacency matrix based on the graph structure, and then obtain the spatial coding features through a fully connected layer Wherein, N is the number of monitoring points of the traffic road network in the target area, that is, the number of nodes, and T is the time length of the historical traffic flow sequence data;
[0008] Based on the preprocessed historical traffic flow sequence data, extract the original flow features through the fully connected layer
[0009] Construct a feature representation including weekly cycle, daily cycle and time stamp, and embed the feature representations of weekly cycle, daily cycle and time stamp into the preprocessed historical traffic flow sequence data respectively through the fully connected layer to obtain the weekly cycle feature Daily cycle feature And time stamp feature
[0010] Based on the spatio-temporal adaptive embedding mechanism, obtain the adaptive spatio-temporal feature
[0011] Obtain the hidden spatio-temporal representation through feature concatenation Where Concat(·) represents the concatenation operation, and d s , d f , d w , d d , d t And d a Are all feature dimensions, and d h = d s + d f + d w + d d + d t + d a Is the feature dimension after concatenation;
[0012] Based on the hidden spatio-temporal representation H, extract the spatio-temporal dependence features of traffic flow along the time dimension and space dimension respectively through the dual-channel attention mechanism to obtain the enhanced spatio-temporal feature representation Z′;
[0013] Based on the enhanced spatio-temporal feature representation Z′, generate the traffic flow prediction values of each node in the future time period through the fully connected output layer.
[0014] In some embodiments, the method adopts a sliding window mechanism, uses the historical traffic flow sequence data as input, and outputs the traffic flow prediction values for the next τ time steps, specifically as follows:
[0015] The traffic flow at the monitoring point v i At time t is expressed as Then the traffic flow of all monitoring points at time t is expressed as the feature matrix The historical traffic flow sequence data is expressed as {X t-T+1 , X t-T+2 ,..., Xt}, and the predicted traffic flow values for the next τ time steps are represented as {Y t+1 , Y t+2 ,..., Y t+τ}; where v i represents the i-th monitoring point, and Y t +τ represents the feature matrix at time t + τ.
[0016] In some embodiments, the preprocessing includes normalization, and the formula is as follows:
[0017]
[0018] In the formula, X norm represents the normalized value, and mean(X) and std(X) represent the mean value and the standard deviation respectively.
[0019] In some embodiments, the traffic road network of the target area is defined as an undirected graph, and the static adjacency matrix is calculated based on the graph structure, including:
[0020] Taking the monitoring points as nodes to form a node set V = {v 1 , v 2 ,..., v N}, and the connection relationships between the monitoring points form an edge set E. Thus, the traffic road network is defined as an undirected graph G = (V, E) to describe the topological structure of the road network;
[0021] Define the static adjacency matrix A ∈ R N×N to represent the connection relationships between the monitoring points, where the matrix element a ij ∈ {0, 1}. When a ij = 1, it means there is a connection relationship between nodes v i and v j , and when a ij = 0, it means there is no connection relationship.
[0022] In some embodiments, constructing a feature representation including a weekly cycle, a daily cycle, and a time stamp, including:
[0023] The feature representation of the weekly cycle is T W ∈ R T , and the value range is [0, 6], representing the time features of the seven days of a week;
[0024] The feature representation of the daily cycle is T D ∈ R T , and the value range is [0, 23], representing the time features of 24 hours of a day;
[0025] The feature representation of the time stamp is T T ∈ RT , with a value range of [0, m], representing the time characteristics of m time intervals within a day.
[0026] In some embodiments, based on the spatio-temporal adaptive embedding mechanism, adaptive spatio-temporal features are obtained, including:
[0027] Create a learnable parameter matrix whose parameters are automatically optimized through the backpropagation algorithm during the training process, used to capture the spatio-temporal change characteristics in traffic flow data, thereby realizing the adaptive modeling of complex spatio-temporal dependence relationships;
[0028] This parameter matrix is obtained at the end of the training.
[0029] In some embodiments, the dual-channel attention mechanism includes:
[0030] Given the hidden spatio-temporal representation Calculate the query matrix The key matrix And the value matrix where is a learnable parameter;
[0031] Calculate the temporal self-attention score:
[0032]
[0033] where A te ∈R N×T×T , used to capture the temporal dependence relationships between different spatial nodes;
[0034] Then the output of the temporal attention layer is
[0035] Z te =FeedForward(A te V te )
[0036] where FeedForward(·) is the operation of the feed-forward layer;
[0037] Similarly, the spatial attention layer performs the following operations:
[0038] Z se =FeedForward(SelfAttention(Z te ))
[0039] where the SelfAttention(·) operation is the same as the operation of obtaining the attention score and the final output in the temporal attention layer;
[0040] Finally, through residual connection and layer normalization operations, an enhanced spatio-temporal feature representation Z′ is obtained.
[0041] In some of these embodiments, traffic flow prediction values for each node in the future time period are generated through a fully connected output layer, including:
[0042]
[0043] In the formula, FC(·) represents the fully connected layer, represents the traffic flow prediction values for all monitoring points in the next τ time steps.
[0044] According to a second aspect of the present invention, there is provided a computer device, including: a processor and a memory, the memory stores a program or instructions that can run on the processor, and when the program or instructions are executed by the processor, the steps of the traffic flow prediction method based on the spatio-temporal synchronous embedding graph Transformer model described in any one of the first aspect are implemented.
[0045] According to a third aspect of the present invention, there is provided a readable storage medium, on which a program or instructions are stored, and when the program or instructions are executed by the processor, the steps of the traffic flow prediction method based on the spatio-temporal synchronous embedding graph Transformer model described in any one of the first aspect are implemented.
[0046] Generally speaking, compared with the prior art through the above technical solutions conceived by the present invention, the following beneficial effects can be achieved:
[0047] Through the innovative adaptive coding mechanism and multi-dimensional feature fusion method of the present invention, synchronous modeling of spatio-temporal features is achieved, effectively overcoming the limitations of the separation of spatio-temporal modules in traditional methods; the model can not only capture the dynamic spatial dependence relationships in the traffic system, fully consider the impacts of regional functional differences and travel pattern changes, but also achieve deep interaction of multi-dimensional features through the attention mechanism, significantly improving the modeling accuracy of spatio-temporal correlation; this innovative design of deeply fusing the original features, time features, periodic features and spatio-temporal features of traffic flow makes the model have stronger generalization ability and prediction accuracy, providing a reliable technical support for the construction of intelligent transportation systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 is a schematic flowchart of a traffic flow prediction method based on a spatio-temporal synchronous embedding graph Transformer model provided by an embodiment of the present application;
[0049] Figure 2 is a diagram of a multi-head attention mechanism provided by an embodiment of the present application;
[0050] Figure 3A spatio-temporal interaction graph of different traffic sequence tokens provided by an embodiment of the present application; wherein, Figure 3 (a) in it is a schematic diagram of a traffic flow sequence, Figure 3 and (b) in it is a schematic diagram of temporal attention, Figure 3 and (c) in it is a schematic diagram of spatial attention;
[0051] Figure 4 A schematic diagram of the hardware structure of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0052] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. Based on the embodiments provided in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the protection scope of the present invention.
[0053] Obviously, the accompanying drawings in the following description are only some examples or embodiments of the present application. For those of ordinary skill in the art, the present application can be applied to other similar scenarios based on these drawings without making creative efforts. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for those of ordinary skill in the art related to the content disclosed in the present application, some design, manufacturing or production changes based on the technical content disclosed in the present application are only conventional technical means and should not be understood as insufficient disclosure of the present application.
[0054] In the present application, referring to "embodiment" means that a specific feature, structure or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The phrase appears in various positions in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those of ordinary skill in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments without conflict.
[0055] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the ordinary meanings understood by those with ordinary skills in the technical field to which this application belongs. The words such as "a", "an", "one kind", "the" and the like involved in this application do not indicate a quantity limitation and may represent a singular or plural number. The terms "include", "comprise", "have" and any variations thereof involved in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may further include steps or units not listed, or may further include other steps or units inherent to these processes, methods, products or devices. The words such as "connect", "be connected", "couple" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, "A and / or B" may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the front and rear associated objects. The terms "first", "second", "third" and the like involved in this application are only used to distinguish similar objects and do not represent a specific order for the objects.
[0056] This application provides a traffic flow prediction method based on a spatio-temporal synchronous embedding graph Transformer model, and proposes a graph Transformer architecture based on spatio-temporal synchronous embedding (STGET). Based on the Transformer model architecture, this method innovatively designs an embedding method to synchronously model time and space dependence relationships, improving the accuracy of traffic flow prediction.
[0057] As Figure 1 shown, the traffic flow prediction method based on the spatio-temporal synchronous embedding graph Transformer model of this application proposes a traffic flow prediction model of spatio-temporal synchronous embedding graph Transformer. This model can effectively improve the prediction accuracy of traffic flow. The method includes the following steps:
[0058] S1. Preprocess the original data collected in real time through the sensor network to form a standardized traffic flow data set.
[0059] S2. Traffic network topology modeling and spatial feature encoding: Define the traffic network of the target area as an undirected graph G=(V, E), and calculate the static adjacency matrix A∈R N×N , where N is the number of nodes, to realize the mathematical representation of the road network spatial topology structure and provide a basis for subsequent spatial feature encoding.
[0060] S3. Multi - dimensional traffic information fusion and feature encoding: Extract multi - dimensional feature information from the pre - processed traffic flow sequence data, including original flow features, time - dimension features, periodic features, and adaptive spatio - temporal features, and achieve effective information fusion through encoding.
[0061] S4. Design a dual - channel attention mechanism, where the temporal attention captures the dependencies of traffic flow at different time scales, and the spatial attention mines the spatial correlations between road network nodes, highlighting important spatial features.
[0062] S5. Generate traffic flow prediction values for each node in the future period through a fully - connected output layer, providing data support for traffic management and decision - making.
[0063] First, the specific implementation of step S1 is as follows: In this embodiment, the PEMS03 and PEMS04 datasets in a real - road scenario are selected as the experimental data source. The data collection frequency of this dataset is once every 20 seconds, and data aggregation processing is performed at 5 - minute intervals. As shown in Table 1, this embodiment divides the dataset into a training set, a validation set, and a test set in a ratio of 6:2:2, and adopts a sliding window mechanism, using the traffic flow data of the previous hour as input to predict the traffic flow of the next hour.
[0064] Table 1 Dataset description table
[0065]
[0066] The data is standardized through a normalization method to unify the dimension and numerical range of each feature. The normalization calculation formula is as follows:
[0067]
[0068] where, X norm represents the normalized value, and mean(X) and std(X) represent the mean and standard deviation based on the training set.
[0069] Next, the specific implementation of step S2 is as follows: Since the target traffic road network contains N monitoring points, that is, the number of nodes, forming a node set V = {v 1 , v 2 ,..., v N}, the connection relationships between the monitoring points form an edge set E. The traffic network is abstracted as an undirected graph G=(V, E) to describe the topological structure of the road network. Define a static adjacency matrix A ∈ R N×N to represent the connection relationships between the monitoring points, where the matrix element a ij ∈{0, 1}, when a ij = 1, it means that node v i is connected to vj There is a connection relationship, where a ij = 0 indicates no connection relationship.
[0070] According to the static adjacency matrix A, the encoding result is obtained through a fully connected layer It can be expressed as:
[0071] E s = FC(A)
[0072] where FC(·) represents the fully connected layer to achieve dimensional adjustment for facilitating splicing and fusion with other features.
[0073] At time t, the traffic flow of the monitoring point v i can be expressed as Then the traffic flow of all monitoring points at time t can be expressed as a feature matrix Let the length of the historical time series be T and the length of the prediction time series be τ. Then the input of the model at time t is the historical traffic flow sequence {X t-T+1 , X t-T+2 ,..., X t} and its time t, and the output is the traffic flow prediction values {Y t+1 , Y t+2 ,..., Y t+τ} for the next τ time steps.
[0074] The specific implementation method of step S3 is as follows: First, in order to preserve the original information in the raw data, in this embodiment, a fully connected layer is used to obtain the feature embedding
[0075] E f = FC({X t-T+1 , X t-T+2 ,..., X t})
[0076] where the dimension of the feature embedding is d f , and FC(·) represents the fully connected layer.
[0077] In order to capture the periodic characteristics of the traffic flow, in this embodiment, a feature representation including daily cycle, weekly cycle, and time stamp is constructed. Among them, the weekly cycle feature T W ∈R T , and its value range is [0, 6], representing the time feature of seven days in a week; the daily cycle feature T D ∈R T , and its value range is [0, 23], representing the time feature of 24 hours in a day; the time stamp feature T T ∈R T, with a value range of [0, 287], represents the time information of 288 time intervals (one interval every 5 minutes) within a day, and its specific value is determined according to the moment t. Then, these features are embedded through a fully connected layer to obtain and where d w = 7, d d = 24, d t = 288 represent the embedding dimensions of the weekly cycle, daily cycle, and timestamp respectively, N is the number of nodes, and T is the historical time step. These embedding representations encode the time information of each node at each time step and are input into the model.
[0078] Meanwhile, in order to model the spatio-temporal dependence of traffic flow, a spatio-temporal adaptive embedding mechanism is designed which designs a learnable parameter matrix whose parameters are automatically optimized through the backpropagation algorithm during model training and are used to capture the spatio-temporal variation features in traffic flow data, thereby realizing the adaptive modeling of complex spatio-temporal dependence relationships in different datasets.
[0079] Finally, the hidden spatio-temporal representation is obtained through feature concatenation where d h = d s + d f + d w + d d + d t + d a is the dimension of the concatenated features.
[0080] The specific implementation method of step S4 is as follows:
[0081] This application uses the Transformer architecture as the core framework, and its core innovation lies in the multi-head attention mechanism. As Figure 2 shown, the multi-head attention mechanism realizes the comprehensive extraction of information by calculating multiple attention heads in parallel. Its core lies in the interactive calculation of the query matrix Q, key matrix K, and value matrix V, where the output result is the weighted sum of the value vectors V, and the weight coefficients are determined by the similarity calculation of Q and K; this mechanism projects the input Q, K, and V into h different subspaces respectively, calculates the attention distribution independently in each subspace and generates the corresponding d h -dimensional output, and then concatenates the outputs of these subspaces and obtains the final output representation through a linear transformation, thereby achieving the goal of jointly capturing diverse information from multiple feature subspaces. Figure 3 This is a spatio-temporal interaction graph of different traffic sequence tokens provided by an embodiment of this application; where Figure 3In (a) is a schematic diagram of the traffic flow sequence, Figure 3 in (b) is a schematic diagram of temporal attention, Figure 3 and in (c) is a schematic diagram of spatial attention.
[0082] Specifically, this embodiment designs a dual-channel attention mechanism based on the Transformer architecture to extract spatio-temporal dependence features of traffic flow along the temporal and spatial dimensions respectively. Given the hidden spatio-temporal representation Calculate the query matrix key matrix and value matrix where are learnable parameters. Calculate the temporal self-attention score:
[0083]
[0084] where A te ∈R N×T×T can capture the temporal dependence relationships between different spatial nodes.
[0085] Then, the output of the temporal attention module is
[0086] Z te = FeedForward(A te V te )
[0087] where FeedForward(·) is the operation of the feed-forward layer.
[0088] Similarly, the spatial attention layer performs the following operations:
[0089] Z se = FeedForward(SelfAttention(Z te ))
[0090] where the SelfAttention(·) operation follows the operations of obtaining the attention score and getting the final output in the temporal attention operation. At the same time, represents the output after the attention operation and the feed-forward operation of the spatial correlation features under different time frames.
[0091] Finally, through the residual connection and layer normalization operations, an enhanced spatio-temporal feature representation Z′ is obtained. This step effectively improves the model's ability to model complex spatio-temporal relationships by calculating the feature interactions of multiple subspaces in parallel through the multi-head attention mechanism.
[0092] Finally, the specific implementation method of step S5 is as follows: Based on the spatio-temporal feature representation extracted by the spatio-temporal Transformer layer The predicted traffic flow values for the next τ time steps are generated through the fully connected output layer. The prediction process can be expressed as:
[0093]
[0094] where is the predicted output, τ represents the time step of prediction. In this embodiment, τ = 12, and d = 1 is the dimension of the output layer features. Therefore, the fully connected layer maps the d h dimensional feature space to a 1-dimensional traffic flow prediction space, achieving accurate prediction of the traffic flow for the next τ time steps at each monitoring point, and providing reliable data support for the real-time decision-making and road network optimization of the traffic management department.
[0095] In the embodiment of this application, a comprehensive comparative experiment is conducted on the proposed model with widely used baseline models and the current state-of-the-art (SOTA) models. The detailed information of each comparative model is as follows:
[0096] (1) Historical Average (HA): Model the traffic demand as a seasonal process and predict the traffic flow for the next 12 time steps using the average value of the previous 24 time steps.
[0097] (2) Vector Auto-Regressive (VAR): A classical statistical model based on multivariate time series analysis, which makes predictions by establishing linear dependencies between variables.
[0098] (3) Fully Connected LSTM (FC-LSTM): Introduce a fully connected layer on the basis of the standard LSTM to enhance the representation ability of spatio-temporal features.
[0099] (4) Spatio-Temporal Graph Convolutional Networks (STGCN): Combine graph convolution and temporal convolution to capture both spatial topology and time-dependent features simultaneously.
[0100] (5) Graph WaveNet: Achieve dynamic spatial dependence modeling through adaptive adjacency matrices and graph convolution operations.
[0101] (6) MTGNN: Fuse external knowledge and one-way relationships between variables through a graph learning module, and capture spatial and temporal dependencies using a mix-hop propagation layer and dilated inception simultaneously.
[0102] (7) DDGCRN: Generate spatio-temporal embeddings based on the time information in traffic signals, and then combine the spatio-temporal embeddings with the dynamic signals extracted from traffic signals to generate dynamic graph embeddings for generating dynamic graphs.
[0103] (8) STID: Proposed a simple model structure based on sequence, time, and space encoding. Achieved efficient and accurate prediction using a simple framework.
[0104] (9) STAEFormer: Based on the Transformer architecture, model global spatio-temporal dependencies through the self-attention mechanism.
[0105] Traditional time series prediction methods have obvious limitations in traffic flow prediction tasks: The statistical-based HA and VAR methods have poor prediction effects because they cannot effectively process non-linear data; The FC-LSTM method based on machine learning has improved compared with traditional statistical methods, but still performs mediocrely when dealing with large-scale traffic data; The STGCN method based on deep learning can capture spatial and time features respectively, but it is limited to the modeling of static spatial relationships, and the prediction performance still needs to be improved. In view of the deficiencies of the baseline methods, researchers proposed a new prediction model based on the adaptive graph structure and the Transformer architecture. Models such as GraphWaveNet, MTGNN, DDGCRN, STID, and STAEFormer realized the joint modeling of complex spatio-temporal dependencies by introducing dynamic graph convolution or self-attention mechanisms. However, these methods did not fully consider the heterogeneity of spatio-temporal features during the modeling process and lacked the ability to synchronously model spatio-temporal dependencies, resulting in limited prediction accuracy.
[0106] The traffic flow prediction model proposed in this application has significant technical advantages: Through the innovative adaptive coding mechanism and multi-dimensional feature fusion method, it realizes the synchronous modeling of spatio-temporal features, effectively overcoming the limitation of the separation of spatio-temporal modules in traditional methods; The model can not only capture the dynamic spatial dependencies in the traffic system, fully consider the impact of regional function differences and travel pattern changes, but also achieve deep interaction of multi-dimensional features through the attention mechanism, significantly improving the modeling accuracy of spatio-temporal correlations; This innovative design that deeply integrates the original features, time features, cycle features, and spatio-temporal features of traffic flow makes the model have stronger generalization ability and prediction accuracy, providing reliable technical support for the construction of intelligent transportation systems. The prediction comparison results with the extreme method are shown in Table 2.
[0107] Table 2 Prediction Comparison Results Table
[0108]
[0109] It can be seen that the model proposed in this application has achieved significant breakthroughs in multiple technical dimensions:
[0110] (1) In terms of prediction accuracy, the system innovatively designs an adaptive embedding, thus greatly improving the accuracy of traffic flow prediction.
[0111] (2) In terms of capturing spatio-temporal feature dependencies, the system accurately captures the complex dependencies of the traffic road network through different embedding methods, ensuring excellent performance of the system in the prediction task and being able to adapt to various complex traffic flow change scenarios.
[0112] (3) In terms of application value, the system demonstrates strong adaptability and versatility. It can not only provide accurate traffic flow prediction for the urban traffic system, support the balance of traffic supply and demand and the stable operation of the system, but also be widely applied to multiple fields such as urban planning, traffic management and public safety.
[0113] In addition, combined with Figure 1 The traffic flow prediction method based on the spatio-temporal synchronous embedding graph Transformer model described in the embodiments of the present application can be implemented by a computer device. Figure 4 It is a schematic diagram of the hardware structure of the computer device according to the embodiments of the present application. As Figure 4 shown, the device may include a processor 201 and a memory 202 storing computer program instructions.
[0114] Specifically, the above-mentioned processor 201 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0115] Among them, the memory 202 may include a mass storage for data or instructions. By way of example and not limitation, the memory 202 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disc, a magneto-optical disc, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In appropriate cases, the memory 202 may include removable or non-removable (or fixed) media. In appropriate cases, the memory 202 may be internal or external to the data processing device. In a particular embodiment, the memory 202 is non-volatile memory. In a particular embodiment, the memory 202 includes a read-only memory (ROM) and a random access memory (RAM). In appropriate cases, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM), or a flash memory, or a combination of two or more of these. In appropriate cases, the RAM may be a static random access memory (SRAM) or a dynamic random access memory (DRAM), where the DRAM may be a fast page mode dynamic random access memory (FPMDRAM), an extended date out dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0116] The memory 202 can be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 201.
[0117] By reading and executing the computer program instructions stored in the memory 202, the processor 201 implements any one of the traffic flow prediction methods based on the spatio-temporal synchronous embedded graph Transformer model in the above embodiments.
[0118] In some embodiments, the point cloud generation device may further include a communication interface 203 and a bus 200. Among them, as Figure 4 shown, the processor 201, the memory 202, and the communication interface 203 are connected through the bus 200 and complete communication with each other.
[0119] The communication interface 203 is used to implement communication between each module, device, unit, and / or device in the embodiments of the present application. The communication interface 203 can also implement data communication with other components such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations.
[0120] The bus 200 includes hardware, software, or both, and couples components of the point cloud generation device to each other. The bus 200 includes, but is not limited to, at least one of the following: Data Bus, Address Bus, Control Bus, Expansion Bus, Local Bus. By way of example and not limitation, the bus 200 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, the bus 200 may include one or more buses. Although embodiments of the present application describe and illustrate specific buses, the present application contemplates any suitable bus or interconnect.
[0121] The computer device can execute the traffic flow prediction method based on the spatio-temporal synchronous embedding graph Transformer model in the embodiments of the present application based on the rendering device, so as to implement the combination Figure 1 The traffic flow prediction method based on the spatio-temporal synchronous embedding graph Transformer model described.
[0122] In addition, in combination with the traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model in the above embodiment, the embodiment of the present application can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any of the traffic flow prediction methods based on the spatiotemporal synchronous embedded graph Transformer model in the above embodiment is implemented.
[0123] In summary, this application provides a traffic flow prediction method based on the spatiotemporal synchronous embedding graph Transformer model. This method designs a deep neural network model for traffic flow prediction. The model can effectively extract the spatiotemporal heterogeneity characteristics of the traffic network and realize accurate modeling of traffic flow parameters. This method can effectively improve the prediction response accuracy and real-time decision-making ability of the intelligent traffic management system, and provide reliable technical support for dynamic urban traffic control, congestion relief optimization, and personalized travel route planning.
[0124] It should be pointed out that the technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. In addition, according to the needs of implementation, the various steps / components described in this application can be split into more steps / components, and two or more steps / components or partial operations of steps / components can be combined into new steps / components to achieve the purpose of the present invention.
[0125] It is easy for a person skilled in the art to understand that the above-mentioned embodiments only express several implementation methods of the present application, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A traffic flow prediction method based on a spatiotemporal synchronous embedding graph Transformer model, characterized in that: The method includes: Acquire historical traffic flow sequence data of the target area and preprocess the data to obtain preprocessed historical traffic flow sequence data; The traffic network of the target area is defined as an undirected graph, the static adjacency matrix is calculated based on the graph structure, and then the spatial encoding features are obtained through the fully connected layer. Among them, N is the number of monitoring points in the traffic network of the target area, that is, the number of nodes, and T is the time length of the historical traffic flow series data; Based on the preprocessed historical traffic flow sequence data, the original traffic features are extracted through the fully connected layer Construct a feature representation containing weekly cycle, daily cycle and timestamp, and embed the feature representation of weekly cycle, daily cycle and timestamp into the preprocessed historical traffic flow sequence data through the fully connected layer to obtain the weekly cycle feature. Daily cycle characteristics and timestamp feature Based on the spatiotemporal adaptive embedding mechanism, adaptive spatiotemporal features are obtained Obtaining hidden spatiotemporal representations through feature concatenation Concat(·) represents the concatenation operation, d s d f d w d d d t and a are feature dimensions, d h =d s +d f +d w +d d +d t +d a is the feature dimension after splicing; Based on the hidden spatiotemporal representation H, the spatiotemporal dependency features of traffic flow are extracted along the time dimension and the spatial dimension respectively through the dual-channel attention mechanism to obtain the enhanced spatiotemporal feature representation Z′; Based on the enhanced spatiotemporal feature representation Z′, the traffic flow prediction value of each node in the future period is generated through the fully connected output layer.
2. The traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model according to claim 1 is characterized in that: This method adopts a sliding window mechanism, takes historical traffic flow sequence data as input, and outputs the traffic flow prediction value for the next τ time steps, as follows: Monitoring point v at time t i The traffic flow is expressed as Then the traffic flow of all monitoring points at time t is expressed as the characteristic matrix The historical traffic flow sequence data is represented as {X t-T+1 ,X t-T+2 ,...,X t }, the traffic flow prediction value of the next τ time steps is expressed as {Y t+1 ,Y t+2 ,...,Y t+τ }; Among them, v i represents the i-th monitoring point, Y t+τ Represents the feature matrix at time t+τ.
3. The traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model according to claim 1 is characterized in that: Preprocessing includes normalization, the formula is as follows: In the formula, X norm represents the normalized value, mean(X) and std(X) represent the mean and standard deviation respectively.
4. The traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model according to claim 1 is characterized in that: The traffic network of the target area is defined as an undirected graph, and the static adjacency matrix is calculated based on the graph structure, including: The monitoring points are regarded as nodes, forming a node set V = {v1, v2, ..., v N }, the connection relationship between monitoring points constitutes an edge set E, which defines the traffic network as an undirected graph G = (V, E) to describe the topological structure of the network; Define the static adjacency matrix A∈R N×N Represents the connection relationship between monitoring points, where the matrix element a ij ∈{0,1}, when a ij =1 indicates node v i With v j There is a connection relationship between ij =0 indicates no connection.
5. The traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model according to claim 1 is characterized in that: Construct feature representations containing weekly periods, daily periods, and timestamps, including: The characteristic of the cycle is expressed as T W ∈R T , the value range is [0,6], indicating the time characteristics of seven days in a week; The characteristic of the daily cycle is expressed as T D ∈R T , the value range is [0,23], indicating the time characteristics of 24 hours a day; The feature representation of the timestamp is T T ∈R T , the value range is [0,m], which represents the time characteristics of m time intervals in a day.
6. The traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model according to claim 1 is characterized in that: Based on the spatiotemporal adaptive embedding mechanism, adaptive spatiotemporal features are obtained, including: Creating a learnable parameter matrix Its parameters are automatically optimized during the training process through the back-propagation algorithm to capture the spatiotemporal variation characteristics in traffic flow data, thereby achieving adaptive modeling of complex spatiotemporal dependencies; The parameter matrix is obtained at the end of training.
7. The traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model according to claim 1 is characterized in that: Dual-channel attention mechanism, including: Given a hidden spatiotemporal representation Compute the query matrix through the temporal attention layer Key Matrix Sum Matrix in is a learnable parameter; Calculate the temporal self-attention score: Among them A te ∈R N×T×T , used to capture the temporal dependencies between different spatial nodes; Then the output of the temporal attention layer is From te =FeedForward(A te In te ) Among them, FeedForward(·) is the operation of the feedforward layer; Similarly, the spatial attention layer performs the following operations: WITH se =FeedForward(SelfAttention(Z te )) The SelfAttention(·) operation is the operation to obtain the attention score and the final output in the temporal attention layer; Finally, through residual connection and layer normalization operations, the enhanced spatiotemporal feature representation Z′ is obtained.
8. The traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model according to claim 1 is characterized in that: The traffic flow prediction value of each node in the future period is generated through the fully connected output layer, including: In the formula, FC(·) represents the fully connected layer, Represents the traffic flow forecast value of all monitoring points in the next τ time steps.
9. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model described in any one of claims 1 to 8 are implemented.
10. A readable storage medium, characterized in that: Programs or instructions are stored thereon, and when the programs or instructions are executed by the processor, the steps of the traffic flow prediction method based on the spatiotemporal synchronous embedded graph Transformer model described in any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Traffic flow prediction method and device based on multi-level space-time and perception fusion
CN121092937A
Traffic flow prediction method and device based on multi-level space-time and perception fusion
CN121092937B
Space-time diagram neural network traffic flow prediction method and system combined with interactive learning
CN121747341A