Traffic flow prediction method and device, electronic equipment and computer readable storage medium

By constructing multi-view road network maps and applying deep learning technologies such as multi-graph convolutional networks, the existing traffic prediction methods are solved in terms of accuracy, and more efficient and accurate traffic prediction is achieved.

CN120048130APending Publication Date: 2025-05-27BEIJING VOYAGER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311586754.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-24
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The existing vehicle flow forecasting methods have still improved in terms of accuracy, especially affected by factors such as data acquisition accuracy, road topology and weather, and there are complex nonlinear relationships between different influencing factors.

Method used

By obtaining historical road network data, road network maps from different spatial perspectives are constructed, including geographic maps, impact maps and elastic maps, and these data are input into the multi-graph convolutional network for processing to determine the traffic forecast results. In addition, technologies such as dynamic training and adaptive embedded networks, counterfactual generator networks are also applied to further improve prediction accuracy.

Benefits of technology

This method can more accurately predict traffic flow by constructing road network diagrams from multiple angles and using deep learning technology, improving the accuracy and real-timeness of prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120048130A_ABST
    Figure CN120048130A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a traffic flow prediction method and device, electronic equipment and a computer readable storage medium. The method comprises the following steps: acquiring first historical road network data; constructing a road network map comprising a geographic map, an influence map and an elastic map by using a road network relationship according to different spatial view angles; inputting the first historical road network data and the road network map into a preset multi-map convolutional network for processing to determine a first prediction result; and determining a traffic flow prediction result according to the first prediction result. Therefore, the traffic flow prediction result is determined by constructing the road network diagrams from different angles and processing the road network diagrams and the historical road network data through the preset multi-graph convolutional network, the traffic flow can be predicted by fully utilizing the road network information and the traffic data, and the accuracy of traffic flow prediction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and particularly to a traffic flow prediction method, apparatus, electronic device, and computer-readable storage medium. Background Art

[0002] Traffic flow prediction technology aims to predict the vehicle flow on a road within a future time period by analyzing historical traffic data, environmental factors, and other relevant information. This prediction technology is of great significance in the fields of traffic management, urban planning, navigation systems, etc., and can help optimize traffic mobility, prevent congestion in advance, and provide services such as intelligent navigation.

[0003] With the development of Internet technology, there are some methods for traffic flow prediction using natural language processing (NLP) technology, but the prediction accuracy still needs to be improved. Summary of the Invention

[0004] In view of this, an object of an embodiment of the present invention is to provide a traffic flow prediction method to improve the accuracy of traffic flow prediction.

[0005] In a first aspect, an embodiment of the present invention aims to provide a traffic flow prediction method, the method comprising:

[0006] Obtaining first historical road network data;

[0007] Constructing road network graphs respectively according to road network relationships from different spatial perspectives, the road network graphs including a geographical graph, an influence graph, and an elasticity graph, the geographical graph being used to represent the topological relationship of the road network, the influence graph being used to represent the correlation between road traffic flows, and the elasticity graph being used to represent the dynamic characteristics of roads in the road network;

[0008] Inputting the first historical road network data and the road network graphs into a preset multi-graph convolutional network for processing to determine a first prediction result;

[0009] Determining a traffic flow prediction result according to the first prediction result.

[0010] Further, the method further comprises:

[0011] Obtaining second historical road network data;

[0012] Performing graph construction according to the second historical road network data and road network relationships to generate an initial graph;

[0013] Performing dynamic training on the initial graph to determine a corresponding dynamic graph;

[0014] Inputting the dynamic graph into a preset adaptive embedding network for processing to determine a second prediction result;

[0015] Input the dynamic graph into a preset counterfactual generator network for processing to determine a third prediction result.

[0016] Further, the determining of the traffic flow prediction result according to the first prediction result includes:

[0017] Determine the traffic flow prediction result according to the first prediction result, the second prediction result, and the third prediction result.

[0018] Further, the determining of the traffic flow prediction result according to the first prediction result, the second prediction result, and the third prediction result includes:

[0019] Determine the traffic flow prediction result from the first prediction result, the second prediction result, and the third prediction result based on a voting mechanism.

[0020] Further, the obtaining of the first historical road network data includes:

[0021] Obtain initial road network data;

[0022] Perform a first preprocessing on the initial road network data to determine the first historical road network data, where the first preprocessing includes one or more of the following processes: semantic disambiguation, adding attribute information, and data standardization, and the attribute information includes weather parameters and event parameters with time tags.

[0023] Further, the inputting of the first historical road network data and the road network graph into a preset multi-graph convolutional network for processing to determine the first prediction result includes:

[0024] Perform temporal convolution on the first historical road network data to determine a temporal feature map;

[0025] Add the spatial information in the road network graph to the temporal feature map to determine a spatial information integration map;

[0026] Perform spatial convolution on the spatial information integration map to determine a spatio-temporal feature map;

[0027] Perform feature mapping on the spatio-temporal feature map to determine the first prediction result.

[0028] Further, the adding of the spatial information in the road network graph to the temporal feature map to determine the spatial information integration map includes:

[0029] Integrate the spatial information corresponding to the geographical map, the influence map, and the elasticity map with the temporal feature map respectively to determine corresponding spatial information maps;

[0030] Integrate each of the spatial information maps to determine the spatial information integration map.

[0031] Further, the feature mapping of the spatio-temporal feature map to determine the first prediction result includes:

[0032] Performing feature mapping on the spatio-temporal feature map and additional information to determine the first prediction result.

[0033] Further, the obtaining of the second historical road network data includes:

[0034] Obtaining initial road network data;

[0035] Performing second preprocessing on the initial road network data to determine the second historical road network data, where the second preprocessing includes one or more of the following processes: data cleaning, data conversion, and semantic disambiguation.

[0036] Further, the dynamically training the initial graph to determine the corresponding dynamic graph includes:

[0037] Performing an embedding operation on the input graph of the current cycle to determine the output graph of the current cycle, where the input graph is the initial graph or the output graph of the previous cycle;

[0038] Performing node evaluation based on the structural mutual information between nodes to determine the node evaluation result;

[0039] Performing node dynamic segmentation according to the node evaluation result to determine a first training subset and a second training subset;

[0040] Determining the loss value of the current cycle according to the probabilities of the nodes in the current output graph falling into the first training subset and the second training subset;

[0041] In response to the loss value of the current cycle satisfying a preset condition, determining the output graph of the current cycle as the dynamic graph.

[0042] Further, the inputting the dynamic graph into a preset adaptive embedding network for processing to determine the second prediction result includes:

[0043] Integrating information of the dynamic graph and the second historical road network data to determine a spatio-temporal representation graph;

[0044] Capturing the temporal features and spatial features in the spatio-temporal representation graph to determine an intermediate feature graph;

[0045] Performing mapping on the intermediate feature graph to determine the second prediction result.

[0046] Further, the inputting the dynamic graph into a preset counterfactual generator network for processing to determine the third prediction result includes:

[0047] Capture the temporal features and spatial features in the dynamic graph to determine the observation prediction result;

[0048] Capture the temporal features and spatial features in the dynamic graph after introducing the perturbation mask to determine the counterfactual output result;

[0049] Determine the optimal perturbation mask and the counterfactual output result under the optimal perturbation mask according to the observation prediction result and the counterfactual output result;

[0050] Determine the counterfactual output result under the optimal perturbation mask as the third prediction result.

[0051] In a second aspect, an embodiment of the present invention aims to provide a traffic flow prediction device, and the device includes:

[0052] A data acquisition unit for acquiring first historical road network data;

[0053] A graph construction unit for respectively constructing road network graphs according to different spatial perspectives by using road network relationships, where the road network graphs include a geographical graph, an influence graph, and an elasticity graph, the geographical graph is used to represent the topological relationship of the road network, the influence graph is used to represent the correlation between road traffic flows, and the elasticity graph is used to represent the dynamic characteristics of roads in the road network;

[0054] A traffic flow prediction unit for inputting the first historical road network data and the road network graph into a preset multi-graph convolutional network for processing to determine a first prediction result;

[0055] A traffic flow determination unit for determining a traffic flow prediction result according to the first prediction result.

[0056] In a third aspect, an embodiment of the present invention aims to provide an electronic device, including a memory and a processor, where the memory is used to store one or more computer program instructions, and wherein the one or more computer program instructions are executed by the processor to implement the method described in any one of the above.

[0057] In a fourth aspect, an embodiment of the present invention aims to provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps described in any one of the above are implemented.

[0058] The technical solution of the embodiment of the present invention obtains the first historical road network data, constructs a road network graph including a geographical map, an influence map, and an elasticity map by using road network relationships from different spatial perspectives, inputs the first historical road network data and the road network graph into a preset multi-graph convolutional network for processing to determine a first prediction result, and determines a traffic flow prediction result according to the first prediction result. It can construct a road network graph from different perspectives and use the preset multi-graph convolutional network to process the road network graph and historical road network data to determine the traffic flow prediction result, making full use of road network information and traffic data to predict the traffic flow and improving the accuracy of traffic flow prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Through the following description of the embodiments of the present invention with reference to the drawings, the above and other objects, features, and advantages of the present invention will become clearer. In the drawings:

[0060] Figure 1 is a flowchart of the traffic flow prediction method according to the embodiment of the present invention;

[0061] Figure 2 is a flowchart of the method for obtaining the first historical road network data according to the embodiment of the present invention;

[0062] Figure 3 is a flowchart of determining the first prediction result according to the embodiment of the present invention;

[0063] Figure 4 is a schematic diagram of the processing process of the multi-graph convolutional network according to the embodiment of the present invention;

[0064] Figure 5 is a schematic diagram of the traffic flow prediction method according to the embodiment of the present invention;

[0065] Figure 6 is another flowchart of the traffic flow prediction method according to the embodiment of the present invention;

[0066] Figure 7 is a flowchart of the method for obtaining the second historical road network data according to the embodiment of the present invention;

[0067] Figure 8 is a schematic diagram of the dynamic training process according to the embodiment of the present invention;

[0068] Figure 9 is a flowchart of the method for dynamically training the initial graph according to the embodiment of the present invention;

[0069] Figure 10 is a flowchart of determining the second prediction result according to the embodiment of the present invention;

[0070] Figure 11 is a processing flowchart of the adaptive embedding network according to the embodiment of the present invention;

[0071] Figure 12 It is a flowchart for determining the third prediction result according to an embodiment of the present invention;

[0072] Figure 13 It is a processing flowchart of a counterfactual generator network according to an embodiment of the present invention;

[0073] Figure 14 It is a schematic diagram of a traffic flow prediction device according to an embodiment of the present invention;

[0074] Figure 15 It is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed implementation manners

[0075] The following describes the present application based on embodiments, but the present application is not limited to these embodiments. In the following detailed description of the present application, some specific details are described in detail. Those skilled in the art can fully understand the present application without the description of these details. In order to avoid obscuring the essence of the present application, well-known methods, processes, procedures, components, and circuits are not described in detail.

