A method for predicting regional traffic based on space-time series
Patent Information
- Application Number
- CN202310462328.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-26
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-04-26
AI Technical Summary
[0005]目前的深度学习模型进行预测的精度不高,问题在于其没有很好利用时空信息
[0067]将流量预测问题转化为图片像素点预测问题在此基础上采用本发明提供的神经网络架构,充分学习局部特征和全局特征,从而提高预测的精准度。
Smart Images

Figure CN117077832B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fishing vessel flow prediction technology in smart ocean scenarios, specifically to a regional flow prediction method oriented towards spatiotemporal sequences. Background Technology
[0002] With the rapid development of modern ports, ship traffic is increasing, and ships are becoming larger, more specialized, and faster. This has led to a growing need for forecasting regional ship traffic. Port managers can use forecasted traffic flow to effectively manage and guide ships entering and leaving the port, thereby preventing congestion, improving efficiency, and ensuring port area safety.
[0003] Existing regional traffic flow forecasting methods mainly include linear and nonlinear methods. Linear statistical methods include time series analysis, Kalman filtering, and grey models. The differential autoregressive moving average model, as a classic time series forecasting method, effectively eliminates data non-stationarity. Because ship traffic flow is nonlinear, random, and complex, linear statistical methods have low forecasting accuracy. Nonlinear forecasting models are increasingly becoming a research focus, with machine learning being a widely used nonlinear method. Machine learning can effectively utilize various types of data to extract hidden and effective information, enabling it to predict nonlinear data well. Machine learning forecasting models mainly include support vector machines (SVMs), backpropagation (BP) neural networks, and deep learning. Genetic algorithms are used to optimize the parameters of support vector machines (SVMs), avoiding the blind selection of SVM parameters and improving the accuracy and generalization ability of SVM predictions. Weighted improved BP neural network forecasting methods have been used to handle this nonlinear problem, and their feasibility has been verified, achieving good forecasting results; however, network parameters can only be determined empirically. In addition, combined prediction models are widely used to improve prediction accuracy, such as the combined prediction model of modular neural network and backpropagation neural network (FNN-BPNN) and the combined prediction model of ensemble empirical mode decomposition and backpropagation neural network.
[0004] In deep learning techniques, Long Short-Term Memory (LSTM) networks and Gated Recurrent Units (GRUs) have achieved better results in handling time series prediction problems. Some researchers have utilized the long-term correlations in traffic flow sequences, employing LSTM networks to extract hidden features for traffic flow prediction. Convolutional Neural Networks (CNNs) are primarily used in image recognition; however, in ship prediction, they can extract and learn spatial features of ships.
[0005] Current deep learning models have low prediction accuracy because they do not make good use of spatiotemporal information. Summary of the Invention
[0006] This invention proposes a regional flow prediction method based on spatiotemporal sequences, aiming to effectively extract spatiotemporal features and improve prediction accuracy.
[0007] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0008] A method for predicting regional flow based on spatiotemporal sequences includes the following steps:
[0009] S1. Data Format: Divide the corresponding predicted region into an M*N grid, and calculate the inflow and outflow rates into all grids within each time period; Define... For a group in t th The set of trajectories over time intervals;
[0010] S2, Data Processing
[0011] 2-1 First, remove non-compliant traffic data, and then perform Min-Max regularization processing;
[0012] 2-2 All regularized traffic data are processed into the following three categories X close X trend X period Traffic at the same time every day, traffic at the same time every week, traffic at the same time every month;
[0013] S3. After inputting the above data into the PreConv module for processing, information containing local spatiotemporal features is obtained;
[0014] S4. Take the output Y from step 3 as input and input it into CoANet to extract long-term spatiotemporal feature information;
[0015] S5. Using the Fusion module, combine the outputs of step S3 and step S4 to obtain the final feature information that combines local spatiotemporal feature information and long-term spatiotemporal feature information as the final output.
[0016] Preferably, in step S1, the inflow and outflow of the cell (i, j) in the i-th row and j-th column at the t-th time interval are calculated using the following formulas:
[0017]
[0018]
[0019] Where Tr: g1→g2→…→g |Tr| yes A segment of the trajectory, g k It is a geographic spatial coordinate, g k∈(i,j) represents point g k Within the square (i, j), during the t-th time interval, all inflow and outflow within the I×J region can be represented as a tensor. in For an M*N grid, at any given time, the two types of flow within each square can be represented by the same tensor, i.e. Predicting regional traffic flow, i.e., given historical observations {X} t To predict X using |t=0,…,n-1} n .
[0020] Preferably, the PreConv module consists of four convolutional blocks: Conv1, Conv2, Conv3, and Conv4. Conv1, Conv2, and Conv4 are the main convolutional blocks, using 3x3 convolutional kernels. Conv3 is a residual block with a 1x1 kernel. The input of the PreConv module is X, and the output is Y, as shown in the following formula:
[0021] Y=Conv4(Conv3(X)+Conv2(Conv1(X)))
[0022] X close X trend X period The input yields three outputs: PreConv close PreConv trend PreConv period .
[0023] Preferably, in step S4, the output Y of step S3 is downsampled by CoANet to reduce the spatial size and reduce the image features to a controllable size, and then global relative attention is used to obtain global feature information; secondly, local attention is forced to obtain local feature information, and the final output long-term spatiotemporal feature information is obtained by combining local feature information and global feature information.
[0024] Preferably, the CoANet consists of five parts: S0, S1, S2, S3, and S4.
[0025] S0 consists of two convolutional modules with a kernel size of 1*1:
[0026]
[0027] in X is the output of S0, X is the input of S0, and Norm is LayerNorm.
[0028] S1 consists of L1 modules, and module G includes two convolutional modules with a kernel size of 1*1 and a deconvolutional module with a kernel size of 3*3.
[0029] G = Conv 1*1 (DepthConv 3*3 (Conv 1*1 (BatchNorm(X))))
[0030]
[0031] Where G is a module of S1 This is the final output of S1, where X is the input of S1, and Proj(Pool(X)) represents the output of the previous module. For ease of formula representation, assume that submodules S1, S2, S3, and S4 are all G, the input is X, and DepthConv is the DepthWise Convolution as shown below:
[0032]
[0033] in These are the input and output at position i, respectively. For the neighborhood of position i, w i-j Let j be the weight of position j relative to position i.
[0034] The S2 consists of L2 G modules, and each module G includes two convolutional modules with a kernel size of 1*1 and a deconvolutional module with a kernel size of 3*3.
[0035] G = Conv 1*1 (DepthConv 3*3 (Conv 1*1 (BatchNorm(X))))
[0036]
[0037] Where G is a module of S2. This is the final output of S2, where X is the input of S1, and Proj(Pool(X)) represents the output of the previous module.
[0038] The S3 consists of L3 G modules, and each G module includes a RelAttention module and an FFN module. The RelAttention formula is as follows:
[0039]
[0040] in These are the input and output at position i, respectively, w i-j Let j be the weight of position j relative to position i.
[0041] The S3 network is shown below:
[0042] T=RelAttention(LayerNorm(X))+LayerNorm(X)
[0043] G = T(X) + FFN(LayerNorm(T(X)))
[0044]
[0045] Where T represents the output of the residual connection between the RelAttention module and X, and T is used as input as the output of FFN, which is then processed through the residual connection structure to obtain G. Proj(Pool(X)) represents the output of the previous module of the current module, which is then... This is the output of S3.
[0046] The S4 consists of L4 G modules, and each G module includes a RelAttention module and an FFN module:
[0047] T=RelAttention(LayerNorm(X))+LayerNorm(X)
[0048] G = T(X) + FFN(LayerNorm(T(X)))
[0049]
[0050] Where T represents the output of the residual connection between the RelAttention module and X, and T is used as input as the output of FFN, which is then processed through the residual connection structure to obtain G. Proj(Pool(X)) represents the output of the previous module of the current module, which is then... This is the output of S4;
[0051] The PreConv close PreConv trend PreConv period CoANet outputs three values, which are respectively used as inputs. close CoANet trend CoANet period .
[0052] Preferably, the Fusion module includes a fully linked layer, denoted by FC:
[0053] Y pred =W c ·PreConv close +W t ·PreConv trend +W p ·PreConv period
[0054] W rc CoANet close +W rt CoANet trend +W rp CoANet period
[0055] Among them, Y pred That is, PreConv, which integrates local features. close PreConv trend PreConv period and global features CoANet close CoANet trend CoANet period The predicted output, W c W t W p W rc W rt W rp The corresponding weights.
[0056] Preferably, the loss function of the overall network composed of PreConv, CoANet, and Fusion in steps S3-S5 is MSELoss:
[0057]
[0058] in For the predicted output, α is the target value.
[0059] As a preferred method, the spatiotemporal information of the grid is used as a heat map of a specific size for prediction.
[0060] Preferably, the network consists of convolutional and attention networks. It comprises five modules: S0, S1, and S2 are convolutional networks, S3 and S4 are similar to the Transformer architecture, and the FFN module is an MLP network.
[0061] The present invention also provides a regional flow prediction device for spatiotemporal sequences, comprising:
[0062] Data preprocessing module: First, it removes data that does not meet the requirements and performs Min-Max regularization. Then, it preprocesses the data into three categories X. close X trend X period As input for the next step.
[0063] PreConv module: X close X trend X period Extracting local features PreConv close PreConv trend PreConv period .
[0064] CoANet module: This will integrate PreConv... close PreConv trend PreConv period CoANet further refines global features based on the input. close CoANet trend CoANet period .
[0065] The Fusion module fuses the learned local and global features using a simple overlay method.
[0066] This invention has the following characteristics and beneficial effects:
[0067] The problem of traffic prediction is transformed into the problem of image pixel prediction. Based on this, the neural network architecture provided by this invention is used to fully learn local and global features, thereby improving the accuracy of prediction. Attached Figure Description
[0068] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0069] Figure 1 This is a schematic diagram of the architecture process provided by the present invention;
[0070] Figure 2 This is a schematic diagram of the PreConv module of the present invention;
[0071] Figure 3 This is a schematic diagram of the CoANet architecture provided by the present invention. Detailed Implementation
[0072] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.
[0073] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0074] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0075] This invention provides a workflow for a regional flow prediction method based on spatiotemporal sequences, such as... Figure 1 As shown below: Step S1, perform standardized analysis, missing data marking, and data normalization on the original data, and finally divide it into three categories according to the period;
[0076] Step S2: Learn local feature information using the PreConv module;
[0077] Step S3: Learn global feature information using the CoANet module;
[0078] Step S4: Use the Fusion module to combine the feature information from steps S3 and S4 to obtain the final prediction result.
[0079] This embodiment first introduces the basic data format:
[0080] First, the data is gridded, meaning the predicted area is divided into an M*N grid. Then, the inflow and outflow rates into all grids (small areas) are calculated for each time period. Definitions are defined as follows. For a group in t th The set of trajectories over time intervals. The inflow and outflow of the cell (i, j) in the i-th row and j-th column at the t-th time interval are represented by the following formulas:
[0081]
[0082]
[0083] Where Tr: g1→g2→…→g |Tr| yes A segment of the trajectory. g k It is a geographic spatial coordinate, g k ∈(i,j) represents point g k Within the square (i, j), during the t-th time interval, all inflow and outflow within the I×J region can be represented as a tensor. in For an M*N grid, at any given time, the two types of flow within each square can be represented by the same tensor, i.e. Predicting regional traffic flow, i.e., given historical observations {X} t To predict X using |t=0,…,n-1} n .
[0084] Next, S1 preprocesses the data, removing invalid and missing data, then regularizes the data, and finally divides the processed data into three categories according to requirements:
[0085] 1-1 First, remove data that does not conform to the standard, and then perform Min-Max regularization.
[0086]
[0087] 1-2 will process all traffic into the following three categories X close X trend X period Traffic at the same time every day, traffic at the same time every week, and traffic at the same time every month.
[0088]
[0089]
[0090]
[0091] Where d c L week L month These represent the selected number of days, weeks, and months, respectively. H*W represents the height and width of the original map selection.
[0092] S2: Input the above data into the PreConv module for preprocessing to obtain information containing local spatiotemporal features.
[0093] The 2-1 PreConv module consists of the following four parts, such as... Figure 1 As shown.
[0094] 2-2 Conv1, Conv2, Conv3, and Conv4 are all convolutional modules, but they have different parameters.
[0095] 2-3 Conv1, Conv2 and Conv4 are the main convolutional modules, and 3*3 convolutional kernels are used here.
[0096] 2-4 Conv3 is a residual module with a convolution kernel size of 1*1.
[0097] 2-5 PreConv takes X as input and outputs Y, as shown in the formula below:
[0098] Y=Conv4(Conv3(X)+Conv2(Conv1(X)))
[0099] X close X trend X period The input yields three outputs: PreConv close PreConv trend PreConv period .
[0100] S3: Using the output Y from step S2 as input, we input it into CoANett to extract long-term spatiotemporal feature information. We need to process the three inputs PreConv... close PreConv trend PreConv period They will be processed separately, since they use the same network. The CoANet network will be introduced next:
[0101] 3-1 Figure 3 As shown, CoANet consists of five parts, namely: S oS1, S2, S3, and S4 primarily perform downsampling to reduce the spatial size, shrinking the image features to a manageable size before utilizing global relative attention to acquire global feature information. Secondly, they force local attention to obtain local feature information, and finally, by combining local and global feature information, they obtain the final output.
[0102] 3-2S0 consists of two convolutional modules with a kernel size of 1*1.
[0103]
[0104] in X is the output of S0, X is the input of S0, and Norm is...
[0105] 3-3 S1 consists of L1 modules. Module G includes two convolutional modules with a kernel size of 1*1 and a deconvolutional module with a kernel size of 3*3.
[0106] G = Conv 1*1 (DepthConv 3*3 (Conv 1*1 (BatchNorm(X))))
[0107]
[0108] Where G is a module of S1 This is the final output of S1, where X is the input of S1, and Proj(Pool(X)) represents the output of the previous module. For ease of formula representation, we assume that submodules S1, S2, S3, and S4 are all G, and the input is X. The specific composition of submodule G is determined by the corresponding formulas and... Figure 2 As shown. DepthConv is DepthWiseConvolution as shown below:
[0109]
[0110] in These are the input and output at position i, respectively. Let w be the neighborhood of position i. i-i Let be the weight of position j relative to position i.
[0111] 3-4 S2 consists of L2 modules. Module G includes two convolutional modules with a kernel size of 1*1 and a deconvolutional module with a kernel size of 3*3, similar to S1.
[0112] =Conv 1*1 (DepthConv 3*3 (Conv1*1 (BatchNorm(X))))
[0113]
[0114] Where G is a module of S2. This is the final output of S2, and X is the input of S1. Proj(Pool(X)) represents the output of the previous module, which is the current module's output.
[0115] 3-5 S3 consists of L3 modules, with module G comprising a RelAttention module and an FFN module. The RelAttention formula is shown below:
[0116]
[0117] in These are the input and output at position i, respectively, w i-j Let be the weight of position j relative to position i, and so on.
[0118] The S3 network is shown below:
[0119] T=RelAttention(LayerNorm(X))+LayerNorm(X)
[0120] G = T(X) + FFN(LayerNorm(T(X)))
[0121]
[0122] Where T represents the output of the residual connection between the RelAttention module and X, and then T is used as input as the output of FFN, which is passed through the residual connection structure to obtain G. Proj(Pool(X)) represents the output of the previous module of the current module, which is then the output of the previous module. This is the output of S3.
[0123] 3-6 S4 consists of L4 modules, and module G includes a RelAttention module and an FFN module.
[0124] T=RelAttention(LayerNorm(X))+LayerNorm(X)
[0125] G = T(X) + FFN(LayerNorm(T(X)))
[0126]
[0127] Where T represents the output of the residual connection between the RelAttention module and X, and then T is used as input as the output of FFN, which is passed through the residual connection structure to obtain G. Proj(Pool(X)) represents the output of the previous module of the current module, which is then the output of the previous module. This is the output of S4.
[0128] 3-7 PreConv close PreConv trend PreConv period CoANet outputs three values, which are respectively used as inputs. close CoANet trend CoANet period .
[0129] S4: Using the Fusion module, combine the outputs of step 3 and step 4 to obtain the final feature information that combines local spatiotemporal feature information and long-term spatiotemporal feature information as the final output.
[0130] 4-1 Fusion contains a fully connected layer, denoted by FC:
[0131] Y pred =W c ·PreConv close +W t ·PreConv trend +W p ·PreConv period
[0132] W rc CoANet close +W rt CoANet trend +W rp CoANet period
[0133] 4-2 Y pred That is, PreConv, which integrates local features. close PreConv trend PreConv period and global features CoANet close CoANet trend CoANet period The predicted output, W c W t W p W rc W rt W rp The corresponding weights are learned by the neural network.
[0134] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments, including components, without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.
Claims
1. A method for predicting regional flow based on spatiotemporal sequences, characterized in that, Includes the following steps: S1. Data format for dividing the corresponding predicted regions. The grid is defined, and the inflow and outflow of traffic entering and leaving all grids within each time period are counted; As a group in The set of trajectories over time intervals; S2, Data Processing 2-1 First, remove traffic data that does not conform to the specifications, and then perform Min-Max regularization processing; 2-2 All regularized traffic data are processed into the following three categories. , , Traffic at the same time every day, traffic at the same time every week, traffic at the same time every month; S3. After inputting the above data into PreConv for processing, information containing local spatiotemporal features is obtained; The PreConv module consists of four convolutional blocks: Conv1, Conv2, Conv3, and Conv4. Conv1, Conv2, and Conv4 are the main convolutional blocks, using 3x3 kernels. Conv3 is a residual block with a 1x1 kernel. The input to the PreConv module is... The output is The formula is shown below: , , The input produces three outputs. , , ; S4. Transfer the output from step 3. As input, it is fed into CoANet to extract long-term spatiotemporal feature information; The CoANet consists of five parts: , , , , , The It consists of two convolutional modules with a kernel size of 1*1: in for The output, for The input, Norm is ; The Depend on It consists of several modules, each module It consists of two convolutional modules with a kernel size of 1*1 and a deconvolutional module with a kernel size of 3*3. in for One of the modules, for The final output, for Input, This represents the output of the previous module, which is the current module. For the sake of convenience in formula representation, assume , , , All submodules are The input is , yes As shown below: in They are in the position Inputs and outputs For position The neighborhood, For position Position The weights; The Depend on It consists of several modules, each module It consists of two convolutional modules with a kernel size of 1*1 and a deconvolutional module with a kernel size of 3*3. in for One of the modules, for The final output, for Input, This represents the output of the previous module, which is the current module. , The Depend on It consists of 1 G modules, modules Includes one Module and a Module composition, The attention formula is shown below: in They are in the position Inputs and outputs For position Position The weights; The network is shown below: in express Modules and The output of the residual link, secondly As input The output is obtained through a residual linking structure. , This represents the output of the previous module, which is the current module. ; for The output; The Depend on It consists of 1 G modules, modules Includes one Module and a Module composition: in express Modules and The output of the residual link, secondly As input The output is obtained through a residual linking structure. , This represents the output of the previous module, which is the current module. ; for The output; The , , Each of these is used as input to produce three outputs. , , ; S5, Utilization Combining the outputs of step S3 and step S4, the final output is the feature information that combines local spatiotemporal feature information and long-term spatiotemporal feature information.
2. The regional flow prediction method for spatiotemporal series according to claim 1, characterized in that, In step S1, the inflow and outflow of the cell (i, j) in the i-th row and j-th column at the t-th time interval are calculated as follows: in yes A segment of the trajectory, These are geographic spatial coordinates. Point In the square Internally, within the t-th time interval, all in The inflow and outflow within a region can be represented as a tensor. ,in , For a In a grid diagram, the two types of flow within each square at any given time can be represented by the same tensor, i.e. Predicting regional flow problems, i.e., given historical observations To predict .
3. The regional flow prediction method for spatiotemporal series according to claim 1, characterized in that, In step S4, the output of step S3 is processed by CoANet. After downsampling to reduce the spatial size and shrinking the image features to a controllable size, global relative attention is used to obtain global feature information. Secondly, forced local attention is used to obtain local feature information, and the final output, long-term spatiotemporal feature information, is obtained by integrating local and global feature information.
4. The regional flow prediction method for spatiotemporal series according to claim 1, characterized in that, The The module contains a fully linked layer for... express: in, That is, to integrate local features , , and global features , , The predicted output, , , , , , The corresponding weights.
5. The regional flow prediction method for spatiotemporal series according to claim 4, characterized in that, The loss function of the overall network composed of PreConv, CoANet, and Fusion in steps S3-S5 is: : loss in To predict the output, This is the target value.