Road traffic state prediction method and device based on graph attention network

Through the graph attention network-based method, event coding and feature extraction of historical traffic sequence information is performed, and space-time diagrams of traffic flow are dynamically modeled, which solves the problem of low prediction accuracy of traditional traffic prediction methods under special events, and achieves higher traffic flow prediction accuracy and reliable decision support.

CN119625987AActive Publication Date: 2025-03-14SHENZHEN TECH UNIV
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411831631.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-03-14
Estimated Expiration
2044-12-12

AI Technical Summary

Technical Problem

Traditional traffic prediction methods cannot effectively capture the sudden and nonlinear changes caused by events in special events, resulting in a significant decrease in prediction accuracy and it is difficult to provide a reliable basis for traffic management decisions.

Method used

The road traffic state prediction method based on the graph attention network is adopted, and the historical traffic sequence information is encoded, the space-time embedding representation is extracted, feature extraction and fine-grained hierarchical modeling are performed, and the space-time diagram of traffic flow is dynamically modeled, and the traffic flow characteristics under the influence of events are captured.

Benefits of technology

It improves the accuracy of traffic flow prediction in special events, provides reliable data support for traffic management decisions, and has strong generalization capabilities and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625987A_ABST
    Figure CN119625987A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of traffic engineering. The invention discloses a road traffic state prediction method and device based on a graph attention network, which can improve the accuracy of traffic flow prediction under the condition of special events. The method comprises the following steps: acquiring historical traffic sequence information; performing event coding processing on the historical traffic sequence information to obtain space-time embedding representation; performing feature extraction processing on the spatio-temporal embedding representation to obtain historical spatio-temporal features; performing fine-grained hierarchical modeling processing on the historical spatiotemporal features to obtain a two-step spatiotemporal diagram and a three-step spatiotemporal diagram; performing conversion processing on the historical spatial-temporal characteristics, the two-step spatial-temporal diagram and the three-step spatial-temporal diagram to obtain a first time scale spatial-temporal diagram, a second time scale spatial-temporal diagram and a third time scale spatial-temporal diagram; and decoding the first time scale space-time diagram, the second time scale space-time diagram and the third time scale space-time diagram to obtain predicted traffic flow information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of traffic engineering, and more specifically, to a method and device for predicting road traffic status based on a graph attention network. Background Art

[0002] With the acceleration of urbanization and the development of the economy and society, special events such as holidays (such as the Spring Festival, National Day and May Day holidays), large-scale urban events (such as large-scale comprehensive sports games) and other special events have an increasingly significant impact on urban traffic. These special events are likely to cause a surge in traffic flow in local areas, causing serious congestion in the road network. Traditional traffic forecasting methods mainly rely on statistical analysis of historical data and use time series models such as ARIMA and Kalman filtering for forecasting. Such methods perform well in daily traffic flow forecasting, but in the case of the above-mentioned special events, the prediction accuracy is significantly reduced due to the inability to effectively capture the suddenness and nonlinear change characteristics brought about by the event, and it is difficult to provide a reliable basis for traffic management decisions. Summary of the invention

[0003] The purpose of the present invention is to provide a method and device for predicting road traffic status based on a graph attention network, which can improve the accuracy of traffic flow prediction in the case of special events and provide reliable data support for traffic management decisions. The present invention is mainly achieved through the following technical solutions:

[0004] A first aspect of the present invention provides a method for predicting road traffic status based on a graph attention network, comprising:

[0005] Obtain historical traffic sequence information;

[0006] Performing event coding processing on the historical traffic sequence information to obtain a spatiotemporal embedding representation;

[0007] Performing feature extraction processing on the spatiotemporal embedding representation to obtain historical spatiotemporal features;

[0008] Performing fine-grained hierarchical modeling processing on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph;

[0009] The historical space-time characteristics, the two-step space-time graph and the three-step space-time graph are converted to obtain a first time scale space-time graph, a second time scale space-time graph and a third time scale space-time graph;

[0010] The first time scale space-time diagram, the second time scale space-time diagram and the third time scale space-time diagram are decoded to obtain predicted traffic flow information.

[0011] According to one embodiment of the present invention, the step of performing event coding processing on the historical traffic sequence information to obtain a spatiotemporal embedding representation includes:

[0012] Set the first time step;

[0013] Dividing the historical traffic sequence information based on the first time step to obtain a plurality of historical traffic segments and a plurality of time steps, each time step having a one-to-one correspondence with one of the historical traffic segments;

[0014] Use one-hot encoding to encode the day of the week of the time information in all historical traffic clips as R 7 vector;

[0015] All historical traffic segments are encoded as R at the specific time of the day using one-hot encoding. 720 vector;

[0016] When a traffic flow change of a target historical traffic segment exceeds a first preset value and / or the target historical traffic segment belongs to a preset rule, marking the target historical traffic segment as event information, wherein the target historical traffic segment is any one of the multiple historical traffic segments;

[0017] Use one-hot encoding to encode all event information into R 3 vector;

[0018] The R 7 vector, the R 720 vector and the R 3 Vector concatenation into R 730 vector;

[0019] The R 730 The vector is transformed to obtain R D vector, where D is set to 64;

[0020] Based on the R D Vector obtains the traffic flow time feature embedding representation and the traffic flow space feature embedding representation of the first target road information at the first target time step, wherein the first target road information is any road information in the historical traffic sequence information, and the first target time step is any time step among all the time steps;