[0076] In addition, those of ordinary skill in the art should understand that the drawings provided herein are for illustrative purposes only, and the drawings are not necessarily drawn to scale.

[0077] Unless the context clearly requires otherwise, words such as "including" and "comprising" in the entire application document should be interpreted as having an inclusive meaning rather than an exclusive or exhaustive meaning; that is, it is the meaning of "including but not limited to".

[0078] In the description of the present application, it should be understood that terms such as "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise specified, the meaning of "a plurality" is two or more.

[0079] For the solutions described in this specification and embodiments, if they involve personal information processing, they will be processed on the premise of having a legal basis (such as obtaining the consent of the personal information subject, or being necessary for performing a contract, etc.), and will only be processed within the specified or agreed scope. If the user refuses to process personal information other than the necessary information required for basic functions, it will not affect the user's use of basic functions.

[0080] Traffic flow prediction technology can play an important role in traffic management, urban planning, navigation systems and other fields. However, since the accuracy of traffic flow prediction results is affected by many factors, such as data collection accuracy, road topology, weather, etc., and there may be nonlinear complex relationships between different influencing factors, this poses a great challenge to the accuracy of traffic flow prediction results, resulting in the accuracy of traffic flow prediction results still needs to be improved. In view of this, this embodiment aims to provide a traffic flow prediction method to improve the accuracy of traffic flow prediction results.

[0081] Figure 1 FIG. 1 is a flow chart of a method for predicting vehicle flow according to an embodiment of the present invention. Figure 1 As shown, the vehicle flow prediction method in this embodiment includes the following steps.

[0082] In step S110, first historical road network data is acquired.

[0083] In this embodiment, the first historical road network data is the historical road network data that occurred between the time periods to be tested, and can be road network data within the same historical time period, or road network data within different historical time periods. For example, assuming that the traffic volume from 12:00 to 12:10 on January 1, 2024 is to be predicted, the first historical road network data can be the road network data from 12:00 to 12:10 every day for 31 days from December 1 to December 31, 2023; it can also be the road network data from 00:00 on December 31, 2023 to 12:00 on January 1, 2024.

[0084] Optionally, the first historical road network data in this embodiment includes basic traffic flow data, which includes data directly reflecting traffic flow information, such as the number of vehicles passing through the road, the time and speed of vehicles passing through the road. Furthermore, the first historical road network data in this embodiment also includes other data that affect the road traffic flow, such as environmental data. Environmental data includes road control time, distribution location of road points of interest, and other similar environmental data that affect road traffic flow.

[0085] Furthermore, in this embodiment, based on Figure 2 The method shown in the figure obtains the first historical road network data, and specifically includes the following steps.

[0086] In step S210, initial road network data is obtained.

[0087] In this embodiment, the initial road network data is data from different data sources obtained according to the traffic flow prediction requirements. For example, the initial road network data includes data collected by vehicle sensors, text data related to road interest points (such as shopping malls, hospitals, etc.) uploaded by terminal devices (such as road monitoring devices, user terminal devices, etc.), or traffic flow-related data obtained from other data sources. The initial road network data includes basic traffic flow data such as the number of vehicles passing through a road, the passing time of vehicles through the road, and the passing speed, as well as other types of data that affect the traffic flow on the road, such as road control time, environmental data such as the distribution locations of road interest points that affect the traffic flow on the road, and the like.

[0088] In step S220, perform a first preprocessing on the initial road network data to determine the first historical road network data.

[0089] In this embodiment, the first preprocessing includes one or more of the following processes: semantic disambiguation, adding attribute information, and data standardization. Among them, the attribute information includes weather parameters and event parameters with time tags.

[0090] Optionally, since the text data in the initial road network data can exist in different language forms, including the mother tongue and other foreign languages, and incorrect interpretations may occur during the translation conversion of text data in different language forms, which will affect the accuracy of subsequent traffic flow prediction results. Therefore, in this embodiment, after obtaining the initial road network data, semantic disambiguation is performed on the text data to resolve the polysemy problem of words or phrases during the translation conversion of the text data, determine the exact meaning of the words in a specific context, and thus improve the accuracy of subsequent traffic flow prediction results.

[0091] Furthermore, in this embodiment, the semantic disambiguation process is implemented based on the method introduced below.

[0092] Suppose a word in the first language form (i.e., the source language s) is to be translated into the second language form (the target language L), and all contexts of the target word w in the source language s are C, that is, the source language s is the language to be translated, and the target word w is the word to be translated in the source language form.

[0093] When performing semantic disambiguation, it mainly includes the following steps: constructing a graph, calculating edge weights, constructing a tree, coreference resolution, result parsing, and evaluation.

[0094] Specifically, first construct a monolingual co-occurrence graph G s =<V s , E s >, where V s and E s respectively represent the nodes and edges in the co-occurrence graph; then collect all co-occurring noun or adjective pairs (cw i , cwj ), and add each word as a node to the initially empty graph. Each co-occurring word pair is connected with an edge (v i , v j ) ∈ E s and is assigned a weight w(v i and cw j based on the association strength between the corresponding words cw i , v j ):

[0095] w(v i , v j ) = 1 - max[p(cw i |cw j ), p(cw j |cw i )]

[0096] where p(cw i |cw j ) represents the conditional probability that the word cw i appears given that the word cw j appears, p(cw j |cw i ) represents the conditional probability that the word cw j appears given that the word cw i appears, and p(cw i |cw j ) is determined by dividing the number of contexts in which cw i and cw j appear simultaneously by the number of contexts containing cw j , and p(cw j |cw i )] is determined based on a method similar to p(cw i |cw j ).

[0097] After that, given a set of target languages L (the translated language), extend G s to the labeled multilingual graph G ML = <V ML , E ML >, where V ML = V s ∪ ∪ l∈L V l , representing a set of nodes of content words from the source (V s ) or target (V l ) languages; E ML = E s ∪ ∪ l∈L {E l ∪ E s,l}, representing the multilingual graph G ML A set of edges in

[0098] Then, the root hubs in the multilingual graph are calculated to distinguish the meanings of target words in the source language.

[0099]

[0100] where PR represents the function for ranking the importance of vertices, d is the damping factor, deg(v i ) is the number of adjacent nodes of node v i , and w ij is the weight of the co-occurrence edge between node v i and v j .

[0101] After that, in this embodiment, the minimum spanning tree (MST) is used to model the associations between words, and this association is utilized to infer the accurate meanings of words. By analyzing the structure and edge weights of the minimum spanning tree, the importance and connections between key words and relevant contexts can be identified, thereby performing accurate semantic disambiguation. Specifically, the minimum spanning tree of the graph has the target word (the word in the target language L) as the root, and the root center of G ML constitutes its first level. By using the multilingual graph, an MST containing translation nodes and edges can be obtained. The MST is used to find the most relevant words in W (the set of target languages) to eliminate ambiguity. Further, by calculating the correct center disHub (i.e., the meaning), the relevant nodes are found, and then only those nodes linked to disHub are retained. Let W h be the set of mapped content words, and the mapped content words in W h correspond to the target language.

[0102]

[0103] where, is a function that assigns weights to cw according to the distance from w, and dist(cw, h) is given by the number of edges between cw (nouns or adjectives in the source language target word context C) and h (words in the set of mapped content words W h ). Finally, the translation counts are summed to sort each translation.

[0104] Finally, through a translation-based cross-lexical resource alignment method, the accuracy of translations is verified by maximizing the similarity metric. The given source word is mapped to the target word by maximizing the lexical intersection between translations. The similarity metric between two translations is defined as follows:

[0105]

[0106] Among them is a function that returns the lexicalized set of the word c in a set of languages .

[0107] Finally, collect the translation edges of the remaining context nodes and sum the translation counts to sort each translation. Thus, semantic disambiguation of text data is achieved through the above method, which is beneficial to improving the accuracy of subsequent traffic flow prediction results.

[0108] Furthermore, in this embodiment, after the semantic disambiguation process ends, attribute information addition and data standardization operations will be performed on all initial road network data. Among them, adding attribute information mainly classifies and adds some external information, including adding weather parameters and event parameters with time tags.

[0109] Specifically, when adding attribute information, define the weather parameter at time point d as q d , and the weather parameter q d has the following values:

[0110]

[0111] At the same time, define the event parameter at time point d as r d , and the event parameter r d has the following values:

[0112]

[0113] After determining different added attribute information, by organizing each attribute information, the external feature p corresponding to each data in the first historical road network data can be obtained d =(q d , r d ).

[0114] In addition, due to the obvious non - normality of the distribution of road network data, and for some nodes, the greater the traffic flow, the more inaccurate the future traffic flow prediction results will be. Therefore, in this embodiment, by performing data standardization operations to reset the data range for the values in the initial road network data, the data imbalance problem caused by the long - tailed distribution of the whole network traffic flow can be handled, ensuring that the traffic flow information of important nodes (including nodes with large traffic flow) can also be accurately predicted.

[0115] Optionally, in this embodiment, the Box - Cox transformation is used to implement data standardization. Specifically, first perform the transformation based on the following transformation formula:

[0116]

[0117] After that, after determining the final prediction result, the inverse transformation can be performed according to the following formula to further determine the actual prediction result.

[0118]

[0119] Among them, Y λ is the output after data transformation, and Y is the output after inverse transformation of the prediction result obtained from the data transformation. λ is a transformation parameter, which is generally determined through the Box-Cox logarithmic similarity function at each node. However, in the case of a large amount of data, a quick method to determine λ can be used: for a single intersection, only select the K traffic flow values that appear the most at this intersection, and the time points where these traffic flow values are located are used as the basis for calculating λ. Here, K is a positive integer not greater than 5. After testing, this estimation method can ensure sufficient accuracy for road network data.

[0120] Thus, in this embodiment, by obtaining the initial road network data and performing operations including semantic disambiguation, adding attribute information, and data standardization on the initial road network data, the first historical road network data used to determine the traffic flow prediction result can be obtained, which can ensure the accuracy, information richness, and rationality of the data to be processed (i.e., the first historical road network data) during the traffic flow prediction process, ensure the reliability of the data during the traffic flow prediction process, avoid inaccurate prediction results caused by inaccurate or unreliable data to be processed, and further ensure and improve the accuracy of the traffic flow prediction result.

[0121] In step S120, road network graphs are respectively constructed according to different spatial perspectives using road network relationships.

[0122] In this embodiment, the road network graph includes a geographical graph, an influence graph, and an elasticity graph. Among them, the geographical graph is used to represent the topological relationship of the road network, the influence graph is used to represent the correlation between road traffic flows, and the elasticity graph is used to represent the dynamic characteristics of the roads in the road network. Further, the dynamic characteristics of the roads can be reflected by dynamic inherent semantics, and the dynamic inherent semantics include dynamic road condition information on the road (such as congestion, accidents, construction, road closures, traffic control, etc.), traffic signal information (such as the timing of traffic lights, signal optimization strategies, etc.), vehicle speed and travel information (such as travel time, etc.), vehicle behavior information (such as acceleration / deceleration, lane change, etc.).

