Traffic flow sample generation method, device, and electronic equipment

By extracting and synthesizing new traffic flow samples, the problem of data imbalance in the traffic flow prediction model is solved, and the model's learning ability and prediction accuracy are improved, especially the prediction effect in abnormal traffic situations.

CN118760901BActive Publication Date: 2024-12-03HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411255738.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-03
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

The traffic flow prediction model has poor prediction results in abnormal traffic situations, mainly due to data imbalance, especially the samples of normal traffic situations are more than samples of abnormal traffic situations, which makes it difficult for the model to learn the characteristics of a few categories during the training process, affecting the model. accuracy.

Method used

By extracting dynamic, static, spatial and temporal representations of traffic flow samples and traffic flow characteristics, the distance between abnormal samples and other samples is calculated, the safe area is divided, and new traffic flow samples are synthesized to enhance the number of samples in a few categories, and thus improve the learning ability of the model.

Benefits of technology

It effectively solves the problem of data imbalance and improves the accuracy of the traffic flow regression prediction model, especially the prediction effect in abnormal traffic situations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760901B_ABST
    Figure CN118760901B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a traffic flow sample generation method, device, electronic device and storage medium. The method includes: extracting dynamic and static spatiotemporal representations based on static attribute information and dynamic change information included in each traffic flow sample, extracting traffic flow representation based on the relationship between the traffic flow included in each traffic flow sample and a preset traffic state representation, splicing the dynamic and static spatiotemporal representation of each traffic flow sample with the traffic flow representation to obtain a sample representation, calculating the distance between each abnormal traffic flow sample and traffic flow samples other than the abnormal traffic flow sample based on the sample representation, dividing the safety area corresponding to each abnormal traffic flow sample according to the relationship between the distance and a preset distance threshold, and synthesizing a new traffic flow sample based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples, thereby solving the problem of data imbalance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of traffic flow prediction, and in particular to a method, device, and electronic device for generating traffic flow samples. Background Art

[0002] Data imbalance means that the number of samples in different categories varies greatly, or the number of samples in the minority category is more important. When effectively learning samples from the minority category, due to the scarcity of samples from the minority category, it is difficult for the model to learn the characteristics of samples from the minority category during training, thus affecting the accuracy of the model.

[0003] The problem of data imbalance is also prominent in traffic flow prediction. Specifically, when training a traffic flow prediction model, samples of normal traffic conditions are often more than samples of abnormal traffic conditions, that is, samples of normal traffic conditions are more than samples of traffic accidents, bad weather and other conditions. In this case, a traffic flow prediction model trained with a small number of samples of abnormal traffic conditions will have poor results in predicting traffic flow under abnormal traffic conditions.

[0004] At present, methods such as data resampling, constructing loss functions that are sensitive to data bias, and constructing models specifically for data imbalance are used to solve the problems caused by data imbalance. However, the above methods are only aimed at the data imbalance in traffic flow classification prediction problems, and there are few studies on the data imbalance in traffic flow regression prediction problems. Data imbalance will still affect the accuracy of traffic flow regression prediction models. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a traffic flow sample generation method, device, electronic device and storage medium to solve the data imbalance problem in the traffic flow regression prediction problem and improve the accuracy of the model. The specific technical solution is as follows:

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

[0007] Based on the static attribute information and dynamic change information included in each traffic flow sample, extract the dynamic and static spatiotemporal representation of each traffic flow sample, wherein the dynamic and static spatiotemporal representation is used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at different time periods at the same location;

[0008] Extracting the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and a preset traffic state representation, wherein the preset traffic state representation is used to represent a representation vector of predefined different traffic states;

[0009] splicing the dynamic and static spatiotemporal representations of each traffic flow sample with the traffic flow representation to obtain a sample representation corresponding to the traffic flow sample;

[0010] Based on the sample representation corresponding to each traffic flow sample, calculating the distance between each abnormal traffic flow sample and traffic flow samples other than the abnormal traffic flow sample, wherein the abnormal traffic flow sample is a traffic flow sample whose number of traffic flow samples of the category to which it belongs is less than a preset number;

[0011] According to the relationship between the distance and the preset distance threshold, the safety area corresponding to each abnormal traffic flow sample is divided, wherein the distance between the abnormal traffic flow sample and the neighboring traffic flow sample in the safety area corresponding to the abnormal traffic flow sample is not greater than the preset distance threshold;

[0012] Based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples, a new traffic flow sample is synthesized.

[0013] Optionally, the step of extracting the dynamic and static spatiotemporal representation of each traffic flow sample based on the static attribute information and dynamic change information included in each traffic flow sample includes:

[0014] Input each traffic flow sample into a pre-trained extraction model so that the spatiotemporal representation extraction unit extracts a static representation based on the static attribute information included in the traffic flow sample, and extracts a dynamic representation based on the dynamic change information included in the traffic flow sample;

[0015] For each traffic flow sample, the static representation and the dynamic representation of the traffic flow sample are spliced ​​to obtain the initial dynamic and static time representation;

[0016] Utilizing a pre-constructed multi-dimensional graph, based on the initial dynamic and static time representation and the graph convolution network, extracting a multi-dimensional spatial representation, wherein the multi-dimensional graph is established based on the spatial structural characteristics of the location corresponding to the traffic flow sample, and the graph convolution network is used to extract the spatial features of the traffic flow sample under the spatial structural characteristics of the corresponding location;

[0017] The spatial representations of the multiple dimensions are fused to obtain a dynamic and static spatiotemporal representation of the traffic flow sample.

[0018] Optionally, the step of extracting a static representation based on the static attribute information included in the traffic flow sample includes:

[0019] Binning the continuous data in the static attribute information included in the traffic flow sample to obtain a first binning result;

[0020] The first binning result and the non-continuous data included in the traffic flow sample are input into a pre-constructed first extraction network layer to obtain a static representation.

[0021] Optionally, the step of extracting dynamic characterization based on the dynamic change information included in the traffic flow sample includes:

[0022] Performing binning processing on the dynamic change information included in the traffic flow sample to obtain a second binning result, wherein the dynamic change information includes at least one of a traffic flow change value, a traffic flow change rate, a speed change value, and a speed change rate at different time points at the same location;

[0023] The second binning result is input into a second pre-built extraction network layer to obtain a dynamic representation.

[0024] Optionally, the step of extracting the spatial representation of multiple dimensions by using the pre-constructed graph of multiple dimensions based on the initial dynamic and static time representation and the graph convolutional network includes:

[0025] For each pre-constructed graph of each dimension, a graph convolution network is used to perform graph convolution processing on the initial dynamic and static time representation to obtain a graph convolution result corresponding to the graph of the dimension as a spatial representation of one dimension;

[0026] Among them, the pre-constructed maps of multiple dimensions are constructed based on the spatial structure characteristics of the traffic road grid, vehicle collision records and public transportation facility distribution map of the location corresponding to the traffic flow sample.

[0027] Optionally, the step of extracting the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and a preset traffic state representation comprises:

[0028] The traffic flow included in the traffic flow sample is input into a pre-trained extraction model, so that the prediction network in the traffic characterization extraction unit predicts the probability vectors of the traffic flow belonging to different traffic states based on the traffic flow and the traffic characterization vectors of different traffic states;

[0029] Based on the relationship between the probability vector and the preset traffic state representation, the traffic flow representation of the traffic flow sample is determined.

[0030] Optionally, the preset traffic state is represented as a matrix, and each row vector in the matrix represents a predefined traffic state;

[0031] The step of determining the traffic flow representation of the traffic flow sample based on the relationship between the probability vector and the preset traffic state representation comprises:

[0032] A matrix multiplication operation is performed on the probability vector and the preset traffic state representation to obtain a traffic flow representation of the traffic flow sample.

[0033] Optionally, the step of synthesizing a new traffic flow sample based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples includes:

[0034] For each abnormal traffic flow sample, the dimensional features of the new traffic flow sample are determined according to the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area;

[0035] Based on the distances between the dimensional features of the new traffic flow sample and the dimensional features of the abnormal traffic flow sample and the dimensional features of each neighboring traffic flow sample, the traffic flow value of the new traffic flow sample is calculated.

[0036] Optionally, the step of determining the dimensional features of the new traffic flow sample according to the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area includes:

[0037] Calculate the difference between the continuous features of each dimension of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area;

[0038] The sum of the continuous features of each dimension of the abnormal traffic flow sample and the target product is used as the continuous features of each dimension of the new traffic flow sample, wherein the target product is the product of a random number within a preset value range and the difference;

[0039] For the category features of each dimension of the new traffic flow sample, the category features of the dimension of the abnormal traffic flow sample or the category features of the dimension of the neighboring traffic flow sample are used as the category features of the dimension of the new traffic flow sample.

[0040] Optionally, the step of calculating the traffic flow value of the new traffic flow sample based on the distances between the dimensional features of the new traffic flow sample and the dimensional features of the abnormal traffic flow sample and the dimensional features of each neighboring traffic flow sample comprises:

[0041] Calculate the first distance between each dimensional feature of the new traffic flow sample and each dimensional feature of the abnormal traffic flow sample, and the second distance between each dimensional feature of the new traffic flow sample and each dimensional feature of each neighboring traffic flow sample;

[0042] Based on the first distance, the second distance, the traffic flow included in the abnormal traffic flow sample and the traffic flow included in each neighboring traffic flow sample, a traffic flow value of a new traffic flow sample is calculated.

[0043] Optionally, the step of calculating a traffic flow value of a new traffic flow sample based on the first distance, the second distance, the traffic flow included in the abnormal traffic flow sample, and the traffic flow included in each neighboring traffic flow sample comprises:

[0044] Calculate the traffic flow value of the new traffic flow sample according to the following formula :

[0045] ;

[0046] Wherein, d1 is the first distance, d2 is the second distance, is the traffic flow included in the abnormal traffic flow sample, is the traffic flow included in the neighborhood traffic flow sample.

[0047] In a second aspect, an embodiment of the present application provides a traffic flow sample generating device, the device comprising:

[0048] A dynamic and static spatiotemporal representation extraction module is used to extract the dynamic and static spatiotemporal representation of each traffic flow sample based on the static attribute information and dynamic change information included in each traffic flow sample, wherein the dynamic and static spatiotemporal representation is used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at different time periods at the same location;

[0049] A traffic flow representation extraction module, configured to extract the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and a preset traffic state representation, wherein the preset traffic state representation is used to represent a representation vector of predefined different traffic states;

[0050] A sample representation acquisition module, used to splice the dynamic and static spatiotemporal representations of each traffic flow sample with the traffic flow representation to obtain a sample representation corresponding to the traffic flow sample;

[0051] A distance calculation module, used for calculating the distance between each abnormal traffic flow sample and traffic flow samples other than the abnormal traffic flow sample based on the sample representation corresponding to each traffic flow sample, wherein the abnormal traffic flow sample is a traffic flow sample whose number of traffic flow samples of the category to which it belongs is less than a preset number;

[0052] A safety area division module, used to divide the safety area corresponding to each abnormal traffic flow sample according to the relationship between the distance and a preset distance threshold, wherein the distance between the abnormal traffic flow sample and the neighboring traffic flow sample in the safety area corresponding to the abnormal traffic flow sample is not greater than the preset distance threshold;

[0053] The traffic flow sample synthesis module is used to synthesize new traffic flow samples based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples.

