A ship trajectory prediction method and system based on anti-smuggling key points
By introducing anti-smuggling key points and the Transformer architecture, combined with a multi-head self-attention mechanism, the problem of prediction error accumulation under complex nonlinear motion in traditional methods is solved, and high-precision long-term trajectory prediction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG POLICE COLLEGE (GUANGDONG PROVINCIAL PUBLIC SECURITY JUDICIAL MANAGEMENT CADRE COLLEGE)
- Filing Date
- 2026-03-19
- Publication Date
- 2026-06-12
AI Technical Summary
Existing trajectory prediction methods are difficult to accurately predict the long-term trajectories of smuggling vessels, especially under complex nonlinear motion modes. The prediction errors of traditional methods are prone to accumulate, failing to meet the high-precision requirements of law enforcement agencies, and lacking the utilization of key geographic environmental information.
We introduce anti-smuggling key points defined by expert experience, and construct a Transformer architecture based on discrete embedding by calculating the spherical distance and orientation angle between the ship and the key points. We combine a multi-head self-attention mechanism to capture spatiotemporal dependencies and construct a multi-task joint loss function for supervised training.
It improves the accuracy and robustness of long-term trajectory prediction, reduces error accumulation, and enhances the convergence speed of the prediction algorithm and its adaptability to the anti-smuggling regulatory environment.
Smart Images