[0021] The traffic flow temporal feature embedding representation and the traffic flow spatial feature embedding representation are concatenated to form an event encoding of the first target road information at the first target time step;

[0022] All of the events are encoded as the spatiotemporal embedding representation.

[0023] According to one embodiment of the present invention, the step of performing feature extraction processing on the spatiotemporal embedding representation to obtain historical spatiotemporal features includes:

[0024] Calculating a first time attention corresponding to the first target road information based on the spatiotemporal embedding representation and all the time steps;

[0025] Calculate a first spatial attention corresponding to the first target road information based on the spatiotemporal embedding representation and all the road information;

[0026] Obtaining a fused attention feature corresponding to the first target road information by calculating based on the first temporal attention and the first spatial attention;

[0027] The fused attention features of the target road information at all time steps are combined into the historical spatiotemporal features.

[0028] According to an embodiment of the present invention, the steps of performing fine-grained hierarchical modeling processing on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph include:

[0029] Perform residual calculation on the historical spatiotemporal features to obtain the two-step spatiotemporal graph;

[0030] A convolution operation of a second time step is performed on the historical spatiotemporal features on a time scale to obtain the three-step spatiotemporal graph.

[0031] According to one embodiment of the present invention, the steps of converting the historical spatiotemporal features, the two-step spatiotemporal graph, and the three-step spatiotemporal graph to obtain a first time scale spatiotemporal graph, a second time scale spatiotemporal graph, and a third time scale spatiotemporal graph include:

[0032] The historical spatiotemporal features are converted using a first preset algorithm to obtain a first time scale spatiotemporal graph;

[0033] Using a second preset algorithm to convert the two-step space-time diagram to obtain the second time scale space-time diagram;

[0034] The three-step space-time diagram is converted using a third preset algorithm to obtain the third time scale space-time diagram.

[0035] According to one embodiment of the present invention, the step of decoding the first time scale space-time graph, the second time scale space-time graph and the third time scale space-time graph to obtain predicted traffic flow information includes:

[0036] The first time scale space-time graph, the second time scale space-time graph and the third time scale space-time graph are integrated and processed by using a gated fusion mechanism to obtain a fusion feature;

[0037] Performing feature extraction processing on the fused features to obtain future spatiotemporal features;

[0038] The future spatiotemporal features are integrated and processed to obtain the predicted traffic flow information.

[0039] According to an embodiment of the present invention, the step of performing feature extraction processing on the fusion feature to obtain future spatiotemporal features includes:

[0040] Calculate a second time attention based on the fused feature and all the time steps;

[0041] Calculating a second spatial attention based on the fused feature and all the road information;

[0042] The future spatiotemporal features are obtained by calculating based on the second temporal attention and the second spatial attention.

[0043] A second aspect of the present invention provides a road traffic state prediction device based on a graph attention network, comprising:

[0044] A historical traffic sequence information acquisition module is used to acquire historical traffic sequence information;

[0045] An event coding module, used for performing event coding processing on the historical traffic sequence information to obtain a spatiotemporal embedding representation;

[0046] A first multi-head spatiotemporal attention module is used to perform feature extraction processing on the spatiotemporal embedding representation to obtain historical spatiotemporal features;

[0047] A multi-time scale module is used to perform fine-grained hierarchical modeling processing on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph;

[0048] A conversion module, used for converting the historical spatiotemporal features, the two-step spatiotemporal graph and the three-step spatiotemporal graph to obtain a first time scale spatiotemporal graph, a second time scale spatiotemporal graph and a third time scale spatiotemporal graph;

[0049] A decoder is used to decode the first time scale space-time diagram, the second time scale space-time diagram and the third time scale space-time diagram to obtain predicted traffic flow information.

[0050] The third aspect of the present invention provides a terminal device, comprising: a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory, and executing the steps of the road traffic status prediction method based on the graph attention network provided in the first aspect of the present invention.

[0051] In a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium is used to store a computer program, wherein the computer program enables a computer to execute the steps of the road traffic status prediction method based on a graph attention network provided in the first aspect of the present invention.

[0052] The beneficial effects of the present invention include:

[0053] The present invention can identify the impact of events by performing event coding on historical traffic sequence information, so as to predict the traffic flow of roads under special events. Specifically, the present invention obtains spatiotemporal embedding representation by performing event coding on historical traffic sequence information; performs feature extraction on the spatiotemporal embedding representation to obtain historical spatiotemporal features; performs fine-grained hierarchical modeling on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph; converts the historical spatiotemporal features, the two-step spatiotemporal graph and the three-step spatiotemporal graph to obtain a first time scale spatiotemporal graph, a second time scale spatiotemporal graph and a third time scale spatiotemporal graph; decodes the first time scale spatiotemporal graph, the second time scale spatiotemporal graph and the third time scale spatiotemporal graph to obtain predicted traffic flow information. Therefore, compared with the prior art, the present invention can improve the accuracy of traffic flow prediction in the case of special events and provide reliable data support for traffic management decisions. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the present invention or the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0055] Figure 1 A flowchart of a method for predicting road traffic status based on a graph attention network in some embodiments of the present invention;

[0056] Figure 2 A flowchart of a method for predicting road traffic status based on a graph attention network in other embodiments of the present invention;