[0054] Optionally, the dynamic and static spatiotemporal representation extraction module includes:

[0055] A dynamic and static representation extraction submodule, used for inputting each traffic flow sample into a pre-trained extraction model, so that the spatiotemporal representation extraction unit extracts a static representation based on the static attribute information included in the traffic flow sample, and extracts a dynamic representation based on the dynamic change information included in the traffic flow sample;

[0056] The time representation acquisition submodule is used to splice the static representation and dynamic representation of each traffic flow sample to obtain the initial dynamic and static time representation;

[0057] A spatial representation submodule is used to extract the spatial representation of multiple dimensions using the pre-built multi-dimensional graphs based on the initial dynamic and static time representation and the graph convolution network, wherein the multi-dimensional graphs are established based on the spatial structural characteristics of the location corresponding to the traffic flow sample, and the graph convolution network is used to extract the spatial features of the traffic flow sample under the spatial structural characteristics of the corresponding location;

[0058] The dynamic and static spatiotemporal representation submodule is used to fuse the spatial representations of the multiple dimensions to obtain the dynamic and static spatiotemporal representation of the traffic flow sample.

[0059] Optionally, the dynamic and static characterization extraction submodule includes:

[0060] A first binning result obtaining unit is used to perform binning processing on the continuous data in the static attribute information included in the traffic flow sample to obtain a first binning result;

[0061] The static representation acquisition unit is used to input the first binning result and the non-continuous data included in the traffic flow sample into a pre-constructed first extraction network layer to obtain a static representation.

[0062] Optionally, the dynamic and static characterization extraction submodule includes:

[0063] A second binning result obtaining unit is used to bin the dynamic change information included in the traffic flow sample to obtain a second binning result, wherein the dynamic change information includes at least one of a traffic flow change value, a traffic flow change rate, a speed change value, and a speed change rate at different time points at the same location;

[0064] The dynamic representation acquisition unit is used to input the second binning result into a second pre-built extraction network layer to obtain a dynamic representation.

[0065] Optionally, the spatial representation raising submodule includes:

[0066] A spatial representation acquisition unit is used to perform graph convolution processing on the initial dynamic and static time representation using a graph convolution network for the pre-constructed graph of each dimension, and obtain a graph convolution result corresponding to the graph of the dimension as a spatial representation of one dimension;

[0067] Among them, the pre-constructed maps of multiple dimensions are constructed based on the spatial structure characteristics of the traffic road grid, vehicle collision records and public transportation facility distribution map of the location corresponding to the traffic flow sample.

[0068] Optionally, the traffic flow characterization extraction module includes:

[0069] A probability vector acquisition unit, used for inputting the traffic flow included in the traffic flow sample into a pre-trained extraction model, so that the prediction network in the traffic characterization extraction unit predicts the probability vectors of the traffic flow belonging to different traffic states based on the traffic flow and the traffic characterization vectors of different traffic states;

[0070] The traffic flow representation determining unit is used to determine the traffic flow representation of the traffic flow sample based on the relationship between the probability vector and the preset traffic state representation.

[0071] Optionally, the preset traffic state is represented as a matrix, and each row vector in the matrix represents a predefined traffic state;

[0072] The traffic flow characterization determining unit comprises:

[0073] The traffic flow representation acquisition subunit is used to perform a matrix multiplication operation on the probability vector and the preset traffic state representation to obtain the traffic flow representation of the traffic flow sample.

[0074] Optionally, the traffic flow sample synthesis module includes:

[0075] The submodule for determining the features of each dimension is used to determine the features of each dimension of a new traffic flow sample for each abnormal traffic flow sample according to the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area;

[0076] The traffic flow value calculation submodule is used to calculate the traffic flow value of the new traffic flow sample based on the distance between the various dimensional features of the new traffic flow sample and the various dimensional features of the abnormal traffic flow sample and the various dimensional features of each neighboring traffic flow sample.

[0077] Optionally, the submodules for determining the features of each dimension include:

[0078] A difference calculation unit, used to calculate the difference of each dimension of continuous features between the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area;

[0079] A continuous feature acquisition subunit, used to add the continuous features of each dimension of the abnormal traffic flow sample and the target product as the continuous features of each dimension of the new traffic flow sample, wherein the target product is the product of a random number within a preset value range and the difference;

[0080] The category feature determination unit is used to use the category features of each dimension of the new traffic flow sample as the category features of the dimension of the abnormal traffic flow sample or the category features of the dimension of the neighboring traffic flow sample.

[0081] Optionally, the traffic flow value calculation submodule includes:

[0082] A first distance and a second distance calculation unit, used to respectively calculate the first distance between each dimensional feature of the new traffic flow sample and each dimensional feature of the abnormal traffic flow sample, and the second distance between each dimensional feature of the new traffic flow sample and each dimensional feature of each neighboring traffic flow sample;

[0083] The traffic flow value calculation unit is used to calculate the traffic flow value of a new traffic flow sample based on the first distance, the second distance, the traffic flow included in the abnormal traffic flow sample and the traffic flow included in each neighboring traffic flow sample.

[0084] Optionally, the traffic flow value calculation unit includes:

[0085] The traffic flow value calculation subunit is used to calculate the traffic flow value of the new traffic flow sample according to the following formula :

[0086] ;

[0087] Wherein, d1 is the first distance, d2 is the second distance, is the traffic flow included in the abnormal traffic flow sample, is the traffic flow included in the neighborhood traffic flow sample.

[0088] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0089] Memory, used to store computer programs;

[0090] The processor is used to implement any method described in the first aspect when executing a program stored in the memory.

[0091] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any method described in the first aspect is implemented.

[0092] In the solution provided by the embodiment of the present application, since the dynamic and static spatiotemporal representation can be used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at the same location in different time periods, the preset traffic state representation can be used to represent the representation vectors of pre-defined different traffic states, and the traffic flow representation can be extracted based on the relationship between the traffic flow included in the traffic flow sample and the preset traffic state representation. Then, the sample features obtained by splicing the dynamic and static spatiotemporal representation and the traffic flow representation can reflect the traffic state at a specific time point and at a specific location while realizing the dynamic embedding of traffic events. In this way, based on the sample representation corresponding to each traffic flow sample, the difference between each abnormal traffic flow sample and the sample except the abnormal traffic flow sample is calculated. The distance between traffic flow samples outside the abnormal traffic flow samples is divided into a safe area corresponding to each abnormal traffic flow sample according to the relationship between the distance and the preset distance threshold, so that the neighboring traffic flow samples in the safe area and the abnormal traffic flow samples have similar traffic event change characteristics and similar traffic conditions, and then new traffic flow samples can be synthesized based on the various dimensional features of each abnormal traffic flow sample and the various dimensional features of its corresponding neighboring traffic flow samples, solving the problem of data imbalance, and adding new traffic flow samples in the process of training the traffic flow regression prediction model can better learn the characteristics of the traffic flow samples, making the trained traffic flow regression prediction model more accurate. Of course, the implementation of any product or method of the present application does not necessarily require all of the advantages described above to be achieved at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0093] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0094] Figure 1 A flow chart of a method for generating traffic flow samples provided in an embodiment of the present application;

[0095] Figure 2 Based on Figure 1 A schematic diagram of the dynamic and static spatiotemporal representation of the illustrated embodiment;

[0096] Figure 3 Based on Figure 1 A schematic diagram of a safety area of ​​the illustrated embodiment;

[0097] Figure 4 for Figure 1 A specific flow chart of step S101 in the illustrated embodiment;

[0098] Figure 5 A schematic diagram of an extraction model provided in an embodiment of the present application;

[0099] Figure 6 Based on Figure 1 Another schematic diagram of the dynamic and static spatiotemporal representation of the illustrated embodiment;

[0100] Figure 7 for Figure 4 A specific flow chart of step S401 in the illustrated embodiment;

[0101] Figure 8 for Figure 4 Another specific flow chart of step S401 in the illustrated embodiment;

[0102] Fig. 9 for Figure 1 A specific flow chart of step S102 in the illustrated embodiment;

[0103] Fig.10 for Figure 1 A specific flow chart of step S106 in the illustrated embodiment;

[0104] Fig.11 for Fig.10 A specific flow chart of step S1001 in the illustrated embodiment;

[0105] Fig.12 for Fig.10 A specific flow chart of step S1002 in the illustrated embodiment;

[0106] Fig.13 A specific flow chart of the traffic flow sample generation method provided in the embodiment of the present application;

[0107] Fig.14 A schematic diagram of the structure of a traffic flow sample generating device provided in an embodiment of the present application;

[0108] Fig.15 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0110] In order to solve the problem of data imbalance in traffic flow regression prediction and improve the accuracy of the model, an embodiment of the present application provides a traffic flow sample generation method, device, electronic device, computer-readable storage medium and computer program product. The following first introduces a traffic flow sample generation method provided in an embodiment of the present application.

[0111] like Figure 1 As shown, a method for generating a traffic flow sample comprises:

[0112] S101, extracting the dynamic and static spatiotemporal representation of each traffic flow sample based on the static attribute information and dynamic change information included in each traffic flow sample;

[0113] The dynamic and static spatiotemporal representation is used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at different time periods at the same location;

[0114] S102, extracting the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and the preset traffic state representation;

[0115] Wherein, the preset traffic state representation is used to represent a representation vector of different predefined traffic states;

[0116] S103, splicing the dynamic and static spatiotemporal representations of each traffic flow sample with the traffic flow representation to obtain a sample representation corresponding to the traffic flow sample;

[0117] S104, calculating the distance between each abnormal traffic flow sample and traffic flow samples other than the abnormal traffic flow sample based on the sample representation corresponding to each traffic flow sample;

[0118] The abnormal traffic flow samples are traffic flow samples whose number of traffic flow samples of the category to which they belong is less than a preset number;

[0119] S105, dividing the safety area corresponding to each abnormal traffic flow sample according to the relationship between the distance and the preset distance threshold;

[0120] Wherein, the distance between the neighboring traffic flow sample located in the safety area corresponding to the abnormal traffic flow sample and the abnormal traffic flow sample is not greater than the preset distance threshold;

[0121] S106, synthesizing a new traffic flow sample based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples.

[0122] It can be seen that in the solution provided in the embodiment of the present application, since the dynamic and static spatiotemporal representations can be used to represent the correlation between the mutual influence of traffic events and the time changes, the preset traffic state representation can be used to represent the characteristics of different pre-defined traffic states, and the traffic flow representation can be extracted based on the relationship between the traffic flow included in the traffic flow sample and the preset traffic state representation. Then, the sample features obtained by splicing the dynamic and static spatiotemporal representations and the traffic flow representation can reflect the traffic state at a specific time point and at a specific location while realizing the dynamic embedding of traffic events. In this way, based on the sample representation corresponding to each traffic flow sample, each abnormal traffic flow sample and the traffic flow sample except the abnormal traffic flow are calculated. The distance between traffic flow samples outside the sample is divided into a safe area corresponding to each abnormal traffic flow sample according to the relationship between the distance and the preset distance threshold. This can make the neighboring traffic flow samples in the safe area and the abnormal traffic flow samples have similar traffic event change characteristics and similar traffic conditions. New traffic flow samples can be synthesized based on the various dimensional features of each abnormal traffic flow sample and the various dimensional features of its corresponding neighboring traffic flow samples, which solves the problem of data imbalance. In this way, adding new traffic flow samples in the process of training the traffic flow regression prediction model can better learn the characteristics of the traffic flow samples and make the trained traffic flow regression prediction model more accurate.

