Method and product for improving traffic prediction performance through implicit geographic information and knowledge distillation model
Through implicit geographic information and knowledge distillation model, combined with explicit geographical correlation, the dual Transformer model is used to extract implicit geographic information and dynamic changes between road sections, and the problem of insufficient spatial correlation capture in existing traffic speed prediction is solved. Improved prediction accuracy and performance.
Patent Information
- Application Number
- CN202411441071.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-10-16
AI Technical Summary
The existing traffic speed prediction methods have excessive smoothing problems in spatial correlation, resulting in prediction errors and it is difficult to effectively capture the implicit spatial correlation between road sections.
The implicit geographical information and knowledge distillation model are used to extract the implicit geographical information and its dynamic changes between road sections through the dual Transformer model, and combined with explicit geographical correlation information, a more accurate traffic speed prediction model is formed.
Improve the accuracy and performance of traffic speed prediction, better capture the complex interactions and time changes between road sections, and enhance the complete perception of traffic patterns.
Smart Images

Figure CN118968770B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and in particular to a method and product for improving traffic prediction performance through implicit geographic information and knowledge distillation models. Background Art
[0002] In recent decades, rapid urbanization has brought about an explosive growth in urban travel demand. Traffic speed prediction plays a vital role in the development of intelligent transportation systems (ITSs), scheduling, planning and management of urban traffic. Traffic speed prediction aims to estimate future traffic speeds based on historical data by leveraging spatial correlation (geographic information) and temporal correlation (such as the temporal impact of evolving traffic) between geographic entities (e.g. road segments). Therefore, how to effectively maintain spatial correlation and temporal correlation becomes the key to achieving accurate traffic speed prediction.
[0003] Extensive research has been conducted on studying the spatial correlation and temporal correlation of traffic speed prediction. In terms of temporal correlation, early works considered traffic speed prediction as a pure time series (i.e., univariate / multivariate) prediction problem, where autoregressive models (e.g., ARMA, ARIMA, etc.) were applied to predict the traffic speed at each time slot. Later, the success of deep recurrent neural networks (RNNs) opened a new chapter for modeling historical patterns with hidden states through deep neural networks. Various variants of RNNs, such as long short-term memory (LSTM), gated recurrent unit (GRU), etc., have been used to model the time-evolving patterns in urban traffic speed prediction. In terms of spatial correlation, the common practice is to extract the relationship between adjacent nodes. Specifically, the entire area is divided into small grids, and convolutional neural networks (CNNs) are utilized on adjacent regions to extract the spatial correlation between surrounding regions. Beyond the regional grid, graph-based models directly consider the road network, treating road segments as nodes and the adjacency relationships between road segments as edges. Then, graph neural networks (GNNs) are adopted to exploit the topological structure of the traffic system by aggregating the traffic patterns of adjacent connected road segments, achieving state-of-the-art (SOTA) results.
[0004] Current spatial correlations are modeled by predefined geographic structures, such as CNNs on regional grids or GNNs with road networks. These predefined geographic structures (e.g., regions or graphs) can reveal clear spatial correlations through the spatial proximity of connected nodes or neighboring nodes, which should share similar traffic patterns. However, in real life, some contradictory observations have been found that neighboring nodes may indicate different patterns. On this basis, the over-smoothing problem of GNNs that force neighborhoods to be as similar as possible may even lead to significant errors. Therefore, how to predict traffic speed more accurately remains an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present invention provide a method and product for improving traffic prediction performance through implicit geographic information and knowledge distillation model.
[0006] A first aspect of an embodiment of the present invention provides a method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model, the method comprising:
[0007] Inputting traffic speed records into a traffic speed prediction model, extracting implicit geographic information through a first information extraction module of the traffic speed prediction model, and extracting dynamic information of the implicit geographic information through a second information extraction module of the traffic speed prediction model, wherein the traffic speed records include: traffic speeds of each road section in the road network within a historical time period;
[0008] Based on the implicit geographic information and the dynamic information of the implicit geographic information, a traffic speed prediction result output by a traffic speed prediction model is obtained, wherein the traffic speed prediction result is used to characterize the traffic speed of each road section in the road network in a future time period;
[0009] The traffic speed prediction model, as a student model, learns the ability to extract explicit geographic correlation information from the pre-trained teacher model, and the traffic speed prediction model learns the ability to extract implicit geographic information and dynamic information of implicit geographic information based on traffic speed labels;
[0010] The implicit geographic information is used to characterize: the correlation between road sections without considering geographic information as prior knowledge; the explicit geographic correlation information is used to characterize: the correlation between road sections when considering geographic information as prior knowledge; the dynamic information of implicit geographic information is used to characterize: the change of implicit geographic information over time.
[0011] Optionally, in the training process of the traffic speed prediction model, the loss function includes at least a first loss, and the training process of the traffic speed prediction model includes:
[0012] Inputting sample traffic speed records and sample road network information into the teacher model to obtain a first sample traffic speed prediction result output by the teacher model, wherein the teacher model has the ability to extract explicit geographic correlation information;
[0013] Inputting the sample traffic speed record into the student model to obtain a second sample traffic speed prediction result output by the student model;
[0014] Based on the first sample traffic speed prediction result and the second sample traffic speed prediction result, a first loss is calculated, where the first loss is used to learn the extraction capability of explicit geographic correlation information from the teacher model.
[0015] Optionally, during the training process of the traffic speed prediction model, the loss function further includes a second loss, and the training process of the traffic speed prediction model includes:
[0016] Calculating a second loss based on the second sample traffic speed prediction result and the sample traffic speed label, wherein the second loss is used to learn the extraction capability of implicit geographic information and dynamic information of the implicit geographic information based on the sample traffic speed label;
[0017] The model parameters of the student model are updated based on the first loss and the second loss to obtain the traffic speed prediction model.
[0018] Optionally, the traffic speed prediction model includes: a first information extraction module and a second information extraction module; inputting the traffic speed record into the traffic speed prediction model includes:
[0019] The time-traffic speed sequences corresponding to the N road sections are input into the first information extraction module. The first information extraction module obtains the representation of implicit geographic information based on the multi-head self-attention mechanism. The time-traffic speed sequence corresponding to each road section represents the traffic speed of the road section within a predetermined time period.
[0020] The road section-traffic speed sequence corresponding to each time step is input into the second information extraction module. The second information extraction module extracts the representation of the dynamic information of the implicit geographic information based on the multi-head self-attention mechanism. The road section-traffic speed sequence corresponding to each time step represents the traffic speed of each of the N road sections within the time step. The network structure of the first information extraction module and the second information extraction module is the same;
[0021] Based on the implicit geographic information and the dynamic information of the implicit geographic information, the traffic speed prediction result output by the traffic speed prediction model is obtained, including:
[0022] splicing the representation of the dynamic information of the implicit geographic information and the representation of the implicit geographic information with a splicing module to obtain a splicing result;
[0023] The prediction module makes predictions based on the splicing results to obtain the traffic speed prediction results.
[0024] Optionally, updating a model parameter of a student model based on the first loss and the second loss includes:
[0025] Updating the model parameters of the student model based on the weighted value of the first loss and the weighted value of the second loss;
[0026] The sum of the first weight of the first loss and the second weight of the second loss is 1, and the value range of the first weight is 0.1~0.3.
[0027] A second aspect of an embodiment of the present invention provides a device for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model, the device comprising:
[0028] An input module is used to input a traffic speed record into a traffic speed prediction model, extract implicit geographic information through a first information extraction module of the traffic speed prediction model, and extract dynamic information of the implicit geographic information through a second information extraction module of the traffic speed prediction model, wherein the traffic speed record includes: traffic speeds of each road section in the road network within a historical time period;
[0029] A traffic speed prediction module, used to obtain a traffic speed prediction result output by a traffic speed prediction model based on implicit geographic information and dynamic information of the implicit geographic information, wherein the traffic speed prediction result is used to characterize the traffic speed of each road section in the road network in a future time period;
[0030] The traffic speed prediction model, as a student model, learns the ability to extract explicit geographic correlation information from the pre-trained teacher model, and the traffic speed prediction model learns the ability to extract implicit geographic information and dynamic information of implicit geographic information based on traffic speed labels;
[0031] The implicit geographic information is used to characterize: the correlation between road sections without considering geographic information as prior knowledge; the explicit geographic correlation information is used to characterize: the correlation between road sections when considering geographic information as prior knowledge; the dynamic information of implicit geographic information is used to characterize: the change of implicit geographic information over time.
[0032] Optionally, in the training process of the traffic speed prediction model, the loss function includes at least a first loss, and the training process of the traffic speed prediction model includes:
[0033] Inputting sample traffic speed records and sample road network information into the teacher model to obtain a first sample traffic speed prediction result output by the teacher model, wherein the teacher model has the ability to extract explicit geographic correlation information;
[0034] Inputting the sample traffic speed record into the student model to obtain a second sample traffic speed prediction result output by the student model;
[0035] Based on the first sample traffic speed prediction result and the second sample traffic speed prediction result, a first loss is calculated, where the first loss is used to learn the extraction capability of explicit geographic correlation information from the teacher model.
[0036] Optionally, during the training process of the traffic speed prediction model, the loss function further includes a second loss, and the training process of the traffic speed prediction model includes:
[0037] Calculating a second loss based on the second sample traffic speed prediction result and the sample traffic speed label, wherein the second loss is used to learn the extraction capability of implicit geographic information and dynamic information of the implicit geographic information based on the sample traffic speed label;
[0038] The model parameters of the student model are updated based on the first loss and the second loss to obtain the traffic speed prediction model.
[0039] Optionally, the traffic speed prediction model includes: a first information extraction module and a second information extraction module; the input module is used to:
[0040] The time-traffic speed sequences corresponding to the N road sections are input into the first information extraction module. The first information extraction module obtains the representation of implicit geographic information based on the multi-head self-attention mechanism. The time-traffic speed sequence corresponding to each road section represents the traffic speed of the road section within a predetermined time period.
[0041] The road section-traffic speed sequence corresponding to each time step is input into the second information extraction module. The second information extraction module extracts the representation of the dynamic information of the implicit geographic information based on the multi-head self-attention mechanism. The road section-traffic speed sequence corresponding to each time step represents the traffic speed of each of the N road sections within the time step. The network structure of the first information extraction module and the second information extraction module is the same;
[0042] The prediction module is used to:
[0043] splicing the representation of the dynamic information of the implicit geographic information and the representation of the implicit geographic information with a splicing module to obtain a splicing result;
[0044] The prediction module makes predictions based on the splicing results to obtain the traffic speed prediction results.
[0045] Optionally, updating a model parameter of a student model based on the first loss and the second loss includes:
[0046] Updating the model parameters of the student model based on the weighted value of the first loss and the weighted value of the second loss;
[0047] The sum of the first weight of the first loss and the second weight of the second loss is 1, and the value range of the first weight is 0.1~0.3.
[0048] A third aspect of an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements the method for improving traffic prediction performance through implicit geographic information and knowledge distillation model as described in the first aspect of the present invention.
[0049] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for improving traffic prediction performance through implicit geographic information and a knowledge distillation model as described in the first aspect of the present invention.
[0050] A fifth aspect of an embodiment of the present invention provides a computer program product, including a computer program / instruction, which is implemented by a processor to implement the steps in the method for improving traffic prediction performance through implicit geographic information and knowledge distillation model as described in the first aspect of the present invention.
[0051] In the embodiment of the present invention, the first information extraction module of the traffic speed prediction model extracts implicit geographic information, and the second information extraction module extracts dynamic information of implicit geographic information. Moreover, the traffic speed prediction model, based on knowledge distillation, serves as a student model and learns the ability to extract explicit geographic correlation information from a pre-trained teacher model. Thus, the traffic speed prediction model integrates the ability to extract explicit geographic correlation, implicit geographic information, and dynamic information of implicit geographic information, and can predict the traffic speed of each section in the road network in the future time period based on the explicit geographic correlation, implicit geographic information, and dynamic information of implicit geographic information in the traffic speed of each section in the road network in the historical time period. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0053] Figure 1 is an exemplary schematic diagram of implicit geographic information in a method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model provided in an embodiment of the present invention;
[0054] Figure 2is a flowchart of the steps of a method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model provided by an embodiment of the present invention;
[0055] Figure 3 It is a schematic diagram of the knowledge distillation learning process in the method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model provided by an embodiment of the present invention;
[0056] Figure 4 It is a schematic diagram of standardized MSE experimental results of different trade-off parameters in a comparative embodiment of a method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model provided in an embodiment of the present invention;
[0057] Figure 5 It is a schematic diagram of standardized MSE experimental results of different trade-off parameters in a comparative embodiment of a method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model provided in an embodiment of the present invention;
[0058] Figure 6 It is a schematic diagram of standardized MSE experimental results of different trade-off parameters in a comparative embodiment of a method for improving traffic prediction performance through implicit geographic information and a knowledge distillation model provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0060] Urban traffic speed prediction aims to estimate future traffic speeds to improve urban transportation services. In the related art, great efforts have been made to exploit the spatial correlation and temporal dependence of traffic speed evolution patterns by using explicit spatial relationships (geographic proximity) through predefined geographic structures (e.g., regional grids or road networks). Although promising results have been achieved, the traffic speed prediction methods in the related art still have the problem of ignoring implicit spatial correlations (interactions), which cannot be captured by grid / graph convolution.
[0061] Specifically, adjacent nodes may indicate different patterns, e.g. Figure 1 As shown, it shows an exemplary schematic diagram of implicit geographic information in the method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model provided by an embodiment of the present invention. In the figure, the road section R 1 It is a main road connecting multiple ramps. 2 is one of the adjacent ramps. During peak hours in the morning and evening, R 2 Overwhelming amount of vehicles trying to merge onto the main road R 1 , resulting in R 2There is light congestion, so the traffic speed is relatively slow. 1 As a major street, it has a greater traffic capacity and regulation of low speed limits, which can produce smooth traffic flow by maintaining faster traffic speeds. Another example: R 3 and R 4 Although geographically distant, due to R 3 and R 4 They are all secondary roads and are located in similar urban functional areas (residential areas). 3 and R 4 The long-term traffic speed patterns of the two cities remain similar, which suggests that there is implicit geographic information beyond spatial proximity.
[0062] In addition, implicit geographic information is dynamically changing. For example, while showing different speed patterns during the morning and evening rush hours, the main road R 1 and adjacent ramp R 2 The speed patterns of R are still similar during the off-peak hours, which is due to the overall smooth traffic during non-peak hours. 3 and R 4 Although similar in the long run, the short-term speed patterns diverge. 3 There is a primary school nearby and the speed limit is 20 mph between 3pm and 4pm, which causes R 3 Traffic speed is relatively slow even during off-peak hours. 3 and R 4 This difference occurs periodically (between 3 and 4 o'clock every day), leading to short-term divergence in traffic speed patterns. In addition, the dynamics of implicit geographic information becomes more complex because smart traffic light controllers can adaptively optimize waiting times.
[0063] In addition, explicit geographic correlation has been shown to be effective in modeling traffic speed patterns, but there is little research on implicit geographic information, let alone research on integrating explicit geographic correlation and implicit geographic information. In fact, integrating explicit and implicit geographic information is crucial to derive a complete perception of traffic patterns from a spatial perspective. However, the unique characteristics of explicit and implicit geographic information hinder the integration of the two: explicit geographic correlation focuses on spatial proximity using a predefined geographic structure, but implicit geographic information is more complex. For neighboring / adjacent points, implicit geographic information can still work with geographic structure, but emphasizes the interaction (e.g., R 1 During peak and off-peak hours 2 For long-distance segments, implicit geographic information breaks the boundaries of the predefined geographic structure, allowing long-distance but related segments to interact with each other (e.g., R 1 and R 3Longer distance, but similar functionality).
[0064] In order to at least partially solve these problems, an embodiment of the present invention proposes a general model that can implicitly incorporate geographic information in the traffic speed prediction method. Specifically, in an embodiment of the present invention, a dual Transformer model is first developed, including a spatial Transformer (first information extraction module) and a temporal Transformer (second information extraction module). The first information extraction module learns the implicit geographic information of road segments outside the boundaries of the geographic structure, while the second information extraction module captures the dynamic change pattern of the implicit geographic information. Then, in order to further integrate explicit and implicit geographic information, an extractive learning framework is also proposed in an embodiment of the present invention, which uses the existing traffic speed prediction method as a teacher model and the proposed dual Transformer model as a student model. The teacher model injects the learned explicit geographic correlation into the student model, so that the student model integrates the explicit geographic information and the implicit geographic information to obtain a traffic speed prediction model with better prediction performance.
[0065] Specifically, in an embodiment of the present invention, a method for improving traffic prediction performance by using implicit geographic information and knowledge distillation model is proposed, such as Figure 2 As shown, it shows a flowchart of the steps of a method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model proposed in an embodiment of the present invention, the method comprising the following steps:
[0066] S101, inputting traffic speed records into a traffic speed prediction model, extracting implicit geographic information through a first information extraction module of the traffic speed prediction model, and extracting dynamic information of the implicit geographic information through a second information extraction module of the traffic speed prediction model, wherein the traffic speed records include: the traffic speed of each road section in the road network within a historical time period.
[0067] S102, based on the implicit geographic information and the dynamic information of the implicit geographic information, obtaining a traffic speed prediction result output by a traffic speed prediction model, wherein the traffic speed prediction result is used to characterize the traffic speed of each road section in the road network in a future time period.
[0068] The traffic speed prediction model, as a student model, learns the ability to extract explicit geographic correlation information from the pre-trained teacher model, and the traffic speed prediction model learns the ability to extract implicit geographic information and dynamic information of implicit geographic information based on traffic speed labels.
[0069] In an embodiment of the present invention, the implicit geographic information is used to characterize: the correlation between road sections without considering geographic information as prior knowledge; the explicit geographic correlation information is used to characterize: the correlation between road sections when considering geographic information as prior knowledge; the dynamic information of implicit geographic information is used to characterize: the changes of implicit geographic information over time.
[0070] In the embodiment of the present invention, the first information extraction module and the second information extraction module of the traffic speed prediction model are both Transformer architectures. In the embodiment of the present invention, the first information extraction module does not use explicit geographic information as prior knowledge, and can extract implicit geographic information between road sections. The second information extraction module extracts implicit geographic information that dynamically evolves between different road sections. The traffic speed prediction model combines the first information extraction module and the second information extraction module to generate the final prediction result.
[0071] In an embodiment of the present invention, in order to integrate explicit geographic correlation and implicit geographic information, a model that can extract explicit geographic correlation and make predictions (e.g., SOTA model) is used as a teacher model, and the traffic speed prediction model is used as a student model to learn the ability to extract explicit geographic correlation information from the teacher model. During the learning process, the teacher model (SOTA model) injects the learned explicit geographic correlation into the student model as prior geographic information. The traffic speed prediction model obtained through knowledge distillation learning can extract explicit geographic correlation, implicit geographic information, and dynamic information of implicit geographic information, thereby improving the traffic speed prediction performance.
[0072] In an optional implementation, the traffic speed prediction model includes: a first information extraction module and a second information extraction module; step S101 includes:
[0073] S1011, input the time-traffic speed sequences corresponding to N road sections into the first information extraction module, which obtains the representation of implicit geographic information based on the multi-head self-attention mechanism. The time-traffic speed sequence corresponding to each road section represents the traffic speed of the road section within a predetermined time period.
[0074] S1012, inputting the road section-traffic speed sequence corresponding to each time step into the second information extraction module, the second information extraction module extracts the representation of the dynamic information of the implicit geographic information based on the multi-head self-attention mechanism, the road section-traffic speed sequence corresponding to each time step represents the traffic speed of each of the N road sections within the time step; the network structure of the first information extraction module and the second information extraction module is the same.
[0075] In the embodiment of the present invention, represents the road network, where represents a road segment set with N road segments, is an edge set showing the adjacency relationship between road segments. v i With a T-step traffic speed sequence Related, among which x t (i) Indicates i The road section is t The traffic speed value of the entire road network The traffic speed records X can be viewed as a multivariate time series: .
[0076] In the embodiment of the present invention, the classic setting in autoregressive time series prediction is followed, and a certain time length is given L Historical observations , the goal of the embodiment of the present invention is to predict the length of a period of time H The future traffic speed within is expressed as X t:t+H = {x (1) t:t+H , x (2) t:t+H ,···,x (N) t:t+H } Then, the traffic speed prediction problem with explicit and implicit geographic information integration can be formulated as:
[0077] (1)
[0078] in g 1 is a learnable function that captures explicit geographic dependencies by taking into account the road network topology. g 2 is a learnable function that automatically extracts implicit geographic information without any prior geographic knowledge. f is the integral function, represents independent and identically distributed Gaussian noise vectors.
[0079] In the embodiment of the present invention, the current SOTA method is directly used as g 1 , the current SOTA method ( g 1 ) can already extract the time dependency. In the embodiment of the present invention, no additional introduction is given on how to model the time dependency. The following is an explanation of the implicit geographic information related function g 2 and integral functionf Provide a detailed explanation.
[0080] Transformer has become a mainstream model in the fields of natural language processing (NLP) and computer vision (CV). The core idea of Transformer is to use the self-attention mechanism to automatically explore the correlation and dependency between input tags, such as word-word dependencies in NLP and the correlation between image blocks in CV. As mentioned above, implicit geographic information is used to characterize the complex interactions between adjacent road sections and the complex similarities between distant road sections, which goes beyond the traditional geographic proximity modeled by the graph-based SOTA method. Therefore, an embodiment of the present invention proposes to use the Transformer architecture to learn the extraction of implicit geographic information.
[0081] Specifically, in the embodiment of the present invention, a spatial transformer is used to learn spatial dependencies and extract implicit geographic information. In the embodiment of the present invention, a simple and effective improvement is made on the basis of the transformer, and a good performance is achieved in the task of traffic speed prediction. In order to directly model the correlation between different road sections (also called nodes), the input of the spatial transformer is represented as follows in the embodiment of the present invention:
[0082] (2)
[0083] in For the i The traffic speed value of the road section from the t-Lth step to the tth step; The road segments are taken as input tokens and the time steps are taken as feature dimensions.
[0084] Then, the implicit geographic information is processed and extracted according to the standard Transformer encoder. The extraction of implicit geographic information is mainly completed by the multi-head self-attention (MSA) block and the multi-perceptron (MLP) block. In addition, the layer norm (LN) is applied before each block, and the residual connection is performed after each block. In the embodiment of the present invention, the self-attention sets Q= K=V=X, and the data processing of the specific time Transformer can be expressed as:
[0085] (3)
[0086] (4)
[0087] (5)
[0088] (6)
[0089] in For passing The whole encoding process includes the total L 1 Layer-by-layer, to finally get the final implicit geographic information representation H S .
[0090] In the embodiment of the present invention, considering that implicit geographic information changes dynamically over time, it is also proposed to use the temporal transformer to pre-serve the dynamics of implicit spatial correlation. Specifically, the spatial transformer shares the same structure as the temporal transformer, but takes the traffic speed data of all road sections within the same time step as input. Specifically, the data processing of the temporal transformer can be expressed as:
[0091] (7)
[0092] (8)
[0093] (9)
[0094] (10)
[0095] in For passing The whole encoding process includes the total L 2 Layer by layer, and finally get the final time representation H T .
[0096] In the embodiment of the present invention, step S102 includes:
[0097] S10121, splicing the representation of the dynamic information of the implicit geographic information and the representation of the implicit geographic information with a splicing module to obtain a splicing result.
[0098] S1022, predicting based on the splicing result by the prediction module to obtain a traffic speed prediction result.
[0099] In the embodiment of the present invention, the outputs of the spatial transformer and the temporal transformer are combined to generate the final prediction result. Specifically, in the embodiment of the present invention, the outputs of the spatial transformer and the temporal transformer are concatenated and an output projection layer is used for prediction, which can be expressed as:
[0100] (11)
[0101] Among them, W H is the learnable projection parameter, y (i)t:t+H It is i The predicted traffic speed value of a road section from time step t to t+H.
[0102] In the embodiment of the present invention, the dual Transformer model pays attention to implicit geographic information and the dynamic information of implicit geographic information without directly using geographic information. Even if the inputs of the two Transformers come from the same source, the two branches can represent the patterns behind the data in different feature spaces. This makes the dual Transformer proposed in the embodiment of the present invention more capable of extracting implicit geographic information and the patterns of implicit geographic information evolving over time.
[0103] In an optional implementation, during the training process of the traffic speed prediction model, the loss function includes at least a first loss, and the training process of the traffic speed prediction model includes:
[0104] S1, inputting sample traffic speed records and sample road network information into the teacher model to obtain a first sample traffic speed prediction result output by the teacher model, wherein the teacher model has the ability to extract explicit geographic correlation information.
[0105] S2, inputting the sample traffic speed record into the student model to obtain a second sample traffic speed prediction result output by the student model.
[0106] S3: Calculate a first loss based on the first sample traffic speed prediction result and the second sample traffic speed prediction result, where the first loss is used to learn the extraction capability of explicit geographic correlation information from the teacher model.
[0107] In an optional implementation, during the training process of the traffic speed prediction model, the loss function further includes a second loss, and the training process of the traffic speed prediction model further includes:
[0108] S4, calculating a second loss based on the second sample traffic speed prediction result and the sample traffic speed label, wherein the second loss is used to learn the extraction capability of implicit geographic information and dynamic information of implicit geographic information based on the sample traffic speed label.
[0109] S5: Update the model parameters of the student model based on the first loss and the second loss to obtain the traffic speed prediction model.
[0110] In an optional implementation, step S5 includes: updating the model parameters of the student model based on the weighted value of the first loss and the weighted value of the second loss.
[0111] The sum of the first weight of the first loss and the second weight of the second loss is 1, and the value range of the first weight is 0.1~0.3.
[0112] The dual Transformer model proposed in the embodiment of the present invention can extract implicit geographic information and dynamic information of implicit geographic information in the traffic speed prediction task. In order to further integrate explicit geographic correlation and implicit geographic information to improve the traffic speed performance of the SOTA model, the embodiment of the present invention also proposes a teacher-student framework to learn the extraction capabilities of integrated geographic information and implicit geographic information through knowledge distillation.
[0113] Specifically, in the embodiment of the present invention, the SOTA model is used as the teacher model, and the above dual Transformer model is used as the student model. Since the current SOTA model is a graph-based model, GNN is used to learn geographic proximity from the road network, so explicit geographic correlation can be effectively extracted. Through knowledge distillation, the teacher model passes the obtained explicit geographic correlation to the dual Transformer model for integration.
[0114] like Figure 3 As shown, it shows a schematic diagram of the knowledge distillation learning process in the method for improving traffic prediction performance by using implicit geographic information and knowledge distillation model provided by an embodiment of the present invention. Specifically, it is assumed that Y t、 Y s and Y represent the prediction results of the SOTA model (teacher model), the dual Transformer model (student model), and the sample traffic speed label, respectively. In the embodiment of the present invention, the SOTA method is first pre-trained to fit the sample traffic speed label. Then, the SOTA method is modified, and the dual Transformer model is optimized and integrated using the SOTA method. Specifically, the integration has two goals: (1) accepting knowledge from the SOTA method, and (2) predicting as accurately as possible. Therefore, according to the teacher-student framework, the integration process can be expressed as:
[0115] (12)
[0116] Where α and β are fixed weights for the first loss (soft loss) and the second loss (hard loss). Specifically, the soft loss is used to predict the result Y of the SOTA method. t As the target, drive the prediction result Y of the dual Transformer model sAs close as possible to the SOTA method. Based on this, the teacher model integrates the learned explicit geographic correlation into the dual Transformer model. On the other hand, the soft loss aims to make the dual Transformer model produce accurate prediction results and provide the correct optimization direction for the integration. By optimizing the Total Loss in equation (12), the integration is automatically performed to achieve the update of the model parameters.
[0117] In the embodiment of the present invention, the dual Transformer model has a spatial Transformer and a temporal Transformer with the same structure. The difference between the two is that the input token of the spatial Transformer is the time-traffic speed sequence corresponding to N road sections, while the input token of the temporal Transformer is the road section-traffic speed sequence corresponding to each time step. The dual Transformer model can effectively extract implicit geographic information and dynamic information of implicit geographic information. Then, in the embodiment of the present invention, the integration of explicit geographic correlation and implicit geographic information is realized through knowledge distillation through the teacher-student framework. Because the relationship between explicit geographic correlation and implicit geographic information is complex and unknown, it is unreliable to directly connect or linearly combine the two techniques. Therefore, the embodiment of the present invention proposes to automatically integrate explicit geographic correlation and implicit geographic information by optimizing the dual Transformer model under the guidance of "soft loss" and "hard loss". In addition, in the embodiment of the present invention, the teaching model can be replaced by any graph-based SOTA method without modifying the internal architecture to adapt to the framework. After good training, the dual Transformer model can be independently applied to traffic speed prediction tasks. Compared with the SOTA method, the dual Transformer model has the advantages of fewer parameters and simpler structure. It can provide public services in mobile devices and has great application potential.
[0118] The embodiment of the present invention also provides a comparative embodiment to further illustrate the method provided by the embodiment of the present invention for improving traffic prediction performance through implicit geographic information and knowledge distillation model.
[0119] In the embodiment of the present invention, extensive experiments are conducted on real data sets of locations A, B, and C to evaluate the performance of the method proposed in the embodiment of the present invention in the traffic prediction task.
[0120] A. Experimental Setup
[0121] 1) Dataset Description: In the embodiment of the present invention, three real data sets related to three cities are used, including: "SZ TAXI" (A), "METR LA" (B) and "PEMS BAY" (C). Table 1 shows the statistical data of the traffic speed data set used in the embodiment of the present invention.
[0122] Table 1 Traffic speed statistics
[0123]
[0124] For the dual Transformer model proposed in the embodiment of the present invention, the embodiment of the present invention does not use the adjacency matrix of the road nodes as input, so that the model itself explores implicit geographic information. In contrast, the adjacency matrix of the road nodes of the teacher model is used as input and is used to extract explicit geographic correlations.
[0125] In the experiment, the embodiment of the present invention divides the data set into three non-overlapping sets: for each task, the first 70% of the data is the training set, the next 20% is the validation set, and the remaining 10% of the data is the test set.
[0126] 2) Evaluation index: Assume that there are n traffic speed prediction tasks to be evaluated in the embodiment of the present invention. Represents the prediction result, Represents the true value of the jth task. The embodiment of the present invention evaluates the prediction performance according to the following three indicators:
[0127] (1) Mean Square Error (MSE):
[0128] (13)
[0129] (2) Mean absolute percentage error (MAPE):
[0130] (14)
[0131] (3) Coefficient of determination (R 2 ):
[0132] (15)
[0133] in, .
[0134] Specifically, for MSE and MAPE, the lower the value, the better the model prediction performance; on the contrary, for R 2 , the larger the value, the better the model prediction performance. For all prediction tasks, the input time window T and the target time window are all set to 12.
[0135] 3) Comparison setting: The present invention uses four widely used SOTA methods as basic models and compares their performance with and without the dual Transformer model proposed in the present invention. The four basic models selected are as follows:
[0136] (1) TGCN: Combining graph convolutional networks (GCN) and gated recurrent units (GRU) to model spatial dependencies and temporal dependencies, respectively.
[0137] (2) STGCN: effectively captures complex local spatiotemporal correlations through a carefully designed spatiotemporal synchronization modeling mechanism.
[0138] (3) STTN: captures dynamic spatial dependencies and long-term temporal dependencies for long-term traffic prediction.
[0139] (4) DKFN integrates the modeling of its own and neighbor dependencies and their predictions under statistical theory and optimizes them through a Kalman filter network.
[0140] When applying the dual Transformer model proposed in the embodiment of the present invention, the embodiment of the present invention adopts the above four basic models as teacher models and the dual Transformer model (DT) as the student model. In the embodiment of the present invention, the basic model supported by the framework is represented as "*-DT", where * represents the basic model, such as TGCN-DT, STGCN-DT, stn-DT and DKFN-DT.
[0141] B. Overall comparison
[0142] The embodiment of the present invention first evaluates the necessity of implicit geographic information and the effectiveness of the traffic speed prediction model (dual Transformer model) proposed in the embodiment of the present invention. In the embodiment of the present invention, the performance of the basic model is compared with the corresponding enhanced "*-DT" version, where the basic model only captures explicit spatial correlation by maintaining spatial proximity, while the "*-DT" version additionally integrates implicit spatial correlation. The experimental results are shown in Table 2. The results show that on all three datasets, the performance of all enhanced "*-DT" versions is always better than the basic version. In particular, for STTN and TGCN, the embodiment of the present invention can be observed that the MAPE on "SZ TAXI" and the R2 on "METR LR" are significantly improved by 40% and 6% respectively compared with the basic model.
[0143] The results can clearly verify the starting point of the embodiment of the present invention, that is, implicit geographic information is crucial to improving traffic speed prediction. Through knowledge distillation, explicit geographic relevance is associated with implicit geographic information. Specifically, the basic model is used as the teacher model and the dual Transformer model is used as the student model.
[0144] Table 2. Experimental results
[0145]
[0146] C. Research on the contribution of explicit geographic relevance and implicit geographic information
[0147] The embodiments of the present invention integrate explicit geographic correlation and implicit geographic information to improve the performance of traffic speed prediction. The embodiments of the present invention further propose: In order to achieve the best performance, what is the optimal degree of explicit geographic correlation that the dual Transformer model can accept. To answer this question, the embodiments of the present invention study the influence of the Teacher-Student Framework trade-off parameters, namely α and β in Formula 12. The trade-off parameters determine whether the dual Transformer relies more on the knowledge or predicted value of the SOTA method. Specifically, in the embodiments of the present invention, α+β = 1 is set, and five pairs of values are selected, Right now {(α = 0.1, β = 0.9), (α = 0.3, β = 0.7), (α = 0.5, β = 0.5), (α = 0.7, β = 0.3), (α = 0.9, β = 0.1)}, to study the corresponding performance. The larger the α value, the more the dual Transformer relies on the explicit geographical correlation learned from the SOTA method. Figure 4 The standardized MSE of each pair of trade-off parameters in the process of training the dual Transformer model with four basic models as teacher models is given in . Figure 4 , Figure 5 and Figure 6 The performance of the dual Transformer model under different trade-off parameter pairs based on three real data sets (SZ TAXI, PEMS BAY, and METRLA) is shown respectively. For simplicity, the normalized MSE results are given in the figure, where Figure 4 Schematic diagram showing the standardized MSE experimental results of different trade-off parameters of the dual Transformer model based on the real dataset SZ TAXI; Figure 56 is a schematic diagram showing the standardized MSE experimental results of different trade-off parameters of the PEMS BAY dual Transformer model based on the real dataset; 6 is a schematic diagram showing the standardized MSE experimental results of different trade-off parameters of the METR LA dual Transformer model based on the real dataset.
[0148] Different trade-off parameters of the teacher-student framework lead to different model performances. When β is higher than α, the model performance is significantly reduced. The potential explanation is that although more prior knowledge is passed to the dual Transformer, over-reliance on the SOTA model distracts the dual Transformer from producing accurate predictions, leading to unexpected errors. Although the SOTA method as a teaching model is well pre-trained, it is not perfect and has certain errors. This will be more obvious when the SOTA cannot produce reliable predictions. Therefore, a relatively small α (about 0.1-0.3) can guarantee improved performance.
[0149] Based on the same inventive concept, an embodiment of the present invention further provides a device for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model, the device comprising:
[0150] An input module is used to input a traffic speed record into a traffic speed prediction model, extract implicit geographic information through a first information extraction module of the traffic speed prediction model, and extract dynamic information of the implicit geographic information through a second information extraction module of the traffic speed prediction model, wherein the traffic speed record includes: traffic speeds of each road section in the road network within a historical time period;
[0151] A traffic speed prediction module, used to obtain a traffic speed prediction result output by a traffic speed prediction model based on implicit geographic information and dynamic information of the implicit geographic information, wherein the traffic speed prediction result is used to characterize the traffic speed of each road section in the road network in a future time period;
[0152] The traffic speed prediction model, as a student model, learns the ability to extract explicit geographic correlation information from the pre-trained teacher model, and the traffic speed prediction model learns the ability to extract implicit geographic information and dynamic information of implicit geographic information based on traffic speed labels;
[0153] The implicit geographic information is used to characterize: the correlation between road sections without considering geographic information as prior knowledge; the explicit geographic correlation information is used to characterize: the correlation between road sections when considering geographic information as prior knowledge; the dynamic information of implicit geographic information is used to characterize: the change of implicit geographic information over time.
[0154] Based on the same inventive concept, an embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes, the steps in the method for improving traffic prediction performance through implicit geographic information and knowledge distillation model as described in any of the above embodiments are implemented.
[0155] Based on the same inventive concept, an embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the method for improving traffic prediction performance through implicit geographic information and knowledge distillation model described in any of the above embodiments are implemented.
[0156] Based on the same inventive concept, an embodiment of the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps in the method for improving traffic prediction performance through implicit geographic information and knowledge distillation model described in any of the above embodiments.
[0157] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0158] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0159] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (apparatus), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0160] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0161] These computer program instructions can also be loaded onto a computer or other programmable terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0162] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0163] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0164] The above is a detailed introduction to a method provided by the present invention for improving traffic prediction performance through implicit geographic information and knowledge distillation model. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for improving traffic prediction performance through implicit geographic information and knowledge distillation model, characterized in that: The method comprises: Inputting traffic speed records into a traffic speed prediction model, extracting implicit geographic information through a first information extraction module of the traffic speed prediction model, and extracting dynamic information of the implicit geographic information through a second information extraction module of the traffic speed prediction model, wherein the traffic speed records include: traffic speeds of each road section in the road network within a historical time period; Based on the implicit geographic information and the dynamic information of the implicit geographic information, a traffic speed prediction result output by a traffic speed prediction model is obtained, wherein the traffic speed prediction result is used to characterize the traffic speed of each road section in the road network in a future time period; The traffic speed prediction model, as a student model, learns the ability to extract explicit geographic correlation information from the pre-trained teacher model, and the traffic speed prediction model learns the ability to extract implicit geographic information and dynamic information of implicit geographic information based on traffic speed labels; The implicit geographic information is used to characterize: the correlation between road sections without considering geographic information as prior knowledge; the explicit geographic correlation information is used to characterize: the correlation between road sections when considering geographic information as prior knowledge; the dynamic information of implicit geographic information is used to characterize: the change of implicit geographic information over time.
2. The method for improving traffic prediction performance by using implicit geographic information and knowledge distillation model according to claim 1, characterized in that: In the training process of the traffic speed prediction model, the loss function includes at least a first loss, and the training process of the traffic speed prediction model includes: Inputting sample traffic speed records and sample road network information into the teacher model to obtain a first sample traffic speed prediction result output by the teacher model, wherein the teacher model has the ability to extract explicit geographic correlation information; Inputting the sample traffic speed record into the student model to obtain a second sample traffic speed prediction result output by the student model; Based on the first sample traffic speed prediction result and the second sample traffic speed prediction result, a first loss is calculated, where the first loss is used to learn the extraction capability of explicit geographic correlation information from the teacher model.
3. The method for improving traffic prediction performance by using implicit geographic information and knowledge distillation model according to claim 2, characterized in that: In the training process of the traffic speed prediction model, the loss function further includes a second loss, and the training process of the traffic speed prediction model includes: Calculating a second loss based on the second sample traffic speed prediction result and the sample traffic speed label, wherein the second loss is used to learn the extraction capability of implicit geographic information and dynamic information of the implicit geographic information based on the sample traffic speed label; The model parameters of the student model are updated based on the first loss and the second loss to obtain the traffic speed prediction model.
4. The method for improving traffic prediction performance by using implicit geographic information and knowledge distillation model according to claim 1, characterized in that: The traffic speed prediction model comprises: a first information extraction module and a second information extraction module; inputting the traffic speed record into the traffic speed prediction model comprises: The time-traffic speed sequences corresponding to the N road sections are input into the first information extraction module. The first information extraction module obtains the representation of implicit geographic information based on the multi-head self-attention mechanism. The time-traffic speed sequence corresponding to each road section represents the traffic speed of the road section within a predetermined time period. The road section-traffic speed sequence corresponding to each time step is input into the second information extraction module. The second information extraction module extracts the representation of the dynamic information of the implicit geographic information based on the multi-head self-attention mechanism. The road section-traffic speed sequence corresponding to each time step represents the traffic speed of each of the N road sections within the time step. The network structure of the first information extraction module and the second information extraction module is the same; Based on the implicit geographic information and the dynamic information of the implicit geographic information, the traffic speed prediction result output by the traffic speed prediction model is obtained, including: splicing the representation of the dynamic information of the implicit geographic information and the representation of the implicit geographic information with a splicing module to obtain a splicing result; The prediction module makes predictions based on the splicing results to obtain the traffic speed prediction results.
5. The method for improving traffic prediction performance by using implicit geographic information and knowledge distillation model according to claim 3, characterized in that: Updating a model parameter of a student model based on the first loss and the second loss includes: Updating the model parameters of the student model based on the weighted value of the first loss and the weighted value of the second loss; The sum of the first weight of the first loss and the second weight of the second loss is 1, and the value range of the first weight is 0.1~0.
3.
6. A device for improving traffic prediction performance by using implicit geographic information and knowledge distillation model, characterized in that: The device comprises: An input module is used to input a traffic speed record into a traffic speed prediction model, extract implicit geographic information through a first information extraction module of the traffic speed prediction model, and extract dynamic information of the implicit geographic information through a second information extraction module of the traffic speed prediction model, wherein the traffic speed record includes: traffic speeds of each road section in the road network within a historical time period; A traffic speed prediction module, used to obtain a traffic speed prediction result output by a traffic speed prediction model based on implicit geographic information and dynamic information of the implicit geographic information, wherein the traffic speed prediction result is used to characterize the traffic speed of each road section in the road network in a future time period; The traffic speed prediction model, as a student model, learns the ability to extract explicit geographic correlation information from the pre-trained teacher model, and the traffic speed prediction model learns the ability to extract implicit geographic information and dynamic information of implicit geographic information based on traffic speed labels; The implicit geographic information is used to characterize: the correlation between road sections without considering geographic information as prior knowledge; the explicit geographic correlation information is used to characterize: the correlation between road sections when considering geographic information as prior knowledge; the dynamic information of implicit geographic information is used to characterize: the change of implicit geographic information over time.
7. The device for improving traffic prediction performance by using implicit geographic information and knowledge distillation model according to claim 6, characterized in that: In the training process of the traffic speed prediction model, the loss function includes at least a first loss, and the training process of the traffic speed prediction model includes: Inputting sample traffic speed records and sample road network information into the teacher model to obtain a first sample traffic speed prediction result output by the teacher model, wherein the teacher model has the ability to extract explicit geographic correlation information; Inputting the sample traffic speed record into the student model to obtain a second sample traffic speed prediction result output by the student model; Based on the first sample traffic speed prediction result and the second sample traffic speed prediction result, a first loss is calculated, where the first loss is used to learn the extraction capability of explicit geographic correlation information from the teacher model.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for improving traffic prediction performance through implicit geographic information and knowledge distillation model as described in any one of claims 1-5 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for improving traffic prediction performance by using implicit geographic information and a knowledge distillation model as described in any one of claims 1 to 5 is implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps in the method for improving traffic prediction performance through implicit geographic information and knowledge distillation model described in any one of claims 1-5 are implemented.
