Training method and device of traffic flow prediction model, electronic equipment and storage medium

The method enhances traffic flow prediction by integrating historical data through deep learning and cross-attention mapping, addressing the balance between accuracy and generalization in existing models, resulting in improved forecasting capabilities.

CN119694125APending Publication Date: 2025-03-25XIAN JIAOTONG LIVERPOOL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411848934.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

Existing traffic flow prediction models face challenges in balancing prediction accuracy and generalization, with model-driven methods struggling to extract temporal and spatial relationships and data-driven methods prone to overfitting.

Method used

A method that combines historical traffic flow, density, and network topology data for deep learning predictions, incorporating cross-attention mapping to enhance model performance, using a hybrid approach that integrates physical models as constraints to improve neural network parameter updates.

Benefits of technology

This approach improves the accuracy and generalization of traffic flow predictions by fusing multi-dimensional data and leveraging physical models to refine deep learning outputs, leading to more robust and effective traffic flow forecasting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119694125A_ABST
    Figure CN119694125A_ABST
Patent Text Reader

Abstract

The invention discloses a traffic flow prediction model training method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring historical traffic flow data, historical traffic density data and historical traffic network topology structure data; performing deep learning prediction based on the historical traffic flow data, the historical traffic density data and the historical traffic network topology structure data to obtain a first flow prediction result; performing cross attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second flow prediction result; and determining model loss based on the first flow prediction result and the second flow prediction result, updating initial neural network parameters based on the model loss until a model training stop condition is satisfied, and obtaining a traffic flow prediction model. According to the technical scheme, the generalization of the prediction precision of the traffic flow prediction model 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 intelligent driving technology, and in particular to a training method, device, electronic equipment and storage medium for a traffic flow prediction model. Background Art

[0002] Today, intelligent driving technology is in a stage of rapid development. In order to enable intelligent driving vehicles to better perceive the surrounding traffic conditions and accurately make driving behavior decisions including lane changing and following, highly granular lane-level traffic prediction has become a technology with great potential.

[0003] Existing traffic flow prediction models are mainly divided into two categories, namely model-driven methods and data-driven methods. However, the complexity and nonlinearity of traffic conditions make it difficult for model-driven methods to accurately extract the spatiotemporal correlation of traffic data to obtain high-precision prediction results, while data-driven models usually have poor generalization and are prone to overfitting.

[0004] In the process of implementing the present invention, it is found that there are at least the following technical problems in the prior art: the existing traffic flow prediction model has the problem that prediction accuracy and generalization cannot be taken into account at the same time. Summary of the invention

[0005] The present invention provides a training method, device, electronic device and storage medium for a traffic flow prediction model to improve the prediction accuracy and generalization of the traffic flow prediction model.

[0006] According to one aspect of the present invention, a method for training a traffic flow prediction model is provided, comprising:

[0007] Obtain historical traffic flow data, historical traffic density data and historical traffic network topology data;

[0008] Perform deep learning prediction based on the historical traffic flow data, the historical traffic density data, and the historical traffic network topology data to obtain a first traffic flow prediction result;

[0009] Performing cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic flow prediction result;

[0010] The model loss is determined based on the first traffic prediction result and the second traffic prediction result, and the initial neural network parameters are updated based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model.

[0011] According to another aspect of the present invention, there is provided a training device for a traffic flow prediction model, comprising:

[0012] A vehicle trajectory data acquisition module is used to acquire historical traffic flow data, historical traffic density data, and historical traffic network topology data;

[0013] A deep learning prediction module, used for performing deep learning prediction based on the historical traffic flow data, the historical traffic density data and the historical traffic network topology data to obtain a first traffic flow prediction result;

[0014] A cross-attention mapping module, used for performing cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result;

[0015] A network parameter training module is used to determine the model loss based on the first traffic prediction result and the second traffic prediction result, and to update the initial neural network parameters based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model.

[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0017] at least one processor;

[0018] and a memory communicatively coupled to the at least one processor;

[0019] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the training method of the traffic flow prediction model described in any embodiment of the present invention.

