Road condition prediction method and device based on heterogeneous graph neural network, and electronic equipment
By constructing a heterogeneous graph neural network and using vehicle GPS data to predict traffic, the problems of small application range and poor prediction effect in the prior art are solved, and high-accurate traffic prediction on multiple roads are achieved.
Patent Information
- Application Number
- CN202411091556.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-12
AI Technical Summary
The existing deep learning-based traffic prediction methods have small application range and poor prediction effects, and cannot effectively utilize the spatial correlation of traffic data, resulting in poor prediction results on multiple roads.
Using heterogeneous graph neural network, the initial heterogeneous graph neural network including road nodes, regional nodes and state nodes is constructed, and the vehicle GPS data is used for roaming sampling and feature encoding is used to train the target heterogeneous graph neural network to predict the road. Future road conditions.
High-accurate traffic prediction on multiple roads is achieved, the scope of application is expanded, and the prediction effect is improved, and it can be quickly and accurately established and used, with low computational complexity and high accuracy.
Smart Images

Figure CN118942248A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of traffic control, and more specifically, relates to a road condition prediction method, device and electronic equipment based on a heterogeneous graph neural network. Background Art
[0002] Spatiotemporal series prediction is an important type of prediction task. Many problems in the real world can be defined as spatiotemporal series prediction problems, such as traffic prediction, weather prediction, and infectious disease spread prediction. Spatiotemporal series prediction learns from a large amount of historical data, mines the spatiotemporal correlation information contained in the data, and ultimately predicts the future state of the prediction target. Take the traffic state prediction scenario as an example. At the temporal level, the state of the road changes nonlinearly over time and has obvious periodicity. At the spatial level, the road state is affected by the surrounding roads. Coupled with the incompleteness of the data, it brings huge challenges to the design of the prediction model.
[0003] Statistical models estimate and predict road conditions by mining the correlation and periodicity between data. Classic statistical models include historical average HA, autovector regression VAR, autoregressive integrated average moving ARIMA, etc. Common machine learning methods include K nearest neighbor (KNN) and support vector regression SVR. However, whether it is a model based on machine learning or a traditional statistical model, the traffic prediction task is regarded as a simple time series prediction task, while ignoring the spatial correlation of traffic data and failing to mine the correlation between roads.
[0004] After the rise of deep learning, it was quickly widely used in the field of traffic prediction because it can model problems from the time and space dimensions and is good at handling complex problems. For example, convolutional neural networks and deep residual networks are used to model spatial information, and recurrent neural networks are used to predict time series. However, most existing methods use data collected by sensors placed on the road. This type of data is of high quality, but covers few urban roads and is difficult to generalize to other roads, resulting in a small application scope and poor prediction results. Summary of the invention
[0005] In response to the above defects or improvement needs of the prior art, the present invention provides a road condition prediction method, device and electronic device based on a heterogeneous graph neural network, which aims to solve the technical problems of the small application scope and poor prediction effect of the existing traffic prediction methods based on deep learning.
[0006] To achieve the above object, according to one aspect of the present invention, a road condition prediction method based on a heterogeneous graph neural network is provided, comprising:
[0007] S1: Construct an initial heterogeneous graph neural network using the collected vehicle GPS data set; wherein the initial heterogeneous graph neural network includes nodes and edges connecting the nodes, and the nodes include: road nodes, regional nodes and state nodes; each of the regional nodes represents a closed loop formed by multiple road nodes, and the regional nodes are connected with the corresponding multiple road nodes to form an edge; each of the state nodes is the road condition level of the corresponding road node at a certain moment, and the state node is connected with the corresponding road node to form an edge; two road nodes are connected to form an edge, indicating that the corresponding roads are physically connected; two regional nodes are connected to form an edge, indicating that the corresponding regions are physically adjacent; two state nodes are connected, indicating that the corresponding states are similar;
[0008] S2: Perform walk sampling on the initial heterogeneous graph neural network to find out the strongly correlated neighbor nodes of each node therein; encode the attribute features of each node in the initial heterogeneous graph neural network into vectors and aggregate them as the initial vector representation of the node;
[0009] S3: inputting the positive samples and negative samples corresponding to each node into the initial heterogeneous graph neural network for training. In each round of training, the initial vector representation of each node is aggregated using the initial vectors of the strongly correlated neighboring nodes of each node. After the training is completed, the target heterogeneous graph neural network and the final vector representation of each node in its graph are obtained; the positive sample of each node is a node with a connection relationship among its strongly correlated neighboring nodes; the negative sample of each node is a node with no connection relationship with it;
[0010] S4: Calculate the road conditions of each road node at a future prediction time using the final vector of each node in the target heterogeneous graph neural network.
[0011] In one embodiment, S1 includes: extracting road network data and road condition data from the vehicle GPS data set; determining the road nodes and the area nodes and the connecting edges corresponding to the two nodes from the road network data, and determining the state nodes corresponding to the road nodes at different times and the connecting edges corresponding to the two nodes from the road condition data to construct the initial heterogeneous graph neural network.
[0012] In one embodiment, the number of state nodes corresponding to each road node is the number of sampling moments within a preset time period.
[0013] In one of the embodiments, the walking sampling of the initial heterogeneous graph neural network to find out the strongly correlated neighbor nodes of each node therein includes: performing random walk sampling with restart on the initial heterogeneous graph neural network to obtain multiple walk sequences corresponding to each node; for each type of neighbor node, taking multiple nodes with the highest number of appearances in the multiple walk sequences as the strongly correlated neighbor nodes.
[0014] In one of the embodiments, encoding the attribute features of each node in the initial heterogeneous graph neural network into vectors and then aggregating them as the initial vector representation of the node includes: One-Hot encoding the label features in the attribute features of each node; normalizing the numerical features in the attribute features of each node; concatenating the vectors obtained by encoding various attribute features corresponding to each node and passing them through a fully connected layer to obtain the initial vector representation of the node.
[0015] In one of the embodiments, during each round of training, the initial vectors of each node's strongly correlated neighboring nodes are used to aggregate the node's initial vector representation, including: for each node's strongly correlated neighboring nodes, first aggregating the node's similar nodes, and then aggregating the node's heterogeneous nodes.
[0016] In one of the embodiments, the node is aggregated with the same type of nodes first, and then the heterogeneous nodes of the node are aggregated, including: for the same type of nodes, aggregating them using bidirectional LSTM plus average pooling; for the heterogeneous nodes, using the attention mechanism to assign weights to each heterogeneous node before aggregating them.
[0017] According to another aspect of the present invention, a road condition prediction device based on a heterogeneous graph neural network is provided, comprising:
[0018] A construction module is used to construct an initial heterogeneous graph neural network using the collected vehicle GPS data set; wherein the initial heterogeneous graph neural network includes nodes and edges connecting the nodes, and the nodes include: road nodes, area nodes and state nodes; each of the area nodes represents a closed loop formed by multiple road nodes, and the area nodes are connected with the corresponding multiple road nodes to form an edge; each of the state nodes is the road condition level of the corresponding road node at a certain moment, and the state node is connected with the corresponding road node to form an edge; two road nodes are connected to form an edge, indicating that the corresponding roads are physically connected; two area nodes are connected to form an edge, indicating that the corresponding areas are physically adjacent; two state nodes are connected, indicating that the corresponding states are similar;
[0019] A computing module is used to perform walk sampling on the initial heterogeneous graph neural network to find out strongly correlated neighbor nodes of each node therein; encode each attribute feature of each node in the initial heterogeneous graph neural network into a vector and aggregate them as an initial vector representation of the node;
[0020] A training module is used to input the positive samples and negative samples corresponding to each node into the initial heterogeneous graph neural network for training. In each round of training, the initial vector representation of each node is aggregated using the initial vectors of the strongly correlated neighboring nodes of each node. After the training is completed, the target heterogeneous graph neural network and the final vector representation of each node in its graph are obtained; the positive sample of each node is a similar node with a connection relationship among its strongly correlated neighboring nodes; the negative sample of each node is a similar node without a connection relationship;
[0021] The prediction module is used to calculate the road conditions of each road node at a future prediction time using the final vector of each node in the target heterogeneous graph neural network.
[0022] According to another aspect of the present invention, an electronic device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method when executing the computer program.
[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described above are implemented.
[0024] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:
[0025] (1) The present invention provides a road condition prediction method based on a heterogeneous graph neural network, which extracts instantaneous state data of roads from large-scale vehicle GPS data, and the data has time and space characteristics. In the most basic heterogeneous graph neural network, a type of fictitious node is used, and together with the road node and the regional node, an initial heterogeneous graph neural network is formed. Among them, the node represents the state information abstracted from the road condition data, and the state node contains information such as time and current road condition level; in terms of time correlation, the connection between the road node and the state node contains time correlation, and the various connection relationships between the road node and the regional node contain spatial information; the initial heterogeneous graph neural network is sampled to find the strongly correlated neighbor nodes of each node; the attribute features of each node in the initial heterogeneous graph neural network are encoded into vectors and then aggregated as the initial vector representation of the node; then the positive samples and negative samples corresponding to each node are input into the initial heterogeneous graph neural network for training to obtain the target heterogeneous graph neural network, and finally the final vector of each node in the target heterogeneous graph neural network is used to calculate the road condition of each road node at the future prediction time, so as to realize the conversion of the road condition estimation and prediction task into the connection prediction problem in the heterogeneous graph neural network. This method can be applied to various roads involved in the vehicle GPS data, has a wide range of applications and high prediction accuracy.
[0026] (2) This scheme determines the road nodes and regional nodes as well as the connecting edges corresponding to the two nodes from the road network data, and determines the state nodes corresponding to the road nodes at different times as well as the connecting edges corresponding to the two nodes from the road condition data. This method can quickly obtain the three types of nodes and their connecting edges, and realize the rapid and accurate establishment of the initial heterogeneous graph neural network.
[0027] (3) In this solution, the number of status nodes corresponding to each road node is the number of sampling moments within a preset time period. For example, if the vehicle GPS data of a day is sampled once every 10 minutes, the final number of status nodes corresponding to the road node is 24*6*5. The status nodes determined by this method are continuous in the time dimension and can accurately reflect the status information of each road.
[0028] (4) In this scheme, the initial heterogeneous graph neural network is subjected to random walk sampling with restart, which can quickly and accurately find the strongly correlated points in each type of node that are most closely related to the current node.
[0029] (5) This scheme performs One-Hot encoding on the label features in the attribute features of each node, and performs normalized encoding on the numerical features in the attribute features of each node; this scheme adopts different encoding methods for different attribute features, and then concatenates the encoded vectors to obtain the initial vector representation, which has low computational complexity and high accuracy.
[0030] (6) This scheme first aggregates the same type of nodes of the node, and then aggregates the heterogeneous nodes of the node. It can quickly and accurately aggregate multiple nodes into the current node, with low computational complexity and high accuracy.
[0031] (7) This scheme uses bidirectional LSTM plus average pooling to aggregate similar nodes. It uses the attention mechanism to assign weights to each heterogeneous node and then aggregates the heterogeneous nodes. The operation is simple and the computational complexity is low. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A flowchart of a road condition prediction method based on a heterogeneous graph neural network provided in Example 1 of the present invention.
[0033] Figure 2 This is a flowchart of S1 provided in Example 1 of the present invention.
[0034] Figure 3 This is a specific structural diagram of the initial heterogeneous graph neural network provided in Example 1 of the present invention.
[0035] Figure 4 A detailed diagram of the connection relationship between state nodes in the initial heterogeneous graph neural network provided in Example 1 of the present invention.
[0036] Figure 5 Schematic diagram of the overall model of the initial heterogeneous graph neural network provided in Example 1 of the present invention.
[0037] Figure 6 Schematic diagram of the random walk process during the neighbor node sampling process in the initial heterogeneous graph neural network provided in Example 1 of the present invention.
[0038] Figure 7 A schematic diagram of node aggregation during the initial heterogeneous graph neural network training process provided in Example 1 of the present invention.
[0039] Figure 8 A schematic diagram of the aggregation of similar nodes during the initial heterogeneous graph neural network training process provided in Example 1 of the present invention.
[0040] Fig. 9 A schematic diagram of heterogeneous node aggregation during the initial heterogeneous graph neural network training process provided in Example 1 of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0042] Example 1
[0043] like Figure 1 As shown, this embodiment provides a road condition prediction method based on a heterogeneous graph neural network, including: S1-S4.
[0044] S1: Construct an initial heterogeneous graph neural network using the collected vehicle GPS data set; wherein the initial heterogeneous graph neural network includes nodes and edges connecting the nodes, and the nodes include: road nodes, regional nodes and state nodes; each regional node represents a closed loop formed by multiple road nodes, and the regional node is connected to the corresponding multiple road nodes to form an edge; each state node is the road condition level of the corresponding road node at a certain moment, and the state node is connected to the corresponding road node to form an edge; two road nodes are connected to form an edge, indicating that the corresponding roads are physically connected; two regional nodes are connected to form an edge, indicating that the corresponding regions are physically adjacent; two state nodes are connected, indicating that the corresponding states are similar.
[0045] S2: Perform walking sampling on the initial heterogeneous graph neural network to find out the strongly correlated neighbor nodes of each node; encode the attribute features of each node in the initial heterogeneous graph neural network into vectors and aggregate them as the initial vector representation of the node.
[0046] S3: The positive and negative samples corresponding to each node are input into the initial heterogeneous graph neural network for training. In each round of training, the initial vector representation of each node is aggregated using the initial vectors of the strongly correlated neighboring nodes of each node. After the training is completed, the target heterogeneous graph neural network and the final vector representation of each node in its graph are obtained. The positive samples of each node are the similar nodes with connection relationships among its strongly correlated neighboring nodes; the negative samples of each node are the similar nodes without connection relationships.
[0047] S4: Use the final vector of each node in the target heterogeneous graph neural network to calculate the road conditions of each road node at the future prediction time.
[0048] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0049] In one of the embodiments, S1 includes: extracting road network data and road condition data from the vehicle GPS data set; determining road nodes and area nodes and the connecting edges corresponding to the two types of nodes from the road network data, and determining state nodes corresponding to road nodes at different times and the connecting edges corresponding to the two types of nodes from the road condition data to construct an initial heterogeneous graph neural network.
[0050] Regarding S1, the road condition data and road network data are obtained from the vehicle GPS data to construct an initial heterogeneous graph neural network of a preset area, and the preset area can be a city, a district, etc.; Figure 2 As shown, the specific steps are as follows:
[0051] S11: First, the GPS data is cleaned to remove invalid and abnormal data. There are two time fields in the GPS data, one is the time when the data is received by the cloud, and the other is the time of the vehicle's internal system. Usually, there will be a gap of several minutes or even hours between these two time fields. Considering that the time of the vehicle's internal system may not match the actual time due to various reasons, the time of the receiving system when the data is uploaded is uniformly regarded as the correct time. In the vehicle's GPS data, there may be many drift points, that is, points that are obviously deviated from the road or too far away from the previous and next points. During the data cleaning process, such points will be removed in advance to avoid affecting the subsequent processing flow. In addition, for vehicles that stay in a certain place for a long time and have a speed of 0, it is observed that this is not because of traffic jams that make them unable to move, but because they have been parked on a small road for several hours. Therefore, they are regarded as abnormal data and cleaned.
[0052] Next, the vehicle trajectory needs to be segmented for subsequent map matching steps. Since GPS data uses longitude and latitude to mark the current position of the vehicle, the GPS trajectory point may deviate from the road due to various errors, and there may be multiple roads near the same location. It is difficult to accurately determine which road the vehicle is actually traveling on based on longitude and latitude information alone, so the vehicle's motion trajectory is needed to assist in the judgment. First, the vehicle's motion trajectory within a day needs to be extracted from the vehicle's GPS data. Then, all the vehicle's trips within a day are divided into multiple trajectories. The rule for trajectory division is that if there is a jump in distance or a large time interval between two adjacent longitude and latitude points, it is considered that the location should be divided into two trajectories. Finally, a GPS sequence of multiple driving trajectories of all recorded vehicles within a day is obtained for subsequent map matching tasks.
[0053] In order to obtain the road condition data, it is necessary to calculate the average speed of vehicles on the road within a specific time slice. However, the correspondence between the longitude and latitude information in the GPS data and the real road is uncertain. Therefore, after obtaining the vehicle trajectory information, it is necessary to map match the trajectory information with the real road network. Finally, find the corresponding road for each point in the longitude and latitude type trajectory sequence. Through this step, the driving status of the vehicle on each road can be determined, and the speed of a vehicle passing through the road can be calculated through multiple GPS points of a vehicle on a certain road. Finally, the average speed of vehicles on each road is counted and converted into the connection relationship between road nodes and state nodes in the traffic heterogeneous graph neural network.
[0054] S12: Collect road network data. The roads in the road network structure contain hierarchical information. The roads are divided into highways, secondary roads, national highways, main roads, and other roads. Each road contains link-type roads connected to other roads. "Other roads" are mostly small alleys or roads inside residential areas. The amount of data obtained from vehicle GPS data is scarce, and it is impossible to calculate the accurate road conditions, so they are not considered in this article. Link-type roads are the connection between two main roads. The length is very short. Vehicles can often pass through this type of road within the interval between two GPS signals, which will not leave enough data. In addition, the road conditions of link-type roads depend on the surrounding main roads, so these roads are merged into the main roads nearby, and finally the road node set in the heterogeneous graph neural network is constructed.
[0055] S13: Collect regional node data. After obtaining the road connection relationship in the city, it is necessary to process the main roads, highways and other roads to find the closed loops formed by these roads. The space enclosed by these loops is regarded as the regional nodes in the heterogeneous graph neural network, and the roads that make up the loops form a connection relationship with the regional nodes on the heterogeneous graph neural network. By analyzing the longitude and latitude coordinates of the road, the shape, size and longitude and latitude information of the center of the area can be obtained. There are many points of interest in these areas, and these points of interest can be divided into 23 types. In order to obtain the attribute characteristics of the points of interest in the area, the points of interest within the geographical space of the area are counted to obtain the number of each type of points of interest.
[0056] S14: Construction of heterogeneous graph neural network. In one embodiment, the number of state nodes corresponding to each road node is the number of sampling moments within a preset time period. First, the state node is constructed, and the road conditions at different times are abstracted into a node. The node is a two-tuple consisting of time and road conditions. The time attribute includes two parts: date and time slice. The time slice is divided into a period of 20 minutes, and each day is divided into 72 time slices. The road conditions are divided into 5 levels according to the average speed of the vehicle, representing smooth, basically smooth, light congestion, moderate congestion, and severe congestion. The heterogeneous graph neural network nodes and connection relationships obtained in the previous data preprocessing step are added to the heterogeneous graph neural network, and the obtained heterogeneous graph neural network is as follows: Figure 3 As shown, the connections between the state nodes are as follows Figure 4 As shown, the state nodes with similar attribute states are connected to each other.
[0057] In one of the embodiments, walking sampling is performed on the initial heterogeneous graph neural network to find out the strongly correlated neighbor nodes of each node therein, including: performing random walk sampling with restart on the initial heterogeneous graph neural network to obtain multiple walk sequences corresponding to each node; for each type of neighbor node, multiple nodes with the highest number of appearances in the multiple walk sequences are taken as strongly correlated neighbor nodes.
[0058] Specifically, the sampling of neighbor nodes in S2 is the first step of the initial heterogeneous graph neural network. The overall structure of the initial heterogeneous graph neural network is as follows: Figure 5 As shown, the purpose of neighbor node sampling is to select strongly correlated neighbors of the current node.
[0059] S21: Figure 6 As shown in the figure, starting from the initial node v, each time the next step of walking is performed, three judgments will be made. First, it is judged whether it is necessary to return to the starting point. If it is judged to jump to a neighboring node, then it is judged what type of node the next jump node is, and finally one of the nodes of this type is selected as the target of the next jump. When selecting neighbors during walking, it is necessary to ensure that several types of neighbor nodes are selected. Therefore, when recording the nodes passed by the random walk, the maximum number of nodes of each type is limited. If the maximum number of nodes has been recorded, then this jump will no longer be recorded, and it will continue to jump from this node to the next node until the number of recorded nodes reaches the maximum length of the walk. L .
[0060] S22: So for each node, set the number of walks n , after walking, we get walk n In order to obtain the neighbor nodes with the greatest impact on a node, the walk sequences are analyzed, the candidate neighbors are classified by type, and then the top K strongly correlated neighbors are selected for each type of neighbor node according to the number of occurrences.
[0061] In one of the embodiments, the attribute features of each node in the initial heterogeneous graph neural network are encoded into vectors and then aggregated as the initial vector representation of the node, including: One-Hot encoding the label features in the attribute features of each node; normalizing the numerical features in the attribute features of each node; concatenating the vectors obtained by encoding various attribute features corresponding to each node and passing them through a fully connected layer to obtain the initial vector representation of the node.
[0062] S23: Figure 7As shown, the attribute features of each node in the heterogeneous graph neural network obtained in S14 are encoded into vectors and then aggregated. For label type attributes, One-Hot encoding is used to convert them into vectors, and for numerical type attributes, standard normalization is used for processing. Road nodes include attributes such as road type, name, length, and number of lanes. Status nodes have three attributes: date, time slice, and road condition. Area nodes have location, size, and point of interest attributes. After splicing the obtained feature outputs, they pass through the fully connected layer, fix the vector dimension to 128 dimensions, and obtain the initial vector representation h of the node. v ∈R d×1 .
[0063] In one of the embodiments, during each round of training, the initial vectors of each node's strongly correlated neighboring nodes are used to aggregate the node's initial vector representation, including: for each node's strongly correlated neighboring nodes, first aggregating the node's similar nodes, and then aggregating the node's heterogeneous nodes.
[0064] In one embodiment, for nodes of the same type, bidirectional LSTM plus average pooling is used for aggregation, such as Figure 8 As shown in the figure, bidirectional LSTM plus average pooling is used to achieve vector aggregation. Since the LSTM function will obtain different outputs after the input order changes, it is necessary to perform random operations on the neighbors when aggregating neighbor node information. The calculation formula is as follows: N t (v) represents the set of neighbor nodes of type t of node v, h u Represents the vector representation of the neighbor node u after aggregating the features within the node.
[0065] For heterogeneous nodes, the attention mechanism is used to assign weights to each heterogeneous node before aggregation. Fig. 9 As shown in the figure, the overall vector representation of different types of neighbor nodes is aggregated with the vector representation of the node itself. Considering the different impacts and contributions of neighbor nodes of different types of nodes on the current node, the attention mechanism is used. After using the attention mechanism, the vector representations of different types of nodes will be restricted by a coefficient α when aggregated. Finally, the vector representation of node v is as follows: ε v ∈R d×1 is the output vector of dimension d, h v is the vector representation of node v, is the aggregate vector representation of neighbor nodes of type t, O V Represents the set of node types in the graph, α v,t The importance of the aggregate node information of neighbor nodes of type t for the representation of node v is calculated as follows: g∈R1×2d is the parameter of the attention network, the ∥ symbol is the concatenation operation of the vector, and LeakyReLU is a linear correction unit that maintains linearity in non-negative numbers and multiplies a small slope λ in the negative part, so that the information is not completely discarded when it is negative, allowing some negatively correlated information to be transmitted. It is defined as follows:
[0066] Regarding S4, the final vector representation of the node obtained in S3 is processed. If you want to determine the road condition level of a road node v at time T, then input the road node v and the corresponding future prediction time T. In fact, it is to determine the five state nodes of the road node and the corresponding time T. The connection probability p(Y i T |v), and take the state node with the highest connection probability as the result. Use the softmax function to obtain the connection probability The connection probabilities are compared and analyzed. Each time period corresponds to five state nodes. The state node with the largest connection probability with the road node is selected as the road condition corresponding to the road node v in a certain period of time.
[0067] Example 2
[0068] This embodiment provides a road condition prediction device based on a heterogeneous graph neural network, including: a construction module, a calculation module, a training module and a prediction module.
[0069] A construction module is used to construct an initial heterogeneous graph neural network using the collected vehicle GPS data set; wherein the initial heterogeneous graph neural network includes nodes and edges connecting the nodes, and the nodes include: road nodes, regional nodes and state nodes; each regional node represents a closed loop formed by multiple road nodes, and the regional node is connected to the corresponding multiple road nodes to form an edge; each state node is the road condition level of the corresponding road node at a certain moment, and the state node is connected to the corresponding road node to form an edge; two road nodes are connected to form an edge, indicating that the corresponding roads are physically connected; two regional nodes are connected to form an edge, indicating that the corresponding regions are physically adjacent; two state nodes are connected, indicating that the corresponding states are similar.
[0070] The computing module is used to perform walking sampling on the initial heterogeneous graph neural network to find out the strongly correlated neighbor nodes of each node therein; the attribute features of each node in the initial heterogeneous graph neural network are encoded into vectors and then aggregated as the initial vector representation of the node.
[0071] The training module is used to input the positive samples and negative samples corresponding to each node into the initial heterogeneous graph neural network for training. In each round of training, the initial vector representation of each node is aggregated using the initial vectors of the strongly correlated neighboring nodes of each node. After the training is completed, the target heterogeneous graph neural network and the final vector representation of each node in its graph are obtained; the positive sample of each node is the same node with a connection relationship among its strongly correlated neighboring nodes; the negative sample of each node is the same node without a connection relationship.
[0072] The prediction module is used to calculate the road conditions of each road node at the future prediction time using the final vector of each node in the target heterogeneous graph neural network.
[0073] The division of each module in the above-mentioned road condition prediction device based on heterogeneous graph neural network is only for illustrative purposes. In other embodiments, the road condition prediction device based on heterogeneous graph neural network can be divided into different modules as needed to complete all or part of the functions of the above-mentioned road condition prediction device based on heterogeneous graph neural network.
[0074] For the specific limitations of the road condition prediction device based on a heterogeneous graph neural network, please refer to the limitations of the road condition prediction method based on a heterogeneous graph neural network above, which will not be repeated here. Each module in the above-mentioned road condition prediction device based on a heterogeneous graph neural network can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0075] Example 3
[0076] This embodiment provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the steps of the method are implemented when the processor executes the computer program.
[0077] Example 4
[0078] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the method are implemented.
[0079] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A road condition prediction method based on heterogeneous graph neural network, characterized in that: include: S1: Construct an initial heterogeneous graph neural network using the collected vehicle GPS data set; wherein the initial heterogeneous graph neural network includes nodes and edges connecting the nodes, and the nodes include: road nodes, regional nodes and state nodes; each of the regional nodes represents a closed loop formed by multiple road nodes, and the regional nodes are connected with the corresponding multiple road nodes to form an edge; each of the state nodes is the road condition level of the corresponding road node at a certain moment, and the state node is connected with the corresponding road node to form an edge; two road nodes are connected to form an edge, indicating that the corresponding roads are physically connected; two regional nodes are connected to form an edge, indicating that the corresponding regions are physically adjacent; two state nodes are connected, indicating that the corresponding states are similar; S2: Perform walk sampling on the initial heterogeneous graph neural network to find out the strongly correlated neighbor nodes of each node therein; encode the attribute features of each node in the initial heterogeneous graph neural network into vectors and aggregate them as the initial vector representation of the node; S3: inputting the positive samples and negative samples corresponding to each node into the initial heterogeneous graph neural network for training. In each round of training, the initial vector representation of each node is aggregated using the initial vectors of the strongly correlated neighboring nodes of each node. After the training is completed, the target heterogeneous graph neural network and the final vector representation of each node in its graph are obtained; the positive sample of each node is a node with a connection relationship among its strongly correlated neighboring nodes; the negative sample of each node is a node with no connection relationship with it; S4: Calculate the road conditions of each road node at a future prediction time using the final vector of each node in the target heterogeneous graph neural network.
2. The road condition prediction method based on heterogeneous graph neural network according to claim 1, characterized in that: The S1 includes: Extracting road network data and road condition data from the vehicle GPS data set; The road nodes and the regional nodes as well as the connecting edges corresponding to the two nodes are determined from the road network data, and the state nodes corresponding to the road nodes at different times as well as the connecting edges corresponding to the two nodes are determined from the road condition data to construct the initial heterogeneous graph neural network.
3. The road condition prediction method based on heterogeneous graph neural network according to claim 2, characterized in that: The number of state nodes corresponding to each road node is the number of sampling moments within a preset time period.
4. The road condition prediction method based on heterogeneous graph neural network according to claim 1, characterized in that: The step of performing walking sampling on the initial heterogeneous graph neural network to find out strongly correlated neighbor nodes of each node therein includes: Performing random walk sampling with restart on the initial heterogeneous graph neural network to obtain multiple walk sequences corresponding to each node; For each type of neighbor nodes, a plurality of nodes that appear most frequently in the plurality of walk sequences are taken as the strongly correlated neighbor nodes.
5. The road condition prediction method based on heterogeneous graph neural network according to claim 4, characterized in that: The attribute features of each node in the initial heterogeneous graph neural network are encoded into vectors and then aggregated as the initial vector representation of the node, including: One-Hot encoding is performed on the label features in the attribute features of each node; Normalize and encode the numerical features in the attribute features of each node; The vectors obtained by encoding the various attribute features corresponding to each node are concatenated and passed through a fully connected layer to obtain the initial vector representation of the node.
6. The road condition prediction method based on heterogeneous graph neural network according to claim 1, characterized in that: In each round of training, the initial vector representation of each node is aggregated using the initial vectors of the strongly correlated neighboring nodes of each node, including: For each node's strongly correlated neighbor nodes, the node's similar nodes are aggregated first, and then the node's heterogeneous nodes are aggregated.
7. The road condition prediction method based on heterogeneous graph neural network according to claim 6, characterized in that: The step of first aggregating the same type of nodes of the node and then aggregating the heterogeneous nodes of the node includes: For nodes of the same type, bidirectional LSTM plus average pooling is used for aggregation; For heterogeneous nodes, the attention mechanism is used to assign weights to each heterogeneous node before aggregation.
8. A road condition prediction device based on heterogeneous graph neural network, characterized in that: include: A construction module is used to construct an initial heterogeneous graph neural network using the collected vehicle GPS data set; wherein the initial heterogeneous graph neural network includes nodes and edges connecting the nodes, and the nodes include: road nodes, area nodes and state nodes; each of the area nodes represents a closed loop formed by multiple road nodes, and the area nodes are connected with the corresponding multiple road nodes to form an edge; each of the state nodes is the road condition level of the corresponding road node at a certain moment, and the state node is connected with the corresponding road node to form an edge; two road nodes are connected to form an edge, indicating that the corresponding roads are physically connected; two area nodes are connected to form an edge, indicating that the corresponding areas are physically adjacent; two state nodes are connected, indicating that the corresponding states are similar; A computing module is used to perform walk sampling on the initial heterogeneous graph neural network to find out strongly correlated neighbor nodes of each node therein; encode each attribute feature of each node in the initial heterogeneous graph neural network into a vector and aggregate them as an initial vector representation of the node; A training module is used to input the positive samples and negative samples corresponding to each node into the initial heterogeneous graph neural network for training. In each round of training, the initial vector representation of each node is aggregated using the initial vectors of the strongly correlated neighboring nodes of each node. After the training is completed, the target heterogeneous graph neural network and the final vector representation of each node in its graph are obtained; the positive sample of each node is a node with a connection relationship among its strongly correlated neighboring nodes; the negative sample of each node is a node with no connection relationship with it; The prediction module is used to calculate the road conditions of each road node at a future prediction time using the final vector of each node in the target heterogeneous graph neural network.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Semiconductor section structure detection method and system based on etching technology
CN120635050A
Large-scale urban road network traffic state prediction method based on graph neural network
CN122135561A