[0123] Traffic flow forecasting refers to predicting the number of vehicles or pedestrians passing through a spatial unit (such as a road section, traffic sensor device, etc.) within a certain period of time. Accurately predicting traffic flow can improve traffic congestion and achieve effective control of traffic lights.

[0124] At present, traffic flow prediction models often only focus on single attributes such as spatiotemporal data, weather conditions, and traffic flow, while ignoring the dynamic interaction between traffic events, between traffic events and time, and between traffic events and locations. In the traffic flow prediction scenario, traffic events have mutual influences on each other, and the mutual influence between traffic events changes dynamically with the flow of time and with different locations. That is, traffic events change in time and space. Therefore, the generation of new traffic flow samples can take into account the mutual influence between traffic events and the correlation between time changes and location changes.

[0125] In step S101, the electronic device can extract the dynamic and static spatiotemporal representation of each traffic flow sample based on the static attribute information and dynamic change information included in each static traffic flow sample, that is, execute step S101. The dynamic and static spatiotemporal representation can be used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at different time periods at the same location.

[0126] Traffic flow samples may include information such as traffic flow, weather conditions, traffic conditions, and vehicle speed. Traffic flow samples may be collected by traffic sensing devices, which may include traffic sensors, radar sensors, cameras, meteorological sensors, traffic flow detectors, and road condition sensors. In one embodiment, the electronic device may obtain traffic flow samples collected by the traffic sensing device from a preset traffic intersection according to a preset period. The preset period may be 15 minutes, 30 minutes, etc., which is not specifically limited here.

[0127] For example, as shown in Table 1, the traffic sensor collects traffic flow in three time periods from location 1 to location 3, and the electronic device can obtain the traffic flow in each time period at each location as a traffic flow sample.

[0128] Table 1

[0129] Location 1 Location 2 Location 3 2021 / 12 / 1 12:00-12:30 10 5 18 2021 / 12 / 1 12:30-13:00 17 8 13 2021 / 12 / 1 13:00-13:30 15 7 12

[0130] The static attribute information included in each traffic flow sample may be attribute information obtained at the same location and time point, such as traffic flow, weather conditions, traffic conditions, etc. at a certain location and time. The dynamic change information included in each traffic flow sample may be the difference in static attribute information at different time points at the same location, such as traffic flow change value, traffic flow change rate, speed change value, speed change rate, etc.

[0131] For example, Figure 2 As shown, the electronic device obtains traffic flow samples from time t1 to time t4 at the three traffic intersections L1, L2, and L3. The traffic flow samples include static attribute information, namely, congestion status and vehicle flow, and also include dynamic change information, namely, the difference in vehicle flow between every two moments. Then, the electronic device can extract dynamic and static spatiotemporal representations based on the congestion status and the difference in vehicle flow. If the congestion status 201 at the L1 intersection at time t2 is abnormal congestion, then the difference in vehicle flow 202 between time t1 and time t2 at the L1 intersection is large, that is, the vehicle flow 202 at the L1 intersection from time t1 to time t2 increases.

[0132] Since the purpose of generating traffic flow samples is to train the traffic flow regression prediction model so as to accurately predict the traffic flow through the trained traffic flow regression prediction model, the traffic flow included in the traffic flow samples is the key attribute for generating new traffic flow samples, and traffic flow representation can be extracted from the traffic flow samples.

[0133] In step S102, the electronic device may extract the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and the preset traffic state representation. The preset traffic state representation is used to represent the representation vector of different predefined traffic states. Traffic flow may include vehicle flow, pedestrian flow, etc., which are not specifically limited here. Traffic states may include unimpeded, basically unimpeded, light congestion, moderate congestion, severe congestion, and no vehicles, etc., which may be determined according to actual conditions.

[0134] That is, the electronic device can extract the traffic flow representation of each traffic flow sample based on the probability that the traffic flow included in each traffic flow sample belongs to different traffic states, that is, reflecting the degree of being in different traffic states. For example, if the traffic flow included in a traffic flow sample is 10, and the preset traffic state representation represents the representation vectors of unblocked, basically unblocked, light congestion, moderate congestion, severe congestion and no car, then the electronic device can extract the traffic flow representation of the traffic flow sample based on the relationship between the traffic flow sample and the preset traffic state representation, that is, the relationship between the traffic flow sample and the representation vectors of unblocked, basically unblocked, light congestion, moderate congestion, severe congestion and no car, that is, extract the probability vector that the traffic flow sample belongs to different traffic states.

[0135] Since traffic flow is affected by both time and space factors, for example, the traffic flow at different intersections at the same time is different, and the same traffic flow may represent different traffic states at different intersections. Therefore, in the process of generating new traffic flow samples, multiple factors of time and space need to be considered. In one implementation, dynamic and static spatiotemporal representation can be combined with traffic flow representation.

[0136] In step S103, the electronic device can combine the dynamic and static spatiotemporal representation of each traffic flow sample with the traffic flow representation to obtain a sample representation corresponding to the traffic flow sample. In this way, the sample representation corresponding to each traffic flow sample can not only realize the dynamic embedding of traffic events and reflect the characteristics of traffic events changing over time, but also reflect the traffic status at a specific time point and location.

[0137] For example, Figure 2 As shown, when the electronic device obtains the dynamic and static spatiotemporal representation and the traffic flow representation at the L1 intersection at time t2, it can splice the dynamic and static spatiotemporal representation and the traffic flow representation, that is, if the congestion state at the L1 intersection at time t2 is abnormal congestion, then the feature of the increase in traffic volume at the L1 intersection from time t1 to time t2 is spliced ​​with the relationship between the traffic volume at time t2 and the features of smooth, basically smooth, light congestion, moderate congestion, severe congestion and no car, so as to obtain the sample representation corresponding to the traffic flow sample collected at the L1 intersection at time t2.

[0138] In one embodiment, in order to make the sample features corresponding to each traffic flow sample more accurate, the electronic device can input the sample features corresponding to each traffic flow sample into a pre-built sample feature optimization model, and optimize the sample features corresponding to each traffic flow sample to obtain optimized sample features.

[0139] When the electronic device obtains the sample features corresponding to each traffic flow sample, in order to increase the number of traffic flow samples of minority categories in the traffic flow samples, in one embodiment, the electronic device can determine the traffic flow samples that are neighbors of each traffic flow sample of minority categories based on the sample features corresponding to each traffic flow sample, and then combine the features between the traffic flow samples of minority categories and their neighboring traffic flow samples to synthesize new traffic flow samples.

[0140] After the electronic device obtains the sample representation corresponding to each traffic flow sample, in step S104, the electronic device can calculate the distance between each abnormal traffic flow sample and the traffic flow samples other than the abnormal traffic flow sample based on the sample representation corresponding to each traffic flow sample. The abnormal traffic flow sample is a traffic flow sample in which the number of traffic flow samples of the category to which it belongs is less than a preset number.

[0141] In one implementation, the electronic device may calculate the Euclidean distance between each abnormal traffic flow sample and a traffic flow sample other than the abnormal traffic flow sample based on the sample representation corresponding to each traffic flow sample. For example, if the sample representation of the abnormal traffic flow sample is x=(x1, ..., xn), and a traffic flow sample other than the abnormal traffic flow sample is y=(y1, ..., yn), then the distance between the abnormal traffic flow sample and the traffic flow sample is .

[0142] After determining the distance between each abnormal traffic flow sample and traffic flow samples other than the abnormal traffic flow sample, the electronic device may divide the safety area corresponding to each abnormal traffic flow sample according to the relationship between the distance and the preset distance threshold, i.e., execute step S105. The distance between the abnormal traffic flow sample and the neighboring traffic flow sample in the safety area corresponding to the abnormal traffic flow sample is not greater than the preset distance threshold.

[0143] That is to say, for each abnormal traffic flow sample, the electronic device can divide a safe area with the abnormal traffic flow sample as the center, and the safe area includes the abnormal traffic flow sample and neighboring traffic flow samples whose distance from the abnormal traffic flow sample is not greater than the preset distance threshold, wherein the maximum radius of the safe area is the preset distance threshold. Then, the traffic flow samples whose distance from the abnormal traffic flow sample is greater than the preset distance threshold are divided outside the safe area, i.e., the non-safe area.

[0144] For example, Figure 3 As shown, in the spatial coordinate system X1X2Tgt, for an abnormal traffic flow sample case, the electronic device can take the abnormal traffic flow sample case as the center, and divide the neighboring traffic flow samples whose distance from the abnormal traffic flow sample case is not greater than the preset distance threshold into a safe area, i.e., a Safe area, and divide the neighboring traffic flow samples whose distance from the abnormal traffic flow sample case is greater than the preset distance threshold into an unsafe area, i.e., an Unsafe area. The neighboring traffic flow samples include a first traffic flow sample 301, a second traffic flow sample 302, and a third traffic flow sample 303.

[0145] The electronic device can determine the neighboring traffic flow samples of each abnormal traffic flow sample based on the safety area corresponding to each abnormal traffic flow sample, and then the electronic device can synthesize a new traffic flow sample based on the dimensional features of each abnormal traffic flow sample and the dimensional features of the corresponding neighboring traffic flow samples, that is, execute step S106. Among them, the dimensional features can be static attribute information included in the traffic flow sample, such as weather conditions, traffic flow, traffic conditions, etc., which are not specifically limited here.

[0146] Dimensional features may be continuous features or categorical features, so the electronic device may adopt different processing methods for different types of features. In one embodiment, for continuous features, the electronic device may calculate the difference between the continuous features of the dimension of the abnormal traffic flow sample and each of its neighboring traffic flow samples in the safety area, and then determine the continuous features of the dimension of the new traffic flow sample based on the difference and the continuous features of the dimension of the abnormal traffic flow sample.

[0147] With respect to the category features, the electronic device may use the category features of the dimension of the abnormal traffic flow sample as the category features of the dimension of the new traffic flow sample, or may use the category features of the dimension of the neighboring traffic flow samples as the category features of the dimension of the new traffic flow sample.

[0148] For example, Figure 3As shown, the abnormal traffic flow sample includes a weather condition. The electronic device can synthesize a new traffic flow sample based on the weather condition of the abnormal traffic flow sample case and the weather conditions of the first traffic flow sample 301 , the second traffic flow sample 302 and the third traffic flow sample 303 .

[0149] If the weather status is a categorical feature, when the electronic device synthesizes a new traffic flow sample based on the weather status of the abnormal traffic flow sample case and the weather status of the first traffic flow sample 301, the electronic device can use the weather status of the abnormal traffic flow sample case as the weather status of the new traffic flow sample.