[0057] Figure 3 is a principle block diagram of a road traffic state prediction device based on a graph attention network in some embodiments of the present invention;

[0058] Figure 4 It is a principle block diagram of the terminal device of the present invention in some embodiments. 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 specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific embodiments disclosed below.

[0060] It should be noted that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0061] The terms "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a specific way.

[0062] The terms "comprises," "includes," or any other variations thereof are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or apparatus that comprises a series of steps or elements is not necessarily limited to those steps or elements explicitly listed but may include other steps or elements not explicitly listed or inherent to such process, method, product, or apparatus.

[0063] Unless otherwise defined, all technical and scientific terms used in the specification of the present invention have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in the specification of the present invention includes any and all combinations of one or more related listed items.

[0064] With the acceleration of urbanization and the development of the economy and society, special events such as holidays (such as the Spring Festival, National Day and May Day holidays), large-scale urban events (such as large-scale comprehensive sports games) and other special events have an increasingly significant impact on urban traffic. These special events are likely to cause a surge in traffic flow in local areas, causing serious congestion in the road network. Traditional traffic forecasting methods mainly rely on statistical analysis of historical data and use time series models such as ARIMA and Kalman filtering for forecasting. Such methods perform well in daily traffic flow forecasting, but in the case of the above-mentioned special events, the prediction accuracy is significantly reduced due to the inability to effectively capture the suddenness and nonlinear change characteristics brought about by the event, and it is difficult to provide a reliable basis for traffic management decisions.

[0065] With the development of deep learning technology, some scholars have tried to use methods such as recurrent neural networks (RNN) and long short-term memory networks (LSTM) to achieve traffic prediction capabilities under special events. Although these methods have improved the prediction accuracy to a certain extent, they still have a lot of room for improvement in prediction effect because they fail to fully consider the spatiotemporal correlation characteristics of special events and how to dynamically capture and identify the occurrence of events. For example, during large-scale sports events, traditional deep learning models are difficult to accurately predict the extent of traffic impact caused by different events, as well as the spatiotemporal distribution characteristics of the impact of events on traffic.

[0066] In recent years, graph neural networks have shown good application prospects in the field of traffic forecasting. For example, patent document CN114220271 B proposed a traffic flow prediction method based on a dynamic spatiotemporal graph convolutional recurrent network, which improves prediction accuracy by establishing a road network topology structure. Patent document CN117688453B proposed a traffic prediction model that combines a spatiotemporal attention mechanism, which has achieved good results in conventional traffic flow prediction. However, when dealing with traffic forecasts under the influence of special events, these methods fail to fully consider the impact of factors such as event type, scale, and duration on traffic patterns, and for special scenarios such as special events, they have also failed to perform effective spatiotemporal modeling to capture the dynamic evolution characteristics of traffic flow.

[0067] Existing methods generally have the following problems: first, it is difficult to effectively extract and utilize event feature information; second, there is no effective modeling to capture this complex spatiotemporal dynamic evolution process. These problems seriously restrict the actual application effect of traffic prediction models in special event scenarios.

[0068] To solve the above problems, the present invention proposes a road traffic state prediction method based on a graph attention network, which dynamically models the spatiotemporal graph of traffic flow at different time scales through the graph attention mechanism, realizes deep mining and dynamic modeling of traffic flow characteristics under the influence of events, and dynamically captures traffic patterns and event information. While improving the prediction accuracy, it has strong generalization ability and stability, and can provide strong support for traffic management decisions under special events. The specific implementation methods of the present invention are further described below in conjunction with the accompanying drawings.

[0069] like Figure 1 As shown, it is a flow chart of a method for predicting road traffic status based on a graph attention network provided by the first aspect of the present invention. Figure 1 In the method, the road traffic state prediction method based on the graph attention network includes:

[0070] S1. Obtain historical traffic sequence information.

[0071] The historical traffic sequence information is the historical state data of traffic flow in the area to be predicted in a preset time period. Each data in the historical traffic sequence information includes but is not limited to spatial location information, time information, traffic flow information, traffic density information and traffic speed information. In other embodiments, each data in the historical traffic sequence information may also include event information, which can be specifically set by those skilled in the art according to actual needs.

[0072] The preset time period may be one day, one week or one month. In other implementations, the preset time period may be set by those skilled in the art according to actual needs.

[0073] Since the historical traffic sequence information is data collected in real time, the present invention can accurately evaluate and predict the traffic flow evolution trend of the road network within the data coverage area.

[0074] The S1 step can be understood as Figure 2 The "Historical Traffic Sequence Information Collection" step in

[0075] S2. Perform event coding processing on the historical traffic sequence information to obtain a spatiotemporal embedding representation.

[0076] Furthermore, the S2 step includes:

[0077] S201. Set a first time step.

[0078] In the present invention, the first time step is 2 minutes. In other embodiments, the first time step may be other time values, which may be set by those skilled in the art according to actual needs, and the present invention does not impose any further limitation on this.

[0079] S202: dividing the historical traffic sequence information based on the first time step to obtain a plurality of historical traffic segments and a plurality of time steps, wherein each time step has a one-to-one correspondence with one of the historical traffic segments.

[0080] S203, use one-hot encoding to encode the day of the week of the time information in all historical traffic segments as R 7 vector.

