Ship track prediction method and system based on CNN-transformer
By using a parallel CNN-Transformer hybrid encoder, which combines CNN and Transformer models, local and global features of ship trajectories are extracted to generate high-precision future trajectory sequences. This solves the problems of environmental adaptability and computational efficiency in existing technologies and provides reliable technical support for intelligent shipping and maritime supervision.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGXI FLIGHT COLLEGE
- Filing Date
- 2026-04-16
- Publication Date
- 2026-06-16
Smart Images

Figure CN122223261A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent shipping and trajectory prediction technology, specifically to a ship trajectory prediction method and system based on a CNN-Transformer fusion model, which is applicable to ship navigation monitoring, anomaly detection and collision avoidance decision support. Background Technology
[0002] In global trade, maritime transport carries the vast majority of goods, making its safety and efficiency crucial. Accurate ship trajectory prediction has become a key supporting technology for ensuring navigational safety and improving management efficiency. However, existing mainstream methods all have limitations: traditional models rely on ideal assumptions and have poor environmental adaptability; machine learning methods have limited feature mining capabilities; classic recurrent neural networks struggle to capture long-range dependencies and sudden maneuvers; and pure Transformer architectures lack local awareness and have high computational costs. A single model struggles to achieve a balance between long-term prediction accuracy, local maneuver sensitivity, and computational efficiency.
[0003] To address this, this patent proposes "a method and system for ship trajectory prediction based on CNN-Transformer." This solution deeply integrates Convolutional Neural Networks (CNN) and Transformers: CNN is responsible for extracting local fine-grained motion features from the trajectory, while Transformer models global long-range dependencies and navigation intentions. The two complement each other, jointly achieving collaborative modeling of both micro and macroscopic patterns of ship trajectories, significantly improving prediction accuracy and robustness, and providing an innovative solution for building next-generation intelligent trajectory prediction systems. Summary of the Invention
[0004] The CNN-Transformer-based ship trajectory prediction method and system provided in this application can effectively improve the accuracy and robustness of ship trajectory prediction, provide reliable technical support for intelligent shipping, maritime supervision and autonomous navigation, and have strong practical value and application prospects.
[0005] Firstly, a method for predicting ship trajectories is provided, including:
[0006] Historical and real-time trajectory data are acquired through the Automatic Identification System (AIS) for ships, followed by data preprocessing and feature engineering. Specifically, this includes: collecting AIS message data from ships within the target waters, containing key information such as timestamps, latitude and longitude, ground speed, and ground heading; cleaning the raw data, imputing missing values, segmenting and aligning the trajectories, and constructing a training set for model training and a test set for performance testing, ensuring no overlap in time or ship identification between the two sets; and calculating and generating a temporal feature sequence reflecting the ship's motion state as model input.
[0007] A hybrid encoder model based on parallel CNN-Transformer is constructed to extract deep features of ship operation. Specifically, a two-branch parallel network structure is designed, where one branch uses a convolutional neural network to extract local spatiotemporal patterns of trajectory sequences (such as short-term acceleration changes and heading fluctuations), and the other branch uses a Transformer encoder to capture long-term dependencies and global contextual relationships of the trajectory. The features extracted by the two branches are adaptively fused to form a fused feature vector containing multi-level information, which comprehensively represents the ship's historical behavior patterns and current operating status.
[0008] A Transformer decoder model based on fused features is constructed to generate future trajectory sequences. Specifically, this includes: constructing a Transformer decoder conditioned on the fused features output by the hybrid encoder; optimizing the decoder parameters using training set data to enable it to learn the mapping relationship from historical features to future trajectories; and generating a sequence of predicted trajectory coordinates for multiple future time steps in an autoregressive manner.
[0009] The predicted trajectory sequence is post-processed and output with coordinates. Specifically, this includes: converting the normalized coordinate sequence output by the model back into actual geographic latitude and longitude coordinates; performing smoothness checks and reasonableness corrections on the predicted trajectory; and finally outputting a standardized future trajectory that can be directly used by ship navigation systems and maritime monitoring platforms.
[0010] The feasibility and prediction accuracy of the proposed method were verified through system integration and simulation experiments.
[0011] The second aspect provides a ship trajectory prediction system, including:
[0012] The data acquisition and preprocessing module is used to access the AIS data stream, complete data cleaning, interpolation, trajectory segmentation and feature calculation, and manage the training set, validation set and test set; the hybrid feature encoding module is used to mount and run the parallel CNN-Transformer hybrid encoder, process the input feature sequence and output the fused feature vector; the trajectory sequence decoding and prediction module is used to mount and run the Transformer decoder, and generate the future trajectory coordinate sequence based on the fused feature vector; the trajectory post-processing and output module is used to convert the predicted coordinates into actual geographic coordinates, and perform format standardization and output; the model training and simulation verification platform is used to perform end-to-end model training and hyperparameter tuning of the hybrid encoder and decoder, and provide a visual interface for simulation analysis and performance evaluation of the prediction results.
[0013] In the first or second aspect mentioned above, the data preprocessing and feature engineering includes filtering and smoothing the ship's historical trajectory to eliminate noise, and extracting multi-dimensional time-series features including position, speed, heading, acceleration, and turning rate.
[0014] In the first or second aspect mentioned above, the parallel CNN-Transformer hybrid encoder uses a one-dimensional convolutional layer to extract local features in its CNN branch, and a multi-head self-attention mechanism to model global dependencies in its Transformer branch, and combines the two types of features through a learnable weight fusion layer.
[0015] In the first or second aspect mentioned above, the Transformer decoder, when generating trajectory points for each future time step, will pay attention to all historical fusion feature information provided by the encoder, thereby ensuring the continuity and global consistency of the prediction.
[0016] Compared with the prior art, the advantages of the present invention are:
[0017] 1. A parallel CNN-Transformer hybrid encoder was designed. CNN captures local trajectory details, while Transformer models global dependencies, enabling a more comprehensive and in-depth extraction of ship operation characteristics. 2. A Transformer decoder based on fused features was used for end-to-end multi-step trajectory sequence generation, avoiding the error accumulation problem of traditional recursive prediction and significantly improving the accuracy and stability of medium- and long-term predictions. 3. A complete chain solution was constructed, from data preprocessing and model training to trajectory post-processing and system simulation, outputting ready-to-use standardized trajectories, greatly improving the method's engineering practicality and system integration. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings of the embodiments will be briefly described below.
[0019] Figure 1 A schematic flowchart of a CNN-Transformer-based ship trajectory prediction method and system according to an embodiment of this application is shown.
[0020] Figure 2 A schematic diagram of the core parallel CNN-Transformer hybrid encoder architecture of this method is shown. Detailed Implementation
[0021] This application presents a ship trajectory prediction method and system based on a CNN-Transformer hybrid model, aiming to improve the collaborative decision-making capabilities of unmanned vehicles in complex environments at smart airports. The method first preprocesses and performs feature engineering on historical AIS trajectory data, then extracts deep spatiotemporal features of ship movement using a parallel CNN-Transformer encoder. Based on the fused features, the system utilizes a Transformer decoder model for training and optimization, ultimately generating high-precision trajectory sequence predictions for future multiple steps. This prediction result provides crucial environmental dynamic prior knowledge for global path planning and real-time collision avoidance algorithms for unmanned vehicles within airports. Together with rain and fog image enhancement technology based on generative adversarial networks, it constitutes an integrated "perception-prediction-decision" unmanned solution, effectively addressing challenges such as path planning in narrow spaces, dynamic obstacle avoidance, and multi-vehicle collaboration. The technology is advanced and has broad application prospects.
[0022] The following will combine Figure 1 and Figure 2 This paper provides a detailed explanation of the ship trajectory prediction method and system based on CNN-Transformer.
[0023] Figure 1 A schematic flowchart of a ship trajectory prediction method and system based on CNN-Transformer according to an embodiment of this application is shown. The method specifically includes:
[0024] Step S1: Acquisition and preprocessing of multi-source AIS data.
[0025] This step involves integrating data streams from the port management information system and the automatic identification system for ships to obtain multi-source heterogeneous historical data on the target ship and its surrounding traffic environment. Systematic data cleaning and feature engineering are then performed to provide high-quality input for subsequent deep learning models.
[0026] (1) AIS data source collection and integration
[0027] AIS data is the core data foundation of this invention, and it is collected and complemented through the following multiple sources:
[0028] Commercial-grade AIS data service (MarineTraffic): This service provides a RESTful API to retrieve historical AIS message data for a specified waterway and time range. This data includes static information (MMSI, vessel name, call sign, IMO number, vessel type, length, beam) and dynamic information (timestamp, longitude, latitude, speed over ground (SOG), heading over ground (COG), heading, rate of turn (ROT), and navigation status). This data source covers major global shipping routes, offers high-quality data, and is suitable for building benchmark training sets.
[0029] Open source real-time AIS data (AISHub): As a supplementary data source, it provides free access to real-time AIS data streams received by volunteer base stations worldwide, which can be used to expand the data scale and increase sample diversity. It is especially suitable for obtaining trajectory data of non-commercial vessels such as small boats and fishing boats.
[0030] Authoritative archived data (NOAA AIS data archive): Historical AIS archived data of the U.S. coastal waters provided by the National Oceanic and Atmospheric Administration (NOAA). The data has been officially verified, has good spatiotemporal continuity, and can be used to verify the generalization ability of the model in specific waters (such as the North American coast).
[0031] Port Authority Proprietary Data: High-precision AIS data within the port area provided by various port authorities (such as Shanghai Port, Singapore Port, and Rotterdam Port). The sampling frequency is usually higher (up to 2-10 seconds / time), which is suitable for detailed modeling of port operations and berthing / departure scenarios.
[0032] (2) Integration of geographic and waterway information data
[0033] To provide channel constraints and navigation context information, this invention integrates the following geospatial data:
[0034] OpenStreetMap (OSM) waterway and port data: Extract vector geographic features such as channel boundary polygons, channel centerlines, traffic control zones, anchorages, berths, and breakwaters from the target waterway using OSM's Overpass API. Utilize the spatial index (R-Tree) to quickly query geometric constraint features such as the lateral distance between the vessel's current position and the channel centerline, and the arc distance to the nearest turning point.
[0035] NOAA chart data: Utilizing NOAA's Electronic Navigation Charts (ENC) data, specialized navigational information such as depth contours, obstruction locations, recommended routes, and reporting lines are extracted. Depth data is used to generate continuous depth surfaces through Kriging interpolation, which are then used to assess navigability constraints in the vessel's navigation area.
[0036] Electronic nautical charts from various maritime authorities: For key research waters (such as the Chinese coast), it integrates official electronic nautical chart data released by the China Maritime Safety Administration to obtain the latest dynamic control information such as channel adjustment information, temporary navigation warning areas, and no-navigation zone boundaries.
[0037] After being vectorized and rasterized, the above geographic data is constructed into a multi-layered geographic feature map. During the model input stage, geographic location features (distance from the centerline of the waterway, distance from the nearest hazard, water depth, whether it is within the separate navigation area, etc.) are added to each trajectory point through spatial query.
[0038] (3) Data preprocessing and feature engineering process
[0039] After completing the multi-source data acquisition, perform the following standardized preprocessing and feature engineering steps:
[0040] Data cleaning: Remove obviously abnormal AIS messages, including: SOG exceeding the ship's design speed limit (>50 knots), latitude and longitude coordinates exceeding the geographical range of the water area, displacement between adjacent messages exceeding the physical possibility range (threshold calculated based on maximum speed and time interval), and MMSI encoding not conforming to the ITU-R M.585 standard.
[0041] Missing value imputation: For short-term data missing (<5 sampling intervals), linear interpolation is used to fill in the position, speed, and heading; for long-term missing or signal loss, the trajectory is broken at this point and treated as an independent flight segment to avoid introducing false correlations.
[0042] Track segmentation and resampling: Based on the ship's MMSI (Mean Mixed Sampling Index), the continuous navigation process is divided into independent track segments by timestamp and breakpoints such as changes in berthing status or signal interruption. Each track segment is resampled at equal time intervals (target sampling rate 30 seconds), and spline interpolation is used to ensure track smoothness.
[0043] Feature Construction and Standardization: For each trajectory point, the following feature vectors are constructed: longitude, latitude, speed over land, heading over land, heading, turning rate, acceleration (calculated from speed difference), lateral acceleration, distance from the channel centerline, relative wind direction and speed components, and significant wave height. All numerical features are Z-score standardized (mean 0, standard deviation 1), and categorical features (ship type) are one-hot encoded.
[0044] Dataset partitioning: The training set, validation set, and test set are randomly partitioned in a ratio of 8:1:1. The partitioning is based on the ship's MMSI (Missing Dimensional Identity) to ensure that the trajectory data of the same ship appears in only a single dataset, thus avoiding data leakage.
[0045] Step S2: Construct a CNN-Transformer joint feature learning and prediction model.
[0046] Ship operation features are extracted by a parallel CNN-transformer hybrid encoder. The local features output by the CNN are concatenated or weighted and fused with the global features output by the Transformer to form a comprehensive feature representation, so as to capture both the local details and long-term dependencies of the trajectory.
[0047] Data Preparation: An AIS dataset from a busy waterway was used, containing over 100,000 vessel tracks, with a sampling interval of 30 seconds for each track. 15,000 valid track sequence samples were constructed and randomly divided into training, validation, and test sets in an 8:1:1 ratio, ensuring no overlap between sets.
[0048] Constructing a CNN local spatiotemporal feature extractor: The input is a preprocessed track sequence. (F represents the feature dimension). A two-layer one-dimensional convolutional neural network (1D-CNN) is used to capture local motion patterns (such as acceleration and turning) in the trajectory.
[0049] First convolutional layer: kernel size = 3, number of filters = 64, stride = 1, ReLU activation. Second convolutional layer: kernel size = 3, number of filters = 128, stride = 1, ReLU activation.
[0050] Then, max pooling (pooling size = 2) is performed to output the local feature map.
[0051] Constructing a Transformer global temporal dependency modeler: The sequence is reshaped into a feature sequence, and a learnable positional encoding P is added to obtain the input to the Transformer encoder:
[0052]
[0053] The encoder consists of N=4 identical layers stacked together. Each layer contains a multi-head self-attention mechanism (MSA) and a feedforward network (FFN), and applies residual connections and layer normalization (LN). For the l-th layer, the calculation process is as follows:
[0054]
[0055] The multi-head self-attention mechanism projects the query (Q), key (K), and value (V) onto h=8 heads and calculates scaled dot product attention:
[0056]
[0057] The feedforward network consists of two fully connected layers, with Re-LU activation used in between.
[0058] Constructing the prediction output head: Take the output of the last Transformer encoder layer. The features of the last time step (corresponding to the global context information of the most recent historical moment) are mapped to a sequence of future waypoint coordinates through a two-layer fully connected network (hidden layer dimension 256, output layer dimension 2×K, where K is the number of predicted future time steps):
[0059]
[0060] Model training and loss function: Mean squared error (MSE) is used as the main loss function, combined with directional smoothness constraints based on ship kinematics.
[0061]
[0062] in, As a coordinate of the real future, These are the weight coefficients (set to 1.0 and 0.1 respectively). The Adam optimizer is used during training, with an initial learning rate of 0.0001, a batch size of 32, and a total of 100 training cycles. The learning rate decays to 0.8 every 20 cycles.
[0063] Step S3: Establish a ship motion model
[0064] First, based on the geometric relationships of the ship's planar motion, core kinematic equations are established to describe the relationship between position, heading, and velocity. This model clarifies the fundamental constraints between the motion state variables, as detailed in the following formulas:
[0065]
[0066]
[0067] Based on the geometric relationships of ship planar motion, the core kinematic equations describing the relationship between position, heading, and velocity are established:
[0068]
[0069]
[0070]
[0071] Where (x,y) represents the ship's position in the geodetic coordinate system. For the bow direction, and These are the longitudinal (forward and backward) velocity and the lateral (drift) velocity in the ship's coordinate system, respectively. Let be the turning angular velocity. This model clarifies the fundamental constraints between the motion state variables.
[0072] For the handling characteristics of different types of ships, key kinematic and dynamic limit parameters are defined and quantified to form a set of constraint rules:
[0073] Rate of change of velocity constraint: A ship's acceleration and deceleration capabilities are limited by main engine thrust and hull resistance. Define the maximum achievable longitudinal acceleration. and deceleration
[0074]
[0075] in, and Dynamically retrieved from a pre-set database of ship handling characteristics based on ship type, main engine power, and loading status.
[0076] Bowing Motion Constraints: A ship's turning ability is affected by rudder effectiveness, speed, and hull shape. The maximum steady-state bowing rate is defined. and head acceleration :
[0077]
[0078] This constraint prevents unrealistic maneuvers such as sudden, sudden changes in forecasts.
[0079] Lateral drift velocity correlation constraint: When a ship turns, it is usually accompanied by lateral drift motion, and its lateral velocity v is related to the turning rate r and the ship's length L, approximately satisfying:
[0080]
[0081] in, This is a proportionality coefficient related to the ship type (usually taken as 0.1~0.3), and this constraint reflects the "oblique" characteristic of the ship's motion.
[0082] This physics-constrained model is integrated with the CNN-Transformer prediction core using a feedforward approach. During training, the kinematic loss term can be added to the total loss function to guide the network in initially learning physical laws. During inference and deployment, the model runs as an independent, mandatory post-processing module to ensure the physical reliability of the final output trajectory. This significantly improves the engineering practicality and safety of the entire method.
[0083] Step S4: Dynamic collision avoidance decision generation based on prediction uncertainty quantification
[0084] 1. Uncertainty Quantification: Monte Carlo Dropout technology is employed, performing multiple forward propagations during the inference phase to obtain the probability distribution of the predicted trajectory. Its covariance matrix is calculated, and a dynamic probability ellipse that grows over time is plotted as a safety boundary, with the ellipse confidence interval set to 95%. 2. Conflict Detection and Rule Embedding: The planned route of this vessel is spatiotemporally overlaid with the predicted trajectories and probability ellipses of other vessels for analysis. The detection logic not only judges geometric conflicts but also embeds COLREGs rule logic (such as the rights and obligations between a vessel traveling in the straight and a vessel giving way in a cross-trajectory situation) to identify the responsible party in advance. 3. Collision Avoidance Decision Generation: Once a potential conflict is detected, the system invokes an improved Dynamic Window Method (DWA). Evaluation Function In addition to considering path distance, speed, and obstacle clearance, a "rule compliance score" is added:
[0085]
[0086] Select the optimal speed pair from the dynamic window that is both safe and compliant with maritime collision avoidance rules. Generate local collision avoidance paths.
[0087] Step S5: Simulation verification of the feasibility of the proposed algorithm.
[0088] To verify the effectiveness of the proposed method, systematic experiments were conducted on a multi-scenario simulation testing platform. Compared with traditional LSTM, Kalman filtering, and pure Transformer models, this method demonstrates significant advantages in key indicators such as prediction accuracy (ADE, FDE), trajectory physical rationality, long-term prediction stability, and timely collision avoidance decision-making. Simulation results confirm that the CNN-Transformer fusion prediction model can effectively learn complex navigation patterns. The decision-making module, combined with physical constraints and rule embedding, can generate safe and compliant collision avoidance strategies. The system as a whole meets the real-time, accuracy, and reliability requirements of intelligent ships for trajectory prediction and collision avoidance decision-making, demonstrating its feasibility for engineering applications.
[0089] The above text combines Figure 1 This paper describes in detail a ship trajectory prediction method and system based on CNN-Transformer according to embodiments of this application. The following section describes in detail a ship anomaly trajectory data detection device based on variational autoencoder according to embodiments of this application. This device includes: an environmental data acquisition module, a model building module, a model training module, a path planning module, and a simulation verification module.
[0090] The environmental data acquisition module is used to acquire surrounding environmental data.
[0091] The model building module is used to build a CNN-Transformer joint feature learning and prediction model;
[0092] The model training module is used to perform unsupervised training on the anomaly detection model;
[0093] The path prediction module is used to predict the path of a ship's trajectory.
[0094] The simulation verification module is used to perform simulation verification on the obtained model.
[0095] and Figure 2This embodiment discloses a parallel CNN-Transformer hybrid encoder architecture, characterized by comprising an input module, a feature decomposition module, a parallel feature extraction module, a feature fusion module, a shared backbone processing module, and an output module connected in sequence. The parallel feature extraction module contains multiple independent branches with identical structures. Each branch sequentially connects two residual blocks, a Transformer encoder, and a set of convolutional layers to extract deep features with different emphases from the decomposed features. The outputs of each branch interact and are integrated through the feature fusion module, then fed into the shared backbone processing module. This shared backbone is composed of alternating convolutional layers (Conv+ReLU) and Transformer blocks, used for deeper local perception and global context joint modeling of the fused features. Finally, the image is optimized by a manifold particle filter module to generate the final output image. This architecture, through a parallel multi-branch design that combines the local feature extraction advantages of CNNs with the global dependency modeling capabilities of Transformers, significantly improves the richness and robustness of feature representation in complex visual tasks.
[0096] This method boasts powerful feature extraction and fusion capabilities. Its core advantage lies in its parallel hybrid encoder architecture. Convolutional neural networks excel at capturing local spatial features in trajectory sequences (such as velocity changes between adjacent moments and instantaneous turns), while Transformer models effectively model long-term dependencies (such as periodic navigation habits and macroscopic route preferences). This design enables the model to simultaneously understand the detailed dynamics and overall patterns of ship motion, laying a solid foundation for accurate predictions.
[0097] In S5, the final step is "system integration and trajectory prediction simulation," which reflects the application-oriented design philosophy of this method. It emphasizes embedding the trained model into a complete software system and conducting comprehensive verification through a simulation environment to evaluate its performance in near-real-world scenarios. This demonstrates that the technical solution not only remains at the theoretical level but also has the potential for engineering implementation and deployment.
[0098] Finally, it should be noted that when a component is said to be "set on" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component.
[0099] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the specification of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0100] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0101] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A ship trajectory prediction method based on CNN-Transformer, characterized in that, Includes the following steps: S1. Improve data quality and enhance feature representation capabilities by preprocessing and feature engineering historical AIS ship trajectory data; S2. Extract ship operation features through a parallel CNN-transformer hybrid encoder, and concatenate or weightedly fuse the local features output by the CNN with the global features output by the Transformer to form a comprehensive feature representation, so as to simultaneously capture the local details and long-term dependencies of the trajectory; (1) Data preparation: The AIS dataset of a busy waterway is used, which contains more than 100,000 ship tracks. The sampling interval of each track is 30 seconds. 15,000 valid track sequence samples are constructed and randomly divided into training set, validation set and test set in a ratio of 8:1:1 to ensure that there is no overlap of ships in each set. (2) CNN Local Spatiotemporal Feature Extractor: The input is the preprocessed track sequence, and a two-layer one-dimensional convolutional neural network is used to capture the local motion patterns in the track; First convolutional layer: kernel size = 3, number of filters = 64, stride = 1, ReLU activation used; The second convolutional layer has a kernel size of 3, a filter count of 128, a stride of 1, and ReLU activation. Max pooling is then performed to output a local feature map. The detailed process for constructing a sequence of future ship trajectories based on fused features and a decoder is as follows: (1) Obtain the fusion feature H output by the encoder and its corresponding future true trajectory , in: It is the true state vector at the k-th future time step; If only the location is predicted, then d=2, representing longitude and latitude; If more features are predicted, it can be expanded to higher dimensions; (2) Construct a Transformer decoder model, whose input is the encoded feature H and the predicted partial trajectory; (3) Using the training set, optimize the decoder parameters by minimizing the prediction error: (4) Use the validation set to evaluate the model performance and adjust the hyperparameters; (5) After training is completed, a decoder capable of generating future K-step trajectories is obtained; (6) Finally, output the predicted trajectory sequence; S4. By using Kalman filtering or moving average to reduce prediction jitter, trajectory post-processing and multi-step prediction coordinate output are performed to improve the smoothness and physical rationality of the predicted trajectory. S5. Perform system integration and trajectory prediction simulation to deploy the trained model to the actual system and perform end-to-end simulation verification.
2. The ship trajectory prediction method based on CNN-Transformer according to claim 1, characterized in that, The historical AIS vessel trajectory data in step S1 includes: (1) AIS data source: MarineTraffic is used to provide API and historical data, AISHub, NOAA AIS data archive, and AIS data from various port authorities; (2) Meteorological data: NOAA meteorological data, ECMWF reanalysis data; (3) Geographic data: waterways, ports, NOAA nautical chart data, and electronic nautical charts issued by maritime authorities of various countries in OpenStreetMap.
3. The ship trajectory prediction method based on CNN-Transformer according to claim 1, characterized in that, The training parameters for generating the CNN-Transformer network in step S2 include: batch size of 32, number of iterations of 50,000, Adam optimizer, and learning rate initialized to 0.0001.
4. The ship trajectory prediction method based on CNN-Transformer according to claim 1, characterized in that, In step S3, based on the geometric relationships of the ship's planar motion, the core kinematic equations describing the relationship between position, heading, and velocity are established: Where (x,y) represents the ship's position in the geodetic coordinate system. For the bow direction, and These are the longitudinal velocity and the lateral velocity in the ship's coordinate system, respectively. The model defines the basic constraints between motion state variables by using the turning angular velocity.
5. A ship trajectory prediction system based on CNN-Transformer, characterized in that, include: The data acquisition and preprocessing module is used to access the AIS data stream, complete data cleaning, interpolation, trajectory segmentation and feature calculation, and manage the training set, validation set and test set; The hybrid feature encoding module is used to mount and run the parallel CNN-Transformer hybrid encoder to process the input feature sequence and output a fused feature vector; the trajectory sequence decoding and prediction module is used to mount and run the Transformer decoder to generate a future trajectory coordinate sequence based on the fused feature vector; the trajectory post-processing and output module is used to convert the predicted coordinates into actual geographic coordinates and perform format standardization and output. The model training and simulation verification platform is used for end-to-end model training and hyperparameter tuning of hybrid encoders and decoders, and provides a visual interface for simulation analysis and performance evaluation of prediction results.