Traffic flow prediction method, device, equipment, storage medium and program product

By matching the traffic flow characteristics in the target city with the pre-acquisitioned traffic pattern and adjusting the network model parameters, combined with the generation adversarial network and meta-learning, the problem of poor accuracy of cross-city traffic flow prediction is solved, and more accurate traffic flow prediction and management is achieved.

CN120496324APending Publication Date: 2025-08-15CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510750305.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing urban traffic flow prediction model has poor prediction accuracy when there is a large difference between the traffic flow characteristics of the target city and the acquired traffic data.

Method used

By obtaining the traffic flow characteristics of the target city and matching the pre-acquisitioned traffic patterns, adjusting the parameters of the pre-trained network model, using the generative adversarial network to generate traffic prediction results, combining meta-learning ideas and clustering technology, a joint pre-training framework for multi-sub-tasks is constructed to realize traffic flow transfer learning across cities.

Benefits of technology

It improves the accuracy of traffic flow prediction, reduces prediction error by 20%, saves model training and inference time by 50%, and improves the efficiency and safety of urban traffic management and planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120496324A_ABST
    Figure CN120496324A_ABST
Patent Text Reader

Abstract

The invention provides a traffic flow prediction method and device, equipment, a storage medium and a program product, and relates to the technical field of artificial intelligence, and the method comprises the steps: obtaining a first traffic flow feature which is a traffic flow feature of a first region; matching the first traffic flow characteristic with a pre-acquired traffic mode to obtain a matching result; performing first adjustment on parameters of a pre-trained network model according to the matching result, wherein the pre-trained network model is obtained by training according to the traffic mode; and generating a traffic prediction result of the first region based on the network model after the first adjustment. According to the embodiment of the invention, the parameters of the pre-trained network model are adjusted according to the matching result of the traffic flow characteristics of the first region and the existing traffic mode, so that the network model can predict the traffic flow according to the traffic mode of the first region, and the traffic flow prediction accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a traffic flow prediction method, apparatus, device, storage medium, and program product. Background Art

[0002] Urban traffic flow is a crucial data source for sensing dynamic urban changes and understanding the state of urban traffic operations. Therefore, accurate and in-depth modeling of urban traffic flow plays an indispensable role in rational urban transportation planning and even in building smart city perception systems.

[0003] Currently, urban traffic flow prediction models are generally applicable to cities with traffic flow characteristics similar to those of the acquired traffic data. However, when the traffic flow characteristics of the target city differ significantly from the acquired traffic data, the accuracy of traffic flow prediction is poor. Summary of the Invention

[0004] The embodiments of the present application provide a traffic flow prediction method, apparatus, device, storage medium, and program product to address the problem of poor accuracy of traffic flow prediction when traffic flow characteristics differ significantly from acquired traffic data.

[0005] To solve the above technical problems, this application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides a traffic flow prediction method, the method comprising:

[0007] Acquire a first traffic flow characteristic, where the first traffic flow characteristic is a traffic flow characteristic of a first area;

[0008] Matching the first traffic flow feature with a pre-acquired traffic pattern to obtain a matching result;

[0009] performing a first adjustment on parameters of a pre-trained network model according to the matching result, wherein the pre-trained network model is trained according to the traffic pattern;

[0010] A traffic prediction result for the first area is generated based on the first adjusted network model.

[0011] Optionally, obtaining the first traffic flow characteristic of the first area includes:

[0012] dividing the first region into a plurality of areas;

[0013] Acquire traffic flow characteristics of each area in the first region, wherein the traffic flow characteristics include at least one of traffic demand, traffic inflow, and flow speed;

[0014] Based on the traffic flow characteristics of each area in the first area, a first traffic flow characteristic of the first area is determined.

[0015] Optionally, matching the first traffic flow feature with a pre-acquired traffic pattern to obtain a matching result includes:

[0016] Encoding the first traffic flow feature and the pre-acquired traffic pattern respectively to obtain an encoding result of the first traffic flow feature and an encoding result of the traffic pattern;

[0017] Based on the similarity between the encoding result of the first traffic flow feature and the encoding result of the traffic pattern, a first traffic pattern matching the first traffic flow feature is determined from the pre-acquired traffic patterns.

[0018] Optionally, the network model includes a generative network and an adversarial network; after first adjusting the parameters of the pre-trained network model according to the matching result, the method further includes:

[0019] generating first traffic data using the generated network after the first adjustment;

[0020] Using the first adjusted adversarial network to determine whether the first traffic data conforms to a traffic distribution to obtain a first determination result, and performing a second adjustment on parameters of the first adjusted generative network based on the first determination result;

[0021] Generating a traffic prediction result for the first area using the first adjusted network model includes:

[0022] The traffic prediction result for the first area is generated by using the second adjusted generation network.

[0023] Optionally, the method further includes:

[0024] dividing the second region into zones;

[0025] determining a second traffic pattern in the second region based on traffic flow characteristics of the plurality of areas in the second region;

[0026] The second traffic pattern is input into the network model to be trained to obtain the trained network model, where the network model includes a generative network and an adversarial network.

[0027] Optionally, determining the second traffic mode of the second area according to the traffic flow characteristics of the multiple areas includes:

[0028] obtaining traffic flow characteristics of a plurality of areas in the second region;

[0029] Clustering is performed on the multiple regions of the second region based on traffic flow characteristics of the multiple regions of the second region to obtain multiple clusters, where the cluster center of each cluster is used to represent a traffic mode, and the second traffic mode of the second region includes at least one traffic mode.