[0081] The one-hot encoding is also called one-bit effective encoding, which uses an N-bit state register to encode N states, each state has its own independent register bit, and at any time, only one of them is valid.

[0082] The R 7 The vector is a binary vector of length 7, that is, a real vector space with 7 dimensions.

[0083] There are 7 categories of the days of the week, namely Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday, so the present invention uses a binary vector with a length of 7 for one-hot encoding.

[0084] S204, use one-hot encoding to encode all historical traffic segments at specific times of the day as R 720 vector.

[0085] The R 720 The vector is a binary vector of length 720, that is, a real vector space with 720 dimensions.

[0086] There are 24 hours in a day, 60 minutes in an hour, and 1440 minutes in a day. Since the present invention uses 2 minutes as the first time step, the present invention adopts a dimension of 720.

[0087] S205. When the traffic flow change of the target historical traffic segment exceeds a first preset value and / or the target historical traffic segment belongs to a preset rule, mark the target historical traffic segment as event information, wherein the target historical traffic segment is any one of the multiple historical traffic segments.

[0088] The first preset value is 50%. In other implementations, the first preset value can be set by those skilled in the art according to actual needs.

[0089] The preset rule refers to the time information of the target historical traffic segment being consistent with the time when a special event will occur. In other embodiments, the preset rule may also be other rules, which may be specifically set by those skilled in the art according to actual needs.

[0090] The event information is actually special event information.

[0091] In the present invention, special events or special event information refer to holidays (such as Spring Festival, National Day and May Day holidays, etc.), large-scale activities in the city (such as large-scale comprehensive sports games) and other events.

[0092] S206, use one-hot encoding to encode all event information into R 3 vector.

[0093] The R 3 A vector is a binary vector of length 3, i.e. a real vector space with 3 dimensions.

[0094] S207, the R 7 vector, the R 720 vector and the R 3 Vector concatenation into R 730 vector.

[0095] The R 730 The vector is a binary vector of length 730, that is, a real vector space with 730 dimensions.

[0096] The R 7 vector and the R 720 vector as time embedding, the R 3 The vector is embedded as an event. After the execution of step S207, the time embedding and the event embedding are merged together, so that the present invention can realize the accurate prediction of the traffic status under the influence of special events such as holidays and large-scale events, and can provide a reliable decision-making basis for the traffic management department to formulate traffic diversion plans, optimize signal timing and dispatch emergency resources, thereby significantly improving the efficiency of traffic management under special events, and providing strong technical support for building an intelligent and refined urban traffic management system.

[0097] S208, the R 730 Vector conversion processing to obtain R D vector, where D is set to 64.

[0098] The R D A vector is a binary vector of length D, that is, a real vector space with D dimensions.

[0099] The step S208 is implemented by the first fully connected layer of the event encoding module in the road traffic state prediction device based on the graph attention network.

[0100] Further, step S208 includes:

[0101] S2081. Set the weight matrix and bias vector.

[0102] The weight matrix is ​​a matrix of size 730×D, where 730 is the input vector (i.e., the R 730 vector), D is the dimension of the output vector (i.e., R D vector).

[0103] The bias vector is a vector of size D used to add additional bias terms to the output.

[0104] S2082, the R 730 The vector is multiplied by the weight matrix to obtain an intermediate result.

[0105] The intermediate result is a vector of size D, which represents the R 730 The result of linear transformation of the vector by the weight matrix.

[0106] Furthermore, the calculation formula of step S2082 is z=W*x, where z is the intermediate result, W is the weight matrix, and x is the R 730 vector.

[0107] S2083, performing element-by-element addition operation on the intermediate result and the bias vector to obtain the R D vector.

[0108] S209, based on the R D The vector obtains the traffic flow time feature embedding representation and the traffic flow space feature embedding representation of the first target road information at the first target time step, wherein the first target road information is any road information in the historical traffic sequence information, and the first target time step is any time step among all the time steps.

[0109] S210: Concatenate the traffic flow temporal feature embedding representation and the traffic flow spatial feature embedding representation to form an event code of the first target road information at the first target time step.

[0110] Specifically, the calculation formula of step S210 is: in, encoding an event of the first target road information at the first target time step; is the embedding representation of the traffic flow spatial feature, that is, the first target road information v i (i-th road information) at the first target time step t j The spatial feature embedding representation of traffic flow at (j-th time step), is the embedding representation of the traffic flow time feature, that is, the first target road information v i At the first target time step t j The time feature embedding representation of traffic flow is is the data concatenation operation; R D For R D vector.

[0111] The first target road information v i , can be a special node, that is, a special road. In the present invention, each road information can be understood as a node.

[0112] The present invention can set a second preset value, and use the average of one or more attributes of all nodes in the historical traffic sequence information to calculate the first correlation coefficient between any two nodes. If the first correlation coefficient is greater than the second preset value, it is considered that the two nodes are connected in the graph structure, thereby obtaining a simulated adjacency matrix; then, the node2vec method is used to learn the vertex representation as the first target road information v i The spatial feature embedding representation of traffic flow is also called spatial embedding.

[0113] S211. Encode all the events as the spatiotemporal embedding representation.

[0114] The S2 step can be understood as Figure 2 The steps of “extracting spatiotemporal information and event information” and “embedding time, space and event information” are as follows.

[0115] S3, performing feature extraction processing on the spatiotemporal embedding representation to obtain historical spatiotemporal features. The S3 step can be understood as Figure 2 "Computation of historical spatiotemporal features".