[0123] Optionally, in this embodiment, when constructing the road network graph, first, according to the first historical road network data and road network relationships, an initial graph is constructed using existing graph construction methods is the node matrix, ε is the edge matrix, and W is the weight matrix. Among and between, e ij ∈ε is a specific road section (representing the edge formed between node v i and node v j ), wij ∈W is the directed weight (representing the relationship weight between node v i and node v j . Further, in this embodiment, according to different spatial perspectives, three kinds of graphs are constructed from three contexts, including the geographical graph (G g ), the influence graph (G r ), and the elasticity graph (G s ). The nodes and edges in the three kinds of graphs are the same as those in the initial graph , and the difference lies in the weight matrix.

[0124] Geographical graph is used to represent the topological relationship of the road network. Its adjacency matrix W g is defined as follows:

[0125]

[0126]

[0127] Influence graph is used to represent the correlation between road traffic flows, and represents the influence of one node on the remaining nodes from a statistical perspective. Its adjacency matrix W r is defined as follows:

[0128]

[0129]

[0130]

[0131] Among them, W r represents the weight of e ij , W r (i,j) represents the normalized value of the influence between node v i and node v j , dis(i,j) is the distance between two nodes v i , v j , mileage(i) is the distance that the vehicle has traveled when it exits node v i . J is the set composed of all nodes except v i . For the movement of any vehicle, its movement end point must correspond to a movement start point. Therefore, by sampling the road traffic flow, the correlation between two road traffic flows can be obtained.

[0132] Elasticity graph is used to represent the dynamic characteristics of roads in the road network. The adjacency matrix W s represents node v i and node vj The weight of edge e ij can reflect the hidden and inherent dynamic spatial relationships in the road network. The matrix is specifically defined as follows:

[0133]

[0134] W s (i, j) = a i *a j

[0135] Among them, the element W s (i, j) ∈ W s is the inherent relationship between nodes i and j learned through a fully connected neural network. (a 1 , a 2 , … a i … a V ) T represents the weight vector, and a i is a learnable constant for node v i . Through gradient descent and backpropagation, a i will be gradually updated until the spatial relationship is learned. Different from the static adjacency matrices of G g and G r above, the elastic graph G s describes the dynamic inherent semantics of the road network through a self-learning model without prior knowledge, obtains hidden spatial information, and can be retrained periodically.

[0136] Furthermore, in this embodiment, the traffic flow prediction can be realized by using the external features corresponding to the geographical map, influence map, elastic graph, and the first historical road network data from different perspectives, and the traffic flow prediction problem can be transformed into the following situation:

[0137]

[0138] Among them, f and h are the time steps for prediction and training respectively, and F(·) is a mapping function.

[0139] Thus, in this embodiment, an initial graph is constructed through the above first historical road network data and road network relationships, and a road network graph including a geographical map, an influence map, and an elastic graph is constructed according to the adjacency matrices from different perspectives, so as to predict the traffic flow at the current moment or future moments based on the road network graph. At the same time, since the geographical map, influence map, and elastic graph can prominently express the traffic flow-related information in the road network from different angles, these information can be fully utilized in the subsequent traffic flow prediction process, and the traffic flow prediction result can be further improved.

[0140] In step S130, the first historical road network data and the road network map are input into a preset multi-graph convolutional network for processing to determine the first prediction result.

[0141] In this embodiment, the preset multi-graph convolutional network processes the first historical road network data and the geographical map, influence map, and elasticity map in the road network map to determine the first prediction result. Thus, in this embodiment, by processing the first historical road network data and multiple road network maps through the multi-graph convolutional network, the historical road network data and the topological relationships, correlations between roads, and dynamic inherent semantics in the road network can be fully utilized to determine the traffic flow prediction result, thereby improving the accuracy of the traffic flow prediction result.

[0142] Figure 3 It is a flowchart for determining the first prediction result in an embodiment of the present invention. As Figure 3 shown, in this embodiment, when determining the first prediction result based on the preset multi-graph convolutional network, it is implemented through the following steps.

[0143] In step S310, temporal convolution is performed on the first historical road network data to determine the temporal feature map.

[0144] In step S320, the spatial information in the road network map is added to the temporal feature map to determine the spatial information integration map.

[0145] In this embodiment, the road network map includes a geographical map, an influence map, and an elasticity map. When adding the spatial information in the road network map to the temporal feature map, in this embodiment, the spatial information corresponding to the geographical map, influence map, and elasticity map in these three road networks will be integrated with the feature information in the temporal feature map to determine the spatial information integration map.

[0146] Optionally, in this embodiment, the spatial information corresponding to the geographical map, influence map, and elasticity map can be first integrated with the temporal feature map respectively to determine the corresponding spatial information maps, and then the spatial information maps are integrated to determine the spatial information integration map; or, the spatial information corresponding to the geographical map, influence map, and elasticity map can be first integrated, and then the integrated spatial information is integrated with the temporal feature map to determine the spatial information integration map. Further, in this embodiment, when determining the spatial information integration map, the first method is adopted, that is, the spatial information corresponding to the geographical map, influence map, and elasticity map is integrated with the temporal feature map respectively to determine the corresponding spatial information maps; and the spatial information maps are integrated to determine the spatial information integration map.

[0147] In step S330, spatial convolution is performed on the spatial information integration map to determine the spatio-temporal feature map.

[0148] In step S340, feature mapping is performed on the spatio-temporal feature map to determine the first prediction result.

[0149] Optionally, in addition to the above factors such as time, weather, holidays, and special events that affect traffic flow, there may be other influencing factors. To further improve the accuracy of the prediction results, in this embodiment, additional information is added on the basis of the foregoing information. The additional information may be social activity information (such as sports games, concerts, large-scale social activities, etc.), public transportation information (such as means of transportation such as subways, buses, and trains), or other information that affects the basic traffic flow. Thus, in this embodiment, when performing feature mapping on the spatio-temporal feature map to determine the first prediction result, additional information is introduced, and the first prediction result is determined by performing feature mapping on the spatio-temporal feature map and the additional information.

[0150] For ease of understanding, in this embodiment, the method for determining the first prediction result will be described in conjunction with a specific multi-graph convolutional network model.

[0151] Figure 4 is a schematic diagram of the processing process of the multi-graph convolutional network according to an embodiment of the present invention. Optionally, as Figure 4 shown, the multi-graph convolutional network in this embodiment includes a first convolutional module 11, a spatial information addition module 12, a second convolutional module 13, and a mapping module 14. The preset multi-graph convolutional network is a multi-graph convolutional network obtained by pre-training. Thus, in this embodiment, the first historical road network data and the geographical map, influence map, and elastic map in the road network map are input into the preset multi-graph convolutional network for processing to determine the first prediction result.

[0152] Optionally, the first convolutional module 11 and the second convolutional module 13 in this embodiment may adopt the same convolutional model structure (such as the MSTGCN model). Both the first convolutional module 11 and the second convolutional module 13 include a two-dimensional convolutional layer and a GLU - gated linear unit. Among them, the MSTGCN model can provide accurate traffic flow prediction results by modeling the spatio-temporal relationship in the traffic network. Specifically, by introducing multi-scale graph convolutional operations in the spatio-temporal graph data, spatio-temporal features at different time scales can be captured. Through multi-layer convolutional and pooling operations on the graph, spatio-temporal information is gradually aggregated and extracted. And since the model uses an attention mechanism to adjust the weights of different nodes or neighbor nodes, this can better distinguish important spatio-temporal relationships from unimportant spatio-temporal relationships, which is beneficial to further improving the accuracy of traffic prediction results.

[0153] It should be understood that the training process of the multi-graph convolutional network in this embodiment is similar to the processing process in the usage scenario, and the only difference is that the input data used is training sample data. Therefore, in this embodiment, an existing network model training method can be adopted for training. The training data includes basic traffic flow data and other environmental data that affect road traffic flow, etc. However, the specific network training process will not be repeated here, and only the processing process of the network will be introduced.

[0154] For ease of understanding, in this embodiment, the processing processes of the first convolutional module and the second convolutional module in the multi-graph convolutional network are first described theoretically. Among them, the convolutional operations performed by the first convolutional module and the second convolutional module correspond to different inputs, but the specific processing flow is the same, and the processing process can be expressed by the following formula:

[0155]

[0156] Γ (k) =Θ (k) *Y (k)

[0157] Ψ (k) =σ(Θ (k) *Y (k) )

[0158] Among them, the value of k is used to represent the corresponding convolutional block identifier. k = 1 indicates the first convolutional block, and k = 2 indicates the second convolutional block; is the output result of the convolution; Γ (k) and Ψ (k) are the results of the two-dimensional convolutional layer and the gated linear unit performing convolution mapping on the input data respectively; ⊙ is the Hadamard product of the two matrices; Y (k) is the input of this module and is the normalized value of the road network data. For each node in the input Y (k) , the convolutional kernel Θ will focus on the traffic flow information within an interval of m time points, extract time features through Θ, and map them to Γ (k) , Ψ (k) .; Θ (k) is the convolutional kernel of the k-th convolutional module, and its size is where and C out are the number of channels of this convolutional unit, and m is a positive integer.

[0159] Furthermore, when predicting the traffic flow, as Figure 4 shows, the input Y (1)Let the first historical traffic flow data (the traffic flow data obtained after the first preprocessing of the initial traffic flow data), and the first convolution module 11 performs convolution on the first historical traffic flow data in the time dimension based on the aforementioned processing process, and the output result of the first convolution module 11 is determined as the time feature map, and the time feature map is input into the spatial information addition module 12 for processing.

[0160] The spatial information addition module 12 receives the time feature map determined by the first convolution module 11 and the aforementioned determined road network map (including the geographical map G g , the influence map G r and the elasticity map G s ), and processes the time feature map and the road network map to add the spatial information in the road network map to the time feature map, and outputs the spatial information integration map.

[0161] Optionally, in this embodiment, when determining the spatial information integration map based on the spatial information addition module 12, first, the spatial information maps corresponding to the geographical map, the influence map, and the elasticity map are respectively determined based on the spatial information addition module and the time feature map, and then the spatial information maps are integrated to determine the spatial information integration map.

[0162] Specifically, in this embodiment, the geographical map G in the road network map is determined based on the following formula g , the influence map G r and the elasticity map G s corresponding spatial information maps and

[0163]

[0164]

[0165]

[0166] ReLU(A ij ) = max(A ij , 0)

[0167] where W is the weight matrix corresponding to each road network map; I is the identity matrix of dimension V; representation matrix element in; is the spatial information map corresponding to each road network map; ω sc is a learnable parameter matrix.

[0168] Furthermore, in this embodiment, based on the following integration formula for the geographical map G g , the influence map Gr and the elastic graph G s The corresponding spatial information graph and are integrated, and the integration formula is:

[0169]

[0170] After that, the integrated matrix is used as the output result of the spatial information addition module 12, that is, the spatial information integration graph.

[0171] Furthermore, in this embodiment, the spatial information integration graph output by the spatial information addition module 12 is used as the input Y of the second convolution module 13 (2) That is The second convolution module 13 performs convolution on the spatial information integration graph in the spatial dimension, and the output result of the second convolution module 13 is determined as the spatio-temporal feature map. At the same time, the convolution process of the second convolution module in this embodiment has been introduced in the foregoing content and will not be repeated here.

[0172] Finally, the mapping module 14 performs feature mapping on the features and additional information in the spatio-temporal feature map based on the attention mechanism and outputs the first prediction result.

[0173] Optionally, the mapping module in this embodiment is implemented by a fully connected layer. When performing feature mapping on the spatio-temporal feature map and additional information based on the mapping module to determine the first prediction result, the processing process of the mapping module is expressed by the following formula:

[0174]

[0175] Among them, is the first prediction result, is the external information obtained above; w fc and b are trainable parameters; w fc is the weight matrix of the fully connected layer in the mapping module; b is the offset value, which is determined according to experience.

[0176] Thus, in this embodiment, by fully considering historical road network data, topological relationships in the road network, correlations between roads, dynamic inherent semantics, and additional information in the traffic flow prediction process to determine the traffic flow prediction result, the accuracy of the traffic flow prediction result can be made higher.

[0177] In step S140, the traffic flow prediction result is determined according to the first prediction result.

[0178] In an alternative implementation, after determining the first prediction result in this embodiment, the first prediction result is determined as the final traffic flow prediction result. Thus, in this embodiment, by constructing road network graphs from different perspectives and using a preset multi-graph convolutional network to process the road network graphs and historical road network data to determine the traffic flow prediction result, the road network information and traffic data can be fully utilized to predict the traffic flow, improving the accuracy of traffic flow prediction.

[0179] In another alternative implementation, in this embodiment, while predicting based on the multi-graph convolutional network to determine the first prediction result, other traffic flow prediction methods are simultaneously used for traffic flow prediction, and the final traffic flow prediction result is determined based on the prediction results obtained under different prediction methods.

[0180] Figure 5 It is a schematic diagram of the traffic flow prediction method of the embodiment of the present invention. As Figure 5 shown, in this embodiment, the multi-graph convolutional network 10, the adaptive embedding network 20, and the counterfactual generator network 30 are respectively used for processing. The prediction result of the multi-graph convolutional network 10 is determined as the first prediction result, the prediction result of the adaptive embedding network 20 is determined as the second prediction result, and the prediction result determined by the counterfactual generator network 30 is determined as the third prediction result. Then, the final traffic flow prediction result is determined according to the first prediction result, the second prediction result, and the third prediction result. Correspondingly, in this embodiment, when determining the traffic flow prediction result according to the first prediction result, it includes determining the traffic flow prediction result according to the first prediction result, the second prediction result, and the third prediction result. Thus, by predicting the traffic flow through different prediction methods and determining the final traffic flow prediction result by referring to the relationship between the prediction results under different methods, the traffic flow prediction result is more in line with the actual situation and has higher accuracy.

[0181] Optionally, in this embodiment, the traffic flow prediction result is determined from the first prediction result, the second prediction result, and the third prediction result based on a voting mechanism. The voting mechanism refers to voting on multiple models or multiple prediction results to determine the final output result. Common voting mechanisms include hard voting and soft voting. In hard voting, the category that appears most frequently in the prediction results is selected as the final output result, or, in case of a tie, a category is randomly selected as the output. In soft voting, all prediction results are averaged or weighted averaged to obtain the final prediction result.

[0182] Further, in the present embodiment, when determining the vehicle flow prediction result, the difference between any two prediction results is first selected and determined, and then the final vehicle flow prediction result is determined according to the difference between the detection results. Specifically, when there are at least two prediction results with a difference of zero (that is, the three detection results are the same), one of the same detection results is randomly selected as the vehicle flow detection result; or, one of the two detection results with the smallest difference is selected as the vehicle flow prediction result; or, the three-phase detection results are sorted according to the difference between the detection results, and the detection result corresponding to the middle value is selected as the vehicle flow prediction result. For example, assuming that the first detection result, the second detection result, and the third detection result are a, b, and c, respectively, and the difference between the three detection results is the absolute value of ab, bc, and ac, respectively, when ab=0, the first detection result or the second detection result is determined as the vehicle flow prediction result. Alternatively, when ab<bc and ab<ac, the first detection result or the second detection result is determined as the vehicle flow prediction result; or when a<b<c is determined according to the difference, the second detection result is determined as the vehicle flow prediction result. Therefore, by determining the final traffic flow prediction result from multiple prediction results through the above voting mechanism, the accuracy and robustness of the prediction results can be improved.

[0183] Figure 6 FIG. 4 is another flow chart of the vehicle flow prediction method according to an embodiment of the present invention. Figure 6 As shown, the method in this embodiment includes the following steps.

[0184] In step S610, second historical road network data is obtained.

[0185] In this embodiment, the second historical road network data is the historical real-time road network data that occurred between the time periods to be measured, and the historical real-time road network data includes basic traffic flow data, and the basic traffic flow data includes data that directly reflects traffic flow information, such as the number of vehicles passing through the road, the time when the vehicles pass through the road, and the speed at which the vehicles pass through the road. Furthermore, the first historical road network data in this embodiment also includes other data that affect the road traffic flow, such as environmental data. Environmental data includes similar environmental data that affect the road traffic flow, such as the road control time, the distribution location of road points of interest, etc.

[0186] Figure 7 FIG. 1 is a flow chart of a method for obtaining second historical road network data according to an embodiment of the present invention. Figure 7 As shown, in this embodiment, when obtaining the second historical road network data, it is achieved through the following steps.

[0187] In step S710, initial road network data is obtained.

[0188] In this embodiment, the initial road network data and the method for obtaining the initial road network data have been introduced in the foregoing content and will not be repeated here.

[0189] In step S720, perform a second preprocessing on the initial road network data to determine the second historical road network data.

[0190] In this embodiment, the second preprocessing includes one or more of the following processes: data cleaning, data conversion, and semantic disambiguation. Among them, data cleaning is used to process incorrect, duplicate, and missing data, thereby improving the accuracy of the data. For occasionally missing data, if there is data at the sampling times before and after the node, the weighted average of the data at the two sampling times before and after is used as the data of the node, and the weight is the reciprocal of the distance from the node with missing data to the two nearest sampling time points. For a large amount of missing data, considering the periodicity of traffic flow in days and weeks, the result of averaging the data of the day or week before and after the missing node is directly used as the data of the missing point. For duplicate data, it is deleted or integrated after comparison. Data conversion is to convert data in different formats and structures into a unified representation for subsequent processing. For the representation of time, the starting time is manually marked, and then each time point is numbered sequentially using integers. The method of semantic disambiguation can be the same as the method described above, so it will not be elaborated here. The data cleaning and data conversion are introduced below.

[0191] Optionally, in this embodiment, when performing the second preprocessing, first perform data cleaning and data conversion on the initial road network data, and then perform semantic disambiguation based on the results of the data cleaning and data conversion. Thus, in this embodiment, by obtaining the initial road network data and performing operations including data cleaning, data conversion, and semantic disambiguation on the initial road network data, the second historical road network data for determining the traffic flow prediction result is obtained, which can ensure the numerical accuracy and data standardization of the data to be processed (i.e., the second historical road network data) during the traffic flow prediction process, and is beneficial to improving the processing efficiency of traffic flow prediction while ensuring the reliability of the data and the accuracy of the prediction result during the traffic flow prediction process.

[0192] In step S620, construct a graph according to the second historical road network data and the road network relationship to generate an initial graph.

[0193] In this embodiment, a graph is constructed according to the second historical road network data and the road network relationship to generate an initial static graph. Optionally, in this embodiment, a Graph Neural Network (GNN) model, such as Graph Convolutional Networks (GCN) or Graph Attention Networks (GAT), can be used to determine the initial graph. The nodes in the initial graph correspond to road intersections in the road network, positions where detection sensors are arranged, or other landmark positions, and the nodes are connected by edges. The node information corresponding to each node in the initial graph is determined according to the second historical road network data and is represented by means such as an adjacency matrix, a node feature matrix, and an edge feature matrix.

[0194] In step S630, the initial graph is dynamically trained to determine the corresponding dynamic graph.

[0195] In this embodiment, since the road network data has the characteristic of dynamic change, after the initial graph is determined, the initial graph will be dynamically trained to determine the corresponding dynamic graph, so as to express the traffic flow-related information of the road network in real time through the dynamic graph.

[0196] Optionally, in this embodiment, after the initial graph is generated, the InfoTrain dynamic training method is introduced to dynamically train the initial graph, process the dynamic changes of the nodes and edges in the graph (such as the changes of the attributes and connection relationships of the nodes over time, or the emergence of new nodes and edges over time in the dynamic graph network), and determine the corresponding dynamic graph, so as to reflect the changes in the topological structure of the nodes and edges over time through the dynamic graph, update and optimize the initial graph, and make subsequent traffic flow predictions using the dynamic graph to improve the traffic flow prediction results.

[0197] Figure 8 is a schematic diagram of the dynamic training process of the embodiment of the present invention. As Figure 8 shown, in this embodiment, after the initial graph and the initial value W of the corresponding weight matrix in the initial graph are determined 0 an embedding operation is performed on the initial graph to obtain the output graph H of the current cycle t . Then, a qualification function and a qualification rate function are constructed based on the node information in the output graph, and the nodes in the output graph H t are evaluated through the qualification function and the qualification rate function. Among them, the qualification function of the defined model is used to take the output i of the model for a certain node v as the input of this node and output the qualification degree The higher the qualification value, the more the output graph after embedding can reflect the information of the node. Define the qualification rate function of the model For the t-th training cycle and node v i , the probability of its qualification is Nodes with a high qualification rate indicate that the training results meet the preset requirements and the training can be ended; while nodes with a low qualification rate indicate that the training results have not yet met the preset requirements and usually need to continue training.

[0198] Furthermore, during the training process, training is carried out through a predefined training strategy The training process is also an update of the weight matrix W in the output graph. Usually, a dynamic training process contains multiple training cycles. For the t-th training cycle, define the weight matrix obtained by training in this training cycle as W t , and the output graph is H t ∈R n×d′ , and ensure during each training cycle

[0199] Specifically, in this embodiment, the training strategy can be determined according to the first training subset Q t+ and the second training subset Q t- after node segmentation. Assume that the first training subset Q t+ and the second training subset Q t- are random sets, and calculate the expected values of the corresponding losses and where and are used to represent the adaptive versions of the original loss function , and Q t+ and Q t- replace as the training node set. When calculating the expected value of the loss, first define The original loss function in the (t + 1)-th cycle is Then adapt this loss function to the training subsets Q t+ and Q t- , and and are used to train Q t+ and Q t- respectively. Among them Due to the randomness of Q t+ and Q t- , the expectations of the above two loss functions are calculated and determined according to the following formula, which are respectively

[0200]

[0201]

[0202] Moreover, integrate the determined expectations above into the dynamic training process of the next cycle. At the same time, for H t ∈R n ×d′ , specify a positive even number α less than the dimension of d′ and divide H t into three parts according to the dimension, that is and where represents the matrix composed of the a-th row to the b-th row (including a and b) in the matrix H t . Let be the i-th vector in . Then, use three loss functions to define the final training strategy

[0203]

[0204] Thus, in this embodiment, by dynamically training the initial graph to determine the corresponding dynamic graph, it can continuously adapt to the changes in the data in the dynamic graph during the training process, better capture the features and change patterns of the dynamic graph, and use the features of the dynamic graph to improve the usage performance and generalization ability of the graph, which is beneficial to further improving the traffic flow prediction results determined based on the dynamic graph subsequently.

[0205] Figure 9 is the flowchart of the method for dynamically training the initial graph in the embodiment of the present invention. As Figure 9 shown, in this embodiment, the method for dynamically training the initial graph to determine the corresponding dynamic graph includes the following steps.

[0206] In step S910, perform an embedding operation on the input graph of the current cycle to determine the output graph of the current cycle, where the input graph of the current cycle is the initial graph or the output graph of the previous cycle.

[0207] In this embodiment, determine the output graph of the current cycle by randomly embedding a certain number of nodes and / or edges in the input graph of the current cycle. It should be understood that the input graph of the current cycle here can be the initial graph g corresponding to the first execution of the embedding operation, or the graph H t-1 to be continuously trained after the previous cycle of training is completed. When performing the embedding operation on the initial graph g, the corresponding training cycle is the first training cycle, and the output graph obtained after the embedding operation is H 1 , and the corresponding weight matrix is W 1 . When performing the embedding operation on the graph H t-1 , the corresponding training cycle is the t-th training cycle, and the output graph obtained after the embedding operation is H t, the corresponding weight matrix is W t .

[0208] Optionally, in this embodiment, when performing the embedding operation to determine the output graph of the corresponding current period, for H t , we construct a random edge set ε using the following rules t :[[]] where σ(·) is the sigmoid activation function. For the initial graph g, when determining the corresponding output graph H 1 , a random edge set will be created When constructing , first obtain the adjacency matrix A ∈ {0, 1} of graph g n×n ; then calculate the probability of each pair of nodes (v i , v j ) Probability ( corresponding to the unembedded features). When there are no known features X or edges ε in the initial graph g, the following augmentation is performed before constructing : For the edge ε lacking the feature X, set X ∈ {1} n×1 ; for the feature X lacking the edge ε, set i.e., A = {1} n×n . Thus, the random edge set is constructed through the above method to implement the graph embedding operation, and the graph obtained after the graph embedding operation is used as the output graph of the current period.

[0209] In step S920, node evaluation is performed based on the structural mutual information between nodes to determine the node evaluation result.

[0210] In this embodiment, the structural mutual information (SMI) is a metric method for measuring the relationship between nodes in graph data. It is based on the concept of information theory and is used to measure the correlation and mutual dependence between two nodes under a given graph structure, revealing the connection relationship, similarity, commonality, cooperation, etc. between nodes. The calculation process of the structural mutual information is similar to the traditional mutual information calculation, which can help discover patterns such as the close relationship between nodes, community structure, and information flow, thus contributing to a deeper understanding of the relationships in graph data. Therefore, in this embodiment, node evaluation is performed based on the structural mutual information between nodes in the output graph to determine the node evaluation result, providing convenience for subsequent dynamic training based on the node evaluation result.

[0211] Next, the method for determining the node evaluation result in this embodiment will be described. Assume that the initial graph at the start of the current period is The current output graph is Then the neighbor sets N′ i+ := {v j |(v i , v j ) ∈ ε′} and N″ i+ := {v j |(v i , v j ) ∈ ε″} are used to describe the local structure of each node in g′ and g″, and let their complements be After that, for a randomly selected node v from j , consider four basic events: v j ∈ N′ i+ , v j ∈ N′ i- , v j ∈ N″ i+ , v j ∈ N″ i- , and use P i ′ + , P i ′ - , P i ″ + and P i ″ - to represent the probabilities of the above events:

[0212] P i ′ + = p(v j ∈ N′ i+ )

[0213] P i ′ - = p(v j ∈ N′ i- )

[0214] P i ″ + = p(v j ∈ N″ i+ )

[0215] P i ″ - = p(v j ∈ N″ i- )

[0216] Meanwhile, for the randomly selected node v from j , consider four compound events: v j ∈ N′ i+ ∩ N″ i+ , v j ∈ N′i+ ∩N″ i- ,v j ∈N′ i- ∩N″ i+ , v j ∈N′ i- ∩N″ i- ∈, and use P i ++ , P i +- , P i -+ and P i -- To express the probability of the above events, they are as follows:

[0217] P i ++ = p(v j ∈N′ i+ ∩N″ i+ )

[0218] P i +- = p(v j ∈N′ i+ ∩N″ i- )

[0219] P i -+ = p(v j ∈N′ i- ∩N″ i+ )

[0220] P i -- = p(v j ∈N′ i- ∩N″ i- )

[0221] Afterwards, the complement set N′ is determined by the probability of occurrence of the above events i and N″ i The information difference between i ,N″ i ). Information difference is used to characterize the information difference between graph structures, which can also be called structural mutual information (SMI). The sum of structural mutual information can reflect the information similarity between two graphs. The larger the sum, the closer the information in the two graphs is. For example, for graph and