[0030] Optionally, inputting the second traffic pattern into a network model to be trained for training to obtain the trained network model includes:

[0031] Inputting the second traffic mode into the network model to be trained, wherein the second traffic mode includes at least two traffic modes, and each traffic mode corresponds to a subtask set;

[0032] A third adjustment is performed on the network model parameters corresponding to each of the subtask sets to obtain the trained network model.

[0033] Optionally, inputting the second traffic pattern into a network model to be trained for training to obtain the trained network model includes:

[0034] inputting the second traffic pattern into the generation network for learning, and generating second traffic data using the learned generation network;

[0035] Using the adversarial network to determine whether the second traffic data conforms to the traffic distribution to obtain a second determination result;

[0036] Based on the second judgment result, the parameters of the generated network are adjusted to obtain the trained network model.

[0037] In a second aspect, an embodiment of the present application provides a traffic flow prediction device, the device comprising:

[0038] an acquisition module, configured to acquire a first traffic flow characteristic, wherein the first traffic flow characteristic is a traffic flow characteristic of a first area;

[0039] a matching module, configured to match the first traffic flow feature with a pre-acquired traffic pattern to obtain a matching result;

[0040] an adjustment module, configured to perform a first adjustment on parameters of a pre-trained network model according to the matching result, wherein the pre-trained network model is trained according to the traffic pattern;

[0041] A first generating module is configured to generate a traffic prediction result for the first area based on the first adjusted network model.

[0042] In a third aspect, an embodiment of the present application provides an electronic device comprising: a processor, a memory, and a program stored on the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the traffic flow prediction method described in the first aspect.

[0043] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the traffic flow prediction method described in the first aspect are implemented.

[0044] In a fifth aspect, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of the traffic flow prediction method as described in the first aspect.

[0045] In an embodiment of the present application, the parameters of the pre-trained network model are adjusted based on the matching results of the traffic flow characteristics of the first area and the existing traffic pattern, so that the network model can predict the traffic flow in the first area based on the traffic pattern of the first area, thereby improving the accuracy of traffic flow prediction. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0047] Figure 1 This is one of the flow charts of a traffic flow prediction method provided in an embodiment of the present application;

[0048] Figure 2 This is the second flow chart of a traffic flow prediction method provided in an embodiment of the present application;

[0049] Figure 3 is a schematic diagram of a traffic flow prediction method provided in an embodiment of the present application;

[0050] Figure 4 This is a schematic diagram of the structure of a traffic flow prediction device provided in an embodiment of the present application;

[0051] Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0053] Traffic flow transfer learning is to learn general knowledge about urban traffic by pre-training in cities with rich traffic flow data, and then transfer this knowledge to cities with missing data to effectively model the traffic flow in that city.

[0054] Related technologies include a model migration optimization strategy based on real-time data, the core of which is to use the encoding part of a pre-trained efficient crowd flow prediction network as a feature extraction module in real-time prediction tasks. This strategy promotes the cross-time transfer of knowledge by intelligently implementing a transfer learning mechanism between features at different levels. Finally, the expectation-maximization algorithm (EM) is used to finely solve the target model parameters, construct a target domain model that adapts to the needs of real-time prediction, and successfully apply the results of transfer learning to actual prediction tasks. It targets the real-time challenge of traffic flow prediction in the same city and optimizes the prediction efficiency by migrating the model in different time windows in the same city. Since the data distribution within these time windows has a high degree of similarity, the feasibility and effectiveness of model migration are ensured. However, when dealing with scenarios where the distribution of two data is significantly different, it is difficult to migrate in complex scenarios such as across domains or cities.

[0055] Other technologies include a spatiotemporal commonality feature learning module and a spatiotemporal migration prediction module based on a generative adversarial network. These modules use a generative adversarial network to learn the spatiotemporal commonality features of different types of source domain data under the same spatiotemporal conditions. A prediction model is then built, minimizing the prediction loss function to bring the predicted values of the spatiotemporal prediction model close to the true values, thereby optimizing the parameters of the entire prediction model. Finally, the spatiotemporal prediction model pre-trained on the source data is migrated to target domain data that shares spatiotemporal commonality features with the source data. Only a small number of iterative training iterations are required to obtain the target domain model parameters. However, this approach also struggles to directly address the challenges of cross-city migration learning, where data distribution varies significantly.

[0056] In addition, a technology that learns the distribution of real spatiotemporal data through an adversarial process to enhance the predictive model's ability to learn data representations. This technology addresses the problem that the original generative adversarial network model uses JS divergence, which cannot effectively measure the difference between distributions, causing the generator loss to become a fixed value and causing gradient vanishing. This technology proposes using a generative adversarial network (WassersteinGAN, WGAN) as an adversarial learning framework and using Wasserstein distance instead of JS divergence as the optimization target. This can more effectively measure the difference between the real data distribution and the generated data distribution. However, this solution can only make the traffic pattern generated by the generator have a similar distribution to the traffic pattern of the training data, and cannot be applied to scenarios where the traffic pattern of the training data and the migration data differ significantly.

[0057] None of the aforementioned solutions capture the traffic flow characteristics of multiple source cities. Instead, they use a single source city as the training target and model that city's traffic patterns through deep neural networks. This results in an inability to capture unique traffic patterns in other cities. Furthermore, these solutions can only perform transfer learning on cities with the same traffic distribution as the source city. For cities with significantly different traffic patterns or time periods with significantly different traffic flow characteristics, they are unable to effectively match and transfer traffic flow knowledge.

