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

By obtaining and updating global model parameters in the traffic flow prediction model, data singularity and safety issues are solved, the accuracy and safety of traffic flow prediction are improved, and more efficient model training and update are achieved.

CN119181240APending Publication Date: 2024-12-24PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411198862.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-24

AI Technical Summary

Technical Problem

The existing traffic flow prediction model has a single training data and a risk of data leakage, resulting in poor prediction results and insufficient security.

Method used

Feature extraction and model training are performed by obtaining the historical traffic flow data of the target area, model parameters are obtained and sent to the model federated learning server, global model parameters are determined based on the model parameters of multiple terminal devices, and local traffic flow prediction models are updated to avoid single data Sex and leak risk.

Benefits of technology

The prediction accuracy and data security of the traffic flow prediction model are improved, the singleness of training data and the risk of data leakage is avoided, and the generalization ability and training efficiency of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119181240A_ABST
    Figure CN119181240A_ABST
Patent Text Reader

Abstract

The invention provides a traffic flow prediction method and apparatus, a terminal device and a computer readable storage medium. The method comprises the steps of obtaining first historical traffic flow data; performing feature extraction processing on the first historical traffic flow data to obtain training data; training the traffic flow prediction model according to the training data to determine a first model parameter; the first model parameters are sent to a model federated learning server, global model parameters determined by the model federated learning server according to the first model parameters uploaded by a plurality of terminal devices are obtained, and different terminal devices are used for monitoring traffic flows of different areas; updating the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model; and based on the target traffic flow prediction model, determining traffic flow prediction data according to second historical traffic flow data. The data security, the training efficiency and the prediction accuracy of the traffic flow prediction model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a traffic flow prediction method, apparatus, terminal device and computer-readable storage medium. Background Art

[0002] Traffic flow prediction is a key component of intelligent transportation systems. Whether it is warning of traffic congestion or scheduling of public transportation, accurate prediction of future traffic flow is required. Therefore, efficient and accurate traffic flow prediction models can effectively improve and alleviate urban traffic problems. However, the training data of current traffic flow prediction models is relatively single. Other methods are to transmit training data between multiple terminal devices or between terminal devices and servers to solve the problem of single training data. However, there is a risk of data leakage in the process of exchanging training data. It can be seen that the current traffic flow prediction model has the problems of poor prediction effect and insufficient security. Summary of the invention

[0003] The present application provides a traffic flow prediction method, apparatus, terminal device and computer-readable storage medium, aiming to improve the prediction effect of a traffic flow prediction model and the security of the training process.

[0004] In a first aspect, the present application provides a traffic flow prediction method applied to a terminal device, the traffic flow prediction method comprising the following steps:

[0005] Acquire first historical traffic flow data of a target area, where the target area is an area monitored by a current terminal device;

[0006] Performing feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model;

[0007] Training the traffic flow prediction model according to the training data to determine a first model parameter of the traffic flow prediction model after training;

[0008] Sending the first model parameters to a model federated learning server, and obtaining a global model parameter determined by the model federated learning server according to the first model parameters uploaded by a plurality of terminal devices, wherein different terminal devices are used to monitor traffic flows in different areas;

[0009] Update the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model;

[0010] Based on the target traffic flow prediction model, traffic flow prediction data is determined according to the second historical traffic flow data.

[0011] In a second aspect, the present application further provides a traffic flow prediction device, the traffic flow prediction device comprising:

[0012] A data acquisition module, used to acquire first historical traffic flow data of a target area, where the target area is an area monitored by the current terminal device;

[0013] A data processing module, used for performing feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model;

[0014] A model training module, used for training the traffic flow prediction model according to the training data to determine a first model parameter of the traffic flow prediction model after training;

[0015] A parameter sending module, used to send the first model parameter to a model federated learning server, and obtain a global model parameter determined by the model federated learning server according to the first model parameter uploaded by a plurality of terminal devices, wherein different terminal devices are used to monitor traffic flow in different areas;

[0016] A model updating module, used for updating the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model;

[0017] The data prediction module is used to determine traffic flow prediction data based on the target traffic flow prediction model and the second historical traffic flow data.

[0018] In a third aspect, the present application also provides a terminal device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the traffic flow prediction method as described above are implemented.

[0019] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the traffic flow prediction method as described above are implemented.

