Vehicle trajectory generation method and device based on diffusion model and lightweight federated learning
By employing a diffusion model and lightweight federated learning approach, and utilizing the U-Net architecture and stochastic quantization function, a combination of privacy security, high quality, and low communication overhead is achieved in vehicle trajectory generation. This solves the problems of privacy leakage and high communication overhead in existing technologies, and generates trajectory data that conforms to vehicle motion patterns.
Patent Information
- Application Number
- CN202410475811.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-19
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2044-04-19
AI Technical Summary
Existing methods for generating trajectory data pose privacy risks, cannot generate vehicle trajectories for entire urban areas, and have high communication overhead and energy consumption, resulting in low-quality trajectory data.
We employ a diffusion model-based and lightweight federated learning approach. A global generative model is trained collaboratively with vehicles through a parameter server. The diffusion model parameters are quantized before communication. High-quality trajectory data is generated using the U-Net architecture and a stochastic quantization function, ensuring privacy and reducing communication overhead.
It generates high-quality vehicle trajectory data without compromising user data privacy, captures the spatiotemporal characteristics of vehicle trajectories, significantly reduces communication overhead, and maintains model generation performance.
Smart Images

Figure CN118379876B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of trajectory generation and privacy protection, and particularly relates to a vehicle trajectory generation method and device based on a diffusion model and lightweight federated learning. BACKGROUND
[0002] With the wide deployment of GPS devices in intelligent transportation systems, it is easy to record the trajectory data of vehicles. Such valuable vehicle trajectory data can be applied to various downstream traffic data mining tasks in intelligent transportation systems, such as trajectory prediction, user demand prediction, travel time estimation, etc. However, these advanced traffic data mining schemes, especially deep learning-based solutions, usually require large-scale trajectory datasets to achieve good results. However, due to the time-consuming and labor-intensive nature of trajectory data collection, as well as the promulgation of international privacy policies and public concern for personal privacy information in recent years, there is a shortage of publicly available large-scale trajectory datasets. This undoubtedly seriously hinders the progress of traffic data mining applications.
[0003] To solve this problem, generative models such as generative adversarial networks, variational autoencoders, and diffusion models are very promising for generating trajectory data. They learn the underlying distribution of trajectory data and sample trajectory data from these underlying distributions to expand the scale of trajectory datasets and improve the data availability of trajectory data mining tasks. However, this centralized generation method still requires a large amount of trajectory data collected by various government and organizational entities for training. In the process of collection, users' personal data may still be leaked, causing serious privacy leakage problems. At the same time, the trajectory data collected by various organizations has obvious regional characteristics, which limits the comprehensive representation of the model for the entire city trajectory information, and cannot accurately capture the diversity and complexity of the city trajectory.
[0004] Existing deep learning-based trajectory data generation methods still require centralized training based on a large amount of user trajectory data collected by government and organizational entities, which still poses a risk of privacy leakage during the collection process, thus cannot absolutely guarantee the privacy safety of users. At the same time, existing trajectory generation methods can only generate trajectories in the region of the trajectory dataset they hold, and cannot generate vehicle trajectories containing information of the entire city region, thus the diversity of the generated trajectories is limited.
[0005] Existing deep learning-based trajectory data generation methods mostly use generative adversarial networks (GAN) for model training, but GANs are prone to mode collapse problems during training, and cannot capture the spatiotemporal features of vehicle trajectories well, thus cannot generate high-quality trajectory data.
[0006] The existing method of training a diffusion model on an edge device such as a vehicle only by using a federated learning method needs to transmit a large amount of parameters of the diffusion model in the process of communication with the vehicle, thereby causing expensive communication overhead and energy consumption and affecting the training efficiency of the diffusion model.
[0007] Therefore, a method for generating high-quality trajectory data with low energy consumption under the premise of ensuring privacy security is particularly needed. SUMMARY
[0008] The present application aims to provide a vehicle trajectory generation method and device based on a diffusion model and light-weight federated learning to at least solve one technical problem in the prior art.
[0009] The technical solution of the present application is:
[0010] A vehicle trajectory generation method based on a diffusion model and light-weight federated learning, comprising:
[0011] An initial global generation model is obtained by pre-training an existing global model using a public data set of a predetermined field by a parameter server;
[0012] In the process of communication between the parameter server and the vehicle in any round, the parameter server selects at least two vehicles from a set of vehicles to participate in the training in the round, and sends the global model parameters to the selected vehicles;
[0013] After each selected vehicle receives the new global model parameters, the vehicle trains a local diffusion model using a local data set of the vehicle and obtains diffusion model parameters after training in the round;
[0014] The vehicle quantizes the trained diffusion model parameters and sends them to the parameter server to share only encrypted parameters without sharing any private data;
[0015] After the parameter server obtains the quantized diffusion model parameters uploaded by all vehicles, the parameter server aggregates the model parameters uploaded by all selected vehicles to obtain an adjusted global model;
[0016] The global model is sent to all vehicles in communication with the parameter server, and repeated training is performed until a set number of communication rounds is reached to obtain a final global diffusion model;
[0017] The final global diffusion model is used to generate vehicle trajectory data.
[0018] After each selected vehicle receives the new global model parameters, the vehicle trains a local diffusion model using a local data set of the vehicle and obtains diffusion model parameters after training in the round, comprising:
[0019] Dividing the local dataset Dk corresponding to any vehicle into batches of size B;
[0020] Randomly sampling from the sequence of diffusion steps, Gaussian noise is sampled from a Gaussian distribution with mean 0 and variance 1;
[0021] Adding noise to the original trajectory in the local data of the vehicle step by step to obtain the noisy trajectory at time t, and estimating the noise added in the forward diffusion process;
[0022] Obtaining the diffusion model parameters after this round of training through the loss function.
[0023] The step of adding noise to the original trajectory in the local data of the vehicle step by step to obtain the noisy trajectory at time t includes:
[0024] Using the formula to calculate the noisy trajectory x t at diffusion step t, this process aims to add noise to the original trajectory step by step, destroying the spatio-temporal features of the original trajectory, and thus obtaining the noisy trajectory at time t;
[0025] where q is the probability distribution followed in the forward noise adding process; t is the diffusion step; x t is the noisy trajectory at diffusion step t; x0 is the original trajectory; α t = 1-β t , β t is a predefined hyperparameter and satisfies {β1<β2<…<β T , β t ∈(0,1)}; represents a Gaussian distribution; I is a unit value; T is the maximum value of the diffusion step.
[0026] The step of estimating the noise added in the forward diffusion process includes:
[0027] Setting the U-Net architecture, given an input trajectory where m represents the latitude and longitude of the trajectory, and n represents the length of the trajectory;
[0028] Each residual block in the U-Net architecture is:
[0029] X l =Conv[σ(GN(X l-1 ))],
[0030] X l = X l +Concat(t emb , c emb ),
[0031] Xl = Conv [σ (GN (X l ))],
[0032] X l = X l + X l-1 ,
[0033] where Conv represents one-dimensional convolution operation; σ represents a nonlinear function; t represents the diffusion step number; c represents the trajectory external attribute; GN represents group normalization operation; l represents the lth residual block; temb represents the vector after encoding the diffusion step number; cemb represents the vector after encoding the trajectory external attribute; Concat represents the concatenation operation;
[0034] The diffusion step number t and the trajectory external attribute c are added to the residual block by encoding:
[0035] t emb = FC (σ (FC (SinTimeEmb (t)))
[0036] c emb = FC (c),
[0037] where FC represents a fully connected layer, and sintimeemb is a step index encoding;
[0038] The intermediate attention layer is set as follows:
[0039]
[0040] X l+1 = X l + Attention (Q, K, V) ;
[0041] where Q = W Q · X l , K = W K · X l , V = W V · X l ; W Q , W K , W V are all learnable parameter matrices; T represents the transpose operation; d represents the scaling factor; X l is the output of the lth residual block.
[0042] The vehicle quantizes the trained diffusion model parameters and sends them to the parameter server, including:
[0043] The model weight ω k is quantized to ω The data type of the diffusion model parameter is converted from 32 bits to q bits, and the formula is as follows:
[0044]
[0045] Wherein, sign(·) represents the sign function, s is the scaling factor, [y a , y a+1 ] is the quantization interval, and the absolute value of each element
[0046] Given the quantization bit number q, the acquisition method of y a is as follows:
[0047]
[0048] Wherein, are the maximum value and minimum value of the non-zero element .
[0049] After the parameter server obtains the quantized diffusion model parameters uploaded by all vehicles, it aggregates the model parameters uploaded by all selected vehicles, including:
[0050] After the parameter server receives the quantized diffusion model parameters uploaded by all vehicles, it aggregates the model parameters uploaded by all vehicles through the federated average algorithm, and the aggregation method is as follows:
[0051]
[0052] Wherein, represents the quantized diffusion model parameter uploaded by the kth vehicle in the i+1th round of communication; K represents the set of vehicles participating in training; w i+1 represents the global model parameter aggregated after the i+1th round of communication.
[0053] The final global diffusion model is used to generate vehicle trajectory data, including:
[0054] The step of generating vehicle trajectory data by using the parameter server to randomly generate any number of Gaussian noises and gradually denoising these Gaussian noises includes:
[0055] The generation process of the vehicle trajectory data is regarded as a reverse denoising process of Gaussian noise into pure trajectory, and the reverse denoising process is represented as follows:
[0056]
[0057] Wherein, p θ is the probability distribution followed in the reverse denoising process; x T represents a standard Gaussian noise with mean 0 and variance 1; x0represents the final generated pure trajectory.
[0058] The generation process of the vehicle trajectory data is regarded as a reverse denoising process of Gaussian noise into a pure trajectory, comprising:
[0059] The generation process of the vehicle trajectory data (x T , x T-1 , …, x0) is regarded as a reverse denoising process of Gaussian noise x T into a pure trajectory x0, each step of which is represented as:
[0060]
[0061] wherein the mean μ θ (x t , t, c) and the variance ∑ θ (x t , t, c) are obtained as follows:
[0062]
[0063]
[0064] wherein ∈ θ (x t , t, c) represents the output of the denoising network with x t , t, c as input; c is an external attribute of the trajectory; x t is a noisy trajectory with t diffusion steps.
[0065] An electronic device for vehicle trajectory data generation, comprising:
[0066] A storage medium for storing a computer program;
[0067] A processing unit in data exchange with the storage medium, for performing the steps of the vehicle trajectory generation method based on the diffusion model and the lightweight federated learning as described above when the vehicle trajectory data generation is performed by executing the computer program through the processing unit.
[0068] A computer-readable storage medium having a computer program stored therein;
[0069] The computer program, when executed, performs the steps of the vehicle trajectory generation method based on the diffusion model and the lightweight federated learning as described above.
[0070] The beneficial effects of the present application at least include:
[0071] The method described in this application uses a federated learning approach to generate vehicle trajectories, enabling individual vehicles to collaboratively train a global trajectory generation model without leaking their local trajectory data. This method can generate high-quality trajectory data while ensuring the privacy and security of user data. Simultaneously, a diffusion model is used to generate vehicle trajectory data. The diffusion model can effectively capture the spatiotemporal features in vehicle trajectory data, thereby generating high-quality trajectory data that conforms to vehicle motion patterns. Furthermore, this application uses a stochastic quantization method to quantize the parameters of the diffusion model before the client communicates with the parameter server, significantly reducing communication overhead without affecting the model's generation performance. Attached Figure Description
[0072] Figure 1 This is a flowchart of a vehicle trajectory generation method based on a diffusion model and lightweight federated learning;
[0073] Figure 2 This is a framework diagram of a vehicle trajectory generation method based on diffusion model and lightweight federated learning;
[0074] Figure 3 This is a diagram of the U-Net architecture for the denoising network in the method described in this application;
[0075] Figure 4 This is a graph showing the changes in loss for different methods;
[0076] Figure 5 This is a comparison of the distribution of trajectories generated by Difftraj and FedDifftraj at different resolution levels;
[0077] Figure 6 This is a performance comparison of the FedDifftraj model under different numbers of vehicles;
[0078] Figure 7 This is a comparison chart of model performance and communication consumption at different quantization levels;
[0079] Figure 8 A trajectory map obtained using the method described in this application. Detailed Implementation
[0080] The present application will now be further described with reference to the accompanying drawings.
[0081] To address the problems of existing technologies, this application employs a federated learning approach, such as... Figure 1By allowing each vehicle to keep its trajectory dataset locally, and co-training a global diffusion model with a parameter server, and quantifying the diffusion model parameters to be uploaded to the parameter server for each vehicle before communicating with the parameter server, a global diffusion model that can generate high-quality trajectory data can be trained in a low-communication-overhead manner without leaking user data privacy. This generates trajectory data to support downstream traffic trajectory data mining tasks.
[0082] Specific Implementation Example I:
[0083] This application provides one embodiment:
[0084] Build as Figure 2 The example shown is a lightweight federated learning framework. In this scenario, the set of vehicles is... Each vehicle has its own local dataset D. k The system uses a local model and a random quantization method to quantize the trained model parameters before communication, and then uploads them to the parameter server for model aggregation.
[0085] The training process for federated learning is as follows:
[0086] S1. The parameter server pre-trains the global model using a public dataset specific to the domain, obtaining the initial global generative model ω. 0 This initialization process does not involve privacy leaks.
[0087] S2. In each round of communication between the parameter server and the vehicles, the parameter server selects K vehicles from the vehicle set to participate in the training of this round, and sets the global model parameters ω. i Send to the selected vehicle.
[0088] S3. After each vehicle simultaneously receives the new global model parameters, it uses its local dataset D based on these parameters. k Train the local diffusion model and obtain the diffusion model parameters ω after this round of training. k .
[0089] S301. Each vehicle divides its local dataset Dk into batches of size B.
[0090] S302. Randomly sample t ~ Uniform({1, ..., T}) from the diffusion step sequence, and obtain Gaussian noise from a Gaussian distribution with mean 0 and variance 1.
[0091] S303.Use formula Calculate the noisy trajectory x when the diffusion step number is t. tThis process aims to add noise to the original trajectory step by step, destroy the spatio-temporal characteristics of the original trajectory, and obtain the noisy trajectory at time t
[0092] S304. Calculate the output of the denoising network with the noisy trajectory x t , the current diffusion step t, and the encoded vehicle trajectory attribute c as input t , t, c). This denoising network is a carefully designed network to estimate the noise added in the forward diffusion process.
[0093] For the trajectory generation task, its denoising network is a carefully designed U-Net architecture, as shown in Figure 3 . It contains down-sampling modules, intermediate attention modules, and up-sampling modules. Each sampling module is composed of multiple residual blocks. At the same time, the output of the down-sampling module is added to the up-sampling module through skip connection.
[0094] Each residual block is composed of one-dimensional convolution, group normalization, and nonlinear function. Therefore, given an input trajectory where m represents the latitude and longitude of the trajectory, and n represents the length of the trajectory. The calculation formula of each residual block can be expressed as follows:
[0095] X l =Conv[σ(GN(X l-1 ))],
[0096] X l =X l +Concat(t emb , c emb ),
[0097] X l =Conv[σ(GN(X l ))],
[0098] X l =X l +X l-1 ,
[0099] where Conv represents one-dimensional convolution operation, which plays different roles in different sampling modules. The one-dimensional convolution in the up-sampling module is used to capture the global features of the trajectory, while the transposed one-dimensional convolution in the down-sampling module is used to restore the resolution and preserve the local features of the trajectory. σ represents the nonlinear function, and the swish function is used in this embodiment. For the residual blocks at the same level in the U-Net, the output of the up-sampling part is connected with the input of the down-sampling part using skip connection, which can well allow the model to capture spatio-temporal features at different resolutions and promote the learning of trajectory details.
[0100] In the above calculation formula of the residual block, the diffusion step number t and the trajectory external attribute c are added to the residual block by encoding:
[0101] t emb =FC(σ(FC(SinTimeEmb(t)))
[0102] c emb =FC(c),
[0103] where FC represents a fully connected layer, sintimeemb is a step index encoding. c is the external attribute of the trajectory, such as the length of the trajectory, travel time, etc. The embedding of the external attribute of the trajectory into the network for conditional generation can better generate trajectories that conform to the laws of the real world.
[0104] In order to better connect the up-sampling and down-sampling modules, the embodiment introduces an attention mechanism. This intermediate attention layer can be formulated as follows:
[0105]
[0106] X l+1 =X l +Attention(Q,K,V);
[0107] where Q=W Q ·X l , K=W K ·X l , V=W V ·X l ; W Q , W K , W V are all learnable parameter matrices.
[0108] This attention layer can improve the network's perception of key features, dynamically integrate global and local information extracted by up-sampling and down-sampling, and improve the fineness of generated trajectories.
[0109] S305. Calculate the gradient by calculating the loss function ||∈-∈0(x t , t, c)| 2 , and perform gradient descent to obtain updated model parameters
[0110] S4. Each vehicle uses a random quantization technique to quantize the trained model parameters and sends them to the parameter server. This process does not share any private data, but only shares encrypted parameters.
[0111] Specifically, a random quantization function Q(·) is defined to quantize the model weights ω kquantization This function can convert the data type from 32 bits to q bits, and its formula is as follows:
[0112]
[0113] Where sign(·) represents the sign function, s is the scaling factor, [y a , y a+1 ] is the quantization interval, and for each element There exists
[0114] Given the number of quantization bits q, the method for obtaining y a is as follows:
[0115]
[0116] Where are the maximum and minimum values of the non-zero elements , respectively.
[0117] S5. After the parameter server receives all the uploaded quantized diffusion model parameters from the vehicles, it aggregates all the uploaded model parameters from the vehicles through the federated averaging algorithm, and the aggregation method is as follows:
[0118]
[0119] S6. Finally, a new global model is formed, and the new global model is sent to each vehicle for the next training, and the steps of S2-S5 are repeated until the set communication round E is reached.
[0120] S7. After multiple vehicles obtain a global generated model G θ through multiple rounds of federated learning training, the parameter server can randomly generate any number of Gaussian noise and gradually denoise these Gaussian noise to obtain generated vehicle trajectory data.
[0121] The trajectory generation process (x T , x T-1 , …, x0) is the reverse denoising process of converting Gaussian noise x T into pure trajectory x0, and each step can be formulated as follows:
[0122]
[0123] According to the Denoising Diffusion Probabilistic Model, the formula for calculating the mean and variance is as follows:
[0124]
[0125]
[0126] Finally, the complete inverse denoising process can be represented as follows:
[0127]
[0128] Through the above steps, the trained global generative model G θ Fast generation of high-quality, large-scale vehicle trajectory data, so as to be applied to traffic data mining tasks such as trajectory prediction, traffic analysis, etc.
[0129] Specific implementation process: first, the parameter server uses the public data set of a certain city to pre-train the existing global model, and obtains the initial global generative model ω 0 ; Then, in the process of each round of communication between the parameter server and the vehicle, the parameter server selects K vehicles from the set of vehicles to participate in the training of this round, and sends the global model parameters ω i to the selected vehicles; and after each vehicle receives the new global model parameters, it trains the local diffusion model based on the local data set D k and obtains the diffusion model parameters ω k after this round of training; then, each vehicle uses the random quantization technique to quantize the trained model parameters and sends them to the parameter server, this process does not share any private data, but only shares encrypted parameters; and after the parameter server receives all the quantized diffusion model parameters uploaded by the vehicles, it aggregates all the model parameters uploaded by the vehicles through the federated averaging algorithm, finally forms a new global model, and sends the new global model to each vehicle for the next training. When multiple vehicles obtain a global generative model G θ through multiple rounds of federated learning training, the parameter server can randomly generate any number of Gaussian noise and gradually denoise these Gaussian noise to obtain generated vehicle trajectory data, and the generated trajectory is as shown in Figure 8 .
[0130] Simulation verification process:
[0131] First part: trajectory generation performance:
[0132] In this section, the method described in this application is recorded as: FedDifftraj model; and the performance of the FedDifftraj model is compared with the performance of Difftraj, TrajGAN, TrajVAE with the same simulation configuration. Among the four competitive methods, FedDifftraj is a federated learning model, and the rest are centralized models. Among them, Difftraj is the centralized version of FedDifftraj, and TrajGAN and TrajVAE are composed of convolutional layers and linear layers.
[0133] Table 1: Results of 4 indicators comparing the trajectories generated by each method with the original trajectory;
[0134]
[0135] All methods in Table 1 generate 3000 trajectories for evaluation, which are not given due to space limitations. According to Table 1, the various indicators of FedDifftraj are better than TrajGAN and TrajVAE, but slightly inferior to Difftraj. This is because FedDifftraj inherits the outstanding performance advantage of Difftraj in the trajectory generation task, so it can rival the central training model.
[0136] As shown in Figure 4 , the loss changes of Difftraj model and FedDifftraj model. From Figure 4 , it can be seen that there is no obvious difference between the loss of FedDifftraj model and Difftraj model. In addition, even in the Non-iid scenario, FedDifftraj model can make the model converge by virtue of its strong fitting ability to data distribution. These results show that FedDifftraj model has strong convergence and stability.
[0137] In addition, this section divides the city into different size grids (8x8, 16x16, 32x32) and visualizes the heat map of trajectory distribution. Figure 5 shows the performance comparison of trajectories generated by Difftraj and FedDifftraj at different resolution levels. From Figure 5It can be found that the distribution of the trajectory generated by the FedDifftraj model and the distribution of the trajectory generated by the Difftraj model are very close at different resolution levels, and are similar to the real-world trajectory distribution. This is because the core technology of FedDifftraj to generate trajectories is the Difftraj structure, so the performance of FedDifftraj can be comparable to that of the Difftraj model. In addition, FedDifftraj can also protect data privacy by retaining the trained data set locally.
[0138] In summary, FedDifftraj can generate high-quality trajectory data without compromising privacy.
[0139] Second part: Performance comparison of FedDifftraj model under different number of vehicles:
[0140] In the simulation experiment, the influence of different number of vehicles (i.e. N = 2, 4, 8, 10) on the performance of FedDifftraj can be obtained. The experimental results are shown in Figure 6 It can be seen that the number of vehicles has an impact on the performance of FedDifftraj, but this impact is small. This is because more vehicles will introduce more communication overhead to the underlying communication infrastructure under normal circumstances, but since the Fedavg algorithm is introduced and the model weights are quantized, the communication overhead is significantly reduced, making it easier for the parameter server to simultaneously perform model parameter aggregation. Therefore, the FedDifftraj model described in the present application can exhibit excellent performance under different number of vehicles.
[0141] Third part: Communication overhead analysis:
[0142] As shown in Figure 7 , the quantized model can significantly reduce energy consumption during communication compared to the model without quantization, significantly reducing communication overhead. When using an 8-bit or 6-bit quantization method, the performance of the model is close to that of the model before quantization. In general, the quantized FedDifftraj model in the present application can significantly reduce communication overhead without affecting model performance at an appropriate quantization level.
[0143] Specific embodiment II:
[0144] The present application also provides an embodiment:
[0145] An electronic device comprising: a storage medium and a processing unit; wherein the storage medium is configured to store a computer program, and the processing unit is configured to exchange data with the storage medium, and execute the computer program by the processing unit to perform the steps of the vehicle trajectory generation method based on diffusion model and light-weight federated learning as described in embodiment I when generating vehicle trajectory data.
[0146] Embodiment III
[0147] A computer readable storage medium having stored therein a computer program; the computer program, when executed, performs the steps of the vehicle trajectory generation method based on diffusion model and light-weight federated learning as described in embodiment I
[0148] In this application, a computer readable storage medium can be any tangible medium that can contain, or store computer readable program codes. In this application, a computer readable signal medium can include a data signal traveling in baseband or traveling as a component of a carrier wave. Combinations of the above should also be included within the scope of computer readable media in this application. The computer readable medium containing codes can be implemented as one or more computer readable storage media embodying such computer programs or implemented as one or more computer readable signal media embodying such computer programs. Computer readable storage media are tangible and non-transitory. Computer readable signal media are non-tangible.
[0149] The above disclosure is only several specific implementation scenarios of the present application, but the present application is not limited to this. Any changes that can be thought of by those skilled in the art shall fall within the protection scope of the present application. The above application serial number is only for description, not representing the advantages and disadvantages of the implementation scenario.
Claims
1. A vehicle trajectory generation method based on a diffusion model and lightweight federated learning, characterized in that, The method comprises the following steps: Pre-training an initial global model by using a preset field public data set through a parameter server to obtain an initial global generative model; In any round of communication between the parameter server and the vehicles, the parameter server selects at least two vehicles from the set of vehicles to participate in the training of this round, and sends the global model parameters to the selected vehicles; After each selected vehicle receives the new global model parameters, it trains a local diffusion model using the known local data set and obtains the diffusion model parameters after the training of this round; The vehicles quantize the trained diffusion model parameters and send them to the parameter server without sharing any private data, only sharing encrypted parameters; After the parameter server obtains all the quantized diffusion model parameters uploaded by the vehicles, it aggregates the model parameters uploaded by all the selected vehicles to obtain an adjusted global model; The global model is sent to all vehicles in communication with the parameter server, and repeated training is performed until a set number of communication rounds is reached to obtain a final global diffusion model; The final global diffusion model is used to generate vehicle trajectory data; After each selected vehicle receives the new global model parameters, it trains a local diffusion model using the known local data set and obtains the diffusion model parameters after the training of this round, which comprises the following steps: Divide the local data set Dk corresponding to any vehicle into batches of size B; Randomly sample from the diffusion step sequence and sample Gaussian noise from a Gaussian distribution with mean 0 and variance 1; gradually add noise to the original trajectory in the local data of the vehicle to obtain the noisy trajectory at time t, and estimate the noise added in the forward diffusion process; through the loss function, obtain the diffusion model parameters after the training of this round; The step of gradually adding noise to the original trajectory in the local data of the vehicle to obtain the noisy trajectory at time t comprises the following steps: The formula is The diffusion step number t is calculated as the noisy trajectory This process aims to gradually add noise to the original trajectory, destroy the spatiotemporal characteristics of the original trajectory, and obtain the noisy trajectory at time t. where q is the probability distribution followed in the forward noise addition process; t is the diffusion step number; x t is the noisy trajectory at diffusion step t; x0is the original trajectory; a t = 1 - β t , β t is a predefined hyperparameter and satisfies ; represents a Gaussian distribution; I is the unit value; T is the maximum value of the diffusion step number; The step of estimating the noise added in the forward diffusion process comprises the following steps: Setting up the U-Net architecture, given an input trajectory where m represents the latitude and longitude of the trajectory, and n represents the length of the trajectory; Each residual block in the U-Net architecture is as follows: ; wherein Conv represents a one-dimensional convolution operation; denotes a non-linear function; t denotes a diffusion step number; c denotes a trajectory external attribute; GN denotes a group normalization operation; l denotes an l-th residual block; temb denotes a vector encoded for the diffusion step number; cemb denotes a vector encoded for the trajectory external attribute; Concat denotes a concatenation operation; The diffusion step t and the trajectory external attribute c are added to the residual block through encoding: ; Where FC represents a fully connected layer, and SinTimeEmb is a step index encoding; Set the intermediate attention layer as follows: ; ; wherein, ; are all learnable parameter matrices; T denotes the transpose operation; d denotes a scaling factor; X l is the output of the l-th block residual block; The step of quantizing the trained diffusion model parameters and sending them to the parameter server comprises the following steps: Utilizing a stochastic quantization function Model weights are quantized to convert the data type of the diffusion model parameters from 32 bits to q bits, which is given by the following formula: ; wherein, is a representative symbol function, s is a scaling factor, is a quantization interval, and all exist ; Given the quantization bit number q, The acquisition method is: ; wherein, , are the maximum, minimum values, respectively, of the non-zero elements of the vector The step of aggregating all the model parameters uploaded by the selected vehicles after the parameter server obtains all the quantized diffusion model parameters uploaded by the vehicles comprises the following steps: After the parameter server receives all the quantized diffusion model parameters uploaded by the vehicles, it aggregates all the model parameters uploaded by the vehicles through a federated averaging algorithm, and the aggregation method is as follows: ; wherein, denotes the quantized diffusion model parameters uploaded by the k-th vehicle in the i+1-th round of communication; K denotes the set of vehicles participating in the training; denotes the global model parameters aggregated after the i+1-th round of communication; The step of generating vehicle trajectory data using the final global diffusion model comprises the following steps: The step of randomly generating any number of Gaussian noises by the parameter server and gradually denoising these Gaussian noises to obtain vehicle trajectory data comprises the following steps: The generation process of the vehicle trajectory data is regarded as a reverse denoising process of Gaussian noise becoming pure trajectory, and the reverse denoising process is represented as follows: ; wherein, is the probability distribution followed in the reverse denoising process; denotes a standard Gaussian noise with mean 0 and variance 1 ; denotes the final generated clean trajectory; The generation process of the vehicle trajectory data is regarded as a reverse denoising process of Gaussian noise into pure trajectory, comprising: The generation process of the vehicle trajectory data is considered as Gaussian noise becomes a pure trajectory The reverse denoising process, each step of which is represented as: ; wherein the mean and the variance are obtained as follows: ; ; wherein, denotes the output of the denoising network with as input; c is an extrinsic property of the trajectory; is a noisy trajectory with diffusion step size .
2. An electronic apparatus for vehicle trajectory data generation, characterized by comprising: Comprising: A storage medium for storing a computer program; A processing unit in data exchange with the storage medium, for executing the computer program through the processing unit when generating vehicle trajectory data, performing the steps of the vehicle trajectory generation method based on the diffusion model and the lightweight federated learning of claim 1. 3.A computer readable storage medium, characterized in that: The computer readable storage medium stores a computer program; The computer program, when executed, performs the steps of the vehicle trajectory generation method based on the diffusion model and the lightweight federated learning of claim 1.