[0058] The embodiments of the present application provide a traffic flow prediction method, apparatus, device, storage medium, and program product to solve the problem of poor accuracy of traffic flow prediction when there is a large difference between traffic flow characteristics and acquired traffic data.

[0059] See also Figure 1 , Figure 1 This is a flow chart of a traffic flow prediction method provided by an embodiment of the present application. Figure 1 As shown, the method includes the following steps:

[0060] Step 101: Acquire a first traffic flow characteristic, where the first traffic flow characteristic is a traffic flow characteristic of a first area;

[0061] Step 102: Match the first traffic flow feature with the pre-acquired traffic pattern to obtain a matching result;

[0062] Step 103: performing a first adjustment on parameters of a pre-trained network model according to the matching result, where the pre-trained network model is trained according to the traffic pattern;

[0063] Step 104: Generate a traffic prediction result for the first area based on the first adjusted network model.

[0064] The traffic flow characteristics can be used to reflect the traffic flow status of the first region (eg, the target city), including vehicle volume, vehicle speed, traffic demand, and the like.

[0065] Traffic flow characteristics can be obtained through historical traffic data, or traffic flow data collected in real time through traffic cameras or other equipment; the first area can also be divided into grids, and the traffic demand, flow and other characteristics of each grid can be counted to obtain the traffic flow characteristics of the first area.

[0066] The pre-acquired traffic pattern may be a traffic pattern obtained by clustering traffic flow characteristics of the second area, wherein the traffic pattern may be, for example, morning rush hour, heavy traffic volume and low speed.

[0067] The pre-acquired traffic pattern may also be a traffic pattern output by a network model. For example, the network model outputs the traffic pattern after acquiring a real traffic pattern for learning.

[0068] The traffic flow characteristics of the first area are matched with the existing traffic pattern, thereby obtaining a traffic pattern that matches the traffic flow characteristics of the first area.

[0069] In some implementations, traffic flow characteristics of the first region are clustered to obtain a traffic pattern, which is then matched with an existing traffic pattern.

[0070] In some embodiments, the similarity between the traffic flow characteristics of the first area and a preset traffic pattern is calculated, thereby matching with the existing traffic pattern.

[0071] In some implementations, the traffic flow characteristics and the preset traffic pattern of the first area are encoded respectively, and traffic pattern matching is performed based on the encoding results.

[0072] When training the network model, the previously acquired traffic pattern can be input into the network model for training, so that the network model learns the correlation between the traffic flow characteristics and the traffic pattern, thereby obtaining a trained network model. When a traffic pattern matching the first traffic flow characteristic is obtained, the parameters of the trained network model are adjusted based on the matching result (i.e., the first adjustment).

[0073] For example, the parameters of the generated network are dynamically adjusted according to the matching results (such as the "morning rush hour" mode) so that it generates traffic data that is closer to the target city.

[0074] The network model includes a generative adversarial network (GAN), which is a deep learning model consisting of two parts: a generative network and a discriminative network. The generative network is responsible for generating simulated data, and the discriminative network is responsible for judging whether the input data is real or generated. The relationship between the two forms an adversarial relationship, and the effects of both are optimized simultaneously during the training process, so that the discriminator optimizes the accuracy of the judgment, while the generator can generate data that is closer to the real distribution. In this embodiment, the generative network generates traffic flow data based on the adjusted parameters, and the adversarial network verifies the authenticity of the generated data. According to the authenticity, the parameters of the generative network can be adjusted again, and so on. The cycle makes the traffic flow data generated by the generative network more accurate.

[0075] Through traffic pattern matching and parameter adjustment, the model can quickly adapt to the traffic patterns of different cities. Using the generative network with adjusted parameters to generate traffic flow data for the target city can improve the accuracy of traffic flow prediction.

[0076] Through this traffic pattern matching and fine-tuning training (i.e., the first adjustment), the model can quickly adapt to the traffic pattern of the target city, provide more accurate and real-time decision support for urban traffic management and planning, and effectively improve the efficiency and safety of urban traffic.

[0077] Optionally, obtaining the first traffic flow characteristic of the first area includes:

[0078] dividing the first region into a plurality of areas;

[0079] Acquire traffic flow characteristics of each area in the first region, wherein the traffic flow characteristics include at least one of traffic demand, traffic inflow, and flow speed;

[0080] Based on the traffic flow characteristics of each area in the first area, a first traffic flow characteristic of the first area is determined.

[0081] For example, the target city is divided into grid areas of fixed size, and the traffic demand, traffic inflow, and flow speed of each area are counted.

[0082] The traffic flow characteristics of multiple regions are integrated into the overall traffic flow characteristics of the first region.

[0083] Optionally, matching the first traffic flow feature with a pre-acquired traffic pattern to obtain a matching result includes:

[0084] Encoding the first traffic flow feature and the pre-acquired traffic pattern respectively to obtain an encoding result of the first traffic flow feature and an encoding result of the traffic pattern;

[0085] Based on the similarity between the encoding result of the first traffic flow feature and the encoding result of the traffic pattern, a first traffic pattern matching the first traffic flow feature is determined from the pre-acquired traffic patterns.

[0086] In some embodiments, the discriminator Di of the adversarial network of the network model is used Body Layer, encode the first traffic flow feature and the pre-acquired traffic pattern to obtain the encoded representation of the two (i.e., the encoding result):

[0087] v=Di Body (x,d),vm=Di Body (mx,md)

[0088] Among them, x represents the traffic state characteristics, d represents the traffic demand;

[0089] v and m represent the encoded representations of the first traffic flow feature and traffic mode, respectively;

[0090] mx and md represent the cluster centers after clustering traffic flow characteristics.

