Traffic pre-training model construction and traffic prediction method, device and electronic equipment
By synthesizing real traffic data based on the synthetic model, generating synthetic traffic data, and using these data to train traffic pre-trained models, the problems of poor quality and small scale of traffic data in the existing technology are solved, and the universality and migration capabilities of the model are improved.
Patent Information
- Application Number
- CN202310532272.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2043-05-11
AI Technical Summary
The traffic data obtained in the prior art has problems such as poor data quality and small data scale, which cannot meet the data needs of the traffic prediction model, resulting in poor applicability of the model and difficulty in migration and deployment.
By using real traffic data to synthesize data based on the synthetic model, rich synthetic traffic data are generated, and the initial pre-trained model is trained using the synthetic traffic data to obtain the traffic pre-trained model. The synthetic model consists of a joint generator, a discriminator and an estimator. The generator is used to synthesize traffic data, the discriminator is used to discriminate data validity, and the estimator is used to predict traffic task.
By generating rich synthetic traffic data, it meets the data needs of model training, effectively solves the problems of poor quality and small scale of traffic data, improves the universality of traffic pre-trained models, and enables the model to meet the migration needs of traffic prediction tasks.
Smart Images

Figure CN116777046B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent transportation technology, and in particular to a method, device and electronic equipment for building a traffic pre-training model and predicting traffic. Background Art
[0002] Intelligent transportation system is a real-time, accurate and efficient intelligent transportation network management system. It effectively integrates advanced information technology, data communication technology, sensor technology, electronic control technology and computer technology. It is an effective means to solve traffic congestion and ensure the transportation safety of the transportation network. As one of the core functions of intelligent transportation system, traffic forecasting is the key technical support for realizing multiple intelligent transportation services such as traffic control and traffic guidance. Accurate and timely traffic forecasting is also a necessary condition for the effective implementation of personalized travel services such as route planning and congestion estimation.
[0003] However, due to the limited spatiotemporal coverage of physical detection equipment, the difficulty of equipment maintenance, and the occasional failures that may occur during data transmission and storage, such as data loss and data errors, the traffic data obtained may have problems such as poor data quality and small data size, which cannot meet the data requirements of model training, resulting in poor applicability of traffic prediction models and difficulty in migration and deployment. Summary of the invention
[0004] The present invention provides a traffic pre-training model construction and traffic prediction method, device and electronic equipment, which are used to solve the defects of poor data quality and small data scale of traffic data obtained in the prior art.
[0005] The present invention provides a method for constructing a traffic pre-training model, comprising:
[0006] Obtain real traffic data;
[0007] Based on the synthesis model, the real traffic data is applied to perform data synthesis to obtain synthetic traffic data; the synthesis model is obtained by training a joint generator, a discriminator and an estimator, the generator synthesizes second traffic data based on the first traffic data, the discriminator is used to judge the validity of the second traffic data, and the estimator performs traffic task prediction based on the second traffic data;
[0008] Based on the synthetic traffic data, the initial pre-training model is trained to obtain a traffic pre-training model.
[0009] According to a traffic pre-training model construction method provided by the present invention, the training step of the synthetic model includes:
[0010] Based on the generator, applying the first traffic data to synthesize the second traffic data;
[0011] Based on the discriminator, determining the validity of the second traffic data, and obtaining a determination result of the second traffic data;
[0012] Based on the estimator, performing traffic task prediction on the second traffic data to obtain a prediction result of the second traffic data;
[0013] Based on the first traffic data, the second traffic data, and the discrimination result and prediction result of the second traffic data, the parameters of the generator are iterated to obtain the synthetic model.
[0014] According to a method for constructing a traffic pre-training model provided by the present invention, the generator is iterated based on the first traffic data, the second traffic data, and the discrimination result and prediction result of the second traffic data to obtain the synthetic model, including:
[0015] Based on the data distribution difference between the first traffic data and the second traffic data, the discrimination result of the second traffic data, and the prediction result and task label of the second traffic data, the parameters of the generator are iterated to obtain the synthetic model.
[0016] According to a method for constructing a traffic pre-training model provided by the present invention, the initial pre-training model is trained based on the synthetic traffic data to obtain the traffic pre-training model, including:
[0017] Acquire road network data corresponding to the synthetic traffic data;
[0018] Constructing a road network topology map based on the road network data;
[0019] Based on the road network topology map and the synthetic traffic data, the initial pre-training model is trained to obtain a traffic pre-training model.
[0020] According to a method for constructing a traffic pre-training model provided by the present invention, obtaining real traffic data includes:
[0021] Get raw traffic data;
[0022] Performing data cleaning on the raw traffic data, and performing data aggregation on the cleaned raw traffic data to obtain aggregated traffic data at different time intervals;
[0023] The aggregated traffic data at the same time interval is normalized to obtain the real traffic data.
[0024] According to a method for constructing a traffic pre-training model provided by the present invention, the initial pre-training model is an encoder-decoder structure, wherein the scale of the encoder is larger than the scale of the decoder.
[0025] The present invention also provides a traffic prediction method, comprising:
[0026] Get historical traffic data;
[0027] Based on the traffic prediction model, applying the historical traffic data to perform traffic prediction;
[0028] The traffic prediction model is constructed based on a traffic pre-training model, and the traffic pre-training model is determined based on any of the traffic pre-training model construction methods described above.
[0029] The present invention also provides a traffic pre-training model construction device, comprising:
[0030] A data acquisition unit, used for acquiring real traffic data;
[0031] a data synthesis unit, configured to perform data synthesis based on a synthesis model and apply the real traffic data to obtain synthetic traffic data, wherein the synthesis model is obtained by training a joint generator, a discriminator, and an estimator, wherein the generator synthesizes second traffic data based on the first traffic data, the discriminator is used to judge the validity of the second traffic data, and the estimator performs traffic task prediction based on the second traffic data;
[0032] The model building unit is used to train the initial pre-training model based on the synthetic traffic data to obtain a traffic pre-training model.
[0033] The present invention also provides a traffic prediction device, comprising:
[0034] An acquisition unit, used for acquiring historical traffic data;
[0035] A prediction unit, configured to perform traffic prediction based on a traffic prediction model and applying the historical traffic data;
[0036] The traffic prediction model is constructed based on a traffic pre-training model, and the traffic pre-training model is determined based on any of the traffic pre-training model construction methods described above.
[0037] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for constructing a traffic pre-training model or the method for predicting traffic is implemented as described above.
[0038] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described traffic pre-training model construction methods or traffic prediction methods.
[0039] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned traffic pre-training model construction methods or traffic prediction methods.
[0040] The present invention provides a traffic pre-training model construction and traffic prediction method, device and electronic equipment. By using real traffic data for data synthesis based on a synthetic model, rich synthetic traffic data can be generated to meet the data requirements of model training, and the problems of poor data quality and small data scale of traffic data in the prior art can be effectively solved. By training the initial pre-training model based on the synthetic traffic data to obtain the traffic pre-training model, the versatility of the traffic pre-training model can be effectively improved, so that the model can meet the needs of traffic prediction task migration. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 It is a flow chart of the traffic pre-training model construction method provided by the present invention;
[0043] Figure 2 It is a schematic diagram of the process of synthetic model training provided by the present invention;
[0044] Figure 3 It is a structural schematic diagram of the synthetic model training provided by the present invention;
[0045] Figure 4 It is a flow chart of step 130 in the method for constructing a traffic pre-training model provided by the present invention;
[0046] Figure 5 is a flow chart of step 110 in the method for constructing a traffic pre-training model provided by the present invention;
[0047] Figure 6 It is a structural schematic diagram of the initial pre-training model provided by the present invention;
[0048] Figure 7 It is a flow chart of the traffic prediction method provided by the present invention;
[0049] Figure 8 It is a structural schematic diagram of the traffic pre-training model building device provided by the present invention;
[0050] Fig. 9It is a structural schematic diagram of the traffic prediction device provided by the present invention;
[0051] Fig.10 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] At present, in the field of intelligent transportation systems, traffic prediction plays an important role in traffic control and management. With the development of urban intelligence, people have gradually paid attention to the planning of urban transportation, especially the research on traffic prediction has attracted the attention of many researchers in this field. Traffic prediction aims to predict future traffic conditions based on historical traffic data. The prediction results can be used as the basis for traffic management departments to adjust traffic control plans to ensure the stable and efficient operation of the traffic system. At the same time, it can also provide travelers with accurate and timely traffic information so that travelers can plan in advance or adjust their routes in time to reduce travel delays.
[0054] In recent years, deep learning has developed rapidly, and traffic prediction methods based on deep learning have shown certain competitiveness, but deep learning is more and more dependent on data. If it only relies on limited data resources obtained through actual collection or manual annotation, it is difficult to provide strong support for the entire research process. In addition, due to the limited spatiotemporal coverage of physical detection equipment, the difficulty of equipment maintenance, and the accidental errors that may occur during data transmission and storage (such as data loss, data errors, etc.), the traffic data obtained often have problems such as poor data quality and small data scale, and cannot meet the data requirements of model training. Moreover, due to the differences in the scale of different cities and different traffic prediction tasks, the existing traffic prediction models have low modeling efficiency and high consumption of computing resources, making it difficult to meet the needs of traffic prediction task migration. In this regard, an embodiment of the present invention provides a method for constructing a traffic pre-training model.
[0055] Figure 1 A flow chart of the traffic pre-training model construction method provided by the present invention is shown in FIG. Figure 1 As shown, the method includes:
[0056] Step 110, obtaining real traffic data;
[0057] Specifically, real traffic data may include data such as traffic flow, traffic speed, road occupancy, and traffic demand. The real traffic data can be obtained through remote sensing means such as satellite remote sensing, aerial photogrammetry, low-altitude drones, ground measurement vehicles, and ground video; it can also be collected and obtained through various sensing devices and terminal devices, such as deploying detectors at sites in various cities and regions, and collecting traffic flow at the sites through the detectors; it can also be traffic data of various cities and regions obtained from relevant transportation departments, and the embodiments of the present invention do not specifically limit this.
[0058] Since the physical detection equipment has limited spatial and temporal coverage, equipment maintenance is difficult, and the collected traffic data may suffer from data loss and data errors during transmission and storage, the acquired real traffic data often has problems such as small data scale and poor data quality, and cannot meet the data requirements of model training. In order to solve this problem, the embodiment of the present invention performs data synthesis based on the synthetic model by executing step 120 to generate rich synthetic traffic data, thereby meeting the data requirements of model training.
[0059] Step 120, based on the synthesis model, real traffic data is used to perform data synthesis to obtain synthetic traffic data; the synthesis model is obtained by training a joint generator, a discriminator and an estimator, the generator synthesizes second traffic data based on the first traffic data, the discriminator is used to judge the validity of the second traffic data, and the estimator performs traffic task prediction based on the second traffic data;
[0060] Specifically, the synthesis model is used to synthesize real traffic data, generate and output new synthetic traffic data. Here, data synthesis refers to the process of generating a new data set by analyzing and simulating existing data, that is, the process of generating synthetic traffic data by analyzing and simulating real traffic data. Synthetic traffic data refers to traffic data generated based on computer simulation or algorithm, which is artificially created simulation data.
[0061] The synthetic model of the embodiment of the present invention can use the relatively stable EWGAN (Euler WassersteinGAN) as the basic network framework. After the real traffic data is input into the synthetic model, the real traffic data is analyzed and processed by the synthetic model to generate synthetic traffic data similar to the real traffic data. Although the synthetic traffic data is not data generated in the real traffic scene, it is generated based on the real traffic data and has the same properties as the real traffic data.
[0062] Generative adversarial network (GAN) is a common existing data synthesis model. GAN usually includes a generator and a discriminator. The generator is used for data synthesis, and the discriminator is used to judge the validity of the synthesized data. Although the existing data synthesis model can generate a large amount of synthetic data, these synthetic data are not related to the downstream traffic prediction tasks. If the model is trained with these synthetic data, the model will not be able to better match the downstream traffic prediction tasks, resulting in the need to retrain the model for different traffic prediction tasks. In order to solve the above problem, an embodiment of the present invention uses an estimator to perform traffic task prediction based on the second traffic data, and jointly trains the generator and the discriminator to obtain a synthetic model, thereby combining data synthesis with the downstream traffic prediction tasks, and further improving the effectiveness of data synthesis.
[0063] Before executing step 120, a synthetic model can also be pre-trained. Specifically, the synthetic model can be trained in the following manner: collect a large amount of sample traffic data, input it into the generator as the first traffic data, and generate second traffic data that is relatively close to the sample traffic data through the generator. Here, the first traffic data refers to the sample traffic data generated in a real traffic scenario, and the second traffic data is simulated traffic data generated by the generator. The discriminator discriminates the validity of the second traffic data to obtain a discrimination result; at the same time, the estimator predicts the traffic task based on the second traffic data to obtain a prediction result, and based on the first traffic data, the second traffic data, the discrimination result and the prediction result, the generator is iterated to obtain a synthetic model. Here, traffic task prediction can include vehicle flow prediction, traffic speed prediction, road occupancy prediction, traffic demand prediction, etc.
[0064] In an embodiment of the present invention, the synthetic model is obtained by training a joint generator, a discriminator and an estimator, wherein the estimator is used to perform traffic task prediction based on the second traffic data, and the prediction result is fed back to the generator after being obtained, and the parameters of the generator are optimized, thereby forming a closed loop between data synthesis and downstream traffic prediction tasks. This can not only enable the generator and the estimator to achieve positive cycle optimization, but also optimize and improve the effectiveness of data synthesis, so that the generated synthetic traffic data is related to the downstream traffic prediction tasks. By training the model with synthetic traffic data, the versatility of the model can be improved.
[0065] Step 130: training the initial pre-trained model based on the synthetic traffic data to obtain a traffic pre-trained model.
[0066] Specifically, the initial pre-trained model can be a parameter-initialized model or a pre-trained language model. For example, the initial pre-trained model can adopt an ELMo (Embeddings from Language Models) model, a GPT (Generative Pre-Training) model, or a BERT (Bidirectional Encoder Representation from Transformers) model. The embodiment of the present invention does not specifically limit this.
[0067] After applying real traffic data to generate synthetic traffic data based on the synthetic model, the synthetic traffic data is input into the initial pre-trained model, and traffic task predictions are performed through the initial pre-trained model, such as traffic flow prediction, traffic demand prediction, etc., to obtain corresponding traffic prediction results. Based on the traffic prediction results, the parameters of the initial pre-trained model are iterated to obtain the traffic pre-trained model.
[0068] Existing traffic prediction models usually need to be trained from scratch for different cities, different regions, and different traffic prediction tasks. The embodiments of the present invention can obtain a traffic pre-training model by training the initial pre-training model based on synthetic traffic data, which can meet the prediction requirements for various traffic tasks. When it is necessary to predict different traffic tasks in different cities and different regions, it can be further fine-tuned and trained on the basis of the traffic pre-training model, without the need to train a new model from scratch, thereby improving the versatility of the traffic pre-training model.
[0069] The traffic pre-training model construction method provided in the embodiment of the present invention can generate rich synthetic traffic data by performing data synthesis based on a synthetic model and applying real traffic data, thereby meeting the data requirements for model training and effectively solving the problems of poor data quality and small data scale of traffic data in the prior art. By training the initial pre-training model based on the synthetic traffic data to obtain the traffic pre-training model, the versatility of the traffic pre-training model can be effectively improved, so that the model can meet the requirements of traffic prediction task migration.
[0070] Based on the above embodiments, Figure 2 A schematic diagram of the process flow of the synthetic model training provided by the present invention, such as Figure 2 As shown, the training steps of the synthetic model include:
[0071] Step 210, based on the generator, using the first traffic data to synthesize the second traffic data;
[0072] Specifically, the generator may adopt a fully connected neural network or a spatiotemporal graph convolutional network, which is not specifically limited in the embodiment of the present invention. The collected first traffic data and the randomly generated noise data are input into the generator, and the noise data is mapped to the distribution of the first traffic data by the generator, thereby generating the second traffic data. During the training process, the goal of the generator is to generate second traffic data that is as similar as possible to the first traffic data, so that it is difficult for the discriminator to distinguish between the first traffic data and the second traffic data, that is, to make the discriminator think that the second traffic data is traffic data generated in a real traffic scene.
[0073] Step 220, based on the discriminator, discriminate the validity of the second traffic data and obtain a discrimination result of the second traffic data;
[0074] Specifically, during the training process, the goal of the discriminator is to distinguish the second traffic data generated by the generator from the real first traffic data as much as possible. The discriminator can use a fully connected neural network to input the second traffic data into the discriminator, and the discriminator determines whether the input second traffic data is real traffic data or traffic data generated by the generator, thereby obtaining a discrimination result of the second traffic data. When the discriminator obtains the discrimination result that the second traffic data is traffic data generated by the generator, it indicates that the second traffic data generated by the generator is not similar enough to the real first traffic data, and cannot achieve the effect of being indistinguishable from the real. At this time, the generated second traffic data has low validity and is not suitable for use as training data for the model.
[0075] As adversarial training proceeds, the distribution of the second traffic data generated by the generator will gradually approach the distribution of the first traffic data, thereby generating second traffic data that is as similar as possible to the first traffic data. When the discriminator obtains the judgment result that the second traffic data is real traffic data, it indicates that the second traffic data generated by the generator is very similar to the real first traffic data, which means that the generated second traffic data is valid and can be used as training data for the model.
[0076] Although after adversarial training, the generator can generate second traffic data that is as close as possible to the first traffic data, the obtained second traffic data has no correlation with the downstream traffic prediction task. In the field of traffic prediction, there are certain differences in traffic prediction tasks in different cities and regions. In order to make the traffic pre-training model obtained by training more universal and meet the needs of migration of different traffic prediction tasks, the embodiment of the present invention designs an estimator, performs traffic task prediction on the second traffic data based on the estimator in steps 230 and 240, and feeds the obtained prediction results back to the generator, optimizes the parameters of the generator, realizes the closed loop of data synthesis and downstream traffic prediction tasks, and further improves the effectiveness of data synthesis.
[0077] Step 230, based on the estimator, performing traffic task prediction on the second traffic data to obtain a prediction result of the second traffic data;
[0078] Step 240, based on the first traffic data, the second traffic data, the discrimination result and the prediction result of the second traffic data, the generator is iterated to obtain a synthetic model.
[0079] Specifically, the estimator is used to perform traffic task prediction based on the second traffic data synthesized by the generator to obtain a prediction result. For example, the estimator can perform traffic flow prediction based on the second traffic data to obtain a traffic flow prediction result. Here, the estimator can be a neural network model. After the generator generates rich second traffic data based on the first traffic data, the estimator can perform traffic task prediction training by learning from the massive second traffic data. The trained estimator performs traffic task prediction based on the second traffic data to obtain a prediction result. The prediction result is fed back to the generator, and the parameters of the generator can be optimized to further improve the effectiveness of its data synthesis.
[0080] After obtaining the discrimination result and prediction result of the second traffic data based on the discriminator and the estimator respectively, the parameters of the generator can be iterated based on the first traffic data, the second traffic data, the discrimination result and the prediction result, so as to obtain a synthetic model. During the training process, the generator synthesizes data based on the first traffic data to obtain the second traffic data, and trains the discriminator based on the first traffic data and the second traffic data; then the trained discriminator discriminates the validity of the newly generated second traffic data to obtain a discrimination result, that is, the probability that the second traffic data is based on the traffic data generated in the real traffic scene determined by the discriminator, and the parameters of the generator are optimized according to this probability, that is, the generator is provided with similarity micro-guidance, so that the second traffic data synthesized by the generator is more similar to the first traffic data. After continuous iterative training of the generator and the discriminator, the second traffic data generated by the generator is very similar to the real first traffic data, so that the discriminator cannot distinguish between the two. It should be understood that in adversarial training, we cannot assume that the generator is well trained if the loss function of the generator is low, because the generator and the discriminator are in a dynamic game process, and finally converge to the point where the discriminator cannot distinguish between the real first traffic data and the generated second traffic data. Therefore, it is also necessary to iterate the parameters of the generator based on the first traffic data and the second traffic data, that is, the goal of generator training should minimize the difference between the first traffic data and the second traffic data.
[0081] While the generator and discriminator are conducting adversarial training, the generator and estimator are also conducting cyclic optimization training. The generator synthesizes data based on the first traffic data to obtain the second traffic data, and then inputs the second traffic data into the estimator. The estimator conducts traffic task prediction training by learning from the massive second traffic data. The trained estimator then predicts the traffic task based on the newly generated second traffic data to obtain the prediction result, which is fed back to the generator to optimize the parameters of the generator, thereby making the second traffic data synthesized by the generator more accurate and effective.
[0082] In an embodiment of the present invention, when the synthetic model is trained, the validity of the second traffic data synthesized by the generator is discriminated by the discriminator, thereby providing similarity micro-guidance to the generator, and the estimator performs traffic task prediction based on the second traffic data synthesized by the generator, and its prediction result is fed back to the generator, thereby forming a closed loop of data synthesis and traffic task prediction. The generator and the estimator will realize forward cycle optimization. The generator will generate richer and more effective synthetic data based on the first traffic data, and the estimator will further improve its prediction and generalization performance by learning from massive synthetic data.
[0083] Based on the above embodiment, step 240 specifically includes:
[0084] Based on the data distribution difference between the first traffic data and the second traffic data, the discrimination result of the second traffic data, and the prediction result and task label of the second traffic data, the parameters of the generator are iterated to obtain a synthetic model.
[0085] Specifically, the generator performs data synthesis based on the first traffic data and randomly generated noise data, and generates the second traffic data by mapping the noise data to the distribution of the first traffic data. The first traffic data will have a specific probability distribution. During training, the probability distribution of the second traffic data generated by the generator will gradually approach the probability distribution of the first traffic data, thereby generating second traffic data that is as similar as possible to the first traffic data. Through alternating iterative training of the generator and the discriminator, the generator can eventually estimate the distribution of the second traffic data. The objective function of the training of the generator and the discriminator is to minimize the difference in data distribution between the first traffic data and the second traffic data, so that the parameters of the generator can be iterated based on the difference in data distribution between the first traffic data and the second traffic data.
[0086] After the generator synthesizes the second traffic data, it uses the discriminator to discriminate the validity of the second traffic data, that is, it discriminates the probability that the second traffic data is based on the traffic data in the real traffic scene, and compares this probability with the preset probability threshold to obtain the discrimination result. When the probability obtained by discrimination is lower than the preset probability threshold, it indicates that the discriminator believes that the second traffic data is the traffic data synthesized by the generator, which means that the validity of the second traffic data generated by the generator at this time is low, and the parameters of the generator need to be optimized. Therefore, after the validity of the second traffic data is discriminated by the discriminator and the discrimination result is obtained, the parameters of the generator can be iterated based on the discrimination result, so that the second traffic data generated by the generator is more similar to the first traffic data, so that the discriminator cannot distinguish between the two. It should be understood that the preset probability threshold is a pre-set probability value, which can be set to 80%, 70% or 60% according to actual needs, and the embodiment of the present invention does not make specific limitations on this.
[0087] In an embodiment of the present invention, the estimator can be a supervised training neural network. After the generator generates rich second traffic data based on the first traffic data, the estimator can perform traffic task prediction based on the second traffic data to obtain a prediction result, compare the prediction result with the corresponding task tag, judge the prediction performance of the estimator, obtain a prediction error, and further feed back the prediction error to the generator, thereby iterating the parameters of the generator to further improve the effectiveness of the generator data synthesis. Here, the task tag refers to the target variable used to train and evaluate the prediction performance of the estimator. For example, the task tag can be the result corresponding to the actual traffic task. For example, when predicting traffic flow, the task tag can be the actual traffic flow; the task tag can also be the result corresponding to the manually marked traffic task, which is not specifically limited in the embodiment of the present invention.
[0088] The embodiment of the present invention iterates the parameters of the generator based on the data distribution difference between the first traffic data and the second traffic data, the discrimination result of the second traffic data, and the prediction result and task label of the second traffic data. The trained generator can be used as a synthetic model, so that the synthetic model generates rich and effective synthetic data, providing training data for the subsequent traffic pre-training model.
[0089] Based on any of the above embodiments, Figure 3 A schematic diagram of the structure of the synthetic model training provided by the present invention, such as Figure 3As shown, when training to obtain a synthetic model, EWGAN (Euler Wasserstein GAN) can be used as the basic network framework. EWGAN includes a generator G and a discriminator D. The generator G is used to synthesize the first traffic data and the randomly generated noise data to obtain the second traffic data. The discriminator D is used to judge the validity of the second traffic data, thereby providing similarity micro-guidance to the generator G. Here, Figure 3 The real data in is the first traffic data, and the generated data is the second traffic data. The objective function of EWGAN is to minimize the Wasserstein distance between the real data distribution and the generated data distribution, that is:
[0090]
[0091] Among them, p data is the distribution of the real data X, p g Is to generate data The distribution of z represents the noise data, p z is the corresponding noise distribution, is the deep Euler representation of sample x, l is the regularization term, θ is the parameter of the generator G, is the parameter of the discriminator D; x and X are both real traffic data, x is also a sample in the training process, X represents the sample array at a certain moment, and x is an element in X.
[0092] To further improve the effectiveness of data synthesis, the embodiment of the present invention designs an estimator E by combining data synthesis with the downstream traffic prediction task, forming a closed loop between data synthesis and the downstream traffic prediction task, thereby jointly optimizing and improving the effectiveness of data synthesis. The paradigm is the prediction error of the estimator E:
[0093]
[0094] in, represents the input data of the estimator E, that is, the generated data of the generator G, is the prediction result of the corresponding estimator E, represents the real data at the corresponding moment; H is the prediction step size of the downstream traffic prediction task.
[0095] During the training process, the prediction error of the estimator E is Feedback is given to the generator G to provide macro guidance. The objective function of the generator G in the closed-loop structure becomes:
[0096]
[0097] Among them, τ∈U[0,1] is an adjustable threshold factor, λ is the weight penalty coefficient, is the regularization term; where ε∈U[0,1] is a random variable, represents the traffic data of the generated detector or station at the corresponding time, is the sample x m,n The deep Euler representation of .
[0098] Based on any of the above embodiments, Figure 4 The flow chart of step 130 in the traffic pre-training model construction method provided by the present invention is as follows: Figure 4 As shown, step 130 specifically includes:
[0099] Step 131, obtaining road network data corresponding to the synthetic traffic data;
[0100] Step 132, constructing a road network topology map based on the road network data;
[0101] Step 133: Based on the road network topology map and the synthetic traffic data, the initial pre-training model is trained to obtain a traffic pre-training model.
[0102] Specifically, road network data refers to road network data composed of various roads that are interconnected and interwoven into a network distribution within a certain area. A road network topology map refers to a network structure map organized according to a graph structure in a topological space, in the form of a graph network. The graph network includes nodes and connecting edges, and the connecting edges represent the dependency relationship between nodes. For a road network topology map, road sections are usually taken as nodes, and the interconnection relationship between road sections is taken as connecting edges. After obtaining the synthetic traffic data, based on the synthetic traffic data, the road section data corresponding to each synthetic traffic data is extracted, and based on the road section data, the spatial distance information of the traffic section is obtained, thereby constructing a road network topology map based on the road section data and the spatial distance information of the road section.
[0103] After constructing the road network topology map, the road network topology map and the synthetic traffic data are input into the initial pre-trained model. The initial pre-trained model is used to perform traffic task predictions, such as traffic flow predictions, traffic speed predictions, road occupancy predictions, etc. for different cities and regions, to obtain corresponding traffic prediction results. Based on the traffic prediction results, the parameters of the initial pre-trained model are iterated to obtain the traffic pre-trained model, so that the traffic pre-trained model has the ability to migrate across regions and be applicable to multiple tasks.
[0104] Based on any of the above embodiments, Figure 5 The flow chart of step 110 in the traffic pre-training model construction method provided by the present invention is as follows: Figure 5 As shown, step 110 specifically includes:
[0105] Step 111, obtaining original traffic data;
[0106] Specifically, the original traffic data is traffic data generated in a real traffic scenario, and may include data such as traffic flow, traffic speed, road occupancy, traffic demand, etc. The original traffic data may be collected and acquired through various sensor devices and terminal devices, such as deploying detectors at various stations in the road network and collecting the traffic flow of the stations through the detectors; the original data may also be acquired through relevant traffic departments, which is not specifically limited in the embodiments of the present invention.
[0107] Since the original traffic data may be sampled at a high frequency and may also have data missing problems, the embodiment of the present invention pre-processes the original traffic data through steps 112 and 113 to ensure data reliability and obtain valid real traffic data.
[0108] Step 112, performing data cleaning on the original traffic data, and performing data aggregation on the cleaned original traffic data to obtain aggregated traffic data at different time intervals;
[0109] Specifically, data cleaning is the process of re-examining and verifying data, including checking data consistency, processing invalid values and missing values, etc. Data aggregation is the process of collecting data and presenting it in a summarized form. In an embodiment of the present invention, data aggregation is to aggregate traffic data from the original sampling period into data of different time intervals. For example, traffic flow data is collected by detectors in the road network, and the original sampling period is once every 10 seconds. After the original traffic data is collected, the original traffic data is cleaned to remove redundant data, missing data and erroneous data to ensure the reliability of the real traffic data finally obtained; after obtaining the cleaned original traffic data, data aggregation is performed, and the traffic flow data can be aggregated from 10 seconds to 5 minutes, 10 minutes, etc., so as to obtain aggregated traffic data at different time intervals, so that the sampling frequency of aggregated traffic data is reduced, avoiding the subsequent consumption of a large amount of computing resources in the data processing operation, while improving the timeliness of data processing and synthesis.
[0110] Step 113, normalizing the aggregated traffic data at the same time interval to obtain real traffic data.
[0111] Specifically, after obtaining the aggregated traffic data at different time intervals, the aggregated traffic data at the same time interval can be normalized to eliminate the impact of data dimension and avoid affecting the subsequent data synthesis results. For example, the aggregated traffic flow data is normalized to the range of [0,1], and the maximum-minimum value normalization method is used to eliminate the impact of data dimension. The specific normalization method is:
[0112]
[0113] Among them, x represents the actual value of traffic flow, x′ represents the normalized value of traffic flow data, and x max represents the maximum value in the traffic flow data, x min Represents the minimum value in the traffic flow data.
[0114] Based on any of the above embodiments, Figure 6 A schematic diagram of the structure of the initial pre-training model provided by the present invention, such as Figure 6 As shown in the figure, the initial pre-training model is an encoder-decoder structure, in which the size of the encoder is larger than that of the decoder. Specifically, the initial pre-training model can use the spatial domain graph convolution GraphSAGE (Graph SAmple and aggreGatE) as the basic unit, adopt an asymmetric encoder-decoder structure, the size of the encoder is larger than that of the decoder, design a deep encoder to extract data spatiotemporal features, and design a lightweight decoder to make reasonable replacements for different traffic prediction tasks.
[0115] After obtaining real traffic data, such as traffic flow data, a traffic flow data matrix can be constructed, which is expressed as:
[0116]
[0117] Among them, m represents the number of detectors or the number of stations in the area to be predicted, n represents the number of historical traffic flow sequence elements owned by each detector or station, and each historical traffic flow sequence element corresponds to a moment, that is, traffic flow is collected at n different moments. Each element of the matrix represents the traffic flow value of the corresponding detector or station at the corresponding moment.
[0118] Based on the synthetic model, the real traffic flow data matrix is used for data synthesis to obtain synthetic traffic data. For example, based on the real traffic flow data matrix X m,n By synthesizing data, a synthetic traffic flow data matrix can be obtained. Based on the synthetic traffic data, the corresponding road network data is obtained, and a road network topology map is constructed based on the road network data. The road network topology map is in the form of a graph network and can be expressed as G = {E, V, A}, where V represents the set of nodes, E is the set of corresponding connecting edges, and A is the adjacency matrix. By defining the format of synthetic traffic data and road network topology maps, a unified data representation paradigm can be obtained, which can be used as the input of the initial pre-training model.
[0119] After the synthetic traffic data and road network topology are input into the initial pre-trained model, feature extraction is performed through the encoder of the initial pre-trained model. First, k-order sampling is performed based on the adjacency matrix A to obtain the neighbors corresponding to each order of the target node, and then the neighbor features are aggregated through spatial domain graph convolution, where Pooling Aggregator is defined as:
[0120]
[0121]
[0122] in, represents the output feature of node v after aggregating k-order neighbors, Represents the k-1th order feature representation of node v’s neighbor node u, is the k-th order feature representation of node v, is the k-1th order feature representation of node v, σ is the activation function, W pool , W k represents the corresponding model training parameters, and b represents the bias.
[0123] GraphSAGE can achieve feature aggregation of multi-order neighbors of any node through multi-layer sampling aggregation, thereby aggregating the feature information contained in the neighboring nodes. Feature extraction is performed through the encoder of the initial pre-trained model to obtain the feature information of each node, and then the feature information of each node is decoded based on the decoder to obtain the vector representation of each node for use in downstream traffic prediction tasks. For example, multi-task predictions such as traffic flow, traffic speed, road occupancy, etc. are performed for different cities (such as city A, city B, city C, etc.) and different regions, so that the traffic pre-training model has the ability to migrate across regions and be applicable to multiple tasks.
[0124] Based on any of the above embodiments, Figure 7 A flow chart of the traffic prediction method provided by the present invention is shown in FIG. Figure 7 As shown, the method includes:
[0125] Step 710, obtaining historical traffic data;
[0126] Step 720, based on the traffic prediction model, using historical traffic data to perform traffic prediction;
[0127] The traffic prediction model is constructed based on the traffic pre-training model, and the traffic pre-training model is determined based on any of the traffic pre-training model construction methods described above.
[0128] Specifically, according to the traffic pre-training model construction method in the above embodiment, after obtaining the traffic pre-training model, a traffic prediction model can be constructed according to the actual traffic task prediction needs, so as to predict the traffic task based on the traffic prediction model. The above historical traffic data refers to the traffic data that has been generated in the real traffic scene.
[0129] For example, to meet the traffic flow prediction needs of a specific area, the traffic pre-training model can be fine-tuned based on real traffic flow data and / or synthetic traffic flow data to obtain a traffic flow prediction model; the historical traffic flow data of the area is obtained, and these historical traffic flow data are analyzed through the traffic flow prediction model to predict the traffic flow data of the area at future times.
[0130] The traffic prediction method provided in the embodiment of the present invention can perform traffic prediction based on historical traffic data through a traffic prediction model, quickly obtain future traffic data, provide accurate traffic information for the intelligent transportation system, and realize intelligent management of road traffic. It can not only facilitate travelers to choose the best travel route, but also provide a basic basis for balancing traffic flow, optimizing traffic management, and improving traffic control.
[0131] Based on any of the above embodiments, Figure 8 The schematic diagram of the structure of the traffic pre-training model building device provided by the present invention is as follows: Figure 8 As shown, the device comprises:
[0132] A data acquisition unit 810, used to acquire real traffic data;
[0133] A data synthesis unit 820 is used to perform data synthesis based on a synthesis model using real traffic data to obtain synthetic traffic data. The synthesis model is obtained by training a joint generator, a discriminator, and an estimator. The generator synthesizes second traffic data based on the first traffic data. The discriminator is used to determine the validity of the second traffic data. The estimator performs traffic task prediction based on the second traffic data.
[0134] The model building unit 830 is used to train the initial pre-training model based on the synthetic traffic data to obtain a traffic pre-training model.
[0135] The traffic pre-training model construction device provided in the embodiment of the present invention can generate rich synthetic traffic data by performing data synthesis based on a synthetic model and applying real traffic data, effectively solving the problems of poor data quality and small data scale of traffic data in the prior art. By training the initial pre-training model based on the synthetic traffic data to obtain the traffic pre-training model, the versatility of the traffic pre-training model can be effectively improved, so that the model can meet the needs of traffic prediction task migration.
[0136] Based on any of the above embodiments, the device further includes a synthesis model training unit, and the synthesis model training unit is used to:
[0137] Based on the generator, applying the first traffic data to synthesize the second traffic data;
[0138] Based on the discriminator, determining the validity of the second traffic data, and obtaining a determination result of the second traffic data;
[0139] Based on the estimator, performing a traffic task prediction on the second traffic data to obtain a prediction result of the second traffic data;
[0140] Based on the first traffic data, the second traffic data, and the discrimination result and prediction result of the second traffic data, the parameters of the generator are iterated to obtain a synthetic model.
[0141] Based on any of the above embodiments, the synthesis model training unit is specifically used for:
[0142] Based on the data distribution difference between the first traffic data and the second traffic data, the discrimination result of the second traffic data, and the prediction result and task label of the second traffic data, the parameters of the generator are iterated to obtain a synthetic model.
[0143] Based on any of the above embodiments, the model building unit 830 is specifically used for:
[0144] Obtain road network data corresponding to the synthetic traffic data;
[0145] Construct road network topology map based on road network data;
[0146] Based on the road network topology map and synthetic traffic data, the initial pre-training model is trained to obtain a traffic pre-training model.
[0147] Based on any of the above embodiments, the data acquisition unit 810 is specifically used for:
[0148] Get raw traffic data;
[0149] Perform data cleaning on the original traffic data, and perform data aggregation on the cleaned original traffic data to obtain aggregated traffic data at different time intervals;
[0150] The aggregated traffic data at the same time interval is normalized to obtain the real traffic data.
[0151] Based on any of the above embodiments, the initial pre-training model is an encoder-decoder structure, wherein the scale of the encoder is larger than the scale of the decoder.
[0152] Based on any of the above embodiments, Fig. 9 The schematic diagram of the traffic prediction device provided by the present invention is as follows: Fig. 9 As shown, the device comprises:
[0153] An acquisition unit 910 is used to acquire historical traffic data;
[0154] A prediction unit 920, configured to perform traffic prediction based on a traffic prediction model and applying historical traffic data;
[0155] The traffic prediction model is constructed based on a traffic pre-training model, and the traffic pre-training model is determined based on any of the traffic pre-training model construction methods described above.
[0156] The traffic prediction device provided in the embodiment of the present invention can perform traffic prediction based on historical traffic data through a traffic prediction model, quickly obtain future traffic data, provide accurate traffic information for the intelligent transportation system, and realize intelligent management of road traffic. It can not only facilitate travelers to choose the best travel route, but also provide a basic basis for balancing traffic flow, optimizing traffic management, and improving traffic control.
[0157] Fig.10 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.10 As shown, the electronic device may include: a processor 1010, a communication interface 1020, a memory 1030 and a communication bus 1040, wherein the processor 1010, the communication interface 1020 and the memory 1030 communicate with each other through the communication bus 1040. The processor 1010 may call the logic instructions in the memory 1030 to execute the traffic pre-training model construction method, the method comprising: obtaining real traffic data; based on the synthetic model, applying the real traffic data to perform data synthesis to obtain synthetic traffic data; the synthetic model is obtained by training a joint generator, a discriminator and an estimator, the generator synthesizes the second traffic data based on the first traffic data, the discriminator is used to judge the validity of the second traffic data, and the estimator performs traffic task prediction based on the second traffic data; based on the synthetic traffic data, the initial pre-training model is trained to obtain the traffic pre-training model.
[0158] In addition, the processor 1010 can call the logic instructions in the memory 1030 to execute the traffic prediction method, which includes: obtaining historical traffic data; based on the traffic prediction model, applying the historical traffic data to perform traffic prediction; the traffic prediction model is constructed based on the traffic pre-training model, and the traffic pre-training model is determined based on the above-mentioned traffic pre-training model construction method.
[0159] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0160] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the traffic pre-training model construction method provided by the above methods, the method including: obtaining real traffic data; based on a synthetic model, applying real traffic data to perform data synthesis to obtain synthetic traffic data; the synthetic model is obtained by training a joint generator, a discriminator and an estimator, the generator synthesizes the second traffic data based on the first traffic data, the discriminator is used to judge the validity of the second traffic data, and the estimator performs traffic task prediction based on the second traffic data; based on the synthetic traffic data, the initial pre-training model is trained to obtain a traffic pre-training model.
[0161] In addition, the computer can also execute the traffic prediction method provided by the above methods, which includes: obtaining historical traffic data; based on the traffic prediction model, applying the historical traffic data to perform traffic prediction; the traffic prediction model is constructed based on the traffic pre-training model, and the traffic pre-training model is determined based on the above-mentioned traffic pre-training model construction method.
[0162] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the traffic pre-training model construction method provided by the above-mentioned methods, the method comprising: obtaining real traffic data; based on a synthetic model, applying real traffic data to perform data synthesis to obtain synthetic traffic data; the synthetic model is obtained by training a joint generator, a discriminator and an estimator, the generator synthesizing second traffic data based on the first traffic data, the discriminator being used to judge the validity of the second traffic data, and the estimator performing traffic task prediction based on the second traffic data; based on the synthetic traffic data, training the initial pre-training model to obtain a traffic pre-training model.
[0163] When the computer program is executed by the processor, it is implemented to execute the traffic prediction method provided by the above methods, which includes: obtaining historical traffic data; based on the traffic prediction model, applying the historical traffic data to perform traffic prediction; the traffic prediction model is constructed based on the traffic pre-training model, and the traffic pre-training model is determined based on the above-mentioned traffic pre-training model construction method.
[0164] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0165] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for constructing a traffic pre-training model, characterized in that: include: Obtain real traffic data; Based on the synthesis model, the real traffic data is used to perform data synthesis to obtain synthetic traffic data; The synthetic model is obtained by training a joint generator, a discriminator and an estimator. The generator synthesizes second traffic data based on first traffic data. The discriminator is used to judge the validity of the second traffic data. The estimator predicts traffic tasks based on the second traffic data and feeds back the obtained prediction results to the generator to optimize the parameters of the generator. The first traffic data refers to traffic data generated in a real traffic scenario, and the second traffic data is simulated traffic data generated by the generator. Based on the synthetic traffic data, the initial pre-training model is trained to obtain a traffic pre-training model; The training steps of the synthetic model include: Based on the generator, applying the first traffic data to synthesize the second traffic data; Based on the discriminator, determining the validity of the second traffic data, and obtaining a determination result of the second traffic data; Based on the estimator, performing traffic task prediction on the second traffic data to obtain a prediction result of the second traffic data; Based on the data distribution difference between the first traffic data and the second traffic data, the discrimination result of the second traffic data, and the prediction error of the estimator, the parameters of the generator are iterated to obtain the synthetic model, and the prediction error is determined based on the prediction result of the second traffic data and the corresponding task label.
2. The method for constructing a traffic pre-training model according to claim 1, characterized in that: The initial pre-training model is trained based on the synthetic traffic data to obtain a traffic pre-training model, including: Acquire road network data corresponding to the synthetic traffic data; Constructing a road network topology map based on the road network data; Based on the road network topology map and the synthetic traffic data, the initial pre-training model is trained to obtain a traffic pre-training model.
3. The method for constructing a traffic pre-training model according to claim 1, characterized in that: The obtaining of real traffic data includes: Get raw traffic data; Performing data cleaning on the raw traffic data, and performing data aggregation on the cleaned raw traffic data to obtain aggregated traffic data at different time intervals; The aggregated traffic data at the same time interval is normalized to obtain the real traffic data.
4. The method for constructing a traffic pre-training model according to any one of claims 1 to 3, characterized in that: The initial pre-training model is an encoder-decoder structure, wherein the scale of the encoder is larger than the scale of the decoder.
5. A traffic prediction method, characterized in that: include: Get historical traffic data; Based on the traffic prediction model, applying the historical traffic data to perform traffic prediction; The traffic prediction model is constructed based on a traffic pre-training model, and the traffic pre-training model is determined based on the traffic pre-training model construction method according to any one of claims 1 to 4.
6. A traffic pre-training model construction device, characterized in that: include: A data acquisition unit, used for acquiring real traffic data; a data synthesis unit, configured to perform data synthesis based on a synthesis model and apply the real traffic data to obtain synthetic traffic data, wherein the synthesis model is obtained by training a joint generator, a discriminator and an estimator, wherein the generator synthesizes second traffic data based on first traffic data, wherein the discriminator is used to judge the validity of the second traffic data, and wherein the estimator performs traffic task prediction based on the second traffic data and feeds back the obtained prediction result to the generator to optimize the parameters of the generator, wherein the first traffic data refers to traffic data generated in a real traffic scenario, and the second traffic data refers to simulated traffic data generated by the generator; A model building unit, used for training the initial pre-training model based on the synthetic traffic data to obtain a traffic pre-training model; The training steps of the synthetic model include: Based on the generator, applying the first traffic data to synthesize the second traffic data; Based on the discriminator, determining the validity of the second traffic data, and obtaining a determination result of the second traffic data; Based on the estimator, performing traffic task prediction on the second traffic data to obtain a prediction result of the second traffic data; Based on the data distribution difference between the first traffic data and the second traffic data, the discrimination result of the second traffic data, and the prediction error of the estimator, the generator is iterated on parameters to obtain the synthetic model, and the prediction error is determined based on the prediction result of the second traffic data and the corresponding task label.
7. A traffic prediction device, characterized in that: include: An acquisition unit, used for acquiring historical traffic data; A prediction unit, configured to perform traffic prediction based on a traffic prediction model and applying the historical traffic data; The traffic prediction model is constructed based on a traffic pre-training model, and the traffic pre-training model is determined based on the traffic pre-training model construction method according to any one of claims 1 to 4.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the traffic pre-training model construction method according to any one of claims 1 to 4 or the traffic prediction method according to claim 5.
Citation Information
Patent Citations
Traffic flow prediction method and device based on synthetic data
CN113570861A