[0222] Optionally, in this embodiment, the information difference I(N′) is determined by the following formula: i ,N″ i ):

[0223]

[0224] Further, after determining the above information differences, based on a preset qualification function evaluate the situation of node embedding, and use the qualification of node embedding as the evaluation result of node embedding.

[0225] In step S930, perform node dynamic segmentation according to the node evaluation result to determine the first training subset and the second training subset.

[0226] After determining the qualification of each node embedding, in this embodiment, dynamic segmentation of the node set is performed according to the embedding situation of the nodes, and the first training subset Q t+ and the second training subset Q t- are determined to utilize the training subsets Q t+ and Q t- to emphasize the importance of the nodes that have been learned well and the nodes that need to be learned.

[0227] Optionally, in this embodiment, according to the embedding situation of each node in, determine the probability that each node falls into the two training subsets Q t+ and Q t- , and based on the probability that the node falls into the training subsets Q t+ and Q t- , determine the first training subset Q t+ and the second training subset Q t- of the current period.

[0228] Further, in this embodiment, a qualification rate function is constructed based on the aforementioned structural mutual information and determine the probability p(v t+ ∈Q t- ) and p(v i ∈Q t+ ) that the corresponding node falls into the training subsets Q i and Q t- according to the qualification of each node.

[0229] Specifically, first set a learnable matrix M t =[0,1] n×1 , and then define as the i-th value in M t , and determine the qualification rate function based on the following formula