[0150] In the scheme of this embodiment, since the dynamic and static spatiotemporal representation can be used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at the same location in different time periods, the preset traffic state representation can be used to represent the representation vectors of pre-defined different traffic states, and the traffic flow representation can be extracted based on the relationship between the traffic flow included in the traffic flow sample and the preset traffic state representation. Then, the sample features obtained by splicing the dynamic and static spatiotemporal representation and the traffic flow representation can reflect the traffic state at a specific time point and at a specific location while realizing the dynamic embedding of traffic events. In this way, based on the sample representation corresponding to each traffic flow sample, the relationship between each abnormal traffic flow sample and the traffic flow other than the abnormal traffic flow sample is calculated. The distance between samples is measured, and the safety area corresponding to each abnormal traffic flow sample is divided according to the relationship between the distance and the preset distance threshold. This can make the neighboring traffic flow samples in the safety area have similar traffic event change characteristics and similar traffic conditions as the abnormal traffic flow samples. Then, based on the various dimensional features of each abnormal traffic flow sample and the various dimensional features of its corresponding neighboring traffic flow samples, new traffic flow samples can be synthesized, which solves the problem of data imbalance. In addition, adding new traffic flow samples in the process of training the traffic flow regression prediction model can better learn the characteristics of the traffic flow samples, making the trained traffic flow regression prediction model more accurate, and at the same time optimizing the prediction effect of the model under abnormal traffic conditions.

[0151] As an implementation method of the present application, Figure 4 As shown, the step of extracting the dynamic and static spatiotemporal representation of each traffic flow sample based on the static attribute information and dynamic change information included in each traffic flow sample may include:

[0152] S401, inputting each traffic flow sample into a pre-trained extraction model, so that the spatiotemporal representation extraction unit extracts a static representation based on the static attribute information included in the traffic flow sample, and extracts a dynamic representation based on the dynamic change information included in the traffic flow sample;

[0153] In order to extract the dynamic and static spatiotemporal representations and traffic flow representations of each traffic flow sample, an extraction model can be pre-trained. The extraction model can include a spatiotemporal representation extraction unit and a traffic flow representation extraction unit, such as Figure 5 As shown, the left part of the extraction model is the spatiotemporal representation extraction unit, and the right part is the flow representation extraction unit.

[0154] In order to extract dynamic and static time representations, a spatiotemporal representation extraction unit for extracting static and dynamic representations can be pre-trained, so that the electronic device can input each traffic flow sample into a pre-trained extraction model, so that the spatiotemporal representation extraction unit of the extraction model can extract a static representation based on the static attribute information included in the traffic flow sample, and extract a dynamic representation based on the dynamic change information included in the traffic flow sample.

[0155] In one embodiment, the spatiotemporal representation extraction unit can extract a static representation vector based on the static attribute information included in the traffic flow sample as a static representation, and extract a dynamic representation vector based on the dynamic change information included in the traffic flow sample as a dynamic representation. The spatiotemporal representation extraction unit can include a pre-constructed first extraction network layer and a second extraction network layer, the first extraction network layer is used to extract the static representation vector, and the second extraction network layer is used to extract the dynamic representation vector.

[0156] For example, the static attribute information included in the traffic flow sample is weather conditions, vehicle flow and congestion status, and the dynamic change information includes vehicle flow change values. Then the electronic device inputs each traffic flow sample into a pre-trained extraction model, so that the spatiotemporal representation extraction unit of the extraction model can extract a static representation vector based on the weather conditions, vehicle flow and congestion status included in the traffic flow sample, and extract a dynamic representation vector based on the vehicle flow change value included in the traffic flow sample.

[0157] Electronic devices can extract dynamic representations, that is, they can achieve dynamic embedding. Dynamic embedding can be used to represent the changing situation of traffic events along the timeline, and the current learning content can be updated based on past information. In order to capture the abnormal impact of traffic flow changes and vehicle speed changes in unbalanced data, the dynamic representation extraction can be performed through a deep learning model based on indicators such as traffic flow change value, traffic flow change rate, speed change value and speed change rate between the same location and different time points, so as to pay more attention to the abnormal changes of traffic flow, vehicle speed, etc. between different time points in the traffic flow prediction process, and then discover the correlation between the mutual influence of traffic events and time changes, that is, discover the correlation of traffic events in the time dimension.

[0158] Combine the following Figure 6 The process of extracting dynamic representations from electronic devices, i.e., dynamic embedding, is described in detail. Figure 6 As shown in the figure, Location 1, Location 2, and Location 3 represent three traffic intersections respectively. The circle on the left represents the static attribute information at each time from t1 to t6, such as weather conditions, traffic flow, congestion status, etc. at each time from t1 to t6. Electronic devices can extract static representations based on the static attribute information. The square part on the right represents the dynamic change information from t1 to t6, such as the traffic flow change value, traffic flow change rate, vehicle speed change value, and vehicle speed change rate. Electronic devices can extract dynamic representation based on dynamic change information. , as in Figure 6 The dark circle 601 corresponding to time t2 at Location 1 indicates that when traffic is abnormally congested, the change value of the traffic volume between time t1 and time t2 increases, as indicated by the dark arrow 602. Conversely, the light circle 603 corresponding to time t3 at Location 1 indicates that when traffic is normal, the change value of the traffic volume between time t2 and time t3 decreases, as indicated by the light arrow 604.

[0159] S402, for each traffic flow sample, concatenate the static representation and the dynamic representation of the traffic flow sample to obtain an initial static and dynamic time representation;

[0160] For each traffic flow sample, after obtaining the static representation and dynamic representation of the traffic flow sample, the static representation and dynamic representation of the traffic flow sample can be spliced ​​to obtain the initial dynamic and static time representation, which can be used to represent the characteristics of traffic event time changing with time.

[0161] In one implementation, the electronic device may add the static characterization vector and the dynamic characterization vector to obtain an initial static and dynamic time characterization. For example, at the same time at the same location, the static characterization vector of the traffic flow sample is , the dynamic representation vector is , electronic devices can transform static representation vectors and dynamic representation vector Add and get the initial dynamic and static time representation .

[0162] In another embodiment, the electronic device may associate the static characterization vector with the dynamic characterization vector to obtain an initial static and dynamic time characterization. For example, at time t at the same location, the static characterization vector of the traffic flow sample is , the dynamic representation vector is , the current dynamic representation vector is related to the dynamic representation vector of the previous moment, and the current learning content can be updated based on past information. Figure 5 The current dynamic representation vector can be expressed as ,in, is the activation function, and W is the weight, which can also reflect the characteristics of traffic events changing over time.

[0163] S403, using a pre-constructed multi-dimensional graph, based on the initial dynamic and static time representation and the graph convolutional network, extracting a multi-dimensional spatial representation;

[0164] Among them, the multi-dimensional graphs are established based on the spatial structure characteristics of the locations corresponding to the traffic flow samples, and the graph convolutional network is used to extract the spatial features of the traffic flow samples under the spatial structure characteristics of the corresponding locations.

[0165] Since traffic events are affected by space, multi-dimensional maps can be constructed in advance based on the spatial structure characteristics of each location. In this way, electronic devices can use pre-constructed multi-dimensional maps to extract multi-dimensional spatial representations based on the initial dynamic and static time representations and graph convolutional networks. In other words, each dimensional map corresponds to a spatial representation of one dimension. Among them, the multi-dimensional maps are established based on the spatial structure characteristics of the location corresponding to the traffic flow sample, and the graph convolutional network can be used to extract the spatial characteristics of the traffic flow sample under the spatial structure characteristics of the corresponding location.

[0166] For example, the spatial structure characteristics may include traffic road grids, vehicle collision records, and public transportation facility distribution maps. In this way, the spatial representations of multiple dimensions extracted by the electronic device can reflect the spatial characteristics of the traffic flow samples under these spatial structure characteristics. For example, if the atlas is constructed based on vehicle collision records, the spatial representation extracted by the electronic device can reflect the spatial characteristics of the vehicle collision situation.

[0167] S404: Fusing the spatial representations of the multiple dimensions to obtain a dynamic and static spatiotemporal representation of the traffic flow sample.

[0168] Since the spatial representation of each dimension corresponds to the spatial features under different spatial structural characteristics, when the electronic device extracts the spatial representation of multiple dimensions, the spatial representation of multiple dimensions can be fused to obtain the dynamic and static spatiotemporal representation of the traffic flow sample. In other words, the dynamic and static spatiotemporal representation of the traffic flow sample can represent the characteristics of traffic events changing over time, and can also represent the characteristics of traffic events under different spatial structures.

[0169] In one embodiment, the electronic device may perform weighted summation of spatial representations of multiple dimensions to obtain a dynamic and static spatiotemporal representation of the traffic flow sample. In another embodiment, the electronic device may use an attention mechanism (such as an Attention Layer) to fuse spatial representations of multiple dimensions to obtain a dynamic and static spatiotemporal representation of the traffic flow sample.

[0170] For example, the spatial representations of multiple dimensions include spatial representation 1, spatial representation 2, and spatial representation 3. The electronic device can perform weighted summation of the spatial representations in the manner of a×spatial representation 1+b×spatial representation 2+c×spatial representation 3, or use the Attention Layer to fuse spatial representation 1, spatial representation 2, and spatial representation 3 to obtain the dynamic and static spatiotemporal representation of the traffic flow sample, that is, projecting the spatial representations of multiple dimensions into a representation space of a common dimension.

[0171] It can be seen that in the embodiment of the present application, the electronic device can splice the static representation and dynamic representation of the traffic flow sample to obtain the initial dynamic and static time representation, and then use the pre-constructed multi-dimensional graph to extract the multi-dimensional spatial representation based on the initial dynamic and static time representation and the graph convolution network, and then fuse the multi-dimensional spatial representation to obtain the dynamic and static spatiotemporal representation of the traffic flow sample. In this way, the obtained dynamic and static spatiotemporal representation can not only represent the characteristics of traffic events changing over time, but also represent the characteristics of traffic events under different spatial structures.

[0172] As an implementation method of the present application, Figure 7 As shown, the above step of extracting the static attribute information included in the traffic flow sample to obtain the static representation may include:

[0173] S701, performing binning processing on the continuous data in the static attribute information included in the traffic flow sample to obtain a first binning result;

[0174] S702: Input the first binning result and the non-continuous data included in the traffic flow sample into a pre-constructed first extraction network layer to obtain a static representation.

[0175] The static attribute information included in the traffic flow sample contains continuous data and categorical data. Continuous data includes traffic flow, and categorical data includes weather conditions, traffic conditions, etc. For categorical data, since the categorical feature values ​​are limited, it can generally be mapped to a low-dimensional vector by table lookup. For continuous data, since its values ​​are infinite, it cannot be directly mapped to a low-dimensional vector by table lookup.

[0176] In one embodiment, the electronic device can perform binning processing on the continuous data in the static attribute information included in the traffic flow sample to obtain a first binning result. The binning process refers to discretizing the continuous data according to the discretization rule. For example, if the traffic flows included in multiple traffic flow samples are 8, 10, 15, 5, 16, and 18, then four intervals of 1-5, 6-10, 11-15, and 16-20 can be determined first, and each interval corresponds to a value of 1, 2, 3, and 4, respectively. In this way, after the traffic flow is binned, the binning results obtained are 2, 2, 3, 1, 4, and 4.

[0177] After obtaining the first binning result, the electronic device can input the first binning result and the non-continuous data included in the traffic flow sample into a pre-constructed first extraction network layer to obtain a static representation. The first extraction network layer can be used to extract the static representation.

[0178] Exemplarily, the first extraction network layer can be an Embedding network layer. After the electronic device inputs the first binning result and the non-continuous data included in the traffic flow sample into the pre-built first extraction network layer, the first extraction network layer can convert the high-dimensional first binning result and the non-continuous data into a low-dimensional Embedding vector as a static representation, wherein the low-dimensional vector includes the characteristics of static attribute information.