[0091] In order to make the traffic data of the target city show a more obvious traffic pattern, the loss function is designed Make the traffic flow characteristic data representation and cluster characteristic center representation as similar as possible. The specific formula is as follows:

[0092]

[0093] Where E[] represents the expected value.

[0094] When the loss function converges, a first traffic pattern matching the first traffic flow characteristic is obtained. Through the above method, the accuracy of traffic pattern recognition is improved.

[0095] Optionally, the network model includes a generative network and an adversarial network; after first adjusting the parameters of the pre-trained network model according to the matching result, the method further includes:

[0096] generating first traffic data using the generated network after the first adjustment;

[0097] Using the first adjusted adversarial network to determine whether the first traffic data conforms to a traffic distribution to obtain a first determination result, and performing a second adjustment on parameters of the first adjusted generative network based on the first determination result;

[0098] Generating a traffic prediction result for the first area using the first adjusted network model includes:

[0099] The traffic prediction result for the first area is generated by using the second adjusted generation network.

[0100] The first traffic data generated by the generative network after the first adjustment can meet the traffic flow characteristics of the target city (i.e., the first region). To further improve the accuracy of the traffic data generated by the generative network, an adversarial network is used to verify the authenticity of the traffic data generated by the generative network. Based on the first judgment result of the adversarial network, the parameters of the generative network are further adjusted, i.e., the second adjustment.

[0101] The first adjusted generation network can enable the generation network to transfer the traffic flow characteristics learned in other regions to the first region and conform to the traffic flow characteristics of the first region; the second adjusted generation network can more accurately generate traffic data, that is, traffic prediction results.

[0102] Optionally, the method further includes:

[0103] dividing the second region into zones;

[0104] determining a second traffic pattern in the second region based on traffic flow characteristics of the plurality of areas in the second region;

[0105] The second traffic pattern is input into the network model to be trained to obtain the trained network model, where the network model includes a generative network and an adversarial network.

[0106] The executing entity of this embodiment may be the same as or different from the executing entity of the above embodiment.

[0107] Traffic flow characteristics of multiple areas in the second region are obtained, and traffic patterns are determined by clustering based on the traffic flow characteristics.

[0108] In some implementations, the acquired traffic pattern is input into a network model for training, so that the network model learns the characteristics of the traffic pattern.

[0109] In some implementations, the second traffic pattern and the corresponding traffic flow characteristics are input into the network model for training, so that the network model learns the traffic flow characteristics and the corresponding traffic pattern.

[0110] Based on the relationship between traffic flow characteristics and traffic patterns, the trained generative network can generate traffic flow based on the input traffic pattern, thereby predicting the traffic flow of the target city.

[0111] Optionally, determining the second traffic mode of the second area according to the traffic flow characteristics of the multiple areas includes:

[0112] obtaining traffic flow characteristics of a plurality of areas in the second region;

[0113] Clustering is performed on the multiple regions of the second region based on traffic flow characteristics of the multiple regions of the second region to obtain multiple clusters, where the cluster center of each cluster is used to represent a traffic mode, and the second traffic mode of the second region includes at least one traffic mode.

[0114] The second region and the first region are two different regions. After obtaining the traffic flow characteristic data of the second region, the network model learns the traffic flow characteristic data of the second region and migrates it to the first region.

[0115] Cluster multiple areas based on traffic flow characteristics. For example, traffic flow characteristics are input into the K-means model to generate clusters such as "morning rush hour", "holidays", and "late night", with each cluster center representing a traffic mode.

[0116] In this way, discrete traffic flow features can be effectively aggregated into clusters, thereby comprehensively capturing the complex and ever-changing traffic flow knowledge in multi-source cities, significantly improving the accuracy of traffic pattern recognition.

[0117] Optionally, inputting the second traffic pattern into a network model to be trained for training to obtain the trained network model includes:

[0118] Inputting the second traffic mode into the network model to be trained, wherein the second traffic mode includes at least two traffic modes, and each traffic mode corresponds to a subtask set;

[0119] A third adjustment is performed on the network model parameters corresponding to each of the subtask sets to obtain the trained network model.

[0120] After building the network model, multiple secondary traffic patterns are fed into the meta-learning pre-training framework to pre-train the generative adversarial network. Each secondary traffic pattern corresponds to a subtask set. A finite number of gradient updates are performed on the generative adversarial network on each subtask dataset, performing a third adjustment on the network model parameters to obtain a trained network model.

[0121] Through the above method, the gap between the parameters updated by finite-step gradients and the initial parameters of the model in different sub-task data sets can be reduced, so that the generative adversarial network can obtain better initial parameters, so that better optimization effects can be achieved by updating with a small number of samples on new sub-tasks.

[0122] This implementation builds a traffic pattern pre-training framework based on meta-learning. This framework divides clusters of traffic flow data from multiple cities into multiple subtask sets and performs pre-training on these subtasks to obtain effective initialization parameters for the model. This pre-training framework significantly improves the model's generalization across different city traffic patterns, providing a more robust and efficient foundation for subsequent modeling of target city traffic patterns.

[0123] Optionally, the second traffic pattern is input into the generation network for learning, and the learned generation network is used to generate second traffic data;

[0124] Using the adversarial network to determine whether the second traffic data conforms to the traffic distribution to obtain a second determination result;

[0125] Based on the second judgment result, the parameters of the generated network are adjusted to obtain the trained network model.

[0126] During training, the generative network generates traffic data, and the adversarial network verifies the authenticity of the generated traffic data, generating a second judgment result. If the adversarial network identifies the traffic data as generated, the parameters of the generative network are adjusted based on the second judgment result. This repeated process makes the traffic data generated by the generative network more accurate.