[0230]

[0231]

[0232]

[0233]

[0234] Based on the above formula, for each node v i the SMI value determine the corresponding pass rate value reflects the difference between the embedded information and the input graph structure and features. At the same time, using the pass rate makes the nodes with higher SMI values fall into the first training subset Q t+ and the nodes with lower SMI values fall into the second training subset Q t- .

[0235] In step S940, determine the loss value of the current cycle according to the probabilities of each node in the current output graph falling into the first training subset and the second training subset.

[0236] In this embodiment, the loss value of the current cycle is used to characterize the difference between the current output graph and the actual output graph.

[0237] Optionally, in this embodiment, when calculating the loss value of the current cycle, the loss value of the first training subset can be determined according to the probability of each node in the current output falling into the first training subset, and the loss value of the second training subset can be determined according to the probability of each node in the current output falling into the second training subset. Then, the loss value of the current cycle is determined according to the loss value of the first training subset and the loss value of the second training subset.

[0238] Furthermore, in this embodiment, when determining the loss value of the current cycle, the loss value of a preset loss function during the training process can also be considered. The loss values of the first training subset and the second training subset are used as the fitness values of the loss value of the preset loss function, and the loss value of the current cycle is jointly determined based on the loss value of the first training subset, the loss value of the second training subset, and the loss value of the preset loss function.

[0239] In step S950, determine whether the training of the current cycle meets the preset conditions.

[0240] In this embodiment, the preset condition is used as the judgment criterion for whether the dynamic training ends. By determining whether the loss of the current cycle meets the preset conditions, it is determined whether to end the dynamic training.

[0241] Optionally, the preset condition in this embodiment may be that the loss in the current cycle reaches a preset value, that is, the loss value in the current cycle is less than or equal to the preset value (at this time, the node qualification degrees of all nodes in the output graph of the current cycle reach the preset value); it may also be that the number of training times corresponding to the end of the current cycle reaches a preset number of times. When it is determined whether the loss in the current cycle meets the preset condition, step S960 is continued; otherwise, return to execute step S910 until the loss in the corresponding current cycle meets the preset condition. It should be understood that the preset value and the preset number of times in this embodiment can be set by using empirical values or according to the actual usage requirements in the scenario.

[0242] In step S960, in response to the training in the current cycle meeting the preset condition, the output graph of the current cycle is determined as the dynamic graph.

[0243] In this embodiment, when the preset condition is that the loss value in the current cycle is less than or equal to the preset value, in response to the loss value in the current cycle being less than or equal to the preset value, the output graph of the current cycle is determined as the dynamic graph; when the preset condition is that the number of training times corresponding to the end of the current cycle reaches the preset number of times, in response to the number of training times corresponding to the end of the current cycle reaching the preset number of times, the output graph of the current cycle is determined as the dynamic graph.

[0244] Thus, in this embodiment, the dynamic training process of the initial graph is completed through the above method, and the dynamic graph is determined to express the traffic flow-related information of the road network in real time through the dynamic graph, so that the dynamic graph can represent richer information, which is convenient for subsequent traffic flow prediction based on the dynamic graph and is beneficial to improving the accuracy of the traffic flow prediction result.

[0245] In step S640, the dynamic graph is input into a preset adaptive embedding network for processing to determine the second prediction result.

[0246] In this embodiment, the second prediction result is determined by inputting the dynamic graph obtained through dynamic training into a preset adaptive embedding network for processing.