[0020] The present application provides a traffic flow prediction method, apparatus, terminal device and computer-readable storage medium. The present application obtains first historical traffic flow data of a target area to determine training data through the first historical traffic flow data, and uses the training data to train a locally deployed traffic flow prediction model to obtain first model parameters in the trained traffic flow prediction model; the first model parameters are sent to a model federated learning server to obtain global model parameters determined by the model federated learning server according to the first model parameters uploaded by multiple terminal devices, so as to update the local traffic flow prediction model according to the global model parameters to obtain a target traffic flow prediction model. Since the global model parameters are determined by model parameters uploaded by multiple terminal devices, and the model parameters of each terminal device are obtained after the local traffic flow prediction model is trained using local training data in each terminal device, updating the local traffic flow prediction model using the global model parameters can avoid the problem of single training data, and what is uploaded to the model federated learning server are model parameters rather than training data or other original data, thereby ensuring the privacy of the data and improving the data security of the model during the training and updating process. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 A flow chart of a traffic flow prediction method provided in one embodiment of the present application;

[0023] Figure 2 A scene diagram of a traffic flow prediction method provided in an embodiment of the present application;

[0024] Figure 3 A schematic block diagram of a traffic flow prediction device provided in one embodiment of the present application;

[0025] Figure 4 This is a schematic block diagram of the structure of a terminal device involved in one embodiment of the present application.

[0026] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0029] The embodiment of the present application provides a traffic flow prediction method, apparatus, terminal device and computer-readable storage medium. The traffic flow prediction method can be applied to a terminal device, which can be an electronic device such as a tablet computer, a laptop computer, a desktop computer, etc.

[0030] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0031] Please refer to Figure 1 , Figure 1 A flow chart of a traffic flow prediction method provided in an embodiment of the present application.

[0032] like Figure 1 As shown, the traffic flow prediction method includes steps S101 to S106.

[0033] Step S101: Acquire first historical traffic flow data of a target area, where the target area is an area monitored by a current terminal device.

[0034] Exemplarily, the current terminal device includes but is not limited to a terminal device that directly monitors the traffic flow in the target area, or a terminal device connected to multiple shooting devices that monitor the traffic flow in the target area.

[0035] In a specific implementation process, the terminal device stores historical traffic flow data, for example, traffic flow data within 2 years, and automatically deletes traffic flow data with a time interval greater than 2 years. When obtaining the first historical traffic flow data, the first historical traffic flow data obtained is all the stored historical traffic flow data or part of the stored historical traffic flow data.

[0036] It should be understood that traffic flow data in different areas are monitored by different terminal devices, for example, different administrative areas or different cities are monitored by different terminal devices, and the monitored traffic flow data are stored locally to ensure data security.

[0037] Step S102: performing feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model.

[0038] Exemplarily, feature extraction processing is performed on the first historical traffic flow data based on a feature extraction model or a feature extraction network, wherein the feature extraction network includes but is not limited to a VGG network or a Resnet network.

[0039] Specifically, the first historical traffic flow data is preprocessed and standardized to obtain training data suitable for model training.

[0040] In some embodiments, the feature extraction processing is performed on the first historical traffic flow data to obtain training data for training a traffic flow prediction model, including: determining the traffic flow mean data and standard deviation data of each target road section in the target area based on the first historical traffic flow data; and performing data conversion processing on the traffic flow mean data and the standard deviation data to obtain training data.

[0041] Exemplarily, the first historical traffic flow data includes historical traffic flow data of multiple road sections. In the process of extracting features from the first historical traffic flow data, the traffic flow mean data and standard deviation data are determined based on the historical traffic flow data of all road sections, so as to convert the first historical traffic flow data into training data in the form of standardized Z scores based on the traffic flow mean data and standard deviation data to train the model. It should be noted that in the process of determining the traffic flow mean data based on the historical traffic flow data of all road sections, the historical time periods corresponding to the historical traffic flow data of all road sections are the same.

[0042] Step S103: training the traffic flow prediction model according to the training data to determine a first model parameter of the traffic flow prediction model after training.

[0043] Exemplarily, based on the obtained training data, the traffic flow prediction model deployed on the current terminal device is trained, so that after completing the model training of the traffic flow prediction model, the first model parameter corresponding to the trained traffic flow prediction model is obtained.

[0044] In the specific implementation process, the training data is input into the traffic flow prediction model, and the predicted data obtained by the traffic flow prediction model based on the training data is obtained, so as to adjust the model parameters of the traffic flow prediction model according to the training data and the predicted data, and determine the adjusted model parameters as the first model parameters.

[0045] Exemplarily, the traffic flow prediction model is a FASTGCN model to ensure the prediction capability of the traffic flow prediction model.

[0046] It should be understood that the training data for the traffic prediction model is local data, that is, in multiple terminal devices used to monitor different areas, the traffic flow prediction model deployed in each terminal device is trained using the training data generated locally by each terminal device. The training data will not be exchanged between the terminal devices to ensure the data security of each terminal device.