[0127] As a specific embodiment of this application, Figure 2 and Figure 3 As shown, the following steps are included:

[0128] S1. Divide the city into grids and organize traffic demand, flow, and flow speed into grid characteristics. Specifically include:

[0129] Step S1.1: Divide the second region into grids. For example, divide the city into m1×m2 rectangular grids, with the grid number s. ij , where i and j represent the horizontal and vertical coordinates of the grid respectively.

[0130] Step S1.2: Collect the data of taxi trips in the city and map the trip data to a grid according to longitude and latitude. The total number of taxi boarding and alighting events in the grid is counted as the traffic demand matrix The taxis arriving at the grid / staying in the grid are regarded as inflow, and the flow rate is calculated according to the travel distance and time. The traffic state matrix is constructed by combining the inflow and flow rate. (i.e. traffic flow characteristics).

[0131] When multiple cities are obtained, the traffic flow characteristics of each city can be obtained.

[0132] S2. A traffic pattern clustering module is constructed based on the K-means algorithm. Discrete traffic flow features are used as clustering objects, and traffic nodes are clustered in the feature space. Each cluster center represents a traffic pattern, and multiple traffic patterns can be obtained.

[0133] Specifically include:

[0134] Step S2.1: Use the traffic demand and traffic status of the regional grid as the characteristic coordinates tr i =(d i ,x i ), where d i is the total traffic demand of the i-th regional grid, x i For the traffic state characteristics of the i-th regional grid, set the cluster C = {C1, C2, ..., C k}, where the number k is a hyperparameter, and the cluster center is initialized to trm j (md j ,mx j )(1≤j≤k);

[0135] Step S2.2: Calculate the distance between the feature point and the cluster center of each grid area, add the regional feature point to the cluster closest to the cluster center, and then update the cluster center coordinates to:

[0136]

[0137] Among them, d i is the total traffic demand of the i-th regional grid, x i is the traffic state characteristics of the i-th regional grid, |C j | represents the number of feature points in the jth cluster. Repeat the above steps until the cluster center no longer changes. At this point, the algorithm obtains multiple cluster centers in the traffic feature space, i.e., cluster centers, each of which represents a traffic mode.

[0138] S3. Build a traffic flow pattern generative adversarial network.

[0139] Step S3.1: Build a traffic flow pattern generator Ge. The goal of the generator Ge is to learn the actual traffic state distribution x (i.e., the traffic pattern of the first region or the second region). The generator accepts the traffic demand d and a noise z sampled from a Gaussian distribution as input and generates a simulated regional traffic state distribution x'~Ge(z,d);

[0140] Step S3.2: Construct a traffic flow pattern discriminator Di. The discriminator receives the real traffic demand d of the area and a traffic state distribution x to be determined as input. Then, through Di Body The layer outputs the representation v of the traffic demand and traffic status, and finally the representation v is passed through Di HeadThe layer obtains a discrimination score (i.e., the second judgment result). The larger the score, the more likely the input traffic state is to be a real traffic state, and vice versa, the more likely it is to be a traffic state generated by the generator.

[0141] Step S3.3: Construct a loss function for adversarial training to optimize the generative adversarial network. Basic adversarial generation loss function for:

[0142]

[0143] Among them, x~p data represents the actual traffic state distribution, and z~p z represents the noise sampled according to Gaussian distribution, z represents the noise, and d is the traffic demand.

[0144] In order to improve the generation quality of the generator, this method also introduces the regularization loss L1:

[0145]

[0146] The optimization process of adversarial training is a game process. The goal of the generator is to generate samples that are as similar as possible to the true distribution, while the goal of the discriminator is to distinguish samples as accurately as possible. Therefore, the optimization goal of the generative adversarial network is:

[0147]

[0148] Among them, α is a hyperparameter that introduces L1 regularization loss.

[0149] By adjusting the parameters of the generated network in the above manner, the optimization goal is finally achieved, thereby improving the accuracy of the traffic data generated by the generated network.

[0150] S4. Build a meta-learning pre-training framework to pre-train the generative adversarial network.

[0151] Meta-learning is a specialized term in computer science that describes the process of constructing a set of subtasks and pre-training to obtain better model initialization parameters, so that the model can be fine-tuned on a new test task with a small amount of data and trained iteratively more quickly to achieve better results.

[0152] Step S4.1: Use the traffic flow data from the second region (e.g., multi-city source) to divide the clusters formed by clustering into subtask sets T = {T1, T2, ..., T k}, after constructing the above generative adversarial network, initialize the parameters of the generator Ge and the discriminator Di to θ Ge and θ Di .

[0153] Step S4.2: Perform a finite-step gradient update on the generative adversarial network on each subtask dataset (i.e., perform a third adjustment on the parameters of the network model). Let the parameters of the generator Ge and the discriminator Di be φ during the update process. Ge and φ Di , the gradient update formula is:

[0154]

[0155] θ Di =θ Di +λ(θ Di -φ Di )

[0156]

[0157] θ Ge =θ Ge +λ(θ Ge -φ Ge )

[0158] Where η and λ represent the step size of the generator or discriminator parameter update.

[0159] The goal of pre-training is to reduce the gap between the parameters updated by the finite-step gradient and the initial parameters in different sub-task datasets, so that the generative adversarial network can obtain better initial parameters, and thus achieve better optimization results on new sub-tasks after updating with a small number of samples. The overall optimization goal of pre-training is:

[0160]