[0247] Optionally, considering that there are both common information (such as node attributes) and specific information in the graph information in the dynamic graph for determining the second prediction result and the data information in the second historical road network data (such as some information unrelated to road network connectivity unique to the second historical road network data, such as road surface obstacles, etc.; or social relationship information unique to the dynamic graph that is not reflected in the historical road network data, etc.), in order to comprehensively utilize the historical road network data and improve the real-time performance of the traffic flow prediction result, in this embodiment, when determining the second prediction result based on the adaptive embedding network prediction, the time series information in the second historical data information and the optimized dynamic graph will be first integrated. The common information in the dynamic graph and the second historical road network data will be merged, and the specific information held separately in the dynamic graph and the second historical road network data will be integrated. Then, the data after the merge and integration processing will be processed by the adaptive embedding network, and the output result of the adaptive embedding network will be determined as the second prediction result.

[0248] Figure 10 is the flowchart of determining the second prediction result in the embodiment of the present invention. As Figure 10 shown, the method for determining the second prediction result in this embodiment specifically includes the following steps.

[0249] Step S1010, integrate the information of the dynamic graph and the second historical road network data to determine the spatio-temporal representation graph.

[0250] In this embodiment, for the common feature information in the dynamic graph and the second historical road network data, the integration can be carried out in a merged manner; for the feature information held separately in the dynamic graph and the second historical road network data, the integration can be carried out in a way of retention and coexistence. Thus, by integrating the information of the dynamic graph and the second historical road network data, the determined spatio-temporal representation graph after integration can retain both the common information and the specific information held separately, making the data used in the subsequent traffic flow prediction process more comprehensive and accurate, which is conducive to further improving the accuracy of the traffic flow prediction result.

[0251] Step S1020, capture the temporal features and spatial features in the spatio-temporal representation graph to determine the intermediate feature graph.

[0252] Optionally, in this embodiment, the temporal features and spatial features in the spatio-temporal representation graph can be captured simultaneously, or the temporal features and spatial features in the spatio-temporal representation graph can be captured successively.

[0253] Step S1030, map the intermediate feature graph to determine the second prediction result.

[0254] For ease of understanding, in this embodiment, the method for determining the second prediction result will be described in combination with a specific adaptive embedding network model.

[0255] Figure 11 is the processing flowchart of the adaptive embedding network according to an embodiment of the present invention. Optionally, as Figure 11 shown, the adaptive embedding network in this embodiment includes a graph embedding module 21, a temporal transformation module 22, a spatial transformation module 23, and an output module 24.

[0256] When determining the second prediction result, the graph embedding module 21 in this embodiment captures and extracts hidden features (such as, patterns and correlation features of spatio-temporal data) in the spatio-temporal data corresponding to the dynamic graph and the second historical road network data based on the technology of mapping spatio-temporal data to a low-dimensional space, and integrates the extracted hidden features to determine a spatio-temporal labeled graph, so as to provide effective input for the subsequent traffic flow prediction process, which is beneficial to improving the accuracy of the subsequent traffic flow prediction result.

[0257] Optionally, considering the important influence of time on the traffic prediction result, and the time relationship in the traffic time series not only has continuity and periodicity, but is also affected by the time order (for example, the time frames in the traffic time series should be more similar to the nearby time frames), and the time series from different sensors often have different time patterns. When determining the spatio-temporal representation graph, the graph embedding module 21 in this embodiment first determines the feature embedding E f , the periodic embedding E p , and the adaptive embedding E a respectively, and then determines the spatio-temporal representation graph according to the above three embeddings. Among them, the feature embedding E f is used to reflect the feature information under continuous time; the periodic embedding E p is used to reflect the feature information under periodic time; the adaptive embedding E a is used to capture complex spatio-temporal relationships in a unified manner, and the adaptive embedding E a can be shared among different business time series.

[0258] Furthermore, when determining the feature embedding E f , the fully connected layer in the graph embedding module is used to obtain the feature embedding The feature embedding can be expressed by the following formula: E f = FC(X t-T+1:t ), where X t-T+1:t is the traffic flow sequence, T is the time, N represents the number of spatial nodes, d f is the dimension of the feature embedding, and FC(·) is the fully connected layer.

[0259] When determining the periodic embedding E p , first, the day-of-week of the learnable embedding dictionary is represented as The time stamp of the embedding dictionary day is represented as Nw Represents the number of days in a week, N d is the number of timestamps per day. After that, W t , D t are represented as the timestamps of the weekly data and daily data of the traffic time series in t-T+1:t. Using the timestamps as indices, the corresponding weekly embedded days are extracted from the embedding dictionary and daily embedded timestamps Finally, the periodic embedding E of the time series is determined through concatenation and broadcasting p .

[0260] When determining the adaptive embedding E a , first, the characteristics of the traffic time series need to be considered, including periodicity, similarity between time series, etc. Then extract features (which have nothing to do with the feature embedding E f ) so that the information about time relationships is included in these features. Finally, select a suitable model (such as a convolutional neural network) to process these features to better capture spatio-temporal relationships. At the same time, when sharing E a between different business time series, only the weight parameters need to be shared.

[0261] Finally, after determining the feature embedding E f , the periodic embedding E p and the adaptive embedding E a , based on the spatio-temporal representation Z hidden by the following formula, and then represent the spatio-temporal representation graph through the spatio-temporal representation Z:

[0262] Z = E f || E p || E a

[0263] where, the hidden dimension d of the spatio-temporal representation graph h is equal to 3d f + d a , d f is the dimension of the input features, and d a is the dimension of other additional features. Thus, by performing a weighted sum combination of the dimension of the additional features and the dimension of the input features, more attention can be paid to specific feature combinations or more feature expression capabilities can be provided in the hidden representation.

[0264] Furthermore, in this embodiment, after determining the spatio-temporal representation graph, the temporal features in the spatio-temporal representation graph are captured through the temporal transformation module 22, and the temporal feature graph is determined.

[0265] Optionally, the temporal transformation module 22 in this embodiment is implemented by a time transformer. When determining the temporal feature map, first obtain a hidden spatio-temporal representation Z (i.e., the spatio-temporal representation map) with T frames and N spatial nodes, and obtain the query matrix Q through the time transformer layer (te) , the key matrix K (te) and the value matrix, as follows:

[0266]

[0267]

[0268]

[0269] wherein, are learnable parameters.

[0270] After that, calculate the self-attention score A based on the following formula (te) , to obtain the output Z of the time transformer based on A (te) , and represent the temporal feature map output by the temporal transformation module 22 through the output Z (te) , and through the output Z (te) characterize the temporal feature map output by the temporal transformation module 22:

[0271]

[0272] Z (te) =A (te) V (te)

[0273] wherein, d h represents the hidden dimension, is a scaling factor used to control the range and distribution of the attention weights.

[0274] Thus, in this embodiment, the attention weights are calculated by the above method, so that the attention weights are normalized among different queries, and important temporal relationships can be emphasized. At the same time, by introducing the calculation of the scaling factor, the finally obtained temporal feature map can retain the temporal information in the input data without being affected by the hidden dimension, which is beneficial to further improving the accuracy of the subsequent traffic flow prediction results.

[0275] Furthermore, in this embodiment, based on the spatial transformation module, capture the spatial features in the temporal feature map to determine the intermediate feature map. Optionally, the spatial transformation module 23 in this embodiment can adopt a network model with the same structure as the aforementioned temporal transformation module 22, and determine the intermediate feature map based on a determination method similar to that of the temporal feature map. The difference is that the input of the spatial transformation module 23 is the temporal feature map, and when performing attention output, the spatial relationship is emphasized based on the self-attention score, and the output Z is determined by the corresponding spatial transformer layer based on the following formula(sp) , to output Z (sp) to represent the intermediate feature map output by the spatial transformation module 23:

[0276] Z (sp) = SelfAttention(Z (te) )

[0277] Among them, SelfAttention follows the above several equations. It should be understood that existing methods such as layer normalization, residual connection, and multi-head mechanism are also applied in the above feature capture process to assist in feature extraction and attention mechanism-based expression, which will not be elaborated here.

[0278] Furthermore, in this embodiment, the output module 24 maps the intermediate feature map containing time and space information, and determines the mapping result output by the output module 24 as the second prediction result.

[0279] Optionally, the output module 24 in this embodiment is implemented by a regression layer, and the processing process of the regression layer can be formulated as the following formula:

[0280]

[0281] Among them, is the traffic flow prediction result, that is, the second prediction result; T′ is the predicted range; d is the dimension of the output feature, which is equal to 1 in this case.

[0282] Thus, in this embodiment, by capturing the time features and space features in the input data and expressing them under the attention mechanism, the historical road network data and the time information and space information in the dynamic graph are fully considered in the traffic flow prediction process, thereby improving the accuracy of the traffic flow prediction result.

[0283] In step S650, the dynamic graph is input into a preset counterfactual generator network for processing to determine the third prediction result.

[0284] Figure 12 is the flowchart of determining the third prediction result in the embodiment of the present invention. As Figure 12 shown, in this embodiment, when the dynamic graph is input into a preset counterfactual generator network for processing to determine the third prediction result, the following steps are included.

[0285] In step S1210, the temporal features and spatial features in the dynamic graph are captured to determine the observed prediction result.

[0286] In step S1220, the temporal features and spatial features in the dynamic graph after introducing the perturbation mask are captured to determine the counterfactual output result.

[0287] In step S1230, an optimal perturbation mask and a counterfactual output result under the optimal perturbation mask are determined based on the observation prediction result and the counterfactual output result.

[0288] In step S1240, the counterfactual output result under the optimal perturbation mask is determined as the third prediction result.

[0289] For ease of understanding, in this embodiment, the method for determining the first prediction result will be described in conjunction with a specific multi-graph convolutional network model.

[0290] Figure 13 It is a processing flowchart of the counterfactual generator network according to an embodiment of the present invention. As Figure 13 shown, the counterfactual generator network in this embodiment includes a graph transformation module 31 and a counterfactual generation module 32. Among them, the graph transformation module 31 is used to capture the temporal features and spatial features in the dynamic graph to determine the observation prediction result. The counterfactual generation module 32 is used to introduce a perturbation mask on the basis of the existing dynamic graph, and capture the temporal features and spatial features in the dynamic graph after introducing the perturbation mask to determine the counterfactual output result. That is, the graph transformation module 31 and the counterfactual generation module 32 constitute two branches of traffic prediction. Then, by comparing the difference between the counterfactual output result and the observation prediction result, the perturbation mask is selected or adjusted, and then the optimal perturbation mask and the counterfactual output result corresponding to the optimal perturbation mask are determined, and the counterfactual output result corresponding to the optimal perturbation mask is output as the third prediction result.

[0291] Optionally, the graph transformation module 31 in this embodiment includes a time transformer and a space transformer. The processing processes of the time transformer and the space transformer are the same as those in the foregoing adaptive embedding network, and the difference is that the input data processed by the graph transformation module 31 only includes the information in the dynamic graph. Thus, in this embodiment, the dynamic graph is input into the time transformer and the space transformer in the graph transformation module 31 for processing, and the observation prediction result is output.