[0116] The step S3 is implemented by the first multi-head spatiotemporal attention module in the road traffic state prediction device based on the graph attention network. Figure 2 The “First Multi-Head Spatiotemporal Attention Module” process.

[0117] Furthermore, the S3 step includes:

[0118] S301. Calculate a first temporal attention corresponding to the first target road information based on the spatiotemporal embedding representation and all the time steps.

[0119] The step S301 includes:

[0120] S3011. Among all the time steps, all other time steps except the first target time step constitute a first to-be-processed set.

[0121] S3012. Calculate a first correlation between the first target road information at the first target time step and a second target time step, where the second target time step is any time step in the first to-be-processed set.

[0122] Specifically, the calculation formula of step S3012 is:

[0123]

[0124] in, is the first target road information v i (i-th road information) at the first target time step t j The first correlation between (j-th time step) and the second target time step; K is the total number of attention heads; t is the second target time step, that is, the t-th time step in the first set to be processed; is the length of the first to-be-processed set, that is, the total number of all other time steps except the first target time step; is the first target time step t j A second correlation coefficient between t and the second target time step t; is the first target road information v i The value of the traffic flow state at the second target time step t; exp(·) is an exponential function with the natural constant e as the base; is the first target time step t in the kth attention head j A second correlation with the second target time step t; t r is the tth r time steps; is the first target time step t in the kth attention head j With t r The third correlation between time steps; is the first target road information v i At the first target time step t j The value of the traffic flow state; is an event encoding of the first target road information at the first target time step in the spatiotemporal embedding representation; It is a data splicing operation; is the event encoding of the first target road information at the tth time step in the spatiotemporal embedding representation; d is the output dimension, d=D / k, D=64.

[0125] S3013. Use the first correlation as the first temporal attention.

[0126] S302. Calculate a first spatial attention corresponding to the first target road information based on the spatiotemporal embedding representation and all the road information.

[0127] The step S302 includes:

[0128] S3021. Among all the road information, all other road information except the first target road information constitute a second to-be-processed set.

[0129] S3022. Calculate a fourth correlation between the first target road information and the second target road information at the first target time step, where the second target road information is any one piece of road information in the second set to be processed.

[0130] Specifically, the calculation formula of step S3022 is:

[0131]

[0132] in, is the first target road information v i (i-th road information) at the first target time step t j (j-th time step) with the fifth correlation of the second target road information; K is the total number of attention heads; ν is the second target road information, that is, the ν-th road information in the second to-be-processed set; V is the length of the second to-be-processed set, that is, the total number of all other road information except the first target road information; is the first target road information v i a third correlation coefficient with the second target road information v; is the second target road information v at the first target time step t j The value of the traffic flow state; exp(·) is an exponential function with the natural constant e as the base; is the first target road information ν in the kth attention head i A sixth correlation with the second target road information v; v r is the νth r Road information; is the first target road information v i At the first target time step t j The value of the traffic flow state; is an event encoding of the first target road information at the first target time step in the spatiotemporal embedding representation; is the data concatenation operation; d is the output dimension, d=D / k, D=64.

[0133] S3023. Use the fifth correlation as the first spatial attention.

[0134] S303. Calculate and obtain a fused attention feature corresponding to the first target road information based on the first temporal attention and the first spatial attention.

[0135] Furthermore, the calculation formula of step S303 is:

[0136] H=z⊙Hs+(1-z)⊙Ht;

[0137] z=σ(HsW z,1 +HtW z,2 +b z );

[0138] Wherein, H is the fused attention feature corresponding to the first target road information; z is the gate value; ⊙ is the element-by-element product; Hs is the first temporal attention; Ht is the first spatial attention; σ(·) is the sigmoid activation function; W z,1 is the first learnable parameter; W z,2 is the second learnable parameter; b z is the bias term of z.

[0139] H can be the fused attention feature of the first target road information at the first target time step, thus, H can also be expressed as H ti ,i=1,2,…,P, P is the total number of all time steps.

[0140] The step S303 is implemented by the gated fusion module of the first multi-head spatiotemporal attention module in the road traffic state prediction device based on the graph attention network.

[0141] S304: Combining the fused attention features of the target road information at all time steps into the historical spatiotemporal features.

[0142] Specifically, the historical spatiotemporal feature is represented by H one =(H t1 ,H t2 ,H t3 ...,H tP-1 ,H tP ), where H one is the historical spatiotemporal characteristics, H t1 is the fused attention feature of the target road information at the first time step t1, H t2 is the fused attention feature of the target road information at the second time step t2, H t3is the fused attention feature of the target road information at the third time step t3, and so on. tP-1 is the fused attention feature of the target road information at the P-1th time step tP-1, H tP is the fused attention feature of the target road information at the Pth time step tP.

[0143] The historical space-time feature is a single-step space-time graph.

[0144] S4: Perform fine-grained hierarchical modeling on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph. The S4 step can be understood as Figure 2 The "fine-grained multi-layer spatio-temporal graph construction" step in

[0145] The historical spatiotemporal features, the two-step spatiotemporal graph and the three-step spatiotemporal graph are multi-time scale spatiotemporal graphs, and thus, S4 can also be understood as Figure 2 The implementation of step S4 can effectively capture the dynamic evolution characteristics of traffic flow.

