Ship AIS data-based port congestion prediction deep learning method
By applying deep learning methods based on ship AIS data in global maritime ports, combined with Transformer and LSTM neural networks, the ST-LSTTM model was constructed, which solved the shortcomings of port congestion state prediction in the existing technology and achieved higher prediction accuracy and robustness.
Patent Information
- Application Number
- CN202510136340.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-07
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2045-02-07
AI Technical Summary
The prior art lacks effective methods for quantifying and predicting congestion states in important global shipping ports and fails to fully consider time and space correlations.
A deep learning method based on ship AIS data and combined with Transformer and LSTM neural networks, a ST-LSTTM model was constructed to capture the spatiotemporal and spatial variation characteristics of port congestion state. The model is integrated into the global maritime liner transportation network and can predict port congestion from both spatial and temporal perspectives.
It significantly improves the prediction accuracy of port congestion state, can effectively capture complex space-time correlations, and is highly robust, helping port operators to monitor and optimize operations in real time.
Smart Images

Figure CN119962754A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of marine transportation port congestion prediction, and relates to a port congestion prediction deep learning method based on ship AIS data. Background Art
[0002] In global trade, shipping undertakes about 90% of trade goods transportation. Among them, container liner shipping, as the main form of maritime transportation, undertakes more than 70% of the total value of global maritime trade, which is particularly important for the development of global economic trade. In recent years, the frequency of container port congestion has increased. Therefore, monitoring and predicting port congestion is an important research topic in the global port and shipping industry, and has important practical significance for the stability of the world's shipping supply chain.
[0003] At present, there is a lack of research on the quantification and prediction of the congestion status of important global shipping ports. The methods used are relatively simple, mainly based on the LSTM model to predict the congestion status of ports, such as the research of Peng et al. (Wenhao Peng, Xiwen Bai, Dong Yang, Kum Fai Yuen & Junfeng Wu (2022): Adeep learning approach for port congestion estimation and prediction, Maritime Policy & Management, DOI: 10.1080 / 03088839.2022.2057608). Secondly, there are relatively many studies on the problem of port ship traffic prediction, and the methods used are relatively diverse. For example, Liang et al. (M. Liang, RW Liu, Y. Zhan, H. Li, F. Zhu and F.-Y. Wang, "Fine-Grained Vessel Traffic Flow Prediction With a Spatio-Temporal Multigraph Convolutional Network," in IEEE Transactions on Intelligent Transportation Systems, vol. 23, no. 12, pp. 23694-23707, Dec. 2022, doi: 10.1109 / TITS.2022.3199160.) proposed a ship traffic prediction method based on GCN. However, the above existing studies mainly focus on predicting the ship traffic in a certain sea area or a certain port. There is still a lack of research on quantifying the congestion status of important global ports and predicting it, and there are few methods.
[0004] In other transportation fields, such as urban subway networks and highway networks, they have conducted a lot of research on road node congestion prediction, and the updated methods have achieved significant results so far. At the same time, most of the research on related prediction problems that have achieved significant results have considered both the temporal correlation and spatial correlation between node states. However, in the case of port congestion prediction, there are few studies that consider temporal and spatial correlations and apply them to method models. Summary of the invention
[0005] To solve the above problems, the present invention provides a deep learning method for predicting shipping port congestion based on ship AIS data. The present invention innovatively constructs a supervised port congestion prediction method (ST-LSTTM) for large-scale shipping transportation networks based on real-time AIS data of ships in global shipping. The core of this method is to combine the two neural networks, Transformer and LSTM, and integrate them into the global shipping liner transportation network. The constructed model can capture the spatiotemporal variation characteristics of the port congestion state from a spatial and temporal perspective. This method can combine the spatial and temporal dependencies to effectively improve the prediction accuracy of the port congestion state.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] The deep learning method for port congestion prediction based on ship AIS data includes the following steps:
[0008] Step 1: Obtain real-time information on the ship’s port of call.
[0009] The real-time information of the ship's port of call includes the ship name, the name of the port of call, the arrival time, the berthing time, the departure time, the draft depth when arriving and leaving the port, etc.
[0010] Step 2: Characterization of port congestion status.
[0011] First, quantify the port congestion status. The average time that ships wait for berthing at the anchorage is used to characterize the port congestion status, and the port congestion status is counted every hour to obtain the congestion status time series data of each port node. in, represents a set of real numbers, T represents the length of the time series (the number of time steps), N represents the number of ports, and F represents the characteristic dimension of each port at each time step, that is, the congestion status of the port.
[0012] Then the congestion status time series data X is normalized, and the formula is:
[0013]
[0014] in, represents the normalized congestion status data. Where t represents the time step, n represents the port number, and f represents the feature dimension; X t,n,f represents the value of the original congestion status data at time step t, port n, and feature dimension f; μ f and σ f They represent the mean and standard deviation of the feature dimension f respectively.
[0015] Finally, a linear layer is used to embed X into a high-dimensional That is, map the feature dimension F of X to the model hidden dimension d, the formula is as follows:
[0016]
[0017] Among them, X emb represents the congestion state embedding representation obtained after high-dimensional embedding through the linear layer, whose dimension is T×N×d, where d is the model hidden layer dimension; W f represents a weight matrix, belonging to the set of real numbers Used to map the original data to the hidden layer dimension, b f represents a bias vector, belonging to the set of real numbers Acts as an offset in linear transformations.
[0018] Step 3: Construct two maritime transportation networks and time context.
[0019] First, two maritime transportation network diagrams are constructed, namely the distance diagram and the interaction diagram; then the time background information is constructed. The specific steps are as follows:
[0020] (3.1) Distance map is an undirected graph used to describe the distance between port nodes. ε represents the set of port nodes and edges in the distance graph, is the number of port nodes, Represents the adjacency matrix of the distance graph. A D Specifically, the reciprocal of the distance between port nodes is used to represent the weight between two port nodes. Therefore, the closer the port nodes are, the higher the value. ij Represents the Euclidean distance between port nodes i and j, the adjacency matrix A of the distance graph D It is expressed as follows:
[0021]
[0022] in, is the distance graph G D The elements in the adjacency matrix of represent the weight between port nodes i and j, that is, the inverse of the distance. DThrough the node2vec method, each port node in the space is mapped to a high-dimensional space vector representation SE D .
[0023] (3.2) Interaction diagram is a directed graph that represents the frequency of interaction between two port nodes in the historical voyage records of ships. ε represents the set of port nodes and edges in the interaction graph, is the number of port nodes, Represents the adjacency matrix of the interaction graph. A I Specifically, along the direction of the ship's navigation, when a ship leaves port node i and its next arrival port node is j, the number of ships that meet this condition is the interaction weight between port nodes i and j. Therefore, the larger the weight, the more frequent the interaction between port nodes i and j, and the more likely port node i is to affect the congestion status of j. Assume I ij Represents the interaction frequency between port nodes i and j, and the adjacency matrix A of the interaction graph I It is expressed as follows:
[0024]
[0025] Among them, I ij is an element in the adjacency matrix of the interaction graph, representing the weight between port nodes i and j, that is, the frequency of interacting ships. I Through the node2vec method, each port node in the space is mapped to a high-dimensional space vector representation SE I .
[0026] (3.3) Finally, the two space vectors of the port nodes obtained in steps (3.1) and (3.2) are represented by SE D with SE I Perform vector concatenation to obtain the final spatial vector representation SE of the port node.
[0027] (3.4) uses two important time signals: the week number in a month and the day number in a week. These two signals provide long-term and short-term background information for the port congestion prediction task. Specifically, a month is divided into T W Week, a week is divided into 7 days; then they are encoded into dimensions and The one-hot vector is then concatenated to construct an embedding representation of temporal context information.
[0028] Step 4: ST-LSTTM (Spatial-Temporal Long Short Time Transformer Model) deep learning network model setting.
[0029] The ST-LSTTM deep learning network model is used to predict the port congestion status in the maritime transportation system. Its overall architecture consists of an encoder and a decoder, and an attention module is set between the encoder and the decoder to alleviate the problem of error propagation in sequence prediction tasks. Among them, the core components of the encoder are the spatial Transformer and LSTM neural network models that capture spatial and temporal features respectively.
[0030] (4.1) Encoder settings
[0031] The input of the encoder is the congestion state embedding representation X obtained in step 2 emb , the spatial vector representation SE of the port node and the temporal background information embedding representation TE obtained in step 3; after being input into the encoder, the encoder learns and captures the spatiotemporal correlation of the congestion status between the port nodes and outputs it. Specifically:
[0032] The encoder consists of multiple layers, each of which consists of a spatial Transformer, an LSTM neural network, and a fusion module; the spatial Transformer neural network is used to capture the spatial dependencies of the port congestion state (set as C S ); LSTM is used to capture the time variation pattern of port congestion status (set as C T ); In order to obtain the complex spatiotemporal correlation of the port congestion status prediction problem, the fusion module interweaves the spatial features and the temporal features. Specifically, the fusion gate g is first calculated using a linear model with a sigmoid activation function to capture the interdependence of port nodes at different time points. The formula is:
[0033] g=σ(C S W S +C T W T +b g )
[0034] Where σ(·) is the sigmoid activation function, W S and W T are all learnable weight matrices, used for linear transformation of spatial and temporal features, respectively, and b g is a bias vector, and then the spatial features and temporal features are combined as follows:
[0035] C=g⊙C S +(1-g)⊙C T
[0036] Where C represents the spatiotemporal correlation of the congestion status of the port node that integrates temporal and spatial characteristics; ⊙ represents element-wise multiplication.
[0037] (4.2) Attention module settings
[0038] A present-to-future attention module is set between the encoder and the prediction decoder, and a present-to-past attention module is set between the encoder and the recall decoder. The attention module learns and models the relationship between the port node congestion status in each future or past time step and all current input time steps.
[0039] The formula for the future attention module is now as follows:
[0040]
[0041] STE F =SE[i,:]+TE[F s ,:]
[0042] STE P =SE[i,:]+TE[P s ,:]
[0043] in, According to STE F and STE P Calculated attention weights; STE F and STE P They represent the spatiotemporal embedding representation of the future port nodes to be predicted and the input port nodes for prediction, respectively. Specifically, the spatial embedding representation SE[i,:] of each port node i is related to the future F s The time embedding representation of the time step TE[F s ,:] or the input P s The embedding representation of the time step TE[P s ,:] added together.
[0044] Then, the spatiotemporal correlation C of the congestion state of the port node output by the encoder is recalculated according to the attention weight as the input of the subsequent prediction decoder. The formula is as follows:
[0045]
[0046] Among them, C pre [F s ,i,:] is the future F s Step 1, the temporal and spatial correlation embedding representation of the congestion state of port node i; C[P s ,i,:] is the Pth output of the encoders Step 1, the spatiotemporal correlation of the congestion status of port node i.
[0047] The setting of the attention module for the past is the same as that for the future. The difference is that the time step F in the attention module for the future is represented by s And the spatiotemporal embedding representation STE of the port nodes to be predicted in the future F , replaced by H, which represents the past time step s and the spatiotemporal embedding representation STE of the port nodes to be recalled in the past H .
[0048] (4.3) Decoder settings
[0049] The decoder part contains two decoders. One is the prediction decoder, which is used to predict the future port congestion status. Its input is the embedded representation of the future port node congestion status output from the current attention module to the future in step (4.2), and the output is the predicted result of the congestion status of all port nodes; the other is the recall decoder, which serves as a regularization term to prevent the prediction decoder from overfitting. Its input is the embedded representation of the past port node congestion status output from the current attention module to the past in step (4.2), and the output is the recall result of the congestion status of all port nodes in the past. The structures of the two decoders are the same as those of the encoder. After the prediction decoder and the recall decoder, fully connected layers are added respectively to further process and obtain the corresponding predicted and recalled congestion status results. and
[0050] Step 5: Model loss function setting.
[0051] The loss function during model training consists of the loss when predicting and recalling the port congestion state, and both are calculated using the mean absolute error (MAE). The specific calculation formula is as follows:
[0052] L=L Fut +αL His
[0053]
[0054] Among them, L represents the total loss of model training; L Fut , L His represents prediction loss and recall loss; α is a weight coefficient; Fut and His are the number of time steps for prediction and recall respectively; X F , X H represents the true value of prediction and recall; Represents the output of the fully connected layer after the prediction decoder and the recall decoder in step 4, as well as the prediction value and the recall value.
[0055] Beneficial effects of the present invention: The deep learning method for predicting port congestion status based on ship AIS data innovatively proposes a deep learning framework based on ship AIS real-time data. The core of this framework is to combine the Transformer and LSTM methods to capture the spatial correlation of congestion status between ports and the temporal correlation between the congestion status of ports respectively. Experimental results show that the method of the present invention is significantly superior to the existing method based on LSTM neural network, and can learn and efficiently capture the complex potential spatiotemporal correlation of port congestion status; and the model has strong robustness. This can effectively help port operators monitor the port congestion status in real time to improve port operation efficiency, indicating that the method of the present invention is effective and practical. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is the framework diagram of ST-LSTTM model;
[0057] Figures 2 to 5 It lists the comparison results of LSTM and ST-LSTTM predictions and actual values of two types of ports;
[0058] Figure 6 This is a comparison of the model prediction performance under Gaussian noise perturbation. DETAILED DESCRIPTION
[0059] The specific implementation of the present invention is further described below in conjunction with the accompanying drawings and technical solutions.
[0060] The deep learning method for port congestion prediction based on ship AIS data includes the following steps:
[0061] Step 1: Obtain real-time information on the ship’s port of call.
[0062] The real-time port information of the ship used in this embodiment includes the ship name, the port name, arrival time, berthing time, departure time, draft depth when arriving and leaving the port, etc., which is provided by the ship automatic identification system (AIS).
[0063] Step 2: Characterization of port congestion status.
[0064] First, quantify the port congestion status. The average time that ships wait for berthing at the anchorage is used to characterize the port congestion status, and the port congestion status is counted every hour to obtain the congestion status time series data of each port node. in, represents a real number set, T represents the length of the time series (the number of time steps, which is 24 in this embodiment), N represents the number of ports (which is 100 in this embodiment), and F represents the feature dimension of each port at each time step, which is 1 in this embodiment, indicating that only one feature is input, namely, the congestion status of the port. Then the congestion status time series data X is normalized, and the formula is:
[0065]
[0066] in, represents the normalized congestion status data; t represents the time step, n represents the port number, and f represents the feature dimension; X t,n,f represents the value of the original congestion status data at time step t, port n, and feature dimension f; μ f and σ f They represent the mean and standard deviation of the feature dimension f respectively.
[0067] Finally, the present invention uses a linear layer to embed X into a high-dimensional That is, map the feature dimension F of X to the model hidden dimension d, the formula is as follows:
[0068]
[0069] Among them, X emb represents the congestion state embedding representation obtained after high-dimensional embedding through the linear layer, whose dimension is T×N×d, where d is the model hidden layer dimension; W f represents a weight matrix, belonging to the set of real numbers Used to map the original data to the hidden layer dimension, b f represents a bias vector, belonging to the set of real numbers
[0070] Step 3: Construct two maritime transportation networks and time context.
[0071] First, two maritime transportation network diagrams are constructed, namely the distance diagram and the interaction diagram; then the time background information is constructed. The specific steps are as follows:
[0072] (3.1) Distance map is an undirected graph used to describe the distance between port nodes. ε represents the set of port nodes and edges in the distance graph, is the number of port nodes (as described in step 2, the value is 100), Represents the adjacency matrix of the distance graph. A D Specifically, the reciprocal of the distance between port nodes is used to represent the weight between two port nodes. Therefore, the closer the port nodes are, the higher their weight is. Let Dij Represents the Euclidean distance between port nodes i and j, the adjacency matrix A of the distance graph D It is expressed as follows:
[0073]
[0074] in, is the distance graph G D The elements in the adjacency matrix of represent the weight between port nodes i and j, that is, the inverse of the distance. D Through the node2vec method, each port node in the space is mapped to a high-dimensional space vector representation SE D In this embodiment, the mapping dimension is 64.
[0075] (3.2) Interaction diagram is a directed graph that represents the frequency of interaction between two port nodes in the historical voyage records of ships. ε represents the set of port nodes and edges in the interaction graph, is the number of port nodes, Represents the adjacency matrix of the interaction graph. A I Specifically, along the direction of the ship's navigation, when a ship leaves port node i and its next arrival port node is j, the number of ships that meet this condition is the interaction weight between port nodes i and j. Therefore, the larger the weight, the more frequent the interaction between port nodes i and j, and the more likely port node i is to affect the congestion status of j. Assume I ij Represents the interaction frequency between port nodes i and j, and the adjacency matrix A of the interaction graph I It is expressed as follows:
[0076]
[0077] Among them, I ij is an element in the adjacency matrix of the interaction graph, representing the weight between port nodes i and j, that is, the frequency of interacting ships. I The node2vec method is used to map each node in the space to a high-dimensional space vector representation SE I , the dimension of the mapping is 64.
[0078] (3.3) Finally, the two space vectors of the port nodes obtained in steps 3.1 and 3.2 are represented by SE D with SE I Perform vector concatenation to obtain the final spatial vector representation SE of the port node.
[0079] (3.4) uses two important time signals: the week number in a month and the day number in a week. These two signals provide long-term and short-term background information for the port congestion prediction task. Specifically, a month is divided into T W Week (In this embodiment, T W = 4 or 5 weeks), a week is divided into 7 days; then encoded into dimensions and The one-hot vector is then concatenated to construct an embedding representation of temporal context information.
[0080] Step 4: ST-LSTTM (Spatial-Temporal Long Short Time Transformer Model) deep learning network model setting.
[0081] The ST-LSTTM deep learning network model is used to predict port congestion in the maritime transportation system. Figure 1 As shown in Figure 1, its overall architecture consists of an encoder and a decoder, and an attention module is set between the encoder and the decoder to alleviate the problem of error propagation in sequence prediction tasks. The core components of the encoder are the spatial Transformer and LSTM neural network models that capture spatial and temporal features respectively.
[0082] (4.1) Encoder settings
[0083] The input of the encoder is the congestion state embedding representation X obtained in step 2 emb , the spatial vector representation SE of the port node and the temporal background information embedding representation TE obtained in step 3; after being input into the encoder, the encoder learns and captures the spatiotemporal correlation of the congestion status between the port nodes and outputs it. Specifically:
[0084] In this embodiment, the encoder includes two layers, each of which is composed of a spatial Transformer, an LSTM neural network and a fusion module; the spatial Transformer neural network is used to capture the spatial dependency of the port congestion state (set as C S ); LSTM is used to capture the time variation pattern of port congestion status (set as C T ); In order to obtain the complex spatiotemporal correlation of the port congestion status prediction problem, the fusion module interweaves the spatial features and the temporal features. Specifically, the fusion gate g is first calculated using a linear model with a sigmoid activation function to capture the interdependence of port nodes at different time points. The formula is:
[0085] g=σ(C S W S +CT W T +b g )
[0086] Where σ(·) is the sigmoid activation function; W S and W T Both are learnable weight matrices, used for linear transformation of spatial and temporal features respectively; b g is a bias vector, and then the spatial features and temporal features are combined as follows:
[0087] C=g⊙C S +(1-g)⊙C T
[0088] Where C represents the spatiotemporal correlation of the congestion status of the port node that integrates temporal and spatial characteristics; ⊙ represents element-wise multiplication.
[0089] (4.2) Attention module settings
[0090] We set up a present-to-future attention module between the encoder and the prediction decoder, and a present-to-past attention module between the encoder and the recall decoder. The attention module learns and models the relationship between each future or past time step and the congestion state of the port node in all current input time steps. The following is the formula of the present-to-future attention module:
[0091]
[0092] STE F =SE[i,:]+TE[F s ,:]
[0093] STE P =SE[i,:]+TE[P s ,:]
[0094] in, According to STE F and STE P Calculated attention weights; STE F and STE P They represent the spatiotemporal embedding representation of the future port nodes to be predicted and the input port nodes for prediction, respectively. Specifically, the spatial embedding representation SE[i,:] of each port node i is related to the future F s The time embedding representation of the time step TE[F s ,:] or the input P s The embedding representation of the time step TE[P s ,:] added together.
[0095] Then, the spatiotemporal correlation C of the congestion state of the port node output by the encoder is recalculated according to the attention weight as the input of the subsequent prediction decoder. The formula is as follows:
[0096]
[0097] Among them, C pre [F s ,i,:] is the future F s Step 1, the temporal and spatial correlation embedding representation of the congestion state of port node i; C[P s ,i,:] is the Pth output of the encoder s Step 1, the spatiotemporal correlation of the congestion status of port node i.
[0098] The setting of the attention module for the past is the same as that for the future. The difference is that the time step F in the attention module for the future is represented by s And the spatiotemporal embedding representation STE of the port nodes to be predicted in the future F , replaced by H, which represents the past time step s and the spatiotemporal embedding representation STE of the port nodes to be recalled in the past H .
[0099] (4.3) Decoder settings
[0100] The decoder part contains two decoders. One is the prediction decoder, which is used to predict the future port congestion status. Its input is the embedded representation of the future port node congestion status output from the current attention module to the future in step (4.2), and the output is the predicted result of the congestion status of all port nodes; the other is the recall decoder, which serves as a regularization term to prevent the prediction decoder from overfitting. The input of this decoder is the embedded representation of the past port node congestion status output from the current attention module to the past in step (4.2), and the output is the recall result of the congestion status of all port nodes in the past. The structures of the two decoders are the same as those of the encoder. After the prediction decoder and the recall decoder, fully connected layers are added respectively, in order to further process and obtain the corresponding predicted and recalled congestion status results. and
[0101] Among them, the composition of the spatial Transformer neural network is as follows:
[0102] (a) Position encoding: The port congestion status obtained in step 2 is embedded into the representation X emb The position information of each node in is converted into embedded information PE through sinusoidal position coding. Sinusoidal position coding is represented by sine and cosine functions, and the formula is:
[0103] PE(p,2k)=sin(p / 10000 2k / D )
[0104] PE(p,2k+1)=cos(p / 10000 2k / D )
[0105] Among them, p represents the position index of the node; k represents the dimension.
[0106] The input of the final spatial Transformer neural network is X emb +PE.
[0107] (b) Self-attention mechanism: It is the core component of the spatial Transformer and uses scaled dot product attention. Its formula is as follows:
[0108]
[0109] Among them, Q is the query; K is the key; V is the value; D is the number of columns in Q, K, and V.
[0110] (c) Based on the self-attention mechanism, multi-head attention is used. Multi-head attention includes h heads (in this embodiment, h=3), and the formula is as follows:
[0111] MultiHeadAtttention(Q,K,V)=Concat(Attention1,…,Attention h )W o
[0112]
[0113] Q l =QWl l Q ,K l =KW l K ,V l =VW l V
[0114] d ′ h =d h / h
[0115] Among them, Q l ,K l ,V l Respectively represent the linear transformation of the original Q, K, V to obtain the query, key and value of the lth head; W l Q , W l K , Wl V is the learnable linear transformation weight matrix of the lth attention head; W o is a learnable linear transformation weight matrix.
[0116] (d) Residual connection and normalization: Figure 1 As shown in the structure of spatial transformer, spatial transformer contains multi-head self-attention layer and feed-forward neural network. And they are followed by a residual connection and layer normalization operation to enhance the feature representation of nodes.
[0117] Among them, the specific composition of the LSTM neural network is as follows:
[0118] (a) The forget gate determines which information in the current cell state needs to be discarded. The formula is:
[0119] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0120] Among them, f t represents the output of the forget gate at time t; h t-1 represents the hidden state at time t-1; x t represents the input data at time t; σ is the sigmoid activation function; W f and b f denote the weight matrix and bias vector respectively.
[0121] (b) The input gate determines which information will be written into the cell state, which consists of two parts. One is the sigmoid activation function, which determines which values need to be updated; the other is the tanh activation function, which generates new candidate values to update the cell state. The formula is:
[0122] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0123]
[0124] Among them, i t is the output of the input gate at time t, that is, what information is written into the memory cell; is the candidate unit state at time t, indicating new information that may be added.
[0125] (c) The unit state is updated, combining the forget gate and the input gate to update Ct The formula is:
[0126]
[0127] Among them, f t is the output of the forget gate at time t; C t-1 is the cell state at time t-1; i t is the output of the input gate at time t; is the new candidate cell state at time t.
[0128] (d) Output gate, which determines the current hidden state h t , that is, the input at the next moment, the formula is:
[0129] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0130] h t =o t tanh(C t )
[0131] Among them, t is the output of the output gate at time t, i.e., the temporal feature captured by LSTM; h t is the hidden state at time t.
[0132] Step 5: Model loss function setting
[0133] The loss function during model training consists of the loss when predicting and recalling the port congestion state, and both are calculated using the mean absolute error (MAE). The specific calculation formula is as follows:
[0134] L=L Fut +αL His
[0135]
[0136] Among them, L represents the total loss of model training; L Fut , L HiS represents prediction loss and recall loss; α is a weight coefficient, which is 0.1 in this embodiment; Fut and His are the time steps of prediction and recall respectively; X F , X H represents the true value of prediction and recall; Represents the output of the fully connected layer after the prediction decoder and the recall decoder in step 4, as well as the prediction value and the recall value.
[0137] In order to prove the effectiveness of the present invention, the present invention designs a control experiment to prove the prediction performance of the proposed method. Since there are few methods for port congestion prediction at present and most of them focus on the LSTM model, the present invention only compares the prediction performance with the LSTM model, that is, the present invention (ST-LSTTM) and LSTM and LSTM-based Encoder-Decoder (LSTM-en-decoder) are used respectively; and the AIS data of global container ships from February 1 to March 31, 2022 are selected as the data set; the top 50 pairs of ports with the shortest distance between the global container ships docked during this period, and the top 50 pairs of ports with the largest number of interactive ships are selected as the objects of observation to predict their congestion status. The embodiment of the present invention sets the ratio of training set to test set to 8:2, and predicts the congestion status of 100 ports at different time steps (specifically 3, 6, 12, and 24 steps) in the future to observe the short-term and long-term prediction performance of the model. Finally, the root mean square error (RMSE) and mean absolute error (MAE) are used as evaluation indicators of model prediction performance. The results are shown in Table 2. The root mean square error of the method of the present invention in predicting 3, 6, 12, and 24 time steps is 12.74, 13.59, 14.93, and 17.02 (hours) for each ship on average, and the mean absolute error is 9.29, 9.93, 10.97, and 12.77 (hours) for each ship on average. The results show that although the two LSTM-based methods have small changes in short-term and long-term prediction errors, their performance is not as good as the model of the present invention, indicating the effectiveness of the method of the present invention in short-term and long-term predictions.
[0138] In addition, the prediction performance of the ST-LSTTM and LSTM methods for the top 10 ports in terms of global throughput in 2022 is compared. The results are shown in Table 3: Except for the MAE error value when predicting the congestion status of Port5 in the next 24 hours, which is slightly worse than that of the LSTM method, the prediction performance of the method of the present invention is better than that of the LSTM method. The results show that compared with the existing methods, the method of the present invention can more accurately predict the congestion status of important ports.
[0139] The comparison results of the actual congestion status and the predicted status of two types of ports by the LSTM model and the model of the present invention are also shown. One type is the port with large fluctuations in the congestion status; the other type is the port with relatively stable fluctuations in the congestion status. Figures 2 to 5 As shown, the horizontal axis represents the length of the time series; the vertical axis represents the port congestion status; the light-colored line represents the actual port congestion status; and the dark-colored line represents the congestion status predicted by the model of the present invention. Figure 2 and Figure 3 It shows the comparison between the predicted value and the true value of the LSTM model and ST-LSTTM in predicting a port with relatively stable fluctuations; Figure 4 and Figure 5 It shows the comparison between the predicted value and the true value of the LSTM model and ST-LSTTM in predicting a port with large fluctuations in congestion status. It can be seen from the figure that no matter whether the congestion status of the port fluctuates relatively slowly or greatly, the model of the present invention can better learn their changing trends and better predict their congestion status. Among them, when predicting ports with large fluctuations, the method of the present invention is significantly better than the LSTM method. The results show the superiority of the method of the present invention in predicting ports with large congestion fluctuations and relatively stable ports, and the performance in predicting ports with relatively volatile congestion status is more prominent. This result further illustrates that the method of the present invention can capture the changing trend of the port congestion status to a certain extent, and its prediction effect is better than the existing methods.
[0140] Figure 6 It is a schematic diagram of the model robustness analysis results. Specifically, the robustness of the model of the present invention is tested by adding noise data to the training data set. In the figure, the horizontal axis represents the standard deviation of the generated noise data; the left vertical axis represents two prediction error indicators (RMSE and MAE); the right vertical axis represents the signal-to-noise ratio of the noise data, and the lower the signal-to-noise ratio, the greater the impact of the noise. It can be observed from the figure that as the impact of the added noise increases, the prediction performance of the model changes only slightly, which shows that the method of the present invention has good robustness.
[0141] Table 2 Prediction performance results for all input ports
[0142]
[0143] Table 3 Prediction performance results of top 10 ports
[0144]
[0145]
Claims
1. A deep learning method for port congestion prediction based on ship AIS data, characterized in that: The steps include: Step 1: Obtain the real-time port information of the ship; Step 2: Characterization of port congestion status; First, quantify the port congestion status; characterize the port congestion status by the average length of time that ships wait for berthing at the anchorage, and count the port congestion status once an hour to obtain the congestion status time series data of each port node in, represents a set of real numbers, T represents the length of the time series, N represents the number of ports, and F represents the characteristic dimension of each port at each time step, that is, the congestion status of the port; Then the congestion status time series data X is normalized, and the formula is: in, represents the normalized congestion status data; t represents the time step, n represents the port number, and f represents the feature dimension; X t,n,f represents the value of the original congestion status data at time step t, port n, and feature dimension f; μ f and σ f Respectively represent the mean and standard deviation of the feature dimension f; Finally, a linear layer is used to embed X into a high-dimensional That is, map the feature dimension F of X to the model hidden dimension d, the formula is as follows: Among them, X emb represents the congestion state embedding representation obtained after high-dimensional embedding through the linear layer, whose dimension is T×N×d, where d is the model hidden layer dimension; W f represents a weight matrix, belonging to the set of real numbers b f represents a bias vector, belonging to the set of real numbers Step 3: Construct two maritime transportation networks and time context; First, two maritime transportation network graphs are constructed, namely the distance graph and the interaction graph; then the time background information is constructed; the specific steps are as follows: (3.1) Distance map is an undirected graph used to describe the distance between port nodes, where ε represents the set of port nodes and edges in the distance graph, is the number of port nodes, Represents the adjacency matrix of the distance graph, A D Specifically, the reciprocal of the distance between port nodes is used to represent the weight between two port nodes. The closer the port nodes are, the higher the value. Let D ij Represents the Euclidean distance between port nodes i and j, the adjacency matrix A of the distance graph D It is expressed as follows: in, is the distance graph G D The elements in the adjacency matrix of G represent the weight between port nodes i and j, that is, the inverse of the distance; then D Through the node2vec method, each port node in the space is mapped to a high-dimensional space vector representation SE D ; (3.2) Interaction diagram is a directed graph used to represent the frequency of interaction between two port nodes in the historical voyage records of ships, where ε represents the set of port nodes and edges in the interaction graph, is the number of port nodes, Represents the adjacency matrix of the interaction graph; A I Specifically, along the direction of the ship's navigation, when a ship leaves port node i and arrives at port node j next time, the number of ships that meet this condition is the interaction weight between port nodes i and j. The larger the weight, the more frequent the interaction between port nodes i and j, and the more likely port node i is to affect the congestion state of j. Let I ij Represents the interaction frequency between port nodes i and j, and the adjacency matrix A of the interaction graph I It is expressed as follows: Among them, I ij is an element in the adjacency matrix of the interaction graph, representing the weight between port nodes i and j, that is, the frequency of interacting ships; similarly, G I Through the node2vec method, each port node in the space is mapped to a high-dimensional space vector representation SE I ; (3.3) Finally, the two space vectors of the port nodes obtained in steps (3.1) and (3.2) are represented by SE D with SE I Perform vector concatenation to obtain the final spatial vector representation SE of the port node; (3.4) Two important time signals are used: the week number in a month and the day number in a week; these two signals provide long-term and short-term background information for the port congestion prediction task; specifically, a month is divided into T W Week, a week is divided into 7 days; then they are encoded into dimensions and The one-hot vector is then concatenated to construct an embedding representation of temporal context information. Step 4: ST-LSTTM deep learning network model setting; The ST-LSTTM deep learning network model is used to predict the port congestion status in the maritime transportation system. Its overall architecture consists of an encoder and a decoder, and an attention module is set between the encoder and the decoder; the details are as follows: (4.1) Encoder settings The input of the encoder is the congestion state embedding representation X obtained in step 2 emb , the spatial vector representation SE of the port node and the temporal background information embedding representation TE obtained in step 3; after inputting into the encoder, the encoder learns and captures the spatiotemporal correlation of the congestion status between the port nodes and outputs it; specifically: The encoder contains multiple layers, each of which consists of a spatial Transformer, an LSTM neural network, and a fusion module; the spatial Transformer neural network is used to capture the spatial dependencies of the port congestion state, set as C S LSTM is used to capture the time variation pattern of port congestion status, set as C T ; In order to obtain the complex spatiotemporal correlation of the port congestion status prediction problem, the fusion module interweaves and fuses the spatial features and temporal features; (4.2) Attention module settings A present-to-future attention module is set between the encoder and the prediction decoder, and a present-to-past attention module is set between the encoder and the recall decoder; the attention module learns and models the relationship between each future or past time step and the congestion status of the port nodes in all current input time steps; (4.3) Decoder settings The decoder part contains two decoders, one of which is the prediction decoder, which is used to predict the future port congestion status. Its input is the embedded representation of the future port node congestion status output from the current attention module to the future in step (4.2), and its output is the predicted result of the congestion status of all port nodes; the other is the recall decoder, which serves as a regularization term to prevent the prediction decoder from overfitting. Its input is the embedded representation of the past port node congestion status output from the current attention module to the past in step (4.2), and its output is the recall result of the congestion status of all port nodes in the past. The structures of the two decoders are the same as those of the encoder. After the prediction decoder and the recall decoder, fully connected layers are added respectively to obtain the corresponding prediction and recall congestion status results. and Step 5: Setting the model loss function; The loss function during model training consists of the losses when predicting and recalling the port congestion status, and both are calculated using the mean absolute error (MAE).
2. The deep learning method for port congestion prediction based on ship AIS data according to claim 1 is characterized in that: In step 1, the real-time information of the ship's port of call includes the ship name, the name of the port of call, the arrival time, the berthing time, the departure time, and the draft depth information when arriving and leaving the port.
3. The deep learning method for port congestion prediction based on ship AIS data according to claim 1 is characterized in that: In step (4.1), the fusion module interweaves and fuses the spatial features and the temporal features. Specifically, a linear model with a sigmoid activation function is first used to calculate the fusion gate g to capture the interdependence of port nodes at different time points. The formula is: g=σ(C S W S +C T W T +b g ) Where σ(·) is the sigmoid activation function; W S and W T Both are learnable weight matrices, used for linear transformation of spatial and temporal features respectively; b g is a bias vector; then, the spatial features and temporal features are combined as follows: C=g⊙C S +(1-g)⊙C T Where C represents the spatiotemporal correlation of the congestion status of the port node that integrates temporal and spatial characteristics; ⊙ represents element-wise multiplication.
4. The deep learning method for port congestion prediction based on ship AIS data according to claim 1 is characterized in that: In step (4.2), The formula for the future attention module is now as follows: STE F =SE[i,:]+TE[F s ,:] STE P =SE[i,:]+TE[P s ,:] in, According to STE F and STE P Calculated attention weights; STE F and STE P They represent the spatiotemporal embedding representation of the future port nodes to be predicted and the input port nodes for prediction, respectively. Specifically, the spatial embedding representation SE[i,:] of each port node i is related to the future F s The time embedding representation TE[F s ,:] or the input P s The embedding representation of the time step TE[P s ,:] added together; Then, the spatiotemporal correlation C of the congestion state of the port node output by the encoder is recalculated according to the attention weight as the input of the subsequent prediction decoder. The formula is as follows: Among them, C pre [F s ,i,:] is the future F s Step 1, the temporal and spatial correlation embedding representation of the congestion state of port node i; C[P s ,i,:] is the Pth output of the encoder s Step 1: the spatiotemporal correlation of the congestion status of port node i; The setting of the attention module for the past is the same as that for the future, except that the time step F in the attention module for the future is represented by s And the spatiotemporal embedding representation STE of the port nodes to be predicted in the future F , replaced by H, which represents the past time step s and the spatiotemporal embedding representation STE of the port nodes to be recalled in the past H .
5. The deep learning method for port congestion prediction based on ship AIS data according to claim 1 is characterized in that: In step 5, the specific calculation formula is as follows: L=L Fut +αL His Among them, L represents the total loss of model training; L Fut , L His represents prediction loss and recall loss; α is a weight coefficient; Fut and His are the number of time steps for prediction and recall respectively; X F , X H represents the true value of prediction and recall; Represents the output of the fully connected layer after the prediction decoder and the recall decoder in step 4, as well as the prediction value and the recall value.
Citation Information
Patent Citations
Port congestion degree quantification method based on ship AIS big data
CN115640873A
Ship traffic flow prediction method based on improved space-time diagram attention neural network
CN116612664A
Ship traffic flow long sequence space-time prediction method based on ST-Informer
CN116821784A
Pure electric ship power battery SOC estimation method based on Extrol-Transform deep learning neural network
CN118169572A
Cited By
Shipping logistics flow direction prediction method and system based on multi-source data fusion
CN120875177A
Shipping logistics flow direction prediction method and system based on multi-source data fusion
CN120875177B
Marine traffic flow probability prediction method based on multi-source AIS-meteorological data fusion
CN121435119A
Inter-port congestion propagation inference method based on Granger causal relationship and reserve pool calculation
CN121745796A