[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the training method of the traffic flow prediction model described in any embodiment of the present invention when executed.

[0021] The technical solution of the embodiment of the present invention obtains historical traffic flow data, historical traffic density data and historical traffic network topology data, and then performs deep learning prediction based on the historical traffic flow data, historical traffic density data and historical traffic network topology data to obtain a first traffic prediction result; in addition, cross-attention mapping is performed on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result, and then the model loss is determined based on the first traffic prediction result and the second traffic prediction result, and the initial neural network parameters are updated based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model. The above technical solution realizes multi-dimensional traffic data fusion prediction by performing deep learning prediction on historical traffic flow data, historical traffic density data and historical traffic network topology data, improves the prediction accuracy of the traffic flow prediction model, and realizes the use of physical models as information supplements and strong constraints for deep learning by simultaneously involving the traffic prediction results of deep learning and cross-attention mapping in loss calculation, thereby improving the generalization of the traffic flow prediction model.

[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0024] Figure 1 is a flow chart of a method for training a traffic flow prediction model provided according to Embodiment 1 of the present invention;

[0025] Figure 2 is a flow chart of a method for training a traffic flow prediction model according to Embodiment 2 of the present invention;

[0026] Figure 3 is a schematic diagram of a multi-dimensional graph fusion process provided according to an embodiment of the present invention;

[0027] Figure 4 is a flow chart of a method for training a traffic flow prediction model provided according to Embodiment 3 of the present invention;

[0028] Figure 5 is a flow chart of a method for training a traffic flow prediction model according to a fourth embodiment of the present invention;

[0029] Figure 6 is a flow chart of a hybrid model-data driven training method provided according to an embodiment of the present invention;

[0030] Figure 7 is a structural schematic diagram of a training device for a traffic flow prediction model provided according to Embodiment 5 of the present invention;

[0031] Figure 8 It is a structural schematic diagram of an electronic device for implementing the training method of the traffic flow prediction model according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. The acquisition, storage, use, processing, etc. of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0034] Embodiment 1

[0035] Figure 1 This is a flow chart of a method for training a traffic flow prediction model provided in the first embodiment of the present invention. This embodiment is applicable to the training of a lane-level traffic flow prediction model. The method can be executed by a training device for a traffic flow prediction model. The training device for a traffic flow prediction model can be implemented in the form of hardware and / or software. The training device for a traffic flow prediction model can be configured in an electronic device such as a terminal and / or a server. Figure 1 As shown, the method includes:

[0036] S110, obtaining historical traffic flow data, historical traffic density data, and historical traffic network topology data.

[0037] In the embodiment of the present invention, historical traffic flow data refers to the traffic flow data of one or more road sections in a unit time. Historical traffic density data refers to the vehicle density data of one or more road sections in a unit time. Historical traffic network topology data refers to the adjacency matrix obtained by collecting the topology of the lane-level traffic network.

[0038] For example, historical traffic observation data may be statistically analyzed to obtain historical traffic flow data, historical traffic density data, and historical traffic network topology data.

[0039] S120. Perform deep learning prediction based on the historical traffic flow data, the historical traffic density data, and the historical traffic network topology data to obtain a first traffic flow prediction result.

[0040] In an embodiment of the present invention, the first traffic flow prediction result refers to the traffic flow predicted by a data-driven deep learning model.

[0041] Specifically, historical traffic flow data, historical traffic density data, and historical traffic network topology data can be fused in multiple dimensions so that deep learning prediction can fully extract the spatiotemporal correlation of traffic data and obtain more accurate first traffic prediction results.

[0042] S130. Perform cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result.

[0043] In the embodiment of the present invention, the second traffic flow prediction result refers to the traffic flow predicted by the physical model based on model driving.

[0044] Specifically, cross-attention mapping refers to mapping the physical information relationship matrix based on density data to the dimension of flow data, that is, mapping historical traffic density data to the flow data dimension and then combining it with historical traffic flow data to complete the cross-attention mapping and obtain the second flow prediction result.

[0045] S140. Determine a model loss based on the first traffic prediction result and the second traffic prediction result, and update initial neural network parameters based on the model loss until a model training stop condition is met to obtain a traffic flow prediction model.

