A ship trajectory prediction method based on local anonymous space-time self-attention network

CN117495902BActive Publication Date: 2026-10-13DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310941903.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-28
Publication Date
2026-10-13
Estimated Expiration
2043-07-28

AI Technical Summary

Technical Problem

[0003]目前,船舶轨迹预测模型以长短期记忆人工神经网络(Long Short Term Memory,LSTM)为主,虽然捕获了历史轨迹的长期依赖,但是没有考虑船舶之间的相互作用,在复杂的海上交通情况下,还会产生不令人满意的轨迹预测结果,不仅稳定性低,准确性不高,而且也无法保护船舶隐私

Benefits of technology

[0032]1、本发明采用基于局部匿名时空自注意力实现船舶航行轨迹预测。使用局部结构信息代替船舶本身信息,保护船舶隐私并为初始数据附加了局部结构特征,降低模型负担。同时在预测过程中引入时空自注意力机制,能够以高权重聚焦重要船舶轨迹,以低权重忽略不相关船舶轨迹,并且还可以动态调整权重使得模型能在多种情况下选取关键轨迹,加强模型预测的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117495902B_ABST
    Figure CN117495902B_ABST
Patent Text Reader

Abstract

The application discloses a ship trajectory prediction method based on a local anonymous spatio-temporal self-attention network, and comprises the following steps: data processing; constructing a ship interaction network; and establishing a ship trajectory prediction model based on the local anonymous spatio-temporal self-attention network. The AIS ship historical trajectory is processed into a ship trajectory interaction graph. Local information features are aggregated by using local anonymous aggregation, and ship privacy is protected to obtain initial features. Then, a structural self-attention convolutional layer is used to learn the structural features between ships. The output of the structural self-attention layer is used as the input of a time sequence self-attention layer, time sequence features are learned in the time dimension by using the time sequence self-attention, the features not only include the interaction information between the ships, but also reflect the change rule of the ship trajectory in the time dimension, and finally, the features aggregated with the structural and time sequence information are used to predict the ship navigation trajectory, so that the prediction result gradually approaches the real ship navigation trajectory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a dynamic graph neural network method for ship trajectory prediction applied to AIS ship historical trajectories, and particularly to a ship trajectory prediction method based on a locally anonymous spatiotemporal self-attention network. Background Technology

[0002] Ship trajectory prediction is a crucial tool for route planning and collision warning. Ship spatiotemporal trajectories collected using Automatic Identification System (AIS) base stations can be used to predict ship navigation paths. Accurate prediction of ship trajectories facilitates real-time monitoring and proactive collision warnings. This involves constructing route clusters by predicting the distribution of ship navigation trajectories, calculating the probability of collisions during navigation, and planning routes in advance to detect collision risks.

[0003] Currently, ship trajectory prediction models primarily rely on Long Short-Term Memory (LSTM) artificial neural networks. While these models capture long-term dependencies in historical trajectories, they fail to consider interactions between ships. In complex maritime traffic conditions, this can lead to unsatisfactory trajectory prediction results, exhibiting low stability, poor accuracy, and a failure to protect ship privacy. Such prediction models can contribute to maritime accidents, causing significant economic and personal damage. Therefore, the rapid development of self-attention mechanisms and dynamic graph neural networks in recent years has brought new possibilities for ship trajectory prediction. Summary of the Invention

[0004] To address the aforementioned problems in existing technologies, this invention proposes a ship trajectory prediction method based on a locally anonymous spatiotemporal self-attention neural network, which more robustly and accurately applies AIS ship historical trajectories for ship trajectory prediction.

[0005] To simulate and predict the navigation trajectory of real ships, the technical solution of this invention is as follows:

[0006] A method for predicting ship trajectories based on a locally anonymous spatiotemporal self-attention network includes the following steps:

[0007] A. Data Processing

[0008] Using AIS ship historical trajectories as the dataset, the latitude and longitude trajectories are mapped to a Cartesian coordinate system. Then, the AIS ship historical trajectories are divided into T time slices. The specific steps are as follows:

[0009] A1. Mapping latitude and longitude coordinates to a rectangular coordinate system: Timestamps in AIS ship history trajectories are treated as a tuple. Where id is the ship number and θ is the timestamp. Let λ and λ represent the longitude and latitude coordinates of timestamp point P, respectively. Using the Mercator projection method, the longitude and latitude coordinates of all timestamp points P are converted to rectangular coordinates, resulting in P′=(id, x, y, θ), where x is the abscissa and y is the ordinate.

[0010] A2. Data sliced ​​by time: Divide the historical trajectory of AIS ships into T time slices on average, and map the timestamps θ in the rectangular coordinates to the corresponding time slices t, to obtain P″=(id,x,y,t), where 0≤t≤T.

[0011] B. Constructing a ship interaction network

[0012] A ship interaction network is constructed within T time slices. All data P″ = (id, x, y, t) within each time slice are clustered, and the cluster centers are used as nodes in the ship interaction network. Then, the ship interaction network links are constructed based on the trajectory coordinates. The specific steps are as follows:

[0013] B1. Node Clustering: First, the elbow method is used to calculate the optimal number of cluster centers, n. Then, the KMeans clustering function is used to cluster the ship trajectory coordinates according to their density, resulting in n cluster centers, which serve as nodes in the ship interaction network, i.e., the shared node set V. These nodes represent points where ship trajectories are relatively dense or the most frequently traversed points. Finally, P″ = (id, x, y, t) is mapped to its respective cluster center to obtain P... c = (id, c, t), where c represents the cluster center number.

[0014] B2. Constructing a Ship Interaction Network Using Trajectory Coordinates: Links are added to ship interaction network nodes using trajectory coordinates. The ship trajectory coordinates in the time slice are traversed, with the cluster center point number *c* at the current coordinate as the starting point. If the next coordinate has the same *id* but a different *c*, a link is added using these two nodes as endpoints; otherwise, *c* at its coordinates is used as the new starting point. A link set *E* is constructed in this manner on time slice *t*. t ={e t1 e t2 , ..., e tξ} Where e represents a link, and ξ is the total number of links in time slice t. These links represent the ship's navigation trajectory. The final result is a ship interaction network G consisting of cluster centers and links. t =(V, E) t ).

[0015] C. Establish a ship trajectory prediction model based on a locally anonymous spatiotemporal self-attention network.

[0016] Ship trajectory prediction model based on locally anonymous spatiotemporal self-attention network A dynamic graph neural network containing structural self-attention layers and temporal self-attention layers, wherein the dynamic graph... G, a series of static image snapshots t =(V, E) t Composed of ) G t This indicates that at time t, there is a shared set of nodes V and edge set E. t Adjacency matrix A t The weighted graph, It is a set of graph embedding representations with T timestamps, representing the characteristic relationships of ship trajectories. It is the set of adjacency matrices of the ship trajectory network at T timestamps, ε={E 1 E 2 , ..., E T} represents the set of all timestamp edges;

[0017] C1. Obtain initial relative position information using locally anonymous random walks: First, in G t Starting from a single node v, perform M random walks, with each walk also consisting of M steps, to obtain the local anonymity feature matrix X′ of that node. t The row coordinates are all from the starting node v, and the column coordinates are from the node set. Then, in the local anonymized feature matrix X′ t For each column, the number of times the column coordinate node appears in that column is calculated, and the local anonymity feature vector of node v is composed of M hit counts. To replace the information of node v itself.

[0018] C2. Construct a self-attention graph convolutional layer for the ship trajectory structure: Perform graph convolution along the graph structure dimension to aggregate node neighbor information. Use the node feature vectors obtained through local anonymization. As input, neighbor node information is aggregated through structural self-attention, and the attention is calculated and weighted summation is performed to obtain node features. Then, by aggregating the features of all nodes in the current time slice, we obtain the structural features z of the time slice. t As shown in formula (1):

[0019]

[0020] Where node u is a neighbor of node v. It is a snapshot G t The set of neighboring nodes of node v; W represents the local feature vectors of nodes u and v, respectively. s It is a shared weight transformation applied to each node in the graph; α is the weight parameter of the self-attention function, α T It is the transpose of α; This refers to the embedding generated between nodes u and v during the calculation of self-attention parameters at time t. || represents the concatenation operation, and σ(·) is the non-linear activation function. This is the current snapshot G t The weights of the links between nodes u and v.

