Deep learning method for port congestion prediction based on ship ais data
By constructing the ST-LSTTM deep learning method and combining Transformer and LSTM neural networks, the spatiotemporal variation characteristics of port congestion status are captured, solving the problem of insufficient accuracy in port congestion prediction in existing technologies, and realizing high-precision prediction and real-time monitoring of port congestion status.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-07
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies have limited methods for quantifying and predicting congestion at major global seaports, and they do not adequately consider temporal and spatial correlations, resulting in insufficient prediction accuracy.
We construct a deep learning method ST-LSTTM based on ship AIS data, combining Transformer and LSTM neural networks, integrating it into the global maritime liner shipping network, capturing the spatiotemporal variation characteristics of port congestion, constructing a maritime traffic network through distance graphs and interaction graphs, and making predictions based on temporal background information.
It significantly improves the prediction accuracy of port congestion status, the model has strong robustness, can monitor port congestion status in real time, and improve port operation efficiency.
Smart Images

Figure CN119962754B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of maritime traffic and port congestion prediction technology, and relates to a deep learning method for port congestion prediction based on ship AIS data. Background Technology
[0002] In global trade, maritime transport accounts for approximately 90% of the transport of trade goods. Among them, container liner shipping, as the main form of maritime transport, handles more than 70% of the total value of global maritime trade, making it particularly important for global economic and trade development. In recent years, the frequency of congestion at container ports has increased. Therefore, monitoring and predicting port congestion is an important research topic in the global port and shipping industry, and has significant practical implications for the stability of the global shipping supply chain.
[0003] Currently, research on the quantification and prediction of congestion at major global seaports is relatively limited, and the methods used are relatively simple, mainly relying on LSTM models to predict port congestion, such as the research by Peng et al. (Wenhao Peng, Xiwen Bai, Dong Yang, Kum Fai Yuen & Junfeng Wu (2022): A deep learning approach for port congestion estimation and prediction, Maritime Policy & Management, DOI:10.1080 / 03088839.2022.2057608). Secondly, there is relatively much research on port vessel traffic prediction, employing a variety of methods. For example, Liang et al. (M.Liang, RWLiu, 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 vessel traffic prediction method based on GCN. However, existing research mainly focuses on predicting vessel traffic in a specific sea area or port. Research on quantifying and predicting congestion at major global ports is still relatively scarce, and methods are limited.
[0004] In other transportation sectors, such as urban subway networks and highway networks, there is a wealth of research on road node congestion prediction, and the methods have been updated and iterated to a point where significant results have been achieved. Furthermore, most studies demonstrating significant effectiveness in related prediction problems consider both the temporal and spatial correlations between node states. However, in the area of port congestion prediction, there is very little research that considers temporal and spatial correlations and incorporates them into its methodological models. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a deep learning method for predicting port congestion based on ship AIS data. This invention innovatively constructs a supervised, large-scale maritime transport network port congestion prediction method (ST-LSTTM) based on real-time AIS data of ships in global maritime transport. The core of this method lies in combining two neural networks, Transformer and LSTM, and integrating them with the global maritime liner transport network. The constructed model can capture the spatiotemporal variation characteristics of port congestion status from both spatial and temporal perspectives. This method effectively improves the prediction accuracy of port congestion status by combining spatial and temporal dependencies.
[0006] To achieve the above objectives, the present invention provides the following technical solution:
[0007] A deep learning method for port congestion prediction based on ship AIS data includes the following steps:
[0008] Step 1: Obtain real-time port call information for ships.
[0009] The real-time port call information for vessels includes the vessel name, the name of the port called, arrival time, berthing time, departure time, and draft at arrival and departure.
[0010] Step 2: Port congestion status characterization.
[0011] First, port congestion status is quantified. The average waiting time for ships at anchor to berth is used to characterize port congestion, and the port congestion status is statistically analyzed hourly to obtain time-series data on congestion status at each port node. in, Let T represent the set of real numbers, T represent the length of the time series (number of time steps), N represent the number of ports, and F represent the feature dimension of each port at each time step, which is the congestion status of the port.
[0012] Then, the congestion time series data X is normalized using the following formula:
[0013]
[0014] in, This represents the congestion status data after normalization. Where t represents the time step, n represents the port number, and f represents the feature dimension; X t,n,f This represents the value of the original congestion status data at time step t, port n, and feature dimension f; μ f and σ f Let f represent the mean and standard deviation of the feature dimension f, respectively.
[0015] Finally, a linear layer is used to embed X in high dimension. The feature dimension F of X is mapped to the hidden layer dimension d of the model, as shown in the following formula:
[0016]
[0017] Among them, X emb This represents the congestion state embedding representation obtained after high-dimensional embedding through a linear layer, with dimensions T×N×d, where d is the hidden layer dimension of the model; W f This represents a weight matrix belonging to the set of real numbers. Used to map raw data to hidden dimension, b f Describe a bias vector that belongs to the set of real numbers. It acts as a shifter in linear transformations.
[0018] Step 3: Construct two maritime transport networks and time contexts.
[0019] First, two maritime traffic network maps are constructed: a distance map and an interaction map; then, temporal context information is created. The specific steps are as follows:
[0020] (3.1) Distance Map It is an undirected graph used to describe the distances between port nodes. ε represents the set of distances to port nodes and edges in the graph, respectively. 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. Let D... ij The adjacency matrix A of the distance graph represents the Euclidean distance between port nodes i and j. D It is expressed as follows:
[0021]
[0022] in, It is a distance graph G D The elements in the adjacency matrix represent the weights between port nodes i and j, which are the reciprocals of the distance. Then, G... DThe node2vec method is used to map each port node in space to a high-dimensional vector representation SE. D .
[0023] (3.2) Interaction Diagram It is a directed graph used to represent the frequency of interactions between two port nodes in a ship's historical voyage records. ε represents the set of port nodes and the set of edges in the interaction graph, respectively. The number of port nodes. Represents the adjacency matrix of the interaction graph. A I Specifically, along the direction of ship navigation, when a ship departs from port node i and its next destination is port node j, the number of ships satisfying this condition is the interaction weight between port nodes i and j. Therefore, a larger weight indicates more frequent interaction between port nodes i and j, and port node i is more likely to influence the congestion state of j. Let I... ij The adjacency matrix A of the interaction graph represents the frequency of interaction between port nodes i and j. I It is expressed as follows:
[0024]
[0025] Among them, I ij These are elements in the adjacency matrix of the interaction graph, representing the weight between port nodes i and j, i.e., the frequency of interacting ships. Similarly, G... I The node2vec method is used to map each port node in space to a high-dimensional vector representation SE. I .
[0026] (3.3) Finally, the two spatial vectors of the port nodes obtained in steps (3.1) and (3.2) are represented as SE. D with SE I Vector concatenation is performed to obtain the final spatial vector representation SE of the port node.
[0027] (3.4) Two important time signals are used: the number of weeks in a month and the number of days 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 A week is divided into 7 days; then they are encoded into dimensions. and The one-hot vectors are then concatenated to construct the embedded representation of temporal background information.
[0028] Step 4: Setting up the ST-LSTTM (Spatial-Temporal Long Short Time Transformer Model) deep learning network model.
[0029] The ST-LSTTM deep learning network model is used to predict port congestion in maritime traffic systems. Its overall architecture consists of an encoder and a decoder, with an attention module between them to mitigate error propagation in sequence prediction tasks. The core components of the encoder are a spatial Transformer and an LSTM neural network model that capture spatial and temporal features, respectively.
[0030] (4.1) Encoder settings
[0031] The encoder input is the congestion state embedding representation X obtained in step two. emb The spatial vector representation (SE) and temporal context information embedding representation (TE) of the port nodes obtained in step three are input into the encoder. The encoder learns and captures the spatiotemporal correlation of congestion states between port nodes and outputs the results. Specifically:
[0032] The encoder consists of multiple layers, each layer comprising a spatial Transformer, an LSTM neural network, and a fusion module; the spatial Transformer neural network is used to capture the spatial dependencies (denoted as C) of the port congestion state. S ); LSTM is used to capture the time-varying patterns of port congestion (set as C). T To capture the complex spatiotemporal correlations in port congestion prediction, the fusion module interweaves and fuses spatial and temporal features. Specifically, a linear model with a sigmoid activation function is first used to calculate the fusion gate g, which captures the interdependencies between port nodes at different time points. The formula is as follows:
[0033] g=σ(C S W S +C T W T +b g )
[0034] Where σ(·) is the sigmoid activation function, W S and W T Both are learnable weight matrices, used for linear transformations of spatial and temporal features, respectively. g It is a bias vector, and then the spatial and temporal features are combined in the following way:
[0035] C=g⊙C S +(1-g)⊙C T
[0036] Where C represents the spatiotemporal correlation of the congestion status of port nodes that integrates time 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 predictive decoder, and a present-to-past attention module is set between the encoder and the recall decoder. The attention modules learn and simulate the relationship between each future or past time step and the port node congestion state in all current input time steps.
[0039] The formula for the attention module for the future 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 Let S represent the future port node to be predicted and the spatiotemporal embedding representation of the input port node used for prediction, respectively. Specifically, it consists of the spatial embedding representation SE[i,:] of each port node i and the future F-th port node. s The temporal embedding representation of time steps TE[F s ,:] or the input of the Pth term s Embedded representation of time steps TE[P s The result is obtained by adding ,:].
[0044] Subsequently, the spatiotemporal correlation C of the congestion state of the port node output by the encoder is recalculated based on the attention weights and used as the input to the subsequent predictive decoder, as shown in the following formula:
[0045]
[0046] Among them, C pre [F s ,i,:] is the future Fth s Step, the spatiotemporal correlation of the congestion state of port node i is embedded in the representation; C[P s [i,:] is the Pth digit of the encoder output.s Step, the spatiotemporal correlation of the congestion status of port node i.
[0047] The settings for the attention module for the past are now the same as those for the attention module for the future. The difference lies in the setting of the time step F representing the future in the current attention module for the future. s And the spatiotemporal embedding representation STE representing the port nodes to be predicted in the future. F Replace with H representing past time steps. s The spatiotemporal embedding representation STE of port nodes to be recalled in the past. H .
[0048] (4.3) Decoder Settings
[0049] The decoder section comprises two decoders. One is a predictive decoder, used to predict future port congestion states. Its input is the embedded representation of the future port node congestion states output from the attention module in step (4.2), and its output is the predicted congestion states of all port nodes. The other is a recall decoder, used as a regularization term to prevent overfitting by the predictive decoder. Its input is the embedded representation of the past port node congestion states output from the past attention module in step (4.2), and its output is the recall of all past port node congestion states. The structures of both decoders are identical to those of the encoder. Fully connected layers are added after the predictive and recall decoders to further process and obtain the corresponding predicted and recalled congestion state results. and
[0050] Step 5: Setting the model loss function.
[0051] The loss function during model training consists of the losses from predicting and recalling port congestion, 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] Where L represents the total loss during model training; L Fut L His Represents prediction loss and recall loss; α is a weighting coefficient; Fut and His are the time steps for prediction and recall, respectively; X F X H Indicates the actual values of prediction and recall; This represents the output of the fully connected layer following the predictive decoder and recall decoder in step four, along with the predicted and recalled values.
[0055] The beneficial effects of this invention are as follows: This deep learning method for predicting port congestion based on ship AIS data innovatively proposes a deep learning framework based on real-time ship AIS data. The core of this framework lies in combining Transformer and LSTM methods to capture the spatial correlation of congestion states between ports and the temporal correlation of congestion states, respectively. Experimental results show that the method of this invention significantly outperforms existing LSTM neural network-based methods, capable of learning and efficiently capturing the complex potential spatiotemporal correlations of port congestion states; and the model exhibits strong robustness. This effectively helps port operators monitor port congestion states in real time to improve port operational efficiency, demonstrating the good performance and strong practicality of the method of this invention. Attached Figure Description
[0056] Figure 1 This is a diagram of the ST-LSTTM model framework;
[0057] Figures 2 to 5 This is a chart showing the comparison between the predictions and actual values of two types of ports using LSTM and ST-LSTTM methods respectively.
[0058] Figure 6 This is a comparison of the model prediction performance under Gaussian noise perturbation. Detailed Implementation
[0059] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings and technical solutions.
[0060] A deep learning method for port congestion prediction based on ship AIS data includes the following steps:
[0061] Step 1: Obtain real-time port call information for ships.
[0062] The real-time port information used in this embodiment includes the vessel name, port name, arrival time, berthing time, departure time, and draft at arrival and departure, which is provided by the Automatic Identification System (AIS).
[0063] Step 2: Port congestion status characterization.
[0064] First, port congestion status is quantified. The average waiting time for ships at anchor to berth is used to characterize port congestion, and the port congestion status is statistically analyzed hourly to obtain time-series data on congestion status at each port node. in, Let X represent the set of real numbers, T represent the length of the time series (number of time steps, 24 steps in this embodiment), N represent the number of ports (100 in this embodiment), and F represent 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 port's congestion status. Then, the congestion status time series data X is normalized using the following formula:
[0065]
[0066] in, This represents the congestion status data after normalization; where t represents the time step, n represents the port number, and f represents the feature dimension; X t,n,f This represents the value of the original congestion status data at time step t, port n, and feature dimension f; μ f and σ f Let f represent the mean and standard deviation of the feature dimension f, respectively.
[0067] Finally, this invention uses a linear layer to embed X in a high dimension. The feature dimension F of X is mapped to the hidden layer dimension d of the model, as shown in the following formula:
[0068]
[0069] Among them, X emb This represents the congestion state embedding representation obtained after high-dimensional embedding through a linear layer, with dimensions T×N×d, where d is the hidden layer dimension of the model; W f This represents a weight matrix belonging to the set of real numbers. Used to map raw data to hidden dimension, b f Describe a bias vector that belongs to the set of real numbers.
[0070] Step 3: Constructing two maritime transport networks and their temporal context.
[0071] First, two maritime traffic network maps are constructed: a distance map and an interaction map; then, temporal context information is created. The specific steps are as follows:
[0072] (3.1) Distance Map It is an undirected graph used to describe the distances between port nodes. ε represents the set of distances to port nodes and edges in the graph, respectively. This represents the number of port nodes (i.e., as described in step two, with a value of 100). Represents the adjacency matrix of the distance graph. A D Specifically, the weight between two port nodes is represented by the reciprocal of the distance between them. Therefore, the closer the port nodes are, the higher their weight. Let D...ij The adjacency matrix A of the distance graph represents the Euclidean distance between port nodes i and j. D It is expressed as follows:
[0073]
[0074] in, It is a distance graph G D The elements in the adjacency matrix represent the weights between port nodes i and j, which are the reciprocals of the distance. Then, G... D The node2vec method is used to map each port node in space to a high-dimensional vector representation SE. D In this embodiment, the mapping dimension is 64.
[0075] (3.2) Interaction Diagram It is a directed graph used to represent the frequency of interactions between two port nodes in a ship's historical voyage records. ε represents the set of port nodes and the set of edges in the interaction graph, respectively. The number of port nodes. Represents the adjacency matrix of the interaction graph. A I Specifically, along the direction of ship navigation, when a ship departs from port node i and its next destination is port node j, the number of ships satisfying this condition is the interaction weight between port nodes i and j. Therefore, a larger weight indicates more frequent interaction between port nodes i and j, and port node i is more likely to influence the congestion state of j. Let I... ij The adjacency matrix A of the interaction graph represents the frequency of interaction between port nodes i and j. I It is expressed as follows:
[0076]
[0077] Among them, I ij These are elements in the adjacency matrix of the interaction graph, representing the weight between port nodes i and j, i.e., the frequency of interacting ships. Similarly, G... I The node2vec method maps each node in the space to a high-dimensional vector representation SE. I The mapping dimension is 64.
[0078] (3.3) Finally, the two spatial vectors of the port nodes obtained in steps 3.1 and 3.2 are represented as SE. D with SE I Vector concatenation is performed to obtain the final spatial vector representation SE of the port node.
[0079] (3.4) Two important time signals are used: the number of weeks in a month and the number of days 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 Zhou (in this embodiment, T) W = 4 or 5 weeks), a week is divided into 7 days; then they are encoded into dimensions. and The one-hot vectors are then concatenated to construct the embedded representation of temporal background information.
[0080] Step 4: Setting up the ST-LSTTM (Spatial-Temporal Long Short Time Transformer Model) deep learning network model.
[0081] The ST-LSTTM deep learning network model is used to predict port congestion in maritime transport systems, such as... Figure 1 As shown, its overall architecture consists of an encoder and a decoder, with an attention module placed between the encoder and decoder to mitigate the error propagation problem in sequence prediction tasks. The core components of the encoder are a spatial Transformer and an LSTM neural network model that capture spatial and temporal features, respectively.
[0082] (4.1) Encoder settings
[0083] The encoder input is the congestion state embedding representation X obtained in step two. emb The spatial vector representation (SE) and temporal context information embedding representation (TE) of the port nodes obtained in step three are input into the encoder. The encoder learns and captures the spatiotemporal correlation of congestion states between port nodes and outputs the results. Specifically:
[0084] In this embodiment, the encoder comprises two layers, each consisting 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 (denoted as C). S ); LSTM is used to capture the time-varying patterns of port congestion (set as C). T To capture the complex spatiotemporal correlations in port congestion prediction, the fusion module interweaves and fuses spatial and temporal features. Specifically, a linear model with a sigmoid activation function is first used to calculate the fusion gate g, which captures the interdependencies between port nodes at different time points. The formula is as follows:
[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 transformations of spatial and temporal features, respectively; b g It is a bias vector, and then the spatial and temporal features are combined in the following way:
[0087] C=g⊙C S +(1-g)⊙C T
[0088] Where C represents the spatiotemporal correlation of the congestion status of port nodes that integrates time 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 predictive decoder, and a present-to-past attention module between the encoder and the recall decoder. The attention modules learn and model the relationship between each future or past time step and the port node congestion state at all current input time steps. The following is the formula for 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 Let S represent the future port node to be predicted and the spatiotemporal embedding representation of the input port node used for prediction, respectively. Specifically, it consists of the spatial embedding representation SE[i,:] of each port node i and the future F-th port node. s The temporal embedding representation of time steps TE[F s ,:] or the input of the Pth term s Embedded representation of time steps TE[P s The result is obtained by adding ,:].
[0095] Subsequently, the spatiotemporal correlation C of the congestion state of the port node output by the encoder is recalculated based on the attention weights and used as the input to the subsequent predictive decoder, as shown in the following formula:
[0096]
[0097] Among them, C pre [F s ,i,:] is the future Fth s Step, the spatiotemporal correlation of the congestion state of port node i is embedded in the representation; C[P s [i,:] is the Pth digit of the encoder output. s Step, the spatiotemporal correlation of the congestion status of port node i.
[0098] The settings for the attention module for the past are now the same as those for the attention module for the future. The difference lies in the setting of the time step F representing the future in the current attention module for the future. s And the spatiotemporal embedding representation STE representing the port nodes to be predicted in the future. F Replace with H representing past time steps. s The spatiotemporal embedding representation STE of port nodes to be recalled in the past. H .
[0099] (4.3) Decoder Settings
[0100] The decoder section comprises two decoders. One is a predictive decoder, used to predict future port congestion states. Its input is the embedding representation of the future port node congestion states output from the attention module in step (4.2), and its output is the predicted congestion states of all port nodes. The other is a recall decoder, used as a regularization term to prevent overfitting by the predictive decoder. Its input is the embedding representation of the past port node congestion states output from the past attention module in step (4.2), and its output is the recall of all past port node congestion states. Both decoders have the same structure as the encoder. Fully connected layers are added after the predictive and recall decoders to further process and obtain the corresponding predicted and recalled congestion state results. and
[0101] The spatial Transformer neural network consists of the following components:
[0102] (a) Location encoding: Embed the port congestion status obtained in step two into the representation X emb The position information of each node is converted into embedded information (PE) through sinusoidal position coding. Sinusoidal position coding is represented by sine and cosine functions, as shown in the formula:
[0103] PE(p,2k)=sin(p / 10000 2k / D )
[0104] PE(p,2k+1)=cos(p / 10000 2k / D )
[0105] Where p represents the node's position index; k represents the dimension.
[0106] The input to the final spatial Transformer neural network is X emb +PE.
[0107] (b) Self-attention mechanism: This is the core component of the spatial Transformer, employing scaled dot product attention, and its formula is as follows:
[0108]
[0109] Where Q represents the query; K represents the key; V represents the value; and D represents the column number of Q, K, and V.
[0110] (c) Based on the self-attention mechanism, multi-head attention is used. Multi-head attention involves 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 These represent the query, key, and value of the l-th head obtained by performing linear transformations on the original Q, K, and V respectively; W l Q W l K Wl V W is the learnable linear transformation weight matrix of the l-th attention head; o It is a learnable linear transformation weight matrix.
[0116] (d) Residual connection and normalization: such as Figure 1 As shown in the structure of the Spatial Transformer, it consists of a multi-head self-attention layer and a feedforward neural network. Each of these is followed by a residual connection and a layer normalization operation to enhance the feature representation of the nodes.
[0117] The specific components of the LSTM neural network are as follows:
[0118] (a) The forget gate determines which information in the current cell state needs to be discarded, using the following formula:
[0119] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0120] Among them, f t h represents the output of the forget gate at time t; 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 These represent the weight matrix and the bias vector, respectively.
[0121] (b) The input gate determines which information will be written into the cell state, and it consists of two parts: a sigmoid activation function, which determines which values need to be updated; and a tanh activation function, which generates new candidate values to update the cell state. The formula is as follows:
[0122] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0123]
[0124] Among them, i t It is the output of the input gate at time t, that is, which information is written into the memory unit; It represents the candidate cell state at time t, indicating new information that may be added.
[0125] (c) Cell state update, combining the effects of the forget gate and the input gate to update C.t The formula is:
[0126]
[0127] Among them, f t It is the output of the forget gate at time t; C t-1 It is the cell state at time t-1; i t It is the output of the input gate at time t; It is the new candidate unit state at time t.
[0128] (d) Output gate 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, o t It is the output of the output gate at time t, that is, the temporal feature captured by the LSTM; h t It is the hidden state at time t.
[0132] Step 5: Setting the Model Loss Function
[0133] The loss function during model training consists of the losses from predicting and recalling port congestion, 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] Where L represents the total loss during model training; L Fut L HiS Represents prediction loss and recall loss; α is a weighting coefficient, which is set to 0.1 in this embodiment; Fut and His are the time steps for prediction and recall, respectively; X F X H Indicates the actual values of prediction and recall; This represents the output of the fully connected layer following the predictive decoder and recall decoder in step four, along with the predicted and recalled values.
[0137] To demonstrate the effectiveness of this invention, a comparative experiment was designed to prove the predictive performance of the proposed method. Since there are currently few methods for port congestion prediction, and most focus on LSTM models, this invention only compares the predictive performance with LSTM models. Specifically, it uses the proposed method (ST-LSTTM), LSTM, and an LSTM-based Encoder-Decoder (LSTM-en-decoder). AIS data of global container ships from February 1st to March 31st, 2022, was selected as the dataset. The top 50 pairs of ports with the shortest distance between them and the top 50 pairs of ports with the most interacting ships during this period were selected as the observation objects, and their congestion status was predicted. In this embodiment, the ratio of training set to test set was set to 8:2, and the congestion status of 100 ports was predicted at different time steps (specifically 3, 6, 12, and 24 steps) to observe the short-term and long-term predictive performance of the model. Finally, the root mean square error (RMSE) and mean absolute error (MAE) were used as evaluation metrics for the model's predictive performance. The results are shown in Table 2. The root mean square error of the method of the present invention for predicting time steps of 3, 6, 12, and 24 is 12.74, 13.59, 14.93, and 17.02 hours per ship, respectively, and the mean absolute error is 9.29, 9.93, 10.97, and 12.77 hours per ship, respectively. The results show that although the two LSTM-based methods show small variations in short-term and long-term prediction errors, their performance is inferior to that of the model of the present invention, demonstrating the effectiveness of the method of the present invention in both short-term and long-term prediction.
[0138] Furthermore, the predictive performance of the ST-LSTTM and LSTM methods for the top 10 ports in terms of global throughput in 2022 was compared. The results are shown in Table 3: except for a slightly worse MAE error value when predicting the congestion status of Port 5 in the next 24 hours compared to the LSTM method, the predictive performance of the method of this invention is better than that of LSTM. The results show that, compared with existing methods, the method of this invention can more accurately predict the congestion status of important ports.
[0139] The paper also presents a comparison of the actual and predicted congestion states of two types of ports using the LSTM model and the model of this invention. One type represents ports with highly fluctuating congestion levels; the other represents ports with relatively stable congestion levels. The results are as follows... 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 this invention. Figure 2 and Figure 3 This shows the comparison between the predicted values and actual values of the LSTM model and ST-LSTTM model for a port with relatively stable fluctuations. Figure 4 and Figure 5 This figure compares the predicted values of the LSTM model and ST-LSTTM model with the actual values for a port with highly fluctuating congestion. As can be seen from the figure, regardless of whether the port's congestion fluctuations are relatively mild or significant, the model of this invention can learn the changing trends well and predict its congestion status effectively. Specifically, when predicting ports with highly fluctuating congestion, the method of this invention significantly outperforms the LSTM method. The results demonstrate the superiority of the method of this invention in predicting ports with both high and relatively stable congestion, and its performance is even more outstanding in predicting ports with relatively fluctuating congestion. This result further illustrates that the method of this invention can, to a certain extent, capture the changing trends of port congestion, and its predictive performance is superior to existing methods.
[0140] Figure 6 This is a schematic diagram illustrating the robustness analysis results of the model. Specifically, the robustness of the model in this invention was tested by adding noisy data to the training dataset. In the figure, the horizontal axis represents the standard deviation of the generated noisy data; the left vertical axis represents two prediction error metrics (RMSE and MAE); and the right vertical axis represents the signal-to-noise ratio (SNR) of the noisy data. The lower the SNR, the greater the impact of the noise. As can be observed from the figure, as the impact of the added noise increases, the model's prediction performance only changes slightly, indicating that the method of this invention has good robustness.
[0141] Table 2. Predicted performance results for all input ports.
[0142]
[0143] Table 3: Predicted Performance Results of the Top 10 Ports
[0144]
[0145]
Claims
1. A deep learning method for port congestion prediction based on ship AIS data, characterized in that, Includes the following steps: Step 1: Obtain real-time port call information for vessels; Step 2: Port congestion status characterization; First, port congestion status is quantified. The average waiting time for ships at anchor to berth is used to characterize port congestion, and the port congestion status is statistically analyzed hourly to obtain time-series data on congestion status at each port node. ;in, Represents the set of real numbers. Indicates the length of the time series. Indicates the number of ports. This represents the characteristic dimension of each port at each time step, which is the port's congestion status. Then, the congestion status time series data... The normalization process is performed using the following formula: in, This represents the congestion status data after normalization; where Indicates a time step. Indicates the port number. Indicates the feature dimension; This indicates the original congestion status data at time step. ,port Feature Dimension The value on; and Representing feature dimensions The mean and standard deviation; Finally, a linear layer is used to... High-dimensional embedding is Soon Feature Dimensions Mapped to the hidden layer dimension of the model The formula is as follows: in, This represents the congestion state embedding representation obtained after high-dimensional embedding through a linear layer, with a dimension of . , It is the hidden layer dimension of the model; This represents a weight matrix belonging to the set of real numbers. ; Describe a bias vector that belongs to the set of real numbers. ; Step 3: Construct two maritime transport networks and their temporal context; First, two maritime traffic network maps are constructed: a distance map and an interaction map; then, temporal context information is constructed; the specific steps are as follows: (3.1) Distance Map is an undirected graph used to describe the distances between port nodes, where Let represent the sets of distances to port nodes and edges in the graph, respectively. The number of port nodes. Represents the adjacency matrix of the distance graph. 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... Port node and Euclidean distance, adjacency matrix of distance graph It is expressed as follows: in, It is a distance graph The elements in the adjacency matrix represent port nodes. and The weight between them, that is, the reciprocal of the distance; then... The node2vec method maps each port node in space to a high-dimensional vector representation. ; (3.2) Interaction diagram , is a directed graph used to represent the frequency of interactions between two port nodes in a ship's historical voyage record, where The adjacency matrix represents the interaction graph; Specifically, along the direction of the ship's journey, the ship departs from the port node. After leaving, its next port node to arrive at is At that time, the total number of ships meeting this condition is the port node. and The interaction weights between them; the larger the weight, the stronger the port node. and The more frequent the interaction, the more port nodes... More likely to affect Congestion status; adjacency matrix of the interaction graph It is expressed as follows: in, Port node and The frequency of interactions represents the port node. and The weights between them; similarly, the weights between them. The node2vec method maps each port node in space to a high-dimensional vector representation. ; (3.3) Finally, the two spatial vectors of the port nodes obtained in steps (3.1) and (3.2) are represented. and Vector concatenation is performed to obtain the final spatial vector representation of the port nodes. ; (3.4) Two important time signals are used: the number of weeks in a month and the number of days in a week; these two signals provide long-term and short-term background information for the port congestion prediction task; a month is divided into A week is divided into 7 days; then they are encoded into dimensions. and The one-hot vectors are then concatenated to construct the embedded representation of temporal background information. ; Step 4: Setting up the ST-LSTTM deep learning network model; The ST-LSTTM deep learning network model is used to predict port congestion in maritime traffic systems. Its overall architecture consists of an encoder and a decoder, with an attention module placed between the encoder and decoder; details are as follows: (4.1) Encoder settings The encoder's input is the congestion state embedding representation obtained in step two. The spatial vector representation of the port nodes obtained in step three. and embedding of time background information After being input into the encoder, the encoder learns and captures the spatiotemporal correlation of congestion states between port nodes and outputs the results; specifically: The encoder consists of multiple layers, each layer comprising a spatial Transformer, an LSTM neural network, and a fusion module; the spatial Transformer neural network is used to capture the spatial dependencies of port congestion states, denoted as... LSTM is used to capture the temporal variation pattern of port congestion, set to To obtain the complex spatiotemporal correlations of port congestion prediction, the fusion module interweaves and fuses spatial and temporal features together. (4.2) Attention module settings A present-to-future attention module is set between the encoder and the predictive decoder, and a present-to-past attention module is set between the encoder and the recall decoder; the attention modules learn and simulate the relationship between each future or past time step and the port node congestion state in all current input time steps. (4.3) Decoder settings The decoder consists of two decoders: a prediction decoder, which predicts future port congestion states, takes as input the embedded representation of the future port node congestion states output from the attention module in step (4.2), and outputs the prediction results of all port node congestion states; and a recall decoder, which acts as a regularization term to prevent overfitting of the prediction decoder, takes as input the embedded representation of the past port node congestion states output from the past attention module in step (4.2), and outputs the recall results of all past port node congestion states. Both decoders have the same structure as the encoder. Fully connected layers are added after the prediction and recall decoders to obtain the corresponding predicted and recalled congestion state results. and ; Step 5: Setting the model loss function; The loss function during model training consists of the losses from predicting and recalling port congestion, 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, characterized in that, In step one, the real-time port information for a vessel includes the vessel name, the name of the port it calls at, arrival time, berthing time, departure time, and draft information at arrival and departure.
3. The deep learning method for port congestion prediction based on ship AIS data according to claim 1, characterized in that, In step (4.1), the fusion module interweaves and fuses spatial and temporal features. Specifically, it first uses a linear model with a sigmoid activation function to calculate the fusion gate. To capture the interdependencies between port nodes at different points in time, the formula is: in, It is the sigmoid activation function; and Both are learnable weight matrices, used for linear transformations of spatial and temporal features, respectively; It is a bias vector; then, the spatial and temporal features are combined in the following way: in, The spatiotemporal correlation of the congestion status of port nodes, which integrates temporal and spatial characteristics; This indicates element-wise multiplication.
4. The deep learning method for port congestion prediction based on ship AIS data according to claim 1, characterized in that, In step (4.2), The formula for the attention module for the future is now as follows: in, Indicates according to and The calculated attention weights; and These represent the future port nodes to be predicted and the spatiotemporal embedding representations of the input port nodes used for prediction, respectively. Specifically, each port node... Spatial Embedding Representation With the future Temporal embedding representation of time steps Or the first input Embedded representation of time steps The result of addition; Subsequently, the spatiotemporal correlation of the congestion status of the port nodes output by the encoder is determined based on the attention weights. The recalculation, used as input to the subsequent predictive decoder, follows as follows: in, Is the future number Step, port node Embedded representation of the spatiotemporal correlation of congestion status; It is the first output of the encoder. Step, port node The spatiotemporal correlation of congestion status; The settings for the attention module for the past are now the same as those for the attention module for the future, the difference being that the time steps representing the future are now set in the attention module for the future. And the spatiotemporal embedding representation of port nodes to be predicted in the future. Replace with a time step representing the past. And the spatiotemporal embedding representation of port nodes to be recalled in the past. .
5. The deep learning method for port congestion prediction based on ship AIS data according to claim 1, characterized in that, In step five, the specific calculation formula is as follows: in, This represents the total loss during model training; , This represents predicted loss and recalled loss; It is a weighting coefficient; , These represent the time steps for prediction and recall, respectively; , Indicates the actual values of prediction and recall; , This represents the output of the fully connected layer following the predictive decoder and recall decoder in step four, along with the predicted and recalled values.
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