Traffic prediction method and system, server and readable storage medium
Through the framework of generative adversarial networks and online federated learning, combined with graph convolutional networks and time attention mechanisms, the shortcomings of existing traffic prediction technologies in road network complexity, equipment limitations and information security are solved, and high-precision and real-time are achieved. and safe traffic forecasts.
Patent Information
- Application Number
- CN202510006901.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2045-01-03
AI Technical Summary
Existing traffic forecasting technologies have shortcomings in dealing with road network complexity, mobile device restrictions and information security, resulting in limited prediction accuracy and risk of data privacy leakage.
Adopting a travel time prediction framework of generative adversarial networks and online federated learning, extract spatial features from individual trajectory data through a central server, generate spatiotemporal features using graph convolution networks and temporal attention mechanisms, and update and aggregation of global models to ensure Data privacy protection.
It improves the accuracy and real-time nature of traffic forecasts, enhances adaptability to dynamic traffic environments, ensures data privacy and security, and achieves the complementary advantages of personalized and global models.
Smart Images

Figure CN119418533A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of traffic data analysis and prediction, and in particular to a traffic prediction method, system, central server and readable storage medium. Background Art
[0002] With the rapid development of artificial intelligence technology and the continuous advancement of technologies such as GPS (Global Positioning System) and sensors, massive amounts of trajectory data have become easily available. The development of these technologies provides a basis for analyzing and mining trajectory data, making it possible to predict travel time. Travel time prediction technology plays an important role in traffic flow prediction, location recommendation, and smart city construction. Existing technologies usually use road segment-based methods, path-based methods, deep learning-based methods, or graph neural network-based methods to estimate travel time.
[0003] Although existing technologies have made certain progress in travel time prediction, there are still technical defects: the existing prediction technology does not adequately consider the complex relationships between road sections and intersections in the road network, resulting in limited prediction accuracy; at the same time, due to the long model training time and high transmission cost during data processing, there is a risk of data privacy leakage and insufficient real-time and dynamic adaptability, making it difficult to quickly respond to changes in traffic conditions. Summary of the invention
[0004] The main technical problem solved by the present invention is to provide a traffic prediction method, system, server and readable storage medium, which is based on a travel time prediction framework of generative adversarial networks and online federated learning, and overcomes the shortcomings of the prior art in dealing with road network complexity, mobile device limitations and information security.
[0005] In order to solve the above technical problems, a technical solution adopted by the present invention is: to provide a traffic prediction method, the method comprising: The central server extracts spatial features related to the road network from the individual trajectory data, uses a graph convolutional network to process and extract the spatial features of the road network, and embeds the spatial features of the road network into the global model to capture the spatial dependency of the road network. Based on the spatial features and time information of the road network, the spatial features are combined with the time information through a graph convolutional network and a time attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embed the processed spatiotemporal features into the global model, and update the global model to reflect the latest traffic conditions. The global model is a personalized model constructed and trained based on the individual trajectory using the trajectory data and vehicle status information of the user during driving collected by the client from the database, and is uploaded to the central server as a model of its weight after adding noise data constructed by differential privacy to the model parameters of the personalized model. The central server analyzes and processes the spatiotemporal characteristics according to the individual trajectory data and the traffic status reflected by the global model to generate an estimated travel time for a specific route and time step; decomposes and processes the spatiotemporal characteristics according to the personalized models uploaded by all clients and the global traffic data to generate traffic status estimates for each time period that conforms to the road network structure; and learns and optimizes the non-personalized global traffic status according to the personalized model parameters uploaded by the client to generate an updated global model; and The central server executes a federated learning algorithm to perform weighted averaging and secure aggregation of the model based on the localized global model weights uploaded by the client, updates the global traffic status, and sends the aggregated global model weights back to the client, so that the client can train and optimize the personalized model based on the aggregated global model weights.
[0006] The spatial features of the road network are processed and extracted using a graph convolutional network, and the spatial features of the road network are embedded into a global model to capture the spatial dependencies of the road network, specifically including: The graph signal is defined by formula (5) to provide a feature vector for each node or link in the graph convolution network, so as to process the spatial characteristics of the traffic network by performing the graph convolution operation by formula (6), aggregate neighbor node information, introduce nonlinear characteristics, and update the global model to accurately reflect the structure and dynamic characteristics of the road network; (5) (6) In formula (5), represents the hidden state of the lth layer of the graph convolutional network, N represents the number of samples, represents the feature dimension of the lth layer; in formula (6), L c Representing the Laplacian matrix of a graph c Power; represents the hidden state at layer l; Indicates c Jump and l The weight parameters of the layer, represents the weight matrix of the lth layer, represents a nonlinear activation function, Represents the set of weight parameters of the lth layer.
[0007] According to the spatial characteristics and temporal information of the road network, the spatial characteristics and temporal information are combined through a graph convolutional network and a temporal attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embed the processed spatiotemporal features into a global model, and update the global model to reflect the latest traffic conditions, specifically including: Receive spatial feature data from the client and obtain time information; The spatial features are processed using a graph convolutional network to generate the hidden state of each road segment and node. ; wherein, the graph convolution network processing is performed by the formula (5), It means that after being processed by the GCN layer, the hidden state of the l+1th layer is obtained; Encode temporal information into temporal embedding vectors ;in, K represents the number of time intervals in a day, I represents the latitude of the time embedding vector; Combine the hidden states and temporal embeddings generated by graph convolutional networks, and use fully connected layers to generate initial prediction features for links and nodes; Apply the temporal attention mechanism to adjust the impact of different time steps on traffic status; Applying the spatiotemporal vector product processing to the links and nodes respectively through formulas (7) and (8) to generate the corresponding traffic state prediction; and The calculated spatiotemporal features are embedded into the global model, and the global model is updated to reflect the latest traffic status; (7) (8) in, Indicates that at a specific time step Traffic status prediction of downlink; Indicates that at a specific time step Traffic status prediction of the next node; It represents the hidden state of the link at layer l+1 after being processed by the graph convolutional network; It represents the hidden state of the node at the l+1 layer after being processed by the graph convolutional network; and represents the weight matrix for links and nodes in the spatiotemporal vector product layer; and Represents the bias terms of links and nodes; Represents the time embedding vector at time step The value below; represents the temporal attention mechanism; the fully connected layer passes through, and Build.
[0008] The central server performs spatiotemporal feature analysis and processing based on the individual trajectory data and the traffic status reflected by the global model to generate an estimated travel time for a specific route and time step, specifically including: The central server performs spatiotemporal feature analysis based on the individual trajectory data and the traffic status reflected by the global model, and uses formula (9) to calculate the estimated travel time on route r; in formula (9), y represents the estimated travel time, represents the estimated or predicted value of the travel time, |r| represents the total number of road segments and intersections in route 𝑟, Y represents the estimated state or time of a certain road segment or intersection, represents the i-th road segment, represents the jth intersection, represents the time step; (9) Based on the personalized models uploaded by all clients and the global traffic data, the temporal and spatial characteristics are decomposed to generate traffic status estimates for each time period that conform to the road network structure, including: Receive the personalized model and global traffic data, divide a day into different parts, apply spatiotemporal tensor decomposition to each part to process traffic state prediction, generate decomposed spatiotemporal features, and generate an estimate of the global traffic state; According to the personalized model parameters uploaded by the client, non-personalized global traffic state learning and optimization processing are performed to generate an updated global model, specifically including: According to the personalized model parameters uploaded by the client, the loss function is calculated using formula (10); wherein the personalized model parameters include the personalized model update uploaded by the client, the client m Actual driving time data , client-side model estimated travel time , the number of trajectory samples of the client n m ; In formula (10), represents the trainable model parameters of the global model, represents the loss function of the global model, which is used to measure the difference between the model prediction and the actual travel time; (10) Apply the stochastic gradient descent (SGD) algorithm to the loss function and the current parameters of the global model Optimize to generate updated global model parameters ; Based on the local model of all clients Table and Sample Size n m , use formula (11) to calculate the global model As the weighted average of all clients, to get the updated global model ;in, α represents the learning rate, M is the number of customers selected in round t, n is the total number of samples of all customers selected in round t; (11) The updated global model The data are aggregated and sent to all clients, so that the clients can perform the next step of personalized model training.
[0009] The central server executes the federated learning algorithm to perform weighted averaging and secure aggregation of the model according to the localized global model weights uploaded by the client, updates the global traffic state, and sends the aggregated global model weights back to the client, so that the client can train and optimize the personalized model based on the aggregated global model weights, specifically including: The central server initializes the global model using formula (12) ;in, Indicates t The global model of the wheel, ; The central server is based on the number of rounds t In each round of t Select M clients to form a random set I t , the current round number is calculated by formula (12) t The global model Send to Collection I t Each client in m , so that the client receives the global model sent by the central server and uses the local data set through formulas (13) and (14) , based on the SGD algorithm and the local dataset Train the model to generate an updated localized global model f m ; (12) (13) (14) The central server receives the privacy-preserving local model uploaded by the client. f m , and calculate the current round number through formula (11) t +1The weighted average of the global models to generate the aggregated global model , and the global model Send it to all clients; wherein the local model of privacy protection f m The updated localized global model is updated by the client f m Add Laplace noise using equation (16) to satisfy Differential privacy, generating privacy-preserving local models f m ;in, f m Indicates m A local model on the client; Represents the gradient operator, which is used to calculate the loss function L with respect to the model parameters θ b The gradient of Represents the loss function, which is used to measure the model f In the m Client datasets The difference between the predicted and actual values on ; (15).
[0010] In order to solve the above technical problems, another technical solution adopted by the present invention is to provide a traffic prediction method, the method comprising: The client collects the user's driving trajectory data and vehicle status information from the database to obtain individual trajectories, and builds and trains a personalized model based on the individual trajectories; and adds differential privacy to the model parameters of the personalized model to build noise data, and uploads the model parameters with added noise data to the central server as localized global model weights; The central server extracts spatial features related to the road network from the individual trajectory data, processes and extracts the spatial features of the road network using a graph convolutional network, and embeds the spatial features of the road network into a global model to capture the spatial dependencies of the road network, and combines the spatial features with the temporal information through a graph convolutional network and a temporal attention mechanism based on the spatial features and temporal information of the road network to generate spatiotemporal features that can reflect changes in traffic conditions, embeds the processed spatiotemporal features into a global model, and updates the global model to reflect the latest traffic conditions; The central server analyzes and processes the spatiotemporal characteristics according to the individual trajectory data and the traffic status reflected by the global model to generate an estimated travel time for a specific route and time step; decomposes and processes the spatiotemporal characteristics according to the personalized models uploaded by all clients and the global traffic data to generate traffic status estimates for each time period that conforms to the road network structure; and learns and optimizes the non-personalized global traffic status according to the personalized model parameters uploaded by the client to generate an updated global model; and The central server executes a federated learning algorithm to perform weighted averaging and secure aggregation of the model based on the localized global model weights uploaded by the client, updates the global traffic status, and sends the aggregated global model weights back to the client, so that the client can train and optimize the personalized model based on the aggregated global model weights.
[0011] In order to solve the above technical problems, another technical solution adopted by the present invention is: providing a central server to establish communication connections with multiple clients, the central server comprising: A spatial feature extraction module, configured to receive the individual trajectory data uploaded by the client, and extract spatial features related to the road network from the individual trajectory data; A graph convolutional network application module, used to process and extract the spatial features of the road network extracted by the spatial feature extraction module using a graph convolutional network, and embed the spatial features of the road network into a global model to capture the spatial dependency of the road network; A spatiotemporal feature integration module is used to combine the spatial features and temporal information of the road network generated by the graph convolutional network application module through a graph convolutional network and a temporal attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embed the processed spatiotemporal features into a global model, and update the global model to reflect the latest traffic conditions; A localized global model prediction module, used to analyze and process the spatiotemporal features according to the individual trajectory data and the traffic state reflected by the global model generated by the spatiotemporal feature integration module, and generate an estimated travel time for a specific route and time step; A spatiotemporal tensor decomposition module is used to receive the personalized model and global traffic data uploaded by the client, and perform spatiotemporal feature decomposition processing to generate traffic state estimates for each time period that conform to the road network structure; A global model training module, used to learn and optimize the non-personalized global traffic state according to the personalized model parameters uploaded by the client, and generate an updated global model; The federated learning collaborative module is used to execute the federated learning algorithm to perform weighted averaging and secure aggregation of the model according to the localized global model weights uploaded by the client, update the global traffic status, and send the aggregated global model weights back to the client, so that the client can train and optimize the personalized model based on the aggregated global model weights.
[0012] The graph convolution network processing module is used to define the graph signal through formula (5) to provide a feature vector for each node or link in the graph convolution network, to perform the graph convolution operation through formula (6) to process the spatial characteristics of the traffic network, aggregate neighbor node information, introduce nonlinear characteristics, and update the global model to accurately reflect the structure and dynamic characteristics of the road network; (5) (6) In formula (5), represents the hidden state of the lth layer of the graph convolutional network, N represents the number of samples, represents the feature dimension of the lth layer; in formula (6), L c Representing the Laplacian matrix of a graph c Power; represents the hidden state at layer l; Indicates c jump and the weight parameter of the lth layer, represents the weight matrix of the lth layer, represents a nonlinear activation function, Represents the set of weight parameters of the lth layer.
[0013] Wherein, the spatiotemporal feature integration module is used to: Receive spatial feature data from the client and obtain time information; The spatial features are processed using a graph convolutional network to generate the hidden state of each road segment and node. ; wherein, the graph convolution network processing is performed by the formula (5), It means that after being processed by the GCN layer, the hidden state of the l+1th layer is obtained; Encode temporal information into temporal embedding vectors ;in, K represents the number of time intervals in a day, I represents the latitude of the time embedding vector; Combine the hidden states and temporal embeddings generated by graph convolutional networks, and use fully connected layers to generate initial prediction features for links and nodes; Apply the temporal attention mechanism to adjust the impact of different time steps on traffic status; Applying the spatiotemporal vector product processing to the links and nodes respectively through formulas (7) and (8) to generate the corresponding traffic state prediction; and The calculated spatiotemporal features are embedded into the global model, and the global model is updated to reflect the latest traffic status; (7) (8) in, Indicates that at a specific time step Traffic status prediction of downlink; Indicates that at a specific time step Traffic status prediction of the next node; It represents the hidden state of the link at layer l+1 after being processed by the graph convolutional network; It represents the hidden state of the node at the l+1 layer after being processed by the graph convolutional network; and Respectively represent the weight matrices for links and nodes in the spatiotemporal vector product layer; and Represents the bias terms of links and nodes; Represents the time embedding vector at time step The value below; represents the temporal attention mechanism; the fully connected layer passes through, and Build.
[0014] The localized global model prediction module is used to analyze and process the spatiotemporal characteristics according to the individual trajectory data and the traffic status reflected by the global model, and calculate the estimated travel time on route r using formula (9); in formula (9), y represents the estimated travel time, represents the estimated or predicted value of the travel time, |r| represents the total number of road segments and intersections in route r, and Y represents the estimated state or time of a road segment or intersection. represents the i-th road segment, represents the jth intersection, represents the time step; (9) The spatiotemporal tensor decomposition module is used to receive the personalized model and the global traffic data, divide the time of a day into different parts, and apply the spatiotemporal tensor decomposition to each part to process the traffic state prediction, generate the decomposed spatiotemporal features, and generate the estimation of the global traffic state; The global model training module is used to: According to the personalized model parameters uploaded by the client, the loss function is calculated using formula (10); wherein the personalized model parameters include the personalized model update uploaded by the client, the client m Actual driving time data , client-side model estimated travel time , the number of trajectory samples of the client n m ; In formula (10), represents the trainable model parameters of the global model, represents the loss function of the global model, which is used to measure the difference between the model prediction and the actual travel time; (10) Apply the stochastic gradient descent (SGD) algorithm to the loss function and the current parameters of the global model Optimize to generate updated global model parameters ; Based on the local model of all clients Table and Sample Size n m , use formula (11) to calculate the global model As the weighted average of all clients, to get the updated global model ;in, α represents the learning rate, M is the number of customers selected in round t, n is the total number of samples of all customers selected in round t; (11) The updated global model The data are aggregated and sent to all clients, so that the clients can perform the next step of personalized model training.
[0015] The federated learning collaborative module is used to: Initialize the global model ;in, Indicates t The global model of the wheel, ; Based on round number t In each round of t Select M clients to form a random set I t , the current round number is calculated by formula (12) t The global model Send to Collection I t Each client in m, so that the client receives the global model sent by the central server , using the local data set through formulas (13) and (14) , based on the SGD algorithm and the local dataset Train the model to generate an updated localized global model f m ; (12) (13) (14) Receive the privacy-preserving local model uploaded by the client f m , and calculate the current round number through formula (11) t +1The weighted average of the global models to generate the aggregated global model , and the global model Send it to all clients; wherein the local model of privacy protection f m The updated localized global model is updated by the client f m Add Laplace noise using equation (15) to satisfy Differential privacy, generating privacy-preserving local models f m ;in, f m Indicates m A local model on the client; Represents the gradient operator, which is used to calculate the loss function L with respect to the model parameters θ b The gradient of Represents the loss function, which is used to measure the model f In the m Client datasets The difference between the predicted and actual values on ; (15).
[0016] To solve the above technical problems, another technical solution adopted by the present invention is: to provide an electronic device, including: a processor and a memory, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor executes the computer instructions, the electronic device executes the steps of the traffic prediction method as described above.
[0017] In order to solve the above technical problems, another technical solution adopted by the present invention is: providing a readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the steps of the traffic prediction method as described above.
[0018] The present invention provides a traffic prediction method, system, central server and readable storage medium. Federated learning technology is used to allow data to be trained on local devices without directly exposing the original data. The differential privacy mechanism is used to ensure the security of user data during model training and updating. The global model is designed as an online generation model, which can be updated in real time to adapt to the dynamic changes of the traffic environment, thereby improving the model's responsiveness to real-time traffic conditions. Through the training and uploading of the client's personalized model and the aggregation of the global model, the advantages of personalized and global models are complementary, and the accuracy of prediction is improved. The spatial dependency of the road network is captured using a graph convolutional network layer, and the relationship in the time series is captured using a temporal attention mechanism, which helps the model to understand the traffic state more comprehensively. The use of the spatiotemporal vector product layer provides a new perspective for estimating travel time, combines spatial and temporal information, and improves the prediction accuracy of the model. Through the federated learning method, the model can learn from multiple data sources, thereby improving the generalization ability of the model in different traffic environments and scenarios. The cloud server securely aggregates the uploaded model weights, which not only improves the accuracy and robustness of the overall prediction, but also provides the client with the latest traffic information by updating the global traffic state. The framework supports the inference and update of real-time traffic status, making the prediction results closer to the actual traffic conditions and providing real-time decision support for drivers and city managers. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a schematic diagram of the structure of a traffic prediction system in an embodiment of the present invention; Figure 2 yes Figure 1 A functional structure diagram of a client implementation example shown; Figure 3 yes Figure 1 A schematic diagram of the functional structure of an embodiment of the central server shown; Figure 4 is a flow chart of a traffic prediction method in an embodiment of the present invention; Figure 5 yes Figure 4 The schematic diagram of the method flow for implementing step S20 shown in the figure; Figure 6 yes Figure 5 The schematic diagram of the method flow for implementing step S202 shown in FIG. Figure 7 yes Figure 4 The schematic diagram of the method flow for implementing step S21 shown in the figure; Figure 8 yes Figure 7 The schematic diagram of the method flow for implementing step S212 shown in FIG. Fig. 9 yes Figure 4 The schematic diagram of the method flow for implementing step S22 shown in the figure; Fig.10 yes Figure 4 The schematic diagram of the method flow for implementing step S23 shown in the figure; Fig.11 It is a schematic diagram of the hardware structure of an electronic device in an embodiment of the present invention.
[0020] The reference numerals in the above drawings are described as follows: 10. Traffic prediction system; 11. Client; 110. Network feature extraction and integration module; 111. Personalized model training module; 112. Differential privacy application module; 113. Learning collaboration module; 114. Model interaction module; 12. Central server; 120. Spatial feature extraction module; 121. Graph convolutional network application module; 122. Spatiotemporal feature integration module; 123. Localized global model prediction module; 124. Spatiotemporal tensor decomposition module; 125. Global model training module; 126. Federated learning collaboration module; 13. Database; 3. Electronic device; 31. Processor; 32. Input device; 33. Output device; 34. Memory; DETAILED DESCRIPTION
[0021] In order to explain in detail the possible application scenarios, technical principles, specific schemes that can be implemented, and the purposes and effects that can be achieved, the following is a detailed description of the specific embodiments listed in conjunction with the accompanying drawings. The embodiments described herein are only used to more clearly illustrate the technical solutions of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0022] Reference to "embodiment" herein means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The term "embodiment" appearing in various places in the specification does not necessarily refer to the same embodiment, nor does it particularly limit its independence or association with other embodiments. In principle, in the present application, as long as there is no technical contradiction or conflict, the various technical features mentioned in the embodiments can be combined in any way to form a corresponding implementable technical solution.
[0023] Unless otherwise defined, the technical terms used in this document have the same meanings as those generally understood by those skilled in the art to which this application belongs; the use of relevant terms in this document is only for describing specific embodiments and is not intended to limit this application.
[0024] In the description of this application, the term "and / or" is an expression used to describe the logical relationship between objects, indicating that three relationships may exist, for example, A and / or B, which means: A exists, B exists, and A and B exist at the same time. In addition, the character " / " in this article generally indicates that the objects before and after are in an "or" logical relationship.
[0025] In the present application, terms such as “first” and “second” are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship of quantity, priority or sequence between these entities or operations.
[0026] Without further limitations, in this application, the words "include", "comprises", "has" or other similar open-ended expressions used in sentences are intended to cover non-exclusive inclusion. These expressions do not exclude the presence of additional elements in the process, method or product including the elements, so that the process, method or product including a series of elements may include not only those limited elements, but also other elements not explicitly listed, or also include elements inherent to such process, method or product.
[0027] Similar to the understanding in the Examination Guidelines, in this application, expressions such as "greater than", "less than", "exceed" and the like are understood to exclude the number itself; expressions such as "above", "below", "within" and the like are understood to include the number itself. In addition, in the description of the embodiments of this application, "multiple" means more than two (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups", "multiple times", etc., unless otherwise clearly and specifically limited.
[0028] In the description of the embodiments of the present application, space-related expressions used, such as "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "vertical", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicate the orientation or position relationship based on the orientation or position relationship shown in the specific embodiments or drawings, and are only for the convenience of describing the specific embodiments of the present application or facilitating the reader's understanding, and do not indicate or imply that the referred device or component must have a specific position, a specific orientation, or be constructed or operated in a specific orientation, and therefore cannot be understood as a limitation on the embodiments of the present application.
[0029] Driving time prediction technology plays an important role in traffic flow prediction, location recommendation and smart city construction. Specifically, driving time prediction technology predicts the user's driving time based on the user's running trajectory and geographic location information. By analyzing and mining trajectory data, the driving time is estimated. On the one hand, it plays an important role in traffic flow prediction and location recommendation; on the other hand, the prediction results provide scientific reference for city managers in smart city construction. At the same time, in order to accurately predict the user's driving time without compromising the user's privacy, driving time prediction technology that ensures information security has become an important research topic.
[0030] Currently, the existing travel time estimation methods can be divided into four categories: segment-based methods, path-based methods, deep learning-based methods and GNN-based methods.
[0031] (1) Segment-based methods: Use speed data sampled from the loop detector to independently infer the travel time of each segment. This method is simple and direct, but it ignores the correlation between segments, such as traffic lights and turning factors, which may lead to inaccurate predictions.
[0032] (2) Path-based methods: generally include nearest neighbor search and trajectory regression methods. The nearest neighbor search estimates the travel time by averaging the travel time of historical trajectories; the trajectory regression method uses common features such as road type, lane, length, etc. to predict the travel time of a road segment. Although this method takes into account the correlation between road segments, it may be limited by the quality and quantity of historical data, as well as its adaptability to dynamic traffic conditions.
[0033] (3) Deep learning-based methods: Capture spatial features through an end-to-end framework to directly predict the travel time of the entire path. Alternatively, a deep generative model can be designed to learn the travel time distribution using grid-based traffic conditions and basic road network features. However, this method requires a large amount of labeled data for training, and the model may be too complex to be interpreted and maintained. There may also be overfitting problems, especially when the amount of data is insufficient.
[0034] (4) GNN-based method: By integrating traffic and context information, a graph attention mechanism is used to capture spatiotemporal features. A multi-layer spatiotemporal graph framework can also be designed, including static networks and dynamic networks, to model basic road attributes and historical traffic characteristics respectively. However, this method may require complex graph structures and feature engineering for processing large-scale graph data, which increases the difficulty of model design and may have efficiency issues.
[0035] Based on the above-mentioned existing technologies and their technical defects, how to ensure that user privacy is not violated while predicting travel time under the existing technologies is an urgent problem to be solved, and inventors are required to develop technologies that can protect user privacy and provide accurate predictions; during the prediction process, it is necessary to ensure the security of information and avoid the leakage of sensitive data, which requires the prediction technology to have a high level of information security protection capabilities; some models trained based on specific data sets may have insufficient generalization capabilities in new or different traffic environments, and the adaptability and robustness of the models need to be further improved.
[0036] The present invention provides a travel time prediction method based on generative adversarial networks and online federated learning. By using the federated learning method to collect multi-source traffic data and maintain the privacy of the data on the client, the problem of data privacy leakage in the prior art is solved, and the data security and privacy protection effect is achieved at the same time. By designing a global online generative model and continuously updating it using an online learning method, the problem of insufficient adaptability to dynamic traffic environments in the prior art is solved, and the accurate inference effect of real-time road traffic status is achieved. By integrating model updates of different nodes on a central server, the accuracy and robustness of the overall prediction are improved, and the problem of limited prediction accuracy in the prior art is solved. By customizing a personalized model for the user to compensate for the residual of the global model prediction, the adaptation to personal driving habits is achieved, and the problem of insufficient personalized prediction in the prior art is solved. By using the differential privacy mechanism, the data privacy security in the processing process is further ensured, and the privacy risk problem that may be caused by data processing in the prior art is solved. Combining the above measures, the present invention improves the accuracy of travel time estimation without leaking user privacy, and can adapt to real-time changing traffic conditions, achieving efficient, safe and accurate travel time prediction effects.
[0037] See also Figure 1 , is a schematic diagram of a traffic prediction system in an embodiment of the present invention. The traffic detection system 10 includes: a plurality of clients 11, a central server 12 and a database 13. The clients 11, the central server 12 and the database 13 establish a communication connection.
[0038] The client 11 is used to train a personalized model using local individual trajectories, construct noise data through differential privacy, and upload the personalized model with added noise to the central server 12. The client 11 is a local device of the user, such as a smart phone, a car system or other navigation device, which is used to collect individual trajectory data and perform personalized model training.
[0039] The central server 12 is the central node in the federated learning architecture, which is used to receive the model weights uploaded by the client 11, perform model aggregation operations, update the global traffic state prediction model, and send the updated model or weights back to the client 11 when necessary.
[0040] The database 13 is used to store data, which is used to train and optimize the model. Specifically, the data stored in the database 13 includes: (1) Data from the client 11, such as a smart phone, an in-vehicle information system, etc. These devices collect the user's driving data, such as GPS trajectory, speed, acceleration, etc.
[0041] (2) Data from sensor networks: sensors deployed on roads or in transportation infrastructure that collect data such as traffic flow, vehicle counts, and traffic conditions.
[0042] (3) Data from traffic management departments, which provide official traffic data, such as accident reports, construction information, or traffic signal data.
[0043] (4) Data from third-party services, such as map service providers or navigation applications, which collect information on users’ travel patterns and traffic conditions.
[0044] (5) Data from social media and mobile applications, where users share posts or updates about traffic conditions, can serve as a supplementary source of traffic data.
[0045] Please also see Figure 2 The client 11 includes a network feature extraction and integration module 110, a personalized model training module 111, a differential privacy application module 112, a learning collaboration module 113 and a model interaction module 114.
[0046] The network feature extraction and integration module 110 is used to collect the trajectory data and vehicle status information of the user during driving from the database 13 to obtain the individual trajectory, and extract the traffic network features from the individual trajectory.
[0047] The individual trajectory is data generated by the client during driving, and may include information such as the user's driving route, speed, and time.
[0048] In this embodiment, the traffic network features include road network features and routing features. The network feature extraction and integration module 110 is used to extract road network features from the database 13 and extract routing-related features from the road network features to obtain the traffic network features.
[0049] Road network features refer to the attributes of nodes and road segments in the road network, which can affect travel time, including but not limited to road type, speed limit, whether there are traffic lights, road length, number of lanes, etc. Specifically, a road network is a traffic network composed of multiple road segments and nodes, which can be regarded as a directed graph, as shown in formula (1): (1) in, V is a set of nodes, representing intersections or junctions; It is a combination of directed edges or road segments, representing road connections (i.e. road segments); π is a characteristic function that can be applied to , can also be applied to ; Representation Node v characteristics, such as speed limit, presence of traffic lights, etc. surface Edge e characteristics, such as road type, road length, number of road lanes, etc.
[0050] In this embodiment, the network feature extraction and integration module 110 is used to extract road network features from the OpenStreetMap database and perform file feature configuration, which can provide rich input data for the model and help the model better learn and predict travel time.
[0051] Specifically, the network feature extraction and integration module 110 can extract road network features from highway labels in the OpenStreetMap database, such as: (1) Road type: expressway, trunk road, branch road, etc.; (2) Special types: whether it is a bridge, tunnel, pedestrian walkway, etc.; (3) Other characteristics: speed limit, road length, road width, number of lanes, etc.
[0052] The network feature extraction and integration module 110 can also extract the labels and types of nodes from the OpenStreetMap database, such as: (1) Node labels: such as speed cameras, traffic signals, intersection signs, turns, bus stops, etc. (2) Contact type: x type, t type, 5-way intersection, etc.; (3) Other features extracted by the network feature extraction and integration module 110: such as a unique ID and GPS coordinates.
[0053] For the above dense features (numerical data) and sparse features (such as categorical data), linear transformation and embedding techniques are applied respectively, in order to convert the original features into a format that is easy for the model to process while retaining the important information of the features.
[0054] A route is a specific path from one location to another in a road network, usually consisting of links (road segments) and nodes (intersections) at a specific time step. The following alternate sequence; routing r i It can be represented as a road segment e 1~ e _|ri| and nodes alternately, that is .
[0055] The personalized model training module 111 is used to: Using the traffic network features extracted by the network feature extraction and integration module 110 to construct a personalized model; training the personalized model using the individual trajectories; Generate individual travel time residuals based on the trained personalized model; and The individual travel time residuals are used to optimize model parameters to generate a personalized model with optimized model parameters.
[0056] On the client 11, the personalized model training module 111 uses the individual trajectory and combines the road network characteristics and routing characteristics to train the personalized model. The individual trajectory data is combined with these road network characteristics to provide more accurate travel time predictions; for example, if a certain road section is frequently used in the individual trajectory, and the road section has specific road network characteristics, such as speed limits or traffic signals, this information will be used for personalized model training to improve the accuracy of the prediction; the routing information is used to capture the user's specific driving habits and preferences, route selection, speed preferences, etc., to build a model that can reflect the user's personalized needs, which helps the model to more accurately predict the travel time of individual users.
[0057] The personalized module training module 111 is also used to generate individual driving time residuals through a fully connected layer based on the trained model to quantify the difference between the model predicted time and the actual driving time.
[0058] Furthermore, the personalized module training module 111 generates individual travel time residuals based on the trained personalized model, specifically including: Extracting profile features from the road network features and individual trajectories; wherein the profile features are specific attributes related to the individual driving path (trajectory), which may include driving speed, acceleration, driving direction, road section length, etc.; Embed the extracted contour features into the personalized model and convert them into numerical vectors that can be processed by the personalized model; Processing the embedded contour features using a hidden layer of a neural network to generate a hidden state; and The hidden state is processed using a fully connected layer (also called a dense layer) and the calculation described in formula (2) is performed to obtain the individual travel time residual.
[0059] (2) In formula (2), represents the hidden state of the individual features after being processed by the lth layer of the model, and are the weight parameters and bias parameters of the fully connected layer in the lth layer.
[0060] The hidden state is a set of feature representations obtained after the contour features are processed by the hidden layer, which captures important information of the input data and provides useful abstraction for the learning task.
[0061] The individual travel time residual is part of the personalized model, which represents the model's adjustment to individual driving habits. By minimizing this residual, the model can learn the driving pattern of a specific user or vehicle. In this way, the individual travel time residual is the part of the travel time prediction that uses the personalized model to adjust the non-personalized or global model prediction results. This personalized adjustment is achieved through the federated learning framework, while ensuring the privacy of the data and the global consistency of the model. The personalized model makes up for the residual between the non-personalized model and the true value, and improves the accuracy of the prediction by adjusting the residual.
[0062] Furthermore, the personalized model training module 111 uses the individual travel time residual to optimize model parameters to generate a personalized model with optimized model parameters, specifically including: defining a residual error according to the individual actual travel time, the travel time predicted by the personalized model, and the individual travel time residual; and The SGD (stochastic gradient descent) algorithm is used to optimize the model parameters according to the gradient information of the residual error to generate a personalized model after the model parameters are optimized.
[0063] Specifically, the residual error is as described in formula (3): (3) in, θ p represents the parameters of the personalized model initially set, represents the actual driving time of the individual, represents the travel time predicted by the personalized model, represents the individual travel time residual, represents the residual error.
[0064] It represents the square of the difference between the actual driving time and the model predicted driving time, which is a measure of the error of a single sample. The modified formula is represents the square of the difference between the actual travel time and the predicted travel time adjusted for the residual, taking into account the personalized adjustment, where is the prediction of the global model; the loss function is the sum of the residual squares of all samples, which is used to quantify the size of the model prediction error on the entire dataset. During the training process, the goal is to adjust θ p To minimize , so that the model's prediction Closer to actual driving time The final output model of the algorithm is , which is the prediction of the global model plus the personalized residual adjustment. In this way, the personalized model can learn the unique driving pattern of each user and provide more accurate travel time prediction.
[0065] The differential privacy application module 112 is used to add privacy protection noise data to the model parameters of the personalized model to generate model parameters with added privacy protection noise.
[0066] In this implementation, the differential privacy application module 112 uses the Laplace mechanism to add noise to each model weight to obtain corresponding model parameters.
[0067] Specifically, differential privacy is a randomization technique that protects data privacy. It consists of a randomization mechanism: Definition; where D is the input domain, R is the output range, and the randomization mechanism satisfies Differential privacy standards.
[0068] The differential privacy criterion is as follows: if for any two adjacent inputs and any subset of the output , then the randomization mechanism M The following conditions are met, as described in formula (4): (4) Pr In the randomization mechanism Next, the probability of the event occurring; and are two non-negative parameters that control the strictness of privacy protection and the randomness of the algorithm. , then the mechanism yes Differentially private. The smaller the value, the stricter the privacy protection, but at the same time the practicality of some data may be sacrificed. The smaller the value of, the less random the algorithm is, but more noise may be needed to meet the requirements of differential privacy.
[0069] In this way, the differential privacy application module 112 provides a privacy protection layer for personalized model training, making data sharing in the federated learning process both secure and in compliance with privacy protection requirements. In this way, noise data is constructed based on the Laplace mechanism of differential privacy. By adding noise, even if an attacker has access to the uploaded model weights, it is impossible to determine whether specific input data has an impact on model training because the noise masks the original characteristics of the data.
[0070] The learning collaboration module 113 is used to upload the personalized model and the model parameters generated by the differential privacy application module 112 to the central server 12 .
[0071] Personalized model training is performed locally on the client 11, and a personalized travel time prediction model is trained using the individual's trajectory data. This process takes into account the individual's driving habits and trajectory characteristics, thereby generating a prediction model that is more in line with individual behavior. In order to protect user privacy, differential privacy technology is used to add noise to the model weights before uploading the personalized model. In this way, even if the model weights are made public, the original data cannot be inferred from the model weights.
[0072] The client 11 can also receive the global model or update integrated by the central server 12 through the learning collaboration module 113, and further train and optimize the personalized model based on the global information. The principle of the central server 12 integrating the global model or update will be described in detail below.
[0073] The central server 12 is used to securely aggregate the personalized model and model parameters uploaded by the client 11 to form a global model, integrate spatial and temporal features to aggregate and update the global model, maintain the global traffic state prediction model, and distribute the updated model back to the client 11 for model iteration and update. The specific working principle is described in detail below.
[0074] Please also see Figure 3The central server 12 includes a spatial feature extraction module 120, a graph convolutional network application module 121, a spatiotemporal feature integration module 122, a localized global model prediction module 123, a spatiotemporal tensor decomposition module 124 and a global model training module 125.
[0075] The spatial feature extraction module 120 is used to receive the individual trajectory data uploaded by the client 11 and extract spatial features related to the road network from the individual trajectory data.
[0076] Among them, the road network spatial characteristics are common characteristics of the road network; the road network includes road sections (links) and road intersections (nodes), such as road type, length, number of lanes, etc.
[0077] The graph convolutional network application module 121 is used to use a graph convolutional network (GCN) to process and extract the spatial features of the road network extracted by the spatial feature extraction module 120, and embed the spatial features of the road network into a global model to capture the spatial dependencies of the road network.
[0078] Specifically, the graph convolution network processing module 121 is used to define the graph signal through formula (5) to provide a feature vector for each node or link in the graph convolution network, to perform the graph convolution operation through formula (6) to process the spatial characteristics of the traffic network, aggregate neighbor node information, introduce nonlinear characteristics, and update the global model to accurately reflect the structure and dynamic characteristics of the road network.
[0079] (5) In formula (5), h (l) represents the hidden state of the lth layer of the graph convolutional network, that is, the feature representation after processing by the lth layer; N represents the number of samples, that is, the total number of nodes or links in the graph, Represents the feature dimension of the lth layer, that is, the dimension of the feature vector of each node or link in the lth layer.
[0080] (6) Formula (6) describes the operation of the C-hop graph convolution layer. In formula (6), Represents graph convolution operation, G represents graph; L c Representing the Laplacian matrix of a graph c The power is used to capture the adjacency relationship between nodes; Represents the hidden state of the lth layer of the graph convolutional network, which is output from the road attribute embedding layer and can be the feature representation of the road segment or node; Indicates cjump and the weight parameter of the lth layer, represents the weight matrix of the lth layer, is a nonlinear activation function, such as ReLU , used to introduce nonlinear characteristics; Represents the weight parameter set of the lth layer, including weight parameters of different hop numbers (c hops).
[0081] The spatiotemporal feature integration module 122 is used to combine the spatial features and temporal information of the road network generated by the graph convolutional network application module 121 through a graph convolutional network and a temporal attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embed the processed spatiotemporal features into the global model, and update the global model to reflect the latest traffic conditions.
[0082] The time information is time-related data used to capture changes in traffic patterns at different times of the day or week. This typically includes the number of hours in a day, whether it is a peak hour, the day of the week, etc. Time information is typically represented using a technique called one-hot encoding, which converts the time variable into a numerical form so that the model can process it. This information may come from historical traffic datasets, or be generated by the client 11 device when recording individual trajectories and uploaded to the central server 12.
[0083] The spatiotemporal feature integration module 122 is specifically used for: Receiving spatial feature data from the client 11 and acquiring time information; The spatial features are processed using a graph convolutional network to generate the hidden state of each road segment and node. h (l+1) ; wherein the graph convolutional network processing is performed by formula (5) as described above, h (l+1) It means that after being processed by the GCN layer, the hidden state of the l+1th layer is obtained; Encode temporal information into temporal embedding vectors ;in, K represents the number of time intervals in a day, I represents the latitude of the time embedding vector; Combine the hidden states and temporal embeddings generated by graph convolutional networks, and use fully connected layers to generate initial prediction features for links and nodes; Apply the temporal attention mechanism to adjust the impact of different time steps on traffic status; Applying the spatiotemporal vector product processing to the links and nodes respectively through formulas (7) and (8) to generate the corresponding traffic state prediction; and The calculated spatiotemporal features are embedded into the global model, and the global model is updated to reflect the latest traffic status.
[0084] (7) (8) in, Indicates that at a specific time step Downlink traffic status prediction (such as flow, speed, etc.); Indicates that at a specific time step Traffic status prediction of the next node (such as vehicle queue length, waiting time, etc.); represents the weight matrix for links and nodes in the spatiotemporal vector product layer; represents the weight matrix for nodes in the spatiotemporal vector product layer; It represents the hidden state of the link at layer l+1 after being processed by the graph convolutional network; It represents the hidden state of the node at the l+1 layer after being processed by the graph convolutional network; represents the bias term of the link; represents the bias term of the node, | E | and | V | represents the number of edges and nodes respectively; represents the Hadamard product, which is element-wise multiplication; represents the temporal attention mechanism, which is used to adjust the impact of different time steps on traffic status; Represents the time embedding vector at time step The value below; I represents the size of the time embedding vector, that is, the dimension of the time feature; and Respectively represent the time step The current traffic status of the downlink and node. The fully connected layer is and Build.
[0085] The temporal attention mechanism is processed by the temporal attention vector Realized, specifically through softmax Calculated by the function, indicating the time point The attention weight.
[0086] As described above, an embodiment of the present invention provides a traffic prediction system, in which the client is mainly responsible for data collection and preliminary training of personalized models, while the server is responsible for model aggregation and generation of global states, and the two work together to improve the accuracy of travel time prediction. Specifically, the client collects the driving trajectory data of individual users, which will be used to train a non-personalized travel time prediction model. The server uses a spatiotemporal vector product layer to generate a global state, which involves generating an estimated travel time based on a traffic network composed of road sections and intersections. The client uses its own trajectory data to train the basic model to generate a localized global model, which can provide non-personalized travel time predictions for individual users. The client uploads the trained localized global model to the cloud server. These models will include parameters and predictions obtained based on individual data training. The server receives models from each client and uses a federated learning strategy (such as FedAvg) to aggregate the models to form a global model. This global model integrates the data and experience of all clients and can provide more accurate travel time predictions.
[0087] The localized global model prediction module 123 is used to analyze and process the spatiotemporal features according to the individual trajectory data and the traffic status reflected by the global model generated by the spatiotemporal feature integration module 122, and generate an estimated travel time for a specific route and time step.
[0088] Specifically, the localized global model prediction module 123 uses formula (9) to calculate the estimated travel time on route r.
[0089] (9) Formula (9) is the estimated travel time of all road segments in route r and the estimated states of all nodes Add together to get the total estimated travel time for the entire route In formula (9), y represents the estimated travel time, represents the estimated or predicted value of the travel time, |r| represents the total number of road segments and intersections in route r, and Y represents the estimated state or time of a road segment or intersection. represents the i-th road segment, represents the jth intersection, Indicates the time step (which may be a specific period of time or a point in time).
[0090] In this embodiment, the localized global model prediction module 123 uses formula (9) to dynamically calculate the status of road sections and intersections based on data collected from the traffic network. YIt may be derived from historical data, real-time data or the output of other traffic models. In this way, it can provide drivers or traffic management systems with travel time estimates based on current traffic conditions.
[0091] The localized global model prediction module 123 achieves accurate prediction of driving time through the specific implementation method described above, while taking into account the global traffic conditions and the driving characteristics of individual users.
[0092] The spatiotemporal tensor decomposition module 124 is used to receive the personalized model and global traffic data uploaded by the client 11, and perform spatiotemporal feature decomposition processing to generate traffic state estimates for each time period that conform to the road network structure.
[0093] Among them, the global traffic data includes: the estimated travel time based on individual trajectory data and global traffic status output by the localized global model prediction module 123; the spatiotemporal features generated by the spatiotemporal feature integration module 122; and may also include real-time traffic information from other sensors, traffic monitoring systems or third-party traffic data providers.
[0094] Specifically, the spatiotemporal tensor decomposition module 124 receives the personalized model and global traffic data, divides a day into different parts, and applies spatiotemporal tensor decomposition in each part to process traffic state prediction, generating decomposed spatiotemporal features for generating an estimate of the global traffic state.
[0095] During off-peak hours, relatively stable traffic conditions are used for tensor decomposition, and the time of the day is divided into five time periods with different traffic characteristics, namely: 1. Midnight (0:00-7:00); 2. Morning peak period (7:00-9:00); 3. Off-peak period (9:00-17:00); 4. Evening peak period (17:00-19:00); 5. Night (19:00-24:00) to avoid the high computational and communication costs of the online aggregation process. The traffic conditions in each time period are relatively stable, which helps model learning and prediction. This division is based on the daily patterns of traffic flow, such as peak and off-peak periods. The spatiotemporal tensor decomposition module 124 converts the output of the global model into and Decomposition is performed to obtain complete road conditions that conform to the road network structure and generate estimates of the road network traffic status for each period, which reflect the traffic flow and patterns in different time periods. Tensor decomposition helps reduce the computational and communication costs during online aggregation while maintaining accurate estimates of traffic status.
[0096] The global model training module 125 is used to learn and optimize the non-personalized global traffic state according to the personalized model parameters uploaded by the client 11, and generate an updated global model for federated learning aggregation and further personalized model training.
[0097] Furthermore, the global model training module 125 is specifically used for: According to the personalized model parameters uploaded by the client 11, the loss function is calculated using formula (10); wherein the personalized model parameters include the personalized model update uploaded by the client, the client m Actual driving time data , client-side model estimated travel time , the number of trajectory samples of the client n m ; In formula (10), represents the trainable model parameters of the global model, represents the loss function of the global model, which is used to measure the difference between the model prediction and the actual travel time; (10) Apply the stochastic gradient descent (SGD) algorithm to the loss function and the current parameters of the global model Optimize to generate updated global model parameters ; Based on the local model of all clients Table and Sample Size n m , use formula (11) to calculate the global model As the weighted average of all clients, to get the updated global model ;in, α represents the learning rate, M is the number of customers selected in round t, n is the total sample size of all customers selected in round t; and (11) The updated global model Aggregate and send to all clients 11, so that the clients 11 can perform the next step of personalized model training.
[0098] The client 11 receives the global model sent by the central server 12, performs personalized model training based on local data, and generates a localized model update. Then, the client 11 uploads the localized model update to the central server 12, and the central server 12 receives the localized model update and performs repeated training and aggregation as described above to output a continuously optimized global model. In this way, the client 11 and the central server 12 work together to perform cyclic training and optimization of the personalized model.
[0099] The central server 12 also includes a federated learning collaborative module 126, which is used to execute a federated learning algorithm to perform weighted averaging and secure aggregation of the model based on the localized global model weights uploaded by the client 11, update the global traffic status, and send the aggregated global model weights back to the client 11, so that the client 11 can further train and optimize its personalized model, thereby achieving collaborative optimization and knowledge sharing of global and local models.
[0100] Furthermore, the federated learning collaboration module 126 is specifically used for: Initialize the global model ;in, Indicates t The global model of the wheel,
[0101] Based on round number t In each round of t Select M clients to form a random set I t , the current round number is calculated by formula (12) t The global model Send to Collection I t Each client in m To carry out the first layer of circulation.
[0102] (12) The personalized model training module 111 of the client 11 is also used to receive the global model sent by the federated learning collaboration module 126. , using the local data set through formulas (13) and (14) , based on the SGD algorithm and the local dataset Train the model to generate an updated localized global model f m Perform the second cycle.
[0103] (13) (14) Among them, ClientUpdate() means using the loss function through gradient descent For local models f m Carry out optimization updates, α is the basic model learning rate. f m Indicates m A local model on the client; Represents the gradient operator, which is used to calculate the loss function L with respect to the model parameters θ b The gradient of Represents the loss function, which is used to measure the model f In the m Client datasets The difference between the predicted and actual values.
[0104] The personalized model training module 111 of the client 11 is further used for: The updated localized global model f m Add Laplace noise using equation (15) to satisfy Differential privacy, generating privacy-preserving local models f m ;
[0105] (15) The privacy-preserving local model f m Upload to the central server 12.
[0106] The federated learning collaborative module 126 of the central server 12 is further used for: Receive the privacy-protected local model uploaded by the client 11 f m , and calculate the current round number through formula (11) t +1The weighted average of the global models to generate the aggregated global model ;as well as The global model The message is sent to all clients 11.
[0107] As described above, the client 11 and the central server 12 enter the next round of training and repeat the above process. The global model of the central server 12 Become the next round ; and, with t Each round of training is based on the previous round.
[0108] The federated learning collaborative module 126 of the central server 12 performs key steps in the federated learning process, including initializing the global model, selecting the client 11 participating in the federated learning, aggregating the localized model weights uploaded by the client 11, applying differential privacy protection, updating the global traffic status, and sending the aggregated model to the client 11. The client 11 further trains and updates the personalized model based on the received global model to form a closed-loop optimization to ensure the accuracy of the model prediction and the privacy security of the user data. This process reflects the collaborative work between the client 11 and the central server 12, as well as the logical relationship between the global and personalized model training. The client 11 can further train and optimize its personalized model to achieve collaborative optimization and knowledge sharing of the global and local models.
[0109] It should be noted that by using the federated learning method to collect traffic data from multiple clients 11, private data can be stored locally on the client 11 during training to maintain data privacy. In this setting, private data will not be sent to the cloud, but will be processed and trained locally, while ensuring data privacy.
[0110] As described above, the traffic prediction system in the embodiment of the present invention has the following technical effects: using federated learning technology, data is allowed to be trained on local devices without directly exposing the original data, and the differential privacy mechanism is used to ensure the security of user data during model training and updating. The global model is designed as an online generation model, which can be updated in real time to adapt to the dynamic changes of the traffic environment, and improves the model's responsiveness to real-time traffic conditions. Through the training and uploading of the client-side personalized model, combined with the aggregation of the global model, the advantages of personalized and global models are complementary, and the accuracy of prediction is improved. The spatial dependencies of the road network are captured using the graph convolutional network layer, and the relationship in the time series is captured using the time attention mechanism, which helps the model to understand the traffic state more comprehensively. The use of the spatiotemporal vector product layer provides a new perspective for estimating travel time, combines spatial and temporal information, and improves the prediction accuracy of the model. Through the federated learning method, the model can learn from multiple data sources, which improves the generalization ability of the model in different traffic environments and scenarios. The cloud server securely aggregates the uploaded model weights, which not only improves the accuracy and robustness of the overall prediction, but also provides the client with the latest traffic information by updating the global traffic state. The framework supports the inference and update of real-time traffic status, making the prediction results closer to the actual traffic conditions and providing real-time decision support for drivers and city managers.
[0111] See also Figure 4, which is a flow chart of a traffic prediction method in an embodiment of the present invention. The method is applied to a traffic prediction system 10 as described above. The traffic prediction system 10 includes multiple clients 11, a central server 12 and a database 13. The client 11, the central server 12 and the database 13 establish a communication connection. The client 11 is a local device of the user (such as a smart phone), which is used to collect individual trajectory data and train local models. The database 13 is used to store data, which is used to train and optimize the model. The data sources stored in the database 13 include: client 11, sensor network, traffic management department, third-party service, social media and mobile application.
[0112] The method comprises: In step S20, the client 11 collects the trajectory data and vehicle status information of the user during driving from the database 13 to obtain the individual trajectory, and builds and trains a personalized model based on the individual trajectory; and adds differential privacy to the model parameters of the personalized model to build noise data, and uploads the model parameters with added noise data to the central server 12 as localized global model weights.
[0113] In step S21, the central server 12 extracts spatial features related to the road network from the individual trajectory data, uses a graph convolutional network (GCN) to process and extract the spatial features of the road network, and embeds the spatial features of the road network into a global model to capture the spatial dependencies of the road network. Based on the spatial features and temporal information of the road network, the spatial features are combined with the temporal information through a graph convolutional network and a temporal attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embed the processed spatiotemporal features into the global model, and update the global model to reflect the latest traffic conditions.
[0114] In step S22, the central server 12 analyzes and processes the spatiotemporal characteristics according to the traffic status reflected by the individual trajectory data and the global model to generate an estimated travel time for a specific route and time step; and decomposes and processes the spatiotemporal characteristics according to the personalized models uploaded by all clients 11 and the global traffic data to generate traffic status estimates for each time period that conform to the road network structure.
[0115] In step S23, the central server 12 executes a federated learning algorithm to perform weighted averaging and security aggregation of the model according to the localized global model weights uploaded by the client 11, updates the global traffic status, and sends the aggregated global model weights back to the client 11, so that the client 11 trains and optimizes the personalized model based on the aggregated global model weights.
[0116] Please also see Figure 5 , step S20, that is, the client 11 collects the trajectory data and vehicle status information of the user during driving from the database 13 to obtain the individual trajectory, builds and trains the personalized model based on the individual trajectory; and adds differential privacy to the model parameters of the personalized model to build noise data, and uploads the model parameters with added noise data to the central server 12 as localized global model weights, specifically including: In step S200 , the client 11 collects the trajectory data and vehicle status information of the user during driving from the database 13 to obtain the individual trajectory, and extracts the traffic network features from the individual trajectory.
[0117] In this embodiment, the traffic network characteristics include road network characteristics and routing characteristics.
[0118] Specifically, the road network is a traffic network directed graph consisting of multiple road segments and nodes, as shown in formula (1): (1) in, V is a set of nodes, representing intersections or junctions; It is a combination of directed edges or road segments, representing road connections (i.e. road segments); π is a characteristic function that can be applied to , can also be applied to ; Representation Node v characteristics, such as speed limit, presence of traffic lights, etc. surface Edge e characteristics, such as road type, road length, number of road lanes, etc.
[0119] The client 11 extracts road network features from the road labels in the OpenStreetMap database, such as: (1) Road type: expressway, trunk road, branch road, etc.; (2) Special types: whether it is a bridge, tunnel, pedestrian walkway, etc.; (3) Other characteristics: speed limit, road length, road width, number of lanes, etc.
[0120] The client 11 may also extract the label and type of the node from the OpenStreetMap database, such as: (1) Node labels: such as speed cameras, traffic signals, intersection signs, turns, bus stops, etc. (2) Contact type: x type, t type, 5-way intersection, etc.; (3) Other features extracted by the client 11: such as a unique ID and GPS coordinates.
[0121] A route is a specific path from one location to another in a road network, usually consisting of links (road segments) and nodes (intersections) at a specific time step. The following alternate sequence; routing r i It can be represented as a road segment e 1~ e _|ri| and nodes alternately, that is .
[0122] Step S201: the client 11 constructs a personalized model using the extracted traffic network features, and trains the personalized model using the individual trajectory.
[0123] Step S202: The client 11 generates individual travel time residuals based on the trained personalized model, and uses the individual travel time residuals to optimize model parameters to generate a personalized model with optimized model parameters.
[0124] Please also see Figure 6 , “the client 11 generates individual travel time residuals based on the trained personalized model” specifically includes: Step S2020, extracting profile features from the road network features and the individual trajectories; wherein the profile features are specific attributes related to the individual driving path (trajectory), which may include driving speed, acceleration, driving direction, road section length, etc.; Step S2021, embedding the extracted contour features into the personalized model and converting them into numerical vectors that can be processed by the personalized model; Step S2022, using the hidden layer of the neural network to process the embedded contour features to generate a hidden state.
[0125] Step S2023, using a fully connected layer (also called a dense layer) to process the hidden state, and performing the calculation described in formula (2) to obtain the individual travel time residual.
[0126] (2) In formula (2), represents the hidden state of the individual features after being processed by the lth layer of the model, and are the weight parameters and bias parameters of the fully connected layer in the lth layer.
[0127] Please refer again Figure 6, “Using the individual travel time residual to optimize the model parameters to generate a personalized model with optimized model parameters”, specifically includes: Step S2024, defining a residual error according to the individual actual driving time, the driving time predicted by the personalized model, and the individual driving time residual.
[0128] Step S2025, using the SGD (stochastic gradient descent) algorithm to optimize the model parameters according to the gradient information of the residual error to generate a personalized model after the model parameters are optimized.
[0129] Specifically, the residual error is as described in formula (3): (3) in, θ p represents the parameters of the personalized model initially set, represents the actual driving time of the individual, represents the travel time predicted by the personalized model, represents the individual travel time residual, Residual error ; represents the square of the difference between the actual driving time and the model predicted driving time; the modified formula represents the square of the difference between the actual travel time and the predicted travel time adjusted by the residual; is the prediction of the global model.
[0130] In step S203, the client 11 adds differential privacy construction noise data to the model parameters of the personalized model to generate model parameters with added noise data, and uploads the model parameters with added noise data to the central server 12 as localized global model weights.
[0131] In this embodiment, the client 11 uses the Laplace mechanism to add noise data to each model weight to obtain corresponding model parameters.
[0132] Specifically, differential privacy consists of a randomization mechanism: Definition; where D is the input domain, R is the output range, and the randomization mechanism satisfies Differential privacy standards.
[0133] The differential privacy criterion is as follows: if for any two adjacent inputs and any subset of the output , then the randomization mechanism M The following conditions are met, as described in formula (4): (4) Pr In the randomization mechanism Next, the probability of the event occurring; and are two non-negative parameters that control the strictness of privacy protection and the randomness of the algorithm. , then the mechanism yes Differentially private. The smaller the value, the stricter the privacy protection, but at the same time the practicality of some data may be sacrificed. The smaller the value of, the less random the algorithm is, but more noise may be needed to meet the requirements of differential privacy.
[0134] As described in steps S200 to S203, local training of the personalized model uses individual trajectory data locally on the client 11 to train a personalized driving time prediction model. This process takes into account the individual's driving habits and trajectory characteristics, thereby generating a prediction model that is more in line with individual behavior. In order to protect user privacy, differential privacy technology is used to add noise to the model weights before uploading the personalized model. In this way, even if the model weights are made public, the original data cannot be inferred from the model weights, while ensuring the privacy of the data. Under this setting, private data will not be sent to the cloud, but will be processed and trained locally. The personalized model weights obtained by local training of each client 11 are uploaded to the central server 10 after adding noise constructed by differential privacy. The central server 10 aggregates these weights to form a global model, while ensuring the privacy and security of the data.
[0135] Please also see Figure 7 , step S21, that is, the central server 12 extracts spatial features related to the road network from the individual trajectory data, uses a graph convolutional network (GCN) to process and extract the spatial features of the road network, and embeds the spatial features of the road network into a global model to capture the spatial dependencies of the road network, and according to the spatial features and time information of the road network, combines the spatial features with the time information through a graph convolutional network and a time attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embeds the processed spatiotemporal features into a global model, and updates the global model to reflect the latest traffic conditions, specifically including: Step S210 : the central server 12 receives the individual trajectory data uploaded by the client, and extracts spatial features related to the road network from the individual trajectory data.
[0136] Among them, the road network spatial characteristics are common characteristics of the road network; the road network includes road sections (links) and road intersections (nodes), such as road type, length, number of lanes, etc.
[0137] In step S211, the central server 12 uses a graph convolutional network (GCN) to process and extract the spatial features of the road network, and embeds the spatial features of the road network into a global model to capture the spatial dependencies of the road network.
[0138] Specifically, the central server 12 defines the graph signal through formula (5) to provide a feature vector for each node or link in the graph convolution network, and performs the graph convolution operation through formula (6) to process the spatial characteristics of the traffic network, aggregate neighbor node information, introduce nonlinear characteristics, and update the global model to accurately reflect the structure and dynamic characteristics of the road network.
[0139] (5) In formula (5), h (l) represents the hidden state of the lth layer of the graph convolutional network, that is, the feature representation after processing by the lth layer; N represents the number of samples, that is, the total number of nodes or links in the graph; Represents the feature dimension of the lth layer, that is, the dimension of the feature vector of each node or link in the lth layer.
[0140] (6) In formula (6), Represents graph convolution operation, G represents graph; L c Representing the Laplacian matrix of a graph c The power is used to capture the adjacency relationship between nodes; Represents the hidden state of the lth layer of the graph convolutional network, which is output from the road attribute embedding layer and can be the feature representation of the road segment or node; Indicates c jump and the weight parameter of the lth layer, represents the weight matrix of the lth layer, is a nonlinear activation function, such as ReLU , used to introduce nonlinear characteristics; Represents the weight parameter set of the lth layer, including weight parameters of different hop numbers (c hops).
[0141] In step S212, the central server 12 combines the spatial features and the temporal information of the road network through a graph convolutional network and a temporal attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embeds the processed spatiotemporal features into the global model, and updates the global model to reflect the latest traffic conditions.
[0142] The time information is time-related data used to capture changes in traffic patterns at different times of the day or week. This typically includes the number of hours in a day, whether it is a peak hour, the day of the week, etc. Time information is typically represented using a technique called one-hot encoding, which converts the time variable into a numerical form so that the model can process it. This information may come from historical traffic datasets, or be generated by the client 11 device when recording individual trajectories and uploaded to the central server 12.
[0143] Please also see Figure 8 Step S212, i.e., the central server 12 combines the spatial features and the temporal information of the road network through a graph convolutional network and a temporal attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embeds the processed spatiotemporal features into a global model, and updates the global model to reflect the latest traffic conditions, specifically including: Step S2120, receiving spatial feature data from the client 11 and acquiring time information; Step S2121, using a graph convolutional network to process the spatial features and generate hidden states for each road segment and node h (l+1) ; wherein the graph convolutional network processing is performed by formula (5) as described above, h (l+1) It means that after being processed by the GCN layer, the hidden state of the l+1th layer is obtained; Step S2122, encoding the time information into a time embedding vector ;in, K represents the number of time intervals in a day, I represents the latitude of the time embedding vector; Step S2123, combining the hidden state and time embedding generated by the graph convolutional network processing, and using the fully connected layer to generate initial prediction features of links and nodes; Step S2124, applying the temporal attention mechanism to adjust the impact of different time steps on the traffic status; Step S2125, applying time-space vector product processing to links and nodes respectively through formulas (7) and (8) to generate corresponding traffic state predictions; and Step S2126, embed the calculated spatiotemporal features into the global model, and update the global model to reflect the latest traffic status.
[0144] (7) (8) in, Indicates that at a specific time step Downlink traffic status prediction (such as flow, speed, etc.); Indicates that at a specific time step Traffic status prediction of the next node (such as vehicle queue length, waiting time, etc.); represents the weight matrix for links and nodes in the spatiotemporal vector product layer; represents the weight matrix for nodes in the spatiotemporal vector product layer; It represents the hidden state of the link at layer l+1 after being processed by the graph convolutional network; It represents the hidden state of the node at the l+1 layer after being processed by the graph convolutional network; represents the bias term of the link; represents the bias term of the node, | E | and | V | represents the number of edges and nodes respectively; represents the Hadamard product, which is element-wise multiplication; represents the temporal attention mechanism, which is used to adjust the impact of different time steps on traffic status; Represents the time embedding vector at time step The value below; I Represents the size of the time embedding vector, that is, the dimension of the time feature; and Respectively represent the time step The current traffic status of the downlink and node. The fully connected layer is and build .
[0145] The temporal attention mechanism is processed by the temporal attention vector Realized, specifically through softmax Calculated by the function, indicating the time point The attention weight.
[0146] In step S22, the central server 12 analyzes and processes the spatiotemporal characteristics according to the traffic status reflected by the individual trajectory data and the global model to generate an estimated travel time for a specific route and time step; decomposes and processes the spatiotemporal characteristics according to the personalized models uploaded by all clients 11 and the global traffic data to generate traffic status estimates for each time period that conforms to the road network structure; and learns and optimizes the non-personalized global traffic status according to the personalized model parameters uploaded by the client 11 to generate an updated global model.
[0147] Specifically, the central server 12 performs temporal and spatial feature analysis based on the individual trajectory data and the traffic status reflected by the global model, and calculates the estimated travel time on route r using formula (9).
[0148] (9) In formula (9), y represents the estimated travel time, represents the estimated or predicted value of the travel time, |r| represents the total number of road segments and intersections in route r, and Y represents the estimated state or time of a road segment or intersection. represents the i-th road segment, represents the jth intersection, Indicates the time step (which may be a specific period of time or a point in time).
[0149] In this embodiment, the localized global model prediction module 123 uses formula (9) to dynamically calculate the status of road sections and intersections based on data collected from the traffic network. Y It may be derived from historical data, real-time data or the output of other traffic models. In this way, it can provide drivers or traffic management systems with travel time estimates based on current traffic conditions.
[0150] The global traffic data includes: estimated travel time based on individual trajectory data and global traffic status; spatiotemporal features generated by the spatiotemporal feature integration module 122; and real-time traffic information from other sensors, traffic monitoring systems or third-party traffic data providers.
[0151] Specifically, the central server 12 receives the personalized model and global traffic data, divides a day into different parts, and applies spatiotemporal tensor decomposition in each part to process traffic state prediction, generating decomposed spatiotemporal features for generating an estimate of the global traffic state.
[0152] Please also see Fig. 9In step S22, "based on the personalized model parameters uploaded by all clients 11, non-personalized global traffic state learning and optimization processing are performed to generate an updated global model", which specifically includes: Step S220, based on the personalized model parameters uploaded by the client 11, the loss function is calculated using formula (10).
[0153] The personalized model parameters include the personalized model update uploaded by the client, m Actual driving time data , client-side model estimated travel time , the number of trajectory samples of the client n m ; In formula (10), represents the trainable model parameters of the global model, represents the loss function of the global model, which is used to measure the difference between the model prediction and the actual travel time; (10) Step S221, applying the stochastic gradient descent (SGD) algorithm to the loss function and the current parameters of the global model Optimize to generate updated global model parameters .
[0154] Step S222: based on the local models of all clients Table and Sample Size n m , use formula (11) to calculate the global model As the weighted average of all clients, to get the updated global model .
[0155] in, α represents the learning rate, M is the number of customers selected in round t, and n is the total sample size of all customers selected in round t.
[0156] (11) Step S223: update the global model Aggregate and send to all clients 11, so that the clients 11 can perform the next step of personalized model training.
[0157] Please also see Fig.10In step S23, the central server 12 executes the federated learning algorithm to perform weighted averaging and security aggregation of the model according to the localized global model weights uploaded by the client 11, updates the global traffic state, and sends the aggregated global model weights back to the client 11, so that the client 11 trains and optimizes the personalized model based on the aggregated global model weights, specifically including: Step S230: the central server 12 initializes the global model ;in, Indicates t The global model of the wheel, ; Step S231, the central server 12 based on the number of rounds t In each round of t Select M clients to form a random set I t , the current round number is calculated by formula (12) t The global model Send to Collection I t Each client in m To carry out the first layer of circulation.
[0158] (12) Step S232: The client 11 receives the global model sent by the central server 12. , using the local data set through formulas (13) and (14) , based on the SGD algorithm and the local dataset Train the model to generate an updated localized global model f m Perform the second cycle.
[0159] (13) (14) Among them, ClientUpdate() means using the loss function through gradient descent For local models f m Carry out optimization updates, α is the basic model learning rate. f m Indicates m A local model on the client; Represents the gradient operator, which is used to calculate the loss function L with respect to the model parameters θ b The gradient of Represents the loss function, which is used to measure the model f In the m Client datasets The difference between the predicted and actual values on ;
[0160] Step S233: the client 11 updates the updated localized global model f m Add Laplace noise using equation (15) to satisfy Differential privacy, generating privacy-preserving local models f m , and the privacy-preserving local model f m Upload to the central server 12.
[0161] (15) Step S234: the central server 12 receives the privacy-preserving local model uploaded by the client 11. f m , and calculate the current round number through formula (11) t +1The weighted average of the global models to generate the aggregated global model , and the global model The message is sent to all clients 11.
[0162] As described above, the client 11 and the central server 12 enter the next round of training and repeat the above process. The global model of the central server 12 Become the next round ; and, with t Each round of training is performed on the basis of the previous round, and the client 11 trains and optimizes the personalized model based on the aggregated global model weights.
[0163] The advantages and beneficial effects of a traffic prediction system 10 have been described above and will not be repeated here. Moreover, since a traffic prediction method is applied to a traffic prediction system, it satisfies the traffic prediction system and has the same advantages and beneficial effects.
[0164] One embodiment of the present invention further provides a readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the steps of any one of the traffic prediction methods described above.
[0165] One embodiment of the present invention also provides an electronic device, including: a processor and a memory, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor executes the computer instructions, the electronic device executes the steps of any one of the traffic prediction methods described above.
[0166] See also Fig.11 , is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention.
[0167] The electronic device 3 includes a processor 31, an input device 32, an output device 33, and a memory 34. The processor 31, the input device 32, the output device 33, and the memory 34 are coupled via a connector, and the connector includes various interfaces, transmission lines, or buses, etc., which are not limited in the embodiments of the present invention. It should be understood that in various embodiments of the present invention, coupling refers to mutual connection in a specific manner, including direct connection or indirect connection through other devices, for example, through various interfaces, transmission lines, buses, etc.
[0168] The processor 31 described in the embodiment of the present application can be implemented by hardware, firmware, software or a combination thereof, and can use a circuit, a single or multiple application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD), a programmable logic device (Programmable Logic Device, PLD), a field programmable gate array (Field Programmable Gate Array, FPGA), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, at least one of a microprocessor, and also includes other physical, biological or chemical structures that can achieve similar or equivalent functions to the processors listed above, such as biological neurons, quantum computing units, DNA computing units, etc., so that the processor can execute some or all of the steps in the computer program or method involved in the various embodiments of the present application, or any combination of the steps mentioned therein. In the electronic device 3 of this embodiment, the processor 31 can be a single processor or a combination of two or more processors in terms of physical entity, such as a combination of a CPU and a GPU, a combination of a CPU and an FPGA, a combination of a CPU and an ASIC, a combination of a CPU and a coprocessor, and a combination of a CPU and a DSP, etc. In the embodiment, these combinations are collectively referred to as processors like a single processor.
[0169] The computer program involved in the embodiment can be stored in a computer device readable storage medium, which includes but is not limited to a disk, a magnetic tape, a magnetic card, a floppy disk, a flash memory, an optical disk, an optical card, a read-only memory (ROM), a random access memory (RAM), an erasable programmable ROM (EPROM) and an electrically erasable programmable ROM (EEPROM), etc., and also includes other biological, physical or chemical structures that can achieve similar or equivalent functions to the storage media listed above, such as DNA, RNA, protein and other units with information storage capabilities. In a specific embodiment, the storage medium involved can be one of the above-mentioned media types, or a combination of the above-mentioned media types. In different embodiments, the computer program involved in the embodiment can be stored in a single medium in a centralized manner, or can be stored in multiple media in a distributed manner.
[0170] The memory 34 containing a computer device readable storage medium may be a non-volatile memory or a random access memory. These computer device readable storage media may be built into the device, or may be connected to the device involved in the embodiment as an external device or part of an external device. In some embodiments, the memory with a computer device readable storage medium is deployed locally; in other embodiments, a scheme of deploying the memory away from the processor may also be adopted, such as a network attached memory accessed via an RF circuit or an external port and a communication network, wherein the communication network may be the Internet, one or more intranets, a local area network (LAN), a wide area network (WLAN), a storage area network (SAN), etc., or a suitable combination thereof, as long as the computer device can access the memory. In addition, the computer program involved in the embodiment may be stored in plaintext / ciphertext form, or may be designed as training data, which may be integrated and reorganized by model training and implicitly stored in the parameter state of a deep neural network or other machine learning model.
[0171] like Fig.11 In the illustrated embodiment, the computer program is stored in the memory 34 of the electronic device 3, but the reader should be aware that other solutions that can enable the processor to execute the computer program are feasible.
[0172] The input device 32 is used to input data and / or signals, and the output device 33 is used to output data and / or signals. The output device 33 and the input device 32 may be independent devices or an integrated device.
[0173] It can be understood that, in the embodiment of the present invention, the memory 34 is not only used to store related instructions, and the embodiment of the present invention does not limit the specific data stored in the memory.
[0174] Understandably, Fig.11Only a simplified design of an electronic device is shown. In practical applications, the electronic device may also include other necessary components, including but not limited to any number of input / output devices, processors, memories, etc., and all ship flow prediction methods based on spatiotemporal multi-graph convolutional networks that can implement the embodiments of the present invention are within the protection scope of the present invention.
[0175] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical or other forms.
[0176] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0177] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0178] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the technical solution of the present invention can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a management server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: read-only memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.
[0179] Finally, it should be noted that although the above embodiments have been described in the specification and drawings of this application, this does not limit the scope of patent protection of this application. All technical solutions generated by replacing or modifying equivalent structures or equivalent processes based on the essential concept of this application using the contents recorded in the specification and drawings of this application, as well as directly or indirectly implementing the technical solutions of the above embodiments in other related technical fields, are included in the scope of patent protection of this application.
Claims
1. A traffic prediction method, characterized in that: The method comprises: The central server extracts spatial features related to the road network from the individual trajectory data, uses a graph convolutional network to process and extract the spatial features of the road network, and embeds the spatial features of the road network into the global model to capture the spatial dependency of the road network. Based on the spatial features and time information of the road network, the spatial features are combined with the time information through a graph convolutional network and a time attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embed the processed spatiotemporal features into the global model, and update the global model to reflect the latest traffic conditions. The global model is a personalized model constructed and trained based on the individual trajectory using the trajectory data and vehicle status information of the user during driving collected by the client from the database, and is uploaded to the central server as a model of its weight after adding noise data constructed by differential privacy to the model parameters of the personalized model. The central server analyzes and processes the spatiotemporal characteristics according to the individual trajectory data and the traffic status reflected by the global model to generate an estimated travel time for a specific route and time step; decomposes and processes the spatiotemporal characteristics according to the personalized models uploaded by all clients and the global traffic data to generate traffic status estimates for each time period that conforms to the road network structure; and learns and optimizes the non-personalized global traffic status according to the personalized model parameters uploaded by the client to generate an updated global model; and The central server executes a federated learning algorithm to perform weighted averaging and secure aggregation of the model based on the localized global model weights uploaded by the client, updates the global traffic status, and sends the aggregated global model weights back to the client, so that the client can train and optimize the personalized model based on the aggregated global model weights.
2. The traffic prediction method according to claim 1, characterized in that: Using a graph convolutional network to process and extract the spatial features of the road network, and embedding the spatial features of the road network into a global model to capture the spatial dependencies of the road network, specifically including: The graph signal is defined by formula (5) to provide a feature vector for each node or link in the graph convolution network, so as to process the spatial characteristics of the traffic network by performing the graph convolution operation by formula (6), aggregate neighbor node information, introduce nonlinear characteristics, and update the global model to accurately reflect the structure and dynamic characteristics of the road network; (5) (6) In formula (5), represents the hidden state of the lth layer of the graph convolutional network, N represents the number of samples, represents the feature dimension of the lth layer; in formula (6), Representing the Laplacian matrix of a graph c Power; Indicates c jump and the weight parameter of the lth layer, represents the weight matrix of the lth layer, represents a nonlinear activation function, Represents the set of weight parameters of the lth layer.
3. The traffic prediction method according to claim 2, characterized in that: According to the spatial features and temporal information of the road network, the spatial features and temporal information are combined through a graph convolutional network and a temporal attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions. The processed spatiotemporal features are embedded into a global model, and the global model is updated to reflect the latest traffic conditions, specifically including: Receive spatial feature data from the client and obtain time information; The spatial features are processed using a graph convolutional network to generate the hidden state of each road segment and node. ; wherein, the graph convolution network processing is performed by the formula (5), It means that after being processed by the GCN layer, the hidden state of the l+1th layer is obtained; Encode temporal information into temporal embedding vectors ;in, K represents the number of time intervals in a day, I represents the latitude of the time embedding vector; Combine the hidden states and temporal embeddings generated by graph convolutional networks, and use fully connected layers to generate initial prediction features for links and nodes; Apply the temporal attention mechanism to adjust the impact of different time steps on traffic status; Applying the spatiotemporal vector product processing to the links and nodes respectively through formulas (7) and (8) to generate the corresponding traffic state prediction; and The calculated spatiotemporal features are embedded into the global model, and the global model is updated to reflect the latest traffic status; (7) (8) in, Indicates that at a specific time step Traffic status prediction of downlink; Indicates that at a specific time step Traffic status prediction of the next node; It represents the hidden state of the link at layer l+1 after being processed by the graph convolutional network; It represents the hidden state of the node at the l+1 layer after being processed by the graph convolutional network; and Respectively represent the weight matrices for links and nodes in the spatiotemporal vector product layer; and denote the bias terms of links and nodes respectively; Represents the time embedding vector at time step The value below; represents the temporal attention mechanism; the fully connected layer is passed through , , and Build.
4. The traffic prediction method according to claim 3, characterized in that: The central server performs spatiotemporal feature analysis and processing based on the individual trajectory data and the traffic status reflected by the global model to generate an estimated travel time for a specific route and time step, specifically including: The central server performs spatiotemporal feature analysis based on the individual trajectory data and the traffic status reflected by the global model, and uses formula (9) to calculate the estimated travel time on route r; wherein, in formula (9), represents the estimated or predicted value of the travel time, |r| represents the total number of road segments and intersections in route r, and Y represents the estimated state or time of a road segment or intersection. represents the i-th road segment, represents the jth intersection, represents the time step; (9) Based on the personalized models uploaded by all clients and the global traffic data, the temporal and spatial characteristics are decomposed to generate traffic status estimates for each time period that conform to the road network structure, including: Receive the personalized model and global traffic data, divide a day into different parts, apply spatiotemporal tensor decomposition to each part to process traffic state prediction, generate decomposed spatiotemporal features, and generate an estimate of the global traffic state; According to the personalized model parameters uploaded by the client, non-personalized global traffic state learning and optimization processing are performed to generate an updated global model, specifically including: According to the personalized model parameters uploaded by the client, the loss function is calculated using formula (10); wherein the personalized model parameters include the personalized model update uploaded by the client, the client m Actual driving time data , client-side model estimated travel time , the number of trajectory samples of the client n m ; In formula (10), represents the trainable model parameters of the global model, represents the loss function of the global model, which is used to measure the difference between the model prediction and the actual travel time; (10) Apply the stochastic gradient descent algorithm to the loss function and the current parameters of the global model Optimize to generate updated global model parameters ; Based on the local model of all clients Table and Sample Size n m , use formula (11) to calculate the global model As the weighted average of all clients, to get the updated global model ;in, α represents the learning rate, M For the t The number of customers selected in the round, n For the t The total number of samples of all customers selected in the round; (11) The updated global model The data are aggregated and sent to all clients, so that the clients can perform the next step of personalized model training.
5. The traffic prediction method according to claim 4, characterized in that: The central server executes the federated learning algorithm to perform weighted averaging and secure aggregation of the model according to the localized global model weights uploaded by the client, updates the global traffic state, and sends the aggregated global model weights back to the client, so that the client trains and optimizes the personalized model based on the aggregated global model weights, specifically including: The central server initializes the global model using formula (12) ;in, Indicates t The global model of the wheel, ; The central server is based on the number of rounds t In each round of t choose M Clients form a random set I t , the current round number is calculated by formula (12) t The global model Send to Collection I t Each client in m , so that the client receives the global model sent by the central server , using the local data set through formulas (13) and (14) , based on the SGD algorithm and the local dataset Train the model to generate an updated localized global model f m ;in, f m Indicates m A local model on the client; Represents the gradient operator, which is used to calculate the loss function with respect to the model parameters θ b The gradient of Represents the loss function, which is used to measure the model f In the m Client datasets The difference between the predicted and actual values on ; (12) (13) (14) The central server receives the privacy-preserving local model uploaded by the client. f m , and calculate the current round number through formula (11) t +1The weighted average of the global models to generate the aggregated global model , and the global model Send it to all clients; wherein the local model of privacy protection f m The updated localized global model is updated by the client f m Add Laplace noise using equation (15) to satisfy Differential privacy, generating privacy-preserving local models f m ; (15)。 6. A traffic prediction method, characterized in that: The method comprises: The client collects the user's driving trajectory data and vehicle status information from the database to obtain individual trajectories, builds and trains a personalized model based on the individual trajectories, adds differential privacy to the model parameters of the personalized model to construct noise data, and uploads the model parameters with added noise data to the central server as localized global model weights; The central server extracts spatial features related to the road network from the individual trajectory data, processes and extracts the spatial features of the road network using a graph convolutional network, and embeds the spatial features of the road network into a global model to capture the spatial dependencies of the road network, and combines the spatial features with the temporal information through a graph convolutional network and a temporal attention mechanism based on the spatial features and temporal information of the road network to generate spatiotemporal features that can reflect changes in traffic conditions, embeds the processed spatiotemporal features into a global model, and updates the global model to reflect the latest traffic conditions; The central server analyzes and processes the spatiotemporal characteristics according to the individual trajectory data and the traffic status reflected by the global model to generate an estimated travel time for a specific route and time step; decomposes and processes the spatiotemporal characteristics according to the personalized models uploaded by all clients and the global traffic data to generate traffic status estimates for each time period that conforms to the road network structure; and learns and optimizes the non-personalized global traffic status according to the personalized model parameters uploaded by the client to generate an updated global model; and The central server executes a federated learning algorithm to perform weighted averaging and secure aggregation of the model based on the localized global model weights uploaded by the client, updates the global traffic status, and sends the aggregated global model weights back to the client, so that the client can train and optimize the personalized model based on the aggregated global model weights.
7. A central server establishes communication connections with multiple clients, characterized in that: The central server comprises: A spatial feature extraction module, configured to receive the individual trajectory data uploaded by the client, and extract spatial features related to the road network from the individual trajectory data; A graph convolutional network application module, used to process and extract the spatial features of the road network extracted by the spatial feature extraction module using a graph convolutional network, and embed the spatial features of the road network into a global model to capture the spatial dependency of the road network; A spatiotemporal feature integration module is used to combine the spatial features and temporal information of the road network generated by the graph convolutional network application module through a graph convolutional network and a temporal attention mechanism to generate spatiotemporal features that can reflect changes in traffic conditions, embed the processed spatiotemporal features into a global model, and update the global model to reflect the latest traffic conditions; A localized global model prediction module, used to analyze and process the spatiotemporal features according to the individual trajectory data and the traffic state reflected by the global model generated by the spatiotemporal feature integration module, and generate an estimated travel time for a specific route and time step; A spatiotemporal tensor decomposition module is used to receive the personalized model and global traffic data uploaded by the client, and perform spatiotemporal feature decomposition processing to generate traffic state estimates for each time period that conform to the road network structure; A global model training module, used to learn and optimize the non-personalized global traffic state according to the personalized model parameters uploaded by the client, and generate an updated global model; The federated learning collaborative module is used to execute the federated learning algorithm to perform weighted averaging and secure aggregation of the model according to the localized global model weights uploaded by the client, update the global traffic status, and send the aggregated global model weights back to the client, so that the client can train and optimize the personalized model based on the aggregated global model weights.
8. The central server according to claim 7, characterized in that: The graph convolution network processing module is used to define the graph signal through formula (5) to provide a feature vector for each node or link in the graph convolution network, to perform the graph convolution operation through formula (6) to process the spatial characteristics of the traffic network, aggregate neighbor node information, introduce nonlinear characteristics, and update the global model to accurately reflect the structure and dynamic characteristics of the road network; (5) (6) In formula (5), represents the hidden state of the lth layer of the graph convolutional network, N represents the number of samples, represents the feature dimension of the lth layer; in formula (6), L c Representing the Laplacian matrix of a graph c Power; Indicates c jump and the weight parameter of the lth layer, represents the weight matrix of the lth layer, represents a nonlinear activation function, Represents the set of weight parameters of the lth layer.
9. The central server according to claim 8, characterized in that: The spatiotemporal feature integration module is used to: Receive spatial feature data from the client and obtain time information; The spatial features are processed using a graph convolutional network to generate the hidden state of each road segment and node. ; wherein, the graph convolution network processing is performed by the formula (5), It means that after being processed by the GCN layer, the hidden state of the l+1th layer is obtained; Encode temporal information into temporal embedding vectors ;in, K represents the number of time intervals in a day, I represents the latitude of the time embedding vector; Combine the hidden states and temporal embeddings generated by graph convolutional networks, and use fully connected layers to generate initial prediction features for links and nodes; Apply the temporal attention mechanism to adjust the impact of different time steps on traffic status; Applying the spatiotemporal vector product processing to the links and nodes respectively through formulas (7) and (8) to generate the corresponding traffic state prediction; and The calculated spatiotemporal features are embedded into the global model, and the global model is updated to reflect the latest traffic status; (7) (8) in, Indicates that at a specific time step Traffic status prediction of downlink; Indicates that at a specific time step Traffic status prediction of the next node; It represents the hidden state of the link at layer l+1 after being processed by the graph convolutional network; It represents the hidden state of the node at the l+1 layer after being processed by the graph convolutional network; and Respectively represent the weight matrices for links and nodes in the spatiotemporal vector product layer; and denote the bias terms of links and nodes respectively; The fully connected layer represents the temporal embedding vector at time steps The value below; Represents the temporal attention mechanism; and Build.
10. The central server according to claim 9, characterized in that: The localized global model prediction module is used to analyze and process the spatiotemporal characteristics according to the individual trajectory data and the traffic status reflected by the global model, and calculate the estimated travel time on the route r using formula (9); In formula (9), represents the estimated or predicted value of the travel time, |r| represents the total number of road segments and intersections in route r, and Y represents the estimated state or time of a road segment or intersection. Indicates i road sections, represents the jth intersection, represents the time step; (9) The spatiotemporal tensor decomposition module is used to receive the personalized model and the global traffic data, divide the time of a day into different parts, and apply the spatiotemporal tensor decomposition to each part to process the traffic state prediction, generate the decomposed spatiotemporal features, and generate the estimation of the global traffic state; The global model training module is used to: According to the personalized model parameters uploaded by the client, the loss function is calculated using formula (10); wherein the personalized model parameters include the personalized model update uploaded by the client, the client m Actual driving time data , client-side model estimated travel time , the number of trajectory samples of the client n m ; In formula (10), represents the trainable model parameters of the global model, represents the loss function of the global model, which is used to measure the difference between the model prediction and the actual travel time; (10) Apply the stochastic gradient descent (SGD) algorithm to the loss function and the current parameters of the global model Optimize to generate updated global model parameters ; Based on the local model of all clients Table and Sample Size n m , use formula (11) to calculate the global model As the weighted average of all clients, to get the updated global model ;in, α represents the learning rate, M is the number of customers selected in round t, n is the total number of samples of all customers selected in round t; (11) The updated global model The data are aggregated and sent to all clients, so that the clients can perform the next step of personalized model training.
11. The central server according to claim 10, characterized in that: The federated learning collaborative module is used to: Initialize the global model using formula (12) ;in, Indicates t The global model of the wheel, ; Based on round number t In each round of t Select M clients to form a random set I t , the current round number is calculated by formula (12) t The global model Send to Collection I t Each client in m , so that the client receives the global model sent by the central server , using the local data set through formulas (13) and (14) , based on the SGD algorithm and the local dataset Train the model to generate an updated localized global model f m ; (12) (13) (14) Receive the privacy-preserving local model uploaded by the client f m , and calculate the current round number ( t +1) Weighted average of the global model , to generate the aggregated global model , and the global model Send it to all clients; wherein the local model of privacy protection f m The updated localized global model is updated by the client f m Add Laplace noise using equation (15) to satisfy Differential privacy, generating privacy-preserving local models f m ;in, f m Indicates m A local model on the client; Represents the gradient operator, which is used to calculate the loss function L with respect to the model parameters θ b The gradient of Represents the loss function, which is used to measure the model f In the m Client datasets The difference between the predicted and actual values on ; (15)。 12. A traffic prediction system, characterized in that: The system includes multiple clients, a database and a central server as described in any one of claims 7 to 11; the clients, the central server and the database establish a communication connection.
13. An electronic device, comprising: A processor and a memory, characterized in that the memory is used to store computer program codes, the computer program codes include computer instructions, and when the processor executes the computer instructions, the electronic device executes the steps of the traffic prediction method as described in any one of claims 1 to 5.
14. A readable storage medium having a computer program stored therein, characterized in that: The computer program includes program instructions, and when the program instructions are executed by a processor of an electronic device, the processor executes the steps of the traffic prediction method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Urban traffic flow space-time prediction method based on federated learning
CN114757389A
Deep learning traffic state estimation method and system based on car networking sparse information
CN115662142A
Vehicle trajectory prediction method based on multi-sequence space-time tensor fusion
CN117743936A
Vehicle trajectory prediction method, system and device and computer readable medium
CN118153745A
Distributed traffic flow prediction method based on personalized federal map signal learning
CN118675337A
Cited By
Federal learning-based roadbed compaction quality evaluation system and method thereof
CN120146710A
Multi-modal service strategy making method and device based on user travel trajectory
CN120338561A
Multi-vehicle cooperative trajectory prediction method and system based on federated learning
CN120808608A