[0179] For example, the non-continuous data is weather conditions, and the values ​​obtained by looking up the table are 1, 5, 3, 6, 5, 3 respectively. The electronic device can input the first binning results 2, 2, 3, 1, 4, 4 and the non-continuous data 1, 5, 3, 6, 5, 3 into the Embedding network layer to obtain the Embedding vector representation corresponding to the static attribute information.

[0180] In one embodiment, before inputting the non-continuous data into the pre-built first extraction network layer, the electronic device may perform category encoding, such as OneHot category encoding, on the non-continuous data.

[0181] It can be seen that in this embodiment, the electronic device can perform binning processing on the continuous data in the static attribute information included in the traffic flow sample to obtain a first binning result, and then input the first binning result and the non-continuous data included in the traffic flow sample into a pre-constructed first extraction network layer to obtain a static representation. In this way, the obtained static representation can be a low-dimensional vector representation and include the characteristics of the static attribute information, so as to pay attention to the static attribute information at each location and time point in the traffic flow prediction process.

[0182] As an implementation method of the present application, Figure 8As shown, the above step of extracting dynamic representation based on the dynamic change information included in the traffic flow sample may include:

[0183] S801, performing binning processing on the dynamic change information included in the traffic flow sample to obtain a second binning result;

[0184] The dynamic change information includes at least one of a traffic flow change value, a traffic flow change rate, a speed change value and a speed change rate at different time points at the same location.

[0185] S802: Input the second binning result into a second pre-built extraction network layer to obtain a dynamic representation.

[0186] The dynamic change information included in the traffic flow sample is continuous data, and the electronic device can perform binning processing on the dynamic change information included in the traffic flow sample to obtain a second binning result. The dynamic change information includes at least one of the traffic flow change value, traffic flow change rate, speed change value, and speed change rate at different time points at the same location. That is, the dynamic change information can include one, more, or all of the traffic flow change value, traffic flow change rate, speed change value, and speed change rate at different time points at the same location.

[0187] Binning refers to the discretization of continuous data according to discretization rules. For example, if the traffic flow change values ​​are 3, 6, 10, 5, 11, and 18, then we can first determine the four intervals of 1-5, 6-10, 11-15, and 16-20, and each interval corresponds to a value of 1, 2, 3, and 4. In this way, after the traffic flow change values ​​are binned, the binning results are 1, 2, 2, 1, 3, and 4.

[0188] After obtaining the second binning result, the electronic device can input the second binning result into the pre-built second extraction network layer to obtain a dynamic representation. The second extraction network layer can be used to extract the dynamic representation. Since the second binning result is processed by a deep learning model (i.e., the second extraction network layer) to obtain a dynamic representation, more attention can be paid to abnormal changes in traffic flow, vehicle speed, etc. between different time points during traffic flow prediction.

[0189] Exemplarily, the second extraction network layer may be an Embedding network layer. After the electronic device inputs the second binning result into a pre-built second extraction network layer, the second extraction network layer may convert the high-dimensional second binning result into a low-dimensional Embedding vector as a dynamic representation, wherein the low-dimensional vector includes features of dynamically changing information.

[0190] For example, the second binning results corresponding to the traffic flow change values ​​are 1, 2, 2, 1, 3 and 4. The electronic device inputs the second binning results 1, 2, 2, 1, 3 and 4 into the Embedding network layer to obtain the Embedding vector representation corresponding to the traffic flow change values.

[0191] It can be seen that in this embodiment, the electronic device can perform binning processing on the dynamic change information included in the traffic flow sample to obtain a second binning result, and then input the second binning result into the second pre-built extraction network layer to obtain a dynamic representation. In this way, the obtained dynamic representation can be a low-dimensional vector representation, and include the characteristics of dynamic attribute information, so as to pay more attention to the abnormal changes in traffic flow, vehicle speed, etc. between different time points in the traffic flow prediction process.

[0192] As an implementation of an embodiment of the present application, the step of extracting multiple dimensional spatial representations based on the initial dynamic and static time representations using multiple pre-constructed graph convolutional networks may include:

[0193] For the pre-constructed graph of each dimension, a graph convolution network is used to perform graph convolution processing on the initial dynamic and static time representation to obtain the graph convolution result corresponding to the graph of that dimension as a spatial representation of one dimension; wherein the pre-constructed graphs of multiple dimensions are respectively constructed based on the spatial structural characteristics of the traffic road grid, vehicle collision records and public transportation facility distribution map of the location corresponding to the traffic flow sample.

[0194] After obtaining the initial dynamic and static time representation, the electronic device can pre-construct a graph of multiple dimensions in order to further extract spatial features of multiple dimensions. In this way, for each pre-constructed graph of each dimension, the electronic device can use a graph convolution network to perform graph convolution processing on the initial dynamic and static time representation, and obtain the graph convolution result corresponding to the graph of that dimension as a spatial representation of one dimension.

[0195] Among them, the pre-constructed multi-dimensional graphs are constructed based on the spatial structure characteristics of the traffic road grid, vehicle collision records, and public transportation facility distribution map at the location corresponding to the traffic flow sample. The graph convolutional network can use GCN (Graph Convolutional Network), that is, GCN is used on the graphs of each dimension to perform graph convolution processing on the initial dynamic and static time representation.

[0196] For example, Figure 5As shown in the left part, after obtaining the static representation and the dynamic representation, the electronic device can splice the static representation and the dynamic representation to obtain the initial dynamic and static time representation. The pre-constructed three-dimensional graphs are constructed based on the spatial structure characteristics of the traffic road grid, vehicle collision records, and public transportation facility distribution map. GCN is used to perform graph convolution processing on the initial dynamic and static time representation on each dimensional graph. After obtaining the graph convolution result corresponding to the graph of each dimension, the spatial representation of each dimension is obtained. The spatial features of the three dimensions can be input into the attention layer for fusion to obtain the dynamic and static spatiotemporal representation, which can reflect the spatial information of the three dimensions of traffic roads, vehicle collision conditions, and public transportation facilities.

[0197] It can be seen that in this embodiment, for each pre-constructed graph of each dimension, the electronic device can use the graph convolution network to perform graph convolution processing on the initial dynamic and static time representation, and obtain the graph convolution result corresponding to the graph of the dimension as a spatial representation of one dimension. In this way, spatial features of multiple dimensions can be extracted, and then the spatial features of multiple dimensions can be fused, so that the obtained dynamic and static spatiotemporal representation fuses the spatial features of multiple dimensions and can reflect spatial information of different dimensions.

[0198] The purpose of constructing a graph network is to use graphs with different spatial structure characteristics to obtain the correlation of different spatial features, construct graphs from the perspective of traffic road grids, vehicle collision records and public transportation facility distribution maps, obtain multi-dimensional spatial representations, and use the attention mechanism to obtain the weights of each spatial feature, and then obtain a common dimensional representation space by fusing multi-dimensional spatial features.

[0199] As an implementation method of the present application, Fig. 9 As shown, the step of extracting the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and the preset traffic state representation may include:

[0200] S901, inputting the traffic flow included in the traffic flow sample into a pre-trained extraction model, so that the prediction network in the traffic characterization extraction unit predicts the probability vectors of the traffic flow belonging to different traffic states based on the traffic flow and the traffic characterization vectors of different traffic states;

[0201] In the traffic flow prediction scenario, although the difference between traffic flows is meaningful, traffic flow is affected by both time and space factors, which requires considering the characteristics of time and space in the construction of traffic flow samples. The same flow may represent different traffic states at different intersections. Therefore, it is necessary to extract additional information implied by traffic flow under specific time and space conditions, such as the probability of traffic flow belonging to different traffic states.

[0202] The pre-trained extraction model includes a spatiotemporal representation extraction unit and a flow representation extraction unit, wherein the flow representation extraction unit can predict the probability of traffic flow belonging to different traffic states. The electronic device can input the traffic flow included in the traffic flow sample into the pre-trained extraction model, so that the prediction network in the flow representation extraction unit predicts the probability vector of traffic flow belonging to different traffic states based on the traffic flow and the flow representation vectors of different traffic states. Among them, the flow representation vectors of different traffic states can represent the flow characteristics of unblocked, basically unblocked, light congestion, moderate congestion, severe congestion and no cars. The prediction network can be a DNN network, etc., which are not specifically limited here.

[0203] Each element in the probability vector can represent the probability of the traffic flow belonging to each traffic state at this time. For example, if different traffic states include unimpeded, basically unimpeded, light congestion, moderate congestion, severe congestion and no car, then the DNN network in the traffic characterization extraction unit can predict the probability vector of the traffic flow belonging to each state of unimpeded, basically unimpeded, light congestion, moderate congestion, severe congestion and no car based on the traffic flow and the traffic characterization vectors corresponding to each state of unimpeded, basically unimpeded, light congestion, moderate congestion, severe congestion and no car. The probability vector is a 1x6 vector, which is (1%, 1%, 6%, 90%, 2%, 0), where the first 1% represents the probability of the traffic flow belonging to unimpeded, and so on, and the last 0 represents the probability of the traffic flow belonging to no car.

[0204] S902: Determine the traffic flow representation of the traffic flow sample based on the relationship between the probability vector and the preset traffic state representation.

[0205] In the problem of traffic flow regression prediction, vehicle flow and pedestrian flow are continuous data. It is impossible to convert continuous data into vectors by table lookup, that is, there is a lack of methods to convert them into vectors. Currently, there are three main methods to convert continuous data into vectors:

[0206] (1) No Embedding: Directly use the original continuous data and input the continuous data into DNN (Deep Neural Network) for vector representation; (2) Field Embedding: Learn an Embedding vector for each continuous data domain separately, and then multiply the continuous data by the Embedding vector; (3) Discretization: Discretize the continuous data into buckets, and then use the Embedding method of categorical data, that is, the look-up method, to perform vector conversion.

[0207] Since the first two methods have low representation capacity and may lead to suboptimal results, the third method may have problems with SBD (Similar value But Dis-similar embedding) and DBS (Dis-similar value But Same embedding). Therefore, the embodiment of the present application provides a method for converting traffic flow into a vector representation, that is, a preset traffic state representation is pre-constructed to represent the representation vectors of pre-defined different traffic states, and then the traffic flow representation of the traffic flow sample is determined based on the relationship between the probability vector and the preset traffic state representation.

[0208] That is, the electronic device can determine the characterization vectors of traffic flows belonging to different traffic states based on the probabilities of traffic flows belonging to different traffic states and the predefined characterization vectors of different traffic states, and further determine the traffic flow characterization of the traffic flow sample.

[0209] For example, the preset traffic state characteristics can be used to represent the characterization vectors of unblocked, basically unblocked, light congestion, moderate congestion, severe congestion, and no car. In this way, the electronic device can determine the characterization vectors of the traffic flow belonging to the states of unblocked, basically unblocked, light congestion, moderate congestion, severe congestion, and no car based on the probability of the traffic flow belonging to unblocked, basically unblocked, light congestion, moderate congestion, severe congestion, and no car, and the pre-defined characterization vectors of unblocked, basically unblocked, light congestion, moderate congestion, severe congestion, and no car, and then determine the traffic flow characterization of the traffic flow sample.