[0292] Furthermore, to fully reflect the impact of the perturbation mask, the difference in the processing of the graph by the graph transformation module 31 and the counterfactual generation module 32 in this embodiment lies only in the processing object. The processing object of the graph transformation module 31 is the original dynamic graph, while the processing object of the counterfactual generation module 32 is the graph with a perturbation mask introduced on the basis of the original dynamic graph. At the same time, the counterfactual generation module 32 in this embodiment has the same components as the graph transformation module 31. The counterfactual generation module 32 also includes a spatial transformer and a temporal transformer, and the processing processes of the spatial transformer and the temporal transformer are the same as those of the spatial transformer and the temporal transformer in the graph transformation module 31. At the same time, it should be understood that the graph transformation module 31 in this embodiment also includes other components necessary for the graph neural network processing that are not shown in other figures but are also present in the counterfactual generation module 32, such as, multi-head connectors, etc.

[0293] In this embodiment, through the temporal transformer and the spatial transformer in the graph transformation module, the temporal features and spatial features in the dynamic graph (hereinafter referred to as the spatio-temporal transformer) are captured to determine the observation prediction result. Specifically, the complex correlations in traffic flow prediction are captured by the spatio-temporal transformer. In the spatial dimension, combined with the propagation delay, the attention is focused on the neighbors and semantic neighbors of the nodes. In the temporal dimension, it can mine the global dynamic time patterns. Formally, for the self-attention mechanism (ATT), the query matrix Q, the key matrix K, and the value matrix V derived from the same input features are obtained, and the specific determination methods are as follows:

[0294] Q = XW Q

[0295] K = XW K

[0296] V = XW V

[0297] Among them, W Q 、W K 、W V are learnable projection matrices, and X is the node feature.

[0298] After that, the attention weight matrix A is defined to capture the dependencies between all nodes. The attention weight matrix can adopt a dynamic adjacency matrix that changes with the input features. The self-attention operation is completed by updating A with the value matrix V:

[0299]

[0300] ATT(Q, K, V) = softmax(A)V

[0301] Among them, d is the dimension of the query, key, and value matrices.

[0302] Thus, in this embodiment, the dynamic graph is input into the time transformer and the spatial transformer in the graph transformer module for processing, and the observation prediction result is output.

[0303] Furthermore, in this embodiment, when determining the optimal perturbation mask and the counterfactual output result under the optimal perturbation mask based on the counterfactual generation module and the observation prediction result,

[0304] The framework of the counterfactual generation module is served by the trained graph transformer (including the time transformer and the spatial transformer). Meanwhile, a perturbation mask is introduced on the graph structure of the existing dynamic graph, and the counterfactual interpretation in the spatial and temporal dimensions under the perturbation mask is obtained by applying the perturbation mask to the graph transformer, that is, the counterfactual output result; then, the optimal perturbation mask on the input data features and the graph structure is determined by searching, and the counterfactual output result under the optimal perturbation mask is determined.

[0305] Optionally, in this embodiment, the perturbation mask is defined as the only learnable parameter in the counterfactual generator. The perturbation mask is characterized by a perturbation matrix, and the perturbation matrix includes M S and M F , where the perturbation matrix M S is used to characterize the feature mask, and the perturbation matrix M F is used to characterize the graph mask. The feature mask is a binary mask used to indicate specific regions or features in an image. It is usually a two-dimensional matrix with the same size as the original image, and the elements in it indicate whether the corresponding position contains the feature of interest. The elements in the feature mask are usually 0 or 1, where 0 indicates that the position does not contain the feature, and 1 indicates that the position contains the feature. By performing an element-wise multiplication operation between the feature mask and the original image, specific regions or features in the image can be extracted or highlighted. The graph mask is a binary mask used to select or exclude specific regions in an image. It is also a two-dimensional matrix with the same size as the original image, and the elements in it indicate whether the corresponding position should be retained or excluded. The elements in the graph mask are usually 0 or 1, where 0 indicates that the position should be excluded, and 1 indicates that the position should be retained. By performing an element-wise multiplication operation between the graph mask and the original image, specific regions in the image can be selectively retained or excluded for further processing or analysis.

[0306] Furthermore, considering that the operable range of spatial perturbation is very large, targeted initialization can effectively search for counterfactuals; and considering the symmetry of the adjacency matrix, M S is set as a symmetric matrix, and only the upper triangular part is set as the learnable parameter, so as to increase the randomness and instability of M S by setting the value of M S to continuous values.

[0307] Meanwhile, in this embodiment, the perturbation mask is added to the dynamic graph through the GCN (Graph Convolutional Network) shown in Figure 13 . Specifically, convolution operations are performed on the dynamic graph data through the GCN to learn the representations of the nodes. It utilizes the feature information of the nodes and their neighbor nodes to update the representations of the nodes, thereby capturing the relationships and context information between the nodes. Based on the information aggregation of the neighbor nodes, by weighted summing the node features with the features of the neighbor nodes and then applying a non-linear activation function to update the representations of the nodes, multi-layer iterations are performed on the graph data to obtain richer feature representations. And, the principle of action of the perturbation mask is represented by the following formula:

[0308]

[0309]

[0310] where, represents the corresponding adjacency matrix after introducing perturbations; represents the node features corresponding to the graph after introducing perturbations; A represents the adjacency matrix corresponding to the graph before introducing perturbations; X represents the node features corresponding to the graph before introducing perturbations.

[0311] Optionally, in this embodiment, before introducing the perturbation mask into the dynamic graph, it is assumed that the adjacency matrix A of the original dynamic graph is GCN , and the graph A is masked before performing the Laplacian operation on the GCN GCN , and the weight matrices A of the transformer are masked Geo and A Tem . Since the operating range of the time dimension is very narrow, very slight perturbations can achieve counterfactual effects. Therefore, each perturbation only targets the input features at each timestamp, which is defined as:

[0312]

[0313] T 2 = LXW GCN

[0314] ATT(Q, K, V) = softmax(M S ⊙A Geo )V

[0315] ATT(Q, K, V) = softmax(M S ⊙A Tem )V

[0316]

[0317] Among them, L is the Laplacian matrix, and W GCN is the weight of the single-layer GCN, and I N is the identity matrix, and D c is the degree matrix of A GCN .

[0318] Furthermore, after introducing the perturbation mask into the dynamic graph, the spatial transformer and the temporal transformer in the counterfactual generation module 32 continue to process the graph with the perturbation mask introduced. Specifically, traffic data can be decomposed into a static component determined by the road topology and a dynamic component determined by the real-time traffic conditions and unexpected events. Assume that the output T 1 is obtained after being processed by the spatial transformer and the temporal transformer, and the output obtained after being processed by the graph convolutional network is the tensor T 2 . Then, in this embodiment, a gate mechanism is applied to fuse the attention of the transformer output T 1 and the tensor T 2 output by the graph convolutional module:

[0319] g = sigmoid(F S (T 1 ) + F G (T 2 ))

[0320] Y = gT 1 + (1 - g)T 2

[0321] Among them, F S and F G are fully connected layers, g is the gate vector, and Y is the counterfactual output result.

[0322] Optionally, in this embodiment, the optimal perturbation mask can be determined by adopting a counterfactual optimizer. The optimal perturbation mask is M F and M S with the least interference but the largest change in traffic flow prediction performance. Furthermore, in this embodiment, the following method is used to determine the optimal perturbation mask.

[0323] First, for the generated graph structure (corresponding to the dynamic graph with the perturbation mask introduced), a matrix is defined to initially retain all edges, and then is initialized according to the spatial dependence symmetry of the sensor positions and the properties of the original adjacency matrix, and threshold setting is performed on the continuous mask to obtain the binary M S . Finally, M S is applied to sparsify the adjacent matrix A to obtain . The perturbation magnitude is measured by the difference between two counterfactuals:

[0324]

[0325] When iteratively updating the parameters, track the "best" counterfactual by sticking to the current best value Retrieve the perturbed edges and time slices from the best counterfactual as counterfactual explanations (Δ A , Δ X ). For searching M F , fix A and update the sensor input data by . The optimization steps of M F are the same as those for searching M S . Also, during the iterative update process, learn the sparse weights of M S , M F by minimizing the following loss, and use the mean square error (MSE) for :

[0326]

[0327] Meanwhile, use to limit the degree of perturbation:

[0328]

[0329] where represents the number of removed edges and the number of perturbed time periods.

[0330] Thus, in this embodiment, the optimal perturbation mask and the counterfactual explanation corresponding to the optimal perturbation mask (i.e., the counterfactual output result) are searched and determined by the above method, and the counterfactual output result corresponding to the optimal perturbation mask is determined as the third detection result.

[0331] In this embodiment, after determining the optimal perturbation mask and the counterfactual output result corresponding to the optimal perturbation mask, the counterfactual output result under the optimal perturbation mask is determined as the third prediction result.

[0332] Further, in this embodiment, after respectively determining the first prediction result based on the multi-graph convolutional network, the second prediction result based on the adaptive embedding network, and the third prediction result based on the counterfactual generator network according to the foregoing method, then based on the foregoing voting mechanism, determine the final traffic flow prediction result according to the first prediction result, the second prediction result, and the third prediction result.

[0333] It should be noted that in this embodiment, the processes of determining the first prediction result based on the multi-graph convolutional network, determining the second prediction result based on the adaptive embedding network, and determining the third prediction result based on the counterfactual generator network can run independently without affecting each other. Therefore, in this embodiment, the first prediction result, the second prediction result, and the third prediction result can be determined in sequence, but the execution order of the three methods corresponding to determining the first prediction result, the second prediction result, and the third prediction result is not limited.

[0334] Figure 14 Schematic diagram of the traffic flow prediction device according to an embodiment of the present invention. As Figure 14 shown, the traffic flow prediction device in this embodiment includes a data acquisition unit 1, a graph construction unit 2, a traffic flow prediction unit 3, and a traffic flow determination unit 4. Among them, the data acquisition unit 1 is used to obtain the first historical road network data. The graph construction unit 2 is used to construct road network graphs respectively according to different spatial perspectives using road network relationships. The road network graphs include a geographical graph, an influence graph, and an elasticity graph. The geographical graph is used to represent the topological relationship of the road network, the influence graph is used to represent the correlation between road traffic flows, and the elasticity graph is used to represent the dynamic characteristics of roads in the road network. The traffic flow prediction unit 3 is used to input the first historical road network data and the road network graphs into a preset multi-graph convolutional network for processing to determine the first prediction result. The traffic flow determination unit 5 is used to determine the traffic flow prediction result according to the first prediction result.