[0046] The initial neural network parameters refer to the network parameters of the deep learning model. It should be noted that in order to solve the problems of overfitting and poor generalization of the deep learning model, the embodiment of the present invention integrates the physical model into the deep learning model architecture, so that the predicted traffic flow of the physical model is used as a reference for updating the model parameters, thereby improving the generalization ability of the deep learning model.

[0047] The technical solution of the embodiment of the present invention obtains historical traffic flow data, historical traffic density data and historical traffic network topology data, and then performs deep learning prediction based on the historical traffic flow data, historical traffic density data and historical traffic network topology data to obtain a first traffic prediction result; in addition, cross-attention mapping is performed on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result, and then the model loss is determined based on the first traffic prediction result and the second traffic prediction result, and the initial neural network parameters are updated based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model. The above technical solution realizes multi-dimensional traffic data fusion prediction by performing deep learning prediction on historical traffic flow data, historical traffic density data and historical traffic network topology data, improves the prediction accuracy of the traffic flow prediction model, and realizes the use of physical models as information supplements and strong constraints for deep learning by simultaneously involving the traffic prediction results of deep learning and cross-attention mapping in loss calculation, thereby improving the generalization of the traffic flow prediction model.

[0048] Embodiment 2

[0049] Figure 2 A flow chart of a method for training a traffic flow prediction model provided in the second embodiment of the present invention. The method of this embodiment can be combined with the various optional schemes in the method for training a traffic flow prediction model provided in the above embodiments. The training method of the traffic flow prediction model provided in this embodiment has been further optimized. Optionally, deep learning prediction is performed based on historical traffic flow data, historical traffic density data, and historical traffic network topology data to obtain a first traffic flow prediction result, including: fusing historical traffic flow data, historical traffic density data, and historical traffic network topology data to obtain a traffic spatiotemporal correlation graph; inputting the traffic spatiotemporal correlation graph into the initial neural network to obtain a first traffic flow prediction result.

[0050] like Figure 2 As shown, the method includes:

[0051] S210, obtaining historical traffic flow data, historical traffic density data and historical traffic network topology data.

[0052] S220, fusing the historical traffic flow data, the historical traffic density data and the historical traffic network topology data to obtain a traffic spatiotemporal correlation graph.

[0053] In the embodiment of the present invention, the traffic spatiotemporal correlation graph refers to a multi-dimensional graph of spatiotemporal correlation obtained by multi-dimensionally fusing historical traffic flow data, historical traffic density data, and historical traffic network topology data.

[0054] Specifically, the spatial autocorrelation coefficient of traffic flow and the temporal autocorrelation coefficient of traffic flow can be generated based on historical traffic flow data; the spatial autocorrelation coefficient of density and the temporal autocorrelation coefficient of density can be generated based on historical traffic density data; the spatial autocorrelation coefficient of traffic flow and the spatial autocorrelation coefficient of density can be inner-producted to obtain a spatial map; the temporal autocorrelation coefficient of traffic flow and the temporal autocorrelation coefficient of density can be inner-producted to obtain a temporal map; the spatial map and the temporal map can be gated and fused to obtain a space-time map; the topological structure of historical traffic network topological structure data can be fused with the space-time map to obtain a traffic spatiotemporal correlation map.

[0055] Among them, the spatial autocorrelation coefficient of traffic refers to the autocorrelation coefficient between the corresponding data sequences of each road section calculated based on the historical traffic flow data; the temporal autocorrelation coefficient of traffic refers to the autocorrelation coefficient between the corresponding data sequences of each time step calculated based on the historical traffic flow data. Similarly, the spatial autocorrelation coefficient of density refers to the autocorrelation coefficient between the corresponding data sequences of each road section calculated based on the historical traffic density data; the temporal autocorrelation coefficient of density refers to the autocorrelation coefficient between the corresponding data sequences of each time step calculated based on the historical traffic density data. The calculation formula of the autocorrelation coefficient can be:

[0056]

[0057] Among them, X k represents the kth data sequence, X l represents the lth data sequence, μ k represents the mean of the kth data sequence, μ l represents the mean of the lth data sequence, DX k The variance of the kth data series, DX l represents the variance of the lth data sequence, and E(·) represents the expectation.