[0210] As an implementation method, the preset traffic state representation is a matrix, each row vector in the matrix represents a predefined traffic state, and the matrix can learn globally shared knowledge. Then the electronic device can perform matrix multiplication operation on the probability vector of traffic flow belonging to different traffic states and the preset traffic state representation to obtain the traffic flow representation of the traffic flow sample. Among them, the number of columns of the probability vector of traffic flow belonging to different traffic states is the same as the number of rows of the matrix.

[0211] For example, according to the road traffic flow level classification, the preset traffic state representation can be set to a 6x5 matrix, which is , each row vector in the matrix represents a predefined traffic state, and the six row vectors represent the six traffic states of unimpeded traffic, basically unimpeded traffic, light congestion, moderate congestion, severe congestion, and no cars. Then the electronic device can perform matrix multiplication operation on the probability vector (1%, 1%, 6%, 90%, 2%, 0) of traffic flow belonging to different traffic states and the preset traffic state representation to obtain the traffic flow representation of the traffic flow sample, that is, the 1x5-dimensional traffic flow representation.

[0212] For example, Figure 5 As shown in the right part, the traffic flow at time t5 is input into the spatiotemporal representation extraction unit to obtain the probability vector of the traffic flow belonging to different traffic states. ,Right now( , …, ), which realizes the automatic discretization process. Through the aggregation function, the probability vector By performing matrix multiplication operation with the preset traffic state representation, the traffic flow representation can be obtained. After extracting the dynamic and static spatiotemporal representation and the traffic flow representation, the electronic device can splice the dynamic and static spatiotemporal representation corresponding to each traffic flow sample with the traffic flow representation to obtain the sample representation.

[0213] It can be seen that in this embodiment, the prediction network in the traffic representation extraction unit can predict the probability vector of traffic flow belonging to different traffic states based on traffic flow and traffic representation vectors of different traffic states, and then the electronic device can determine the traffic flow representation of the traffic flow sample based on the relationship between the probability vector and the preset traffic state representation, so that the relationship between the traffic flow and the preset traffic state representation can be obtained while discretizing the traffic flow based on the preset traffic state representation, and the implicit information of the traffic flow under specific time and space conditions can be extracted. In addition, using the traffic flow representation in the subsequent traffic prediction model can effectively improve the prediction effect of the model.

[0214] As an implementation method of the present application, Fig.10 As shown, the step of synthesizing a new traffic flow sample based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples may include:

[0215] S1001, for each abnormal traffic flow sample, determine the dimensional features of a new traffic flow sample according to the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area;

[0216] After the electronic device divides the safety area corresponding to each abnormal traffic flow sample, the neighboring traffic flow samples of the abnormal traffic flow sample can be determined. The abnormal traffic flow sample and the neighboring traffic flow samples meet a certain distance requirement and therefore have similarity. The electronic device can determine the dimensional features of the new traffic flow sample based on the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in its safety area. The original features may include weather conditions, traffic flow, and traffic status, etc., which are not specifically limited here. The number of new traffic flow samples is the same as that of the neighboring traffic flow samples.

[0217] For example, the safety area includes an abnormal traffic flow sample case and multiple neighboring traffic flow samples near1, near2 and near3. The abnormal traffic flow sample case and the multiple neighboring traffic flow samples near1, near2 and near3 all include original characteristic weather conditions, traffic flow and traffic conditions. Then, the electronic device can determine the weather conditions, traffic flow and traffic conditions of new traffic flow samples according to the weather conditions, traffic flow and traffic conditions of the abnormal traffic flow sample case and the multiple neighboring traffic flow samples near1, near2 and near3, wherein the number of new traffic flow samples is 3.

[0218] S1002, based on the distances between the dimensional features of the new traffic flow sample and the dimensional features of the abnormal traffic flow sample and the dimensional features of each neighboring traffic flow sample, the traffic flow value of the new traffic flow sample is calculated.

[0219] After obtaining the dimensional features of the new traffic flow sample, in order to further accurately determine the traffic flow value of the new traffic flow sample, the electronic device can calculate the traffic flow value of the new traffic flow sample based on the distance between the dimensional features of the new traffic flow sample and the dimensional features of the abnormal traffic flow sample and the dimensional features of each neighboring traffic flow sample.

[0220] For example, the abnormal traffic flow sample is case, and the neighboring traffic flow sample is near1. After determining the new traffic flow sample, the electronic device can calculate the distance between the new traffic flow sample and the characteristics of each dimension of the abnormal traffic flow sample case to obtain d1, and calculate the distance between the new traffic flow sample and the characteristics of each dimension of the neighboring traffic flow sample near1 to obtain d2. In this way, the electronic device calculates the traffic flow value of the new traffic flow sample based on the traffic flow of the abnormal traffic flow sample, the traffic flow of the neighboring traffic flow sample, d1 and d2.

[0221] It can be seen that in this embodiment, for each abnormal traffic flow sample, the electronic device calculates the traffic flow value of the new traffic flow sample while determining the characteristics of each dimension of the new traffic flow sample. In this way, new traffic flow samples with different pertinences can be obtained to meet the training requirements of different models, thereby making more accurate and diverse predictions on the traffic flow.

[0222] As an implementation method of the present application, Fig.11 As shown, the step of determining the dimensional features of the new traffic flow sample based on the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area may include:

[0223] S1101, respectively calculating the difference between the continuous features of each dimension of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area;

[0224] S1102, summing the product of the continuous features of each dimension of the abnormal traffic flow sample and the target as the continuous features of each dimension of the new traffic flow sample;

[0225] The target product is the product of a random number within a preset value range and the difference.

[0226] The abnormal traffic flow sample and each neighboring traffic flow sample in the safety area include multiple dimensional features, which may include continuous features or categorical features. For continuous features, the electronic device can calculate the difference between the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area.

[0227] After obtaining the difference, the electronic device can add the continuous features of each dimension of the abnormal traffic flow sample and the target product as the continuous features of each dimension of the new traffic flow sample. The target product is the product of a random number within a preset value range and the difference. The preset value range can be 0 to 1, which is not specifically limited here.

[0228] For example, the abnormal traffic flow sample is case, and the neighboring traffic flow sample is near1. The electronic device can calculate the difference between the continuous features of the abnormal traffic flow sample case and the neighboring traffic flow sample near1 to obtain diff1. Then the electronic device can add the continuous feature of the abnormal traffic flow sample and the target product to obtain diff1. The values ​​of are used as continuous features of each dimension of the new traffic flow sample.

[0229] S1103, for the category features of each dimension of the new traffic flow sample, the category features of the dimension of the abnormal traffic flow sample, or the category features of the dimension of the neighboring traffic flow sample, are used as the category features of the dimension of the new traffic flow sample.

[0230] Regarding categorical features, since categorical features can be represented by numerical values ​​and the abnormal traffic flow sample has similarities with its neighboring traffic flow samples in the safety area, the electronic device can use the categorical features of this dimension of the abnormal traffic flow sample, or the categorical features of this dimension of the neighboring traffic flow sample, as the categorical features of this dimension of the new traffic flow sample.

[0231] For example, the abnormal traffic flow sample is case and the neighboring traffic flow sample is near1. The electronic device can use the category feature Case_feature of the abnormal traffic flow sample case as the category feature of the dimension of the new traffic flow sample, and can also use the category feature near1_feature of the neighboring traffic flow sample near1 as the category feature of the dimension of the new traffic flow sample.

[0232] It can be seen that in this embodiment, the electronic device can use different methods to determine the multiple dimensional features of the new traffic flow sample for continuous features and categorical features, so that the obtained new traffic flow samples can meet the training requirements of different models, thereby making more accurate and diverse predictions on the traffic flow.

[0233] As an implementation method of the present application, Fig.12 As shown, the step of calculating the traffic flow value of the new traffic flow sample based on the distances between the dimensional features of the new traffic flow sample and the dimensional features of the abnormal traffic flow sample and the dimensional features of each neighboring traffic flow sample may include:

[0234] S1201, respectively calculating the first distance between each dimensional feature of the new traffic flow sample and each dimensional feature of the abnormal traffic flow sample, and the second distance between each dimensional feature of the new traffic flow sample and each dimensional feature of each neighboring traffic flow sample;

[0235] S1202: Calculate a traffic flow value of a new traffic flow sample based on the first distance, the second distance, the traffic flow included in the abnormal traffic flow sample, and the traffic flow included in each neighboring traffic flow sample.

[0236] After obtaining the dimensional features of the new traffic flow sample, in order to further accurately determine the traffic flow value of the new traffic flow sample, in one embodiment, the electronic device can respectively calculate the first distance between the dimensional features of the new traffic flow sample and the dimensional features of the abnormal traffic flow sample, and the second distance between the dimensional features of the new traffic flow sample and the dimensional features of each neighboring traffic flow sample.

[0237] Then, based on the first distance, the second distance, the traffic flow included in the abnormal traffic flow sample and the traffic flow included in each neighboring traffic flow sample, a traffic flow value of a new traffic flow sample is calculated.

[0238] As an implementation method, the electronic device can calculate the traffic flow value of the new traffic flow sample according to the following formula: :

[0239] ;

[0240] Where d1 is the first distance, d2 is the second distance, is the traffic flow included in the abnormal traffic flow sample, is the traffic flow included in the neighborhood traffic flow sample.

[0241] For example, the abnormal traffic flow sample is case, the traffic flow included in the abnormal traffic flow sample is case_TrafficFlow, the neighboring traffic flow sample is near1, and the traffic flow included in the neighboring traffic flow sample near1 is near1_TrafficFlow, the electronic device can respectively calculate the first distance d1 between each dimensional feature of the new traffic flow sample and each dimensional feature of the abnormal traffic flow sample case, and the second distance d2 between each dimensional feature of the new traffic flow sample and each dimensional feature of the neighboring traffic flow sample near1, and calculate the distance d2 according to the first distance d1 between each dimensional feature of the new traffic flow sample and each dimensional feature of the neighboring traffic flow sample near1. Calculate the traffic flow value of the new traffic flow sample.

[0242] It can be seen that in this embodiment, the electronic device can calculate the traffic flow value of the new traffic flow sample based on the first distance between the various dimensional features of the new traffic flow sample and the various dimensional features of the abnormal traffic flow sample, the second distance between the various dimensional features of the new traffic flow sample and each neighboring traffic flow sample, the traffic flow included in the abnormal traffic flow sample and the traffic flow included in each neighboring traffic flow sample, so that the new traffic flow sample is similar to the abnormal traffic flow sample, and the obtained new traffic flow sample meets actual needs.

[0243] Fig.13A specific flow chart of the traffic flow sample generation method provided in the embodiment of the present application. Fig.13 The traffic flow sample generation method provided in the embodiment of the present application is introduced by way of example. Fig.13 As shown, the traffic flow sample generation method provided in the embodiment of the present application may include the following steps:

[0244] S1301, extracting the dynamic and static spatiotemporal representation and traffic flow representation of each traffic flow sample at each traffic intersection at each time;

[0245] The electronic device can extract static features based on the static attribute information included in each traffic flow sample, and extract dynamic features based on the dynamic change information, and splice the static features with the dynamic features to obtain the dynamic and static time representation of each traffic flow sample.