[0047] In some embodiments, the training of the traffic flow prediction model according to the training data to determine the first model parameters of the traffic flow prediction model after training includes: determining an attention matrix based on the spatiotemporal attention network of the traffic flow prediction model according to at least one calculation parameter and the training data; determining a data node graph corresponding to the training data based on the spatiotemporal graph convolutional network of the traffic flow prediction model, and determining predicted data corresponding to the training data based on the attention matrix and the Laplacian matrix of the data node graph; determining a training loss value based on the loss value calculation network of the traffic flow prediction model according to the training data and the predicted data; and adjusting the calculation parameters according to the training loss value to obtain the first model parameters of the traffic flow prediction model after training.

[0048] Exemplarily, the traffic flow prediction model includes at least a spatiotemporal attention network, a spatiotemporal graph convolution network and a loss value calculation network. The spatiotemporal attention network is used to determine the attention matrix based on at least one calculation parameter and training data. Specifically, the calculation parameter is determined by the model parameter of the current traffic flow prediction model; the spatiotemporal graph convolution network is used to determine the data node graph based on the training data, taking into account the topological structure of the road network, and determining the Laplace matrix of the data node graph, so as to determine the prediction data determined based on the training data according to the attention matrix and the Laplace matrix of the data node graph.

[0049] After obtaining the prediction data corresponding to the training data, the training loss value is determined according to the training data and the prediction data, so as to adjust the calculation parameters according to the training loss value, thereby realizing the adjustment of the model parameters. It should be noted that the calculation parameters are the model parameters, that is, the adjusted calculation parameters are the first model parameters.

[0050] In some embodiments, determining the attention matrix based on at least one calculation parameter and the training data includes: determining a first attention calculation matrix based on the training data and a first calculation parameter; determining a second attention calculation matrix based on the training data and a second calculation parameter; based on a first activation function, determining a third attention calculation matrix based on the first attention calculation matrix, the second attention calculation matrix and a third calculation parameter; based on a second activation function, determining the attention matrix based on the third attention calculation matrix and a fourth calculation parameter.

[0051] Exemplarily, including four calculation parameters, the calculation process of the attention matrix is ​​shown as follows:

[0052] S = softmax(V s ·σ(X h ·W1+W2·X h +b s ))

[0053] Among them, S is used to indicate the attention matrix, X h is used to indicate the training data, W1 is used to indicate the first calculation parameter, W2 is used to indicate the second calculation parameter, and b s Used to indicate the third calculation parameter, V s is used to indicate the fourth calculation parameter, σ is used to indicate the first activation function, and softmax is used to indicate the second activation function.

[0054] It should be understood that based on the calculation process of the above formula, the attention matrix input to the spatiotemporal graph convolutional network is obtained, so that in the spatiotemporal graph convolutional network, the predicted data corresponding to the training data is determined according to the attention matrix and the Laplacian matrix of the data node graph, thereby determining the training loss value according to the training data and the predicted data, and then determining the first model parameter according to the training loss value.

[0055] In the specific implementation process, the calculation process of the spatiotemporal graph convolutional network is shown as follows:

[0056] Y = ReLU(g θ (L)·X)

[0057] Among them, Y is used to indicate the predicted data corresponding to the training data, ReLU is the activation function, L is used to indicate the Laplacian matrix of the data node graph, and g θ It is used to indicate the graph convolution operation, and X is used to indicate the input data input to the spatiotemporal graph convolution network. Specifically, the input data input to the spatiotemporal graph convolution network includes but is not limited to the attention matrix output from the spatiotemporal attention network, or the input data determined according to the training data and the attention matrix.

[0058] It should be understood that each data node in the data node graph includes a plurality of feature vectors determined by training data.

[0059] In some embodiments, before adjusting the calculation parameters according to the training loss value, the method further includes: if the training loss value meets the model optimization conditions, adjusting the calculation parameters according to the training loss value, and determining the first model parameters according to the adjusted calculation parameters; if the training loss value does not meet the model optimization conditions, adjusting the calculation parameters according to the training loss value, and training the traffic flow prediction model after the adjusted calculation parameters according to the training data.

[0060] In the specific implementation process, the training process of the traffic flow prediction model can be expressed as the following optimization problem:

[0061]

[0062] Among them, N is the number of samples of training data, x i Used to indicate the input training data, y i Used to indicate the predicted data corresponding to the training data, f θ It is used to indicate the FASTGCN model, θ is used to indicate the first model parameter, and L is used to indicate the preset loss function.