[0058] S230: Input the traffic spatiotemporal correlation graph into an initial neural network to obtain a first traffic flow prediction result.

[0059] Optionally, the initial neural network may include a graph convolutional neural network and a gated recurrent neural network, and the traffic spatiotemporal correlation graph is input into the initial neural network to obtain a first traffic prediction result, including: inputting the traffic spatiotemporal correlation graph into the graph convolutional neural network to obtain traffic graph convolution features; inputting the traffic graph convolution features into the gated recurrent neural network to obtain the first traffic prediction result.

[0060] It should be noted that the traffic spatiotemporal correlation graph is used as the input of the graph convolutional neural network to fully couple the spatiotemporal correlation information extracted from the flow and density data structures and the adjacency structure containing the intelligent vehicle lane change hypothesis, and a gated recurrent neural network is connected to the output segment to further model the temporal features in the flow data.

[0061] S240: Perform cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result.

[0062] S250. Determine a model loss based on the first traffic prediction result and the second traffic prediction result, and update initial neural network parameters based on the model loss until a model training stop condition is met to obtain a traffic flow prediction model.

[0063] For example, Figure 3 It is a flow chart of a multi-dimensional graph fusion provided according to an embodiment of the present invention. Specifically, the spatial autocorrelation coefficient of traffic flow and the temporal autocorrelation coefficient of traffic flow can be generated based on historical traffic flow data; the spatial autocorrelation coefficient of density and the temporal autocorrelation coefficient of density can be generated based on historical traffic density data; the spatial autocorrelation coefficient of traffic flow and the spatial autocorrelation coefficient of density can be inner-producted to obtain a spatial graph; the temporal autocorrelation coefficient of traffic flow and the temporal autocorrelation coefficient of density can be inner-producted and then subjected to uniform manifold approximation and projection (Uniform Manifold Approximation and Projection, UMAP) to obtain a temporal graph, and then the spatial graph and the temporal graph can be gated and fused to obtain a space-time graph. It should be noted that, through UMAP processing, the dimension of the temporal graph can be kept the same as the dimension of the spatial graph. Furthermore, the topological structure of the lane-level traffic network can be collected to obtain an adjacency matrix, such as Figure 3 As shown in the figure, for each road segment, the correlation between the upstream and downstream and left and right adjacent road segments in the adjacency matrix can be set to 1, and the correlation of the four corners can be set to the probability a of the smart car changing lanes. Furthermore, the topological structure fusion is performed based on the adjacency matrix and the space-time graph to obtain the traffic spatiotemporal correlation graph. Furthermore, the traffic spatiotemporal correlation graph is input into the graph convolutional neural network (GCN) to obtain the traffic graph convolutional features, and then the traffic graph convolutional features are input into the gated recurrent neural network (GRU) to obtain the first traffic prediction result (y DL).

[0064] The technical solution of the embodiment of the present invention obtains a traffic spatiotemporal correlation graph by fusing historical traffic flow data, historical traffic density data and historical traffic network topology data, and then inputs the traffic spatiotemporal correlation graph into the initial neural network to obtain a first traffic flow prediction result. The above technical solution realizes multi-dimensional traffic data fusion prediction and improves the prediction accuracy of the traffic flow prediction model.

[0065] Embodiment 3

[0066] Figure 4 A flow chart of a method for training a traffic flow prediction model provided in Embodiment 3 of the present invention, the method of this embodiment can be combined with the various optional schemes in the method for training a traffic flow prediction model provided in the above embodiments. The training method for the traffic flow prediction model provided in this embodiment is further optimized. Optionally, cross-attention mapping is performed on the historical traffic flow data and the historical traffic density data to obtain a second traffic flow prediction result, including: performing traffic flow estimation based on the historical traffic density data to obtain traffic flow estimation data; performing attention mapping based on the traffic flow estimation data and the historical traffic flow data to obtain a second traffic flow prediction result.

[0067] like Figure 4 As shown, the method includes:

[0068] S310, obtaining historical traffic flow data, historical traffic density data and historical traffic network topology data.

[0069] S320. Perform deep learning prediction based on the historical traffic flow data, the historical traffic density data, and the historical traffic network topology data to obtain a first traffic flow prediction result.