[0246] Since the dynamic and static time representations are used to represent the characteristics of traffic events that change over time, in order to reflect that traffic events are also affected by space, multi-dimensional graphs can be pre-constructed. For each dimensional graph, the graph convolution network is used to perform graph convolution processing on the initial dynamic and static time representations to obtain the spatial representation of each dimension, and then the spatial representations of multiple dimensions are fused to obtain the dynamic and static spatiotemporal representation of each traffic flow sample.

[0247] In order to extract the characteristics of traffic flow belonging to different traffic states, the electronic device can extract the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and the preset traffic state representation.

[0248] S1302, based on the spliced ​​representation of the dynamic and static spatiotemporal representation corresponding to each traffic flow sample and the traffic flow representation, calculate the distance between each abnormal traffic flow sample and other traffic flow samples, and divide the safety area;

[0249] After extracting the dynamic and static spatiotemporal representation and the traffic flow representation, the electronic device can splice the dynamic and static spatiotemporal representation and the traffic flow representation corresponding to each traffic flow sample to obtain the sample representation, and then calculate the distance between each abnormal traffic flow sample and other traffic flow samples based on the sample characteristics, and classify the neighboring traffic flow samples whose distance to the abnormal traffic flow sample is not greater than a preset distance threshold into a safe area.

[0250] S1303, synthesizing a new traffic flow sample based on the dimensional features of each abnormal traffic flow sample and the dimensional features of the neighboring traffic flow samples corresponding to its safe area.

[0251] After dividing the safe area, the electronic device can determine the abnormal traffic flow samples and the neighboring traffic flow samples in the safe area, and then synthesize new traffic flow samples based on the various dimensional features of the abnormal traffic flow samples and the various dimensional features of each neighboring traffic flow sample.

[0252] It can be seen that in the solution provided by the embodiment of the present application, since the dynamic and static spatiotemporal representation can be used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at the same location in different time periods, the preset traffic state representation can be used to represent the representation vectors of pre-defined different traffic states, and based on the relationship between the traffic flow included in the traffic flow sample and the preset traffic state representation, the traffic flow representation can be extracted. Then, the sample features obtained by splicing the dynamic and static spatiotemporal representation and the traffic flow representation can reflect the traffic state at a specific time point and at a specific location while realizing the dynamic embedding of traffic events. In this way, based on the sample representation corresponding to each traffic flow sample, the relationship between each abnormal traffic flow sample and the traffic flow representation can be calculated. The distance between traffic flow samples other than the abnormal traffic flow sample is divided into a safe area corresponding to each abnormal traffic flow sample according to the relationship between the distance and the preset distance threshold, so that the neighboring traffic flow samples in the safe area and the abnormal traffic flow samples have similar traffic event change characteristics and similar traffic conditions. Therefore, new traffic flow samples can be synthesized based on the various dimensional features of each abnormal traffic flow sample and the various dimensional features of its corresponding neighboring traffic flow samples, which solves the problem of data imbalance. In addition, adding new traffic flow samples in the process of training the traffic flow regression prediction model can better learn the characteristics of the traffic flow samples and make the trained traffic flow regression prediction model more accurate.

[0253] Corresponding to the above-mentioned method for generating a traffic flow sample, the embodiment of the present application further provides a traffic flow sample generating device. The following is an introduction to a traffic flow sample generating device provided in the embodiment of the present application.

[0254] like Fig.14 As shown, a traffic flow sample generating device comprises:

[0255] The dynamic and static spatiotemporal representation extraction module 1410 is used to extract the dynamic and static spatiotemporal representation of each traffic flow sample based on the static attribute information and dynamic change information included in each traffic flow sample, wherein the dynamic and static spatiotemporal representation is used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at different time periods at the same location;

[0256] A traffic flow representation extraction module 1420 is used to extract the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and a preset traffic state representation, wherein the preset traffic state representation is used to represent a representation vector of predefined different traffic states;

[0257] A sample representation acquisition module 1430 is used to splice the dynamic and static spatiotemporal representations of each traffic flow sample with the traffic flow representation to obtain a sample representation corresponding to the traffic flow sample;

[0258] The distance calculation module 1440 is used to calculate the distance between each abnormal traffic flow sample and traffic flow samples other than the abnormal traffic flow sample based on the sample representation corresponding to each traffic flow sample, wherein the abnormal traffic flow sample is a traffic flow sample whose number of traffic flow samples of the category to which it belongs is less than a preset number;

[0259] The safety area division module 1450 is used to divide the safety area corresponding to each abnormal traffic flow sample according to the relationship between the distance and the preset distance threshold, wherein the distance between the abnormal traffic flow sample and the neighboring traffic flow sample in the safety area corresponding to the abnormal traffic flow sample is not greater than the preset distance threshold;

[0260] The traffic flow sample synthesis module 1460 is used to synthesize a new traffic flow sample based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples.

[0261] It can be seen that in the solution provided by the embodiment of the present application, since the dynamic and static spatiotemporal representation can be used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at the same location in different time periods, the preset traffic state representation can be used to represent the representation vectors of pre-defined different traffic states, and based on the relationship between the traffic flow included in the traffic flow sample and the preset traffic state representation, the traffic flow representation can be extracted. Then, the sample features obtained by splicing the dynamic and static spatiotemporal representation and the traffic flow representation can reflect the traffic state at a specific time point and at a specific location while realizing the dynamic embedding of traffic events. In this way, based on the sample representation corresponding to each traffic flow sample, the relationship between each abnormal traffic flow sample and the traffic flow representation can be calculated. The distance between traffic flow samples other than the abnormal traffic flow sample is divided into a safe area corresponding to each abnormal traffic flow sample according to the relationship between the distance and the preset distance threshold, so that the neighboring traffic flow samples in the safe area and the abnormal traffic flow samples have similar traffic event change characteristics and similar traffic conditions. Therefore, new traffic flow samples can be synthesized based on the various dimensional features of each abnormal traffic flow sample and the various dimensional features of its corresponding neighboring traffic flow samples, which solves the problem of data imbalance. In addition, adding new traffic flow samples in the process of training the traffic flow regression prediction model can better learn the characteristics of the traffic flow samples and make the trained traffic flow regression prediction model more accurate.

[0262] As an implementation of an embodiment of the present application, the above-mentioned dynamic and static spatiotemporal representation extraction module 1410 may include:

[0263] A dynamic and static representation extraction submodule, used for inputting each traffic flow sample into a pre-trained extraction model, so that the spatiotemporal representation extraction unit extracts a static representation based on the static attribute information included in the traffic flow sample, and extracts a dynamic representation based on the dynamic change information included in the traffic flow sample;

[0264] The time representation acquisition submodule is used to splice the static representation and dynamic representation of each traffic flow sample to obtain the initial dynamic and static time representation;

[0265] A spatial representation submodule is used to extract the spatial representation of multiple dimensions using the pre-built multi-dimensional graphs based on the initial dynamic and static time representation and the graph convolution network, wherein the multi-dimensional graphs are established based on the spatial structural characteristics of the location corresponding to the traffic flow sample, and the graph convolution network is used to extract the spatial features of the traffic flow sample under the spatial structural characteristics of the corresponding location;

[0266] The dynamic and static spatiotemporal representation submodule is used to fuse the spatial representations of the multiple dimensions to obtain the dynamic and static spatiotemporal representation of the traffic flow sample.

[0267] As an implementation of an embodiment of the present application, the above-mentioned dynamic and static characterization extraction submodule may include:

[0268] A first binning result obtaining unit is used to perform binning processing on the continuous data in the static attribute information included in the traffic flow sample to obtain a first binning result;

[0269] The static representation acquisition unit is used to input the first binning result and the non-continuous data included in the traffic flow sample into a pre-constructed first extraction network layer to obtain a static representation.

[0270] As an implementation of an embodiment of the present application, the above-mentioned dynamic and static characterization extraction submodule may include:

[0271] A second binning result obtaining unit is used to bin the dynamic change information included in the traffic flow sample to obtain a second binning result, wherein the dynamic change information includes at least one of a traffic flow change value, a traffic flow change rate, a speed change value, and a speed change rate at different time points at the same location;

[0272] The dynamic representation acquisition unit is used to input the second binning result into a second pre-built extraction network layer to obtain a dynamic representation.

[0273] As an implementation of an embodiment of the present application, the above-mentioned space representation submodule may include:

[0274] A spatial representation acquisition unit is used to perform graph convolution processing on the initial dynamic and static time representation using a graph convolution network for the pre-constructed graph of each dimension, and obtain a graph convolution result corresponding to the graph of the dimension as a spatial representation of one dimension;

[0275] Among them, the pre-constructed maps of multiple dimensions are constructed based on the spatial structure characteristics of the traffic road grid, vehicle collision records and public transportation facility distribution map of the location corresponding to the traffic flow sample.

[0276] As an implementation of an embodiment of the present application, the above-mentioned traffic flow characterization extraction module may include:

[0277] A probability vector acquisition unit, used for inputting the traffic flow included in the traffic flow sample into a pre-trained extraction model, so that the prediction network in the traffic characterization extraction unit predicts the probability vectors of the traffic flow belonging to different traffic states based on the traffic flow and the traffic characterization vectors of different traffic states;

[0278] A traffic flow representation determination unit, configured to determine a traffic flow representation of the traffic flow sample based on a relationship between the probability vector and a preset traffic state representation;

[0279] The preset traffic state is represented as a matrix, and each row vector in the matrix represents a predefined traffic state.

[0280] As an implementation of an embodiment of the present application, the above-mentioned traffic flow characterization determination unit may include:

[0281] The traffic flow representation acquisition subunit is used to perform a matrix multiplication operation on the probability vector and the preset traffic state representation to obtain the traffic flow representation of the traffic flow sample.

[0282] As an implementation of the embodiment of the present application, the traffic flow sample synthesis module may include:

[0283] The submodule for determining the features of each dimension is used to determine the features of each dimension of a new traffic flow sample for each abnormal traffic flow sample according to the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area;

[0284] The traffic flow value calculation submodule is used to calculate the traffic flow value of the new traffic flow sample based on the distance between the various dimensional features of the new traffic flow sample and the various dimensional features of the abnormal traffic flow sample and the various dimensional features of each neighboring traffic flow sample.

[0285] As an implementation of an embodiment of the present application, the above-mentioned dimensional feature determination submodules may include:

[0286] A difference calculation unit, used to calculate the difference of each dimension of continuous features between the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area;

[0287] A continuous feature acquisition subunit, used to add the continuous features of each dimension of the abnormal traffic flow sample and the target product as the continuous features of each dimension of the new traffic flow sample, wherein the target product is the product of a random number within a preset value range and the difference;

[0288] The category feature determination unit is used to use the category features of each dimension of the new traffic flow sample as the category features of the dimension of the abnormal traffic flow sample or the category features of the dimension of the neighboring traffic flow sample.

[0289] As an implementation of the embodiment of the present application, the above-mentioned traffic flow value calculation submodule may include:

[0290] A first distance and a second distance calculation unit, used to respectively calculate the first distance between each dimensional feature of the new traffic flow sample and each dimensional feature of the abnormal traffic flow sample, and the second distance between each dimensional feature of the new traffic flow sample and each dimensional feature of each neighboring traffic flow sample;

[0291] The traffic flow value calculation unit is used to calculate the traffic flow value of a new traffic flow sample based on the first distance, the second distance, the traffic flow included in the abnormal traffic flow sample and the traffic flow included in each neighboring traffic flow sample.