[0063] It should be understood that when the above-mentioned optimization problem obtains the best solution, it is determined that the training loss value meets the model optimization conditions, so as to determine the first model parameters based on the traffic flow prediction model adjusted according to the current training loss value; and when the above-mentioned optimization problem does not obtain the best solution, the model parameters of the traffic flow prediction model are adjusted according to the training loss value, and the traffic flow prediction model after the model parameters are adjusted is trained again according to the training data, so that when the above-mentioned optimization problem obtains the best solution, the first model parameters are determined.

[0064] Through the optimization problem provided above, the accuracy of the first model parameters can be improved, thereby improving the prediction accuracy of the final traffic flow prediction model, and the decision-making process in the model training process can be clearly understood to improve the transparency and interpretability of the model training process, thereby improving the credibility and acceptance of the traffic flow prediction model in actual application scenarios.

[0065] Step S104: Send the first model parameters to a model federated learning server, and obtain global model parameters determined by the model federated learning server based on the first model parameters uploaded by multiple terminal devices, wherein different terminal devices are used to monitor traffic flow in different areas.

[0066] Exemplarily, after obtaining the first model parameter according to the trained traffic flow prediction model, the first model parameter is sent to the model federated learning server to obtain the global model parameter issued by the model federated learning server;

[0067] See also Figure 2 , Figure 2 A scene diagram of a traffic flow prediction method provided in an embodiment of the present application.