[0070] S330: Estimating traffic flow based on the historical traffic density data to obtain traffic flow estimation data.

[0071] In an embodiment of the present invention, a Macroscopic Fundamental Diagram (MFD) may be used as a physical model to describe the physical relationship between flow and density in a lane-level traffic network.

[0072] Exemplarily, historical traffic density data is input into the macro basic map to obtain traffic flow estimation data. The mathematical expression of the macro basic map is:

[0073] MFD(ρ)=a·ρ·e -bρ ;

[0074] Among them, MFD(ρ) represents the traffic flow estimation data, ρ represents the historical traffic density data, and a and b represent the model parameters of the macro basic graph.

[0075] S340: Perform attention mapping based on the traffic flow estimation data and the historical traffic flow data to obtain a second traffic flow prediction result.

[0076] Exemplarily, the calculation formula for determining the second flow prediction result is:

[0077]

[0078] Among them, y MFD represents the second traffic flow prediction result, ρ represents the historical traffic density data, MFD(ρ) represents the traffic flow estimation data, f represents the historical traffic flow data, W q represents the first cross-attention learnable parameter, W k represents the second cross-attention learnable parameter, W v represents the third cross-attention learnable parameter, N represents the number of divided lane segments, [·] T Represents matrix transpose.

[0079] S350. Determine a model loss based on the first traffic prediction result and the second traffic prediction result, and update initial neural network parameters based on the model loss until a model training stop condition is met to obtain a traffic flow prediction model.

[0080] The technical solution of the embodiment of the present invention obtains traffic flow estimation data by estimating traffic flow based on historical traffic density data, and then performs attention mapping based on the traffic flow estimation data and historical traffic flow data to obtain a second traffic prediction result, thereby realizing the mapping of historical traffic density data to the traffic data dimension.

[0081] Embodiment 4

[0082] Figure 5A flowchart of a method for training a traffic flow prediction model provided in Embodiment 4 of the present invention, the method of this embodiment can be combined with the various optional schemes in the method for training a traffic flow prediction model provided in the above embodiments. The training method for a traffic flow prediction model provided in this embodiment has been further optimized. Optionally, the determination of the model loss based on the first traffic prediction result and the second traffic prediction result includes: weighted combination of the first traffic prediction result and the second traffic prediction result to obtain a target traffic prediction result; obtaining real traffic data, and determining a first mean square error based on the target traffic prediction result and the real traffic data; obtaining traffic flow estimation data, and determining a second mean square error based on the target traffic prediction result and the traffic flow estimation data; and determining the model loss based on the first mean square error and the second mean square error.

[0083] like Figure 5 As shown, the method includes:

[0084] S410, obtaining historical traffic flow data, historical traffic density data and historical traffic network topology data.

[0085] S420. Perform deep learning prediction based on the historical traffic flow data, the historical traffic density data, and the historical traffic network topology data to obtain a first traffic flow prediction result.

[0086] S430: Perform cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result.

[0087] S440: Perform weighted combination on the first traffic prediction result and the second traffic prediction result to obtain a target traffic prediction result.

[0088] Among them, the target traffic prediction result refers to the result of combining the traffic prediction result of the deep learning model with the traffic prediction result of the macro basic graph.

[0089] Exemplarily, the calculation formula of the target flow prediction result is:

[0090]

[0091] Among them, a represents the weight value, Norm(·) represents standardization, and y DL represents the first traffic prediction result, y MFD Indicates the second traffic prediction result.

[0092] S450: Acquire actual traffic data, and determine a first mean square error based on the target traffic prediction result and the actual traffic data.

[0093] S460: Obtain traffic flow estimation data, and determine a second mean square error based on the target flow prediction result and the traffic flow estimation data.

[0094] S470. Determine a model loss based on the first mean square error and the second mean square error, and update initial neural network parameters based on the model loss until a model training stop condition is met to obtain a traffic flow prediction model.

[0095] In an embodiment of the present invention, the calculation formula for determining the model loss is:

[0096] L = a·MSE pre +(1-a) MSE MFD +λ1·L reg ;

