Traffic flow prediction method and device, and computer readable storage medium
By combining video and positioning data, neural networks and convolution models are used to convert traffic flow data from coarse-grained to fine-grained, solving the problem of low prediction accuracy from a single data source and improving the accuracy of traffic flow prediction and the non-linearity of the model. Linear expression ability.
Patent Information
- Application Number
- CN202410624603.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-08-23
AI Technical Summary
Traffic flow prediction has limitations in spatiotemporal data perception, resulting in low prediction accuracy. In particular, it is difficult for a single data source to effectively capture the randomness and uncertainty of traffic flow.
Using multi-source data combination, we obtain fine-grained first historical traffic data through video data and positioning data to obtain coarse-grained second historical traffic data, and use neural network models and super-resolution query tensors to convert coarse-grained data into fine-grained data. , and combined with the convolution model for traffic flow prediction.
It improves the accuracy of traffic flow prediction, can more effectively capture the spatiotemporal changes in traffic flow, enhances the nonlinear expression ability of the prediction model, and improves the accuracy of traffic flow prediction at the target time.
Smart Images

Figure CN118538027A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence, and in particular to a traffic flow prediction method and device, and a computer-readable storage medium. Background Art
[0002] Traffic flow prediction (such as motor vehicle flow, non-motor vehicle flow, and pedestrian flow) is an important part of traffic planning and an important part of the preliminary research of road construction. At present, before planning and implementing transportation construction projects and policies, it is necessary to investigate, predict and analyze traffic flow. The accuracy of the prediction will directly affect the formulation of transportation planning schemes. The task of traffic flow prediction plays an important role in public safety, emergency response, resource allocation, etc. in smart cities.
[0003] Traffic flow varies with time and space, and is affected by vehicles, pedestrians and other interference factors. It exhibits randomness and uncertainty, and is difficult to predict. Summary of the invention
[0004] According to a first aspect of the present disclosure, a traffic flow prediction method is provided, comprising: obtaining first historical flow data with a first granularity and second historical flow data with a second granularity of a target area, wherein the first historical flow data is obtained based on video data, and the second historical flow data is obtained based on positioning data; generating third historical flow data with a first granularity based on the second historical flow data; and predicting the traffic flow of the target area at a target time based on the first historical flow data and the third historical flow data.
[0005] In some embodiments, the first granularity is smaller than the second granularity, and generating third historical traffic data with the first granularity based on the second historical traffic data includes: generating the third historical traffic data based on the second historical traffic data and multiple super-resolution query tensors using a neural network model.
[0006] In some embodiments, the total number of super-resolution query tensors is determined according to a first granularity and a second granularity.
[0007] In some embodiments, the neural network model includes k layers, k is a positive integer, and the third historical traffic data is generated based on the second historical traffic data and the super-resolution query tensor using the neural network model, including: using the first t layers of the neural network model to generate multiple intermediate tensors based on the second historical traffic data, where t is a positive integer, 0<t<k; inputting the multiple intermediate tensors and the multiple super-resolution query tensors into the t+1th layer of the neural network model to obtain the third historical traffic data.
[0008] In some embodiments, the first t layers of the neural network model are used to generate multiple intermediate tensors based on the second historical traffic flow data, including: using a shuffle model to generate multiple original tensors based on the second historical traffic flow data; using the first t layers of the neural network model to generate the multiple intermediate tensors based on the multiple original tensors.
[0009] In some embodiments, the target area includes multiple grids, each grid includes multiple sub-grids, the first granularity is determined according to the total number of the grids in the target area, and the second granularity is determined according to the total number of the sub-grids in the target area, and the total number of the grids is the same as the total number of the multiple intermediate tensors.
[0010] In some embodiments, the total number of super-resolution query tensors is equal to the difference between the total number of sub-grids in the target area and the total number of grids in the target area.
[0011] In some embodiments, the traffic flow prediction method further includes: before generating the third historical traffic data, adding a mask to the multiple super-resolution query tensors.
[0012] In some embodiments, the traffic flow of the target area at the target time is predicted based on the first historical traffic data and the third historical traffic data, including: for any sub-grid, when the sub-grid has corresponding first historical traffic data, the historical traffic flow of the sub-grid is determined according to the first historical traffic data corresponding to the sub-grid; when the sub-grid does not have corresponding first historical traffic data, the historical traffic flow of the sub-grid is determined according to the third historical traffic data corresponding to the sub-grid; based on the historical traffic flow of the sub-grid of the target area, the traffic flow of the target area at the target time is predicted.
[0013] In some embodiments, predicting the traffic flow of the target area at the target time based on the historical traffic of the sub-grid of the target area includes: using a convolutional model to predict the traffic flow of the target area at the target time based on the historical traffic of the sub-grid of the target area, wherein the input of the convolutional model and the output of the activation layer in the convolutional model are residually connected.
[0014] According to a second aspect of the present disclosure, a training method for a traffic flow prediction model is provided, including: obtaining first historical traffic data with a first granularity for a target area, first traffic data with a first granularity for a target area at a target time, second traffic data with a second granularity for a target area at a target time, and second historical traffic data with a second granularity, wherein the first historical traffic data and the first traffic data are obtained based on video data, and the second traffic data and the second historical traffic data are obtained based on positioning data; using a traffic flow prediction model, generating third historical traffic data with a first granularity based on the second historical traffic data; using a traffic flow prediction model, predicting the traffic flow of the target area at the target time based on the first historical traffic data and the third historical traffic data; training the traffic flow prediction model based on the traffic flow of the target area at the target time, the first traffic data, and the second traffic data.
[0015] In some embodiments, the target area includes multiple grids, each grid includes multiple sub-grids, the first granularity is determined according to the total number of the grids in the target area, and the second granularity is determined according to the total number of the sub-grids in the target area, and the total number of the grids is the same as the total number of the multiple intermediate tensors.
[0016] In some embodiments, a traffic flow prediction model is trained based on traffic flow, traffic statistics data at a target time, and first traffic flow data at a target time, including: calculating the value of a first loss function based on traffic flow and the first traffic flow data at a target time; calculating the value of a second loss function based on traffic flow and traffic statistics data at a target time; calculating the value of a target loss function based on the value of the first loss function and the value of the second loss function; and training the traffic flow prediction model based on the value of the target loss function.
[0017] In some embodiments, the value of the first loss function is calculated based on the traffic flow and the first traffic flow data at the target time, including: for a sub-grid with the first traffic flow data corresponding to the target time, the loss value of the sub-grid is calculated based on the first traffic flow data at the target time corresponding to the sub-grid and the traffic flow of the sub-grid at the target time; the value of the first loss function is calculated based on the loss values of multiple sub-grids with the first traffic flow data corresponding to the target time.
[0018] In some embodiments, the value of the second loss function is calculated based on traffic flow and traffic statistics at the target time, including: determining the predicted total traffic flow in the target area at the target time based on the traffic flow in the target area at the target time; determining the actual total traffic flow in the target area based on the second traffic data of the target area at the target time; and calculating the value of the second loss function based on the predicted total traffic flow and the actual total traffic flow.
[0019] According to a third aspect of the present disclosure, a traffic flow prediction device is provided, comprising: an acquisition module, configured to acquire first historical flow data with a first granularity and second historical flow data with a second granularity of a target area, wherein the first historical flow data is obtained based on video data, and the second historical flow data is obtained based on positioning data; a generation module, configured to generate third historical flow data with a first granularity based on the second historical flow data; and a prediction module, configured to predict the traffic flow of the target area at a target time based on the first historical flow data and the third historical flow data.
[0020] According to a fourth aspect of the present disclosure, a training device for a traffic flow prediction model is provided, comprising: an acquisition module, configured to acquire first historical traffic data with a first granularity of a target area, first traffic data with a first granularity of a target area at a target time, second traffic data with a second granularity of a target area at a target time, and second historical traffic data with a second granularity, wherein the first historical traffic data and the first traffic data are obtained according to video data, and the second traffic data and the second historical traffic data are obtained according to positioning data; a generation module, configured to generate third historical traffic data with a first granularity according to the second historical traffic data using a traffic flow prediction model; a prediction module, configured to predict the traffic flow of a target area at a target time according to the first historical traffic data and the third historical traffic data using a traffic flow prediction model; and a training module, configured to train the traffic flow prediction model according to the traffic flow of the target area at the target time, the first traffic data, and the second traffic data.
[0021] According to a fifth aspect of the present disclosure, a traffic flow prediction device is provided, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute the traffic flow prediction method according to any embodiment of the present disclosure based on instructions stored in the memory.
[0022] According to a sixth aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the instructions are executed by a processor, the traffic flow prediction method according to any embodiment of the present disclosure is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0024] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:
[0025] Figure 1 A flow chart showing a flow prediction method according to some embodiments of the present disclosure;
[0026] Figure 2 A schematic diagram showing generation of first historical traffic data according to some embodiments of the present disclosure;
[0027] Figure 3 A method of deploying a density estimation model according to some embodiments of the present disclosure is shown;
[0028] Figure 4 A schematic diagram of a super-resolution model according to some embodiments of the present disclosure is shown;
[0029] Figure 5 The structure of the attention model according to some embodiments of the present disclosure is shown;
[0030] Figure 6 A schematic diagram showing a convolution model according to some embodiments of the present disclosure;
[0031] Figure 7 A schematic diagram showing traffic prediction according to some embodiments of the present disclosure;
[0032] Figure 8 A method for training a traffic flow prediction model according to some embodiments of the present disclosure is shown;
[0033] Fig. 9 A schematic diagram showing a training traffic flow prediction model according to some embodiments of the present disclosure;
[0034] Fig.10 A block diagram showing a traffic flow prediction device according to some embodiments of the present disclosure;
[0035] Fig.11 A block diagram showing a training device for a traffic flow prediction model according to some embodiments of the present disclosure;
[0036] Fig.12 A block diagram showing a traffic flow prediction device according to some other embodiments of the present disclosure;
[0037] Fig.13 A block diagram of a computer system for implementing some embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0038] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0039] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0040] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0041] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0042] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0043] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0044] Different data sources have different granularities. In related technologies, a single data source is used to predict traffic flow, but a single data source has the limitation of spatiotemporal data perception, resulting in low prediction accuracy.
[0045] The present disclosure provides a traffic flow prediction method and device, and a computer-readable storage medium, which can predict traffic flow based on multi-source data and improve prediction accuracy.
[0046] Figure 1 A flow chart of a traffic prediction method according to some embodiments of the present disclosure is shown.
[0047] like Figure 1 As shown, the traffic flow prediction method includes steps S11 to S13. In some embodiments, the traffic flow prediction method is performed by a traffic flow prediction device.
[0048] In step S11, first historical traffic data with a first granularity and second historical traffic data with a second granularity of the target area are obtained, wherein the first historical traffic data is obtained based on the video data, and the second historical traffic data is obtained based on the positioning data.
[0049] Traffic flow data collected based on video data is real-time and accurate. The following introduces a method for detecting traffic based on video data.
[0050] Figure 2 A schematic diagram showing the generation of first historical traffic data according to some embodiments of the present disclosure.
[0051] like Figure 2 As shown, the crowd density estimation model receives the picture frames of the video as input, performs inference on the inference chip of the edge device, and outputs the estimated crowd density.
[0052] Figure 3 A method of deploying a density estimation model according to some embodiments of the present disclosure is shown.
[0053] like Figure 3 As shown in the figure, the pre-trained crowd or vehicle density estimation model (model.pth) is converted into a static calculation graph (t_model.pt) by tracing. Then, the parameters and calculation amount of crowd density estimation are compressed by quantization to obtain the compressed model (out.bmodel). Finally, the model is integrated into the inference chip to form a traffic monitoring system, and the software development kit (SDK) is used for inference.
[0054] The inventors have found through experiments that the delay of inferring crowd density using video data is only 0.2s to 0.3s per frame. Therefore, the above system can be connected to existing video cameras and other equipment to achieve real-time, accurate, and environmentally friendly crowd density detection. In addition, video collection is not limited to fixed locations, and can also be used through mobile devices to enhance the perception of traffic flow and further improve the accuracy of prediction.
[0055] In some embodiments, the positioning data is at least one of GPS data, point reporting data, and check-in data. Point reporting data collected by devices such as GPS has a wider spatial range, but in a short time, the confidence of the local space is low and it is coarse-grained data.
[0056] From the GPS data source, crowd flow characteristics such as inflow flow, outflow flow, and resident flow can be extracted. The GPS-based perception method is more accurate when the vehicle speed is high, but the data statistical accuracy is poor in situations such as traffic jams. Reporting point data refers to the GPS data reported by the APP device, and the pedestrian and vehicle flow conditions in the area can also be obtained from the reporting point data. Check-in data includes clock-in, gate ticket inspection, and other data.
[0057] The following uses GPS data as an example to introduce a method for generating the second historical traffic data.
[0058] For example, the spatial granularity means counting the traffic within a range of 10m*10m, 500m*500m or 1km*1km. The temporal granularity is, for example, counting the traffic every 5 minutes, 30 minutes or 1 hour. For the preset spatial granularity and temporal granularity, the following describes how the GPS data source counts the second historical traffic data.
[0059] According to the unique identifier (ID) of the GPS provider, the GPS is formed into a track. Then, spatial interpolation or downsampling is performed based on the preset time granularity to make the sampling frequency of the track fixed. The logic of traffic data statistics is as follows.
[0060] For a given spatial range (represented by a 10m*10m grid) and time t, for each trajectory, if at time t-1, the trajectory is not within the spatial range, and at time t, the trajectory is within the spatial range, then the inflow flow count of the spatial range is +1.
[0061] For a given spatial range (represented by a 10m*10m grid) and time t, for each trajectory, if at time t-1, the trajectory is within the spatial range and at time t, the trajectory is not within the spatial range, then the outflow flow count of the spatial range is +1.
[0062] For a given spatial range (represented by a 10m*10m grid) and time t, for each trajectory, if at time t-1, the trajectory is within the spatial range and at time t, the trajectory is within the spatial range, then the residence flow count of the spatial range is +1.
[0063] In step S12, third historical traffic data with a first granularity is generated based on the second historical traffic data. For example, the granularity of the second historical traffic data is aligned with that of the first historical traffic data, that is, the second historical traffic data is converted to the same granularity as the first historical traffic data, so as to obtain the third historical traffic data.
[0064] By aligning the granularity of the second historical traffic data from the positioning data with the granularity of the first historical traffic data from the video, the two different data sources can be fused even in the case where there is a large difference in spatiotemporal granularity between the two data sources.
[0065] In some embodiments, a super-resolution model is used to generate third historical traffic data having a first granularity based on the second historical traffic data.
[0066] Figure 4 A schematic diagram of a super-resolution model according to some embodiments of the present disclosure is shown.
[0067] like Figure 4 As shown, the super-resolution model includes a shuffle model and a multi-head self-attention model (including an encoder and a decoder).
[0068] In some embodiments, the first granularity is smaller than the second granularity, and third historical traffic data having the first granularity is generated based on the second historical traffic data, including: generating the third historical traffic data using a neural network model based on the second historical traffic data and multiple query tensors.
[0069] For example, the first historical traffic data is fine-grained data, and the second historical traffic data is coarse-grained data. The coarse-grained second historical traffic data is also converted into fine-grained third historical traffic data, so that the granularity of the second historical traffic data is aligned with that of the first historical traffic data. The super-resolution query tensor is randomly initialized and used as the input of the neural network model to achieve super-resolution of the second historical traffic data.
[0070] In some embodiments, the total number of super-resolution query tensors is determined according to the first granularity and the second granularity. The super-resolution query tensor is used to super-divide the second historical traffic data of the second granularity (e.g., coarse granularity) into the third historical traffic data of the first granularity (e.g., fine granularity), and the total number of super-resolution query tensors depends on the gap between the second granularity and the first granularity.
[0071] In some embodiments, the neural network model includes k layers, k is a positive integer, and the third historical traffic data is generated based on the second historical traffic data and the super-resolution query tensor using the neural network model, including: using the first t layers of the neural network model to generate multiple intermediate tensors based on the second historical traffic data, where t is a positive integer, 0<t<k; and inputting the multiple intermediate tensors and the multiple super-resolution query tensors into the t+1th layer of the neural network model to obtain the third historical traffic data.
[0072] For example, the super-resolution query tensor is not input into the first layer of the neural network model, but into the model in the middle layer or the last layer, so that the features of the original second historical traffic data are fully extracted and retained in the first few layers of the model, free from the interference of the super-resolution query tensor, and super-resolution is achieved in the last few layers of the model.
[0073] In some embodiments, the target area includes multiple grids, each grid includes multiple sub-grids, the first granularity is determined according to the total number of target area grids, the second granularity is determined according to the total number of target area sub-grids, and the total number of grids is the same as the total number of multiple intermediate tensors.
[0074] For example, the target area is divided into n*m grids, n represents the number of grids in the first direction (for example, a row), m represents the number of grids in the second direction (for example, a column), and n and m are positive integers. A grid includes (y+1) sub-grids, then the target area includes (y+1)*n*m sub-grids, where n, m, and y are all positive integers. The first historical traffic data and the third historical traffic data are both counted in units of sub-grids. Each sub-grid has corresponding third historical traffic data, which represents the traffic flow of the sub-grid obtained from the positioning data. The first historical traffic data corresponding to a sub-grid represents the traffic flow of the sub-grid obtained from the video data. A grid has its corresponding second historical traffic data, which represents the traffic flow of the grid obtained from the positioning data. Usually, due to the difficulty in obtaining complete video data, the first historical traffic data corresponding to some sub-grids are missing.
[0075] Figure 5 The structure of the attention model according to some embodiments of the present disclosure is shown.
[0076] like Figure 5 As shown in Figure 1, the t+1th layer of the attention model includes a residual addition and normalization layer (Add&Norm), a feed forward layer (Feed Forward), and a multi-head attention layer. The output of the tth layer is concatenated with the super-resolution query tensor and then input into the t+1th layer.
[0077] In some embodiments, the first t layers of the neural network model are used to generate multiple intermediate tensors based on the second historical traffic flow data, including: using a shuffle model to generate multiple original tensors based on the second historical traffic flow data; using the first t layers of the neural network model to generate multiple intermediate tensors based on the multiple original tensors.
[0078] For example, for an original input of n*m (indicating that the target area is divided into n*m grids), shuffle is used to concatenate the rows of two-dimensional data and rearrange the two-dimensional image features into tokens to form n*m original tokens (ie, intermediate tensors).
[0079] In some embodiments, the total number of super-resolution query tensors is equal to the difference between the total number of target region subgrids and the total number of target region grids. For example, if the target region includes n*m grids and (y+1)*n*m subgrids, the total number of super-resolution query tensors is y*n*m.
[0080] In some embodiments, before generating the third historical traffic data, masks are added to multiple super-resolution query tensors. For example, masks are added to all super-resolution query tensors so that the super-resolution query tensors do not operate on each other, and only the super-resolution query tensors and intermediate variables operate, thereby avoiding interference between the super-resolution query tensors and allowing the super-resolution query tensors to focus on the original features.
[0081] In some embodiments, multiple intermediate tensors and multiple super-resolution query tensors are input into the t+1 layer of the neural network model to obtain third historical traffic data, including: inputting multiple intermediate tensors and multiple super-resolution query tensors into the t+1 layer of the neural network model to obtain multiple target tensors; generating third historical traffic flow data based on the multiple target tensors.
[0082] For example, the t+1th layer of the neural network model is an encoder, which inputs the target tensor into the decoder for decoding, aligns the number of tokens with the dimension of the target, and then uses the shuffle network to convert the decoding result into the third historical traffic data of each sub-grid.
[0083] In some embodiments, the traffic flow of the target area at the target time is predicted based on the first historical traffic data and the third historical traffic data, including: for any sub-grid, when the sub-grid has corresponding first historical traffic data, the historical traffic flow of the sub-grid is determined according to the first historical traffic data corresponding to the sub-grid; when the sub-grid does not have corresponding first historical traffic data, the historical traffic flow of the sub-grid is determined according to the third historical traffic data corresponding to the sub-grid; based on the historical traffic flow of the sub-grid of the target area, the traffic flow of the target area at the target time is predicted.
[0084] For example, although the video data source has high real-time performance, its spatial range is limited, that is, it is usually difficult to obtain the first flow data of each subgrid in the target area. Although the GPS data source has a large spatial range, its accuracy is low. Therefore, the features of the video data source and the GPS data source are aligned to obtain the third flow data as a supplement to the first flow data. For example, for a subgrid in the target area, the first historical flow data sourced from the video data is preferentially used as the historical flow of the subgrid. If there is no video data for the subgrid, the third historical flow data is used.
[0085] In step S13, the traffic flow of the target area at the target time is predicted based on the first historical traffic flow data and the third historical traffic flow data.
[0086] For example, for a data set with unified indicators, according to different types of spatial division, a prediction model suitable for a graph structure or a grid structure is selected, such as Spatio-Temporal Residual Networks (ST-ResNet), Spatial-Temporal Graph Convolutional Networks (ST-GCN) model, etc. Among them, the ST-ResNet model is suitable for data sources with a grid structure, and the ST-GCN model is suitable for data sources with a graph structure and a point structure. In addition, external feature data such as weather data sources, meteorological data sources, and holiday data sources are combined to predict the traffic flow at the target time based on these external feature data, the first historical traffic data, and the third historical traffic data.
[0087] When the model is inferring the traffic at the target time, for scenarios with low latency requirements, code inference is used directly. For scenarios with high latency requirements, the model is converted into an inference framework format, and then the inference framework is used to accelerate model inference.
[0088] In some embodiments, predicting the traffic flow of the target area at the target time based on the historical traffic of the sub-grid of the target area includes: using a convolutional model to predict the traffic flow of the target area at the target time based on the historical traffic of the sub-grid of the target area, wherein the input of the convolutional model and the output of the activation layer in the convolutional model are residually connected.
[0089] Figure 6 A schematic diagram of a convolution model according to some embodiments of the present disclosure is shown.
[0090] like Figure 6 As shown, the convolution model includes a convolution layer (Conv) and an activation layer (ReLU). Some embodiments of the present disclosure place the residual connection of the convolution model after the activation layer (ReLU), that is, the input of the convolution model and the output of the activation layer are residually connected. Compared with the traditional residual connection before the activation layer, the residual connection method of the present disclosure can increase the nonlinear expression ability of the model, has the ability of model integration (Ensemble), and can improve the accuracy of the model.
[0091] According to the traffic flow prediction method disclosed in the present invention, the inventors conducted experiments using different convolutional models, including context-aware crowd counting model (CANNet), dilated convolutional neural networks for understanding the highly congested scenes (CSRNet), multi-column convolutional neural network architecture (MCNN), and saptial full convolutional network (SFCN).
[0092]
[0093] The experimental results show that compared with the traditional method of using a single data source, the prediction accuracy of the integrated video data source and positioning data source disclosed in the present invention is improved.
[0094] According to some embodiments of the present disclosure, a traffic flow prediction method includes obtaining first historical traffic data with a first granularity and second historical traffic data with a second granularity of a target area, wherein the first historical traffic data is obtained based on video data and the second historical traffic data is obtained based on positioning data; generating third historical traffic data with a first granularity based on the second historical traffic data; and predicting the traffic flow of the target area at a target time based on the first historical traffic data and the third historical traffic data. The above-mentioned traffic flow prediction method can align the granularity of the second historical traffic data (derived from positioning data with a wide spatial range) with the granularity of the first historical traffic data (derived from real-time and highly accurate video data), thereby comprehensively utilizing multiple data sources to predict traffic flow, thereby improving the prediction accuracy of the model.
[0095] The traffic flow prediction method according to some embodiments of the present disclosure can be applied to scenarios such as emergency warning, scenic area traffic prediction, and intelligent traffic prediction. For example, cameras are deployed at frequently congested sections of roads and frequently crowded scenic spots to monitor the passenger flow in the area in real time and realize real-time warning functions. For another example, video cameras are deployed at key points in and out of the scenic area for data collection, predicting the passenger flow of the scenic area, and then regulating the resources of the scenic area. For another example, real-time traffic flow detection equipment is deployed at key traffic intersections to collect the traffic flow of the traffic road network, thereby realizing accurate prediction of traffic flow and assisting the construction of a smart transportation system.
[0096] Figure 7A schematic diagram showing traffic prediction according to some embodiments of the present disclosure.
[0097] like Figure 7 As shown in the figure, the overall traffic prediction includes traffic data perception, data calibration and alignment, traffic prediction, density estimation, and model deployment. Traffic data perception includes video data collection and conversion, mobile GPS data collection and conversion, point reporting data collection and conversion, and check-in data collection and conversion. The data calibration and alignment part is responsible for aligning the traffic data of each data source in time and space dimensions, reproducing a more realistic traffic distribution, and forming a traffic data set. The traffic prediction model part includes two sub-parts: prediction model training and prediction model deployment.
[0098] Figure 8 A method for training a traffic flow prediction model according to some embodiments of the present disclosure is shown.
[0099] like Figure 8 As shown, the training method of the traffic flow prediction model includes steps S21-S24. In some embodiments, the training method of the traffic flow prediction model is performed by a training device of the traffic flow prediction model.
[0100] In step S21, first historical traffic data with a first granularity of the target area, first traffic data with a first granularity of the target area at a target time, second traffic data with a second granularity of the target area at a target time, and second historical traffic data with a second granularity are obtained, wherein the first historical traffic data and the first traffic data are obtained based on the video data, and the second traffic data and the second historical traffic data are obtained based on the positioning data.
[0101] In some embodiments, the target area includes multiple grids, each grid includes multiple sub-grids, the first granularity is determined according to the total number of target area grids, the second granularity is determined according to the total number of target area sub-grids, and the total number of grids is the same as the total number of multiple intermediate tensors.
[0102] For step S21, see Figure 2 and Figure 3 Related description.
[0103] In step S22, the traffic flow prediction model is used to generate third historical traffic data with a first granularity according to the second historical traffic data.
[0104] In some embodiments, the traffic flow prediction model includes a neural network model, the first granularity is smaller than the second granularity, and third historical traffic data with the first granularity is generated based on the second historical traffic data, including: based on the second historical traffic data and multiple super-resolution query tensors, using the neural network model to generate the third historical traffic data.
[0105] In some embodiments, the total number of super-resolution query tensors is determined according to a first granularity and a second granularity.
[0106] In some embodiments, the neural network model includes k layers, k is a positive integer, and the third historical traffic data is generated based on the second historical traffic data and the super-resolution query tensor using the neural network model, including: using the first t layers of the neural network model to generate multiple intermediate tensors based on the second historical traffic data, where t is a positive integer, 0<t<k; and inputting the multiple intermediate tensors and the multiple super-resolution query tensors into the t+1th layer of the neural network model to obtain the third historical traffic data.
[0107] In some embodiments, the total number of super-resolution query tensors is equal to the difference between the total number of target region sub-grids and the total number of target region grids.
[0108] In some embodiments, before generating the third historical traffic data, a mask is added to the plurality of super-resolution query tensors.
[0109] In some embodiments, the first t layers of the neural network model are used to generate multiple intermediate tensors based on the second historical traffic flow data, including: using a shuffle model to generate multiple original tensors based on the second historical traffic flow data; using the first t layers of the neural network model to generate multiple intermediate tensors based on the multiple original tensors.
[0110] For step S22, see Figure 4 and Figure 5 Related description.
[0111] In step S23, the traffic flow prediction model is used to predict the traffic flow of the target area at the target time according to the first historical traffic data and the third historical traffic data.
[0112] In some embodiments, the traffic flow of the target area at the target time is predicted based on the first historical traffic data and the third historical traffic data, including: for any sub-grid, when the sub-grid has corresponding first historical traffic data, the historical traffic flow of the sub-grid is determined according to the first historical traffic data corresponding to the sub-grid; when the sub-grid does not have corresponding first historical traffic data, the historical traffic flow of the sub-grid is determined according to the third historical traffic data corresponding to the sub-grid; based on the historical traffic flow of the sub-grid of the target area, the traffic flow of the target area at the target time is predicted.
[0113] In some embodiments, the traffic flow prediction model includes a convolutional model, which predicts the traffic flow of the target area at the target time based on the historical flow of the sub-grid of the target area, including: using the convolutional model to predict the traffic flow of the target area at the target time based on the historical flow of the sub-grid of the target area, wherein the input of the convolutional model and the output of the activation layer in the convolutional model are residually connected.
[0114] For step S23, see Figure 6 Related description.
[0115] In step S24, a traffic flow prediction model is trained based on the traffic flow of the target area at the target time, the first traffic flow data, and the second traffic flow data.
[0116] According to some embodiments of the present disclosure, the training method of the traffic flow prediction model includes: obtaining first historical traffic data with a first granularity of the target area, first traffic data with a first granularity of the target area at a target time, second traffic data with a second granularity of the target area at a target time, and second historical traffic data with a second granularity, wherein the first historical traffic data and the first traffic data are obtained according to the video data, and the second traffic data and the second historical traffic data are obtained according to the positioning data; using the traffic flow prediction model, according to the second historical traffic data, generating third historical traffic data with a first granularity; using the traffic flow prediction model, according to the first historical traffic data and the third historical traffic data, predicting the traffic flow of the target area at the target time; training the traffic flow prediction model according to the traffic flow of the target area at the target time, the first traffic data, and the second traffic data. According to the above method, the positioning data with a wide spatial range is aligned with the video data with high real-time and accuracy, and the traffic flow prediction model is trained using multi-source data, so that the prediction accuracy of the trained traffic flow prediction model is higher.
[0117] In some embodiments, a traffic flow prediction model is trained based on traffic flow, traffic statistics data at a target time, and first traffic flow data at a target time, including: calculating the value of a first loss function based on traffic flow and the first traffic flow data at a target time; calculating the value of a second loss function based on traffic flow and traffic statistics data at a target time; calculating the value of a target loss function based on the value of the first loss function and the value of the second loss function; and training the traffic flow prediction model based on the value of the target loss function.
[0118] For example, the loss function of a neural network is divided into two parts. The first loss function represents the fine-grained loss. The coarse-grained data is super-resolved through the aforementioned neural network model to obtain fine-grained data. Based on the fine-grained data, the reconstruction loss provided by the fine-grained reliable video data source can be calculated. The second loss function represents the coarse-grained loss, for example, the loss of global coarse-grained reconstruction. Combining the losses at both the fine-grained and coarse-grained levels to train the traffic flow prediction model can improve the training efficiency, and the prediction accuracy of the obtained model is higher.
[0119] In some embodiments, the value of the first loss function is calculated based on the traffic flow and the first traffic flow data at the target time, including: for a sub-grid with the first traffic flow data corresponding to the target time, the loss value of the sub-grid is calculated based on the first traffic flow data at the target time corresponding to the sub-grid and the traffic flow of the sub-grid at the target time; the value of the first loss function is calculated based on the loss values of multiple sub-grids with the first traffic flow data corresponding to the target time.
[0120] For example, the first traffic data (from the input video source) and the third traffic data (from GPS data) obtained after super-resolution are the same in time and space granularity, and the confidence of the video source data source is higher than that of the GPS data source. In grids with video sources, using video sources to supervise the training of super-resolution networks can improve the prediction accuracy of the model.
[0121] In some embodiments, for a sub-grid having first traffic flow data at a corresponding target time, the loss value of the sub-grid is calculated based on the first traffic flow data at the target time corresponding to the sub-grid and the traffic flow of the sub-grid at the target time, including: calculating the loss value of the sub-grid based on the difference between the first traffic flow data at the target time corresponding to the sub-grid and the traffic flow of the sub-grid at the target time.
[0122] For example, with the mask matrix R mask Indicates whether each subgrid in the target area has the first flow data, R mask The shape and size of R fine The same is true for the sub-grid division of the target area. mask The element with index i in If the corresponding subgrid has the first flow data, the element is marked as 1, and if the corresponding subgrid does not have the first flow data, the element is marked as 0. The prediction result of the traffic flow prediction model includes the flow of each subgrid in the target area at the target time. The predicted flow of all subgrids in the target area at the target time is recorded as the matrix R fine , the matrix R fine Elements The first flow data of the entire target area is recorded as R fact In the target area, at the spatial location with the video data source (i.e., the subgrid with the first flow data), the video data source is used as the supervisory signal of the neural network model, R fact The first flow data of the subgrid corresponding to the element with index i is recorded as The expression of the first loss function is as follows.
[0123] Loss1=R maskLoss(R fine ,R fact )
[0124] Among them, Loss() is, for example, a 0-1 loss function, a perceptual loss function, a cross entropy loss function, a cross entropy loss function, a mean square error loss function, etc.
[0125] If Loss is the mean square error loss function, the above expression is expanded as follows.
[0126]
[0127] in, Represents the matrix R mask The total number of subgrids with first flow data in .
[0128] In some embodiments, the value of the second loss function is calculated based on traffic flow and traffic statistics at the target time, including: determining the predicted total traffic flow of the target area at the target time based on the traffic flow of the target area at the target time; determining the actual total traffic flow of the target area based on the second traffic data of the target area at the target time; and calculating the value of the second loss function based on the predicted total traffic flow and the actual total traffic flow. By calculating the total traffic flow of the target area at a coarse-grained level, calculating the loss function and training the model, the accuracy of the model can be improved.
[0129] For example, the second loss function is the loss of global coarse-grained reconstruction. The value of the second loss function is calculated based on the difference between the predicted total flow and the second flow data. The second flow data is the actual flow obtained from the GPS data source, denoted as matrix R corse , the actual total flow rate of the entire target area is ∑R corse The predicted flow of all subgrids in the target area at the target time is recorded as matrix R fine , the total flow predicted for the entire target area is ∑R fine , then the reconstruction loss for coarse-grained traffic is as follows.
[0130] Loss2=∑R corse -∑R fine
[0131] The expression of the target loss function Loss is as follows
[0132] Loss = Loss1 + Loss2
[0133] Fig. 9 A schematic diagram showing a traffic flow prediction model training according to some embodiments of the present disclosure.
[0134] like Fig. 9As shown, video data and location data (reporting data, GPS data) are collected respectively, and then the video data is input into the density estimation model to obtain fine-grained first historical traffic data. Based on the coarse-grained location data, coarse-grained second historical traffic data is obtained. Based on the second historical traffic data, a super-resolution network is used to obtain fine-grained third historical traffic data, thereby achieving alignment of data of different granularities. The prediction model is trained using the aligned data in combination with external feature data such as weather data sources, meteorological data sources, and holiday data sources to obtain a pre-trained model. The pre-trained model is used for subsequent traffic flow prediction.
[0135] Fig.10 A block diagram of a traffic flow prediction device according to some embodiments of the present disclosure is shown.
[0136] like Fig.10 As shown, the traffic flow prediction device 10 includes an acquisition module 101 , a generation module 102 and a prediction module 103 .
[0137] The acquisition module 101 is configured to acquire first historical traffic data with a first granularity and second historical traffic data with a second granularity of the target area, wherein the first historical traffic data is obtained according to the video data, and the second historical traffic data is obtained according to the positioning data, for example, by performing the following steps: Figure 1 Step S11 is shown.
[0138] The generating module 102 is configured to generate third historical traffic data with a first granularity according to the second historical traffic data, for example, by performing the following steps: Figure 1 Step S12 is shown.
[0139] The prediction module 103 is configured to predict the traffic flow of the target area at the target time according to the first historical traffic data and the third historical traffic data, for example, by performing the following steps: Figure 1 Step S13 is shown.
[0140] In some embodiments, the target area includes multiple grids, each grid includes multiple sub-grids, the first granularity is determined according to the total number of target area grids, the second granularity is determined according to the total number of target area sub-grids, and the total number of grids is the same as the total number of multiple intermediate tensors.
[0141] In some embodiments, the first granularity is smaller than the second granularity, and the generation module 102 is further configured to generate third historical traffic data using a neural network model based on the second historical traffic data and a plurality of super-resolution query tensors.
[0142] In some embodiments, the total number of super-resolution query tensors is determined according to a first granularity and a second granularity.
[0143] In some embodiments, the neural network model includes k layers, k is a positive integer, and the generation module 102 is configured to: use the first t layers of the neural network model to generate multiple intermediate tensors based on the second historical traffic data, where t is a positive integer, 0<t<k; input the multiple intermediate tensors and multiple super-resolution query tensors into the t+1th layer of the neural network model to obtain the third historical traffic data.
[0144] In some embodiments, the generation module 102 is configured to: generate multiple original tensors using a shuffle model based on the second historical traffic flow data; and generate multiple intermediate tensors based on the multiple original tensors using the first t layers of the neural network model.
[0145] In some embodiments, the total number of super-resolution query tensors is equal to the difference between the total number of target region sub-grids and the total number of target region grids.
[0146] In some embodiments, the traffic flow prediction method further includes: a mask module configured to add masks to the plurality of super-resolution query tensors before generating the third historical traffic data.
[0147] In some embodiments, the prediction module 103 is further configured as follows: for any sub-grid, when the sub-grid has corresponding first historical traffic data, the historical traffic of the sub-grid is determined according to the first historical traffic data corresponding to the sub-grid; when the sub-grid does not have corresponding first historical traffic data, the historical traffic of the sub-grid is determined according to the third historical traffic data corresponding to the sub-grid; based on the historical traffic of the sub-grid in the target area, the traffic flow of the target area at the target time is predicted.
[0148] In some embodiments, the prediction module 103 is further configured to: use a convolutional model to predict the traffic flow in the target area at the target time based on the historical traffic of the sub-grid of the target area, wherein the input of the convolutional model and the output residual connection of the activation layer in the convolutional model are connected.
[0149] Fig.11 A block diagram of a training device for a traffic flow prediction model according to some embodiments of the present disclosure is shown.
[0150] like Fig.11 As shown, the traffic flow prediction device 11 includes an acquisition module 111 , a generation module 112 , a prediction module 113 and a training module 114 .
[0151] The acquisition module 111 is configured to acquire first historical traffic data with a first granularity and second historical traffic data with a second granularity of the target area, wherein the first historical traffic data is obtained according to the video data, and the second historical traffic data is obtained according to the positioning data, for example, by performing the following steps: Figure 8 Step S21 is shown.
[0152] The generation module 112 is configured to generate third historical traffic data with a first granularity based on the second historical traffic data using a traffic flow prediction model, for example, by performing the following steps: Figure 8 Step S22 is shown.
[0153] The prediction module 113 is configured to use the traffic flow prediction model to predict the traffic flow of the target area at the target time according to the first historical traffic data and the third historical traffic data, for example, by performing the following steps: Figure 8 Step S23 is shown.
[0154] The training module 114 is configured to train a traffic flow prediction model according to the traffic flow of the target area at the target time, the first traffic flow data, and the second traffic flow data, for example, by performing the following steps: Figure 8 Step S24 is shown.
[0155] In some embodiments, the traffic flow prediction model includes a neural network model, wherein the first granularity is smaller than the second granularity, and the generation module 112 is further configured to generate third historical traffic data using the neural network model based on the second historical traffic data and multiple super-resolution query tensors.
[0156] In some embodiments, the total number of super-resolution query tensors is determined according to a first granularity and a second granularity.
[0157] In some embodiments, the neural network model includes k layers, k is a positive integer, and the generation module 112 is configured to: use the first t layers of the neural network model to generate multiple intermediate tensors based on the second historical traffic data, where t is a positive integer, 0<t<k; input the multiple intermediate tensors and multiple super-resolution query tensors into the t+1th layer of the neural network model to obtain the third historical traffic data.
[0158] In some embodiments, the traffic flow prediction model includes a shuffle model, and the generation module 112 is further configured to: generate multiple original tensors using the shuffle model based on the second historical traffic flow data; and generate multiple intermediate tensors based on the multiple original tensors using the first t layers of the neural network model.
[0159] In some embodiments, the target area includes multiple grids, each grid includes multiple sub-grids, the first granularity is determined according to the total number of target area grids, the second granularity is determined according to the total number of target area sub-grids, and the total number of grids is the same as the total number of multiple intermediate tensors.
[0160] In some embodiments, the total number of super-resolution query tensors is equal to the difference between the total number of target region sub-grids and the total number of target region grids.
[0161] In some embodiments, the traffic flow prediction method further includes: a mask module configured to add masks to the plurality of super-resolution query tensors before generating the third historical traffic data.
[0162] In some embodiments, the prediction module 113 is further configured as follows: for any sub-grid, when the sub-grid has corresponding first historical traffic data, the historical traffic of the sub-grid is determined according to the first historical traffic data corresponding to the sub-grid; when the sub-grid does not have corresponding first historical traffic data, the historical traffic of the sub-grid is determined according to the third historical traffic data corresponding to the sub-grid; based on the historical traffic of the sub-grid in the target area, the traffic flow of the target area at the target time is predicted.
[0163] In some embodiments, the traffic flow prediction model includes a convolutional model, and the prediction module 113 is further configured to: use the convolutional model to predict the traffic flow in the target area at the target time based on the historical traffic of the sub-grid in the target area, wherein the input of the convolutional model and the output of the activation layer in the convolutional model are residually connected.
[0164] In some embodiments, the training module 114 is further configured to train a traffic flow prediction model based on traffic flow, traffic statistics data at the target time, and first traffic flow data at the target time, including: calculating the value of a first loss function based on traffic flow and the first traffic flow data at the target time; calculating the value of a second loss function based on traffic flow and traffic statistics data at the target time; calculating the value of a target loss function based on the value of the first loss function and the value of the second loss function; and training the traffic flow prediction model based on the value of the target loss function.
[0165] In some embodiments, the training module 114 is further configured to calculate the loss value of the sub-grid with the first traffic flow data at the corresponding target time based on the first traffic flow data at the target time corresponding to the sub-grid and the traffic flow of the sub-grid at the target time; and calculate the value of the first loss function based on the loss values of multiple sub-grids with the first traffic flow data at the corresponding target time.
[0166] In some embodiments, the training module 114 is further configured to: determine the predicted total flow of the target area at the target time based on the traffic flow of the target area at the target time; determine the actual total flow of the target area based on the second flow data of the target area at the target time; and calculate the value of the second loss function based on the predicted total flow and the actual total flow.
[0167] Fig.12 A block diagram of a traffic flow prediction device according to some other embodiments of the present disclosure is shown.
[0168] like Fig.12As shown, the traffic flow prediction device 12 includes a memory 121; and a processor 122 coupled to the memory 121, and the memory 121 is used to store instructions for executing the corresponding embodiments of the traffic flow prediction method. The processor 122 is configured to execute the traffic flow prediction method in any of the embodiments of the present disclosure based on the instructions stored in the memory 121.
[0169] Fig.13 A block diagram of a computer system for implementing some embodiments of the present disclosure is shown.
[0170] like Fig.13 As shown, the computer system 130 may be embodied in the form of a general-purpose computing device. The computer system 130 includes a memory 1310, a processor 1320, and a bus 1300 that connects the various system components.
[0171] The memory 1310 may include, for example, a system memory, a non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, and other programs. The system memory may include a volatile storage medium, such as a random access memory (RAM) and / or a cache memory. The non-volatile storage medium may store, for example, instructions for executing at least one of the corresponding embodiments of the traffic flow prediction method. The non-volatile storage medium includes, but is not limited to, a disk memory, an optical memory, a flash memory, etc.
[0172] The processor 1320 can be implemented by a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistors, etc. Discrete hardware components. Accordingly, each module such as the judgment module and the determination module can be implemented by a central processing unit (CPU) running instructions in a memory that execute corresponding steps, or can be implemented by a dedicated circuit that executes corresponding steps.
[0173] The bus 1300 may use any of a variety of bus architectures, including, but not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, and a Peripheral Component Interconnect (PCI) bus.
[0174] The computer system 130 may also include an input / output interface 1330, a network interface 1340, a storage interface 1350, etc. These interfaces 1330, 1340, 1350, the memory 1310, and the processor 1320 may be connected via a bus 1300. The input / output interface 1330 may provide a connection interface for input / output devices such as a display, a mouse, and a keyboard. The network interface 1340 may provide a connection interface for various networked devices. The storage interface 1350 may provide a connection interface for external storage devices such as a floppy disk, a USB flash drive, and an SD card.
[0175] Here, various aspects of the present disclosure are described with reference to flowcharts and / or block diagrams of methods, devices, and computer program products according to embodiments of the present disclosure. It should be understood that each frame of the flowchart and / or block diagram and the combination of frames can be implemented by computer-readable program instructions.
[0176] These computer-readable program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable device to produce a machine, so that the processor executes the instructions to produce means for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.
[0177] These computer-readable program instructions may also be stored in a computer-readable memory, which cause the computer to work in a specific manner to produce an article of manufacture, including instructions for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.
[0178] The present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects.
[0179] The traffic flow prediction method and device, and computer-readable storage medium in the above-mentioned embodiments improve the accuracy of traffic flow prediction.
[0180] So far, the traffic flow prediction method and device, and computer-readable storage medium according to the present disclosure have been described in detail. In order to avoid obscuring the concept of the present disclosure, some details known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solution disclosed herein.
Claims
1. A traffic flow prediction method, comprising: Acquire first historical traffic data with a first granularity and second historical traffic data with a second granularity of a target area, wherein the first historical traffic data is obtained based on video data, and the second historical traffic data is obtained based on positioning data; generating third historical traffic data with a first granularity according to the second historical traffic data; The traffic flow of the target area at the target time is predicted based on the first historical traffic data and the third historical traffic data.
2. The traffic flow prediction method according to claim 1, wherein: The first granularity is smaller than the second granularity, and generating the third historical traffic data having the first granularity according to the second historical traffic data includes: The third historical traffic data is generated according to the second historical traffic data and multiple super-resolution query tensors using a neural network model.
3. The traffic flow prediction method according to claim 2, wherein: The total number of super-resolution query tensors is determined according to the first granularity and the second granularity.
4. The traffic flow prediction method according to claim 2, wherein: The neural network model includes k layers, where k is a positive integer. The generating the third historical traffic data by using the neural network model according to the second historical traffic data and the super-resolution query tensor includes: Using the first t layers of the neural network model, a plurality of intermediate tensors are generated according to the second historical traffic data, where t is a positive integer, 0<t<k; The multiple intermediate tensors and the multiple super-resolution query tensors are input into the t+1th layer of the neural network model to obtain the third historical traffic data.
5. The traffic flow prediction method according to claim 4, wherein: Using the first t layers of the neural network model, multiple intermediate tensors are generated according to the second historical traffic flow data, including: According to the second historical traffic flow data, a plurality of original tensors are generated by using a shuffle model; The plurality of intermediate tensors are generated according to the plurality of original tensors by utilizing the first t layers of the neural network model.
6. The traffic flow prediction method according to claim 4, wherein: The target area includes multiple grids, each grid includes multiple sub-grids, the first granularity is determined according to the total number of the grids in the target area, and the second granularity is determined according to the total number of the sub-grids in the target area, and the total number of the grids is the same as the total number of the multiple intermediate tensors.
7. The traffic flow prediction method according to claim 6, wherein: The total number of super-resolution query tensors is equal to the difference between the total number of sub-grids in the target area and the total number of grids in the target area.
8. The traffic flow prediction method according to claim 2, further comprising: Before generating the third historical traffic data, masks are added to the multiple super-resolution query tensors.
9. The traffic flow prediction method according to claim 6, wherein: The traffic flow of the target area at the target time is predicted according to the first historical traffic data and the third historical traffic data, including: For any sub-grid, if the sub-grid has corresponding first historical flow data, determine the historical flow of the sub-grid according to the first historical flow data corresponding to the sub-grid; In the case that the sub-grid has no corresponding first historical flow data, determining the historical flow of the sub-grid according to the third historical flow data corresponding to the sub-grid; Based on the historical traffic of the subgrids in the target area, the traffic flow in the target area at the target time is predicted.
10. The traffic flow prediction method according to claim 9, wherein: Based on the historical traffic of the subgrid in the target area, the traffic flow of the target area at the target time is predicted, including: A convolutional model is used to predict the traffic flow of a target area at a target time according to the historical traffic flow of a subgrid in the target area, wherein the input of the convolutional model and the output of the activation layer in the convolutional model are residually connected.
11. A method for training a traffic flow prediction model, comprising: Acquire first historical traffic data with a first granularity of a target area, first traffic data with a first granularity of a target area at a target time, second traffic data with a second granularity of a target area at a target time, and second historical traffic data with a second granularity, wherein the first historical traffic data and the first traffic data are obtained based on video data, and the second traffic data and the second historical traffic data are obtained based on positioning data; Using a traffic flow prediction model, generating third historical traffic data with a first granularity according to the second historical traffic data; Using the traffic flow prediction model, based on the first historical flow data and the third historical flow data, predict the traffic flow of the target area at the target time; A traffic flow prediction model is trained according to the traffic flow in the target area at the target time, the first flow data, and the second flow data.
12. The traffic flow prediction method according to claim 11, wherein: The target area includes multiple grids, each grid includes multiple sub-grids, the first granularity is determined according to the total number of the grids in the target area, and the second granularity is determined according to the total number of the sub-grids in the target area, and the total number of the grids is the same as the total number of the multiple intermediate tensors.
13. The traffic flow prediction method according to claim 12, training a traffic flow prediction model according to the traffic flow, traffic statistics data at the target time, and first traffic flow data at the target time, comprising: Calculating a value of a first loss function according to the traffic flow and the first traffic flow data at the target time; Calculate the value of the second loss function according to the traffic flow and traffic statistics at the target time; Calculate the value of the target loss function according to the value of the first loss function and the value of the second loss function; According to the value of the target loss function, the traffic flow prediction model is trained.
14. The traffic flow prediction method according to claim 13, wherein the value of the first loss function is calculated based on the traffic flow and the first traffic flow data at the target time, comprising: For a subgrid having first traffic flow data corresponding to a target time, calculating a loss value of the subgrid according to the first traffic flow data corresponding to the target time of the subgrid and the traffic flow of the subgrid at the target time; The value of the first loss function is calculated according to the loss values of the plurality of sub-grids having the first traffic flow data at the corresponding target time.
15. The traffic flow prediction method according to claim 12, wherein: According to the traffic flow and traffic statistics at the target time, the value of the second loss function is calculated, including: Determine the predicted total traffic volume of the target area at the target time based on the traffic volume of the target area at the target time; determining an actual total flow rate of the target area according to the second flow rate data of the target area at the target time; The value of the second loss function is calculated based on the predicted total flow and the actual total flow.
16. A traffic flow prediction device, comprising: An acquisition module is configured to acquire first historical traffic data with a first granularity and second historical traffic data with a second granularity of a target area, wherein the first historical traffic data is obtained based on video data, and the second historical traffic data is obtained based on positioning data; A generating module, configured to generate third historical traffic data with a first granularity according to the second historical traffic data; The prediction module is configured to predict the traffic flow of the target area at the target time based on the first historical traffic data and the third historical traffic data.
17. A training device for a traffic flow prediction model, comprising: an acquisition module, configured to acquire first historical traffic data with a first granularity of a target area, first traffic data with a first granularity of a target area at a target time, second traffic data with a second granularity of a target area at a target time, and second historical traffic data with a second granularity, wherein the first historical traffic data and the first traffic data are obtained according to video data, and the second traffic data and the second historical traffic data are obtained according to positioning data; A generating module, configured to generate third historical traffic data with a first granularity according to the second historical traffic data by using a traffic flow prediction model; A prediction module is configured to predict the traffic flow of a target area at a target time based on the first historical traffic data and the third historical traffic data using a traffic flow prediction model; The training module is configured to train a traffic flow prediction model based on the traffic flow of the target area at the target time, the first traffic data, and the second traffic data.
18. A traffic flow prediction device, comprising: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the traffic flow prediction method according to any one of claims 1 to 15 based on instructions stored in the memory.
19. A computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implements the traffic flow prediction method according to any one of claims 1 to 15.
