Ship trajectory prediction method and system based on AIS data
By using cubic spline interpolation and Savitzky-Golay filter to process AIS data missing and outliers, and combining with the improved Transformer model, the problems of missing data and outliers in ship trajectory prediction are solved, high-precision track prediction is achieved, and navigation safety and efficiency are improved.
Patent Information
- Application Number
- CN202411783537.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-12-06
AI Technical Summary
Existing technologies in ship trajectory prediction have problems such as short prediction time and insufficient versatility. Especially in AIS data applications, data missing and outlier processing are not sufficient, which affects the accuracy and applicability of track prediction.
Cubic spline interpolation is used to fill missing data, combined with Savitzky-Golay filter for smoothing, and an improved Transformer model is constructed, including a sliding window attention mechanism and a normalized encoder-decoder. Huber Loss is used as the loss function for training, and the ship trajectory is iteratively predicted.
It improves the accuracy and applicability of ship trajectory prediction, enhances navigation safety and efficiency, and achieves high-precision trajectory tracking and prediction.
Smart Images

Figure CN119884732B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of AIS ship data, artificial intelligence, and in particular to a ship trajectory prediction method based on AIS data. Background Art
[0002] Vessel Traffic Dervice (VTS) is an important component of maritime safety. VTS uses communication equipment such as the Automatic Identification System (AIS), radar, Closed Circuit Television (CCTV), wireless telephones, and shipboard terminals to monitor the course, speed, and other information of ships, track ships in real time, and provide technical assistance for early warning of ship accidents. The sensing and information technologies therein are used to assist in the collection, storage, processing, and visualization of maritime traffic data. AIS is a new navigation aid system used for navigation safety and ship-to-shore and ship-to-ship communications. According to the International Maritime Organization (IMO) Convention for the Safety of Life at Sea, ships with a displacement of 300 tons and above and all passenger ships must be equipped with this system. AIS was originally designed for ships to avoid collisions by allowing them to broadcast information about their position and other information to avoid collisions between ships.
[0003] Because the amount of data received by AIS is huge, the data content is rich, and the types are diverse, for example, it provides a large amount of valuable monitoring data, including dynamic information such as longitude, latitude, speed over the ground, and course over the ground, as well as static information about the ship itself, such as the name and type. It provides a large amount of rich maritime ship trajectory feature data for maritime transport management and related research. Therefore, combining the characteristics of AIS data, studying ship trajectory-related issues based on deep learning algorithms is a crucial issue for improving the accuracy of ship trajectory prediction and solving navigation safety. Summary of the Invention
[0004] In order to overcome the problems of short ship prediction time and lack of versatility in existing methods, the present invention designs a Transformer model optimized for AIS time series data, aiming to improve the prediction accuracy and applicability of the model. The present invention focuses on the practical application problems of AIS data in liner navigation, such as incomplete data and outlier processing, as well as the accuracy of track prediction. Through methods that fit the characteristics of liner navigation, such as data repair technology, track clustering analysis, and the establishment of track prediction models, the present invention aims to provide more practical solutions for the daily operations and safety supervision of the maritime industry.
[0005] Due to various factors, including AIS system equipment and the data collection environment, raw AIS data often contains varying degrees of missing data. This paper uses cubic spline interpolation to fill in missing data in AIS data. Combined with the application of a Savitzky-Golay filter, this method aims to make the interpolated trajectory smoother and more natural, thereby improving the effectiveness of AIS trajectory prediction.
[0006] The object of the present invention is achieved by the following technical solution: A method for predicting ship trajectory based on AIS data comprises the following steps:
[0007] Step 1: Obtain AIS ship historical positioning dataset and perform data selection and preprocessing;
[0008] Step 2: Use the cubic spline method to fill the pre-processed AIS data;
[0009] Step 3, smoothing the filled data sequence;
[0010] Step 4: Segment the smoothed time series data for model training;
[0011] Step 5: Build an improved transformer model, including an encoder consisting of a sliding window attention mechanism and normalization, and a decoder consisting of a sliding window attention mechanism and a fully connected layer;
[0012] The processing process of the improved transformer model is as follows: the AIS data in step 4 is input into the Embedding layer to obtain an embedded sequence, which is then processed by the encoder and decoder to obtain predicted data. A prediction loss function is designed to train the improved transformer model. At the same time, the predicted data is processed again by the Embedding layer as the next input to the decoder to sample the next position information. Through the iterative prediction process, a time series of predicted positions is generated.
[0013] Step 6: Use the trained model to predict the ship trajectory.
[0014] Furthermore, in step 1, the longitude LON, latitude LAT, speed SOG, and heading COG data in the AIS ship historical positioning data set are selected, and data with abnormal values in LON, LAT, SOG, and COG are deleted.
[0015] Furthermore, in step 2, the data of the same ship are first sorted in the order of timestamps, and a cubic polynomial is constructed between two adjacent data points. The longitude LON, latitude LAT, speed SOG, and heading COG information are respectively substituted into the formula to obtain the interpolated data. The specific formula is:
[0016]
[0017] Where x represents the LON, LAT, COG or SOG data of the current calculated position, a i Represents the cubic spline interpolation polynomial S i (x) at node x i The function value at S i (x i ), b i Indicates that at node x i The first derivative when M i Indicates that at node x i Time S i The second derivative of (x), h i Represents the distance between two adjacent endpoints.
[0018] Furthermore, the longitude sequence Lon = {lon1, lon2, ..., lon n} and the dimension sequence Lat={lat1,lat2,…,lat n}, and process the data in sequence. When processing the data with index i, obtain the data with indexes between iw and i+w for polynomial fitting, where w is the set window size; fit a polynomial f(x) in the window by the least squares method, and the form of the polynomial is: f(x)=a0+a1x+a2x 2 +…+a k x k , by solving the least squares problem, find the optimal polynomial coefficients a0, a1,…, a k ; Use the fitting polynomial f(x) to calculate the window center point x i The value f(x i ) as the smoothed data point to achieve a smoothing effect; for boundary points, the error after filtering is reduced by adding zero values at the beginning or end of the data; the specific formula is as follows:
[0019] f lon =Savitzky_Golay(lon i ,w,k) (2)
[0020] f lat =Savitzky_Golay(lat i ,w,k) (3)
[0021] where f lon and f lat Represents the i-th smoothed data, lon i and lat irepresents the i-th data to be processed; w represents the i-th data to be smoothed, and the data from iw to i+w need to be selected for auxiliary smoothing processing; k is the order of the polynomial.
[0022] Furthermore, in step 5, the processing of the Eembedding layer is as follows:
[0023] The longitude, latitude, speed, and heading parameters in the training set data are discretized into one-hot vectors, and the one-hot vectors of longitude, latitude, speed, and heading are concatenated to form a four-dimensional one-hot vector. The result is where h t Represents the four-dimensional one-hot vector encoding at time t, They represent the one-hot vectors corresponding to the longitude, latitude, speed and heading parameters at time t respectively;
[0024] The Embedding layer of the encoder is used to transform the original h t Mapped to a higher dimensional vector e t , the specific formula can be expressed as:
[0025] e t =embedding(h t ) (4)
[0026] Thus we get the embedded sequence e 0:t ,in
[0027] Furthermore, the processing of the sliding window attention mechanism in step 5 is as follows:
[0028] The time window size is set to w by embedding the sequence Input into the sliding window attention mechanism, the window effectively captures local dependencies and patterns. The specific formula is:
[0029]
[0030] Where t represents the current time step, which represents the time point at which the attention weight is being calculated; i represents a time step of the sliding window, specifically a time step around the current time step t, located in the window arrive within the scope of :t means from arrive The sequence between q t represents the query vector at time step t, k i represents the key vector at time step i within the window, v iRepresents the value vector of time step i within the window, q t 、k i 、v i By inputting feature data and W q 、W k 、W v Perform matrix operations, W q 、W k 、W v Data is generated by random initialization and then parameters are optimized in back propagation; sim(q t ,k i ) is the similarity function, calculated using dot product; attention weight a i Indicates the degree of attention of time step t to the data point of time step i in the window; the output y is calculated t , represents the weighted integration of data points in the local time period before and after time step t.
[0031] Furthermore, in order to avoid the gradient explosion problem during training, the processed data is normalized. The specific formula is:
[0032]
[0033] Where x represents the data after the sliding window attention mechanism extracts features, Represents the normalized data and will be continuously fed into the decoder as input for trajectory prediction.
[0034] Furthermore, the formula for the fully connected layer in the decoder is as follows:
[0035]
[0036] Where x is the feature matrix output by the sliding window attention mechanism, W is the weight matrix, which is generated by random initialization and then optimized in back propagation. Represents the predicted value at time t+1.
[0037] Furthermore, Huber Loss is used as the prediction loss function, and the specific formula is:
[0038]
[0039] in represents the true value at time t+1, δ is a hyperparameter, and the calculation formula is: δ raw is a learnable parameter; prediction result It will be re-input into the model as the next input of the decoder to sample the next position information;
[0040] Through the iterative prediction process, the model starts from the current time t and uses the results of each prediction As the input for the next prediction, the ship trajectory in the next T hours is continuously predicted. The prediction error of each step is evaluated and optimized by Huber Loss. Finally, the model generates a time series containing the predicted positions from t+1 to t+T. Indicates the ship's trajectory in the next T hours.
[0041] The present invention also provides a ship trajectory prediction system based on AIS data, including a processor and a memory, the memory being used to store program instructions, and the processor being used to call the stored instructions in the memory to execute the ship trajectory prediction method based on AIS data as described in the above technical solution.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] Aiming at the application of AIS data in liner navigation, the present invention designs a complete trajectory prediction method and system. By using cubic spline interpolation to repair missing data, using the Savitzky-Golay filter algorithm to process outliers, and combining it with an improved Transformer model for track prediction, high-precision ship trajectory tracking and prediction is achieved, effectively improving the safety and efficiency of liner navigation. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a flow chart of the present invention;
[0045] Figure 2 This is the principle diagram of cubic spline interpolation method;
[0046] Figure 3 This is the schematic diagram of the Savitzky-Golay algorithm;
[0047] Figure 4 This is the flow chart of the AIS data trajectory prediction model;
[0048] Figure 5 This is a Transformer model diagram optimized for AIS data trajectory prediction;
[0049] Figure 6 This is a comparison chart of the effects before and after AIS data repair. DETAILED DESCRIPTION
[0050] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings.
[0051] This research examines AIS vessel data, exploring and analyzing key challenges such as the scarcity of samples of abnormal navigation patterns, the complexity of sample types, and the reduced precision of information resulting from increased model complexity. This research led to the design and implementation of a highly efficient and accurate AIS data prediction model, aiming to fundamentally reduce data reconstruction errors, enhance the accuracy of navigation anomaly prediction and localization capabilities, and optimize the response speed and accuracy of early warning systems. The ultimate goal of this innovative strategy is to provide a highly reliable AIS data prediction solution for modern maritime traffic management systems.
[0052] like Figure 1 As shown, the embodiment of the present invention provides a method for predicting ship trajectory based on AIS data, which includes the following steps:
[0053] Step S1: In the embodiment of the present invention, we use the historical positioning data set of Hailanxin radar and AIS ships in a certain province. The data set contains data serial number, ship call sign, ship destination, course, ship positioning latitude and other information. The data set contains more than 20,000 data, which will be used to train the model. The data set only takes the LON (longitude), LAT (latitude), SOG (speed), COG (course) and other data, which can be specifically expressed as in It can be expressed as the i-th track at time t. The data with abnormal values of LON, LAT, SOG, and COG (including null values, speed greater than 0 miles per hour or greater than 25 miles per hour) are deleted.
[0054] Step S2: Use the cubic spline method to fill the AIS data. Specifically, Figure 2 As shown, first sort the data of the same ship in the order of timestamp. Construct a cubic polynomial between two adjacent data points. We substitute the longitude, latitude, SOG, and COG information into the formula to obtain interpolated data. The specific formula is:
[0055]
[0056] Where x represents the longitude, latitude, SOG or COG data of the current calculated position. i Represents the cubic spline interpolation polynomial S i (x) at node x i The function value at S i (x i ), b i Indicates that at node x i The first derivative when M i Indicates that at node x i Time S i The second derivative of (x), hi Represents the distance between two adjacent endpoints.
[0057] Step S3: In order to reduce the impact of noise in the inserted data, we use the Savitzky-Golay filtering algorithm to smooth the inserted data sequence, thereby improving the smoothness of the AIS trajectory. Specifically, Figure 3 As shown, we obtain the longitude and latitude sequence Lon = {lon1, lon2, ..., lon n} and lat={lat1,lat2,…,lat n} and process the data in sequence. When processing the data with index i, obtain the data between index iw and i+w for polynomial fitting, where w is the set window size. Fit a polynomial f(x) in the window by the least squares method. The form of the polynomial is: f(x) = a0+a1x+a2x 2 +…+a k x k , by solving the least squares problem, find the optimal polynomial coefficients a0, a1,…, a k . Use the fitting polynomial f(x) to calculate the window center point x i The value f(x i ) as the smoothed data points to achieve a smoothing effect. In particular, for boundary points, the error after filtering is reduced by adding zero values at the beginning or end of the data. The summary formula is as follows:
[0058] f lon =Savitzky_Golay(lon i ,w,k) (2)
[0059] f lat =Savitzky_Golay(lat i ,w,k) (3)
[0060] where f lon and f lat Represents the i-th smoothed data, lon i and lat i represents the i-th data point to be processed. w represents the data points iw to i+w that need to be smoothed for the i-th data point. k represents the order of the polynomial. The smaller k is, the smaller the computational complexity, but the greater the error. In this paper, w is fixed to 51 and k to 3. Finally, we take data with a 4-minute interval to reconstruct a new AIS sequence.
[0061] Step S4: Segment the time series data after smoothing in step S3 into a training set, a validation set, and a test set, with data proportions of 60%, 20%, and 20%, respectively, to provide data support for the subsequent training of the AIS prediction module.
[0062] Step S5: The model adopts an improved transformer model, where the transformer consists of an encoder and a decoder. The encoder includes a sliding window attention mechanism and normalization, and the decoder includes a sliding window attention mechanism and a fully connected layer. Figure 4 and Figure 5 As shown in Figure 1, the encoder's main task is to convert the input time series data into a high-dimensional context representation (Context Representation), which contains all relevant information about the input sequence. In AIS trajectory prediction, the encoder typically processes historical data with the goal of extracting patterns and features from this data. The decoder's main task is to gradually generate future predictions based on the context representation generated by the encoder. In time series prediction, the decoder typically generates future time steps, which can be continuous or multi-step.
[0063] In the training process, the latitude, longitude, speed, and heading parameters in the training set data are discretized into one-hot vectors. These four one-hot vectors (one-hot vectors of longitude, latitude, speed, and heading) are concatenated to form a four-dimensional one-hot vector. The result is where h t Represents the four-dimensional one-hot vector encoding at time t, These represent the one-hot vectors of the latitude and longitude, speed, and heading parameters at time t. In this way, multi-dimensional continuous parameters can be effectively converted into discrete forms that the model can handle, thereby improving the model's training efficiency and prediction accuracy.
[0064] First, the original h is transformed through the embedding layer t Mapped to a higher dimensional vector e t , the specific formula can be expressed as:
[0065] e t =embedding(h t ) (4)
[0066] Thus we can get the embedded sequence e 0:t ,in
[0067] Step S6: embed the sequence e 0:tThis information is fed into a sliding window attention mechanism module to capture local AIS time series features. To accurately predict a vessel's trajectory, the prediction model needs to capture possible long-term correlations in historical AIS observations. The non-sparse attention in the original Transformer formulation has a self-attention component and therefore cannot be effectively extended to long time series. This invention adopts a sliding window attention model that considers the importance of local context and employs a fixed-size window of attention around each marker. This use of a sliding attention mechanism enables efficient prediction of longer-term vessel trajectories.
[0068] Specifically, we set the time window size to w by embedding the sequence Input into the sliding window attention mechanism, the local dependencies and patterns within the window are effectively captured. The specific formula is:
[0069]
[0070] Where t represents the current time step, which represents the time point at which the attention weight is being calculated; i represents a time step of the sliding window, specifically a time step around the current time step t, located in the window arrive within the scope of :t means from The sequence between q t represents the query vector (Query) at time step t, k i Represents the key vector (Key) of time step i in the window, v i Represents the value vector (Value) of time step i in the window, q t 、k i 、v i Characteristic data and W can be input through s5 q 、W k 、W v Perform matrix operations, W q 、W k 、W v Data can be generated by random initialization and parameters can be optimized in back propagation. t ,k i ) is the similarity function, which can be calculated using dot product. Attention weight a i Indicates the degree of attention of time step t to the data point of time step i in the window. i The value means that the model believes that the data point at time step i is more important for the prediction of the current time step t. After calculation, we get the output y t, represents the weighted integration of data points in the local time period before and after time step t. In this way, the model can effectively capture and utilize local features and patterns, thereby improving the accuracy and robustness of predictions.
[0071] Furthermore, in order to avoid the gradient explosion problem during training, we normalize the processed data. The specific formula is:
[0072]
[0073] Where x represents the data after the sliding window attention module extracts features, Represents the normalized data and will be continuously fed into the decoder as input for trajectory prediction.
[0074] Step S7: Input the sequence obtained by the encoder into the decoder, where the decoder also consists of a sliding window attention module and a fully connected layer. It is responsible for predicting the position information of the next time interval. The calculation of the sliding window attention mechanism is the same as formula (5) and formula (6). The fully connected formula is as follows
[0075]
[0076] Where x is the feature matrix output by the sliding window attention module, and W is the weight matrix, which can be generated by random initialization and then the parameters can be optimized in backpropagation. Represents the predicted value at time t+1.
[0077] Step S8: In order to measure the difference between the model prediction value and the true value, MSE can be used as the loss function. However, during the navigation process, the ship may have noise values due to the change of course. Therefore, this patent uses Huber Loss as the prediction loss function. The specific formula is:
[0078]
[0079] in Represents the true value at time t+1, and δ is used to determine when to switch from square loss to linear loss. Traditionally, δ is a hyperparameter that needs to be set manually, usually requiring a lot of experiments and debugging through grid search, random search, or Bayesian optimization. In this paper, δ is used as a learnable parameter, and the model can automatically adjust the value of δ during training. Specifically, a learnable parameter δ is set. raw , is converted to δ through the Softplus function. The Softplus formula is In this way, δ can gradually converge to the optimal value as training progresses, just like other model parameters, so that Huber Loss can adaptively balance the squared error and absolute error, improving the robustness of the model and prediction accuracy.
[0080] Prediction results It will be re-input into the model as the next input of the decoder to sample the next position information.
[0081] Through the iterative prediction process, the model starts from the current time t and uses the results of each prediction As the input for the next prediction, the ship trajectory is continuously predicted for the next 2 hours. The prediction error at each step is evaluated and optimized using Huber Loss (where δ is set to 0.5). Ultimately, the model generates a time series containing the predicted positions from t+1 to t+120 (predicted every 1 minute, for a total of 120 time steps). Indicates the ship's trajectory in the next 2 hours.
[0082] The ship trajectory prediction effect is shown in the figure. Figure 6 The table shows the original trajectory data of the ship with MMSI number 636017435, represented by discrete points; the chart on the right shows the trajectory predicted for the next two hours using the improved Transformer model, represented by a continuous line. The overall path is smooth and continuous, indicating that the model can effectively capture and predict the ship's movement path, thereby significantly improving the accuracy and robustness of the prediction.
[0083] On the other hand, an embodiment of the present invention also provides a ship trajectory prediction system based on AIS data, including a processor and a memory, the memory being used to store program instructions, and the processor being used to call the stored instructions in the memory to execute the ship trajectory prediction method based on AIS data as described in the above technical solution.
[0084] The specific embodiments described herein are merely illustrative of the spirit of the present invention. Persons skilled in the art may make various modifications, additions, or substitutions to the described specific embodiments without departing from the spirit of the present invention or exceeding the scope of the appended claims.
Claims
1. A ship trajectory prediction method based on AIS data, characterized in that: The steps include: Step 1: Obtain AIS ship historical positioning dataset and perform data selection and preprocessing; Step 2: Use the cubic spline method to fill the pre-processed AIS data; Step 3, smoothing the filled data sequence; Step 4: Segment the smoothed time series data for model training; Step 5: Build an improved transformer model, including an encoder consisting of a sliding window attention mechanism and normalization, and a decoder consisting of a sliding window attention mechanism and a fully connected layer; The processing process of the improved transformer model is as follows: the AIS data in step 4 is input into the Embedding layer to obtain an embedded sequence, which is then processed by the encoder and decoder to obtain predicted data. A prediction loss function is designed to train the improved transformer model. At the same time, the predicted data is processed again by the Embedding layer as the next input to the decoder to sample the next position information. Through the iterative prediction process, a time series of predicted positions is generated. Step 6: Use the trained model to predict the ship trajectory.
2. The ship trajectory prediction method based on AIS data according to claim 1, characterized in that: In step 1, the longitude LON, latitude LAT, speed SOG, and course COG data in the AIS ship historical positioning dataset are selected, and the data with abnormal values in LON, LAT, SOG, and COG are deleted.
3. The ship trajectory prediction method based on AIS data according to claim 1, characterized in that: In step 2, first sort the data of the same ship in the order of timestamps, construct a cubic polynomial between two adjacent data points, and substitute the longitude LON, latitude LAT, speed SOG, and heading COG information into the formula to obtain interpolated data. The specific formula is: Where x represents the LON, LAT, COG or SOG data of the current calculated position, a i Represents the cubic spline interpolation polynomial S i (x) at node x i The function value at S i (x i ), b i Indicates that at node x i The first derivative when M i Indicates that at node x i Time S i The second derivative of (x), h i Represents the distance between two adjacent endpoints.
4. The ship trajectory prediction method based on AIS data according to claim 1, characterized in that: Get the longitude sequence lon={lon1,lon2,…,lon n } and the dimension sequence Lat={lat1,lat2,…,lat n }, and process the data in sequence. When processing the data with index i, obtain the data with indexes between iw and i+w for polynomial fitting, where w is the set window size; fit a polynomial f(x) in the window by the least squares method, and the form of the polynomial is: f(x)=a0+a1x+a2x 2 +…+a k x k , by solving the least squares problem, find the optimal polynomial coefficients a0, a1,…, a k ; Use the fitting polynomial f(x) to calculate the window center point x i The value f(x i ) as the smoothed data point to achieve a smoothing effect; for boundary points, the error after filtering is reduced by adding zero values at the beginning or end of the data; the specific formula is as follows: f lon =Savitzky_Golay(lon i ,w,k) (2) f lat =Savitzky_Golay(lat i ,w,k) (3) where f lon and f lat Represents the i-th smoothed data, lon i and lat i Represents the data to be processed for the i-th time; w represents that for the i-th data that needs to be smoothed, data from iw to i+w need to be selected for auxiliary smoothing processing; k is the order of the polynomial.
5. The ship trajectory prediction method based on AIS data according to claim 1, characterized in that: In step 5, the processing of the Eembedding layer is as follows: The longitude, latitude, speed, and heading parameters in the training set data are discretized into one-hot vectors, and the one-hot vectors of longitude, latitude, speed, and heading are concatenated to form a four-dimensional one-hot vector. The result is where h t Represents the four-dimensional one-hot vector encoding at time t, They represent the one-hot vectors corresponding to the longitude, latitude, speed and heading parameters at time t respectively; The Embedding layer of the encoder is used to transform the original h t Mapped to a higher dimensional vector e t , the specific formula can be expressed as: e t =embedding(h t ) (4) Thus we get the embedded sequence e 0:t ,in 6. The ship trajectory prediction method based on AIS data according to claim 1, characterized in that: The processing of the sliding window attention mechanism in step 5 is as follows: The time window size is set to w by embedding the sequence Input into the sliding window attention mechanism, the window effectively captures local dependencies and patterns. The specific formula is: Where t represents the current time step, which represents the time point at which the attention weight is being calculated; i represents a time step of the sliding window, specifically a time step around the current time step t, located in the window arrive within the scope of t means from arrive The sequence between q t represents the query vector at time step t, k i represents the key vector at time step i within the window, v i Represents the value vector of time step i within the window, q t 、k i 、v i By inputting feature data and W q 、W k 、W v Perform matrix operations, W q 、W k 、W v Data is generated by random initialization and then parameters are optimized in back propagation; sim(q t ,k i ) is the similarity function, calculated using dot product; attention weight a i Indicates the degree of attention of time step t to the data point of time step i in the window; the output y is calculated t , represents the weighted integration of data points in the local time period before and after time step t.
7. The ship trajectory prediction method based on AIS data according to claim 1, characterized in that: In order to avoid the gradient explosion problem during training, the processed data is normalized. The specific formula is: Where x represents the data after the sliding window attention mechanism extracts features, Represents the normalized data and will be continuously fed into the decoder as input for trajectory prediction.
8. The ship trajectory prediction method based on AIS data according to claim 1, characterized in that: The formula for the fully connected layer in the decoder is as follows: Where x is the feature matrix output by the sliding window attention mechanism, W is the weight matrix, which is generated by random initialization and then optimized in back propagation. Represents the predicted value at time t+1.
9. The ship trajectory prediction method based on AIS data according to claim 1, characterized in that: HuberLoss is used as the prediction loss function, and the specific formula is: in represents the true value at time t+1, δ is a hyperparameter, and the calculation formula is: δ raw is a learnable parameter; prediction result It will be re-input into the model as the next input of the decoder to sample the next position information; Through the iterative prediction process, the model starts from the current time t and uses the results of each prediction As the input for the next prediction, the ship trajectory in the next T hours is continuously predicted. The prediction error of each step is evaluated and optimized by Huber Loss. Finally, the model generates a time series containing the predicted positions from t+1 to t+T. Indicates the ship's trajectory in the next T hours.
10. A ship trajectory prediction system based on AIS data, characterized by: The method comprises a processor and a memory, wherein the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the ship trajectory prediction method based on AIS data as claimed in any one of claims 1 to 9.