[0161] Among them, T j represents the j-th subtask set.

[0162] S5. Build a traffic pattern clustering matcher to fine-tune traffic flow learning in the target city.

[0163] Step S5.1: Construct a traffic pattern cluster matcher. In order to make the update on the target city present a more significant traffic pattern, the Di of the traffic flow pattern discriminator Di in step S3.2 is used. Body Layer, encode the traffic features of the target data and the cluster feature centers in step S2.2 to obtain the encoded representations of the two.

[0164] Step S5.2: Initialize the generative adversarial network with the parameters pre-trained in step S4.1, and perform fine-tuning training on the target city data, i.e., make the first adjustment to the model parameters. The adversarial optimization objectives of fine-tuning are as follows:

[0165]

[0166] Among them, α and β represent the weights of L1 loss and Lc loss, respectively.

[0167] During fine-tuning, the parameters are updated by gradient descent on the target city’s data. The specific formula is as follows:

[0168]

[0169] Through fine-tuning, a generator that perceives the traffic pattern of the target city is obtained, and the generator can be used to predict the traffic flow of the target city.

[0170] This embodiment of the present application collects traffic flow data from multiple source cities and utilizes clustering techniques to derive patterns of traffic flow in various cities, enabling more comprehensive and effective learning of complex urban traffic flow knowledge. This allows for multi-regional, multi-modal modeling of complex urban traffic flow. After acquiring complex knowledge of urban traffic flow, a multi-task joint pre-training framework and a target city traffic flow matching module are designed to enable effective transfer learning for target cities with scarce data. For target cities with significantly different traffic flow characteristics, accurate matching and effective transfer are achieved.

[0171] Through the above approach, it is possible to capture more diverse traffic flow patterns in multiple cities, thereby achieving more accurate traffic pattern migration and modeling. At the same time, through pattern clustering methods and pattern clustering matchers, the technical problem of different traffic patterns in the source city and the target city can be solved. In addition, by expanding the traffic flow data source, the model can learn more complex and diverse traffic patterns. Combined with precise pattern matching methods, the error in traffic flow prediction is reduced by 20%. The multi-subtask joint pre-training framework and target city traffic flow matching module built at the same time improve the efficiency of target city traffic flow prediction, saving more than 50% of model training and inference time. It realizes the cross-city migration of complex urban traffic flow knowledge, especially improving the prediction effect in data-scarce cities with large differences in traffic flow patterns.

[0172] In an embodiment of the present application, a traffic pattern clustering method is used in adversarial training generated by data from different cities. A traffic pattern pre-training framework is then built based on clustering subtasks and meta-learning ideas. Finally, a cluster matcher is constructed to match the traffic flow of the target city with the clustered traffic pattern, and fine-tuning training is performed on the target city data to address the limitations of related technologies in that only the traffic flow characteristics of a single city can be captured and transfer learning can only be performed to cities with the same traffic pattern.

[0173] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a traffic flow prediction device provided by an embodiment of the present application. Figure 4As shown, the traffic flow prediction device 400 includes:

[0174] An acquisition module 401 is configured to acquire a first traffic flow characteristic, where the first traffic flow characteristic is a traffic flow characteristic of a first region;

[0175] A matching module 402 is configured to match the first traffic flow feature with a pre-acquired traffic pattern to obtain a matching result;

[0176] An adjustment module 403 is configured to perform a first adjustment on parameters of a pre-trained network model according to the matching result, where the pre-trained network model is trained according to the traffic pattern;

[0177] The first generating module 404 is configured to generate a traffic prediction result for the first region based on the first adjusted network model.

[0178] Optionally, the acquisition module includes:

[0179] a division submodule, configured to divide the first region into a plurality of areas;

[0180] a first acquisition submodule, configured to acquire traffic flow characteristics of each area in the first region, wherein the traffic flow characteristics include at least one of traffic demand, traffic inflow, and flow speed;

[0181] The first determining submodule is configured to determine a first traffic flow characteristic of the first region based on the traffic flow characteristic of each area in the first region.

[0182] Optionally, the matching module includes:

[0183] an encoding submodule, configured to encode the first traffic flow feature and the pre-acquired traffic pattern respectively, to obtain an encoding result of the first traffic flow feature and an encoding result of the traffic pattern;

[0184] The second determining submodule is configured to determine a first traffic pattern matching the first traffic flow feature from the pre-acquired traffic patterns based on similarities between the encoding result of the first traffic flow feature and the encoding result of the traffic pattern.

[0185] Optionally, the network model includes a generative network and an adversarial network; and the apparatus further includes:

[0186] A second generating module, configured to generate first traffic data using the generated network after the first adjustment;

[0187] a judgment module, configured to use the first adjusted adversarial network to determine whether the first traffic data conforms to the traffic distribution to obtain a first judgment result, and to perform a second adjustment on the parameters of the first adjusted generative network based on the first judgment result;

[0188] The first generating module is specifically configured to:

[0189] The traffic prediction result for the first area is generated by using the second adjusted generation network.

[0190] Optionally, the device further comprises:

[0191] a division module, configured to divide the second region into a plurality of areas;

[0192] a determining module, configured to determine a second traffic mode of the second region based on traffic flow characteristics of a plurality of areas in the second region;

[0193] The training module is used to input the second traffic mode into the network model to be trained to obtain the trained network model, where the network model includes a generative network and an adversarial network.

[0194] Optionally, the determining module includes:

[0195] a second acquisition submodule, configured to acquire traffic flow characteristics of a plurality of areas in the second region;