[0146] Furthermore, the S4 step includes:

[0147] S401, performing residual calculation on the historical spatiotemporal features to obtain the two-step spatiotemporal graph.

[0148] The two-step space-time graph can be expressed as H res =(H t2 -H t1 ,H t3 -H t2 ,...,H tP -H tP-1 ), where H res is the two-step space-time graph, H t1 is the fused attention feature of the target road information at the first time step t1, H t2 is the fused attention feature of the target road information at the second time step t2, H t3 is the fused attention feature of the target road information at the third time step t3, and so on. tP-1 is the fused attention feature of the target road information at the P-1th time step tP-1, H tP is the fused attention feature of the target road information at the Pth time step tP.

[0149] S402: Perform a convolution operation of a second time step on the historical spatiotemporal features on a time scale to obtain the three-step spatiotemporal graph.

[0150] The second time step is 3 minutes. In other embodiments, the second time step can be changed to a higher integer to adapt to prediction tasks under different time scales.

[0151] The three-step space-time graph can be expressed as H conv =σ(Φ1*H one ), where H conv is the three-step spatiotemporal graph; σ(·) is the sigmoid activation function; Φ1 is the convolution parameter; H one is the historical space-time feature, that is, the single-step space-time graph.

[0152] S5, converting the historical spatiotemporal features, the two-step spatiotemporal graph and the three-step spatiotemporal graph to obtain a first time scale spatiotemporal graph, a second time scale spatiotemporal graph and a third time scale spatiotemporal graph. The step S5 can be understood as Figure 2 The "Convert to obtain multi-time scale spatiotemporal map" step.

[0153] The step S5 is implemented by the conversion module of the road traffic state prediction device based on the graph attention network, which can be understood as Figure 2 "Conversion Module" process.

[0154] Furthermore, the step S5 includes:

[0155] S501: Use a first preset algorithm to convert the historical spatiotemporal features to obtain the first time scale spatiotemporal map.

[0156] The calculation formula of S501 is:

[0157]

[0158] in, is the first time scale spatiotemporal graph, i.e., the future traffic flow state after the historical spatiotemporal features are converted; K is the total number of attention heads; t = t1, t2, …, t p ; t1 is the first time step; t2 is the second time step; t p is the pth time step; To predict the first target time step t in the kth attention head j The seventh correlation with the t-th time step; is the historical spatiotemporal feature H one The first target road information ν i The space-time representation value at the t-th time step; exp(·) is an exponential function with the natural constant e as the base; is the first target time step t in the kth attention head jThe eighth correlation with the t-th time step; t r =t1,t2,…,t p ; is the first target time step t in the kth attention head j With t r The ninth correlation between time steps; is an event encoding of the first target road information at the first target time step in the spatiotemporal embedding representation; In the spatiotemporal embedding representation, the event encoding of the first target road information at the t-th time step; d=D / k, D=64.

[0159] S502: Use a second preset algorithm to convert the two-step space-time diagram to obtain the second time scale space-time diagram.

[0160] The calculation formula of S502 is:

[0161]

[0162] in, is the second time scale spatiotemporal graph, i.e., the future traffic flow state after the conversion of the two-step spatiotemporal graph; K is the total number of attention heads; t = t1, t2, …, t p ; t1 is the first time step; t2 is the second time step; t p is the pth time step; To predict the first target time step t in the kth attention head j The seventh correlation with the t-th time step; In the two-step space-time graph H res The first target road information ν i The space-time representation value at the t-th time step; exp(·) is an exponential function with the natural constant e as the base; is the first target time step t in the kth attention head j The eighth correlation with the t-th time step; t r =t1,t2,…,t p ; is the first target time step t in the kth attention head j With t r The ninth correlation between time steps; is an event encoding of the first target road information at the first target time step in the spatiotemporal embedding representation; In the spatiotemporal embedding representation, the event encoding of the first target road information at the t-th time step; d=D / k, D=64.

[0163] S503: Use a third preset algorithm to convert the three-step space-time diagram to obtain the third time scale space-time diagram.

[0164] The calculation formula of S503 is:

[0165]

[0166]

[0167] in, is the third time scale spatiotemporal graph, i.e., the future traffic flow state after the three-step spatiotemporal graph transformation; K is the total number of attention heads; t = t1, t2, …, t p ; t1 is the first time step; t2 is the second time step; t p is the pth time step; To predict the first target time step t in the kth attention head j The seventh correlation with the t-th time step; is the three-step space-time graph H conv The first target road information ν i The space-time representation value at the t-th time step; exp(·) is an exponential function with the natural constant e as the base; is the first target time step t in the kth attention head j The eighth correlation with the t-th time step; t r =t1,t2,…,t p ; is the first target time step t in the kth attention head j With t r The ninth correlation between time steps; is an event encoding of the first target road information at the first target time step in the spatiotemporal embedding representation; In the spatiotemporal embedding representation, the event encoding of the first target road information at the t-th time step; d=D / k, D=64.

[0168] S6: Decode the first time scale space-time graph, the second time scale space-time graph and the third time scale space-time graph to obtain predicted traffic flow information. The step S6 can be understood as: Figure 2 The "Predict future traffic flow status" step in

[0169] The predicted traffic flow information is the predicted traffic flow information of the first target road information. After steps S1-S6, the present invention can predict the predicted traffic flow information of all road information in the historical traffic sequence information.