[0335] In an optional implementation manner, when obtaining the first historical road network data, the data acquisition unit 1 in this embodiment is further used to obtain the initial road network data, perform a first preprocessing on the initial road network data, and determine the first historical road network data. Among them, the first preprocessing includes one or more of the following processes: semantic disambiguation, adding attribute information, and data standardization. The attribute information includes weather parameters and event parameters with time tags.

[0336] Optionally, the traffic flow prediction unit 3 in this embodiment is further used to perform temporal convolution on the first historical road network data to determine a temporal feature map; add spatial information in the road network graphs to the temporal feature map to determine a spatial information integration map; perform spatial convolution on the spatial information integration map to determine a spatio-temporal feature map; and perform feature mapping on the spatio-temporal feature map to determine the first prediction result.

[0337] Further, the traffic flow prediction unit 3 is specifically further used to integrate the spatial information corresponding to the geographical graph, the influence graph, and the elasticity graph with the temporal feature map respectively to determine the corresponding spatial information maps; and integrate the spatial information maps to determine the spatial information integration map. Even further, the traffic flow prediction unit 3 is specifically further used to perform feature mapping on the spatio-temporal feature map and additional information to determine the first prediction result.

[0338] In another alternative implementation, the data acquisition unit 1 in this embodiment is further configured to obtain second historical road network data. When obtaining the second historical road network data, the data acquisition unit 1 is specifically configured to obtain initial road network data; perform second preprocessing on the initial road network data to determine the second historical road network data, and the second preprocessing includes one or more of the following processes: data cleaning, data conversion, and semantic disambiguation.

[0339] Further, the graph construction unit 2 in this embodiment is further configured to perform graph construction based on the second historical road network data and the road network relationship to generate an initial graph; perform dynamic training on the initial graph to determine the corresponding dynamic graph. Optionally, when generating the dynamic graph, the graph construction unit 2 is configured to perform an embedding operation on the input graph of the current period to determine the output graph of the current period, and the input graph is the initial graph or the output graph of the previous period; perform node evaluation based on the structural mutual information between nodes to determine the node evaluation result; perform node dynamic segmentation according to the node evaluation result to determine the first training subset and the second training subset; determine the loss value of the current period according to the probabilities of each node in the current output graph falling into the first training subset and the second training subset; and in response to the loss value of the current period satisfying a preset condition, determine the output graph of the current period as the dynamic graph.

[0340] Further, the traffic flow prediction unit 3 in this embodiment is further configured to input the dynamic graph into a preset adaptive embedding network for processing to determine a second prediction result; input the dynamic graph into a preset counterfactual generator network for processing to determine a third prediction result. Correspondingly, when determining the traffic flow prediction result according to the first prediction result, the traffic flow determination unit 4 in this embodiment is further configured to determine the traffic flow prediction result according to the first prediction result, the second prediction result, and the third prediction result. Further, the traffic flow determination unit 4 is specifically configured to determine the traffic flow prediction result based on a voting mechanism from the first prediction result, the second prediction result, and the third prediction result.

[0341] Optionally, the traffic flow prediction unit 3 in this embodiment is further configured to integrate the information of the dynamic graph and the second historical road network data to determine a spatio-temporal representation graph; capture the temporal features and spatial features in the spatio-temporal representation graph to determine an intermediate feature graph; and map the intermediate feature graph to determine the second prediction result.

[0342] Optionally, the traffic flow prediction unit 3 in this embodiment is further configured to capture the temporal features and spatial features in the dynamic graph to determine an observation prediction result; capture the temporal features and spatial features in the dynamic graph after introducing a perturbation mask to determine a counterfactual output result; determine an optimal perturbation mask and the counterfactual output result under the optimal perturbation mask according to the observation prediction result and the counterfactual output result; and determine the counterfactual output result under the optimal perturbation mask as the third prediction result.

[0343] Figure 15 is a schematic diagram of the electronic device according to an embodiment of the present invention. As Figure 15 shown, the electronic device is a general address query device, which includes a general computer hardware structure, and at least includes a processor 51 and a memory 52. The processor 51 and the memory 52 are connected through a bus 53. The memory 52 is adapted to store instructions or programs executable by the processor 51. The processor 51 can be an independent microprocessor or a set of one or more microprocessors. Thus, by executing the instructions stored in the memory 52, the processor 51 executes the method flow of the embodiment of the present invention as described above to implement the processing of data and the control of other devices. The bus 53 connects the above-mentioned multiple components together, and at the same time connects the above-mentioned components to a display controller 54, a display device, and an input / output (I / O) device 55. The input / output (I / O) device 55 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a body-sensing input device, a printer, and other devices well-known in the art. Typically, the input / output (I / O) device 55 is connected to the system through an input / output (I / O) controller 56.

[0344] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device (equipment), or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt a computer program product implemented on one or more computer-readable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0345] The present application is described with reference to the flowcharts of methods, devices (equipment), and computer program products according to the embodiments of the present application. It should be understood that each process in the flowchart can be implemented by computer program instructions.

[0346] These computer program instructions can be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device, and the instruction device implements the process Figure 1 specified functions in one process or multiple processes.

[0347] These computer program instructions can also be provided to the processor of a general computer, a special computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices produce a device for implementing the Figure 1 specified functions in one process or multiple processes.

[0348] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, which is used for a computer to execute the above-mentioned partial or all method embodiments.

[0349] That is, those skilled in the art can understand that all or part of the steps in implementing the above method embodiments can be completed by specifying relevant hardware through a program, and the program is stored in a storage medium, including several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.

[0350] The foregoing are only the preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various modifications and changes can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.

Claims

1. A traffic flow prediction method, characterized in that, the method includes: Obtain the first historical road network data; Construct road network graphs respectively according to road network relationships from different spatial perspectives. The road network graphs include a geographical graph, an influence graph, and an elasticity graph. The geographical graph is used to represent the topological relationship of the road network, the influence graph is used to represent the correlation between road traffic flows, and the elasticity graph is used to represent the dynamic characteristics of roads in the road network; Input the first historical road network data and the road network graphs into a preset multi-graph convolutional network for processing to determine a first prediction result; Determine the traffic flow prediction result according to the first prediction result.

2. The method according to claim 1, characterized in that, the method further includes: Obtain the second historical road network data; Perform graph construction according to the second historical road network data and road network relationships to generate an initial graph; Perform dynamic training on the initial graph to determine the corresponding dynamic graph; Input the dynamic graph into a preset adaptive embedding network for processing to determine a second prediction result; Input the dynamic graph into a preset counterfactual generator network for processing to determine a third prediction result.

3. The method according to claim 2, characterized in that, the determining the traffic flow prediction result according to the first prediction result includes: Determine the traffic flow prediction result according to the first prediction result, the second prediction result, and the third prediction result.

4. The method according to claim 3, characterized in that, the determining the traffic flow prediction result according to the first prediction result, the second prediction result, and the third prediction result includes: Determine the traffic flow prediction result from the first prediction result, the second prediction result, and the third prediction result based on a voting mechanism.

5. The method according to claim 1, characterized in that, the obtaining the first historical road network data includes: Obtain the initial road network data; Perform a first preprocessing on the initial road network data to determine the first historical road network data. The first preprocessing includes one or more of the following processes: semantic disambiguation, adding attribute information, and data standardization. The attribute information includes weather parameters and event parameters with time tags.

6. The method according to claim 1, characterized in that, the inputting the first historical road network data and the road network graphs into a preset multi-graph convolutional network for processing to determine a first prediction result includes: Perform temporal convolution on the first historical road network data to determine a temporal feature map; Add the spatial information in the road network graphs to the temporal feature map to determine a spatial information integration map; Perform spatial convolution on the spatial information integration map to determine a spatio-temporal feature map; Perform feature mapping on the spatio-temporal feature map to determine the first prediction result.

7. The method according to claim 6, characterized in that, the adding the spatial information in the road network graphs to the temporal feature map to determine a spatial information integration map includes: Integrate the spatial information corresponding to the geographical graph, the influence graph, and the elasticity graph with the temporal feature map respectively to determine corresponding spatial information graphs; Integrate each of the spatial information graphs to determine the spatial information integration map.

8. The method according to claim 6, wherein, the determining the first prediction result by performing feature mapping on the spatio-temporal feature map includes: performing feature mapping on the spatio-temporal feature map and additional information to determine the first prediction result.

9. The method according to claim 2, wherein, the obtaining the second historical road network data includes: obtaining initial road network data; performing second preprocessing on the initial road network data to determine the second historical road network data, and the second preprocessing includes one or more of the following processes: data cleaning, data conversion, and semantic disambiguation.

10. The method according to claim 2, wherein, the determining the corresponding dynamic graph by dynamically training the initial graph includes: performing an embedding operation on the input graph of the current cycle to determine the output graph of the current cycle, where the input graph is the initial graph or the output graph of the previous cycle; performing node evaluation based on the structural mutual information between nodes to determine a node evaluation result; performing node dynamic segmentation according to the node evaluation result to determine a first training subset and a second training subset; determining the loss value of the current cycle according to the probabilities of the nodes in the current output graph falling into the first training subset and the second training subset; in response to the loss value of the current cycle satisfying a preset condition, determining the output graph of the current cycle as the dynamic graph.

11. The method according to claim 2, wherein, the determining the second prediction result by inputting the dynamic graph into a preset adaptive embedding network for processing includes: integrating information of the dynamic graph and the second historical road network data to determine a spatio-temporal representation graph; capturing the temporal features and spatial features in the spatio-temporal representation graph to determine an intermediate feature graph; performing mapping on the intermediate feature graph to determine the second prediction result.

12. The method according to claim 2, wherein, the determining the third prediction result by inputting the dynamic graph into a preset counterfactual generator network for processing includes: capturing the temporal features and spatial features in the dynamic graph to determine an observation prediction result; capturing the temporal features and spatial features in the dynamic graph after introducing a perturbation mask to determine a counterfactual output result; determining an optimal perturbation mask and the counterfactual output result under the optimal perturbation mask according to the observation prediction result and the counterfactual output result; determining the counterfactual output result under the optimal perturbation mask as the third prediction result.

13. A traffic flow prediction device, wherein, the device includes: a data acquisition unit for obtaining first historical road network data; a graph construction unit for respectively constructing road network graphs according to different spatial perspectives using road network relationships, where the road network graphs include a geographical graph, an influence graph, and an elastic graph, the geographical graph is used to represent the topological relationship of the road network, the influence graph is used to represent the correlation between road traffic flows, and the elastic graph is used to represent the dynamic characteristics of roads in the road network; a traffic flow prediction unit for inputting the first historical road network data and the road network graphs into a preset multi-graph convolutional network for processing to determine a first prediction result; A traffic flow determination unit, configured to determine a traffic flow prediction result according to the first prediction result.

14. An electronic device, comprising a memory and a processor, wherein, the memory is configured to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1-12.

15. A computer-readable storage medium, wherein, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps according to any one of claims 1-12 are implemented.