[0196] The clustering submodule is used to cluster the multiple areas of the second area based on the traffic flow characteristics of the multiple areas of the second area to obtain multiple clusters, where the cluster center of each cluster is used to represent a traffic mode, and the second traffic mode of the second area includes at least one traffic mode.

[0197] Optionally, the training module includes:

[0198] A first input submodule is configured to input the second traffic mode into the network model to be trained, wherein the second traffic mode includes at least two traffic modes, and each traffic mode corresponds to a subtask set;

[0199] The first adjustment submodule is used to perform a third adjustment on the network model parameters corresponding to each of the subtask sets to obtain the trained network model.

[0200] Optionally, the training module includes:

[0201] a second input submodule, configured to input the second traffic pattern into the generation network for learning, and generate second traffic data using the learned generation network;

[0202] a judgment submodule, configured to use the adversarial network to determine whether the second traffic data conforms to the traffic distribution to obtain a second judgment result;

[0203] A generation submodule is used to adjust the parameters of the generation network based on the second judgment result to obtain the trained network model.

[0204] Traffic flow prediction device can achieve Figure 1 The various processes implemented in the method embodiment can achieve the same technical effect, and to avoid repetition, they will not be described here.

[0205] It should be noted that the electronic device provided in the embodiments of this application is a device capable of performing the above-mentioned traffic flow prediction. Therefore, all implementation methods in the above-mentioned traffic flow prediction method embodiments are applicable to the electronic device and can achieve the same or similar beneficial effects. To avoid repetition, this embodiment will not be further described.

[0206] The embodiment of the present application also provides an electronic device. Since the principle of solving the problem by the electronic device is similar to the traffic flow prediction method in the embodiment of the present application, the implementation of the electronic device can refer to the implementation of the method, and the repeated parts will not be repeated. Figure 5 As shown, the electronic device of the embodiment of the present application includes: a processor 500, which is used to read the program in the memory 520 and execute the following process:

[0207] Acquire a first traffic flow characteristic, where the first traffic flow characteristic is a traffic flow characteristic of a first area;

[0208] Matching the first traffic flow feature with a pre-acquired traffic pattern to obtain a matching result;

[0209] performing a first adjustment on parameters of a pre-trained network model according to the matching result, wherein the pre-trained network model is trained according to the traffic pattern;

[0210] A traffic prediction result for the first area is generated based on the first adjusted network model.

[0211] The transceiver 510 is configured to receive and send data under the control of the processor 500 .

[0212] Among them, Figure 5In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking together various circuits of one or more processors represented by processor 500 and memory represented by memory 520. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are all well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 510 may be a plurality of components, i.e., a transmitter and a transceiver, providing a unit for communicating with various other devices on a transmission medium. The processor 500 is responsible for managing the bus architecture and general processing, and the memory 520 may store data used by the processor 500 when performing operations.

[0213] Optionally, the processor 500 reads a program in the memory 520 and executes the step of obtaining the first traffic flow characteristic of the first area, including:

[0214] dividing the first region into a plurality of areas;

[0215] Acquire traffic flow characteristics of each area in the first region, wherein the traffic flow characteristics include at least one of traffic demand, traffic inflow, and flow speed;

[0216] Based on the traffic flow characteristics of each area in the first area, a first traffic flow characteristic of the first area is determined.

[0217] Optionally, the processor 500 reads a program in the memory 520 and executes the matching of the first traffic flow feature with the pre-acquired traffic pattern to obtain a matching result, including:

[0218] Encoding the first traffic flow feature and the pre-acquired traffic pattern respectively to obtain an encoding result of the first traffic flow feature and an encoding result of the traffic pattern;

[0219] Based on the similarity between the encoding result of the first traffic flow feature and the encoding result of the traffic pattern, a first traffic pattern matching the first traffic flow feature is determined from the pre-acquired traffic patterns.

[0220] Optionally, the network model includes a generative network and an adversarial network; the processor 500 is further configured to read a program in the memory 520 and execute:

[0221] generating first traffic data using the generated network after the first adjustment;

[0222] Using the first adjusted adversarial network to determine whether the first traffic data conforms to a traffic distribution to obtain a first determination result, and performing a second adjustment on parameters of the first adjusted generative network based on the first determination result;

[0223] Generating a traffic prediction result for the first area using the first adjusted network model includes:

[0224] The traffic prediction result for the first area is generated by using the second adjusted generation network.

[0225] Optionally, the processor 500 is further configured to read a program in the memory 520 and execute:

[0226] dividing the second region into zones;

[0227] determining a second traffic pattern in the second region based on traffic flow characteristics of the plurality of areas in the second region;

[0228] The second traffic pattern is input into the network model to be trained to obtain the trained network model, where the network model includes a generative network and an adversarial network.

[0229] Optionally, the processor 500 reads a program in the memory 520 and executes the step of determining the second traffic pattern in the second area according to the traffic flow characteristics of the multiple areas, including:

[0230] obtaining traffic flow characteristics of a plurality of areas in the second region;

[0231] Clustering is performed on the multiple regions of the second region based on traffic flow characteristics of the multiple regions of the second region to obtain multiple clusters, where the cluster center of each cluster is used to represent a traffic mode, and the second traffic mode of the second region includes at least one traffic mode.

[0232] Optionally, the processor 500 reads a program in the memory 520 and executes the step of inputting the second traffic pattern into the network model to be trained for training to obtain the trained network model, including:

[0233] Inputting the second traffic mode into the network model to be trained, wherein the second traffic mode includes at least two traffic modes, and each traffic mode corresponds to a subtask set;