[0170] Furthermore, the step S6 comprises:

[0171] S601: Using a gated fusion mechanism to integrate the first time scale space-time graph, the second time scale space-time graph, and the third time scale space-time graph to obtain fusion features.

[0172] Specifically, the present invention performs two gated fusion adaptive integration processes on the first time scale space-time graph, the second time scale space-time graph and the third time scale space-time graph to obtain the fusion feature.

[0173] The fused feature is a future spatiotemporal graph representation of the prediction of the first target road information.

[0174] S602: Perform feature extraction processing on the fused features to obtain future spatiotemporal features.

[0175] The S602 is implemented by the second multi-head spatiotemporal attention module of the decoder in the road traffic state prediction device based on the graph attention network.

[0176] Furthermore, the step S602 includes:

[0177] S6021. Calculate a second time attention corresponding to the first target road information based on the fused features and all the time steps.

[0178] For the specific implementation of step S6021, refer to the specific implementation of step S301.

[0179] S6022. Calculate a second spatial attention corresponding to the first target road information based on the fused features and all the road information.

[0180] For the specific implementation of step S6022, refer to the specific implementation of step S302.

[0181] S6023. Calculate and obtain the future spatiotemporal features corresponding to the first target road information based on the second temporal attention and the second spatial attention.

[0182] For the specific implementation of step S6023, refer to the specific implementation of step S303.

[0183] S603: Integrate and process the future spatiotemporal features to obtain the predicted traffic flow information.

[0184] The step S603 is implemented by the second fully connected layer of the decoder. The specific implementation of the step S603 can refer to the specific implementation of the step S208.

[0185] In the above implementation, the present invention can identify the impact of events by performing event coding on historical traffic sequence information, so as to predict the traffic flow of roads under special events. Compared with the prior art, the present invention can improve the accuracy of traffic flow prediction under special events, effectively capture the traffic flow evolution pattern, and provide reliable data support for traffic management decision-making, which has broad application prospects and important social value.

[0186] refer to Figure 3 FIG. 1 is a block diagram of a road traffic state prediction device based on a graph attention network provided by the second aspect of the present invention. Figure 3 In the embodiment, the road traffic state prediction device 100 based on the graph attention network includes:

[0187] A historical traffic sequence information acquisition module 101 is used to acquire historical traffic sequence information;

[0188] An event coding module 102, used to perform event coding processing on the historical traffic sequence information to obtain a spatiotemporal embedding representation;

[0189] A first multi-head spatiotemporal attention module 103, configured to perform feature extraction processing on the spatiotemporal embedding representation to obtain historical spatiotemporal features;

[0190] A multi-time scale module 104 is used to perform fine-grained hierarchical modeling processing on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph;

[0191] A conversion module 105 is used to convert the historical spatiotemporal features, the two-step spatiotemporal graph and the three-step spatiotemporal graph to obtain a first time scale spatiotemporal graph, a second time scale spatiotemporal graph and a third time scale spatiotemporal graph;

[0192] The decoder 106 is used to decode the first time scale space-time graph, the second time scale space-time graph and the third time scale space-time graph to obtain predicted traffic flow information.

[0193] A third aspect of the present invention provides a terminal device, the principle block diagram of the terminal device can be as follows: Figure 4As shown. The terminal device includes a processor, a memory, a network interface, a display screen and a temperature sensor connected via a system bus. Among them, the processor is used to provide computing and control capabilities. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the terminal device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a road traffic state prediction method based on a graph attention network is implemented. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor is pre-set inside the terminal device to detect the operating temperature of the internal device.

[0194] Those skilled in the art will understand that Figure 4 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the terminal device to which the scheme of the present invention is applied. The specific terminal device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0195] In some embodiments, the present invention provides a terminal device, comprising a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the steps of the road traffic status prediction method based on the graph attention network provided in the first aspect of the present invention.

[0196] In a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium is used to store a computer program, wherein the computer program enables a computer to execute the steps of the road traffic status prediction method based on a graph attention network provided in the first aspect of the present invention.

[0197] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synch link) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0198] The technical features of the above embodiments can be combined without changing the basic principles of the present invention. To make the description concise, not all possible combinations of the technical features in the above embodiments are 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.

[0199] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent application. 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 invention, and these all belong to the protection scope of the present invention. Therefore, the patent protection scope of the present invention shall be subject to the attached claims.

Claims

1. A road traffic state prediction method based on graph attention network, characterized in that: include: Obtain historical traffic sequence information; Performing event coding processing on the historical traffic sequence information to obtain a spatiotemporal embedding representation; Performing feature extraction processing on the spatiotemporal embedding representation to obtain historical spatiotemporal features; Performing fine-grained hierarchical modeling processing on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph; The historical space-time characteristics, the two-step space-time graph and the three-step space-time graph are converted to obtain a first time scale space-time graph, a second time scale space-time graph and a third time scale space-time graph; The first time scale space-time diagram, the second time scale space-time diagram and the third time scale space-time diagram are decoded to obtain predicted traffic flow information.