[0097] Among them, L represents the model loss, MSE pre Represents the first mean square error, MSE MFD represents the second mean square error, a represents the weight, λ1 represents the preset constant, L reg represents the L2 norm.

[0098] For example, Figure 6 It is a flow chart of a hybrid model-data driven training method provided according to an embodiment of the present invention. The model-driven and data-driven hybrid framework of the embodiment of the present invention is divided into two parts. The model-driven part is a cross-attention mapping part based on a macro basic graph, and the data-driven part is a deep learning prediction part based on multi-dimensional graph fusion. Specifically, historical traffic flow data, historical traffic density data, and historical traffic network topology data are obtained, and then deep learning prediction is performed based on the historical traffic flow data, historical traffic density data, and historical traffic network topology data to obtain a first traffic prediction result (y DL In addition, the historical traffic density data is used to perform MFD traffic flow estimation to obtain traffic flow estimation data; then the attention weight is set, that is, the cross-attention learnable parameters are configured; the traffic flow estimation data is combined with the historical traffic flow data to complete the cross-attention mapping and obtain the second traffic prediction result (y MFD ). Further, the first traffic prediction result and the second traffic prediction result are respectively standardized and fused to obtain a target traffic prediction result, and then a first mean square error is determined based on the target traffic prediction result and the actual traffic data, a second mean square error is determined based on the target traffic prediction result and the traffic flow estimation data, a model loss is determined based on the first mean square error and the second mean square error, and the initial neural network parameters are updated based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model.

[0099] It should be noted that the embodiments of the present invention can integrate the physical connection between flow and density at the macro-statistical level into the forward propagation process of model training, while importing more traffic information into the deep learning prediction model and reducing the model's over-reliance on data distribution and quality. Secondly, by taking the physical error of the traffic flow estimation data (i.e., the second mean square error) as part of the loss function, the deviation of the physical model can be used as one of the references for updating the model parameters to improve the generalization ability of the model.

[0100] The technical solution of the embodiment of the present invention obtains the target traffic prediction result by weighted combination of the first traffic prediction result and the second traffic prediction result, and then obtains the real traffic data, determines the first mean square error based on the target traffic prediction result and the real traffic data, and then obtains the traffic flow estimation data, determines the second mean square error based on the target traffic prediction result and the traffic flow estimation data, and then determines the model loss based on the first mean square error and the second mean square error. The above technical solution uses the physical error of the traffic flow estimation data as part of the loss function, and can use the deviation of the physical model as a reference for updating the model parameters, thereby improving the generalization ability of the model.

[0101] Embodiment 5

[0102] Figure 7 This is a schematic diagram of the structure of a training device for a traffic flow prediction model provided in Embodiment 5 of the present invention. Figure 7 As shown, the device comprises:

[0103] The vehicle trajectory data acquisition module 510 is used to acquire historical traffic flow data, historical traffic density data and historical traffic network topology data;

[0104] A deep learning prediction module 520, configured to perform deep learning prediction based on the historical traffic flow data, the historical traffic density data, and the historical traffic network topology data to obtain a first traffic flow prediction result;

[0105] A cross-attention mapping module 530, configured to perform cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic flow prediction result;

[0106] The network parameter training module 540 is used to determine the model loss based on the first traffic prediction result and the second traffic prediction result, and update the initial neural network parameters based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model.

[0107] The technical solution of the embodiment of the present invention obtains historical traffic flow data, historical traffic density data and historical traffic network topology data, and then performs deep learning prediction based on the historical traffic flow data, historical traffic density data and historical traffic network topology data to obtain a first traffic prediction result; in addition, cross-attention mapping is performed on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result, and then the model loss is determined based on the first traffic prediction result and the second traffic prediction result, and the initial neural network parameters are updated based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model. The above technical solution realizes multi-dimensional traffic data fusion prediction by performing deep learning prediction on historical traffic flow data, historical traffic density data and historical traffic network topology data, improves the prediction accuracy of the traffic flow prediction model, and realizes the use of physical models as information supplements and strong constraints for deep learning by simultaneously involving the traffic prediction results of deep learning and cross-attention mapping in loss calculation, thereby improving the generalization of the traffic flow prediction model.

[0108] In some optional implementations, the deep learning prediction module 520 includes:

[0109] A multi-dimensional data fusion unit, used to fuse the historical traffic flow data, the historical traffic density data and the historical traffic network topology data to obtain a traffic spatiotemporal correlation graph;

[0110] The neural network prediction unit is used to input the traffic spatiotemporal correlation graph into an initial neural network to obtain a first traffic flow prediction result.

[0111] In some optional implementations, the multidimensional data fusion unit may be further used for:

[0112] Generate a traffic volume spatial autocorrelation coefficient and a traffic volume temporal autocorrelation coefficient based on the historical traffic volume data;

[0113] Generate a density spatial autocorrelation coefficient and a density temporal autocorrelation coefficient based on the historical traffic density data;

[0114] Perform an inner product of the flow spatial autocorrelation coefficient and the density spatial autocorrelation coefficient to obtain a spatial map;

[0115] Performing an inner product of the flow time autocorrelation coefficient and the density time autocorrelation coefficient to obtain a time graph;

[0116] Performing gated fusion on the spatial map and the temporal map to obtain a spatial-temporal map;

[0117] A traffic spatiotemporal correlation graph is obtained by performing topological structure fusion based on the historical traffic network topological structure data and the space-time graph.

[0118] In some optional implementations, the initial neural network includes a graph convolutional neural network and a gated recurrent neural network. Accordingly, the neural network prediction unit may also be used to:

[0119] Inputting the traffic spatiotemporal correlation graph into the graph convolutional neural network to obtain traffic graph convolution features;

[0120] The traffic map convolution feature is input into the gated recurrent neural network to obtain a first traffic prediction result.

[0121] In some optional implementations, the cross-attention mapping module 530 includes:

[0122] A traffic flow estimation unit, configured to estimate traffic flow based on the historical traffic density data to obtain traffic flow estimation data;

[0123] An attention mapping unit is used to perform attention mapping based on the traffic flow estimation data and the historical traffic flow data to obtain a second traffic flow prediction result.

[0124] In some optional implementations, the calculation formula for determining the second flow prediction result is:

[0125]

[0126] Among them, y MFD represents the second traffic flow prediction result, ρ represents the historical traffic density data, MFD(ρ) represents the traffic flow estimation data, f represents the historical traffic flow data, W q represents the first cross-attention learnable parameter, W k represents the second cross-attention learnable parameter, W v represents the third cross-attention learnable parameter, N represents the number of divided lane segments, [·] T Represents matrix transpose.

[0127] In some optional implementations, the network parameter training module 540 may be specifically used to:

[0128] Performing a weighted combination on the first flow prediction result and the second flow prediction result to obtain a target flow prediction result;

[0129] Acquire real flow data, and determine a first mean square error based on the target flow prediction result and the real flow data;

[0130] Acquire traffic flow estimation data, and determine a second mean square error based on the target flow prediction result and the traffic flow estimation data;

[0131] A model loss is determined based on the first mean square error and the second mean square error.

[0132] The training device for the traffic flow prediction model provided in the embodiment of the present invention can execute the training method for the traffic flow prediction model provided in any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0133] Embodiment 6

