A method, device and equipment for predicting ship traffic flow
By acquiring real-time traffic flow and weather data of ship channels and using a multi-layer network model to decompose and process them, the problem of accuracy in traffic flow prediction under adverse weather conditions is solved, stable traffic flow prediction under adverse weather conditions is achieved, and safe navigation of ships is ensured.
Patent Information
- Application Number
- CN202410930465.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-07-11
AI Technical Summary
Existing ship traffic flow prediction methods fail to effectively consider the impact of adverse weather on traffic flow, resulting in difficulties in maritime traffic management and scheduling, and posing safety risks.
By acquiring real-time traffic flow data and weather factor data of ship channels, the target traffic flow prediction model is used for decomposition processing and multi-layer network model training. Different preset network models are used in the decomposition layer, intermediate layer and prediction layer respectively to extract and process feature data to achieve accurate traffic flow prediction.
Stable and accurate forecasting of traffic flow in adverse weather conditions ensures safe navigation of ships and facilitates maritime traffic management and dispatch.
Smart Images

Figure CN119066414B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ship traffic flow prediction, and in particular to a method, device and equipment for predicting ship traffic flow. Background Art
[0002] Maritime trade is the primary mode of commerce, but existing transportation infrastructure is increasingly struggling to cope with the growing and complex nature of traffic flows, making traditional maritime traffic management and dispatching difficult. Furthermore, collisions, groundings, and oil spills caused by irregular ship navigation are common, posing a significant challenge in ensuring safe navigation.
[0003] Reliable and reasonable traffic flow forecast data can provide an important foundation for traffic organization and optimization in ports and important waterways. Vessel traffic flow forecasting can provide a basis for maximizing waterway navigability and provide a theoretical foundation for improving traffic efficiency and safety. However, existing traffic flow forecasting methods do not consider the impact of adverse weather on traffic flow and cannot meet the needs of real-world scenarios. Summary of the Invention
[0004] The present invention provides a method, device and equipment for predicting ship traffic flow, which can realize traffic flow prediction under the influence of adverse weather, stably and accurately predict traffic flow under the influence of adverse weather, help to ensure the safe navigation of ships, and facilitate maritime traffic management and scheduling.
[0005] In order to solve the above technical problems, the technical solutions of the present invention are as follows:
[0006] A method for predicting ship traffic flow, comprising:
[0007] Obtain real-time traffic flow data and real-time weather factor data for ship channels;
[0008] determining target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data;
[0009] Inputting the target traffic flow characteristic data into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences;
[0010] Inputting the plurality of characteristic data sequences into the intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate layer processing result;
[0011] The intermediate layer processing result is input into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain a ship traffic flow prediction result; wherein, the decomposition layer of the target traffic flow prediction model is trained according to the first preset network model, the intermediate layer is trained according to the second preset network model and the third preset network model, and the prediction layer is trained according to the fourth preset network model.
[0012] Optionally, determining target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data includes:
[0013] By formula:
[0014]
[0015] Obtaining a correlation coefficient between the weather factor data and the real-time traffic flow data;
[0016] Determining the real-time traffic flow data whose correlation coefficient is greater than a preset value as target traffic flow characteristic data;
[0017] Among them, ρ X,Y is the correlation coefficient, and the sequence of weather factor data is: X=[X1,X2,…,X N ]; is the mean of the elements in sequence X, X i is an element in the sequence X; the sequence of the real-time traffic flow data is: Y = [Y1, Y2, ..., Y N ]; is the mean of the elements in sequence Y, i is the element in sequence Y, and N is the number of elements in sequence X or sequence Y.
[0018] Optionally, the target traffic flow characteristic data is input into a decomposition layer of a target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences, including:
[0019] The target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model, and the target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model according to y(t)=f(t)+r(t)=exp(g'(t)+h'(t))+s(t+ε t Perform decomposition processing to obtain regularity component feature data sequence and residual component feature data sequence;
[0020] in,
[0021] y(t) represents the target traffic flow characteristic data; f(t) represents the regularity component; r(t) represents the residual component; g(t) represents the trend term; s(t) represents the seasonal term; h(t) represents the weather impact term; ε trepresents a singular term that cannot be fitted.
[0022] Optionally, the plurality of feature data sequences are input into an intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate layer processing result, including:
[0023] Inputting the regularity component feature data sequence into the first processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a first intermediate layer processing result;
[0024] The regularity component feature data sequence and the residual component feature data sequence are input into the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result.
[0025] Optionally, inputting the regularity component feature data sequence into a first processing module of an intermediate layer of the target traffic flow prediction model for processing to obtain a first intermediate layer processing result includes:
[0026] The regularity component feature data sequence is input into the time series prediction unit of the first processing module of the intermediate layer of the target traffic flow prediction model for processing, and the obtained processing result is used as the first intermediate layer processing result.
[0027] Optionally, inputting the regularity component feature data sequence and the residual component feature data sequence into a second processing module of an intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result includes:
[0028] Inputting the regularity component feature data sequence and the residual component feature data sequence into the encoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate vector;
[0029] The intermediate vector is input into the decoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result.
[0030] Optionally, the intermediate layer processing result is input into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain a ship traffic flow prediction result, including:
[0031] The intermediate layer processing result is input into the shallow fully connected neural network unit of the prediction layer of the target traffic flow prediction model for feature fitting processing to obtain the ship traffic flow prediction result.
[0032] The present invention also provides a device for predicting ship traffic flow, comprising:
[0033] An acquisition module is used to obtain real-time traffic flow data and real-time weather factor data of ship channels;
[0034] A processing module is used to determine target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data; input the target traffic flow characteristic data into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences; input the multiple characteristic data sequences into the intermediate layer of the target traffic flow prediction model for processing to obtain intermediate layer processing results; input the intermediate layer processing results into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain a ship traffic flow prediction result; wherein, the decomposition layer of the target traffic flow prediction model is trained according to the first preset network model, the intermediate layer is trained according to the second preset network model and the third preset network model, and the prediction layer is trained according to the fourth preset network model.
[0035] The present invention further provides a computing device, comprising: a processor and a memory storing a computer program, wherein the computer program executes the method described above when executed by the processor.
[0036] The present invention also provides a computer-readable storage medium storing instructions, which, when executed on a computer, enable the computer to execute the method described above.
[0037] The above solution of the present invention includes at least the following beneficial effects:
[0038] The above-mentioned scheme of the present invention obtains real-time traffic flow data and real-time weather factor data of the ship channel; determines the target traffic flow characteristic data according to the correlation between the weather factor data and the real-time traffic flow data; inputs the target traffic flow characteristic data into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences; inputs the multiple characteristic data sequences into the intermediate layer of the target traffic flow prediction model for processing to obtain intermediate layer processing results; inputs the intermediate layer processing results into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain ship traffic flow prediction results; it can realize traffic flow prediction under the influence of adverse weather, stably and accurately predict traffic flow under the influence of adverse weather, help to ensure the safe navigation of ships, and facilitate maritime traffic management and scheduling. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 is a flow chart of a method for predicting ship traffic flow provided by an embodiment of the present invention;
[0040] Figure 2 This is a basic classification diagram of waterway traffic flow;
[0041] Figure 3 is a neural network structure diagram of a target traffic flow prediction model provided by an embodiment of the present invention;
[0042] Figure 4 1 is a schematic diagram of the neural network structure of the second processing module in the target traffic flow prediction model provided by an embodiment of the present invention;
[0043] Figure 5 is a neural network structure diagram of a recurrent neural network unit provided by an embodiment of the present invention;
[0044] Figure 6 A module diagram of a device for predicting ship traffic flow provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0046] like Figure 1 As shown, an embodiment of the present invention provides a method for predicting ship traffic flow, comprising:
[0047] Step 11, obtaining real-time traffic flow data and real-time weather factor data of the ship channel;
[0048] Step 12: determining target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data;
[0049] Step 13: inputting the target traffic flow characteristic data into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences;
[0050] Step 14: inputting the plurality of characteristic data sequences into the intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate layer processing result;
[0051] Step 15: inputting the intermediate layer processing result into the prediction layer of the target traffic flow prediction model to perform traffic flow prediction processing to obtain a ship traffic flow prediction result;
[0052] Among them, the decomposition layer of the target traffic flow prediction model is trained according to the first preset network model, the intermediate layer is trained according to the second preset network model and the third preset network model, and the prediction layer is trained according to the fourth preset network model.
[0053] In this embodiment, real-time traffic flow data and real-time weather factor data of the ship channel are obtained; target traffic flow characteristic data is determined based on the correlation between the weather factor data and the real-time traffic flow data; the target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences; the multiple characteristic data sequences are input into the intermediate layer of the target traffic flow prediction model for processing to obtain intermediate layer processing results; the intermediate layer processing results are input into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain ship traffic flow prediction results; traffic flow prediction under the influence of adverse weather can be realized, and traffic flow can be stably and accurately predicted under the influence of adverse weather, which helps to ensure the safe navigation of ships and facilitates maritime traffic management and scheduling.
[0054] In an embodiment of the present invention, the vessel traffic flow may include at least one of the following indicators:
[0055] (1) Traffic flow trajectory: the trajectory of ships in the waterway;
[0056] (2) Traffic flow speed: the average speed of ships traveling in different areas of the waterway and at different time periods;
[0057] (3) Traffic flow density: the number of ships traveling within a unit waterway space, which can objectively reflect the congestion of the waterway;
[0058] (4) Traffic flow width: the width of the route occupied by the macroscopic ship traffic flow in different time periods and different areas;
[0059] (5) Traffic flow: the number of ships in the waterway per unit time, or the number of ships passing the gate line per unit time.
[0060] like Figure 2 The figure below shows the basic classification of waterway traffic flow. When counting the number of ships, it is necessary to consider the spatial characteristics of the waterway. However, the waterway in actual conditions is more complex. When conducting analysis and prediction, it is necessary to consider whether there are situations such as ship confluence, diversion, and temporary turning.
[0061] The traffic flow prediction result can be the prediction of the future ship traffic volume at one or more time steps τ, which can be expressed as:
[0062] I 1:T =[I1,I2,I3,...,I n ]→I τ | V=0 ;
[0063] Where V=0.
[0064] In an optional embodiment of the present invention, cross-sectional traffic volume is used as the target. Cross-sectional traffic volume refers to the total number of ships passing through the waterway and coastal navigation zone within a given time. Specifically, the ship flow rate passing through the cross section every 30 minutes is used to construct a data set.
[0065] The process of acquiring real-time traffic flow data of ship channels includes:
[0066] Obtaining AIS (Automatic Identification System) data of ships in the shipping lane;
[0067] According to the AIS data of the ship, real-time traffic flow data of the ship channel is obtained.
[0068] In this embodiment, the AIS data of the ship includes: the ship's Maritime Mobile Service Identification Number (MMSI), latitude, longitude, speed, length, type, and true heading;
[0069] Assume that the coordinates of observation point A are (x a ,y a ), the coordinates of point B are (x b ,y b ), the latitude and longitude coordinates of the ship obtained from the record are (x, y);
[0070] Data cleaning: discard abnormal records and only keep records that meet speed ≥ 0, 0 ≤ trueheading < 360, and length > 0;
[0071] Position judgment: Let S = (x a -x)(y b -y)-(y a -y)(x b -x), if S<0, the ship position is considered to be on the left side of the observation line AB, otherwise it is on the right side; the function S is operated on all records, and the records that satisfy S<0 are saved in the set L, and the rest are saved in the set R;
[0072] Time statistics: Divide all records of L and R into 30-minute intervals, and obtain 31*24*2 small sets in each group; the divided sets are recorded as L=[L1,L2,...L 31*24*2 ] and R=R1,R2,...R 31*24*2 ];
[0073] Get the passing set: "Passing" is defined as: within a given time period, both sets L and R have records with the same MMSI number (that is, they belong to the same ship); the passing set is obtained by taking the intersection of the two sets L and R, that is, PASS i =L i ∩R i ; Where i is the number of the time period, PASS i Represents the MMSI numbers of all ships crossing the observation line during the time period; each MMSI number corresponds to a ship, and duplicate MMSI numbers are removed to obtain a unique crossing set;
[0074] Traffic volume conversion: for PASS i All ships are converted to standard traffic volume according to the conversion coefficients in Table 1, and the sum is calculated to obtain the final traffic volume; the operation of obtaining the crossing set and converting the standard traffic volume is repeated to obtain the passing traffic volume of all time periods;
[0075] Table 1 Ship type coefficient conversion table
[0076] Ship tonnage (t) Length (m) Conversion factor <100 <30 0.25 100-499 30-49 0.5 500-2999 50-89 1 3000-5999 90-114 1.18 6000-9999 115-134 1.41 10000-19999 135-169 2 20000-29999 170-194 2.25 30000-39999 195-214 2.5 40000-59999 215-245 3 >60000 >245 4
[0077] Denoising and stabilization: Wavelet smoothing algorithm is used to reduce the noise of traffic data and improve its smoothness;
[0078] Through the above process, the total number of ships passing through the waterway and the coastal navigation zone within a given time, that is, the end-face traffic volume, is obtained as the real-time traffic flow data of the ship channel.
[0079] In an optional embodiment of the present invention, the acquisition interval of real-time traffic flow data of the ship channel is 30 minutes, and the acquisition interval of real-time weather factor data varies from 3 hours to 1 hour. The real-time weather factor data is preprocessed and converted to uniform 30-minute interval data. The original sampling interval of the meteorological series is large, so missing data needs to be repaired; the real-time weather factor data is filled by cubic spline interpolation:
[0080] 1) For the given n+1 ordered points (x0, y0)...(x n ,y n ) is divided into n intervals, S i (x) is the function that fits the interval;
[0081] 2) For each boundary point of the interval, for any i, the interpolation condition S(x i )=y i ;
[0082] 3) S(x) is smooth and continuous, and both the first-order and second-order derivatives exist at each point;
[0083] Based on the above, the function of the i-th interval is:
[0084] S i (x) = a i +b i (xx i )+c i (xx i ) 2 +d i (xx i ) 3 ;
[0085] S' i (x) = b i +2c i (xx i )+3d i (xx i ) 2 ;
[0086] S” i (x) = 2c i +6d i (xx i );
[0087] Among them, a, b, c, and d are polynomial coefficients;
[0088] m i =S” i (x), h i =x i+1 -x i ; It can be seen that h i By y i+1 Draw out; c i and d i By m i and h i roll out;
[0089] When natural boundaries are specified (the second-order derivatives of both end points are 0), the solution process of this function is:
[0090]
[0091] After the above steps, a fitting curve is obtained, completing the processing and conversion of real-time weather factor data.
[0092] In an optional embodiment of the present invention, step 12 includes:
[0093] Step 121, by formula:
[0094]
[0095] Obtaining a correlation coefficient between the weather factor data and the real-time traffic flow data;
[0096] Step 122, determining the real-time traffic flow data with a correlation coefficient greater than a preset value as target traffic flow characteristic data;
[0097] Among them, ρ X,Y is the correlation coefficient, and the sequence of weather factor data is: X=[X1,X2,…,X N ]; is the mean of the elements in sequence X, X i is an element in the sequence X; the sequence of the real-time traffic flow data is: Y = [Y1, Y2, ..., Y N ]; is the mean of the elements in sequence Y, i is the element in sequence Y, and N is the number of elements in sequence X or sequence Y.
[0098] In this embodiment, in actual practice, weather factors have different effects on traffic flow. In order to accurately obtain traffic flow data under the influence of weather factors, the correlation coefficients between weather factors such as rainfall, wind speed, temperature, and visibility and traffic flow are obtained using the above formula;
[0099] Specifically, a correlation coefficient less than 0.1 indicates no correlation, a correlation coefficient greater than 0.1 and less than 0.3 indicates weak correlation, a correlation coefficient greater than 0.3 and less than 0.5 indicates correlation, and a correlation coefficient greater than 0.5 indicates strong correlation. In this embodiment, the traffic flow data with a correlation coefficient greater than 0.3 is determined as the target traffic flow characteristic data.
[0100] In an optional embodiment of the present invention, step 13 includes:
[0101] Step 131: Input the target traffic flow characteristic data into the decomposition layer of the target traffic flow prediction model, and calculate the target traffic flow characteristic data according to the formula y(t)=f(t)+r(t)=exp(g'(t)+h'(t))+s(t+ε t Perform decomposition processing to obtain regularity component feature data sequence and residual component feature data sequence;
[0102] in,
[0103] y(t) represents the target traffic flow characteristic data; f(t) represents the regularity component; r(t) represents the residual component; g(t) represents the trend term; s(t) represents the seasonal term; h(t) represents the weather impact term; ε t represents the singular term that cannot be fitted and can be considered as Gaussian white noise.
[0104] In this embodiment, the decomposition formula: y(t)=g(t)+s(t)+h(t)+εt Perform the transformation to obtain the first decomposition: y(t)=g(t)*(1+h(t))+s(t)+ε t ; Performing a logarithmic transformation on the first decomposition formula to obtain the decomposition formula of the present application; processing by the decomposition formula of the present application can improve the calculation accuracy and reduce the loss of value transmission between subsequent layers;
[0105] According to y(t)=f(t)+r(t)=exp(g'(t)+h'(t))+s(t)+ε t Decomposition processing is performed to obtain a regularity component characteristic data sequence and a residual component characteristic data sequence; y(t) is the value of the target traffic flow characteristic data at time t;
[0106] Trending items:
[0107] g(t)=-k(t)(tm(t))
[0108] Among them, k(t) is the growth rate function; m(t) is the compensation rate function;
[0109]
[0110] m(t)=m+a(t) T γ;
[0111] Where k is the growth rate; the growth rate changes at a specific time node j∈{1,2,...,n}; for a sequence y(t) of length N, the specific time node is set at the beginning of the sequence. At the equal-division point; the rate of change at node j is δ j ; a(t)=[a1(t),...a n (t)] T ,sta j ∈{0,1};γ=[γ1,γ2,...γ n ], and γ j =-s j δ j ;
[0112] Among them, δ j Obeying the Laplace distribution Laplace(0,τ), its probability density function is:
[0113]
[0114] Considering the needs of subsequent prediction tasks, since no new change points are added, k(t) remains unchanged, which will reduce the uncertainty of the prediction and thus reduce the prediction accuracy. To ensure the prediction accuracy, the maximum likelihood estimation is used to obtain the distribution of future change points.
[0115] The results of the maximum likelihood estimation are as follows:
[0116]
[0117] Future change points are randomly distributed with the following probabilities:
[0118]
[0119] Complete the fitting of g(t) by setting n, k, m and τ;
[0120] Seasonal items:
[0121] s(t) = X(t)β;
[0122] in, β=[a1,b1,...,b n ] T , β has a mean of 0 and a variance of σ 2 Normal distribution; P is the period;
[0123] Weather impact items:
[0124] Assume that there are N weather impact items in the time period T, and the time period of each weather impact item is T i (1≤i≤N);
[0125] h(t)=Z(t)κ;
[0126] Where Z(t)=[1(t∈T1),0,...,1(t∈T2),...,1(t∈T N ),];κ~Normal(0,v 2 ); specifically, v 2 The larger the value of , the greater the impact of the emergency event on the entire model, and vice versa. In this embodiment, the impact of the emergency event of meteorological factors is mainly considered, so v is set to 2 =0.7.
[0127] In this embodiment, one of the difficulties in the ship traffic flow prediction problem lies in its "plausible" periodicity and trend: the sequence itself has a fixed upward or downward trend, and a relatively obvious periodic characteristic can be observed when calculated on a daily, weekly, and monthly basis, but the specific periodic nature keeps changing. In order to facilitate the subsequent feature processing of the target traffic flow prediction model, the target traffic flow feature data is decomposed through the decomposition layer of the target traffic flow prediction model to extract the potential periodic changes in the target traffic flow feature data.
[0128] In an optional embodiment of the present invention, step 14 includes:
[0129] Step 141: input the regularity component feature data sequence into the first processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a first intermediate layer processing result;
[0130] Step 142: Input the regularity component feature data sequence and the residual component feature data sequence into the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result.
[0131] In this embodiment, the middle layer of the target traffic flow prediction model is horizontally divided into two processing modules: a first processing module and a second processing module;
[0132] The first processing module adopts a time series prediction unit, whose principle and processing process are the same as the decomposition layer of the target traffic flow prediction model;
[0133] The second processing module adopts a sequence-to-sequence model structure. The encoder unit and decoder unit of the second processing module both adopt a double-layer multi-level recurrent neural network unit, and the first double-layer multi-level recurrent neural network unit of the encoder unit of the second processing module adopts an attention mechanism to output an intermediate vector, such as Figure 4 As shown;
[0134] Among them, the cyclic neural network unit adopts the GRU (gated cyclic unit) structure, as shown in the following example: Figure 5 As shown in the figure, the GRU structure is simpler, with fewer parameters calculated during forward and back propagation, and faster convergence;
[0135] The cyclic neural network unit includes: input layer, hidden layer and output layer; X t is the input unit; S t is a hidden unit; O t is the output unit; L t is the loss function; Y t is the true value; the weight parameter W of the hidden layer s It will be output to the next layer along with the input cycle; the input of the recurrent neural network unit is a time series: X=[X1,X2,...,X n ]; the output is the prediction result; W represents the connection weight matrix between each unit; at time t, the state S of the hidden layer satisfies the following update method: S t =σ(X t W x +S t-1 W s +b s );
[0136] Among them, b s is the bias term; σ is the activation function, usually sigmoid or tanh;
[0137] The output at time t is: Q t =S t W o +b s ;
[0138] The predicted value output is:
[0139] The total loss function is:
[0140] The above is the forward propagation process of the recurrent neural network unit;
[0141] The calculation of each parameter is done by back propagation; where W o and b s Calculated by chain rule; where W s and W x Calculated by the derivative rule of multivariate function;
[0142]
[0143] The GRU structure includes: reset gate and update gate;
[0144] The reset gate is used to control how much previous data is retained, using r t Represents the reset gate, when r t =0, it means forgetting all previous data and resetting to the state of the current input data;
[0145] r t =σ(W r x t +U r h t-1 +b r );
[0146] Where σ is the sigmoid function; x t is the input data; h t-1 is the candidate data of the previous moment; W r and U r is the weight of the reset gate; b r To reset the gate bias;
[0147] The update gate is used to control the update and retention of data. t represents the update gate, when z t =0, it means retaining all previous data;
[0148] z t =σ(W z x t +U z h t-1 +bz );
[0149] Where σ is the sigmoid function; x t is the input data; h t-1 is the candidate data of the previous moment; W z and U z is the weight of the update gate; b r is the bias of the update gate;
[0150] Current candidate values:
[0151] r t is the data for resetting the gate; x t is the input data; h t-1 is the candidate data of the previous moment; W and U are learnable parameters; b is the bias; ⊙ is the element product;
[0152] Output data:
[0153] (1-z t )⊙h t-1 For previously retained data; For updated data;
[0154] Among them, the first double-layer multi-level recurrent neural network unit of the encoder unit of the second processing module adopts the attention mechanism to output the intermediate vector, and the intermediate vector is input into the decoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain the second intermediate layer processing result. The specific process is:
[0155] The encoder unit input of the second processing module is a multivariate sequence of length n and dimension k The output is a sequence y of length T t =[y1,y2,...,y T ], the hidden layer output of the encoder at time t is h t , the hidden layer state of the decoder is s t , the correlation between historical input and current moment is: e tj =a(s t-1 ,h j ); where a is the correlation function used to calculate s t-1 and h j the correlation between them;
[0156] For e tj Perform softmax and regularization processing to quantize it into values with a sum of 1 and unequal weights; thus, the contribution of the historical sequence to the current moment is obtained:
[0157]
[0158] The intermediate vector is:
[0159] The next moment input of the decoder is: s t =f(s t-1 ,y t-1 ,c t );
[0160] The predicted output of the decoder is:
[0161] Where W is the weight, Represents the predicted value, act is the activation function, usually tanh.
[0162] In an optional embodiment of the present invention, step 141 includes:
[0163] Step 1411: input the regularity component feature data sequence into the time series prediction unit of the first processing module of the intermediate layer of the target traffic flow prediction model for processing, and the obtained processing result is used as the first intermediate layer processing result.
[0164] In this embodiment, the processing principle and process of the time series prediction unit of the first processing module of the intermediate layer of the target traffic flow prediction model are the same as the processing principle and process of the decomposition layer of the target traffic flow prediction model, and have been described in the above content and will not be repeated here.
[0165] In an optional embodiment of the present invention, step 142 includes:
[0166] Step 1421: Input the regularity component feature data sequence and the residual component feature data sequence into the encoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate vector;
[0167] Step 1422: Input the intermediate vector into the decoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result.
[0168] In this embodiment, the regularity component feature data sequence and the residual component feature data sequence are input into the input layer of the first double-layer multi-stage recurrent neural network unit of the encoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model as the first input layer output result; the first input layer output result and the first input layer target parameter are input into the hidden layer of the first double-layer multi-stage recurrent neural network unit of the encoder unit of the second processing module for processing to obtain the first hidden layer output result; the first hidden layer output result and the first hidden layer target parameter are input into the output layer of the first double-layer multi-stage recurrent neural network unit of the encoder unit of the second processing module for processing, and the output result obtained is used as the intermediate vector;
[0169] The intermediate vector is input into the input layer of the second double-layer multi-level cyclic neural network unit of the decoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model as the second input layer output result; the second input layer output result and the second input layer target parameter are input into the hidden layer of the second double-layer multi-level cyclic neural network unit of the decoder unit of the second processing module for processing to obtain the second hidden layer output result; the second hidden layer output result and the second hidden layer target parameter are input into the output layer of the second double-layer multi-level cyclic neural network unit of the decoder unit of the second processing module for processing, and the obtained output result is used as the second intermediate layer processing result.
[0170] In an optional embodiment of the present invention, step 15 includes:
[0171] Step 151: Input the intermediate layer processing result into the shallow fully connected neural network unit of the prediction layer of the target traffic flow prediction model for feature fitting processing to obtain the ship traffic flow prediction result.
[0172] In this embodiment, the first intermediate layer processing result and the second intermediate layer processing result are input into the input layer of the shallow fully connected neural network unit of the prediction layer of the target traffic flow prediction model as the input layer result, the input layer result and the first target parameter are input into the hidden layer of the shallow fully connected neural network unit of the prediction layer for processing to obtain the hidden layer result, the hidden layer result and the second target parameter are input into the output layer of the shallow fully connected neural network unit of the prediction layer for regression processing, and the output result obtained is used as the ship traffic flow prediction result. Specific embodiment:
[0174] Receive AIS data of ships in a certain waterway area and weather data of that area;
[0175] Process the ship's AIS data to obtain real-time traffic flow data;
[0176] Process and convert meteorological data to obtain real-time weather factor data;
[0177] Obtaining a correlation coefficient between the weather factor data and the real-time traffic flow data;
[0178] Determining the real-time traffic flow data whose correlation coefficient is greater than a preset value as target traffic flow characteristic data;
[0179] Inputting the target traffic flow characteristic data into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain a regularity component characteristic data sequence and a residual component characteristic data sequence;
[0180] Inputting the regularity component feature data sequence into the time series prediction unit of the first processing module of the intermediate layer of the target traffic flow prediction model for processing, and obtaining the processing result as the first intermediate layer processing result;
[0181] Input the regularity component feature data sequence and the residual component feature data sequence into the input layer of the first double-layer multi-stage cyclic neural network unit of the encoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model as the first input layer output result; input the first input layer output result and the first input layer target parameter into the hidden layer of the first double-layer multi-stage cyclic neural network unit of the encoder unit of the second processing module for processing to obtain the first hidden layer output result; input the first hidden layer output result and the first hidden layer target parameter into the output layer of the first double-layer multi-stage cyclic neural network unit of the encoder unit of the second processing module for processing, and the obtained output result is used as the intermediate vector;
[0182] Input the intermediate vector into the input layer of the second double-layer multi-stage cyclic neural network unit of the decoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model as the second input layer output result; input the second input layer output result and the second input layer target parameter into the hidden layer of the second double-layer multi-stage cyclic neural network unit of the decoder unit of the second processing module for processing to obtain the second hidden layer output result; input the second hidden layer output result and the second hidden layer target parameter into the output layer of the second double-layer multi-stage cyclic neural network unit of the decoder unit of the second processing module for processing, and the obtained output result is used as the second intermediate layer processing result;
[0183] The first intermediate layer processing result and the second intermediate layer processing result are input into the input layer of the shallow fully connected neural network unit of the prediction layer of the target traffic flow prediction model as the input layer result, the input layer result and the first target parameter are input into the hidden layer of the shallow fully connected neural network unit of the prediction layer for processing to obtain the hidden layer result, the hidden layer result and the second target parameter are input into the output layer of the shallow fully connected neural network unit of the prediction layer for regression processing, and the output result obtained is used as the ship traffic flow prediction result.
[0184] Aiming at two problems in the short-term prediction of ship traffic flow: multi-step prediction and prediction under adverse weather conditions, a target traffic flow prediction model is proposed, which adopts a three-layer architecture; the impact of weather factors is quantified as an attenuation coefficient through the decomposition layer, and a feature-rich intermediate matrix is constructed; the intermediate layer consists of a first processing module composed of a time series prediction unit and a second processing module composed of a sequence-to-sequence model structure using an attention mechanism, which can capture the long-term and short-term characteristics of the traffic flow sequence and the nonlinear mapping relationship between multiple variables, greatly improving the model's feature expression ability for long and short sequence inputs; the target traffic flow prediction model of this application has excellent versatility, can be applied to single-step prediction and multi-step prediction tasks, and can make reasonable and accurate predictions under adverse weather conditions.
[0185] like Figure 6 As shown, an embodiment of the present invention further provides a vessel traffic flow prediction device 60, comprising:
[0186] An acquisition module 61 is used to acquire real-time traffic flow data and real-time weather factor data of the ship channel;
[0187] The processing module 62 is used to determine the target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data; input the target traffic flow characteristic data into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences; input the multiple characteristic data sequences into the intermediate layer of the target traffic flow prediction model for processing to obtain intermediate layer processing results; input the intermediate layer processing results into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain ship traffic flow prediction results; wherein, the decomposition layer of the target traffic flow prediction model is trained according to the first preset network model, the intermediate layer is trained according to the second preset network model and the third preset network model, and the prediction layer is trained according to the fourth preset network model.
[0188] Optionally, determining target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data includes:
[0189] By formula:
[0190]
[0191] Obtaining a correlation coefficient between the weather factor data and the real-time traffic flow data;
[0192] Determining the real-time traffic flow data whose correlation coefficient is greater than a preset value as target traffic flow characteristic data;
[0193] Among them, ρ X,Y is the correlation coefficient, and the sequence of weather factor data is: X=[X1,X2,…,X N ]; is the mean of the elements in sequence X, X i is an element in the sequence X; the sequence of the real-time traffic flow data is: Y = [Y1, Y2, ..., Y N ]; is the mean of the elements in sequence Y, i is the element in sequence Y, and N is the number of elements in sequence X or sequence Y.
[0194] Optionally, the target traffic flow characteristic data is input into a decomposition layer of a target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences, including:
[0195] The target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model, and the target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model according to y(t)=f(t)+r(t)=exp(g'(t)+h'(t))+s(t+ε t Perform decomposition processing to obtain regularity component feature data sequence and residual component feature data sequence;
[0196] in,
[0197] y(t) represents the target traffic flow characteristic data; f(t) represents the regularity component; r(t) represents the residual component; g(t) represents the trend term; s(t) represents the seasonal term; h(t) represents the weather impact term; ε t represents a singular term that cannot be fitted.
[0198] Optionally, the plurality of feature data sequences are input into an intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate layer processing result, including:
[0199] Inputting the regularity component feature data sequence into the first processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a first intermediate layer processing result;
[0200] The regularity component feature data sequence and the residual component feature data sequence are input into the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result.
[0201] Optionally, inputting the regularity component feature data sequence into a first processing module of an intermediate layer of the target traffic flow prediction model for processing to obtain a first intermediate layer processing result includes:
[0202] The regularity component feature data sequence is input into the time series prediction unit of the first processing module of the intermediate layer of the target traffic flow prediction model for processing, and the obtained processing result is used as the first intermediate layer processing result.
[0203] Optionally, inputting the regularity component feature data sequence and the residual component feature data sequence into a second processing module of an intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result includes:
[0204] Inputting the regularity component feature data sequence and the residual component feature data sequence into the encoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate vector;
[0205] The intermediate vector is input into the decoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result.
[0206] Optionally, the intermediate layer processing result is input into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain a ship traffic flow prediction result, including:
[0207] The intermediate layer processing result is input into the shallow fully connected neural network unit of the prediction layer of the target traffic flow prediction model for feature fitting processing to obtain the ship traffic flow prediction result.
[0208] It should be noted that the device is a device corresponding to the above method, and all implementation methods in the above method embodiments are applicable to the embodiments of the device and can achieve the same technical effects.
[0209] An embodiment of the present invention further provides a computing device comprising: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described in the above embodiment. All implementations of the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0210] The present invention also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to execute the method described in the above embodiment. All implementations of the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0211] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0212] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0213] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0214] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0215] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0216] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, ROM, RAM, a magnetic disk, or an optical disk.
[0217] In addition, it should be noted that, in the apparatus and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. Moreover, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order, and some steps can be performed in parallel or independently of each other. For those of ordinary skill in the art, it will be understood that all or any steps or components of the method and apparatus of the present invention can be implemented in any computing device (including processors, storage media, etc.) or a network of computing devices in hardware, firmware, software or a combination thereof, which can be achieved by those of ordinary skill in the art using their basic programming skills after reading the description of the present invention.
[0218] Therefore, the purpose of the present invention can also be achieved by running a program or a group of programs on any computing device. The computing device can be a well-known general-purpose device. Therefore, the purpose of the present invention can also be achieved simply by providing a program product containing program code that implements the method or device. That is to say, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any well-known storage medium or any storage medium developed in the future. It should also be pointed out that in the device and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. In addition, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but do not necessarily need to be performed in chronological order. Certain steps can be performed in parallel or independently of each other.
[0219] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for predicting ship traffic flow, characterized in that: include: Obtain real-time traffic flow data and real-time weather factor data for ship channels; determining target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data; Inputting the target traffic flow characteristic data into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences; Inputting the plurality of characteristic data sequences into the intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate layer processing result; Inputting the intermediate layer processing result into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain a ship traffic flow prediction result; wherein the decomposition layer of the target traffic flow prediction model is trained according to the first preset network model, the intermediate layer is trained according to the second preset network model and the third preset network model, and the prediction layer is trained according to the fourth preset network model; The target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences, including: The target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model, according to Decomposition processing is performed to obtain a regularity component characteristic data sequence and a residual component characteristic data sequence; in, ; Represents target traffic flow characteristic data; represents the regularity component; represents the residual component; g(t) represents the trend term; s(t) represents the seasonal term; h(t) represents the weather impact term; Indicates a singular term that cannot be fitted; The step of inputting the plurality of characteristic data sequences into the intermediate layer of the target traffic flow prediction model for processing to obtain the intermediate layer processing results includes: Inputting the regularity component feature data sequence into the time series prediction unit of the first processing module of the intermediate layer of the target traffic flow prediction model for processing, and obtaining the processing result as the first intermediate layer processing result; Inputting the regularity component feature data sequence and the residual component feature data sequence into the encoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate vector; Inputting the intermediate vector into the decoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result; The intermediate layer processing result is input into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain the ship traffic flow prediction result, including: The first intermediate layer processing result and the second intermediate layer processing result are input into the shallow fully connected neural network unit of the prediction layer of the target traffic flow prediction model for feature fitting processing to obtain the ship traffic flow prediction result.
2. The method for predicting ship traffic flow according to claim 1, characterized in that: Determine target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data, including: By formula: Obtaining a correlation coefficient between the weather factor data and the real-time traffic flow data; Determining the real-time traffic flow data whose correlation coefficient is greater than a preset value as target traffic flow characteristic data; in, is the correlation coefficient, and the sequence of the weather factor data is: ; is the mean of the elements in the sequence X, is an element in the sequence X; the sequence of the real-time traffic flow data is: ; is the mean of the elements in sequence Y, is the element in sequence Y, and N is the number of elements in sequence X or sequence Y.
3. A device for predicting ship traffic flow, characterized in that: include: An acquisition module is used to obtain real-time traffic flow data and real-time weather factor data of ship channels; a processing module for determining target traffic flow characteristic data based on the correlation between the weather factor data and the real-time traffic flow data; inputting the target traffic flow characteristic data into a decomposition layer of a target traffic flow prediction model for decomposition processing to obtain a plurality of characteristic data sequences; inputting the plurality of characteristic data sequences into an intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate layer processing result; inputting the intermediate layer processing result into a prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain a ship traffic flow prediction result; wherein the decomposition layer of the target traffic flow prediction model is trained according to a first preset network model, the intermediate layer is trained according to a second preset network model and a third preset network model, and the prediction layer is trained according to a fourth preset network model; The target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model for decomposition processing to obtain multiple characteristic data sequences, including: The target traffic flow characteristic data is input into the decomposition layer of the target traffic flow prediction model, according to Decomposition processing is performed to obtain a regularity component characteristic data sequence and a residual component characteristic data sequence; in, ; Represents target traffic flow characteristic data; represents the regularity component; represents the residual component; g(t) represents the trend term; s(t) represents the seasonal term; h(t) represents the weather impact term; Indicates a singular term that cannot be fitted; The step of inputting the plurality of characteristic data sequences into the intermediate layer of the target traffic flow prediction model for processing to obtain the intermediate layer processing results includes: Inputting the regularity component feature data sequence into the time series prediction unit of the first processing module of the intermediate layer of the target traffic flow prediction model for processing, and obtaining the processing result as the first intermediate layer processing result; Inputting the regularity component feature data sequence and the residual component feature data sequence into the encoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain an intermediate vector; Inputting the intermediate vector into the decoder unit of the second processing module of the intermediate layer of the target traffic flow prediction model for processing to obtain a second intermediate layer processing result; The intermediate layer processing result is input into the prediction layer of the target traffic flow prediction model for traffic flow prediction processing to obtain the ship traffic flow prediction result, including: The first intermediate layer processing result and the second intermediate layer processing result are input into the shallow fully connected neural network unit of the prediction layer of the target traffic flow prediction model for feature fitting processing to obtain the ship traffic flow prediction result.
4. A computing device, characterized in that include: A processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 2 is performed.
5. A computer-readable storage medium, characterized in that: The device stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Traffic flow prediction method based on multi-feature fusion
CN117727175A
Festival and holiday long-term traffic situation prediction method and device based on time sequence model
CN118155423A