Figure CN122196444A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship trajectory prediction technology, and in particular to a ship trajectory prediction method and system based on key anti-smuggling points. Background Technology
[0002] With the deep integration of the global maritime economy, maritime transport has become a vital artery for national foreign trade and the flow of goods. However, the accompanying maritime smuggling and other illegal activities are becoming increasingly rampant, posing a severe challenge to national economic security and maritime defense stability. Therefore, it is particularly important to construct an all-weather, intelligent maritime monitoring system and achieve precise targeting and movement prediction of suspected vessels. In anti-smuggling operations, vessel trajectory prediction is the core technical support for judging the intentions of suspected vessels and formulating interception plans. However, unlike normal merchant ships that travel along fixed routes, smuggling vessels often exhibit strong stealth, resistance, and nonlinear maneuvering characteristics in order to evade radar monitoring and maritime patrol interception. These characteristics include adopting complex detour routes, sudden changes in speed and direction, and even blind navigation with AIS signals turned off. Traditional trajectory prediction methods, such as Kalman filtering and its improved algorithms, are usually based on linear systems or Gaussian distribution assumptions, making it difficult to effectively model the highly complex and nonlinear motion patterns of smuggling vessels. Especially when vessels make large-scale maneuvers or long-distance detours, the prediction errors of traditional methods accumulate rapidly, failing to meet the practical needs of law enforcement agencies for long-term, high-precision operations.
[0003] In recent years, artificial intelligence technologies represented by deep learning, such as recurrent neural networks and the Transformer architecture, have been gradually applied to the field of trajectory prediction due to their powerful nonlinear fitting capabilities. However, they still have many limitations when facing the specific and complex scenario of combating smuggling. On the one hand, existing models are mostly limited to focusing on the historical motion state of the ships themselves, while ignoring the fact that smuggling vessels often have clear destination orientation or evasion behavior. That is, they lack the utilization of key geographical environmental information such as hidden docks and key monitoring areas, making it difficult for the models to accurately predict the final destination after a long period of time. On the other hand, smuggling vessel data is often accompanied by positioning noise, and directly regressing continuous values can easily lead to training instability. Moreover, existing models lack effective spatial constraints in long-term predictions, which can easily lead to accumulated errors.
[0004] Therefore, there is an urgent need to develop a long-term trajectory prediction method that can integrate key geographical information, adopt discretized embedding representation, and possess high robustness, in order to improve the intelligence level and interception success rate of combating maritime smuggling activities. Summary of the Invention
[0005] To overcome the shortcomings and deficiencies of existing technologies, this invention provides a ship trajectory prediction method and system based on anti-smuggling key points. This invention aims to enhance environmental context awareness and multi-dimensional constraints, specifically addressing the characteristics of smuggling vessels—high concealment and complex maneuvers. By introducing expert-defined anti-smuggling key points and constructing a Transformer architecture based on discrete embedding, it enhances the model's ability to capture ship evasion behavior and global motion trends. Specifically, the steps include: reading raw ship trajectory data from a maritime regulatory database; calculating the spherical distance and direction angle of the trajectory point to be predicted relative to the anti-smuggling key points; merging this with the original latitude, longitude, and ground speed and heading to obtain an extended feature tensor; and feeding the extended feature tensor into a feature discrete embedding module, which, through linear binning discretization and table lookup operations, maps it into a comprehensive embedded representation that integrates multi-source heterogeneous information. The representation is fed into the Transformer architecture module, where positional embedding information is superimposed, and a multi-head self-attention mechanism with causal masking is used to capture long-term spatiotemporal dependencies; the resulting hidden layer feature representation is then processed. The data is fed into the prediction output module, where the trajectory probability distribution is decoupled and obtained. A multi-task joint loss function is then constructed to weight and sum the primary and secondary spatial smoothing cross-entropy losses to complete the joint supervised training of the model. The resulting long-term trajectory prediction not only has high positional accuracy but also maintains consistency with the anti-smuggling regulatory environment in terms of spatial geometry and logic. This effectively improves the error accumulation problem in long-term prediction of smuggling vessels and significantly enhances the convergence speed and robustness of the prediction algorithm.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: Step 1: Construct a feature engineering module based on key anti-smuggling points. Read the original ship track sequence from the maritime regulatory database, and based on the experience of maritime regulatory experts, set the coordinates of key anti-smuggling points within the prediction area (such as maritime checkpoints, the center of key monitoring areas). Calculate the spherical distance features and signed direction angle features of the ship's track point relative to the key anti-smuggling points. Merge the original latitude, longitude, speed to ground, and heading to ground data with the newly added geometric correlation features to obtain an extended feature tensor containing six-dimensional information. Step 2: Constructing the Discrete Feature Embedding Module. The extended feature tensor X is fed into the discrete feature embedding module. Using a linear binning strategy, continuous features in each dimension—latitude, longitude, speed to ground, heading to ground, spherical distance to anti-smuggling key points, and azimuth angle—are converted into discrete integer indices based on a preset resolution range. Then, each index is input into the corresponding learnable embedding matrix for table lookup, resulting in a comprehensive embedding table that integrates the ship's motion state with the correlation information of anti-smuggling key points. ; Step 3: Construct the Transformer structural module. Integrate the embedded representation. The data is fed into a Transformer architecture module as input, and learnable position embedding parameters are superimposed. A multi-head self-attention mechanism with causal masking is used to process time-series data in parallel, capturing the temporal dependencies between smuggling vessel track points and the spatial correlation patterns between track points and key anti-smuggling points, thus generating more powerful hidden layer feature representations. ; Step 4: Construct the prediction output module. Represent the hidden layer features output by the Transformer. The data is fed into a fully connected layer and mapped back to the discrete grid dimension of the full feature space. Then, it is decoupled into independent prediction tensors of six feature dimensions: latitude, longitude, speed to ground, heading to ground, spherical distance to anti-smuggling key points, and direction angle using tensor splitting operation. The prediction probability distribution for the next time step is generated by the Softmax activation function. Step 5: Construct the joint loss function calculation module. For the discretized probability distribution of the model output, after spatial smoothing, calculate the cross-entropy loss between the predicted distribution and the true label index in each dimension; define the losses for latitude and longitude and ground speed and heading as the main loss, and define the losses for spherical distance and direction angle relative to key points as auxiliary losses. Use a weighted summation strategy to construct the joint loss function for supervised training of the model. Step Six: Model Training. Based on the deep learning framework and backpropagation algorithm, a parameter grouping optimization strategy is implemented. The network parameters are iteratively updated with the goal of minimizing the joint loss function. This guides the model to learn the basic motion laws of ships and the geometric constraints between them and key anti-smuggling points. After training is completed, the model parameters are saved. Step 7: Model Testing and Application. Load the trained ship trajectory prediction model based on key anti-smuggling points, and input historical trajectory data of suspected vessels using an autoregressive model. At the output end, a grid center value mapping strategy combining Top-K probability filtering and multinomial distribution sampling is employed to recover high-precision continuous physical values from the discrete prediction probability distribution, outputting the six-dimensional feature prediction results for the next time step in real time. Among these, latitude and longitude values are used to construct the predicted trajectory including the future geographical location, while the remaining features are retained as predicted values for motion state and geometric constraints, providing early warning support for maritime supervision.
[0007] As a preferred technical solution, a feature engineering module based on key anti-smuggling points is constructed to read the original vessel track data from the maritime regulatory database. Based on the original four-dimensional basic features of latitude (LAT), longitude (LON), speed on land (SOG), and heading on land (COG), the coordinates of key anti-smuggling points within the prediction area are set according to expert experience. By calculating the geometric correlation features between the track points to be predicted and the key points, the original track sequence is expanded into an extended feature tensor X containing spatial and geometric constraints (i.e., the feature channels are expanded from 4-dimensional to 6-dimensional). Specific steps include: Determine the location of key anti-smuggling points and calculate spherical distance characteristics: Based on maritime regulatory needs, define the geographic coordinates of key anti-smuggling points within the trajectory prediction space. To eliminate scale differences in the original latitude and longitude data, a projection algorithm or normalization process is used to map the coordinates to a unified metric space; for each time step, the spherical distance between the track point and the key anti-smuggling point is calculated. In the data preprocessing stage, to adapt to the input requirements of the subsequent neural network, the calculated spherical distance is mapped to... The standard numerical range is used to ensure that it is in the same dimension and order of magnitude as basic features such as latitude and longitude, ground speed and heading, so as to prevent numerical instability from affecting model convergence.
[0008] Calculating Signed Direction Angle Features: To capture the evasion intentions of smuggling vessels relative to key anti-smuggling points, directional angle features are constructed. Based on the vessel's instantaneous motion vector and its azimuth vector pointing to the key point, the signed direction angle is calculated using the vector dot product and two-dimensional cross product. Similarly, according to the data loader's preprocessing specifications, this angular feature is linearly mapped to its physical value range. The interval is then converted into a specific integer index in the subsequent discretization stage. This feature explicitly encodes the ship's port-side or starboard-side evasive maneuvers, improving upon the problem that traditional methods relying solely on the ship's own course cannot perceive environmental constraints.
[0009] Constructing an extended feature tensor: Extract latitude, longitude, speed to ground, and heading to ground from the original track sequence to form the basic state tensor. ); and compare it with the geometric correlation feature (spherical distance) calculated above. and direction angle The features are concatenated along the feature channel dimension to construct an extended feature tensor X( This feature tensor, after outlier truncation, serves as the standard input unit for subsequent neural network models.
[0010] As a preferred technical solution, a feature discrete embedding module is constructed. Targeting the nonlinear characteristics of smuggling vessel motion data, an embedding layer structure based on a lookup table is adopted to map the integer indices of the discretized extended feature tensor X to a continuous high-dimensional semantic space. Specific steps include: Feature discretization and index transformation: Based on the size of the feature vocabulary for each dimension, continuous normalized floating-point features are converted into discrete integer indices. Specifically, the discrete size of each dimension is set to... The discrete dimensions of the longitude dimension are The discrete dimensions of the ground speed and heading are respectively and The discrete dimensions of the two geometrically related features, spherical distance and orientation angle, are respectively... and By using a linear binning strategy, each value in the extended feature tensor is mapped to its corresponding index, resulting in an index tensor.
[0011] High-dimensional embedding representation with independent mapping: An embedding layer is constructed containing multiple independent sub-modules, each configured with a learnable embedding matrix corresponding to latitude, longitude, ground speed, ground heading, and keypoint geometric features. Discrete indices for each dimension are input into the corresponding embedding layer, and the dense embedding representation corresponding to that index is directly obtained through a lookup table operation. This process avoids the high computational overhead of sparse matrix multiplication and utilizes backpropagation to update the parameters in the embedding matrix, automatically learning the semantic representation of the features.
[0012] Sequence feature fusion construction: combining features from the same time step The vectors obtained after embedding mapping of all feature dimensions are concatenated by channels in the last dimension, i.e.: .
[0013] If the dimension of the dimensional embedding is Longitude embedding dimension is And so on, the concatenated single-step synthetic embedding representation Dimensions Subsequently, the single-step synthesis embedding of all time steps is represented. Stacking forms a comprehensive embedded representation (Dimension:) ), which serves as the standard input for subsequent Transformer structure modules.
[0014] As a preferred technical solution, a Transformer structure module is constructed, employing a multi-layered stacked self-attention architecture. First, a position embedding layer is built to address the issue of the attention mechanism's inability to recognize sequence order. This is followed by a comprehensive embedding representation output from the feature discrete embedding module. (Contains features from T time steps), initialize a learnable location embedding parameter matrix with the same dimension as the input. The system automatically learns the optimal temporal location representation through training. Then, it performs feature and location aggregation to synthesize the embedded representation. With position embedding parameter matrix Element-by-element addition, i.e. Finally, to ensure the causality of the time-series predictions, a causal mask is applied before the input to the self-attention layer to ensure that the model processes the current time step. At that time, one can only focus on to Historical information at any given moment is used to prevent future information leaks.
[0015] Linear projection and matrix construction: Integrating the input tensor with positional information The query matrix is mapped through three learnable linear projection layers. Key matrix Sum matrix Due to the input tensor The query matrix already explicitly includes spherical distance and orientation angle features related to key anti-smuggling points. Bond matrix When calculating the dot product, the spatiotemporal relationship between the trajectory and key points can be learned through the feature interaction process; Multi-head self-attention computation: Within each attention head, the input tensor is computed in parallel using a scaled dot product attention mechanism. The internal relevance weight is calculated using the following formula: ;in, The subspace dimension of the query vector and key vector in each attention head; This is an upper triangular mask matrix, where the elements in the upper triangular region (excluding the diagonal) are negative infinity. ), the rest are 0. (Introduction) As a scaling factor, the mask matrix adjusts the numerical magnitude. Ensure that the attention weights after Softmax are only assigned to historical time steps. Finally, concatenate the output vectors of all attention heads and perform a linear transformation to output the result, which serves as the input to the feedforward neural network.
[0016] Parallel Processing and Feedforward Network: This module contains a pointwise location-based feedforward network, consisting of two linear layers and an activation function. Input features are processed through multiple stacked Transformer blocks, each employing layer normalization and residual connections to prevent gradient vanishing in deeper networks. The final output is a hidden layer feature representation incorporating global contextual information and anti-smuggling keypoint constraints. .
[0017] As a preferred technical solution, a prediction output module is constructed to receive the hidden layer feature representation output by the Transformer structure module. The process involves using fully connected layers to map high-dimensional semantic features back to the original discrete feature space and decoupling them into prediction probability distributions for each physical dimension. Specific steps include: Fully connected mapping and feature decoupling: Construct a linear mapping layer at the output end, where the total number of output nodes corresponds to the sum of the total number of discrete intervals divided by all feature dimensions (latitude, longitude, speed to ground, heading to ground, spherical distance to anti-smuggling key points, and orientation angle). Represent the hidden layer features output by the Transformer. Inputting the network yields the unnormalized log probabilities of the entire feature space. Subsequently, based on the vocabulary size of each dimension, tensor splitting operations are used to decouple the unnormalized log probabilities into independent prediction tensors corresponding to the six dimensions.
[0018] Probability Distribution Generation and Numerical Recovery: For the prediction tensor of each decoupled feature dimension, the Softmax activation function is applied for normalization to obtain the probability distribution of the feature in each discrete interval. Furthermore, to recover continuous physical values from the discrete distribution, a Top-K filtering and multinomial random sampling strategy is used to select the target interval index, and this index is mapped to the geometric center value of the corresponding interval, thereby outputting accurate values such as latitude, longitude, ground speed, ground heading, spherical distance to key anti-smuggling points, and direction angle.
[0019] As a preferred technical solution, a joint loss function calculation module is constructed. To enable the model to learn the motion state of smuggling vessels while also considering their spatial geometric constraints relative to key anti-smuggling points, a joint optimization objective including basic feature loss and geometric correlation loss is designed. The specific steps include: The main loss for the basic features is calculated as follows: A multi-task learning strategy is employed for the four basic motion state dimensions of the ship: latitude, longitude, speed to ground, and heading to ground. The cross-entropy loss, which incorporates spatial smoothing, is calculated between the predicted probability distribution of each dimension output by the model and its corresponding ground truth label (discrete index). Let the losses for latitude, longitude, speed to ground, and heading be denoted as follows: The single-step basic feature principal loss is defined as the sum of the four factors, used to supervise the model to accurately capture the ship's physical position and motion trend in the next moment.
[0020] Calculate the auxiliary loss for the geometric features of key anti-smuggling points: Extract the prediction branch corresponding to the model output layer for the two geometrically related dimensions introduced: "spherical distance to the key anti-smuggling point" and "direction angle". Calculate the loss between the predicted spherical distance distribution and the true distance label. And the loss between the predicted orientation angle distribution and the true orientation angle label. This auxiliary loss helps the model learn the interaction between ships and key anti-smuggling points in the feature space, reducing the risk of logical deviations between the predicted path and key anti-smuggling points over long periods.
[0021] Joint Loss Weighted Optimization: Constructing the Final Joint Loss Function The main loss of the basic features Auxiliary loss with geometric features The weighted summation is calculated using the following formula: Among them, the main loss Auxiliary loss ; A preset balancing weight coefficient (e.g., 1.0) is used to adjust the proportion of geometric constraints in the joint loss, and auxiliary supervision signals of spherical distance and orientation angle are introduced as regularization terms. This invention, through the aforementioned joint loss function, ensures that the six dimensions of the model output mutually constrain and collaboratively optimize during backpropagation.
[0022] As a preferred technical solution, the model training is based on a deep learning framework to construct a training process, which minimizes the joint loss function using the backpropagation algorithm and the adaptive moment estimation optimization algorithm (AdamW). Specific steps include: Optimizer Configuration and Parameter Grouping: To improve the model's generalization ability and prevent overfitting, the AdamW optimizer is employed, along with a parameter grouping optimization strategy. Model parameters are divided into "decaying groups" and "non-decaying groups": weight decay is applied to the parameters of linear layer weights for regularization; for parameters such as bias terms, layer normalized weights, and position embeddings, the weight decay coefficient is set to 0. This strategy effectively constrains model complexity while maintaining the model's fitting ability.
[0023] Optimizer Configuration and Multi-Task Joint Loss Calculation: During training, the AdamW optimizer is used for parameter updates, and a fixed learning rate (e.g., 6e-4) is set to maintain training stability. Simultaneously, to balance the learning of basic trajectory features and the geometric features of anti-smuggling key points, a multi-task joint loss function is constructed. For the predicted probability distributions of the six dimensions of the model output (latitude, longitude, ground speed, ground heading, spherical distance to anti-smuggling key points, and heading angle), spatial smoothing is applied, and the cross-entropy loss between these dimensions and the true label index is calculated. The losses for latitude, longitude, ground speed, and heading are defined as the main losses, while the losses for spherical distance to anti-smuggling key points and heading angle are defined as auxiliary losses. These two losses are weighted and summed using preset weighting coefficients, thereby balancing the gradient signals of different feature dimensions during backpropagation and achieving joint supervised training of the model.
[0024] Iterative update of joint geometric constraints: The extended feature tensor X from historical time steps is input into the model. The joint loss value based on multi-task weights is calculated through forward propagation. This loss function integrates the prediction errors of basic motion features (latitude and longitude, ground speed and heading) with geometric correlation features (spherical distance and direction angle of anti-smuggling key points). An automatic differentiation mechanism is used to calculate the gradient and update the network parameters. This process guides the model to learn the coupling relationship between changes in latitude and longitude and changes in the spherical distance and direction angle of anti-smuggling key points, thereby improving the physical and logical consistency of the predicted trajectory.
[0025] As a preferred technical solution, the model testing and application aims to use the trained Transformer model to perform real-time trajectory simulation and intent assessment of suspected vessels on the sea surface. Specific steps include: Model Loading and Forward Inference: Load the model weights that performed best on the validation set during training. Read historical track data of the suspected vessel to be monitored from the test set; this data includes preprocessed and normalized six-dimensional features. Feed the data into the model for forward inference; the model outputs the next time step... The unnormalized log probability in the prediction space is decoupled into six dimensions: latitude, longitude, speed to ground, heading to ground, spherical distance to key anti-smuggling points, and direction angle.
[0026] Probability Sampling and Center Value Mapping: To recover continuous physical trajectory points from discrete prediction distributions, a grid center value mapping strategy combining Top-K probability filtering and multivariate distribution sampling is employed. First, Top-K filtering is performed on the unnormalized log probabilities of each dimension, retaining only the points with the highest probabilities. For each interval, the unnormalized logarithmic probability of the remaining intervals is set to negative infinity and then Softmax normalized. Subsequently, multinomial random sampling is performed based on the normalized probability distribution to select the target discrete index. (in Then, the selected discrete index is mapped back to a continuous value within the normalized interval using the grid center value mapping formula. The calculation formula is as follows: in, This is the grid center offset. This represents the total number of grid cells in that dimension; finally, it is combined with the maximum value in that dimension. and minimum value To perform inverse normalization, the calculation formula is: This allows us to obtain accurate physical coordinates and geometric characteristic values.
[0027] To address the need for long-term trajectory prediction, an autoregressive generation mode is adopted. The predicted point generated at the current moment is added to the end of the input sequence as new known information, and the oldest time step is removed. The model is then iteratively input into the model to predict the next moment until a complete trajectory is generated.
[0028] During the evaluation phase, a comprehensive evaluation index system comprising five dimensions was constructed: First, the mean absolute error (MAE) and median absolute error (MdAE) were calculated in the normalized feature space (or latitude and longitude coordinate space) to reflect the model's fitting accuracy in the numerical domain and its robustness after excluding extreme outliers; Second, after inverse normalizing the predicted coordinates, the true distance between the predicted point and the actual point on the spherical physical space was calculated using the semi-versus formula, and the mean displacement error (ADE) and final displacement error (FDE) were obtained accordingly to quantify the overall route deviation and final destination prediction deviation of the predicted trajectory on the actual sea surface; Finally, the coefficients of determination (R²) for latitude and longitude were calculated respectively to comprehensively evaluate the degree of agreement between the shape of the predicted trajectory and the actual smuggling route.
[0029] The present invention also provides a ship trajectory prediction system based on anti-smuggling key points, comprising: a feature engineering module based on anti-smuggling key points, a feature discrete embedding module, a Transformer structure module, a prediction output module, a joint loss function calculation module, a training module, and a testing module; The feature engineering module based on anti-smuggling key points is used to read the original ship track data in the maritime supervision database. Based on the four-dimensional basic features of latitude, longitude, speed to ground, and heading to ground, the coordinates of anti-smuggling key points in the prediction area are set according to expert experience. The spherical distance feature and the signed direction angle feature between the track point to be predicted and the anti-smuggling key point are calculated. The original track sequence is expanded into an extended feature tensor X containing spatial and geometric constraints. The feature discrete embedding module is used to construct an embedding layer structure based on a lookup table. First, it uses a linear binning strategy to expand the continuous normalized features in the feature tensor X into discrete integer indices. Then, it inputs the discrete indices of each dimension into the corresponding learnable embedding matrix for a lookup operation, mapping the discrete features to a continuous high-dimensional semantic space. Finally, it forms a serialized comprehensive embedding representation through channel concatenation. ; The Transformer structure module is used to receive the synthesized embedded representation. By superimposing learnable position embedding parameters and utilizing a multi-head self-attention mechanism with causal masking, correlation weights within the track sequence are computed in parallel. This captures long-term dependencies between track points and between track points and key anti-smuggling points, generating hidden layer feature representations. ; The prediction output module is used to receive the hidden layer feature representation. The fully connected layer is used to map it back to the discrete grid dimension of the full feature space, and the tensor is decoupled into six feature dimensions of latitude, longitude, ground speed, ground heading, spherical distance to anti-smuggling key point and direction angle using tensor partitioning operation. The prediction probability distribution of the next time step is generated by the Softmax activation function. The joint loss function calculation module is used to calculate the cross-entropy loss between the predicted distribution and the true label index in each dimension after spatial smoothing of the discretized probability distribution output by the model. The loss of latitude and longitude and the speed and heading to the ground are the main losses, and the loss of spherical distance and direction angle with anti-smuggling key points are the auxiliary losses. The main loss and auxiliary loss are weighted and summed using preset weight coefficients to finally construct a joint loss function that includes basic features and geometric constraints. The training module, based on a deep learning framework and backpropagation algorithm, uses a parameter grouping optimization strategy and an adaptive moment estimation optimizer to iteratively update network parameters with the goal of minimizing the joint loss function, guiding the model to learn the laws of ship motion and the geometric constraints of key anti-smuggling points. The test module is used to load the optimal training model weights, input the historical track data of the suspected vessel using an autoregressive generation mode, and at the output end, it uses a Top-K probability filtering combined with a grid center value mapping strategy of multivariate distribution sampling to recover continuous physical values and output the six-dimensional feature prediction results for the next moment in real time. Among them, latitude and longitude are used to construct the future geographical location trajectory, and the other features are retained as predicted values of motion state and geometric constraints.
[0030] The technical effects and advantages of this invention are as follows: This invention breaks through the limitations of traditional models that rely solely on their own historical motion states. It introduces expert-defined "anti-smuggling key points" and calculates spherical distances and signed direction angles to explicitly encode the ship's port / starboard evasive behavior, endowing the model with environmental awareness and improving the physical interpretability and geometric consistency of long-term predictions. Addressing the instability of AIS positioning noise and continuous numerical regression, it employs linear binning and embedded lookup tables to construct a discretized embedded representation. This filters out numerical noise, avoids the high computational overhead of sparse matrix multiplication, and achieves deep semantic learning of multi-source heterogeneous features. Furthermore, a multi-task joint loss function is constructed during the training phase, fusing and co-optimizing the basic motion main loss and geometric correlation auxiliary loss, thereby improving the performance of highly complex nonlinear models. The rapid accumulation of errors under maneuvering effectively improves the model's convergence speed and robustness. Finally, the prediction output abandons the traditional direct numerical output and innovatively combines Top-K probability filtering and grid center value mapping strategies to restore high-precision continuous physical values, effectively improving the error accumulation problem in long-term prediction. The measured mean absolute error in the numerical domain is reduced by about 8.5% compared with the advanced TrAISformer algorithm, and the final displacement error, which characterizes the long-term prediction performance of physical space, is significantly reduced by about 22.8%. While effectively reducing the offset between coordinates and actual position, it maintains excellent trajectory shape fitting (the coefficient of determination R² is improved to 0.992), providing more reliable trend prediction and intelligent early warning support for maritime anti-smuggling operations. Attached Figure Description
[0031] Figure 1 This is an overall block diagram of the system structure of the present invention; Figure 2 This is a flowchart of the method of the present invention; Figure 3 This is a training and validation loss curve of the ship trajectory prediction method based on anti-smuggling key points in this embodiment; Figure 4 This is a flowchart of the test module in the ship trajectory prediction method based on anti-smuggling key points in this embodiment; Figure 5 This is a comparison chart of the observed trajectory, the actual trajectory, and the predicted trajectory of the ship trajectory prediction method based on key anti-smuggling points in this embodiment. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0033] Example This embodiment uses AIS (Automatic Identification System) data released by the Danish Maritime Authority (DMA) as the experimental benchmark. This dataset covers the Belt Strait and surrounding waters, a vital waterway connecting the Baltic and North Seas. This region is characterized by complex topography, numerous islands and reefs, facilitating concealed navigation, and is a key area for maritime surveillance and anti-smuggling monitoring. Unlike straight-line navigation in the open ocean, vessel trajectories in this area are constrained by narrow waterways, lane separation systems, and stringent monitoring requirements, exhibiting strong nonlinear and maneuverability characteristics. This effectively simulates the complex behaviors of smuggling vessels, such as maneuvering and speed changes, within controlled waters. This dataset was chosen to verify the effectiveness of the model in long-term trajectory prediction under complex geographical constraints, combined with information from key shore-based anti-smuggling points (such as strait entrance / exit checkpoints, radar monitoring centers, and key buoys). The dataset includes navigation data under various weather conditions, including high winds and waves, ensuring the diversity and generalization ability of the model's training samples.
[0034] At the data preprocessing level, to address the noise and anomalies present in the original AIS signal, this embodiment first performs data cleaning to remove invalid trajectory sequences containing NaN values and those with insufficient length (e.g., less than 24 time steps). To construct the feature input for fusing anti-smuggling key points, this embodiment, based on electronic nautical charts and regulatory logic, selects the regulatoryly sensitive areas within the sea area as preset anti-smuggling key points. Based on this, the spherical distance and heading angle of each track point relative to the anti-smuggling key points are calculated and used as new feature dimensions, stitched into the original latitude, longitude, speed to ground, and heading to ground data. Subsequently, numerical truncation and maximum / minimum normalization are performed on all feature dimensions, mapping all feature values to... The dataset is divided into training, validation, and test sets in a 7:2:1 ratio. This embodiment is simulated on a Windows 11 system, based on the PyTorch deep learning framework and Python 3.11 environment, and trained using an NVIDIA GPU that supports CUDA.
[0035] like Figure 1 As shown, this embodiment provides a ship trajectory prediction method based on key anti-smuggling points, including the following steps: S1: Construct a data preprocessing and feature expansion module. Read the original AIS trajectory data from the dataset, send the trajectory data to the data preprocessing module to filter out invalid data such as trajectory sequences containing NaN values and insufficient length, and calculate expanded features in combination with anti-smuggling key points to construct a normalized extended feature tensor 𝑋.
[0036] In this embodiment, the original trajectory dataset is read, and trajectory sequences containing NaN values or fewer than a set time step (e.g., 24 time steps) are removed, filtering out invalid data that meets the above conditions. For the filtered valid trajectories, based on the preset anti-smuggling key point coordinates, the spherical distance and orientation angle of each track point relative to the anti-smuggling key point are calculated, and these are used as new feature dimensions and concatenated into the original latitude, longitude, ground speed, and ground heading data. Subsequently, numerical truncation and maximum / minimum normalization are performed on all six dimensions of feature data, mapping all feature values to... Within the half-open interval, the extended feature tensor X is constructed.
[0037] S2: Construct a feature discrete embedding module. The normalized extended feature tensor X is fed into this module, where continuous-value linear discretization, embedding lookup, and vector aggregation are performed to capture the semantic relationships between features of different physical dimensions, resulting in a comprehensive embedding representation E that integrates six features. Specific steps include: Normalized continuous data in six dimensions—latitude, longitude, ground speed, ground heading, spherical distance to key anti-smuggling points, and direction angle—are mapped into discrete indices using linear binning strategies with different resolution configurations. Dense embedding representations of the corresponding indices are found from the constructed learnable embedding matrix, and feature fusion is achieved through channel concatenation to obtain a comprehensive embedding representation E.
[0038] The discretization of continuous values at different resolutions first involves configuring discretization grid parameters for each feature dimension. According to the configuration in this embodiment: latitude: set to 250 grids; longitude: set to 270 grids; ground speed: set to 30 grids; ground heading: set to 72 grids; spherical distance to anti-smuggling key points: set to 100 grids; heading angle: set to 72 grids. The discrete integer index for each dimension is obtained by multiplying the normalized value by the corresponding number of grids and rounding down.
[0039] In the embedding lookup step, a trainable feature embedding matrix is first constructed to extract the corresponding feature vectors based on discrete indices. Corresponding to the grid partitioning described above, the following are constructed: dimensional embedding matrices. Longitude embedding matrix Ground speed embedding matrix Ground heading embedding matrix ; Spherical distance embedding matrix ; Direction angle embedding matrix Then, based on the discrete indices obtained above, the corresponding row vectors are searched from the six embedding matrices mentioned above.
[0040] The mathematical expression of the lookup operation that extracts the corresponding feature vector from the embedding matrix based on the discrete index is as follows (using the first...). Time steps of each sample (For example) In the formula, taking latitude as an example, Represents the extraction of learnable embedding matrices The The row is represented by a dense embedding, and the extraction operations for the other dimensions of features are similar.
[0041] The vector aggregation achieved through concatenation involves directly concatenating the feature vectors of the six dimensions along the channel dimension, fusing them to form a single-step integrated embedding representation with a total of 896 dimensions. As the input unit for the subsequent Transformer model, the specific formula is as follows:
[0042] S3: Construct a Transformer structure module that receives the integrated embedded representation output from step S2, which incorporates anti-smuggling key point correlation information. By utilizing a self-attention mechanism with causal masking, long-term dependencies in the track sequence are captured in parallel to obtain the hidden layer feature representation. The specific steps include: In this embodiment, a deep neural network based on a multi-layer self-attention mechanism is constructed. First, the model input dimension is defined. The sum of the embedding dimensions of the aforementioned six features (i.e. The dimension is set to 8 for the multi-head attention mechanism and 8 for the network layer stacking depth. The dimension obtained in step S2 is... Comprehensive Embedded Representation Location information encoding and feature extraction are performed.
[0043] The location information encoding employs a learnable location embedding strategy. A learnable location embedding parameter matrix that matches the maximum sequence length is constructed. During forward propagation, the position vector corresponding to the current input sequence length is extracted and combined with the integrated embedding representation. The elements are added one by one to generate an input tensor Z that incorporates positional information, and then randomly deactivated during subsequent transmission.
[0044] The feature extraction process employs multi-head self-attention computation with causal masking. Within each attention head, a query matrix is generated through a linear transformation. Key matrix Sum matrix After calculating the attention score, an upper triangular causal mask is applied to reset the attention weights for future time steps to negative infinity, ensuring that the model cannot obtain future information when predicting the current time step. The attention weights are then processed using a normalized activation function and compared with the value matrix. Multiplication. Finally, after layer normalization, feedforward neural network, and residual connection processing, the output is a hidden layer feature representation containing global context information. .
[0045] S4: Construct the prediction output module, which receives the hidden layer feature representations output by the Transformer structure module. The process involves using fully connected layers to map high-dimensional semantic features back to the original discrete feature space and decoupling them into unnormalized log probabilities for each physical dimension. Specific steps include: First, determine the output dimension of the entire feature space. Based on the discretization parameters set in step S2, calculate the total number of grids for all feature dimensions. In this embodiment, there are 250 latitude grids, 270 longitude grids, 30 ground speed grids, 72 ground heading grids, 100 spherical distance grids for key anti-smuggling points, and 72 azimuth angle grids, totaling... .
[0046] Representing hidden layer features The fully connected output layer is input and projected onto a 794-dimensional prediction space via a linear transformation to obtain an unnormalized log-probability tensor. To generate the predicted state for the next time step, the output slice of this tensor at the last time step is extracted. Subsequently, based on the number of grids in each feature dimension, the tensor is segmented along the feature channel dimension, decoupled into six independent prediction tensors, corresponding to latitude, longitude, ground speed, ground heading, spherical distance to anti-smuggling key points, and orientation angle, respectively.
[0047] S5: Construct a joint loss function calculation module. To balance ship motion state prediction with the geometric constraints of key anti-smuggling points, a joint optimization objective based on multi-task weighted summation is designed. Specific steps include: Prepare real-world label data. Convert the latitude and longitude, ground speed and heading of the real trajectory points at the next moment, along with the calculated geometric correlation features, into corresponding discrete grid indices, which will serve as the target labels for supervised training.
[0048] To balance the accuracy of basic trajectory prediction with the effectiveness of geometric constraints on anti-smuggling key points, a multi-task joint loss calculation strategy is constructed. For the predicted probability distributions of the model output in six dimensions—latitude, longitude, ground speed, ground heading, spherical distance to anti-smuggling key points, and heading angle—the differences between these distributions and the actual discrete label indices are calculated using a cross-entropy loss function with a spatial smoothing mechanism to preserve the topological continuity between grids. The losses for latitude, longitude, ground speed, and heading are defined as the primary losses, while the losses for spherical distance to anti-smuggling key points and heading angle are defined as auxiliary losses. A weighted sum of the primary and auxiliary losses is constructed by introducing a preset balancing coefficient, thereby constructing the final joint loss function. This allows for the simultaneous optimization of ship motion state and geometric constraints during backpropagation.
[0049] Calculate the joint loss. For the four basic features (latitude, longitude, airspeed, and heading) and the two geometrically related features (spherical distance and heading angle), calculate the cross-entropy loss between the predicted probability distribution of the model output and the true label index, after spatial smoothing. The sum of the losses for the first four basic features is defined as the main loss. The sum of the losses of the latter two geometrically related features is defined as the auxiliary loss. Through preset balancing weight coefficients We obtain the joint loss function by weighted summation of the two. The calculation formula is as follows: By minimizing this joint loss, the model parameters are driven to optimize simultaneously towards physical location accuracy and geometric logical consistency.
[0050] S6: Construct a model training module, building an iterative optimization process based on a deep learning framework. Utilizing parameter grouping strategies and a multi-task joint loss function, the model is driven to learn the spatiotemporal evolution patterns of anti-smuggling routes, such as... Figure 2 As shown, the specific steps include: In this embodiment, the AdamW optimizer is used for parameter updates during model training, and a fixed learning rate (e.g., 6e-4) is set to maintain the stability of the training process. To balance the learning of basic trajectory features and geometric constraint features, when calculating the loss, the predicted probability distributions of the six feature dimensions (latitude, longitude, ground speed, ground heading, spherical distance to anti-smuggling key points, and heading angle) of the model output are spatially smoothed before calculating the cross-entropy loss between them and the true label index. Subsequently, the losses for latitude, longitude, ground speed, and heading are defined as the main loss, and the losses for spherical distance to anti-smuggling key points and heading angle are defined as auxiliary losses. The joint loss value is obtained by weighted summation. Finally, the gradient is calculated using an automatic differentiation mechanism, and the gradient norm is clipped (e.g., a clipping threshold of 1.0). The network parameters are updated by the optimizer to complete a single iteration. Through the above multi-task joint supervised training, the model error gradually decreases and eventually converges. The training and validation loss curves of the ship trajectory prediction model based on anti-smuggling key points in this embodiment are shown below. Figure 3 As shown. By Figure 3 As can be seen, with the increase of the number of training epochs, both the training loss and the validation loss steadily decrease and no obvious overfitting phenomenon is observed, which proves the effectiveness of the training strategy.
[0051] S7: Construct a model testing and numerical inversion module. Utilize the trained model to perform long-term trajectory extrapolation, and employ a probabilistic sampling strategy to recover continuous physical values. Evaluate prediction performance using multi-dimensional metrics, such as... Figure 4 As shown, the specific steps include: The long-term trajectory extrapolation and numerical inversion process first loads the model weights that performed best on the validation set during training. For trajectory prediction in future time periods, the model employs an autoregressive generation mode: in each prediction step, the historical trajectory sequence of the ship to be monitored is input into the model to obtain the unnormalized prediction tensor for the next moment. To recover high-precision continuous physical values from discrete distributions, this invention uses a sampling mapping strategy. First, the output tensor is filtered, retaining only the intervals with the highest probability and re-normalizing with Softmax. Subsequently, multivariate random sampling is performed based on this distribution to select target discrete indices. Then, using the grid center value mapping formula and inverse normalization operation, the selected discrete indices are converted into accurate continuous values (the mapping process incorporates grid center offset and the maximum and minimum values of features). After completing a single-step inversion, the model outputs complete six-dimensional prediction values. These six-dimensional values (including predicted latitude and longitude, ground speed, ground heading, spherical distance, and heading angle) are appended to the end of the input sequence as new trajectory points, and the oldest time step is removed. This prediction process is repeated until a complete future trajectory sequence is generated. In this process, latitude and longitude sequences are extracted to construct an intuitive map of future geographic locations, while the predictions for the other four dimensions serve as necessary state variables to maintain the model's autoregressive loop.
[0052] To visually verify the prediction effect of the method proposed in this invention, the predicted data generated in this embodiment is compared with the real data. The comparison diagram of the observed trajectory, the real trajectory, and the predicted trajectory is shown below. Figure 5 As shown. By Figure 5 It can be seen that after introducing geometric constraints on key anti-smuggling points, the predicted trajectory (marked by the red line in the figure) can better match the actual maneuvering and turning trajectory of smuggling vessels (marked by the green line in the figure), achieving highly accurate long-term trajectory extrapolation.
[0053] The multi-dimensional comprehensive evaluation refers to constructing an evaluation system with five dimensions after the prediction is completed to verify the model performance. Specifically, it includes: First, calculating the mean absolute error and median absolute error in latitude and longitude coordinate (or normalized) space to reflect the model's fitting accuracy in the numerical domain and its robustness after excluding extreme outliers; Second, after inverse normalizing the predicted coordinates, using the semi-versus formula to calculate the true distance between the predicted point and the actual point in the spherical physical space, and accordingly obtaining the mean displacement error and the final displacement error, respectively quantifying the overall route deviation of the predicted trajectory on the actual sea surface and the prediction deviation of the final destination; Finally, calculating the determination coefficients of latitude and longitude respectively, comprehensively evaluating the degree of fit between the shape of the predicted trajectory and the actual smuggling route, thereby outputting a reliable anti-smuggling trajectory prediction result.
[0054] To demonstrate the effectiveness of this invention, this embodiment follows the testing conditions of existing ship trajectory prediction algorithms, training and testing are performed on the DMA AIS dataset, and the state-of-the-art algorithm TrAISformer (published in the IEEE Journal in 2024) is selected as the benchmark model for comparison. To comprehensively evaluate prediction performance, five metrics—mean absolute error (MAE), median absolute error (MdAE), coefficient of determination (R²), average displacement error (ADE), and final displacement error (FDE)—are used for quantitative analysis. The experimental results are shown in Table 1. Table 1. Comparison of performance metrics between the method of this invention and the TRAISformer model. As shown in Table 1, compared with the TrAISformer method, the present invention improves all performance indicators. Specifically, in terms of the MAE and MdAE indices, which reflect the accuracy of coordinate domain fitting, the present method reduces the MAE from 2.587 to 2.367 and the MdAE from 1.244 to 1.236, respectively; in the physical space evaluation index, the average displacement error (ADE) decreases from 0.962 km to 0.917 km, and the final displacement error (FDE) decreases from 10.576 km to 8.163 km; at the same time, the coefficient of determination (C²) increases from 0.990 to 0.992. The above results indicate that the method of the present invention outperforms the comparative model in terms of trajectory fitting accuracy and spatial location prediction performance, and exhibits better error control capabilities in scenarios with long prediction spans.
[0055] This invention addresses the pain points of existing prediction methods, such as difficulty in performing long-term accurate tasks and lack of geographical environment awareness. It aims to improve the physical interpretability and accuracy of long-term prediction tasks by introducing anti-smuggling key point features from the perspective of Transformer network feature extraction and environmental constraints.
[0056] First, the original ship track data is read from the dataset and input into the feature engineering module. Based on expert experience, the coordinates of key points are set and the spherical distance and direction angle are calculated, expanding the original four-dimensional features into a six-dimensional extended feature tensor X containing spatial geometric constraints. Then, the tensor X is sent into the feature discrete embedding module, and the continuous features are mapped into a high-dimensional comprehensive embedding representation E by using linear binning and embedding lookup table. Next, the integrated embedding representation E is fed into the Transformer structure module, and the multi-head self-attention mechanism is used to capture the spatiotemporal dependencies within the sequence. During the training phase, a multi-task joint loss function with geometric constraints is constructed to guide the model to learn the ship motion laws and the geometric relationship between them and the key points of anti-smuggling, thus avoiding the divergence problem of single feature prediction. Finally, the obtained hidden layer feature representation H is fed into the prediction output module, and a grid center value mapping strategy combining Top-K probability filtering and multi-distribution sampling is adopted to recover continuous physical values.
[0057] The resulting long-term predicted ship trajectories not only have high numerical accuracy, but also effectively reflect the ship's intention to approach or evade the regulatory area, thus effectively improving the generalization capability and operational interception success rate of the anti-smuggling early warning system.
[0058] The experimental results above demonstrate that this embodiment performs excellently on public datasets, maintaining a very high trajectory fitting degree while significantly reducing position prediction errors, thus fully verifying the effectiveness of the method of the present invention.
[0059] This embodiment also provides a ship trajectory prediction system based on anti-smuggling key points, including: a feature engineering module based on anti-smuggling key points, a feature discrete embedding module, a Transformer structure module, a prediction output module, a joint loss function calculation module, a training module, and a testing module; In this embodiment, the feature engineering module based on anti-smuggling key points is used to read the original AIS trajectory data in the dataset, filtering out invalid data containing NaN values and insufficient length, and calculating the spherical distance and orientation angle based on the anti-smuggling key point coordinates set by expert experience to obtain a normalized six-dimensional extended feature tensor X; the feature discretization and embedding module is used to feed the extended feature tensor X into the discretization unit, performing linear binning, embedding layer table lookup, and feature channel concatenation to capture the semantic relationships of features in different physical dimensions, obtaining a comprehensive embedded representation E that integrates the association information of anti-smuggling key points; the Transformer structure module... The module is used to feed the comprehensive embedded representation E into a multi-layer self-attention network, using a causal masking mechanism to capture long-term dependencies in the trajectory sequence in parallel, generating a hidden layer feature representation H. The prediction output module maps the hidden layer feature representation H back to the full feature space and decouples it into six independent prediction tensors to obtain the prediction probability distribution for the next time step. The joint loss function calculation module calculates the cross-entropy loss with spatial smoothing between the discrete probability distributions of the six dimensions of the model output (latitude, longitude, ground speed, ground heading, spherical distance to anti-smuggling key points, and orientation angle) and the true labels, and combines it with the basic feature main loss. Auxiliary loss with geometric association features The joint loss value is calculated using a weighted summation strategy with preset weights. The training module is used for model training, based on minimizing the joint loss function. The network parameters are updated using an optimizer to achieve the target, and the network model and parameters are saved after training is completed. The test module is used for model testing. It loads the trained prediction model, adopts a grid center value mapping strategy that combines Top-K probability filtering with multivariate distribution sampling, inputs historical ship track data, and outputs the six-dimensional feature prediction results for the next moment in real time. Among them, the latitude and longitude values are used to construct the predicted trajectory of the future geographical location, and the other dimensional features are used as state variables to drive long-term autoregressive inference.
[0060] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for predicting ship trajectories based on key anti-smuggling points, characterized in that, Includes the following steps: Step 1: Read the original track sequence of the vessel from the maritime supervision database, and set the coordinates of the key anti-smuggling points in the prediction area based on the experience of maritime supervision experts. Calculate the spherical distance feature and the signed direction angle feature of the vessel track point relative to the key anti-smuggling points. Combine the original latitude, longitude, speed to ground, and heading to ground data with the newly added geometric correlation features to obtain an extended feature tensor containing six-dimensional information. Step 2: Expand the feature tensor X The data is fed into the feature discrete embedding module, where a linear binning strategy is employed. Based on a preset resolution range, continuous features in each dimension—latitude, longitude, ground speed, ground heading, spherical distance to anti-smuggling key points, and heading angle—are converted into discrete integer indices. Each index is then input into the corresponding learnable embedding matrix for lookup operations, resulting in dense embedding representations for each feature dimension. These representations are then concatenated to obtain a comprehensive embedding representation that integrates the ship's motion state with the correlation information between anti-smuggling key points. ; Step 3: Integrate the embedded representation The data is fed into a Transformer architecture module as input, and learnable position embedding parameters are superimposed. A multi-head self-attention mechanism with causal masking is used to process time-series data in parallel, capturing the temporal dependencies between smuggling vessel track points and the spatial correlation patterns between track points and key anti-smuggling points, thus generating more powerful hidden layer feature representations. ; Step 4: Represent the hidden layer features output by the Transformer The data is fed into a fully connected layer and mapped back to the discrete grid dimension of the full feature space. Then, it is decoupled into independent prediction tensors of six feature dimensions: latitude, longitude, speed to ground, heading to ground, spherical distance to anti-smuggling key points, and direction angle using tensor splitting operation. The prediction probability distribution for the next time step is generated by the Softmax activation function. Step 5: For the discretized probability distribution of the model output, after spatial smoothing, calculate the cross-entropy loss between the predicted distribution of each dimension and the true label index. Define the loss of latitude and longitude and the speed and heading of the ground as the main loss, and define the loss of the spherical distance and direction angle relative to the anti-smuggling key point as the auxiliary loss. Use the weighted summation strategy to construct a joint loss function to supervise the training of the model. Step 6: Based on the deep learning framework and backpropagation algorithm, implement the parameter grouping optimization strategy, and iteratively update the network parameters with the goal of minimizing the joint loss function. Guide the model to learn the basic motion law of the ship and the geometric constraint relationship between it and the key points of anti-smuggling. After training is completed, save the model parameters. Step 7: Load the trained ship trajectory prediction model based on anti-smuggling key points, input the historical trajectory data of the suspected ship using an autoregressive mode, and at the output end, use a grid center value mapping strategy combining Top-K probability filtering and multivariate distribution sampling to recover high-precision continuous physical values from the discrete prediction probability distribution, and output the six-dimensional feature prediction results for the next moment in real time; among them, latitude and longitude values are used to construct the predicted trajectory containing the future geographical location, and the remaining features are retained as predicted values of motion state and geometric constraints, providing early warning support for maritime supervision.
2. The method according to claim 1, characterized in that, The process of constructing the extended feature tensor in step 1 includes: Based on the needs of maritime surveillance, the geographic coordinates of key anti-smuggling points are defined within the trajectory prediction space. ; For each time step, calculate the spherical distance between the track point and the key anti-smuggling point. And map the calculated spherical distance to The standard numerical range; Based on the ship's instantaneous motion vector and its azimuth vector pointing to key points, the signed direction angle is calculated using the vector dot product and the two-dimensional cross product. This feature explicitly encodes the vessel's maneuvering behavior for port or starboard evasion. The latitude, longitude, speed to ground, and heading to ground are extracted from the original track sequence to form the basic state tensor, which is then compared with the spherical distance calculated above. and direction angle The features are concatenated along the feature channel dimension to construct an extended feature tensor. X Its shape is ,in T The sequence length is given.
3. The method according to claim 1, characterized in that, The specific processing steps of the feature discrete embedding module in step 2 include: Feature discretization and index transformation: Using a linear binning strategy, based on the discrete dimensions set for each dimension of features, the continuous normalized floating-point features in the extended feature tensor are converted into discrete integer indices, resulting in discrete index tensors for each dimension. High-dimensional embedding representation independent mapping: Construct an embedding layer containing multiple independent sub-modules, configure independent learnable embedding matrices for latitude, longitude, ground speed, ground heading and anti-smuggling key point geometric features, input discrete indices of each dimension into the corresponding embedding layer, and directly obtain the dense embedding representation corresponding to each index through table lookup operation; Sequence feature fusion construction: combining features from the same time step The dense embedding representations of all feature dimensions after embedding mapping are concatenated along the channel dimension to obtain a single-step comprehensive embedding representation that integrates information on the correlation between ship motion state and key anti-smuggling points. Its expression is: in, The first part consists of a dense embedded representation of latitude, longitude, speed to ground, heading to ground, spherical distance to key anti-smuggling points, and azimuth angle after table lookup; the second part consists of a single-step integrated embedded representation after splicing. Dimensions ,in The embedding matrix dimensions are defined for each dimension; subsequently, a single-step integrated embedding representation of all time steps is obtained. Stacking forms a comprehensive embedded representation .
4. The method according to claim 1, characterized in that, The specific processing steps of the Transformer structure module in step 3 include: Location information encoding and feature overlay: targeting information containing T Comprehensive embedding representation of features at each time step Initialize a learnable position embedding parameter matrix with the same dimension as the input. The integrated embedded representation With position embedding parameter matrix By adding elements one by one, we obtain the input tensor that incorporates positional information. ,Right now Furthermore, a causal mask is applied before the input self-attention layer to ensure that the model processes the current time step. At that time, one can only focus on to Historical information of a moment; Linear projection and matrix construction: Integrating the input tensor with positional information Z The query matrix is mapped through three learnable linear projection layers. Key matrix Sum matrix Due to the input tensor The query matrix already explicitly includes spherical distance and orientation angle features related to key anti-smuggling points. Bond matrix When calculating the dot product, the spatiotemporal relationship between the trajectory and key points can be learned through the feature interaction process; Multi-head self-attention computation: Within each attention head, the input tensor is computed in parallel using a scaled dot product attention mechanism. Z The internal relevance weight is calculated using the following formula: in, The subspace dimension of the query vector and key vector in each attention head; It is an upper triangular mask matrix, in which the elements in the upper triangular region that do not contain the diagonal are negative infinity, and the rest are 0; Parallel processing and feedforward network: The output vectors of all attention heads are concatenated and linearly transformed before being input into a pointwise feedforward network. This network consists of two linear layers and an activation function. The input features are processed through multiple stacked Transformer blocks, with layer normalization and residual connections used within each block. The final output is a hidden layer feature representation that includes global context information and anti-smuggling keypoint constraints. .
5. The method according to claim 1, characterized in that, The specific processing steps of the prediction output module in step 4 include: Fully connected mapping and feature decoupling: Construct a linear mapping layer at the output end, where the total number of output nodes corresponds to the sum of the total number of discrete intervals divided by all feature dimensions, namely latitude, longitude, speed to ground, heading to ground, spherical distance to anti-smuggling key points, and orientation angle; represent the hidden layer features output by the Transformer. Input the network to obtain the unnormalized log probability of the entire feature space; then, based on the vocabulary size of each dimension, use tensor splitting operation to decouple the unnormalized log probability into independent prediction tensors corresponding to the six dimensions. Probability distribution generation and numerical recovery: For the prediction tensor of each feature dimension after decoupling, the Softmax activation function is applied for normalization to obtain the probability distribution of the feature in each discrete interval. Furthermore, in order to recover continuous physical values from discrete distributions, a Top-K filtering and multinomial distribution random sampling strategy is used to select the target interval index, and the index is mapped to the geometric center value of the corresponding interval, thereby outputting accurate values such as latitude, longitude, speed and heading on the ground, and distance and direction angle to key anti-smuggling points.
6. The method according to claim 1, characterized in that, The process of constructing the joint loss function in step 5 includes: Calculate the main loss for the basic features: For the basic motion state dimensions of ship latitude, longitude, speed above ground, and heading above ground, calculate the cross-entropy loss between the predicted probability distribution of each dimension output by the model and the corresponding real label index, combined with spatial smoothing. Let the losses for latitude, longitude, speed above ground, and heading be denoted as follows: The single-step basic feature principal loss is defined as the sum of the four factors. Calculate the auxiliary loss for the geometric features of key anti-smuggling points: Based on the geometric correlation dimension between the spherical distance and orientation angle to the key anti-smuggling points, extract the prediction branch corresponding to the model output layer, and calculate the loss between the predicted spherical distance distribution and the true distance label. And the loss between the predicted orientation angle distribution and the true orientation angle label. ; Joint Loss Weighted Optimization: Constructing the Final Joint Loss Function The main loss of the basic features Auxiliary loss with geometric features The weighted summation is calculated using the following formula: Among them, the main loss Auxiliary loss ; These are preset balance weight coefficients used to adjust the proportion of geometric constraints in the joint loss.
7. The method according to claim 1, characterized in that, The specific process of model training described in step 6 includes: Optimizer configuration and parameter grouping: The AdamW optimizer is adopted and a parameter grouping optimization strategy is implemented. The model parameters are divided into decaying and non-decaying groups. Weight decay is applied to the parameters of linear layer weights for regularization. For bias terms, layer normalized weights and position embedding parameters, the weight decay coefficient is set to 0. Gradient calculation and iterative update: expanding the feature tensor of historical time steps X The input model is used to calculate the joint loss value based on multi-task weights through forward propagation; the gradient is calculated using an automatic differentiation mechanism and the gradient norm is clipped; the network parameters are updated through the optimizer to complete a single iteration, guiding the model to learn the coupling relationship between latitude and longitude, changes in ground speed and heading, and changes in spherical distance and heading angle.
8. The method according to claim 1, characterized in that, Step 7, model testing and application, includes long-term trajectory extrapolation and numerical inversion. The specific process includes: Model loading and forward inference: Load the model weight parameters that perform best on the validation set during training. Using an autoregressive generation mode, input the historical track sequence of the suspected vessel to be monitored into the model for forward inference to obtain the unnormalized log probability in the prediction space at the next moment and decouple it into a six-dimensional prediction distribution. Probability Sampling and Center Value Mapping: Top-K filtering is performed on the unnormalized log probabilities of the predictions for each dimension, retaining only the top K intervals with the highest probabilities and re-normalizing them using Softmax; based on the normalized probability distribution, multinomial random sampling is performed to select the target discrete index. (in Then, the selected discrete index is mapped back to a continuous value within the normalized interval using the grid center value mapping formula. The calculation formula is as follows: in, This is the grid center offset. This represents the total number of grid cells in that dimension; finally, it is combined with the maximum value in that dimension. and minimum value To perform inverse normalization, the calculation formula is: This allows us to obtain precise physical coordinates and geometric characteristic values; Long-term trajectory extrapolation: The predicted points, including latitude and longitude and corrected geometric features, generated by single-step inversion are appended to the end of the input sequence, and the oldest time step is removed. The input model is then cyclically fed into the model to predict the next moment until a complete future trajectory sequence is generated.
9. A ship trajectory prediction system based on anti-smuggling key points, based on the method of any one of claims 1-8, characterized in that, include: The system comprises a feature engineering module, a feature discrete embedding module, a Transformer structure module, a prediction output module, a joint loss function calculation module, a training module, and a testing module based on anti-smuggling key points. The feature engineering module based on anti-smuggling key points is used to read the original ship track data in the maritime supervision database. Based on the four-dimensional basic features of latitude, longitude, speed to ground, and heading to ground, the coordinates of anti-smuggling key points in the prediction area are set according to expert experience. The spherical distance feature and the signed direction angle feature between the track point to be predicted and the key point are calculated. The original track sequence is expanded into a six-dimensional extended feature tensor containing spatial and geometric constraints. The feature discrete embedding module is used to construct an embedding layer structure based on a lookup table. First, it uses a linear binning strategy to convert the normalized six-dimensional continuous features into discrete integer indices. Then, it inputs the discrete indices of each dimension into the corresponding learnable embedding matrix for a lookup operation, mapping the discrete features to a continuous high-dimensional semantic space. Finally, it forms a comprehensive embedding representation through channel concatenation. ; The Transformer structure module is used to receive the synthesized embedded representation. By superimposing learnable position embedding parameters and utilizing a multi-head self-attention mechanism with causal masking, correlation weights within the track sequence are computed in parallel. This captures long-term dependencies between track points and between track points and key anti-smuggling points, generating hidden layer feature representations. ; The prediction output module is used to receive the hidden layer feature representation. The fully connected layer is used to map it back to the discrete grid dimension of the full feature space, and the tensor is decoupled into independent prediction tensors of six feature dimensions: latitude, longitude, ground speed, ground heading, spherical distance and direction angle using tensor partitioning operation. The prediction probability distribution of the next time step is generated by the Softmax activation function. The joint loss function calculation module is used to calculate the cross-entropy loss between the predicted distribution and the true label index in each dimension after spatial smoothing of the discretized probability distribution output by the model. The loss of latitude and longitude and the speed and heading to the ground are the main losses, and the loss of spherical distance and direction angle with anti-smuggling key points are the auxiliary losses. The main loss and auxiliary loss are weighted and summed using preset weight coefficients to finally construct a joint loss function that includes basic features and geometric constraints. The training module, based on a deep learning framework and backpropagation algorithm, uses a parameter grouping optimization strategy and an adaptive moment estimation optimizer to iteratively update network parameters with the goal of minimizing the joint loss function, driving the model to learn both ship motion laws and geometric constraints of key anti-smuggling points simultaneously. The test module is used to load the optimal training model weights, input the historical track data of the suspected vessel using an autoregressive generation mode, and at the output end, it uses a Top-K probability filtering combined with a grid center value mapping strategy of multi-distribution sampling to recover continuous physical values and output a complete predicted trajectory containing the future geographical location in real time.