[0068] like Figure 2 As shown, the model federated learning server obtains data from multiple terminal devices (such as Figure 2The terminal devices 1-4 shown upload the first model parameters. It should be understood that the first model parameters of each terminal device are model parameters of the traffic flow prediction model deployed locally on each terminal device and trained through the above steps, so that the model federated learning server can determine the global model parameters based on the first model parameters uploaded by multiple terminal devices. Based on this, the traffic flow prediction model is updated according to the global model parameters, which can solve the problem that the uneven distribution of training data on a single terminal device affects the prediction performance of the traffic flow prediction model. The terminal device uploads the first model parameters so that the model federated learning server sends the global model parameters to each terminal device after federated learning, so that the terminal device does not need to upload original data such as historical traffic flow data, avoiding the risk of leakage of original data, improving the data security of the terminal device, and the training of the traffic flow prediction model is completed on each terminal device respectively, avoiding training multiple models on one terminal, and improving the training and update efficiency of the model.

[0069] In some embodiments, sending the first model parameters to a model federated learning server and obtaining global model parameters determined by the model federated learning server based on the first model parameters uploaded by multiple terminal devices include: sending the first model parameters to the model federated learning server to obtain global model parameters obtained by the model federated learning server after weighted averaging the first model parameters uploaded by multiple terminal devices.

[0070] Exemplarily, in a model federated learning server, first model parameters uploaded by multiple terminal devices are obtained, and the first model parameters uploaded by all terminal devices are aggregated to obtain global model parameters.

[0071] Specifically, the polymerization process is shown as follows:

[0072]

[0073] Among them, θ global is used to indicate the global model parameters, K is used to indicate the total number of terminal devices that upload the first model parameters, θ k Used to indicate the first model parameter uploaded by the k-th terminal model, w k Used to indicate the weight value of the kth terminal device; specifically, the weight value of the terminal device is determined based on the data volume and / or data quality, which is not limited in this application.

[0074] By completing the federated learning of the model in the model federated learning server to obtain the global model parameters, and the data for the federated learning in the model federated learning server are the model parameters of each terminal device, without involving the original data, thereby improving the security of the local data of each terminal device during the federated learning process. It should be understood that after the model federated learning server determines the global model parameters based on the first model parameters uploaded by multiple terminal devices, the global model parameters are sent to each terminal device, so that each terminal device can update the locally deployed traffic flow prediction model according to the global model parameters. Since the updated parameters are global model parameters, the data distribution is wider, which can improve the generalization ability and prediction performance of the updated model.

[0075] Step S105: updating the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model.

[0076] Exemplarily, after receiving the global model parameters sent by the model federated learning server, the locally deployed traffic flow prediction model is updated according to the global model parameters to obtain the target traffic flow prediction model.

[0077] It should be noted that the global model parameters may not include all model parameters of the locally deployed traffic flow prediction model, that is, the global model parameters only update some model parameters in the traffic flow prediction model. Based on this, the target traffic flow prediction model updated based on the global model parameters in different terminal devices is not exactly the same, so that terminal devices monitoring different areas can still make predictions based on the actual situation of their own monitoring areas, so as to improve the prediction accuracy of the target traffic flow prediction model.

[0078] In some embodiments, updating the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model includes: if the number of rounds of updating the traffic flow prediction model based on the global model parameters is greater than or equal to a preset round threshold, determining that the current traffic flow prediction model updated based on the global model parameters is the target traffic flow prediction model.

[0079] Exemplarily, the traffic flow prediction model is updated multiple times to improve the prediction accuracy of the obtained target traffic flow prediction model. Specifically, a round number threshold is preset, so that when the number of rounds of updating the traffic flow prediction model according to the global model parameters is greater than or equal to the preset round number threshold, the model update is terminated, and the model updated last is determined as the target traffic flow prediction model.

[0080] It should be understood that each round of global model parameter updating of the traffic flow prediction model indicates the execution of the above steps S103 to S105 once, and in each round of training the traffic flow prediction model based on the training data, the traffic flow prediction model updated in the previous round is trained. Specifically, in the n+1th round, the traffic flow prediction model to be trained is the traffic flow prediction model updated based on the global model parameters in the nth round, so as to improve the prediction accuracy of the target traffic flow prediction model that is finally output.

[0081] In other embodiments, updating the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model includes: determining second model parameters of the traffic flow prediction model after being updated based on the global model parameters; if the second model parameters meet the model parameter convergence conditions, determining that the traffic flow prediction model corresponding to the second model parameters is the target traffic flow prediction model.

[0082] Exemplarily, it is determined whether the second model parameters meet the model parameter convergence conditions to end the update of the traffic flow prediction model. Specifically, after the nth round of updates, the traffic flow prediction model is updated based on the global model parameters obtained in the nth round, and the second model parameters of the traffic flow prediction model after the nth round of updates are determined, and the second model parameters of the updated traffic flow prediction model in the n-1th round are obtained. If it is determined that the second model parameters meet the convergence conditions based on the second model parameters in the nth round and the second model parameters in the n-1th round, the traffic flow prediction model after the nth round of updates is determined as the target traffic flow prediction model. It should be understood that when determining whether the second model parameters meet the model parameter convergence conditions, it can be determined based on the second model parameters corresponding to more rounds, and this application is not limited thereto.

[0083] It should be noted that the traffic flow prediction model is updated for multiple rounds. When the number of update rounds is greater than or equal to the preset round number threshold or the corresponding model parameters converge, the update of the traffic flow prediction model can be terminated and the target traffic flow prediction model can be output, thereby improving the prediction accuracy and generalization ability of the target traffic flow prediction model.

[0084] Step S106: Determine traffic flow prediction data based on the target traffic flow prediction model and the second historical traffic flow data.

[0085] Exemplarily, after obtaining the target traffic flow prediction model, the second historical traffic flow data monitored by the current terminal device is input into the target traffic flow prediction model in the current terminal device to obtain the traffic flow prediction data output by the target traffic flow prediction model, thereby completing the prediction of the traffic flow at the target time, and predicting the traffic flow in the future, so that public transportation can be dispatched and congestion warning can be issued according to the predicted traffic flow, so as to improve and alleviate traffic problems. It should be understood that the second historical traffic flow data is the same as the first historical traffic flow data, or the historical time period corresponding to the second historical traffic flow data is shorter than the historical time period corresponding to the first historical traffic flow data, and the historical time period corresponding to the second historical traffic flow data is closer to the current time, so as to improve the accuracy of traffic flow prediction.

[0086] It should be noted that in different terminal devices, predictions are made based on the second historical traffic flow data monitored in each terminal device, so that each terminal device can make predictions based on the traffic flow data monitored by itself, thereby improving the prediction accuracy of traffic flow in different areas.

[0087] The traffic flow prediction method provided in the above embodiment obtains the first historical traffic flow data of the target area to determine the training data through the first historical traffic flow data, and uses the training data to train the traffic flow prediction model deployed locally on the current terminal device to obtain the first model parameters in the trained traffic flow prediction model; the first model parameters are sent to the model federated learning server to obtain the global model parameters determined by the model federated learning server according to the first model parameters uploaded by multiple terminal devices, so as to update the local traffic flow prediction model according to the global model parameters to obtain the target traffic flow prediction model. Since the global model parameters are determined by the model parameters uploaded by multiple terminal devices, and the model parameters of each terminal device are in each terminal device, the local traffic flow prediction model is updated using the local training data. Therefore, using the global model parameters to update the local traffic flow prediction model can avoid the problem of single training data and improve the generalization ability of the target traffic flow prediction model; and what is uploaded to the model federated learning server are the model parameters of the traffic flow prediction model in each terminal device, rather than training data or other original data, to ensure the privacy of the data; and the model training process in each terminal device is completed in each terminal device, avoiding training multiple models in the same terminal device and causing excessive load on the terminal device, thereby reducing the overall training efficiency; therefore, the present application improves the data security and training update efficiency of the model during the training update process, and avoids the problem of single or uneven distribution of training data, thereby improving the prediction accuracy and generalization ability of the target traffic flow prediction model.

[0088] See also Figure 3 , Figure 3 is a schematic diagram of a traffic flow prediction device provided in an embodiment of the present application. The traffic flow prediction device can be configured in a terminal device to execute the aforementioned traffic flow prediction method.

[0089] like Figure 3 As shown, the traffic flow prediction device 100 includes: a data acquisition module 110, a data processing module 120, a model training module 130, a parameter sending module 130, a model updating module 150, and a data prediction module 160.

[0090] The data acquisition module 110 is used to acquire first historical traffic flow data of a target area, where the target area is the area monitored by the current terminal device.

[0091] The data processing module 120 is used to perform feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model.

[0092] The model training module 130 is used to train the traffic flow prediction model according to the training data to determine the first model parameter of the traffic flow prediction model after training.

[0093] The parameter sending module 140 is used to send the first model parameters to the model federated learning server, and obtain the global model parameters determined by the model federated learning server based on the first model parameters uploaded by multiple terminal devices, wherein different terminal devices are used to monitor traffic flow in different areas.

[0094] The model updating module 150 is used to update the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model.

[0095] The data prediction module 160 is used to determine traffic flow prediction data according to the second historical traffic flow data based on the target traffic flow prediction model.

[0096] Exemplarily, the model training module 130 includes a spatiotemporal attention network submodule, a spatiotemporal graph convolutional network submodule, a loss value calculation network submodule, and a calculation parameter adjustment submodule.

[0097] The spatiotemporal attention network submodule is used to determine an attention matrix based on the spatiotemporal attention network of the traffic flow prediction model according to at least one calculation parameter and the training data.

[0098] The spatiotemporal graph convolutional network submodule is used to determine the data node graph corresponding to the training data based on the spatiotemporal graph convolutional network of the traffic flow prediction model, and determine the prediction data corresponding to the training data according to the attention matrix and the Laplacian matrix of the data node graph.

[0099] The loss value calculation network submodule is used to determine the training loss value based on the loss value calculation network of the traffic flow prediction model according to the training data and the prediction data.

[0100] The calculation parameter adjustment submodule is used to adjust the calculation parameter according to the training loss value to obtain the first model parameter of the traffic flow prediction model after training.

[0101] Exemplarily, the spatiotemporal attention network submodule also includes a first matrix determination submodule, a second matrix determination submodule, a third matrix determination submodule, and an attention matrix determination submodule.

[0102] The first matrix determination submodule is used to determine a first attention calculation matrix according to the training data and the first calculation parameter.

[0103] The second matrix determination submodule is used to determine the second attention calculation matrix according to the training data and the second calculation parameters.

[0104] The third matrix determination submodule is used to determine the third attention calculation matrix based on the first activation function, according to the first attention calculation matrix, the second attention calculation matrix and the third calculation parameter.

[0105] The attention matrix determination submodule is used to determine the attention matrix based on the second activation function, according to the third attention calculation matrix and the fourth calculation parameter.

[0106] Exemplarily, the traffic flow prediction device 100 further includes a loss value determination submodule.

[0107] The loss value determination submodule is used to adjust the calculation parameters according to the training loss value if the training loss value meets the model optimization conditions, and determine the first model parameters according to the adjusted calculation parameters; if the training loss value does not meet the model optimization conditions, adjust the calculation parameters according to the training loss value, and train the traffic flow prediction model after the adjusted calculation parameters according to the training data.

[0108] Exemplarily, the parameter sending module 140 is also used to send the first model parameters to the model federated learning server to obtain the global model parameters obtained by the model federated learning server after weighted averaging the first model parameters uploaded by multiple terminal devices.

[0109] Exemplarily, the data processing module 120 includes a data calculation submodule and a data conversion submodule.

[0110] A data calculation submodule, used to determine the traffic flow mean data and standard deviation data of each target road section in the target area according to the first historical traffic flow data;

[0111] The data conversion submodule is used to perform data conversion processing on the traffic flow mean data and the standard deviation data to obtain training data.

[0112] Exemplarily, the model updating module 150 is also used to determine that the current traffic flow prediction model updated based on the global model parameters is the target traffic flow prediction model if the number of rounds of updating the traffic flow prediction model based on the global model parameters is greater than or equal to a preset round threshold.

[0113] Or used to determine the second model parameters of the traffic flow prediction model updated based on the global model parameters; if the second model parameters meet the model parameter convergence conditions, determine the traffic flow prediction model corresponding to the second model parameters as the target traffic flow prediction model.

[0114] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0115] See also Figure 4 , Figure 4 A schematic block diagram of the structure of a terminal device provided in an embodiment of the present application.