[0021] C3. Construct a temporal self-attention map convolutional layer for ship trajectories: Perform convolutions on the temporal dimension of the map slices to aggregate temporal features. The structural features z of each time slice output by the structural self-attention layer are then processed. t The input time-series self-attention layer captures the temporal change patterns of the dynamic graph and obtains the ship trajectory feature Z containing time-series information, as shown in formula (2):

[0022]

[0023]

[0024] Where, β t The attention weight matrix W is obtained by multiplying the transpose of the attention function. q For self-attention, the built-in parameter matrix is: q = query, representing the requested query information; W = ... k W is the built-in parameter matrix for self-attention, where k is the key and represents all feature information related to the request; v e′ is the built-in parameter matrix for self-attention, where v is the value, simply representing the original feature information. t The embedding is generated during the computation of the attention weight matrix at time t. This is a scaling factor to avoid excessively large values. M t It is the mask matrix of time slice t, used to enhance the model's ability to filter key information;

[0025] C4. Use ship trajectory features as label samples to evaluate the cross-entropy loss function, as shown in formula (3):

[0026]

[0027] Where σ is the sigmoid function, and <, > denote the inner product operation. l(v) represents a random walk starting at node v. Q is the set of nodes that co-occur with v during a random walk with a fixed step size in snapshot t. t (v) is the negative sampling distribution at time t starting from node v, where u′ is a node in the negative sampling distribution, and w q It is the negative sampling ratio, an adjustable hyperparameter used to balance positive and negative sampling.

[0028] C5. Optimize the parameters of the ship trajectory prediction model and perform ship trajectory prediction. After obtaining the cross-entropy loss function L, the gradient descent algorithm is used to iteratively optimize the parameters of the ship trajectory prediction model. When L is minimized, the optimal parameters of the ship trajectory prediction model are obtained and prediction is performed. The prediction process is shown in formula (4):

[0029]

[0030] Where Γ={P1,P2,...,P h} represents the ship's navigation trajectory consisting of a series of timestamps P, where h is the total number of timestamps constituting the trajectory. Γ 1 , Γ 2 ,...,Γ T Historical ship navigation trajectory data is input into the ship trajectory prediction model. Prediction is performed to obtain the predicted ship trajectory Γ T+N N represents the number of steps required for ship trajectory prediction.

[0031] Compared with the prior art, the present invention has the following beneficial effects:

[0032] 1. This invention employs a locally anonymized spatiotemporal self-attention mechanism for ship trajectory prediction. It uses local structural information instead of the ship's own information, protecting ship privacy and adding local structural features to the initial data, thus reducing the model's burden. Simultaneously, the introduction of a spatiotemporal self-attention mechanism during prediction allows for the high-weighting of important ship trajectories and the low-weighting of irrelevant trajectories. Furthermore, the weights can be dynamically adjusted, enabling the model to select key trajectories under various conditions, thereby enhancing the accuracy of the model's predictions.

[0033] 2. This invention utilizes a deep learning method based on the PyTorch framework to process AIS ship historical trajectories into a ship trajectory interaction graph. Local anonymization is used to aggregate local information features while protecting ship privacy, resulting in initial features. Then, structural self-attention convolutional layers are used to learn structural features between ships. The output of the structural self-attention layer is then used as the input of a temporal self-attention layer to learn temporal features in the time dimension. These features encompass both the interaction information between ships and reflect the changing patterns of ship trajectories over time. Features from multiple timestamps are aggregated, and finally, the aggregated structural and temporal features are used to predict ship trajectories. By calculating the cross-entropy between the predicted results based on AIS ship historical trajectories and the actual ship trajectories, a gradient descent algorithm is used to optimize the network model, making the predicted results gradually approach the actual ship trajectories. Among current related methods, this approach is relatively simple to implement, with clear and concise data acquisition and processing, and strong practicality. Attached Figure Description

[0034] This invention has a total of appendices Figure 6 Zhang, of which:

[0035] Figure 1 This is a diagram of the self-attention network model framework.

[0036] Figure 2 It is a graphical representation of the ship's navigation trajectory.

[0037] Figure 3 It is a map showing the navigation trajectory of ships in near-shore waters.