[0134] Figure 8 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0135] like Figure 8 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The I / O interface 15 is also connected to the bus 14.

[0136] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0137] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a training method for a traffic flow prediction model, which includes:

[0138] Obtain historical traffic flow data, historical traffic density data and historical traffic network topology data;

[0139] Perform deep learning prediction based on the historical traffic flow data, the historical traffic density data, and the historical traffic network topology data to obtain a first traffic flow prediction result;

[0140] Performing cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic flow prediction result;

[0141] The model loss is determined based on the first traffic prediction result and the second traffic prediction result, and the initial neural network parameters are updated based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model.

[0142] In some embodiments, the training method of the traffic flow prediction model may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the training method of the traffic flow prediction model described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the training method of the traffic flow prediction model in any other appropriate manner (e.g., by means of firmware).

[0143] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0144] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0145] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0146] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0147] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0148] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0149] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0150] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for training a traffic flow prediction model, characterized in that: include: Obtain historical traffic flow data, historical traffic density data and historical traffic network topology data; Perform deep learning prediction based on the historical traffic flow data, the historical traffic density data, and the historical traffic network topology data to obtain a first traffic flow prediction result; Performing cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic flow prediction result; The model loss is determined based on the first traffic prediction result and the second traffic prediction result, and the initial neural network parameters are updated based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model.