[0116] like Figure 4 As shown, the terminal device includes a processor, a memory and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.

[0117] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any traffic flow prediction method.

[0118] The processor is used to provide computing and control capabilities to support the operation of the entire terminal device.

[0119] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any traffic flow prediction method.

[0120] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the terminal device to which the scheme of the present application is applied. The specific terminal device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0121] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0122] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0123] Acquire first historical traffic flow data of a target area, where the target area is an area monitored by a current terminal device;

[0124] Performing feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model;

[0125] Training the traffic flow prediction model according to the training data to determine a first model parameter of the traffic flow prediction model after training;

[0126] Sending the first model parameters to a model federated learning server, and obtaining global model parameters determined by the model federated learning server according to the first model parameters uploaded by multiple terminal devices, wherein different terminal devices are used to monitor traffic flows in different areas;

[0127] Update the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model;

[0128] Based on the target traffic flow prediction model, traffic flow prediction data is determined according to the second historical traffic flow data.

[0129] In one embodiment, when the processor implements training the traffic flow prediction model according to the training data to determine the first model parameter of the trained traffic flow prediction model, it is used to implement:

[0130] Based on the spatiotemporal attention network of the traffic flow prediction model, determining an attention matrix according to at least one calculation parameter and the training data;

[0131] Based on the spatiotemporal graph convolutional network of the traffic flow prediction model, determining a data node graph corresponding to the training data, and determining prediction data corresponding to the training data according to the attention matrix and the Laplacian matrix of the data node graph;