[0038] Figure 4 It refers to the historical navigation trajectory of the ship to be predicted.

[0039] Figure 5 It is a comparison between the predicted navigation trajectory of a ship and its actual trajectory.

[0040] Figure 6 This is a flowchart of the present invention. Detailed Implementation

[0041] The present invention will now be further described with reference to the accompanying drawings.

[0042] The structural framework of the ship trajectory prediction model based on locally anonymized dynamic graph self-attention neural network of the present invention is as follows: Figure 1 As shown, the trajectory prediction model uses structural self-attention to aggregate neighbor node information, and then inputs the structural features obtained from each static timestamp into a temporal self-attention convolutional layer to capture the evolution of the ship trajectory over time. Furthermore, to facilitate model calculation, the ship trajectory's latitude and longitude coordinates are converted into a graphical representation, as shown below. Figure 2 As shown, the nodes are clustered according to the density of ship trajectories. Figure 3 Given a map of near-shore vessel navigation tracks, select the historical navigation tracks of the vessels to be predicted from it, such as... Figure 4 As shown, the historical AIS navigation trajectory of the vessel to be predicted is fed into a vessel trajectory prediction model based on a locally anonymized dynamic graph self-attention neural network. The predicted result is then compared with the actual route, as shown below. Figure 5 As shown in the diagram. The light-colored routes represent the model's predicted results, while the dark-colored routes represent the actual trajectories. The predicted trajectories are largely consistent with the actual flight trajectories, demonstrating high accuracy. The overall flowchart of this invention is shown below. Figure 6 As shown.

[0043] This invention is not limited to this embodiment. Any equivalent concept or modification within the technical scope disclosed in this invention shall be included within the protection scope of this invention.

Claims

