Ship trajectory prediction method
By combining the GRU-Attention-BiLSTM model with an attention mechanism, the problem of insufficient accuracy in ship trajectory prediction in complex waters is solved, and more efficient trajectory prediction results are achieved.
Patent Information
- Application Number
- CN202511077801.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2026-02-24
AI Technical Summary
Existing ship trajectory prediction methods cannot accurately consider the surrounding environment information of ships in complex navigable waters, resulting in reduced prediction accuracy, and the model's ability to process complex trajectory data is insufficient.
A GRU-Attention-BiLSTM ship trajectory prediction model is adopted, which combines a GRU encoder, an attention module, and a BiLSTM decoder. Through feature extraction and decoding prediction, the model utilizes longitude, latitude, heading, speed, and regional density information in the ship trajectory data and introduces an attention mechanism to optimize feature weight allocation, thereby improving prediction accuracy.
It effectively reduces ship trajectory prediction errors and improves prediction accuracy, especially performing well in complex waterways and environments with many obstacles.
Smart Images

Figure CN121565018A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to ship collision avoidance technology, and more particularly to a method for predicting ship trajectories. Background Technology
[0002] In complex navigable waterways characterized by restricted channels, heavy traffic, intersecting routes, and numerous static obstacles, ship trajectory prediction, by accurately forecasting future ship movements, helps to provide early warnings of potential dangers, thereby ensuring the safety of ships, personnel, and cargo. Therefore, an efficient and accurate ship trajectory prediction model is crucial for ensuring maritime transport safety.
[0003] In traditional research methods, mathematical modeling methods that simulate ship behavior by designing specific physical equations are widely used in the field of ship trajectory prediction. Houenou et al. [3] established a curvilinear motion model and used the extended Kalman filter algorithm to predict the position, velocity and acceleration of the ship. This process is computationally intensive and not applicable to different scenarios.
[0004] With the development of artificial intelligence, machine learning methods can learn the relationship between historical motion patterns of ships and future trajectories. Rong et al. decomposed ship motion into longitude and latitude directions, and used Gaussian regression model to estimate the probability density function of longitudinal acceleration and the probability density function of latitude position to predict trajectory uncertainty. Zhang et al.[5] proposed a wavelet-based Hidden Markov Model (HMM) trajectory prediction algorithm, which solved the shortcomings of Kalman filtering and linear regression such as low accuracy and large time delay. In practical applications, machine learning has problems such as insufficient sample size and local optimization.
[0005] In recent years, neural networks have gained widespread attention in trajectory prediction due to their excellent performance in other fields. Models such as the Hidden Markov Model (LSTM) and the Gated Recurrent Unit (GRU) are often used to address the difficulty in capturing temporal features. Liu Chengyong et al., based on the complex navigation environment of inland waterways, proposed an Atten-LSTM model combining attention mechanisms and LSTM, which can efficiently and accurately predict ship trajectories while ensuring reliability. Ju Cong et al. proposed a hybrid ship trajectory prediction model (CNN-GRU) based on CNN and GRU, significantly improving prediction accuracy and efficiency through improved data processing and model building. Meanwhile, compared to the traditional unidirectional LSTM, bidirectional LSTM (BiLSTM) and its variants perform better in many trajectory sequence modeling tasks. Guo Yijie et al. fused TCN and Bi-LSTM networks to learn the preceding and following states of the trajectory sequence to extract more information from the sequence, achieving more accurate predictions of future ship trajectories. XUE et al. combined the complementary advantages of GRU and Transformer for long-term prediction, improving prediction accuracy and computational efficiency.
[0006] While existing methods have made significant progress in ship trajectory prediction, they still have limitations in adapting to complex navigable waters. Current trajectory prediction methods often use the longitude, latitude, heading, and speed of trajectory points as inputs, without considering information about the ship's surrounding environment. This results in models being unable to accurately predict trajectory changes in different scenarios under complex navigable waters, thus reducing prediction accuracy. Furthermore, complex trajectory data places higher demands on the model's feature processing capabilities. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a method for predicting ship trajectories, addressing the deficiencies in the prior art.
[0008] The technical solution adopted by this invention to solve its technical problem is: a ship trajectory prediction method, comprising the following steps: 1) Collect trajectory data of ships in navigable waters at each time step, including the longitude and latitude of the trajectory point at each time step, the heading to the ground, the speed to the ground, and the ship density in the area where the trajectory point is located at the current time; 2) Construct a ship trajectory prediction model; The ship trajectory prediction model is a GRU-Attention-BiLSTM ship trajectory prediction model, which includes a GRU encoder, an attention module, and a BiLSTM decoder. The aim is to encode, extract features, and decode and predict ship trajectory data.
[0009] The GRU encoder is responsible for receiving the trajectory data of the ship at each time step and the hidden state of the previous time step, generating the hidden state of each time step through nonlinear transformation, and outputting a comprehensive semantic vector at the last moment to summarize the entire trajectory sequence.
[0010] The hidden state of the previous time step is a compressed representation of all historical trajectory information from the beginning of the trajectory data sequence up to the time of the previous time step; The BiLSTM decoder is used to concatenate the feature vector output by the attention module with the hidden state of the current decoder at each time step. After restoring the shape through nonlinear transformation, a new hidden state and the final output are generated, realizing the stepwise prediction of the trajectory. The attention module calculates the correlation between the hidden states of the GRU encoder and the hidden states of the BiLSTM decoder to obtain weight values, and generates the feature vector for each time step by weighted summation. 3) Obtain the predicted trajectory based on the model's output.
[0011] According to the above scheme, the GRU encoder encodes five features of the received trajectory point: longitude (Lon), latitude (Lat), heading to ground (COG), speed to ground (SOG), and the ship density (Density) of the area where the trajectory point is located at the current time, as follows: Each GRU unit receives the hidden state from the previous time step and the trajectory data from the current time step as input; by performing a nonlinear transformation on the input information, it generates the data for each time step. The hidden state;
[0012] In the formula, The hidden state at time t-1; for Input at any moment; This is a GRU encoder. At the last time step T of the sequence, all the hidden states output by the encoder are further processed to obtain the intermediate semantic vector. , ;
[0013] In the formula: It is a non-linear function responsible for mapping the features of the encoder data to the output space required by the decoder.
[0014] According to the above scheme, the attention mechanism assigns different weights to each feature by calculating the correlation between the features at each time step in the input sequence and the current state of the decoder. The attention mechanism operates in three steps: relevance calculation, weight normalization, and weighted summation. First, calculate the hidden state of the GRU encoder at time i. The hidden state of the BiLSTM decoder at time t correlation score ;
[0015] In the formula: This is the weight matrix; Transformation coefficients encoder status and decoder state The columns are concatenated into a new vector. This concatenated vector contains all the information from the encoder at time i and the decoder at time t. After linear transformation and activation function, the correlation scores between them are calculated and used for weighted summation in the attention mechanism. This is a linear transformation that maps the high-dimensional tanh result; tanh is the activation function. Then, the relevance scores are normalized using the softmax function, and the influence weights of the GRU hidden state on the BiLSTM hidden state are calculated, as shown below. ; In the formula: These are the weight values calculated using the softmax function; Finally, the hidden states of the GRU encoder are weighted and summed using attention weights to obtain the feature vector at time t. As shown below: .
[0016] According to the above scheme, the input of the BiLSTM decoder is the feature vector output by the attention module, and the output is the trajectory information to be predicted.
[0017] According to the above scheme, the decoding process of the BiLSTM decoder is as follows: The feature vector output by the attention module The hidden state of the BiLSTM decoder at time t Concatenate the hidden states and compute the new hidden states of the BiLSTM decoder at time t. As shown below: ; In the formula: For the transformation matrix, Indicates splicing; Let be the hidden state of the decoder part at time t; Calculate the final output of the BiLSTM decoder at time t. As shown below: ; In the formula: This is the output coefficient matrix of the hidden layer; This is a bias term.
[0018] According to the above scheme, the GRU encoder performs data preprocessing on the received data; the five feature dimensions of the ship trajectory data are normalized to the [0,1] interval respectively.
[0019] According to the above scheme, the loss function used in the model training phase is as follows: ; in , This indicates the ship's actual longitude and latitude at time step t. , This indicates the predicted longitude and latitude of the ship at time step t. This refers to the set prediction time step.
[0020] The beneficial effects of this invention are: This invention combines GRU, BiLSTM, and attention mechanisms to propose a ship trajectory prediction model based on GRU-Attention-BiLSTM, which captures the temporal features of the trajectory and can effectively reduce ship trajectory prediction errors and improve prediction accuracy. Attached Figure Description
[0021] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 This is a flowchart of a method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the model structure according to an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the model encoding and decoding principle of an embodiment of the present invention; Figure 4 This is a comparative schematic diagram of a straight-line navigation scenario model according to an embodiment of the present invention; Figure 5 This is a comparative schematic diagram of a small-amplitude turning navigation scenario model according to an embodiment of the present invention; Figure 6 This is a comparative schematic diagram of a navigation scenario model with a large turning radius according to an embodiment of the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0023] like Figure 1 As shown, a ship trajectory prediction method includes the following steps: 1) Collect trajectory data for each time step of the ship's navigation, including the longitude (Lon), latitude (Lat), heading to ground (COG), speed to ground (SOG), and the ship density (Density) of the area where the trajectory point is located at the current time. 2) Construction of a ship trajectory prediction model based on GRU-Attention-BiLSTM; 2.1 Overall Model Framework The GRU-Attention-BiLSTM ship trajectory prediction model consists of a GRU encoder, an attention module, and a BiLSTM decoder, and is designed to encode, extract features, and decode ship trajectory data for prediction.
[0024] The GRU encoder is responsible for receiving the trajectory data at each time step and the hidden state at the previous time step (t-1), generating the hidden state at each time step through nonlinear transformation, and outputting a comprehensive semantic vector at the last moment to summarize the entire trajectory sequence.
[0025] The attention module addresses the information bottleneck problem of fixed-length semantic vectors. It calculates the correlation between the hidden states of the GRU encoder and the BiLSTM decoder to obtain weight values, and uses weighted summation to generate feature vectors for each time step, highlighting key features. At each time step, the BiLSTM decoder concatenates the feature vector output by the attention module with the current decoder's hidden state. After restoring the shape through a nonlinear transformation, it generates a new hidden state and the final output, achieving progressive trajectory prediction.
[0026] The five features of the trajectory point—longitude (Lon), latitude (Lat), heading to ground (COG), speed to ground (SOG), and the ship density (Density) of the area where the trajectory point is located at the current moment—are input into the encoder for encoding. Finally, the decoder module outputs the ship's trajectory for future moments. Its overall structure is as follows: Figure 2 As shown.
[0027] Figure 3 This demonstrates the process of information transfer within the model. In the encoding stage, the model processes historical track sequences through feature extraction and information compression, ultimately encoding them into intermediate semantic vectors. A unified representation is then performed. The decoding phase decodes the ship's potential motion pattern information into trajectory information to be predicted.
[0028] 2.2 GRU-Attention-BiLSTM encoding and decoding process; 2.2.1 Encoding Process First, the preprocessed ship trajectory data is input into the GRU encoder, where each GRU unit receives the hidden state from the previous time step and the trajectory data from the current time step. Then, by performing a nonlinear transformation on the input information, the data for each time step is generated. The hidden state;
[0029] In the formula, This is the hidden state from the previous time step; for Input at any moment; This is a GRU encoder; at the last time step T of the sequence, all hidden states output by the encoder are further processed to obtain intermediate semantic vectors. , .
[0030]
[0031] In the formula: It is a non-linear function responsible for mapping the features of the encoder data to the output space required by the decoder.
[0032] BiLSTM decoder; The decoding phase decodes the ship's potential motion pattern information into trajectory information to be predicted. The input to the decoder is an intermediate semantic vector. The output is the trajectory information to be predicted; 2.2.2 Attention Module Calculate the correlation between the features at each time step in the input sequence and the current state of the decoder, assign different weights to each feature, and obtain the key features based on the weight values; However, a fixed-length semantic vector *c* cannot fully encompass all the information of a long sequence, especially when faced with a long input, where subsequent inputs may overwrite important information from earlier inputs, leading to information loss. To address this issue, an attention mechanism is introduced. The attention mechanism calculates the correlation between the features at each time step of the input sequence and the current state of the decoder, assigning different weights to each feature to highlight key features.
[0033] The attention mechanism operates in three steps: relevance calculation, weight normalization, and weighted summation.
[0034] First, calculate the hidden state of the GRU encoder at time i. The hidden state of the BiLSTM decoder at time t correlation score ; ; In the formula: This is the weight matrix; Transformation coefficients encoder status and decoder state The columns are concatenated into a new vector. The concatenated vector contains all the information of the encoder at time i and the decoder at time t. After linear transformation and activation function, the correlation score between them is calculated and used for weighted summation in the attention mechanism. This is a linear transformation that maps the high-dimensional tanh result; tanh is the activation function. Then, the relevance scores are normalized using the softmax function, and the influence weights of the GRU hidden state on the BiLSTM hidden state are calculated, as shown below. ; In the formula: These are the weight values calculated using the softmax function.
[0035] Finally, the hidden states of the GRU encoder are weighted and summed using attention weights to obtain the feature vector at time t. As shown below: ; 2.2.3 Decoding Process The decoding phase outputs the feature vector from the attention module. The hidden state of the BiLSTM decoder at time t Concatenate the hidden states and compute the new hidden states of the BiLSTM decoder at time t. As shown below: ; In the formula: This is the transformation matrix. Because the feature dimensions will change after concatenation, we will... splicing result and transformation matrix Shape recovery is performed through multiplication. Based on this, the final output of the BiLSTM decoder at time t is calculated. As shown below ; In the formula: This is the output coefficient matrix of the hidden layer; This is a bias term.
[0036] 3) Obtain the predicted trajectory based on the model's output.
[0037] 3.1.3 Data Normalization The preprocessed ship trajectory data, after incorporating ship traffic density information, was divided into training, validation, and test sets in a 7:2:1 ratio. The training set was used to optimize model parameters and learn the relationship between input and output. The validation set was used to evaluate the model's performance on new data, prevent overfitting, and select the optimal configuration. The test set was used to evaluate the model's generalization ability and prediction accuracy.
[0038] To accelerate model convergence and increase data stability, the five feature dimensions of the ship trajectory data are normalized to the [0,1] interval. The normalization formula is shown below.
[0039] ; In the formula, For the normalized data, For data of a certain feature dimension, and These are the minimum and maximum values of the data for this feature dimension, respectively.
[0040] 3.2 Model Parameter Settings This study builds the proposed improved GRU-BiLSTM model based on the TensorFlow deep learning framework in Python and conducts related experiments. The number of neurons in both the GRU and BiLSTM modules is set to 128, which ensures sufficient model complexity while avoiding overfitting.
[0041] During model training, the mean-square error (MSE) is used as the model's loss function to measure the deviation between the generated predicted trajectory and the true trajectory. The MSE for each ship is calculated by summing the squares of the Euclidean distances between the predicted and true trajectory points at the same time. The closer the predicted and true values are, the smaller their MSE. The ultimate goal of training is to minimize the loss function. During the training of this model, it is necessary to simultaneously calculate the ship's... The loss function in this experiment is calculated as the sum of the errors in longitude and latitude at each prediction time step, and therefore the formula is as follows:
[0042] in , This indicates the ship's actual longitude and latitude at time step t. , This indicates the predicted longitude and latitude of the ship at time step t. This refers to the set prediction time step.
[0043] The model uses the Adam optimizer during training, which introduces an adaptive learning rate scaling mechanism and a momentum term. This helps to better balance convergence speed and stability in the early and later stages of training, and helps to smooth gradient changes. Furthermore, this optimizer handles sparse gradients well.
[0044] The initial learning rate was set to 0.01, Dropout to 0.5, and batch size to 128. We tested different learning rates (0.005, 0.01, 0.02, etc.) and found that 0.01 allowed the loss function to decrease relatively quickly while ensuring stable model convergence; therefore, it was chosen as the final learning rate. A Dropout rate of 0.5 prevented overfitting while preserving sufficient learning capacity. A batch size of 128 ensured effective model convergence while making efficient use of computational resources, reducing fluctuations during training, and enabling the model to learn features from ship trajectory data more stably. An epoch of 100 was set, allowing the model to eventually minimize the loss function and maintain relative stability, with the learning rate adaptively decreasing each epoch.
[0045] 3.2 Model Evaluation Indicators The accuracy of the model prediction results is evaluated using the average position error (ADE) and the final position error (FDE). ADE represents the average Euclidean distance between all corresponding points on the predicted and actual trajectories. FDE represents the Euclidean distance between the last predicted trajectory point and its corresponding actual trajectory point. The specific calculation method is as follows:
[0046]
[0047] in, Indicates the actual location. Indicates the actual destination location. Indicates the predicted location. Indicates the predicted endpoint location. Indicates the number of trajectory points. This represents the L2 norm, used to calculate Euclidean distance.
[0048] 4. Results Analysis and Effect Comparison The model is tested using a test set to evaluate its generalization ability and prediction accuracy.
[0049] After data cleaning and trajectory interpolation preprocessing, the raw trajectory data is divided into trajectory points at 1-minute intervals. For each trajectory sequence, a sliding window slicing process is used, with the window length being the sum of the historical trajectory duration and the predicted trajectory duration (in this application, the two are set to be equal). Each slice contains the historical trajectory and the future true trajectory (Ground Truth).
[0050] During the model training phase, the training set trajectories are traversed, and slices are generated using a sliding window and input into the model. The model splits the slices into historical trajectories and Ground Truth. The historical trajectories are input into the decoder, and training is completed by minimizing the mean squared error between the predicted trajectory and the Ground Truth.
[0051] During the model testing phase, the test set trajectories are also sliced using a sliding window and input into the trained model. The model decodes historical trajectories, generates predicted trajectories, and performs quantitative and qualitative comparisons with the Ground Truth to evaluate the prediction performance.
[0052] This application employs a multi-step prediction method (the model outputs all predicted trajectory points simultaneously) to output the predicted trajectory. The prediction results of the GRU-Attention-BiLSTM model are quantitatively and qualitatively evaluated and compared with GRU, LSTM, Seq2Seq-LSTM, Attention-BiLSTM, and Transformer models to analyze the performance differences of different models.
[0053] 4.1 Quantitative Assessment Based on the characteristics of vessel traffic and the needs of navigation practice in the Ningbo-Zhoushan Port waters, a quantitative evaluation experiment was conducted with the historical trajectory duration input to the model set to 10 minutes, 15 minutes, and 20 minutes. The predicted trajectory duration was the same as the input historical trajectory duration. The experiment compared the trajectory prediction performance under different input (output) trajectory durations with and without adding vessel density features, and used ADE and FDE to evaluate the prediction accuracy.
[0054] Table 1. ADE / FDE(m) of different models at different prediction durations (excluding regional ship density characteristics)
[0055] Table 2. ADE / FDE(m) of different models at different prediction durations (including regional ship density characteristics)
[0056] As shown in Tables 1 and 2, for different models with the same prediction duration and input features, the Seq2Seq-LSTM and GRU-Attention-BiLSTM models significantly outperform the LSTM and GRU models in ADE / FDE, indicating that introducing an Encoder-Decoder effectively improves the model's prediction performance. Compared to LSTM and GRU, the Attention-BiLSTM model, due to the introduction of bidirectional LSTM and the attention mechanism, has a relatively smaller prediction error. The Transformer model outperforms the Attention-BiLSTM model in ADE, but is slightly inferior in FDE. Among all the compared models, the GRU-Attention-BiLSTM model has the lowest ADE / FDE values and the highest prediction accuracy.
[0057] When the input features are the same, the ADE and FDE of all models increase with the increase of prediction time, meaning that the prediction performance of all models decreases with the increase of prediction time. When the prediction time increases from 10 min to 15 min and 20 min, the growth rates of ADE / FDE of GRU-Attention-BiLSTM are 30.9% / 19.7% and 37.5% / 12.4% respectively when ship density features are not added to the trajectory points, and 28.7% / 18.6% and 24% / 16.3% respectively after adding ship density features. The growth rate is the smallest among all the comparison models, that is, the GRU-Attention-BiLSTM model has the smallest change in prediction error and the most stable prediction performance as the prediction time increases.
[0058] For the same model and the same prediction duration, the ADE / FDE of all models decreased after the regional ship density feature was added, indicating that adding the regional ship density feature can effectively further improve the prediction performance of the model.
[0059] 4.2 Qualitative Assessment In the qualitative evaluation experiment, both the historical trajectory duration and the predicted trajectory duration were 10 minutes, and the input trajectory point features included regional ship density features. The prediction performance of different models was judged by visually comparing the prediction results with the ground truth under three navigation scenarios: straight navigation, small-amplitude turning, and large-amplitude turning. Figure 4 , Figure 5 , Figure 6 As shown.
[0060] In scenarios where ships navigate in a straight line, the predicted trajectory of GRU-Attention-BiLSTM almost perfectly matches the actual trajectory, with an ADE / FDE ratio of 72.1m / 86.8m. The Transformer's predicted trajectory is also relatively close to the actual trajectory, with an ADE / FDE ratio still reaching 96.4m / 169.5m. Other comparative models deviate significantly from the actual trajectory in their predicted trajectories, and their prediction performance is generally inferior to the GRU-Attention-BiLSTM model.
[0061] In scenarios where the ship makes small turns, both the GRU-Attention-BiLSTM and Seq2Seq-LSTM models predict turn amplitudes closer to the actual trajectory. However, the GRU-Attention-BiLSTM model significantly outperforms the Seq2Seq-LSTM model in terms of average position error, with the former achieving only 42% of the ADE (Adjustment Error) and an ADE / FDE ratio of 89.1m / 82.5m. While the Transformer model's predicted trajectory generally approaches the actual trajectory, it gradually deviates in the latter half, increasing the error, with an ADE / FDE ratio of 128.2m / 272.3m. Other models exhibit relatively large prediction errors throughout the entire trajectory.
[0062] In scenarios involving significant ship turns, the Transformer model performed best among the comparative models, with an ADE / FDE ratio of 202.3m / 363.9m. The GRU-Attention-BiLSTM model's predictions remained closest to the actual trajectory, with an ADE / FDE ratio of only 106.2m / 143.5m. Other comparative models showed significant deviations in the timing or magnitude of the predicted turns.
[0063] The results of quantitative and qualitative evaluation experiments show that the BiLSTM and attention mechanism adopted in this application improve the model's ability to capture long-term dependencies in AIS data, resulting in a significantly better prediction performance than other comparative models.
[0064] It should be understood that those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A method for predicting ship trajectories, characterized in that, Includes the following steps: 1) Collect trajectory data of ships in navigable waters at each time step, including the longitude and latitude of the trajectory point at each time step, the heading to the ground, the speed to the ground, and the ship density in the area where the trajectory point is located at the current time; 2) Construct a ship trajectory prediction model The ship trajectory prediction model is a GRU-Attention-BiLSTM ship trajectory prediction model, which includes a GRU encoder, an attention module, and a BiLSTM decoder. in, The GRU encoder is responsible for receiving the trajectory data of the ship at each time step and the hidden state of the previous time step. It generates the hidden state of each time step through nonlinear transformation and outputs a comprehensive semantic vector at the last moment to summarize the entire trajectory sequence. The hidden state of the previous time step is a compressed representation of all historical trajectory information from the beginning of the trajectory data sequence to the time of the previous time step. The BiLSTM decoder is used to concatenate the feature vector output by the attention module with the hidden state of the current decoder at each time step. After restoring the shape through nonlinear transformation, a new hidden state and the final output are generated, realizing the stepwise prediction of the trajectory. The attention module calculates the correlation between the hidden states of the GRU encoder and the hidden states of the BiLSTM decoder to obtain weight values, and generates the feature vector for each time step by weighted summation. 3) Obtain the predicted trajectory based on the model's output.
2. The ship trajectory prediction method according to claim 1, characterized in that, In step 2), the GRU encoder encodes five features of the received trajectory point: longitude, latitude, heading towards the ground, speed towards the ground, and ship density in the area where the trajectory point is located at the current time, as follows: Each GRU unit receives the hidden state from the previous time step and the trajectory data from the current time step as input; by performing a nonlinear transformation on the input information, it generates the data for each time step. The hidden state; In the formula, The hidden state at time t-1; for Input at any moment; This is a GRU encoder. At the last time step T of the sequence, all the hidden states output by the encoder are further processed to obtain the intermediate semantic vector. , ; In the formula: It is a non-linear function responsible for mapping the features of the encoder data to the output space required by the decoder.
3. The ship trajectory prediction method according to claim 1, characterized in that, In step 2), the attention mechanism assigns different weights to each feature by calculating the correlation between the features at each time step in the input sequence and the current state of the decoder. The attention mechanism operates in three steps: relevance calculation, weight normalization, and weighted summation. First, calculate the hidden state of the GRU encoder at time i. The hidden state of the BiLSTM decoder at time t correlation score ; In the formula: This is the weight matrix; These are the linear transformation coefficients. encoder status and decoder state Concatenate the columns to form a new vector; Then, the relevance scores are normalized using the softmax function, and the influence weights of the GRU hidden state on the BiLSTM hidden state are calculated, as shown below. ; In the formula: These are the weight values calculated using the softmax function; Finally, the hidden states of the GRU encoder are weighted and summed using attention weights to obtain the feature vector at time t. As shown below: 。 4. The ship trajectory prediction method according to claim 1, characterized in that, In step 2), the input to the BiLSTM decoder is the feature vector output by the attention module, and the output is the trajectory information to be predicted.
5. The ship trajectory prediction method according to claim 4, characterized in that, In step 2), the decoding process of the BiLSTM decoder is as follows: The feature vector output by the attention module The hidden state of the BiLSTM decoder at time t Concatenate the hidden states and compute the new hidden states of the BiLSTM decoder at time t. As shown below: ; In the formula: For the transformation matrix, Indicates splicing; Let be the hidden state of the decoder part at time t; Calculate the final output of the BiLSTM decoder at time t. As shown below: ; In the formula: This is the output coefficient matrix of the hidden layer; This is a bias term.
6. The ship trajectory prediction method according to claim 1, characterized in that, In step 2), the GRU encoder preprocesses the received data, normalizing the five feature dimensions of the ship trajectory data to the [0,1] interval.
7. The ship trajectory prediction method according to claim 1, characterized in that, In step 3), the loss function used by the model is as follows: ; in , This indicates the ship's actual longitude and latitude at time step t. , This indicates the predicted longitude and latitude of the ship at time step t. This refers to the set prediction time step.
8. An electronic device, characterized in that, include: One or more processors; as well as Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 7.