[0132] Based on the loss value calculation network of the traffic flow prediction model, determining the training loss value according to the training data and the prediction data;

[0133] The calculation parameters are adjusted according to the training loss value to obtain first model parameters of the traffic flow prediction model after training.

[0134] In one embodiment, the processor, when determining the attention matrix according to at least one calculation parameter and the training data, is used to implement:

[0135] Determine a first attention calculation matrix according to the training data and the first calculation parameter;

[0136] Determine a second attention calculation matrix according to the training data and the second calculation parameter;

[0137] Based on the first activation function, determining a third attention calculation matrix according to the first attention calculation matrix, the second attention calculation matrix and the third calculation parameter;

[0138] Based on the second activation function, the attention matrix is ​​determined according to the third attention calculation matrix and the fourth calculation parameter.

[0139] In one embodiment, before adjusting the calculation parameters according to the training loss value, the processor is further configured to implement:

[0140] If the training loss value meets the model optimization condition, adjust the calculation parameter according to the training loss value, and determine the first model parameter according to the adjusted calculation parameter;

[0141] If the training loss value does not meet the model optimization condition, the calculation parameters are adjusted according to the training loss value, and the traffic flow prediction model after the adjusted calculation parameters is trained according to the training data.

[0142] In one embodiment, when the processor implements sending the first model parameter to the model federated learning server and obtaining the global model parameter determined by the model federated learning server according to the first model parameter uploaded by multiple terminal devices, it is used to implement:

[0143] The first model parameters are sent to a model federated learning server to obtain global model parameters obtained by weighted averaging the first model parameters uploaded by multiple terminal devices by the model federated learning server.

[0144] In one embodiment, when the processor performs feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model, the processor is used to implement:

[0145] Determine the traffic flow mean data and standard deviation data of each target road section in the target area according to the first historical traffic flow data;

[0146] Data conversion processing is performed on the traffic flow mean data and the standard deviation data to obtain training data.

[0147] In one embodiment, when the processor updates the traffic flow prediction model based on the global model parameters to obtain the target traffic flow prediction model, it is used to implement:

[0148] If the number of rounds of updating the traffic flow prediction model based on the global model parameters is greater than or equal to a preset round number threshold, determining the current traffic flow prediction model updated based on the global model parameters as the target traffic flow prediction model; or

[0149] Determining a second model parameter of the traffic flow prediction model updated based on the global model parameter;

[0150] If the second model parameters meet the model parameter convergence condition, the traffic flow prediction model corresponding to the second model parameters is determined to be the target traffic flow prediction model.

[0151] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the terminal device described above can refer to the corresponding process in the aforementioned traffic flow prediction method embodiment, and will not be repeated here.

[0152] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the traffic flow prediction method of the present application.

[0153] The computer-readable storage medium may be an internal storage unit of the terminal device described in the foregoing embodiment, such as a hard disk or memory of the terminal device. The computer-readable storage medium may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the terminal device.