[0292] As an implementation of the embodiment of the present application, the above-mentioned traffic flow value calculation unit may include:

[0293] The traffic flow value calculation subunit is used to calculate the traffic flow value of the new traffic flow sample according to the following formula :

[0294] ;

[0295] Wherein, d1 is the first distance, d2 is the second distance, is the traffic flow included in the abnormal traffic flow sample, is the traffic flow included in the neighborhood traffic flow sample.

[0296] The present application also provides an electronic device, such as Fig.15 As shown, including:

[0297] Memory 1501, used for storing computer programs;

[0298] The processor 1502 is used to implement the steps of the traffic flow sample generation method described in any of the above embodiments when executing the program stored in the memory 1501.

[0299] In addition, the electronic device may further include a communication bus and / or a communication interface, and the processor 1502, the communication interface, and the memory 1501 communicate with each other via the communication bus.

[0300] It can be seen that in the solution provided by the embodiment of the present application, since the dynamic and static spatiotemporal representation can be used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at the same location in different time periods, the preset traffic state representation can be used to represent the representation vectors of pre-defined different traffic states, and based on the relationship between the traffic flow included in the traffic flow sample and the preset traffic state representation, the traffic flow representation can be extracted. Then, the sample features obtained by splicing the dynamic and static spatiotemporal representation and the traffic flow representation can reflect the traffic state at a specific time point and at a specific location while realizing the dynamic embedding of traffic events. In this way, based on the sample representation corresponding to each traffic flow sample, the relationship between each abnormal traffic flow sample and the traffic flow representation can be calculated. The distance between traffic flow samples other than the abnormal traffic flow sample is divided into a safe area corresponding to each abnormal traffic flow sample according to the relationship between the distance and the preset distance threshold, so that the neighboring traffic flow samples in the safe area and the abnormal traffic flow samples have similar traffic event change characteristics and similar traffic conditions. Therefore, new traffic flow samples can be synthesized based on the various dimensional features of each abnormal traffic flow sample and the various dimensional features of its corresponding neighboring traffic flow samples, which solves the problem of data imbalance. In addition, adding new traffic flow samples in the process of training the traffic flow regression prediction model can better learn the characteristics of the traffic flow samples and make the trained traffic flow regression prediction model more accurate.

[0301] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0302] The communication interface is used for communication between the above electronic device and other devices.

[0303] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0304] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0305] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned traffic flow sample generation methods are implemented.

[0306] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the traffic flow sample generation methods in the above embodiments.

[0307] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.

[0308] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0309] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0310] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A method for generating traffic flow samples, It is characterized in that The method comprises: Based on the static attribute information and dynamic change information included in each traffic flow sample, extract the dynamic and static spatiotemporal representation of each traffic flow sample, wherein the dynamic and static spatiotemporal representation is used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at different time periods at the same location; Extracting the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and a preset traffic state representation, wherein the preset traffic state representation is used to represent a representation vector of predefined different traffic states; splicing the dynamic and static spatiotemporal representations of each traffic flow sample with the traffic flow representation to obtain a sample representation corresponding to the traffic flow sample; Based on the sample representation corresponding to each traffic flow sample, calculating the distance between each abnormal traffic flow sample and traffic flow samples other than the abnormal traffic flow sample, wherein the abnormal traffic flow sample is a traffic flow sample whose number of traffic flow samples of the category to which it belongs is less than a preset number; According to the relationship between the distance and the preset distance threshold, the safety area corresponding to each abnormal traffic flow sample is divided, wherein the distance between the abnormal traffic flow sample and the neighboring traffic flow sample in the safety area corresponding to the abnormal traffic flow sample is not greater than the preset distance threshold; Based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples, a new traffic flow sample is synthesized.

2. The method according to claim 1, It is characterized in that The step of extracting the dynamic and static spatiotemporal representation of each traffic flow sample based on the static attribute information and dynamic change information included in each traffic flow sample comprises: Input each traffic flow sample into a pre-trained extraction model so that the spatiotemporal representation extraction unit extracts a static representation based on the static attribute information included in the traffic flow sample, and extracts a dynamic representation based on the dynamic change information included in the traffic flow sample; For each traffic flow sample, the static representation and the dynamic representation of the traffic flow sample are spliced ​​to obtain the initial dynamic and static time representation; Utilizing a pre-constructed multi-dimensional graph, based on the initial dynamic and static time representation and the graph convolution network, extracting a multi-dimensional spatial representation, wherein the multi-dimensional graph is established based on the spatial structural characteristics of the location corresponding to the traffic flow sample, and the graph convolution network is used to extract the spatial features of the traffic flow sample under the spatial structural characteristics of the corresponding location; The spatial representations of the multiple dimensions are fused to obtain a dynamic and static spatiotemporal representation of the traffic flow sample.

3. The method according to claim 2, It is characterized in that The step of extracting static representation based on the static attribute information included in the traffic flow sample includes: Binning the continuous data in the static attribute information included in the traffic flow sample to obtain a first binning result; The first binning result and the non-continuous data included in the traffic flow sample are input into a pre-constructed first extraction network layer to obtain a static representation.

4. The method according to claim 2, It is characterized in that The step of extracting dynamic characterization based on the dynamic change information included in the traffic flow sample includes: Performing binning processing on the dynamic change information included in the traffic flow sample to obtain a second binning result, wherein the dynamic change information includes at least one of a traffic flow change value, a traffic flow change rate, a speed change value, and a speed change rate at different time points at the same location; The second binning result is input into a second pre-built extraction network layer to obtain a dynamic representation.

5. The method according to claim 2, It is characterized in that The step of extracting the spatial representation of multiple dimensions by using the pre-constructed graph of multiple dimensions based on the initial dynamic and static time representation and the graph convolution network includes: For each pre-constructed graph of each dimension, a graph convolution network is used to perform graph convolution processing on the initial dynamic and static time representation to obtain a graph convolution result corresponding to the graph of the dimension as a spatial representation of one dimension; Among them, the pre-constructed maps of multiple dimensions are constructed based on the spatial structure characteristics of the traffic road grid, vehicle collision records and public transportation facility distribution map of the location corresponding to the traffic flow sample.

6. The method according to any one of claims 1 to 5, It is characterized in that The step of extracting the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and the preset traffic state representation comprises: The traffic flow included in the traffic flow sample is input into a pre-trained extraction model, so that the prediction network in the traffic characterization extraction unit predicts the probability vectors of the traffic flow belonging to different traffic states based on the traffic flow and the traffic characterization vectors of different traffic states; Based on the relationship between the probability vector and the preset traffic state representation, the traffic flow representation of the traffic flow sample is determined.

7. The method according to claim 6, It is characterized in that The preset traffic state is represented as a matrix, and each row vector in the matrix represents a predefined traffic state; The step of determining the traffic flow representation of the traffic flow sample based on the relationship between the probability vector and the preset traffic state representation comprises: A matrix multiplication operation is performed on the probability vector and the preset traffic state representation to obtain a traffic flow representation of the traffic flow sample.

8. The method according to any one of claims 1 to 5, It is characterized in that The step of synthesizing a new traffic flow sample based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples includes: For each abnormal traffic flow sample, the dimensional features of the new traffic flow sample are determined according to the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area; Based on the distances between the dimensional features of the new traffic flow sample and the dimensional features of the abnormal traffic flow sample and the dimensional features of each neighboring traffic flow sample, the traffic flow value of the new traffic flow sample is calculated.

9. The method according to claim 8, It is characterized in that The step of determining the dimensional features of the new traffic flow sample according to the original features of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area includes: Calculate the difference between the continuous features of each dimension of the abnormal traffic flow sample and each neighboring traffic flow sample in the safety area; The sum of the continuous features of each dimension of the abnormal traffic flow sample and the target product is used as the continuous features of each dimension of the new traffic flow sample, wherein the target product is the product of a random number within a preset value range and the difference; For the category features of each dimension of the new traffic flow sample, the category features of the dimension of the abnormal traffic flow sample or the category features of the dimension of the neighboring traffic flow sample are used as the category features of the dimension of the new traffic flow sample.

10. The method according to claim 8, It is characterized in that The step of calculating the traffic flow value of the new traffic flow sample based on the distances between the dimensional features of the new traffic flow sample and the dimensional features of the abnormal traffic flow sample and the dimensional features of each neighboring traffic flow sample comprises: Calculate the first distance between each dimensional feature of the new traffic flow sample and each dimensional feature of the abnormal traffic flow sample, and the second distance between each dimensional feature of the new traffic flow sample and each dimensional feature of each neighboring traffic flow sample; Based on the first distance, the second distance, the traffic flow included in the abnormal traffic flow sample and the traffic flow included in each neighboring traffic flow sample, a traffic flow value of a new traffic flow sample is calculated.

11. The method according to claim 10, It is characterized in that The step of calculating the traffic flow value of a new traffic flow sample based on the first distance, the second distance, the traffic flow included in the abnormal traffic flow sample, and the traffic flow included in each neighboring traffic flow sample comprises: Calculate the traffic flow value of the new traffic flow sample according to the following formula : ; Among them, d 1 is the first distance, d 2 is the second distance, is the traffic flow included in the abnormal traffic flow sample, is the traffic flow included in the neighborhood traffic flow sample.

12. A traffic flow sample generating device, It is characterized in that The device comprises: A dynamic and static spatiotemporal representation extraction module is used to extract the dynamic and static spatiotemporal representation of each traffic flow sample based on the static attribute information and dynamic change information included in each traffic flow sample, wherein the dynamic and static spatiotemporal representation is used to represent the mutual influence of traffic events at different locations and the correlation between traffic events at different time periods at the same location; A traffic flow representation extraction module, configured to extract the traffic flow representation of each traffic flow sample based on the relationship between the traffic flow included in each traffic flow sample and a preset traffic state representation, wherein the preset traffic state representation is used to represent a representation vector of predefined different traffic states; A sample representation acquisition module, used to splice the dynamic and static spatiotemporal representations of each traffic flow sample with the traffic flow representation to obtain a sample representation corresponding to the traffic flow sample; A distance calculation module, used for calculating the distance between each abnormal traffic flow sample and traffic flow samples other than the abnormal traffic flow sample based on the sample representation corresponding to each traffic flow sample, wherein the abnormal traffic flow sample is a traffic flow sample whose number of traffic flow samples of the category to which it belongs is less than a preset number; A safety area division module, used to divide the safety area corresponding to each abnormal traffic flow sample according to the relationship between the distance and a preset distance threshold, wherein the distance between the abnormal traffic flow sample and the neighboring traffic flow sample in the safety area corresponding to the abnormal traffic flow sample is not greater than the preset distance threshold; The traffic flow sample synthesis module is used to synthesize new traffic flow samples based on the dimensional features of each abnormal traffic flow sample and the dimensional features of its corresponding neighboring traffic flow samples.

13. An electronic device, It is characterized in that include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-11 when executing a program stored in a memory.

Citation Information

Patent Citations

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

    CN109272169A

  • Traffic flow prediction method and device based on synthetic data

    CN113570861A

  • Traffic speed prediction method based on traffic flow data fusion and system

    CN113808396A

  • Traffic flow prediction method based on dynamic graph convolution and time sequence convolution network

    CN115376317A

  • Vehicle traffic flow prediction method with missing data

    US20210407284A1