[0234] A third adjustment is performed on the network model parameters corresponding to each of the subtask sets to obtain the trained network model.

[0235] Optionally, the processor 500 reads a program in the memory 520 and executes the step of inputting the second traffic pattern into the network model to be trained for training to obtain the trained network model, including:

[0236] Inputting the second traffic pattern into the generation network for learning, and using the learned generation network to generate second traffic data;

[0237] Using the adversarial network to determine whether the second traffic data conforms to the traffic distribution to obtain a second determination result;

[0238] Based on the second judgment result, the parameters of the generated network are adjusted to obtain the trained network model.

[0239] The electronic device provided in the embodiment of the present application can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated in this embodiment.

[0240] The present application also provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program implements the various processes of the above-described traffic flow prediction method embodiment and achieves the same technical effects. To avoid repetition, the details are not described here. The computer-readable storage medium may be, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0241] The present application also provides a computer program product including computer instructions, which, when executed by a processor, implement the above Figure 1 The various processes of the method embodiment shown can achieve the same technical effect, and to avoid repetition, they will not be described here.

[0242] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0243] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0244] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.

Claims

1. A traffic flow prediction method, characterized in that: include: Acquire a first traffic flow characteristic, where the first traffic flow characteristic is a traffic flow characteristic of a first area; Matching the first traffic flow feature with a pre-acquired traffic pattern to obtain a matching result; performing a first adjustment on parameters of a pre-trained network model according to the matching result, wherein the pre-trained network model is trained according to the traffic pattern; A traffic prediction result for the first area is generated based on the first adjusted network model.

2. The method according to claim 1, characterized in that The obtaining of the first traffic flow characteristic of the first area includes: dividing the first region into a plurality of areas; Acquire traffic flow characteristics of each area in the first region, wherein the traffic flow characteristics include at least one of traffic demand, traffic inflow, and flow speed; Based on the traffic flow characteristics of each area in the first area, a first traffic flow characteristic of the first area is determined.

3. The method according to claim 1, characterized in that The matching of the first traffic flow feature with the pre-acquired traffic pattern to obtain a matching result includes: Encoding the first traffic flow feature and the pre-acquired traffic pattern respectively to obtain an encoding result of the first traffic flow feature and an encoding result of the traffic pattern; Based on the similarity between the encoding result of the first traffic flow feature and the encoding result of the traffic pattern, a first traffic pattern matching the first traffic flow feature is determined from the pre-acquired traffic patterns.

4. The method according to claim 1, wherein The network model includes a generative network and an adversarial network; after first adjusting the parameters of the pre-trained network model according to the matching result, the method further includes: generating first traffic data using the generated network after the first adjustment; Using the first adjusted adversarial network to determine whether the first traffic data conforms to a traffic distribution to obtain a first determination result, and performing a second adjustment on parameters of the first adjusted generative network based on the first determination result; Generating a traffic prediction result for the first area using the first adjusted network model includes: The traffic prediction result for the first area is generated by using the second adjusted generation network.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: dividing the second region into zones; determining a second traffic pattern in the second region based on traffic flow characteristics of the plurality of areas in the second region; The second traffic pattern is input into the network model to be trained to obtain the trained network model, where the network model includes a generative network and an adversarial network.

6. The method according to claim 5, characterized in that The determining, based on the traffic flow characteristics of the plurality of areas, the second traffic mode in the second area includes: obtaining traffic flow characteristics of a plurality of areas in the second region; Clustering is performed on the multiple regions of the second region based on traffic flow characteristics of the multiple regions of the second region to obtain multiple clusters, where the cluster center of each cluster is used to represent a traffic mode, and the second traffic mode of the second region includes at least one traffic mode.

7. The method according to claim 5, characterized in that Inputting the second traffic mode into the network model to be trained for training to obtain the trained network model includes: Inputting the second traffic mode into the network model to be trained, wherein the second traffic mode includes at least two traffic modes, and each traffic mode corresponds to a subtask set; A third adjustment is performed on the network model parameters corresponding to each of the subtask sets to obtain the trained network model.

8. The method according to claim 5, characterized in that Inputting the second traffic mode into the network model to be trained for training to obtain the trained network model includes: Inputting the second traffic pattern into the generation network for learning, and using the learned generation network to generate second traffic data; Using the adversarial network to determine whether the second traffic data conforms to the traffic distribution to obtain a second determination result; Based on the second judgment result, the parameters of the generated network are adjusted to obtain the trained network model.

9. A traffic flow prediction device, characterized in that: include: an acquisition module, configured to acquire a first traffic flow characteristic, wherein the first traffic flow characteristic is a traffic flow characteristic of a first area; a matching module, configured to match the first traffic flow feature with a pre-acquired traffic pattern to obtain a matching result; an adjustment module, configured to perform a first adjustment on parameters of a pre-trained network model according to the matching result, wherein the pre-trained network model is trained according to the traffic pattern; A first generating module is configured to generate a traffic prediction result for the first area based on the first adjusted network model.

10. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the traffic flow prediction method according to any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the traffic flow prediction method according to any one of claims 1 to 8.

12. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the traffic flow prediction method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Traffic flow prediction method, device and equipment and computer storage medium

    CN111739285A

  • Traffic pre-training model construction method and device, traffic prediction method and device and electronic equipment

    CN116777046A

  • Traffic flow prediction method based on space-time diagram transfer learning

    CN116959258A

  • Urban traffic flow prediction method, system and equipment based on generative adversarial network

    CN116978218A

  • Diffusion model-based few-sample traffic flow prediction method, system and terminal

    CN119917907A