1. A ship trajectory prediction method based on a locally anonymous spatiotemporal self-attention network, characterized in that: The steps include the following: A. Data Processing Using AIS ship historical trajectories as the dataset, the latitude and longitude trajectories are mapped to a Cartesian coordinate system. Then, the AIS ship historical trajectories are divided into T time slices. The specific steps are as follows: A1. Mapping latitude and longitude coordinates to a rectangular coordinate system: Timestamps in AIS ship history trajectories are treated as a tuple. Where id is the ship number and θ is the timestamp. Let λ and λ represent the longitude and latitude coordinates of timestamp point P, respectively. The Mercator projection method is used to convert the longitude and latitude coordinates of all timestamp points P into rectangular coordinates, resulting in P′=(id,x,y,θ), where x is the abscissa and y is the ordinate. A2. Data sliced ​​by time: Divide the AIS ship historical trajectory into T time slices on average, and map the timestamp θ ​​in the rectangular coordinate to the corresponding time slice t, to obtain P″=(id,x,y,t), where 0≤t≤T; B. Constructing a ship interaction network A ship interaction network is constructed within T time slices. All data P″=(id,x,y,t) within each time slice are clustered, and the cluster centers are used as nodes in the ship interaction network. Then, the ship interaction network links are constructed based on the trajectory coordinates. The specific steps are as follows: B1. Node clustering: First, the elbow method is used to calculate the optimal number of cluster centers n. Then, the KMeans clustering function is used to cluster the ship trajectory coordinates according to the density to obtain n cluster centers, which serve as nodes in the ship interaction network, i.e., the shared node set V. These nodes represent points where ship trajectories are relatively dense or the most frequently visited points; finally, P″=(id,x,y,t) is mapped to its respective cluster center point to obtain P c = (id, c, t), where c represents the cluster center number; B2. Constructing a Ship Interaction Network Using Trajectory Coordinates: Add links to ship interaction network nodes using trajectory coordinates; traverse the ship trajectory coordinates in the time slice, taking the cluster center point number c in the current coordinate as the starting point; if the next coordinate has the same id but different c, add a link with these two nodes as endpoints; otherwise, take c in its coordinates as the new starting point; construct a link set E in this way on time slice t. t ={e t1 ,e t2 ,…,e tξ }; where e represents a link, and ξ is the total number of links in time slice t; these links represent the ship's navigation trajectory; finally, a ship interaction network G consisting of cluster centers and links is obtained. t =(V,E) t ); C. Establish a ship trajectory prediction model based on a locally anonymous spatiotemporal self-attention network. Ship trajectory prediction model based on locally anonymous spatiotemporal self-attention network A dynamic graph neural network containing structural self-attention layers and temporal self-attention layers, wherein the dynamic graph... G, a series of static image snapshots t =(V,E) t Composed of ) G t This indicates that at time t, there is a shared set of nodes V and edge set E. t Adjacency matrix A t The weighted graph, It is a set of graph embedding representations with T timestamps, representing the characteristic relationships of ship trajectories; It is the set of adjacency matrices of the ship trajectory network at T timestamps, ε={E 1 E 2 ,…,E T } represents the set of all timestamp edges; C1. Obtain initial relative position information using locally anonymous random walks: First, in G t Starting from a single node v, perform M random walks, with each walk also consisting of M steps, to obtain the local anonymity feature matrix X′ of that node. t The row coordinates are all from the starting node v, and the column coordinates are from the node set. Then, in the local anonymized feature matrix X′ t For each column, the number of times the column coordinate node appears in that column is calculated, and the local anonymity feature vector of node v is composed of M hit counts. To replace the information of node v itself; C2. Construct a self-attention graph convolutional layer for the ship trajectory structure: Perform graph convolution along the graph structure dimension to aggregate node neighbor information; use node feature vectors obtained through local anonymization. As input, neighbor node information is aggregated through structural self-attention, and the attention is calculated and weighted summation is performed to obtain node features. Then, by aggregating the features of all nodes in the current time slice, we obtain the structural features z of the time slice. t As shown in formula (1): Where node u is a neighbor of node v. It is a snapshot G t The set of neighboring nodes of node v; W represents the local feature vectors of nodes u and v, respectively. s It is a shared weight transformation applied to each node in the graph; α is the weight parameter of the self-attention function, α T It is the transpose of α; It is the embedding generated between nodes u and v during the calculation of self-attention parameters at time t; || is the concatenation operation, and σ(·) is the nonlinear activation function. This is the current snapshot G t The weights of the links between nodes u and v in the middle; C3. Construct a temporal self-attention map convolutional layer for ship trajectories: Perform convolution on the temporal dimension of the map slices to aggregate temporal features; convert the structural features z of each time slice output by the structural self-attention layer into... t The input time-series self-attention layer captures the temporal change patterns of the dynamic graph and obtains the ship trajectory feature Z containing time-series information, as shown in formula (2): Where, β t The attention weight matrix W is obtained by multiplying the transpose of the attention function. q For self-attention, the built-in parameter matrix is: q = query, representing the requested query information; W = ... k W is the built-in parameter matrix for self-attention, where k is the key and represents all feature information related to the request; v For self-attention built-in parameter matrix, v is the value, simply representing the original feature information; e ′t The embedding is generated during the computation of the attention weight matrix at time t; M is a scaling factor to avoid excessively large values; t It is the mask matrix of time slice t, used to enhance the model's ability to filter key information; C4. Use ship trajectory features as label samples to evaluate the cross-entropy loss function, as shown in formula (3): Where σ is the sigmoid function, <,> denotes the inner product operation; l(v) represents a random walk starting at node v. Q is the set of nodes that co-occur with v during a random walk with a fixed step size in snapshot t. t (v) is the negative sampling distribution at time t starting from node v, where u′ is a node in the negative sampling distribution, and w q It is the negative sampling ratio, an adjustable hyperparameter used to balance positive and negative sampling; C5. Optimize the parameters of the ship trajectory prediction model and perform ship trajectory prediction; after obtaining the cross-entropy loss function L, use the gradient descent algorithm to iteratively optimize the parameters of the ship trajectory prediction model. When L is minimized, obtain the optimal parameters of the ship trajectory prediction model and perform prediction. The prediction process is shown in formula (4): Where Γ={P1,P2,…,P h } represents the ship's navigation trajectory consisting of a series of timestamps P, where h is the total number of timestamps constituting the trajectory; Γ 1 ,Γ 2 ,…,Γ T The ship's historical navigation trajectory data is input into the ship trajectory prediction model F for prediction, resulting in the predicted ship trajectory Γ. T+N N represents the number of steps required for ship trajectory prediction.