A multi-ship trajectory prediction method based on social interaction and collision constraints
By constructing a multi-ship trajectory prediction model, integrating ship state and social interaction characteristics, and introducing a collision constraint loss function, the problems of difficulty in characterizing the dynamic interaction relationship of multiple ships and failure to consider safety distance in existing methods are solved, and high-precision and safe multi-ship trajectory prediction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-25
- Publication Date
- 2026-07-24
Smart Images

Figure CN122451376A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multi-ship trajectory prediction technology, and in particular to a multi-ship trajectory prediction method based on social interaction and collision constraints. Background Technology
[0002] In recent years, with the rapid development of the global shipping industry and the continuous advancement of intelligent navigation technology, ship trajectory prediction, as a crucial supporting technology for maritime traffic management and navigation safety, has received widespread attention. Early trajectory prediction methods were mostly based on statistical analysis or mathematical models of ship motion, calculating trajectories by modeling historical navigation data. However, their ability to characterize nonlinear features and dynamic changes in complex environments was limited. With the development of artificial intelligence technology, deep learning-based trajectory prediction methods have gradually become a research hotspot, capable of mining ship motion patterns from massive amounts of Automatic Identification System (AIS) data, effectively improving prediction accuracy.
[0003] In ship trajectory prediction research, models such as Recurrent Neural Networks (RNNs), Long Short-Term Memory Networks (LSTMs), and Transformers have been widely used for single-ship trajectory modeling and prediction, achieving good prediction results. However, these deep learning models have limited ability to model the interactive behavior of multiple ships, making it difficult to accurately reflect the dynamic influence relationships between ships in complex sea areas.
[0004] In maritime navigation environments, ships often operate in multi-objective interaction scenarios, especially in densely populated waters such as ports and waterways, where interactions and collision avoidance constraints are more pronounced. Existing Social-LSTM models, by incorporating social interaction mechanisms, can characterize the mutual influence between multiple ships to some extent. However, they primarily focus on the spatial distribution of ship trajectories and do not consider the safety distance constraints that ships must meet during navigation. Therefore, existing Social-LSTM models may still encounter situations such as trajectory intersections or collisions during trajectory prediction that do not conform to actual navigation rules, making it difficult to generate safe and realistic multi-ship traffic flow prediction results. Summary of the Invention
[0005] This invention provides a multi-ship trajectory prediction method based on social interaction and collision constraints to overcome the above-mentioned technical problems.
[0006] To achieve the above objectives, the technical solution of the present invention is as follows: A multi-ship trajectory prediction method based on social interaction and collision constraints, specifically including the following steps: S1: Obtain historical ship trajectory time series data; Furthermore, the historical ship trajectory time series data includes the ship's longitude, latitude, heading, and speed at different times; S2: Construct a multi-ship trajectory prediction model; and the multi-ship trajectory prediction model includes a ship state feature acquisition module, a social feature extraction module, a combined feature vector acquisition module, an LSTM encoder module, and an LSTM decoder module; The ship state feature acquisition module is used to acquire ship state feature vectors based on historical ship trajectory time series data; The social feature extraction module is used to construct a social occupation grid to obtain the social occupation matrix corresponding to each target ship; and to obtain the social interaction feature vector based on the social occupation matrix. The combined feature vector acquisition module is used to fuse the ship state feature vector and the social interaction feature vector to obtain a combined feature vector. The LSTM encoder module is used to extract the motion evolution pattern of the target ship in the historical ship trajectory time series data based on the combined feature vector, and obtain the corresponding encoded feature vector of each target ship. The LSTM decoder module is used to obtain the time step displacement increment for recursively predicting the future trajectory based on the encoded feature vector, and to obtain the ship's future trajectory position at the next moment based on the time step displacement increment. S3: Construct a composite loss function that includes ship trajectory reconstruction loss and ship collision loss; train the constructed multi-ship trajectory prediction model based on the composite loss function using historical ship trajectory time series data to obtain the optimal multi-ship trajectory prediction model; implement the multi-ship trajectory prediction process based on social interaction and collision constraints according to the optimal multi-ship trajectory prediction model.
[0007] Furthermore, the method for obtaining the social interaction feature vector described in S2 is as follows: By configuring a social occupation grid for the target scene using a pre-defined social pooling layer, that is, taking the target ship in the target scene as the center, and within a pre-defined side length of 2... R Within the square perception range, a two-dimensional grid structure is constructed to characterize the distribution of other ships around the target ship in the target scene space; Confirm whether other ships exist within any grid cell of the two-dimensional mesh structure. If they exist, mark the corresponding grid cell as 1; otherwise, mark it as 0; thus obtaining the... i The target vessel at the time t Social Occupation Matrix S i t and ,in RG×G Represent a G × G A real grid matrix; Social Occupation Matrix S i t Convert to a one-dimensional vector representation, and perform feature mapping through a pre-defined fully connected layer to obtain the first... i The target vessel at the time t Social interaction feature vector g i t and ;in, This represents a social feature encoding function.
[0008] Furthermore, the formula for obtaining the combined feature vector described in S2 is as follows:
[0009]
[0010] In the formula: Represents the ship's state feature vector; i Indicates the ship's number; Indicates the first i The target vessel at the time t Longitude and latitude in local plane coordinates; Indicates the first i The speed of the target vessel; Indicates the first i The heading angle of the target vessel; Represents the coding function for ship state characteristics; This represents a combined feature vector.
[0011] Furthermore, the formula for obtaining the encoded feature vector described in S2 is as follows:
[0012] In the formula: They represent the first i The target vessel in time step t The encoder's hidden state and the encoder's memory unit state are the encoded feature vectors; They represent the first i The target vessel in time step t -1 represents the encoder hidden state and encoder memory unit state.
[0013] Furthermore, the method for obtaining the ship's future trajectory position at the next moment in S2 is as follows: S21: Use the encoded feature vector output by the LSTM encoder module as the initial hidden state of the LSTM decoder module. With memory cell state Its expression is:
[0014] In the formula: This represents the encoded feature vector that is finally output by the LSTM encoder module; S22: Based on the initial hidden state, the LSTM decoder module... With memory cell state The decoding feature vector is obtained, and the formula for obtaining the decoding feature vector is:
[0015] In the formula: Indicates the first i The target vessel in time step The decoder's hidden state and the decoder's memory unit state; Indicates the first i The target vessel in time step -1 decoder hidden state and decoder memory unit state; This represents the predicted displacement at the previous moment, i.e., the displacement increment at the time step. S23: Obtain the predicted displacement at the current time step by using a preset linear mapping layer based on the decoder hidden state in the decoded feature vector. for:
[0016] In the formula: This represents the weight matrix of the linear mapping layer; Represents the bias vector; Indicates the first i The target vessel in time step Relative to time step k -1 corresponds to the lateral and longitudinal displacement increments in the local coordinate system; S24: Obtain the future predicted displacement sequence based on S21 to S23, and gradually accumulate the future predicted displacement sequence to obtain the first... i The future trajectory position of a target vessel is expressed as:
[0017] In the formula: Indicates the first i The future trajectory and location of the target vessel; Indicates the position of the last moment in the historical observation sequence; Indicates the first i The target vessel j The displacement increment for each predicted time step.
[0018] Furthermore, the method for obtaining the optimal multi-ship trajectory prediction model in S3 is as follows: S31: Randomly divide the historical ship trajectory time series data into training set and validation set according to a preset ratio; S32: Train the constructed multi-ship trajectory prediction model based on the training set to obtain the trained multi-ship trajectory prediction model; S33: Based on the constructed composite loss function that includes ship trajectory reconstruction loss and ship collision loss, the trained multi-ship trajectory prediction model is validated using the validation set. That is, to determine whether the output of the trained multi-ship trajectory prediction model has converged; If the output of the trained multi-ship trajectory prediction model converges, then the trained multi-ship trajectory prediction model is confirmed to be the optimal multi-ship trajectory prediction model. Otherwise, the weight parameters of the trained multi-ship trajectory prediction model are adaptively adjusted based on the backpropagation method, and step S32 is repeated until the weight parameters of the trained multi-ship trajectory prediction model that has converged are confirmed to be the optimal weight parameters, and the multi-ship trajectory prediction model is reconstructed to obtain the optimal multi-ship trajectory prediction model.
[0019] Furthermore, the composite loss function constructed in S33, which includes ship trajectory reconstruction loss and ship collision loss, is as follows:
[0020]
[0021]
[0022]
[0023]
[0024] In the formula: Represents the composite loss function; Indicates the loss from reconstructing the ship's trajectory; This represents the weighting coefficient used to balance the ship trajectory reconstruction loss and the ship collision loss; N Indicates the number of valid vessels; This represents the displacement increments in longitude and latitude of the ship's trajectory predicted by the model; This represents the displacement increments in longitude and latitude of the ship's actual trajectory; Indicates the length of the prediction period; Indicates the firsti The target vessel and the first j The target vessel at the predicted time t Spatial distance; They represent the first i The target vessel t The longitude and latitude coordinates of the moment; They represent the first j The target vessel t The longitude and latitude coordinates of the moment; Indicates the first i The target vessel and the first j The target vessel at the predicted time t Collision penalty; max ( ) indicates the maximum value among the selected objects; Indicates the minimum safe distance; Represents the collision loss function; log Represents a logarithmic function.
[0025] Beneficial Effects: This invention provides a multi-ship trajectory prediction method based on social interaction and collision constraints. By constructing a Social-Coll-LSTM multi-ship trajectory prediction model, the target ship and its neighboring ships are distributed and mapped onto a gridded spatial region within a pre-defined multi-ship scenario, forming a social interaction feature vector that is fused with the ship state feature vector. A Long Short-Term Memory (LSTM) network is used to perform temporal modeling of the fused features, i.e., the combined feature vector, effectively modeling the dynamic interaction behavior between multiple ships. This overcomes the shortcomings of single-ship trajectory prediction methods in characterizing multi-target interactions, improving the accuracy and stability of multi-ship trajectory prediction. Simultaneously, during the training process of the multi-ship trajectory prediction model, a composite loss function of trajectory reconstruction loss and collision loss is constructed to constrain the safe distance between ships in multi-ship trajectory prediction. Penalties are imposed when there is a potential collision risk, guiding the model to generate trajectories that conform to actual navigation rules, effectively reducing the collision risk of intersecting ship trajectories and improving the safety of predicted trajectories. Attached Figure Description
[0026] To more clearly illustrate the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a flowchart of the multi-ship trajectory prediction method based on social interaction and collision constraints of the present invention; Figure 2This is a multi-ship trajectory prediction route map based on the Social-Coll-LSTM model in this embodiment; Figure 3 This is a schematic diagram of the Social-Coll-LSTM multi-ship trajectory prediction model that introduces a collision constraint mechanism in this embodiment. Figure 4 This is a schematic diagram of the social pooling layer in this embodiment; Figure 5 This is a graph showing the prediction of a future trajectory in 12 steps based on an 8-step historical trajectory observed in this embodiment. Figure 6 This is a graph showing the prediction of a future trajectory over 30 steps based on 20 historical steps observed in this embodiment. Figure 7 This is a graph showing the prediction of a future trajectory over 90 steps based on a historical trajectory observed over 60 steps, as presented in this embodiment. Figure 8 This is a comparison chart of observing 8 steps of historical trajectory and predicting 12 steps of single ship trajectory in this embodiment; Figure 9 This is a comparison chart of observing 20 steps of historical trajectory and predicting 30 steps of single-ship trajectory in this embodiment; Figure 10 This is a comparison chart of observing 60 steps of historical trajectory and predicting 90 steps of single-ship trajectory in this embodiment; Figure 11 This embodiment shows a graph for predicting the trajectory of multiple ships in the next 12 steps based on 8 steps of historical multi-ship trajectories. Figure 12 This embodiment shows a graph of predicting the trajectory of multiple ships in the next 30 steps based on 20 steps of historical multi-ship trajectories. Figure 13 This embodiment uses a graph to predict the trajectory of multiple ships over the next 90 steps based on the historical trajectories of 60 ships. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0029] This embodiment provides a multi-ship trajectory prediction method based on social interaction and collision constraints, such as Figures 1 to 2 As shown, the specific steps include: S1: Obtain historical ship trajectory time series data; and the historical ship trajectory time series data includes ship longitude, ship latitude, ship heading and ship speed at different times; Specifically, this embodiment constructs ship state features by performing outlier removal, time sorting, and conversion of longitude, latitude, and heading on the original multi-ship trajectory data, thereby obtaining historical ship trajectory time-series data. In this embodiment, due to factors such as ship AIS equipment malfunction, signal transmission delay, data recording errors, and external environmental interference, the original AIS data often contains outliers, affecting the subsequent trajectory analysis and prediction model training effects. Therefore, outlier detection and removal are necessary for the AIS dataset to ensure data reliability. Specifically, for example... Figure 2 This embodiment employs conventional speed and heading anomaly detection methods from the maritime field to remove outliers from the original ship AIS data. For speed anomalies, when the speed is 0 km / h, the ship itself is not moving and can be considered to be in a non-navigating state; when the speed is below 2 km / h, the ship's movement is largely affected by environmental factors such as wind, current, and waves, exhibiting passive drift rather than autonomous navigation. In this case, speed and heading are difficult to reflect the ship's true maneuvering behavior, and such data is not conducive to the model learning effective motion patterns. Therefore, data with speeds in the range of [0, 2) km / h are considered invalid and deleted. Furthermore, the ship's heading should be within the range of 0° to 360°; if the heading data exceeds this range, it is considered an outlier and should be deleted. After removing the outlier data, a valid ship AIS dataset for the Yellow Sea is obtained. The trajectory data of each ship in the dataset is sorted in ascending order according to the timestamp, and the data is resampled at fixed intervals of 20 seconds to obtain a temporally continuous ship trajectory data sequence with consistent sampling intervals. Specifically, the trajectory data of each ship is resampled and aligned, including using cubic spline interpolation for latitude and longitude coordinates and linear interpolation for speed and heading.
[0030] S2: Construct a multi-ship trajectory prediction model; and the multi-ship trajectory prediction model includes a ship state feature acquisition module, a social feature extraction module, a combined feature vector acquisition module, an LSTM encoder module, and an LSTM decoder module; The ship state feature acquisition module is used to acquire ship state feature vectors based on historical ship trajectory time series data; Specifically, for the trajectory data of each ship, to avoid discontinuities in the heading angle around 0° and 360°, this embodiment uses a sine wave... sin With cosine cos The function encodes the heading angle to obtain stable directional features and converts latitude and longitude coordinates into local planar coordinates to construct a ship state feature vector. and Furthermore, this embodiment constructs state features from continuous and complete ship trajectory data and normalizes dynamic features such as speed, heading, longitude, and latitude. This helps the model learn data features better, improving its prediction performance and generalization ability. In this embodiment, by normalizing the ship AIS dataset, the original data is linearly mapped to the [0, 1] interval. This reduces the range of data variation while maintaining the data distribution characteristics, improving the training stability of the neural network model and ultimately accelerating the model convergence speed. In the model prediction stage, the model output needs to be denormalized, that is, the normalized predicted values are restored to the scale range of the original data, and the prediction results are converted back into real geographic coordinates or navigation parameters. The calculation formula is as follows:
[0031] In the formula: and These represent the minimum and maximum values of the original trajectory data, respectively. This represents the normalized sequence data; This represents the sequence data after denormalization; x This represents historical ship trajectory time series data; The social feature extraction module is used to construct a social occupation grid to obtain the social occupation matrix corresponding to each target ship; and to obtain the social interaction feature vector based on the social occupation matrix. Specifically, the method for obtaining the social interaction feature vector is as follows: By configuring a social occupation grid for the target scene using a pre-set social pooling layer, that is, by pre-establishing a multi-ship scene based on the timestamp and centering it on the target ship in the target scene, within a pre-set side length of 2... R Within a square perception range, a model is constructed to characterize the distribution of other ships around the target ship in the target scene space. G × G A two-dimensional mesh structure is established; then, it is confirmed whether other ships exist within any mesh cell of the two-dimensional mesh structure. If they exist, the corresponding mesh cell is marked as 1; otherwise, it is marked as 0; thus, the second... i The target vessel at the time t Social Occupation Matrix S i t and ,in R G×G Represent a G × G The real-valued grid matrix; the social occupation matrix S i tConvert to a one-dimensional vector representation, and perform feature mapping through a pre-defined fully connected layer to obtain the first... i The target vessel at the time t Social interaction feature vector g i t and , This represents the social feature encoding function, which is used to perform nonlinear mapping of social occupation grid features through a fully connected network, thereby extracting social interaction features among ships; The social pooling layer in this embodiment can model the interaction relationships between multiple moving targets and learn the interaction effects between multiple ships. The social pooling layer assigns an independent LSTM to each target ship in a multi-ship scenario and propagates information among different target individuals through a shared social pooling mechanism, thereby capturing the impact of group behavior on individual trajectories. For example... Figure 4 This is a schematic diagram of the social pooling layer, where each LSTM learns the state of the target ship and predicts its corresponding future position, and the LSTM weights are shared across all future position sequences. The combined feature vector acquisition module is used to fuse the ship state feature vector and the social interaction feature vector to obtain a combined feature vector. Specifically, the formula for obtaining the combined feature vector is as follows:
[0032] In the formula: Represents the ship's state feature vector; i Indicates the ship's number; Indicates the first i The target vessel at the time t Longitude and latitude in local plane coordinates; Indicates the first i The speed of the target vessel; Indicates the first i The heading angle of the target vessel; Represents the coding function for ship state characteristics; This represents the combined feature vector. The ship state feature vector and the social interaction feature vector are encoded separately and concatenated by channel dimension to form a fused feature. The fused feature, i.e., the combined feature vector, is then input into the subsequent LSTM encoder module for temporal encoding, and then gradually predicted by the LSTM decoder module for future multi-ship trajectory displacement. The LSTM encoder module is used to extract the motion evolution pattern of the target ship in the historical ship trajectory time series data based on the combined feature vector, and obtain the corresponding encoded feature vector of each target ship. Specifically, the formula for obtaining the encoded feature vector is as follows:
[0033] In the formula: They represent the first i The target vessel in time step t The encoder's hidden state and the encoder's memory unit state are the encoded feature vectors; They represent the first i The target vessel in time step t The encoder hidden state and encoder memory unit state are represented by -1. Specifically, through the encoding process of this LSTM encoder module, the temporal dependencies of ship motion and social interaction information can be captured. After encoding the historical sequence, the encoder outputs the final hidden state. With memory cell state High-dimensional temporal features used to characterize ship historical motion information and social interaction information; The LSTM decoder module is used to obtain the time step displacement increment for recursively predicting the future trajectory based on the encoded feature vector, and to obtain the ship's future trajectory position at the next moment based on the time step displacement increment. Specifically, in this embodiment, the method for obtaining the future trajectory position of the ship at the next moment is as follows: S21: Use the encoded feature vector output by the LSTM encoder module as the initial hidden state of the LSTM decoder module. With memory cell state Its expression is:
[0034] In the formula: This represents the encoded feature vector that is finally output by the LSTM encoder module; S22: Based on the initial hidden state, the LSTM decoder module... With memory cell state The decoding feature vector is obtained, and the formula for obtaining the decoding feature vector is:
[0035] In the formula: Indicates the first i The target vessel in time step The decoder's hidden state and the decoder's memory unit state; Indicates the first i The target vessel in time step -1 decoder hidden state and decoder memory unit state; The predicted displacement at the previous moment represents the displacement increment of the time step. In this embodiment, during the decoding stage, the future displacement sequence is generated through an LSTM network. The LSTM decoder module recursively predicts the future trajectory based on the displacement increment generated in the previous prediction step. S23: Obtain the predicted displacement at the current time step by using a preset linear mapping layer based on the decoder hidden state in the decoded feature vector. for:
[0036] In the formula: This represents the weight matrix of the linear mapping layer; Represents the bias vector; Indicates the first i The target vessel in time step Relative to time step k -1 corresponds to the lateral and longitudinal displacement increments in the local coordinate system, i.e., the displacement changes of the ship at adjacent moments. S24: Obtain the future predicted displacement sequence based on S21 to S23, and gradually accumulate the future predicted displacement sequence to obtain the first... i The future trajectory position of a target vessel is expressed as:
[0037] In the formula: Indicates the first i The future trajectory and location of the target vessel; Indicates the position of the last moment in the historical observation sequence; Indicates the first i The target vessel j The displacement increments are calculated over a predicted time step. In this embodiment, after obtaining the future predicted displacement sequence, the predicted displacement increments are restored to their actual spatial coordinate trajectories. Using the position at the last moment of the historical observation sequence as the initial point, the predicted displacements are gradually accumulated to obtain the future trajectory position of the ship. ; S3: Construct a composite loss function that includes ship trajectory reconstruction loss and ship collision loss; train the constructed multi-ship trajectory prediction model based on the composite loss function using historical ship trajectory time series data to obtain the optimal multi-ship trajectory prediction model; implement the multi-ship trajectory prediction process based on social interaction and collision constraints according to the optimal multi-ship trajectory prediction model. Specifically, in this embodiment, the method for obtaining the optimal multi-ship trajectory prediction model is as follows: S31: Randomly divide the historical ship trajectory time series data into training set and validation set according to a preset ratio; S32: Train the constructed multi-ship trajectory prediction model based on the training set to obtain the trained multi-ship trajectory prediction model; S33: Based on the constructed composite loss function that includes ship trajectory reconstruction loss and ship collision loss, the trained multi-ship trajectory prediction model is validated using the validation set. That is, to determine whether the output of the trained multi-ship trajectory prediction model has converged; If the output of the trained multi-ship trajectory prediction model converges, then the trained multi-ship trajectory prediction model is confirmed to be the optimal multi-ship trajectory prediction model. Otherwise, the weight parameters of the trained multi-ship trajectory prediction model are adaptively adjusted based on the backpropagation method, and step S32 is repeated until the weight parameters of the trained multi-ship trajectory prediction model that has converged are confirmed to be the optimal weight parameters, and the multi-ship trajectory prediction model is reconstructed to obtain the optimal multi-ship trajectory prediction model.
[0038] Specifically, the composite loss function constructed in this embodiment, which includes ship trajectory reconstruction loss and ship collision loss, is as follows:
[0039]
[0040]
[0041]
[0042]
[0043] In the formula: Represents the composite loss function; Indicates the loss from reconstructing the ship's trajectory; This represents the weighting coefficient used to balance the ship trajectory reconstruction loss and the ship collision loss; N Indicates the number of valid vessels; This represents the displacement increments in longitude and latitude of the ship's trajectory predicted by the model; This represents the displacement increments in longitude and latitude of the ship's actual trajectory; Indicates the length of the prediction period; Indicates the first i The target vessel and the first j The target vessel at the predicted time t Spatial distance; They represent the first i The target vessel t The longitude and latitude coordinates of the moment; They represent the first j The target vessel tThe longitude and latitude coordinates of the moment; Indicates the first i The target vessel and the first j The target vessel at the predicted time t Collision penalty; max ( ) indicates the maximum value among the selected objects; Indicates the minimum safe distance; Represents the collision loss function; log Represents a logarithmic function.
[0044] In this embodiment, the ship reconstruction loss is obtained by calculating the future multi-ship trajectory displacement deviation; the spatial distance between any two ships in the predicted trajectory is calculated, and a collision penalty is generated when the spatial distance is less than the safe distance, resulting in a collision loss; a joint loss function is constructed based on the ship reconstruction loss and the collision loss, and the model parameters are updated through an optimization algorithm to obtain the multi-ship trajectory prediction model. Specifically, to improve the prediction accuracy and safety of the model in a multi-ship interaction environment, this embodiment trains and optimizes the model by constructing a joint loss function composed of trajectory reconstruction loss and collision loss; during the multi-ship trajectory prediction process, the future multi-ship trajectory displacement deviation is calculated to obtain the ship reconstruction loss, and the trajectory reconstruction loss... The mean square error of the displacement increment introduced by the trajectory reconstruction block is used to calculate the trajectory reconstruction loss. The multi-ship trajectory prediction offset, directly applied to the model output, helps improve the model's ability to fit trajectory change trends. In this embodiment, the spatial distance between any two ships in the predicted trajectory is calculated. When the spatial distance is less than the safe distance, a collision penalty is generated, resulting in collision loss. During the multi-ship trajectory prediction process, a pre-set collision detection module calculates the spatial distance between any two ships at the prediction time. Specifically, when the spatial distance between the two ships is greater than the minimum safe distance, a collision penalty is applied. The penalty is 0; when the spatial distance between the two ships is less than the minimum safe distance, the collision penalty is... The value increases as distance decreases; to improve the stability of model training and avoid excessive gradient fluctuations, a logarithmic function is used to smooth the degree of collision violation, thus obtaining the ship collision loss. Specifically, ship collision losses It can penalize ships that may pose a collision risk during trajectory prediction, guiding the model to learn more reasonable collision avoidance behaviors.
[0045] The structural principle of the Social-Coll-LSTM multi-ship trajectory prediction model in this embodiment is as follows: Figure 3As shown, the Social-Coll-LSTM multi-ship trajectory prediction model introduces a collision constraint mechanism on top of the traditional Social-LSTM model, enabling it to simultaneously consider safe distance constraints between ships during the learning of trajectory motion patterns, thus predicting ship trajectories that conform to real-world navigation behavior. The experimental dataset information for multi-ship trajectory prediction provided in this embodiment is shown in Table 1.
[0046] Table 1. Dataset Information for Multi-Ship Trajectory Prediction Experiment
[0047] Specifically, to evaluate the trajectory prediction capability of the Social-Coll-LSTM multi-ship trajectory prediction model at different time scales, three different experimental configurations were designed. The first experiment used 8 steps of historical trajectory to predict 12 steps of future trajectory; the second experiment used 20 steps of historical trajectory to predict 30 steps of future trajectory; and the third experiment used 60 steps of historical trajectory to predict 90 steps of future trajectory. These three multi-scale time series prediction experiments comprehensively evaluated the model's performance in both short-term and long-term trajectory prediction tasks. Detailed parameter settings for the Social-Coll-LSTM multi-ship trajectory prediction model are shown in Table 2.
[0048] Table 2. Detailed parameter settings for the Social-Coll-LSTM multi-ship trajectory prediction model
[0049] Specifically, this embodiment analyzes the training process of the model, evaluating its performance in tasks with different historical trajectory step lengths and prediction trajectory step lengths by analyzing the learning ability and generalization performance of the Social-Coll-LSTM multi-ship trajectory prediction model under different time-series prediction tasks. Figure 5 As shown, with an observation step size of 8 and a prediction step size of 12, the training loss continuously decreased, eventually converging to around 20 in the 50th training epoch. The validation loss ultimately decreased to around 19, and the overall trend was basically consistent with the training loss. Figure 6 As shown, the training loss eventually stabilized at around 31, and the validation loss steadily decreased to around 29. The experimental results with an observation step size of 60 / prediction step size of 90 are as follows... Figure 7 As shown, the training loss stabilizes at around 60, and the validation loss stabilizes at around 58. The above analysis indicates that the Social-Coll-LSTM multi-ship trajectory prediction model exhibits consistent and stable training and validation losses across prediction tasks of different durations, demonstrating good learning ability and strong temporal modeling and generalization capabilities.
[0050] Specifically, this embodiment uses four metrics—Average Displacement Error (ADE), Final Displacement Error (FDE), Root Mean Square Error (RMSE), and Maximum Displacement Error (MDE)—to quantitatively evaluate the performance of the Social-Coll-LSTM multi-ship trajectory prediction model. ADE measures the average distance error between the predicted trajectory and the actual trajectory over the entire prediction time series. FDE measures the distance error between the endpoint of the predicted trajectory and the endpoint of the actual trajectory. RMSE is a weighted average of the squared errors between the predicted and actual trajectory points, used to calculate the average deviation between the two trajectories. MDE is used to calculate the maximum error between the predicted and actual trajectories and can also be used to measure the maximum offset effect of collision avoidance constraints on the predicted trajectory, verifying the model's comprehensive prediction capability considering both safety and prediction accuracy.
[0051] Specifically, in multi-ship trajectory prediction tasks, each scenario typically involves multiple ships. Therefore, the aforementioned metrics need to be statistically analyzed and averaged for all ships at the scenario level, denoted as [missing information]. AVG The unit is meters. Assume there are a total of [number] [units] in the scene. N Ships (indexed as) i The mean displacement error (ADE) is then calculated. AVG ), mean error of endpoint (FDE) AVG ), Root Mean Square Error (RMSE) AVG ) and the mean maximum displacement error (MDE) AVG The formula for calculating the error index of multi-ship trajectory prediction is as follows:
[0052]
[0053]
[0054]
[0055]
[0056] In the formula, d This indicates the geographical deviation distance between the predicted point and the actual point; These represent the differences between the predicted and actual values in latitude and longitude, respectively. r Indicates the average radius of the Earth; cos ( lat 1)· cos ( lat 2) Represents the product of the cosine of the predicted latitude and the cosine of the actual latitude; T Indicates a time step; i Indicates the ship's number; Indicates the first t Geographical distance between the predicted point and the actual point at the time step; Indicates the final time step T The predicted geographical deviation distance of the ship's position, where max represents the maximum value selected from multiple objects.
[0057] Specifically, to verify the effectiveness and accuracy of the Social-Coll-LSTM multi-ship trajectory prediction model in the multi-ship trajectory prediction task, the LSTM model, the Transformer model, and the Social-LSTM model without the introduction of the collision constraint loss function were selected for multi-ship trajectory prediction comparison. The prediction trajectory errors of different models at different step lengths are shown in Table 3. Table 3. Predicted trajectory errors of different models at different step lengths
[0058] Specifically, Table 3 presents the predicted trajectory errors of different models at different step lengths, among which the Social-Coll-LSTM model in ADE... AVG FDE AVG RMSE AVG and MDE AVG The results show that it outperforms other comparative models, verifying its high prediction accuracy and robustness in multi-ship trajectory prediction tasks. Figures 9 to 10 The results comparing the single-ship trajectories of different models in the multi-ship trajectory prediction task are presented. Blue represents the true trajectory, red represents the predicted trajectory of the Social-Coll-LSTM model, and purple, yellow, and green represent the predicted trajectories of the Social-LSTM model, LSTM model, and Transformer model, respectively. Figure 8 , Figure 9 and Figure 10 The trajectory prediction results are shown for three different prediction step sizes. For example... Figures 11 to 13 This section compares the multi-ship trajectory predictions of the Social-Coll-LSTM model at different prediction steps. Blue trajectories represent the true trajectories, and red trajectories represent the predicted trajectories of the Social-Coll-LSTM model. Figure 11 To predict the ship's trajectory in the next 12 steps by observing 8 steps of historical trajectory, Figure 12 To predict the ship's trajectory in the next 30 steps by observing 20 steps of historical trajectory, Figure 13To predict ship trajectories for the next 90 steps based on 60 historical trajectories, the analysis above shows that the Social-Coll-LSTM model exhibits high prediction accuracy and robustness at various prediction step lengths, especially maintaining low error even at long prediction step lengths, indicating its advantage in multi-ship trajectory prediction in complex multi-ship traffic environments.
[0059] In summary, the method described in this embodiment first addresses the outliers and temporal discontinuities in ship AIS trajectory data by removing outliers, sorting the data by time, and normalizing the data. It then constructs ship state features through coordinate transformation and sine / cosine encoding of heading angles, obtaining stable and continuous model input data and improving data quality and feature representation capabilities. Secondly, to characterize the dynamic interaction relationships between multiple ships, a social occupancy grid is introduced within the target ship's perception range, based on timestamps. This maps the spatial distribution of neighboring ships into structured social interaction feature vectors, enabling multi-ship information interaction. By fusing the ship's own state features with social interaction features and inputting them into an LSTM network, joint modeling of the ship's own dynamics and spatial interaction relationships with other ships can be achieved, improving the accuracy of multi-ship trajectory prediction. Simultaneously, a collision constraint mechanism is introduced to generate predicted trajectories that comply with navigation safety rules. During trajectory prediction, trajectory reconstruction loss models the deviation between the predicted trajectory and the actual trajectory, enabling the model to effectively learn the laws of ship motion; collision loss calculates the spatial distance between any two ships in the predicted trajectory and constructs a collision penalty based on the minimum safe distance, constraining potential collision behaviors and preventing ship collisions.
[0060] The method described in this embodiment effectively models the interactive behavior of multiple vessels by introducing a social occupancy grid, thereby improving the model's trajectory prediction capability in complex traffic environments. Simultaneously, by constructing a composite loss function that includes vessel trajectory reconstruction loss and vessel collision loss, safety distance constraints are integrated into the model training process, effectively avoiding predicted trajectory intersections and potential collisions, thus improving the rationality and safety of the prediction results. The method described in this embodiment can achieve parallel prediction of multiple vessel trajectories and has significant application value in traffic flow modeling and intelligent navigation simulation testing in complex maritime areas.
[0061] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for predicting the trajectories of multiple ships based on social interaction and collision constraints, characterized in that, The specific steps include: S1: Obtain historical ship trajectory time series data; Furthermore, the historical ship trajectory time series data includes the ship's longitude, latitude, heading, and speed at different times; S2: Construct a multi-ship trajectory prediction model; and the multi-ship trajectory prediction model includes a ship state feature acquisition module, a social feature extraction module, a combined feature vector acquisition module, an LSTM encoder module, and an LSTM decoder module; The ship state feature acquisition module is used to acquire ship state feature vectors based on historical ship trajectory time series data; The social feature extraction module is used to construct a social occupation grid to obtain the social occupation matrix corresponding to each target ship; and to obtain the social interaction feature vector based on the social occupation matrix. The combined feature vector acquisition module is used to fuse the ship state feature vector and the social interaction feature vector to obtain a combined feature vector. The LSTM encoder module is used to extract the motion evolution pattern of the target ship in the historical ship trajectory time series data based on the combined feature vector, and obtain the corresponding encoded feature vector of each target ship. The LSTM decoder module is used to obtain the time step displacement increment for recursively predicting the future trajectory based on the encoded feature vector, and to obtain the ship's future trajectory position at the next moment based on the time step displacement increment. S3: Construct a composite loss function that includes ship trajectory reconstruction loss and ship collision loss; based on the composite loss function, train the constructed multi-ship trajectory prediction model using historical ship trajectory time series data to obtain the optimal multi-ship trajectory prediction model; implement the multi-ship trajectory prediction process based on social interaction and collision constraints according to the optimal multi-ship trajectory prediction model.
2. The multi-ship trajectory prediction method based on social interaction and collision constraints according to claim 1, characterized in that, The method for obtaining the social interaction feature vector described in S2 is as follows: By configuring a social occupation grid for the target scene using a pre-defined social pooling layer, that is, taking the target ship in the target scene as the center, and within a pre-defined side length of 2... R Within the square perception range, a two-dimensional grid structure is constructed to characterize the distribution of other ships around the target ship in the target scene space; Confirm whether there are other ships in any grid cell of the two-dimensional grid structure. If there are, mark the corresponding grid cell as 1. Otherwise, mark it as 0; thus obtaining the first... i The target vessel at the time t Social Occupation Matrix S i t and ,in R G×G Represent a G × G A real grid matrix; Social Occupation Matrix S i t Convert to a one-dimensional vector representation, and perform feature mapping through a pre-defined fully connected layer to obtain the first... i The target vessel at the time t Social interaction feature vector g i t and ;in, This represents a social feature encoding function.
3. The multi-ship trajectory prediction method based on social interaction and collision constraints according to claim 2, characterized in that, The formula for obtaining the combined feature vector described in S2 is: In the formula: Represents the ship's state feature vector; i>i represents the ship number; Indicates the first i The target vessel at the time t Longitude and latitude in local plane coordinates; Indicates the first i The speed of the target vessel; Indicates the first i The heading angle of the target vessel; Represents the coding function for ship state characteristics; This represents a combined feature vector.
4. The multi-ship trajectory prediction method based on social interaction and collision constraints according to claim 3, characterized in that, The formula for obtaining the encoded feature vector described in S2 is: In the formula: They represent the first i The target vessel in time step t The encoder's hidden state and the encoder's memory unit state are the encoded feature vectors; They represent the first i The target vessel in time step t -1 represents the encoder hidden state and encoder memory unit state.
5. The multi-ship trajectory prediction method based on social interaction and collision constraints according to claim 4, characterized in that, The method for obtaining the ship's future trajectory position at the next moment in S2 is as follows: S21: Use the encoded feature vector output by the LSTM encoder module as the initial hidden state of the LSTM decoder module. With memory cell state Its expression is: In the formula: This represents the encoded feature vector that is finally output by the LSTM encoder module; S22: Based on the initial hidden state, the LSTM decoder module... With memory cell state The decoding feature vector is obtained, and the formula for obtaining the decoding feature vector is: In the formula: Indicates the first i The target vessel in time step The decoder's hidden state and the decoder's memory unit state; Indicates the first i The target vessel in time step -1 decoder hidden state and decoder memory unit state; This represents the predicted displacement at the previous moment, i.e., the displacement increment at the time step. S23: Obtain the predicted displacement at the current time step by using a preset linear mapping layer based on the decoder hidden state in the decoded feature vector. for: In the formula: This represents the weight matrix of the linear mapping layer; Represents the bias vector; Indicates the first i The target vessel in time step Relative to time step k -1 corresponds to the lateral and longitudinal displacement increments in the local coordinate system; S24: Obtain the future predicted displacement sequence based on S21 to S23, and gradually accumulate the future predicted displacement sequence to obtain the first... i The future trajectory position of a target vessel is expressed as: In the formula: Indicates the first i The future trajectory and location of the target vessel; Indicates the position of the last moment in the historical observation sequence; Indicates the first i The target vessel j The displacement increment for each predicted time step.
6. The multi-ship trajectory prediction method based on social interaction and collision constraints according to claim 4, characterized in that, The method for obtaining the optimal multi-ship trajectory prediction model in S3 is as follows: S31: Randomly divide the historical ship trajectory time series data into training set and validation set according to a preset ratio; S32: Train the constructed multi-ship trajectory prediction model based on the training set to obtain the trained multi-ship trajectory prediction model; S33: Based on the constructed composite loss function that includes ship trajectory reconstruction loss and ship collision loss, the trained multi-ship trajectory prediction model is validated using the validation set. That is, to determine whether the output of the trained multi-ship trajectory prediction model has converged; If the output of the trained multi-ship trajectory prediction model converges, then the trained multi-ship trajectory prediction model is confirmed to be the optimal multi-ship trajectory prediction model. Otherwise, the weight parameters of the trained multi-ship trajectory prediction model are adaptively adjusted based on the backpropagation method, and step S32 is repeated until the weight parameters of the trained multi-ship trajectory prediction model that has converged are confirmed to be the optimal weight parameters, and the multi-ship trajectory prediction model is reconstructed to obtain the optimal multi-ship trajectory prediction model.
7. The multi-ship trajectory prediction method based on social interaction and collision constraints according to claim 6, characterized in that, The composite loss function constructed in S33, which includes ship trajectory reconstruction loss and ship collision loss, is as follows: In the formula: Represents the composite loss function; Indicates the loss from reconstructing the ship's trajectory; This represents the weighting coefficient used to balance the ship trajectory reconstruction loss and the ship collision loss; N Indicates the number of valid vessels; This represents the displacement increments in longitude and latitude of the ship's trajectory predicted by the model; This represents the displacement increments in longitude and latitude of the ship's actual trajectory; Indicates the length of the prediction period; Indicates the first i The target vessel and the first j The target vessel at the predicted time t Spatial distance; They represent the first i The target vessel t The longitude and latitude coordinates of the moment; They represent the first j The target vessel t The longitude and latitude coordinates of the moment; Indicates the first i The target vessel and the first j The target vessel at the predicted time t Collision penalty; max ( ) indicates the maximum value among the selected objects; Indicates the minimum safe distance; Represents the collision loss function; log Represents a logarithmic function.