2. The road traffic state prediction method based on graph attention network according to claim 1 is characterized in that: The steps of performing event coding processing on the historical traffic sequence information to obtain a spatiotemporal embedding representation include: Set the first time step; Dividing the historical traffic sequence information based on the first time step to obtain a plurality of historical traffic segments and a plurality of time steps, each time step having a one-to-one correspondence with one of the historical traffic segments; Use one-hot encoding to encode the day of the week of the time information in all historical traffic clips as R 7 vector; All historical traffic segments are encoded as R at the specific time of the day using one-hot encoding. 720 vector; When a traffic flow change of a target historical traffic segment exceeds a first preset value and / or the target historical traffic segment belongs to a preset rule, marking the target historical traffic segment as event information, wherein the target historical traffic segment is any one of the multiple historical traffic segments; Use one-hot encoding to encode all event information into R 3 vector; The R 7 vector, the R 720 vector and the R 3 Vector concatenation into R 730 vector; The R 730 The vector is transformed to obtain R D vector, where D is set to 64; Based on the R D Vector obtains the traffic flow time feature embedding representation and the traffic flow space feature embedding representation of the first target road information at the first target time step, wherein the first target road information is any road information in the historical traffic sequence information, and the first target time step is any time step among all the time steps; The traffic flow temporal feature embedding representation and the traffic flow spatial feature embedding representation are concatenated to form an event encoding of the first target road information at the first target time step; All of the events are encoded as the spatiotemporal embedding representation.

3. The road traffic state prediction method based on graph attention network according to claim 2 is characterized in that: The step of performing feature extraction processing on the spatiotemporal embedding representation to obtain historical spatiotemporal features includes: Calculating a first time attention corresponding to the first target road information based on the spatiotemporal embedding representation and all the time steps; Calculate a first spatial attention corresponding to the first target road information based on the spatiotemporal embedding representation and all the road information; Obtaining a fused attention feature corresponding to the first target road information by calculating based on the first temporal attention and the first spatial attention; The fused attention features of the target road information at all time steps are combined into the historical spatiotemporal features.

4. The road traffic state prediction method based on graph attention network according to claim 1 is characterized in that: The steps of performing fine-grained hierarchical modeling processing on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph include: Perform residual calculation on the historical spatiotemporal features to obtain the two-step spatiotemporal graph; A convolution operation of a second time step is performed on the historical spatiotemporal features on a time scale to obtain the three-step spatiotemporal graph.

5. The road traffic state prediction method based on graph attention network according to claim 1 is characterized in that: The steps of converting the historical spatiotemporal features, the two-step spatiotemporal graph and the three-step spatiotemporal graph to obtain a first time scale spatiotemporal graph, a second time scale spatiotemporal graph and a third time scale spatiotemporal graph include: The historical spatiotemporal features are converted using a first preset algorithm to obtain a first time scale spatiotemporal graph; Using a second preset algorithm to convert the two-step space-time diagram to obtain the second time scale space-time diagram; The three-step space-time diagram is converted using a third preset algorithm to obtain the third time scale space-time diagram.

6. The road traffic state prediction method based on graph attention network according to claim 2 is characterized in that: The step of decoding the first time scale space-time graph, the second time scale space-time graph and the third time scale space-time graph to obtain predicted traffic flow information includes: The first time scale space-time graph, the second time scale space-time graph and the third time scale space-time graph are integrated and processed by using a gated fusion mechanism to obtain a fusion feature; Performing feature extraction processing on the fused features to obtain future spatiotemporal features; The future spatiotemporal features are integrated and processed to obtain the predicted traffic flow information.

7. The road traffic state prediction method based on graph attention network according to claim 6 is characterized in that: The step of performing feature extraction processing on the fusion feature to obtain future spatiotemporal features includes: Calculate a second time attention based on the fused feature and all the time steps; Calculating a second spatial attention based on the fused feature and all the road information; The future spatiotemporal features are obtained by calculating based on the second temporal attention and the second spatial attention.

8. A road traffic state prediction device based on a graph attention network, characterized in that: include: A historical traffic sequence information acquisition module is used to acquire historical traffic sequence information; An event coding module, used for performing event coding processing on the historical traffic sequence information to obtain a spatiotemporal embedding representation; A first multi-head spatiotemporal attention module is used to perform feature extraction processing on the spatiotemporal embedding representation to obtain historical spatiotemporal features; A multi-time scale module is used to perform fine-grained hierarchical modeling processing on the historical spatiotemporal features to obtain a two-step spatiotemporal graph and a three-step spatiotemporal graph; A conversion module, used for converting the historical spatiotemporal features, the two-step spatiotemporal graph and the three-step spatiotemporal graph to obtain a first time scale spatiotemporal graph, a second time scale spatiotemporal graph and a third time scale spatiotemporal graph; A decoder is used to decode the first time scale space-time diagram, the second time scale space-time diagram and the third time scale space-time diagram to obtain predicted traffic flow information.

9. A terminal device, characterized in that: include: A processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory to execute the steps of the road traffic state prediction method based on a graph attention network as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program enables a computer to execute the steps of the road traffic state prediction method based on a graph attention network as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Traffic flow prediction method, device and storage medium based on dynamic spatiotemporal graph convolutional recurrent network

    CN114220271B

  • A traffic flow prediction method based on spatiotemporal embedded attention network

    CN117688453B

  • Traffic flow prediction method based on multi-graph attention mechanism, equipment and medium

    CN113762338A

  • Traffic sequence prediction method based on multivariate time series data analysis

    CN115713155A

  • Transform-based diffusion diagram attention network traffic flow prediction method

    CN116504060A