[0154] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0155] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0156] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A traffic flow prediction method, characterized in that: Applied to a terminal device, the traffic flow prediction method includes: Acquire first historical traffic flow data of a target area, where the target area is an area monitored by a current terminal device; Performing feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model; Training the traffic flow prediction model according to the training data to determine a first model parameter of the traffic flow prediction model after training; Sending the first model parameters to a model federated learning server, and obtaining global model parameters determined by the model federated learning server according to the first model parameters uploaded by multiple terminal devices, wherein different terminal devices are used to monitor traffic flows in different areas; Update the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model; Based on the target traffic flow prediction model, traffic flow prediction data is determined according to the second historical traffic flow data.

2. The traffic flow prediction method according to claim 1, characterized in that: The step of training the traffic flow prediction model according to the training data to determine a first model parameter of the traffic flow prediction model after training includes: Based on the spatiotemporal attention network of the traffic flow prediction model, determining an attention matrix according to at least one calculation parameter and the training data; Based on the spatiotemporal graph convolutional network of the traffic flow prediction model, determining a data node graph corresponding to the training data, and determining prediction data corresponding to the training data according to the attention matrix and the Laplacian matrix of the data node graph; Based on the loss value calculation network of the traffic flow prediction model, determining the training loss value according to the training data and the prediction data; The calculation parameters are adjusted according to the training loss value to obtain first model parameters of the traffic flow prediction model after training.

3. The traffic flow prediction method according to claim 2, characterized in that: The determining of the attention matrix according to at least one calculation parameter and the training data comprises: Determine a first attention calculation matrix according to the training data and the first calculation parameter; Determine a second attention calculation matrix according to the training data and the second calculation parameter; Based on the first activation function, determining a third attention calculation matrix according to the first attention calculation matrix, the second attention calculation matrix and the third calculation parameter; Based on the second activation function, the attention matrix is ​​determined according to the third attention calculation matrix and the fourth calculation parameter.

4. The traffic flow prediction method according to claim 2, characterized in that: Before adjusting the calculation parameters according to the training loss value, the method further includes: If the training loss value meets the model optimization condition, adjust the calculation parameter according to the training loss value, and determine the first model parameter according to the adjusted calculation parameter; If the training loss value does not meet the model optimization condition, the calculation parameters are adjusted according to the training loss value, and the traffic flow prediction model after the adjusted calculation parameters is trained according to the training data.

5. The traffic flow prediction method according to any one of claims 1 to 4, characterized in that: The sending the first model parameter to the model federated learning server, and obtaining the global model parameter determined by the model federated learning server according to the first model parameter uploaded by multiple terminal devices, includes: The first model parameters are sent to a model federated learning server to obtain global model parameters obtained by weighted averaging the first model parameters uploaded by multiple terminal devices by the model federated learning server.

6. The traffic flow prediction method according to any one of claims 1 to 4, characterized in that: The performing feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model includes: Determine the traffic flow mean data and standard deviation data of each target road section in the target area according to the first historical traffic flow data; Data conversion processing is performed on the traffic flow mean data and the standard deviation data to obtain training data.

7. The traffic flow prediction method according to any one of claims 1 to 4, characterized in that: The updating of the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model includes: If the number of rounds of updating the traffic flow prediction model based on the global model parameters is greater than or equal to a preset round number threshold, determining the current traffic flow prediction model updated based on the global model parameters as the target traffic flow prediction model; or Determining a second model parameter of the traffic flow prediction model updated based on the global model parameter; If the second model parameters meet the model parameter convergence condition, the traffic flow prediction model corresponding to the second model parameters is determined to be the target traffic flow prediction model.

8. A traffic flow prediction device, characterized in that: The traffic flow prediction device comprises: A data acquisition module, used to acquire first historical traffic flow data of a target area, where the target area is an area monitored by the current terminal device; A data processing module, used for performing feature extraction processing on the first historical traffic flow data to obtain training data for training a traffic flow prediction model; A model training module, used for training the traffic flow prediction model according to the training data to determine a first model parameter of the traffic flow prediction model after training; A parameter sending module, used to send the first model parameter to a model federated learning server, and obtain a global model parameter determined by the model federated learning server according to the first model parameter uploaded by a plurality of terminal devices, wherein different terminal devices are used to monitor traffic flow in different areas; A model updating module, used for updating the traffic flow prediction model based on the global model parameters to obtain a target traffic flow prediction model; The data prediction module is used to determine traffic flow prediction data based on the target traffic flow prediction model and the second historical traffic flow data.

9. A terminal device, characterized in that: The terminal device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the traffic flow prediction method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the traffic flow prediction method according to any one of claims 1 to 7 are implemented.