Model and method for predicting trajectory of coastal commercial fishing boat in encounter scene
By integrating surrounding vessel navigation data using the Encounter-LSTM model, the problem of traditional trajectory prediction methods failing to consider the interaction between encountering vessels is solved, achieving high-precision trajectory prediction in complex waters.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- MINJIANG UNIVERSITY
- Filing Date
- 2026-01-23
- Publication Date
- 2026-05-19
AI Technical Summary
Traditional ship trajectory prediction methods fail to effectively consider the potential interactions between encountering ships, resulting in insufficient trajectory prediction accuracy in complex waters, especially posing a significant risk in waters with dense traffic flow or complex encounter situations.
A ship encounter trajectory prediction model based on Encounter-LSTM is adopted. By extracting encounter trajectory data, a long short-term memory network is constructed. Combined with pooling function and reconstruction loss function, surrounding ship navigation data is integrated to predict future trajectories.
It improves the accuracy of ship trajectory prediction, especially in waters with dense traffic flow or complex encounter situations, demonstrating strong stability and accuracy, and can effectively predict the future trajectory of ships.
Smart Images

Figure CN122065152A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship trajectory prediction technology, and in particular to a trajectory prediction model and method for encounter scenarios of coastal merchant and fishing vessels. Background Technology
[0002] Whether in coastal, port, or inland waterways, ships face complex encounter situations. An encounter occurs when two ships are within a specified distance of each other over a certain time interval. In densely populated waterways or port areas, encounter scenarios are frequent and complex. By predicting the future trajectories of other ships, the potential for collision can be assessed in advance. Trajectory prediction heavily relies on real-time data streams provided by the Automatic Identification System (AIS). Traditional trajectory prediction typically only considers the ship's own historical trajectory and does not take into account the potential interactions between encountering ships. Summary of the Invention
[0003] The purpose of this invention is to provide a trajectory prediction model and method for encounters between coastal merchant and fishing vessels, which can effectively predict the future trajectories of ships by extracting and training multi-ship encounter trajectory data.
[0004] To achieve the above objectives, the present invention provides the following technical solution: a trajectory prediction method for encounters between coastal merchant and fishing vessels, characterized in that the method includes the following steps: Step S1: Extract ship travel information from historical records based on timestamps, preprocess the Automatic Identification System (AIS) data, and extract encounter trajectory data from it. Step S2: Visualize the extracted encounter trajectory data according to the different densities within a unit area, and select the ship encounter interaction feature dataset according to the density. Step S3: Perform pooling on the hidden states of adjacent ships within a predefined spatial distance threshold of the target ship, integrate the pooled information into the input of the Long Short-Term Memory (LSTM) network, construct a ship encounter trajectory prediction model based on Encounter-LSTM, and reconstruct the loss function Loss. Step S4: Train the ship encounter trajectory prediction model based on the dataset; Step S5: Use the trained ship encounter trajectory prediction to predict the trajectory in the encounter scenario.
[0005] Furthermore, the extraction of the encounter trajectory data in step S1 further comprises: Step S11: Sort the pre-processed Automatic Identification System (AIS) data in ascending order according to location and time, construct the Traji path status time series of various vessels under spatiotemporal constraints, and obtain the position between two vessels. Step S12: Select a 5-minute interval from the constructed ship path status time series and extract the ship's navigation data within that interval. Step S13: Interpolate the data based on the vessel identification number to ensure that each vessel has one AIS data record per minute; Step S14: Traverse each time slice and calculate the relative distance matrix between trajectories; Step S15: Output information on possible ships and their corresponding time slices, retrieve the data of the trajectories before and after the encounter scene, and save them to the corresponding database. Step S16: Use the nearest point of encounter (CPA) algorithm to verify the ship encounter situation in the database.
[0006] Furthermore, the navigation data includes the vessel identification number, timestamp, latitude and longitude position, speed, and heading information.
[0007] Furthermore, the calculation of the relative distance matrix between trajectories in step S14 is further as follows: trajectories within the same time slice are traversed, and based on the latitude and longitude position information of the ships in that time slice, the spatial distance between any two ship trajectories is calculated using a spherical distance calculation model; a relative distance matrix is constructed using all ships in the same time slice as rows and columns, where each element in the matrix represents the relative distance between two corresponding ships in that time slice, and when the two ships are the same ship, the corresponding matrix element takes a zero value, thereby obtaining a trajectory relative distance matrix used to identify potential encounter relationships.
[0008] Furthermore, the construction of the Traji path state time series of various ships under spatiotemporal constraints to obtain the position between two ships further involves: The formula for the path state time series is Traji = {p0, p1, p2, …pt}, where i represents the i-th ship, and p = (mmsi, lon, lat, cog, sog). The bearing angle C and distance D between the two ships are determined by applying the method of calculating the bearing distance using the constant heading line. The calculation process is based on the following formula: ; ; In the above formula, This represents the difference in longitude between corresponding trajectory points of two ships within the same time slice; Δq represents the difference in the rate of latitude change between points A and B; SLati refers to the meridian distance from the equator to a point; and r1 is the radius of the isotropic circle at latitude Lat1. This represents the latitude difference between corresponding trajectory points of two ships within the same time slice; This term is used to correct the latitudinal distance component to the actual sailing distance along the course, and is a commonly used correction term in course distance calculations; in the above formula, S Lati The expression is as follows: ; In the above formula: a is the length of the semi-major axis of the Earth's ellipsoid; e is the eccentricity. The formula for calculating the difference in latitude asymmetry rate Δq between A and B is shown below: ; The radius r1 of the isotropic circle at latitude Lat1 is: ; Furthermore, the loss function Loss is composed of , , Composition, in which It is the Euclidean distance between the predicted location and the actual location: ; Where: (x, y) and ( ) represent the actual location and the predicted location at the corresponding time, respectively. The trajectory consists of n scattered points, and the coordinates of these points are represented as (xi,yi), where i=1,2,…,n; Second error This is used to represent the error in curvature between the predicted trajectory and the actual trajectory. As is well known, a ship's trajectory is a curve, and the predicted trajectory curve should also remain relatively smooth. The velocity and acceleration at each point are approximated using the difference formula. For the i-th point, the velocity components are calculated using the two points before and after it: , The accelerations are as follows: , The formula for calculating the trajectory curvature is: ; The third error This represents the average Euclidean distance difference between the predicted trajectory endpoint and the actual trajectory endpoint, and can reasonably evaluate the reachability of the predicted trajectory endpoint. The formula is: ; The weight parameter represents the weight of the error in the loss function, satisfying the following condition: The reconstructed loss function is shown in the following formula: ; Furthermore, the model includes an input layer, an attention mechanism layer, a first-layer Long Short-Term Memory (LSTM) network, a pooling layer, a second-layer LSTM network, and a fully connected layer; The input layer receives the navigation feature sequences of the ship and the encountering ships at each time step; the attention mechanism layer performs weighted processing on the features at different time steps in the time series to highlight the key information that has an important impact on the trajectory evolution; the weighted sequence features are input into the first layer of the Long Short-Term Memory (LSTM) network to model the local temporal dependencies of the ship's navigation trajectory. The hidden states of the current ship and the encountered ship output by the first layer of the Long Short-Term Memory (LSTM) network are merged through feature fusion to form a joint hidden layer representation, which is then passed to the pooling layer. The time-dimensional pooling operation is used to achieve feature dimensionality reduction and compression of redundant information. The pooled data then enters the second LSTM layer to learn the global temporal features of ship interaction behavior in the encounter scenario. Finally, the ht containing global hidden information is sent to the fully connected layer to obtain the predicted longitude and latitude data.
[0009] The beneficial effects of this invention are as follows: This invention develops a trajectory prediction model and method for encounter scenarios involving coastal merchant and fishing vessels. It utilizes LSTM technology for trajectory prediction during vessel encounters. By integrating navigation data from surrounding vessels, the trajectory prediction model and method enhance the accuracy of trajectory prediction when vessels meet. Through the extraction and training of multi-vessel encounter trajectory data, it can effectively predict future vessel paths and demonstrates good prediction accuracy under different encounter scenarios. The vessel trajectory prediction performance considering encounter scenarios in this invention is generally superior to traditional trajectory prediction methods, especially in waters with dense traffic flow or complex encounter situations, where the model exhibits strong stability and accurate prediction capabilities. Attached Figure Description
[0010] Figure 1 A flowchart for extracting multi-ship encounter trajectory data; Figure 2 Visualization of ship encounter data; Figure 3 A visualization of the density of the encounter trajectory data; Figure 4 A model diagram of ship trajectories to take into account encounter situations; Figure 5 Diagram illustrating the mechanism for sharing hidden layer information on the tracks of encountered vessels; Figure 6 A model diagram of ship trajectories to take into account encounter situations; Figure 7 LSTM module model diagram; Figure 8 This is a schematic diagram of a dataset showing encounters at confluence waterways. Figure 9 This is a schematic diagram of six sets of encounter trajectory datasets at the converging waters; Figure 10This is a graph showing the decrease in the loss function; Figure 11 This is a graph showing the increase in accuracy. Figure 12 A comparison chart showing the performance of LSTM and GRU in single-step cyclic prediction versus direct multi-step prediction; Figure 13 A visualization of the predicted test encounter trajectories for two sets of test routes in the inner channel lane change zone; Figure 14 A visualization of the predicted trajectories of two sets of test encounters in the nearshore waters of Lianjiang East; Figure 15 A visualization of the predicted test trajectories for two sets of entrances and exits at Sansha Bay; Figure 16 A visualization of the evaluation indicators. Detailed Implementation
[0011] The invention will now be further described with reference to the accompanying drawings.
[0012] Please see Figures 1 to 16 The present invention provides an embodiment: a trajectory prediction method for encounters between coastal merchant and fishing vessels, characterized in that the method includes the following steps: Step S1: Extract ship travel information from historical records based on timestamps, preprocess the Automatic Identification System (AIS) data, and extract encounter trajectory data from it. Step S2: Visualize the extracted encounter trajectory data according to the different densities within a unit area, and select the ship encounter interaction feature dataset according to the density. Step S3: Perform pooling on the hidden states of adjacent ships within a predefined spatial distance threshold of the target ship, integrate the pooled information into the input of the Long Short-Term Memory (LSTM) network, construct a ship encounter trajectory prediction model based on Encounter-LSTM, and reconstruct the loss function Loss. Step S4: Train the ship encounter trajectory prediction model based on the dataset; Step S5: Use the trained ship encounter trajectory prediction to predict the trajectory in the encounter scenario.
[0013] Please continue reading. Figure 1 As shown, in one embodiment of the present invention, the extraction of the encounter trajectory data in step S1 further comprises: Step S11: Sort the pre-processed Automatic Identification System (AIS) data in ascending order according to location and time, construct the Traji path status time series of various vessels under spatiotemporal constraints, and obtain the position between two vessels. Step S12: Select a 5-minute interval from the constructed ship path status time series and extract the ship's navigation data within that interval. Step S13: Interpolate the data based on the vessel identification number to ensure that each vessel has one AIS data record per minute; Step S14: Traverse each time slice and calculate the relative distance matrix between trajectories; Step S15: Output information on possible ships and their corresponding time slices, retrieve the data of the trajectories before and after the encounter scene, and save them to the corresponding database. Step S16: Use the nearest point of encounter (CPA) algorithm to verify the ship encounter situation in the database.
[0014] Please continue reading. Figure 1 As shown, in one embodiment of the present invention, the navigation data includes ship identification number, timestamp, latitude and longitude position, speed and heading information.
[0015] Please continue reading. Figure 1 As shown, in one embodiment of the present invention, the calculation of the relative distance matrix between trajectories in step S14 is further described as follows: trajectories within the same time slice are traversed, and based on the latitude and longitude position information of the ships in the time slice, the spatial distance between any two ship trajectories is calculated using a spherical distance calculation model; a relative distance matrix is constructed using all ships in the same time slice as rows and columns, where each element in the matrix represents the relative distance between two corresponding ships in the time slice, and the corresponding matrix element takes a zero value when the two ships are the same ship, thereby obtaining a trajectory relative distance matrix for identifying potential encounter relationships.
[0016] Please continue reading. Figure 1 As shown, in one embodiment of the present invention, the step of constructing the Traji path state time series of various ships under spatiotemporal constraints to obtain the position between two ships further comprises: The formula for the path state time series is Traji = {p0, p1, p2, …pt}, where i represents the i-th ship, and p = (mmsi, lon, lat, cog, sog). The bearing angle C and distance D between the two ships are determined by applying the method of calculating the bearing distance using the constant heading line. The calculation process is based on the following formula: ; ; In the above formula, This represents the difference in longitude between corresponding trajectory points of two ships within the same time slice; Δq represents the difference in the rate of latitude change between points A and B; SLati refers to the meridian distance from the equator to a point; and r1 is the radius of the isotropic circle at latitude Lat1. This represents the latitude difference between corresponding trajectory points of two ships within the same time slice; This term is used to correct the latitudinal distance component to the actual sailing distance along the course, and is a commonly used correction term in course distance calculations; in the above formula, S Lati The expression is as follows: ; In the above formula: a is the length of the semi-major axis of the Earth's ellipsoid; e is the eccentricity. The formula for calculating the difference in latitude asymmetry rate Δq between A and B is shown below: ; The radius r1 of the isotropic circle at latitude Lat1 is: ; Please continue reading. Figure 5 As shown, in one embodiment of the present invention, the loss function Loss is... , , Composition, in which It is the Euclidean distance between the predicted location and the actual location: ; Where: (x, y) and ( ) represent the actual location and the predicted location at the corresponding time, respectively. The trajectory consists of n scattered points, and the coordinates of these points are represented as (xi,yi), where i=1,2,…,n; Second error This is used to represent the error in curvature between the predicted trajectory and the actual trajectory. As is well known, a ship's trajectory is a curve, and the predicted trajectory curve should also remain relatively smooth. The velocity and acceleration at each point are approximated using the difference formula. For the i-th point, the velocity components are calculated using the two points before and after it: , The accelerations are as follows: , The formula for calculating the trajectory curvature is: ; The third error This represents the average Euclidean distance difference between the predicted trajectory endpoint and the actual trajectory endpoint, and can reasonably evaluate the reachability of the predicted trajectory endpoint. The formula is: ; The weight parameter represents the weight of the error in the loss function, satisfying the following condition: The reconstructed loss function is shown in the following formula: ; Please continue reading. Figures 4 to 6 As shown, in one embodiment of the present invention, the model includes an input layer, an attention mechanism layer, a first long short-term memory (LSTM) network layer, a pooling layer, a second LSTM layer, and a fully connected layer. The input layer receives the navigation feature sequences of the ship and the encountering ships at each time step; the attention mechanism layer performs weighted processing on the features at different time steps in the time series to highlight the key information that has an important impact on the trajectory evolution; the weighted sequence features are input into the first layer of the Long Short-Term Memory (LSTM) network to model the local temporal dependencies of the ship's navigation trajectory. The hidden states of the current ship and the encountered ship output by the first layer of the Long Short-Term Memory (LSTM) network are merged through feature fusion to form a joint hidden layer representation, which is then passed to the pooling layer. The time-dimensional pooling operation is used to achieve feature dimensionality reduction and compression of redundant information. The pooled data then enters the second LSTM layer to learn the global temporal features of ship interaction behavior in the encounter scenario. Finally, the ht containing global hidden information is sent to the fully connected layer to obtain the predicted longitude and latitude data. Specific Implementation Example 1:
[0017] In this embodiment, the experiment selected data from waters where encounters occurred frequently to train the model. The data used came from the coastal area of Fujian, where the marine environment is very complex, covering straight channels, branch channels, and junctions. Figure 2 The collected encounter trajectory data is displayed.
[0018] Ship travel information is extracted from historical records based on timestamps, and a time series of path states for various types of ships is constructed under spatiotemporal constraints: Traji = {p0, p1, p2, …pt}, where i represents the i-th ship, and p = (mmsi, lon, lat, cog, sog). Assuming there are two ships, their positions represented by latitude and longitude coordinates A(Lon1, Lat1) and B(Lon2, Lat2), respectively, the azimuth C and distance D between these two ships can be determined by applying the method of calculating the azimuth distance of the constant-heading line. The formulas used in the calculation process are detailed in (4-1) and (4-2): ; ; In the above formula, This represents the difference in longitude between corresponding trajectory points of two ships within the same time slice; Δq represents the difference in the rate of latitude change between points A and B; SLati refers to the meridian distance from the equator to a point; and r1 is the radius of the isotropic circle at latitude Lat1. This represents the latitude difference between corresponding trajectory points of two ships within the same time slice; This term is used to correct the latitudinal distance component to the actual sailing distance along the course, and is a commonly used correction term in course distance calculations; in the above formula, S Lati The expression is as follows: ; In the above formula: a is the length of the semi-major axis of the Earth's ellipsoid; e is the eccentricity.
[0019] The formula for calculating the difference in latitude asymmetry rate Δq between A and B is shown in (4-4): ; The radius r1 of the isotropic circle at latitude Lat1 is: ; First, historical Automatic Identification System (AIS) data is preprocessed, sorted in ascending order by location and time, and 5-minute intervals are selected to extract vessel navigation data within each interval. Then, the data is interpolated based on the vessel identification number to ensure that each vessel has one AIS data record per minute. Next, each time slice is traversed, and the relative distance matrix between trajectories is calculated. Then, information on potentially encountering vessels and their corresponding time slices is output, and data on the trajectories before and after these encounter scenarios is retrieved and saved to the corresponding database. Finally, the nearest encounter point (CPA) algorithm is used to verify the vessel encounter situation in the database. The algorithm flowchart is shown below. Figure 1 The collected encounter trajectory data is as follows: Figure 2 exhibit.
[0020] This embodiment visualizes the extracted trajectory data according to the different densities within a unit area, and extracts trajectory data from areas with high encounter density to establish a ship trajectory prediction model under encounter situations. Figure 3 It involves visualizing the density of trajectory data and selecting a dataset of ship encounter and interaction features based on the density level to feed into the model for training.
[0021] The trajectory prediction problem when multiple ships meet is defined as follows: Assume that at the current time t, there are n ships in a certain body of water, denoted by the set S = {si | i = 1, 2, ..., n}. Let p represent the trajectory information of any ship at time t. i =(lon) i t ,lat i t,cog i t ,sog i t The trajectory observed by any ship at time t is denoted as Traj. i ={p0,p1,p2,…p t The trajectory prediction problem involves constructing the future path Traji={pt+1,pt+2,pt+3,…pt+m} for each ship at time t, based on the observed trajectory information of all ships. This path covers the next m positions and aims to predict the trajectories when multiple ships meet, while also considering the avoidance maneuvers between ships.
[0022] Multi-ship trajectory prediction in encounter scenarios essentially considers the relative positions of the ship and other ships. It involves feeding the trajectories of surrounding vessels along with the ship's own trajectory into the model for training, allowing the model to learn more information from the data that influences the ship's future trajectory, thus enabling more accurate predictions of future positions. While LSTM models are used to build multi-ship encounter trajectory prediction models, each ship's historical trajectory is represented by a separate LSTM block. However, LSTM models cannot account for potential interactions between encountering ships. Therefore, this paper builds a new multi-ship encounter prediction model based on classic single-ship trajectory prediction models such as LSTM and GRU. Figure 4 As shown.
[0023] To effectively model the complex interactions during ship encounters, a Multiple Encounter Social Pooling (MESP) mechanism is proposed. Assume there is a specific ship, such as... Figure 5 As shown, these are represented by black dots in the model framework. For this target vessel, the focus is on aggregating the hidden states of neighboring vessels within a predefined spatial distance threshold. These neighboring vessels are represented in the visualization by yellow, blue, and orange, respectively.
[0024] The multi-encounter social pooling operation aims to perform pooling on the hidden states of these adjacent vessels. This pooling process is crucial because it allows the model to preserve some spatial relationships between adjacent vessels, which is vividly demonstrated in the last two steps of the model-based visualization. By integrating the pooled information into the input of a Long Short-Term Memory (LSTM) network, the model of this invention can efficiently capture the influence of surrounding vessels on the trajectory of the target vessel. This approach not only enhances the model's ability to handle complex social-spatial interactions in the maritime domain but also provides a more comprehensive and accurate representation of vessel encounters, which is essential for applications such as ship traffic prediction and collision avoidance.
[0025] The constructed model comprises an input layer, an attention mechanism layer, a first Long Short-Term Memory (LSTM) layer, a pooling layer, a second LSTM layer, and a fully connected layer. By integrating ship-related datasets, the model's feature dimensions are expanded, leading to a significant increase in computational complexity. The input layer receives the navigation feature sequences of the ship and encountering ships at each time step; the attention mechanism layer weights the features at different time steps in the time series to highlight key information that significantly influences trajectory evolution; the weighted sequence features are input to the first LSTM layer to model the local temporal dependencies of the ship's navigation trajectory. The LSTM layer has the ability to process sequence data and can uncover the inherent connections between data at different time points in the time series; the pooling layer effectively alleviates overfitting by reducing data dimensionality. To incorporate information such as the speed and relative position of encountering vessels into the factors influencing future trajectories, and thus better capture the dynamic relationships and spatial constraints of vessels during encounters, this model merges the hidden state of the current vessel and the encountering vessel into a single hidden state vector. This hidden state data is then passed to a pooling layer to achieve dimensionality reduction and reduce computational cost. The hidden states of the current vessel and the encountering vessel output from the first LSTM layer are merged through feature fusion to form a joint hidden state representation, which is then passed to the pooling layer. Temporal pooling operations are used to reduce feature dimensionality and compress redundant information. The pooled data then enters the second LSTM layer to learn the global temporal features of vessel interaction behavior in encounter scenarios. Finally, the ht containing global hidden information is sent to a fully connected layer, which obtains the predicted longitude and latitude data, such as... Figure 6 and Figure 7 As shown.
[0026] The key to improving the robustness and generalization ability of deep neural networks lies in the loss function used when training the neural model. In previous trajectory prediction based on neural networks, the loss function (Loss) was usually defined as the Euclidean distance between the predicted and actual positions, i.e.: ; Where (x, y) and ( The numbers () represent the actual location and the predicted location at the corresponding time, respectively. Clearly, this simple loss function only describes the offset distance between the predicted and actual points. Offset direction, trajectory curvature, and destination reachability cannot be simply measured using this loss function. Therefore, it is necessary to reconstruct the loss function to incorporate the directional relationship between the actual and predicted locations, as well as destination reachability.
[0027] Based on the foregoing description, the trajectory consists of n scattered points, whose coordinates are represented as (xi, yi), where i = 1, 2, ..., n. The reconstructed loss function is... , , Composition. Among them... It is the Euclidean distance between the predicted location and the actual location: ; Second error This is used to represent the error in curvature between the predicted trajectory and the actual trajectory. As is well known, a ship's trajectory is a curve, and the predicted trajectory curve should also remain relatively smooth. The velocity and acceleration at each point are approximated using the difference formula. For the i-th point, the velocity components are calculated using the two points before and after it: , The accelerations are as follows: , The formula for calculating the trajectory curvature is shown in (4-8): ; The third error The average Euclidean distance difference between the predicted trajectory endpoint and the actual trajectory endpoint can be used to reasonably evaluate the reachability of the predicted trajectory endpoint, as shown in formula (4-9): ; The weight parameter represents the weight of the error in the loss function, satisfying the following condition: The reconstructed loss function is shown in the following formula: ; In regression analysis, predicting ship trajectories is a crucial task. MSE (Mean Squared Error), the most commonly used loss function, primarily calculates the sum of squared differences between predicted and actual values. MAE, on the other hand, is a loss function for another regression model. It assesses the sum of absolute differences between the target and predicted values, focusing on the average magnitude of the prediction error without considering its directionality. Combining these two metrics improves the detection of deviations between model predictions and actual values, thus providing a more accurate evaluation of the model's fit.
[0028] ; ; Previous studies using one or two indicators to measure the performance of prediction methods when evaluating models were prone to introducing bias, so four new evaluation indicators were added.
[52] These six metrics include SMAPE, FDE, FD, and AED. SMAPE is presented as a percentage and is unrelated to scale, making it suitable for comparing prediction results at different scales. FDE represents the average Euclidean distance difference between the predicted and actual endpoint locations, reasonably assessing model error accumulation. FD considers path spatial distance to describe the similarity of path spaces. AED measures the average distance between two trajectories in space. These six metrics comprehensively evaluate the quality of model prediction results from different perspectives; the smaller the calculated value of each metric, the better the prediction performance of the method.
[0029] ; ; ; ; Where p i and r i These are the prediction and the actual result for the i-th point, respectively. i (lon) and p i (lat) represents the longitude and latitude of the i-th prediction point, respectively. i (lon) and r i (lat) represents the longitude and latitude of the i-th real sample trajectory point, respectively. n is the number of trajectory points in the test sample.
[0030] We selected real AIS datasets from three sea areas with different geographical features and compared the prediction methods in sea areas with different encounter characteristics. For example... Figure 8 As shown, the first dataset is a lane-changing area on the main channel from Guanbei Island to the Minjiang Estuary. This area is a crucial vessel turning point in the nearshore waters of Lianjiang East on the main channel from Guanbei Island to the Minjiang Estuary. Located between Haiwei Cape and Douyu Island, this area has a high density of fishing nets, resulting in frequent shipwrecks and collisions with reefs. It is a complex intersection and encounter zone with a wide distribution and high traffic density. The collision and conflict patterns are dense and clearly defined here; therefore, this location was chosen as the first dataset to verify the effectiveness of vessel trajectory prediction during encounters.
[0031] The second dataset represents typical reef waters with complex traffic flow and natural environment. Furthermore, it features high traffic density from merchant and fishing vessels, frequent encounters, and a high risk of maritime accidents (such as collisions and groundings). Therefore, this location was chosen as the second dataset to compare the effectiveness of vessel trajectory prediction.
[0032] The third dataset was selected at the entrance and exit of Sansha Bay, the only entry and exit point for fishermen in Sansha Bay. The waterway is restricted by Jigongshan and the reefs to the south, creating a bottleneck area with high vessel traffic. Encounters and conflicts between merchant and fishing vessels are significant in this area, especially near the inland waterway, where the conflict issues are particularly pronounced. During the fishing season, numerous fishing vessels travel through the area, and the geographical characteristics lead to frequent encounters. The presence of reefs and islands places higher demands on vessel operators, resulting in significant collision avoidance maneuvers. Therefore, this location was chosen as the third dataset to verify the accuracy of vessel trajectory prediction under different encounter conditions. Specific dataset information is shown in Table 1. Table 1 Information on the three experimental datasets
[0033] During model training, the dataset was divided into two parts: 80% for training and 20% for testing. Furthermore, six sets of encounter data, totaling 12 trajectories, were selected from the test set across three water areas to visualize, compare, and analyze the prediction performance. Before conducting the formal experiments, this study preprocessed the original three datasets (i.e., outlier removal, trajectory interpolation, etc.) to ensure data availability and model training quality. ] .
[0034] When selecting six sets of encounter test trajectory data, various features under different sea areas and encounter scenarios should be included for visualization analysis. Therefore, some representative trajectories were selected from three datasets as test datasets for subsequent prediction performance comparison. Six sets of ship encounter trajectories with different key features were selected, with MMSI values of 413088709 and 413556850, 413231220 and 413264020, 413445430 and 412441409, 412061981 and 312148000, 412521518 and 412322110, and 374080000 and 100900487 (experiments numbered 1-6 below). Figure 9 The red lines represent ship trajectories selected from the dataset. Subsequent experiments will visualize these predicted trajectories to compare their effectiveness in different encounter scenarios.
[0035] All numerical experiments in this study were conducted on an NVIDIA Ge Force RTX 3090Ti GPU, 24GB of RAM, and a 64-bit Windows 10 operating system. Model parameter settings included a batch size of 64, 128 hidden layer neurons, a Drought layer parameter of 0.3, 300 training epochs, and the Adam optimizer with a learning rate of 0.001. The experiments used 10 time intervals, each lasting 1 minute, inputting the trajectories from the initial 10 observation times. The goal was to predict the ship's trajectory for the next 10 time intervals. All algorithms were implemented in Python 3.9, using the same dataset and test set for the different models. Table 2 lists the relevant hyperparameters, which were consistent across the eight deep learning models used in the experiments to ensure comparability of results. An early stopping mechanism was implemented during training. The model was considered convergent when the learning rate decreased to less than 10⁻⁶ or the model's performance did not improve after 10 consecutive iterations, at which point training automatically stopped. Experimental parameters are shown in Table 2 below. Table 2 Parameter settings during model training
[0036] In this experiment, the Encounter-LSTM model training loss function decreased and the accuracy increased as follows: Figure 10 , Figure 11 As shown: from Figure 10 The loss function decline curve shows that the model's loss value is high in the early stages of training, but decreases significantly with each epoch, eventually stabilizing. This indicates that the model learns relatively effective feature representations in the early stages and continuously optimizes its parameters with each iteration, causing the loss function to gradually converge. The loss value decreases rapidly, especially in the first 50 training epochs, suggesting that the model has learned crucial features in the early stages. The slower decline in the later stages indicates that the model has converged, and further optimization yields less benefit.
[0037] At the same time, from Figure 11 The model's accuracy curve shows that the accuracy is low in the initial stage, but increases rapidly as training progresses and eventually stabilizes. The increasing accuracy corresponds to the decreasing loss curve, indicating that the model's classification or prediction ability gradually improves as the parameters are continuously adjusted. After a certain number of training epochs, the accuracy remains at a relatively high level, indicating that the model has learned relatively stable feature representations and possesses good generalization ability.
[0038] Throughout the training process, the Encounter-LSTM model quickly learned the data patterns in the early stages of training, demonstrating good convergence. In the later stages of training, the model's performance stabilized, the rate of loss reduction decreased, and the accuracy approached saturation, indicating that the model's learning on the current dataset was close to optimal.
[0039] At this stage, continuously increasing the number of training iterations may not lead to significant performance improvements and could even result in overfitting. Therefore, in practical applications, it is necessary to select an appropriate number of training iterations based on the performance on the validation or test sets to ensure optimal generalization ability of the model.
[0040] The experiment compared two schemes in multi-step trajectory prediction: one was cyclic single-step prediction, which predicted the position, speed, and heading for the next time step before continuing the prediction; the other was to directly predict the position for the next 10 steps. Each method has its advantages and disadvantages. Overall, direct multi-step prediction performed better than cyclic single-step prediction. However, cyclic single-step prediction had higher accuracy in the first few steps, but the error increased significantly later. This is because cyclic single-step prediction requires predicting the heading and speed together, and these errors also affect the position prediction. Furthermore, these errors propagate during cyclic prediction, ultimately leading to increasingly larger errors in later steps, resulting in poor prediction performance. Figure 12 As shown.
[0041] To further compare the trajectory prediction performance of different methods and identify their respective advantages and disadvantages, the prediction results of the six sets of encounter trajectories used for testing are visualized as follows: Figure 13 , Figure 14 and Figure 15 As shown below. Figure 13 , Figure 14 and Figure 15 In the diagram, solid blue lines depict historical paths, while dashed blue lines represent the actual paths to be predicted. Paths predicted using different methods are distinguished by different colors: LSTM models are represented by solid black lines, Bi-LSTM models by solid green lines, Single-LSTM models by solid pink lines, and Encounter-LSTM models by solid red lines. Trajectories predicted by GRU models are represented by solid brown lines, Bi-GRU models by solid orange lines, Single-GRU models by solid purple lines, and Encounter-GRU models by solid yellow lines.
[0042] Figure 13This is the prediction effect of two sets of encounter trajectory data in the channel change zone of Data Set 1. This area has many reefs, islands and fishing nets, and the ship trajectory is arc-shaped along the channel. The encounter situation is usually manifested as a face-to-face encounter or a small-angle intersection. The two prediction methods are compared with the ship trajectory prediction considering the encounter scenario. The prediction effect is shown in the figure below. It can be clearly seen that the ship trajectory prediction effect considering the encounter scenario is generally better than the traditional trajectory effect.
[0043] Encounters typically include types such as oncoming, overtaking, and large-angle intersections, such as... Figure 14 As shown.
[0044] The situations encountered are usually in patterns such as meeting and overtaking, such as... Figure 15 As shown.
[0045] To further evaluate the prediction performance of different trajectory prediction methods, Table 3 summarizes the results of six evaluation metrics for the training methods of eight ship data prediction models under various encounter scenarios. The decrease in the values of each metric reflects the optimization of the prediction results. From the evaluation metrics perspective, after considering the encounter scenario, both LSTM and GRU outperform the traditional LSTM and GRU in terms of ship trajectory evaluation metrics. The trajectory prediction model, by taking into account the positional information of surrounding ships, can better capture the relative position information of ships for predicting future trajectories. Changes in heading and speed caused by avoidance behavior during encounters directly affect the future position information of ships. The ship trajectory prediction considering encounters uses six evaluation metrics to quantitatively demonstrate its unique advantages in waters with dense traffic flow or similarly complex encounter situations. This is of great significance for avoiding ship collisions and the navigation of unmanned vessels.
[0046] Table 3 Results of the six evaluation indexes in the FJ water area. Trajs Index LSTM GRU E-LSTM E-GRU BI-LSTM BI-GRU Single-LSTM Single-GRU Group1 MSE( / 102) 0.000565 0.00155 0.000151 0.000442 0.00067 0.0093 0.00164 0.001902 MAE 0.002 0.0034 0.0009 0.0008 0.00179 0.0084 0.0029 0.0032 SMAE 0.0025 0.004 0.000025 0.000024 0.00232 0.0098 0.0042 0.0047 FDE 0.004 0.0087 0.00227 0.0039 0.004 0.019 0.0146 0.0156 FD 0.0092 0.0166 0.00655 0.0103 0.0148 0.039 0.0119 0.0126 AED 0.0073 0.012 0.00337 0.0059 0.0064 0.028 0.0047 0.00502 Group2 MSE( / 102) 0.00312 0.0038 0.000121 0.00099 0.0032 0.00095 0.0011 0.001 MAE 0.0036 0.0039 0.0022 0.0021 0.0036 0.0020 0.007 0.00669 SMAE 0.005 0.0054 0.0000613 0.000051 0.005 0. 00106 0.013 0.0131 FDE 0.01 0.015 0.0072 0.0063 0.0114 0.00187 0.038 0.0348 FD 0.031 0.0332 0.02 0.016 0.034 0.0046 0.03420.011 0.03 AED 0.013 0.016 0.0083 0.0079 0.0133 0.0028 0.011 0.0117 Group3 MSE( / 102) 0.0011 0.0018 0.000445 0.00027 0.00097 0.00633 0.0053 0.00289 MAE 0.0027 0.0029 0.0016 0.00127 0.0025 0.0069 0.0056 0.00423 SMAE 0.0059 0.0059 0.000038 0.000026 0.0053 0.013 0.0081 0.006 FDE 0.0065 0.0095 0.0046 0.0035 0.007 0.0167 0.018 0.0148 FD 0.013 0.0235 0.0105 0.0066 0.0134 0.037 0.019 0.0169 AED 0.0095 0.0112 0.00603 0.0047 0.0092 0.023 0.0095 0.0064 Group4 MSE( / 102) 0.000577 0.0032 0.00034 0.00058 0.00083 0.0045 0.00101 0.00688 MAE 0.0021 0.0051 0.00155 0.00061 0.0022 0.0064 0.0025 0.0069 SMAE 0.00876 0.0214 0.00031 0.000153 0.01 0.026 0.0095 00224 FDE 0.0044 0.0108 0.003 0.00193 0.005 0.0089 0.00692 0.0266 FD 0.0086 0.0237 0.0079 0.0032 0.0144 0.027 0.0072 0.0208 AED 0.0075 0.0173 0.00566 0.0023 0.0082 0.02 0.00407 0.00101 Group5 MSE( / 102) 0.000255 0.00076 0.000229 0.000176 0.00046 0.00017 0.00167 0.000725 MAE 0.0013 0.00223 0.0012 0.00088 0.001 0.0014 0.0035 0.002 SMAE 0.0031 0.00596 0.000265 0.00018 0.0043 0.003 0.008 0.0043 FDE 0.0024 0.0055 0.00366 0.00381 0.0033 0.004 0.011 0.0055 FD 0.007 0.011 0.006 0.00551 0.0085 0.0054 0.009 0.0103 AED 0.0047 0.00835 0.00465 0.00369 0.0063 0.0054 0.005 0.0033 Group6 MSE( / 102) 0.00325 0.00586 0.000105 0.000305 0.0021 0.0033 0.00366 0.00089 MAE 0.004 0.0061 0.00079 0.00136 0.0037 0.0046 0.0047 0.0025 SMAE 0.017 0.021 0.00016 0.000267 0.013 0.0137 0.011 0.0012 FDE 0.011 0.016 0.00208 0.00298 0.0095 0.013 0.01 0.011 FD 0.031 0.0335 0.00406 0.00868 0.021 0.023 0.0138 0.0036 AED 0.015 0.023 0.0031 0.005 0.012 0.017 0.0076 0.003 Figure 16The visualization results of different evaluation indicators are presented. It can be seen that among the six sets of encounter trajectory data for the six evaluation indicators, Single-LSTM and Single-GRU have the largest prediction index values (i.e., the largest error rates). This is because during cyclic prediction, the ship's speed and heading need to be predicted simultaneously before the next position can be predicted. This leads to error accumulation during cyclic prediction, resulting in larger position errors in later steps, which affects the final evaluation index value during error statistics. Ecounter-LSTM and Ecounter-GRU have the best prediction performance and are insensitive to curved trajectories during turns or collision avoidance, demonstrating high robustness in practical applications. Comprehensive analysis shows that the ship trajectory prediction of this invention, after incorporating the position information of surrounding ships, exhibits excellent prediction accuracy in both simple and complex behavioral characteristic stages. It is particularly suitable for waters where encounter scenarios occur frequently.
[0047] This invention operates on the following principle: It utilizes LSTM technology for trajectory prediction of encounters between merchant and fishing vessels. The trajectory prediction model and method enhance the accuracy of trajectory prediction when vessels meet by integrating navigation data from surrounding vessels. Through the extraction and training of multi-vessel encounter trajectory data, it can effectively predict future vessel paths and demonstrates good prediction accuracy in various encounter scenarios. The vessel trajectory prediction method in this invention, which considers encounter scenarios, generally outperforms traditional trajectory prediction methods, especially in waters with dense traffic flow or complex encounter situations, where the model exhibits strong stability and accurate prediction capabilities.
[0048] The above description is only a preferred embodiment of the present invention and should not be construed as a limitation of this application. All equivalent changes and modifications made in accordance with the scope of the patent application of the present invention should be covered by the present invention.
Claims
1. A trajectory prediction method for encounters between coastal merchant and fishing vessels, characterized in that: The method includes the following steps: Step S1: Extract ship travel information from historical records based on timestamps, preprocess the Automatic Identification System (AIS) data, and extract encounter trajectory data from it. Step S2: Visualize the extracted encounter trajectory data according to the different densities within a unit area, and select the ship encounter interaction feature dataset according to the density. Step S3: Perform pooling on the hidden states of adjacent ships within a predefined spatial distance threshold of the target ship, integrate the pooled information into the input of the Long Short-Term Memory (LSTM) network, construct a ship encounter trajectory prediction model based on Encounter-LSTM, and reconstruct the loss function Loss. Step S4: Train the ship encounter trajectory prediction model based on the dataset; Step S5: Use the trained ship encounter trajectory prediction to predict the trajectory in the encounter scenario.
2. The trajectory prediction method for coastal merchant and fishing vessel encounters according to claim 1, characterized in that: The extraction of the encounter trajectory data in step S1 further includes: Step S11: Sort the pre-processed Automatic Identification System (AIS) data in ascending order according to location and time, construct the Traji path status time series of various vessels under spatiotemporal constraints, and obtain the position between two vessels. Step S12: Select a 5-minute interval from the constructed ship path status time series and extract the ship's navigation data within that interval. Step S13: Interpolate the data based on the vessel identification number to ensure that each vessel has one AIS data record per minute; Step S14: Traverse each time slice and calculate the relative distance matrix between trajectories; Step S15: Output information on possible ships and their corresponding time slices, retrieve the data of the trajectories before and after the encounter scene, and save them to the corresponding database. Step S16: Use the nearest point of encounter (CPA) algorithm to verify the ship encounter situation in the database.
3. The trajectory prediction method for coastal merchant and fishing vessels encountering each other, as described in claim 2, is characterized in that: The navigation data includes the vessel identification number, timestamp, latitude and longitude position, speed, and heading information.
4. The trajectory prediction method for coastal merchant and fishing vessel encounter scenarios according to claim 2, characterized in that: The calculation of the relative distance matrix between trajectories in step S14 is further as follows: Trajectory points within the same time slice are traversed, and the spatial distance between any two ship trajectories is calculated using a spherical distance calculation model based on the latitude and longitude position information of the ship in the time slice; a relative distance matrix is constructed with all ships in the same time slice as rows and columns, and each element in the matrix represents the relative distance between two corresponding ships in the time slice. When the two ships are the same ship, the corresponding matrix element takes a zero value, thereby obtaining the trajectory relative distance matrix used to identify potential encounter relationships.
5. The trajectory prediction method for coastal merchant and fishing vessels encountering each other according to claim 1, characterized in that: The Traji algorithm, which constructs path state time series of various ships under spatiotemporal constraints, further obtains the position between two ships by: The formula for the path state time series is Traji = {p0, p1, p2, …pt}, where i represents the i-th ship, and p = (mmsi, lon, lat, cog, sog). The bearing angle C and distance D between the two ships are determined by applying the method of calculating the bearing distance using the constant heading line. The calculation process is based on the following formula: ; ; In the above formula, This represents the difference in longitude between corresponding trajectory points of two ships within the same time slice; Δq represents the difference in the rate of latitude change between points A and B; SLati refers to the meridian distance from the equator to a point; and r1 is the radius of the isotropic circle at latitude Lat1. This represents the latitude difference between corresponding trajectory points of two ships within the same time slice; This term is used to correct the latitudinal distance component to the actual sailing distance along the course, and is a commonly used correction term in course distance calculations; in the above formula, S Lati The expression is as follows: ; In the above formula: a is the length of the semi-major axis of the Earth's ellipsoid; e is the eccentricity. The formula for calculating the difference in latitude asymmetry rate Δq between A and B is shown below: ; The radius r1 of the isotropic circle at latitude Lat1 is: 。 6. The trajectory prediction method for coastal merchant and fishing vessel encounter scenarios according to claim 1, characterized in that: The loss function Loss is determined by , , Composition, in which It is the Euclidean distance between the predicted location and the actual location: ; Where: (x, y) and ( ) represent the actual location and the predicted location at the corresponding time, respectively. The trajectory consists of n scattered points, and the coordinates of these points are represented as (xi,yi), where i=1,2,…,n; Second error This is used to represent the error in curvature between the predicted trajectory and the actual trajectory. As is well known, a ship's trajectory is a curve, and the predicted trajectory curve should also remain relatively smooth. The velocity and acceleration at each point are approximated using the difference formula. For the i-th point, the velocity components are calculated using the two points before and after it: , The accelerations are as follows: , The formula for calculating the trajectory curvature is: ; The third error This represents the average Euclidean distance difference between the predicted trajectory endpoint and the actual trajectory endpoint, and can reasonably evaluate the reachability of the predicted trajectory endpoint. The formula is: ; The weight parameter represents the weight of the error in the loss function, satisfying the following condition: The reconstructed loss function is shown in the following formula: 。 7. A trajectory prediction model for encounters between coastal merchant and fishing vessels, characterized in that: The model includes an input layer, an attention mechanism layer, a first-layer Long Short-Term Memory (LSTM) network, a pooling layer, a second-layer LSTM network, and a fully connected layer. The input layer receives the navigation feature sequences of the ship and the encountering ships at each time step; the attention mechanism layer performs weighted processing on the features at different time steps in the time series to highlight the key information that has an important impact on the trajectory evolution; the weighted sequence features are input into the first layer of the Long Short-Term Memory (LSTM) network to model the local temporal dependencies of the ship's navigation trajectory. The hidden states of the current ship and the encountered ship output by the first layer of the Long Short-Term Memory (LSTM) network are merged through feature fusion to form a joint hidden layer representation, which is then passed to the pooling layer. The time-dimensional pooling operation is used to achieve feature dimensionality reduction and compression of redundant information. The pooled data then enters the second LSTM layer to learn the global temporal features of ship interaction behavior in the encounter scenario. Finally, the ht containing global hidden information is sent to the fully connected layer to obtain the predicted longitude and latitude data.