2. The method according to claim 1, characterized in that The deep learning prediction based on the historical traffic flow data, the historical traffic density data and the historical traffic network topology data is performed to obtain a first traffic flow prediction result, including: The historical traffic flow data, the historical traffic density data and the historical traffic network topology data are integrated to obtain a traffic spatiotemporal correlation graph; The traffic spatiotemporal correlation graph is input into an initial neural network to obtain a first traffic flow prediction result.

3. The method according to claim 2, characterized in that The historical traffic flow data, the historical traffic density data and the historical traffic network topology data are integrated to obtain a traffic spatiotemporal correlation graph, including: Generate a traffic volume spatial autocorrelation coefficient and a traffic volume temporal autocorrelation coefficient based on the historical traffic volume data; Generate a density spatial autocorrelation coefficient and a density temporal autocorrelation coefficient based on the historical traffic density data; Perform an inner product of the flow spatial autocorrelation coefficient and the density spatial autocorrelation coefficient to obtain a spatial map; Performing an inner product of the flow time autocorrelation coefficient and the density time autocorrelation coefficient to obtain a time graph; Performing gated fusion on the spatial map and the temporal map to obtain a spatial-temporal map; A traffic spatiotemporal correlation graph is obtained by performing topological structure fusion based on the historical traffic network topological structure data and the space-time graph.

4. The method according to claim 2, characterized in that: The initial neural network includes a graph convolutional neural network and a gated recurrent neural network. The traffic spatiotemporal correlation graph is input into the initial neural network to obtain a first traffic flow prediction result, including: Inputting the traffic spatiotemporal correlation graph into the graph convolutional neural network to obtain traffic graph convolution features; The traffic map convolution feature is input into the gated recurrent neural network to obtain a first traffic prediction result.

5. The method according to claim 1, characterized in that: The performing cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result includes: Performing traffic flow estimation based on the historical traffic density data to obtain traffic flow estimation data; Attention mapping is performed based on the traffic flow estimation data and the historical traffic flow data to obtain a second traffic flow prediction result.

6. The method according to claim 5, characterized in that The calculation formula for determining the second flow prediction result is: Among them, y MFD represents the second traffic flow prediction result, ρ represents the historical traffic density data, MFD(ρ) represents the traffic flow estimation data, f represents the historical traffic flow data, W q represents the first cross-attention learnable parameter, W k represents the second cross-attention learnable parameter, W v represents the third cross-attention learnable parameter, N represents the number of divided lane segments, [·] T Represents matrix transpose.

7. The method according to claim 1, characterized in that The determining the model loss based on the first flow prediction result and the second flow prediction result includes: Performing a weighted combination on the first flow prediction result and the second flow prediction result to obtain a target flow prediction result; Acquire real flow data, and determine a first mean square error based on the target flow prediction result and the real flow data; Acquire traffic flow estimation data, and determine a second mean square error based on the target flow prediction result and the traffic flow estimation data; A model loss is determined based on the first mean square error and the second mean square error.

8. A training device for a traffic flow prediction model, characterized in that: include: A vehicle trajectory data acquisition module is used to acquire historical traffic flow data, historical traffic density data, and historical traffic network topology data; A deep learning prediction module, used for performing deep learning prediction based on the historical traffic flow data, the historical traffic density data and the historical traffic network topology data to obtain a first traffic flow prediction result; A cross-attention mapping module, used for performing cross-attention mapping on the historical traffic flow data and the historical traffic density data to obtain a second traffic prediction result; A network parameter training module is used to determine the model loss based on the first traffic prediction result and the second traffic prediction result, and to update the initial neural network parameters based on the model loss until the model training stop condition is met to obtain a traffic flow prediction model.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein, the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the training method of the traffic flow prediction model described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the training method of the traffic flow prediction model described in any one of claims 1-7 when executed.