Method, recording medium and system for establishing ship trajectory prediction model

By combining the Transformer model with the ship motion model in a hierarchical fusion design, the problem of existing models predicting results that violate dynamics in complex water environments is solved, realizing the physical rationality of ship trajectory prediction and data fitting accuracy, and improving the robustness and safety of the model.

CN121579928APending Publication Date: 2026-02-27WUHAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202512000776.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-29
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing ship trajectory prediction models may produce predictions that violate basic ship dynamics in complex water environments. Furthermore, purely data-driven methods lack reliability and interpretability in rare scenarios or extreme conditions, and fail to effectively incorporate the physical laws of ship motion as prior knowledge and hard constraints.

Method used

A hierarchical fusion design is adopted, combining a Transformer model with a multi-head self-attention mechanism and a ship motion model. By introducing a physical feasibility verification layer and multiple rounds of training, the attention weights are corrected using the residual constraints of the ship motion model to ensure that the prediction results conform to ship dynamics. The time derivative and residuals are calculated by automatic differentiation. The model achieves physical rationality and data fitting accuracy by combining the weighted sum of data-driven loss and physical-driven loss.

Benefits of technology

It improves the robustness and safety of ship trajectory prediction, ensures that the prediction results follow physical feasibility and navigation rules in complex water environments, and enhances the accuracy and practical application value of the prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121579928A_ABST
    Figure CN121579928A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of artificial intelligence, and discloses a method for establishing a ship trajectory prediction model, which comprises the following steps: acquiring data including ship position, course, speed, ship draft and ship type parameters in real time through a ship automatic identification system, introducing a ship motion model by taking Transform containing a multi-head self-attention mechanism as a basic framework, and establishing a ship trajectory prediction model; the attention weight is indirectly corrected through the influence exerted on the total loss function by the residual constraint of the theoretical physical quantity and the predicted physical quantity; and through multiple rounds of training, based on the corrected attention weight matrix, the improved Transform model can generate prediction conforming to ship dynamics. The method overcomes the problems that pure data driven model prediction is poor in reliability and interpretability, and a large amount of training data is needed, and is especially suitable for scheduling of port and inland river shipping. The invention also provides a recording medium storing the program of the method and a system comprising the medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence technology, and in particular its application in port and shipping production scheduling operations. It discloses a method, recording medium and system for establishing a ship trajectory prediction model. Background Technology

[0002] With the booming development of the global shipping industry and the continuous growth in the number of ships, the density of waterway traffic flow has increased significantly, and ship encounter scenarios have become increasingly complex and changeable, posing unprecedented and severe challenges to navigation safety and traffic efficiency. Accurately predicting the future trajectory of ships is a key foundation for improving situational awareness, achieving intelligent collision avoidance, and optimizing route planning, and is crucial for ensuring navigation safety and improving waterway capacity.

[0003] Currently, the field of ship trajectory prediction mainly relies on various technical approaches. Traditional methods, such as Kalman filtering and ship dynamics models, focus on extrapolating predictions using physics-based motion models combined with historical AIS (Automatic Identification System) data. While computationally efficient, these methods have limited adaptability to complex environments and the ability to capture nonlinear behaviors. In recent years, deep learning models have demonstrated strong potential, particularly Recurrent Neural Networks (RNNs) and their variants (such as LSTM and GRU), which are widely used in trajectory prediction due to their sequence modeling capabilities, enabling them to learn complex spatiotemporal patterns from massive amounts of data. Furthermore, Transformer models based on attention mechanisms, with their excellent long-term dependency modeling capabilities and parallel computing advantages, are also beginning to be applied to trajectory prediction, effectively improving the accuracy of long-term time-series predictions.

[0004] Despite significant progress made by data-driven methods such as RNN / LSTM / GRU and Transformer in modeling complex trajectory patterns, they still face important challenges, primarily in two aspects: First, purely data-driven models often act as "black boxes," and their predictions may violate fundamental ship dynamics in certain situations, affecting their reliability and interpretability, especially in rare scenarios or extreme conditions where training data is insufficiently covered. Second, existing models typically focus on mining statistical correlations in the data, failing to explicitly incorporate the physical laws governing ship motion as prior knowledge and hard constraints, which may lead to uncontrolled prediction biases in critical safety scenarios. Therefore, there is an urgent need for a prediction framework that can organically integrate the physical essence of ship motion with powerful spatiotemporal pattern learning capabilities to overcome the limitations of existing methods, ensuring that predictions are not only statistically accurate but also strictly adhere to physical feasibility and navigation rules, thereby improving the robustness, safety, and practical application value of trajectory prediction in complex water environments. Summary of the Invention

[0005] To address the above problems, this invention provides a method for establishing a ship trajectory prediction model, comprising the following steps: S1. A layered fusion design is adopted, with an input layer: real-time data from the model input end is obtained through the Automatic Identification System (AIS), including ship position, heading, speed, draft, and ship type parameters; S2. Based on the Transformer framework which contains a multi-head self-attention mechanism, the spatiotemporal interaction relationship between ships is extracted through the self-attention mechanism, and an initial attention weight matrix is ​​generated. S3. Set up a physical feasibility verification layer: Introduce a ship motion model, determine the residual constraints between theoretical and predicted physical quantities through the ship motion model, and apply them to the total loss function under the Transformer framework. Then, indirectly correct the attention weights through the influence of the ship motion model. S4. After multiple rounds of training, based on the corrected attention weight matrix, the encoder in the Transformer can generate feature representations that conform to ship dynamics, and the decoder can predict future ship trajectories that conform to ship dynamics, thus completing the construction of the ship trajectory prediction model.

[0006] Preferably, based on the physical meaning of the ship motion model, three types of constraints are set: ground speed, heading, and bow angle acceleration constraints.

[0007] Preferably, the predicted bow acceleration and bow velocity are obtained by automatically differentiating the time derivative contained in the predicted trajectory, and used to calculate the residual between them and the theoretical physical quantities determined by the ship motion model.

[0008] Preferably, the total loss function is a weighted sum of the data-driven loss function and the physics-driven loss function; wherein, the data-driven loss function is used to ensure the fitting accuracy between the predicted trajectory and the actual observation data; the physics-driven loss function is constrained by the residual of the ship motion model; and then back-passed to the attention weight matrix through gradient calculation.

[0009] Another aspect of the present invention is to provide a non-transient readable recording medium for storing one or more programs containing multiple instructions, which, when executed, cause the processing circuitry to perform the aforementioned method for establishing a ship trajectory prediction model.

[0010] Another aspect of the present invention provides a system for establishing a ship trajectory prediction model, including a processing circuit and a memory electrically coupled thereto, the memory being configured to store at least one program, the program containing multiple instructions, the processing circuit running the program, and being able to execute the above-described method for establishing a ship trajectory prediction model.

[0011] Compared to existing technologies, this invention provides a method, recording medium, and system for establishing a ship trajectory prediction model, which solves the problem that pure data-driven model predictions may violate the basic dynamics of ships. By incorporating the physical laws governing ship motion as prior knowledge and hard constraints, the amount of training data required to achieve a certain prediction accuracy is reduced. Using the ship motion model residuals as regularization terms, a gradient feedback mechanism guides the model to output trajectories that conform to dynamics. By combining data fitting loss and physical residual loss, the prediction results are ensured to be not only statistically accurate but also strictly follow physical feasibility and navigation rules, thereby improving the robustness, safety, and practical application value of trajectory prediction in complex water environments. Attached Figure Description

[0012] Figure 1 This is a schematic diagram of the ship trajectory prediction model structure in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the process of the decoder accepting physical constraints in an embodiment of the present invention. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be described below with reference to the accompanying drawings. The described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without innovative effort are within the scope of protection of the present invention.

[0014] Referring to the accompanying drawings, the present invention provides an embodiment of a method for establishing a ship trajectory prediction model as follows: a hierarchical fusion design strategy is adopted, and the following internal levels are set.

[0015] I. Input Layer: Receives historical AIS trajectory sequences, represented as: ; Where d represents the feature dimension and k represents the sequence length, including dynamic information such as position coordinates (longitude, latitude), speed over ground (SOG), heading over ground (COG), ship draft, and ship type parameters.

[0016] This module is responsible for converting raw AIS observation data into complete state vectors required for ship dynamics analysis, providing basic state information for subsequent physical constraint calculations.

[0017] Input: Original AIS sequence:

[0018] Where B represents the batch size, T represents the length of the input sequence, and the four dimensions represent: longitude, latitude, speed to Earth (SOG), and heading to Earth (COG).

[0019] The processing includes: (1) Geographic coordinate transformation:

[0020] in, Indicates the ship's current latitude and longitude coordinates (in radians); The reference point is the latitude and longitude (in radians), usually chosen as the starting point of the sequence or the center of the region. R represents the Earth's radius, approximately 6,371,000 meters. Represents the transformed Cartesian coordinates (meters). Significance: Converting spherical latitude and longitude into local planar rectangular coordinates facilitates subsequent kinematic calculations in Euclidean space.

[0021] (2) State vector construction:

[0022] State component definition: Earth coordinate system status:

[0023] Speed ​​in hull coordinate system:

[0024] At the same time, we convert the ground velocity (SOG / COG) into velocity components in the ship's coordinate system and calculate the rate of change of heading. This is the standard input format for Fossen's ship dynamics equations, which is convenient for subsequent use.

[0025]

[0026] in, For planar coordinates, Let u be the bow angle (approximated by COG), v be the longitudinal velocity, v be the lateral velocity, and r be the angular velocity of the bow turn.

[0027] Output: (1) Initial state sequence: (2) Time series: ; II. Transformer Encoding Layer: Utilizes a multi-head self-attention mechanism to extract the spatiotemporal dependencies of ship motion and generate an initial attention weight matrix. Where h represents the number of attention heads.

[0028] This module is responsible for mapping the raw observation data and physical state information to a high-dimensional feature space and adding temporal location information to prepare for Transformer processing.

[0029] enter: Original AIS sequence:

[0030] Initial state:

[0031] Processing procedure: (1) Feature projection:

[0032] in, This indicates a feature dimension concatenation operation. Represents the embedding weight matrix. This is a bias term.

[0033] Mathematical meaning: Improving input features through linear transformation. (Transformer hidden layer dimension) is a high-dimensional space, enhancing the model's expressive power.

[0034] (2) Location coding:

[0035] in, For time step position index, Indexed by feature dimensions, This indicates the dimension of the hidden layer in the Transformer.

[0036] Physical meaning: Add a unique position identifier to each time step in the sequence, enabling the Transformer to perceive temporal relationships, while ensuring that the relative relationship between different position codes can be captured by linear transformation.

[0037] Output: (1) Initial characteristics:

[0038] (2) Initial state:

[0039] III. Physical Feasibility Verification Layer: The Fossen ship motion model refers to the mathematical model systematically proposed and summarized by Norwegian scientist Professor Thor I. Fossen in his classic work "Handbook of Marine Craft Hydrodynamics and Motion Control". It provides a unified framework based on rigid body dynamics and fluid dynamics to describe the motion of marine vehicles such as ships, underwater robots (AUVs), and remotely operated vehicles (ROVs) in six degrees of freedom.

[0040] The core idea of ​​this model is to decompose the motion of a ship into a superposition of rigid body dynamics and fluid dynamics. Rigid body dynamics describes the geometric motion of the ship as a point mass, while fluid dynamics describes the motion of the ship under the influence of forces such as propellers, water puddles, and wind puddles. The Fossen ship motion model uses a concise and unified "vector-matrix" form, making it very suitable for computer simulation and control system design.

[0041] To understand the Fossen model, one must first understand the two coordinate systems it uses: (1) Geodetic coordinate system

[0042] This coordinate system is used to describe the position and attitude of a ship. The origin is at a point on the Earth's surface. Pointing to due north. Pointing due east geographically. Pointing towards the Earth's center.

[0043] (2) Hull coordinate system Used to describe the instantaneous changes in a ship's position and attitude after being subjected to forces. The origin is usually located at the ship's center of gravity; Parallel to sea level and pointing towards the bow, Parallel to sea level and pointing towards the starboard side of the ship, The axis points towards the Earth's center and is perpendicular to the horizontal plane.

[0044] In a surface environment, ships are subjected to external forces in multiple directions, requiring multiple degrees of freedom to describe their complex motion. According to the standards of the Institute of Naval Architects and Marine Engineers (SNAME), the definitions shown in the table below describe the motion of a ship in six degrees of freedom: pitch, sway, heel, roll, and roll. Specifically, coordinates... Represents the position and attitude of the ship in the geodetic coordinate system; its first derivative coordinates This represents the translational linear velocity and rotational angular velocity of the ship in the ship's coordinate system.

[0045] Degrees of freedom describe Hull coordinate system Geodetic coordinate system Surge Along O B X B Translation of the axis Sway Along O B Y B Translation of the axis hanging heave Along O B Z B Translation of the axis Horizontal roll <![CDATA[Rotation along the O B X B axis]]> Pitch <![CDATA[Rotation along the O B Y B axis]]> yaw <![CDATA[Rotation along the O B Z B axis]]> The six-degree-of-freedom model defined in the table above is:

[0046] Although a ship exhibits motion in six degrees of freedom in water, the complete kinematic model described above is overly complex, posing challenges to motion analysis and controller design. Considering that the amplitude of motion in the heave, pitch, and roll degrees of freedom of a USV is relatively small in practical applications, the motion in these three degrees of freedom is generally ignored, i.e.:

[0047] A simplified three-degree-of-freedom ship kinematics model is obtained:

[0048] Fossen established a unified ship dynamics model that decomposes the forces acting on a USV into rigid body forces, hydrodynamic forces, propulsion forces, and disturbance forces.

[0049] In the above formula, M is the inertia matrix of the hull system, derived from the rigid body inertia matrix. and additional mass matrix composition

[0050]

[0051] The ship's mass is m. These are the coordinates of the ship's center of gravity in the ship's coordinate system. It is around Moment of inertia

[0052] The Coriolis force-centripetal force matrix is ​​derived from the rigid body Coriolis force-centripetal force matrix. and the additional Coriolis force-centripetal force matrix composition.

[0053]

[0054] in

[0055]

[0056] The damping matrix is ​​composed of the linear damping matrix D and the nonlinear damping matrix D. composition;

[0058] in,

[0059]

[0060] It is the restoring force and torque generated by gravity and buoyancy. Control force ,in These represent longitudinal force, lateral force, and yaw moment, respectively.

[0061] The meanings of the hydrodynamic coefficients mentioned above are as follows: Meaning of hydrodynamic coefficient The longitudinal added mass coefficient generated by the longitudinal acceleration of the ship The longitudinal added mass coefficient generated by the ship's heading angular acceleration Lateral added mass coefficient generated by lateral acceleration of the ship Lateral added mass coefficient caused by ship's heading angular acceleration Additional moment of inertia in the ship's longitudinal acceleration Additional moment of inertia in the ship's heading caused by lateral acceleration The additional moment of inertia in the heading direction caused by the ship's heading angular acceleration Longitudinal linear water damping coefficient generated by the ship's longitudinal velocity Lateral linear water damping coefficient generated by the ship's lateral velocity Lateral linear water damping coefficient generated by the ship's heading angular velocity The linear water damping coefficient in the ship's lateral velocity The linear water damping coefficient of the ship's heading angular velocity Second-order longitudinal nonlinear water damping coefficient generated by the ship's longitudinal velocity Second-order lateral nonlinear water damping coefficient generated by the ship's lateral velocity Second-order bow-side nonlinear water damping coefficient generated by the ship's bow angular velocity This invention achieves deep embedding of ship kinematics and dynamics rules and constraints by deeply integrating data-driven learning and physical mechanism modeling. The core innovation of this model lies in the structured embedding of the differential equation residual optimization mechanism of the Physical Information Neural Network (PINN) into the attention computation unit of the Transformer architecture, constructing a closed-loop physical optimization path. This significantly enhances the model's physical consistency and generalization ability while ensuring prediction accuracy, as will be elaborated below.

[0062] This encoder has a multi-layered structure, deeply integrating physical computation on top of the standard Transformer encoder to achieve dual constraints of feature learning and physical laws. The input, output, and intermediate steps of the l-th physical sensing encoder layer are as follows: enter: (1) Features of the previous layer: , which are feature representations from the previous coding layer.

[0063] (2) Previous state: It contains ship status information, including the ship's position, speed, and heading.

[0064] (3) Physical guidance signal: The physical guidance information of the upper layer (for the first layer, ).

[0065] The physical sensing encoder layer executes the following five core processing steps in sequence: (1) Physical perception self-attention mechanism, the function of which is to integrate physical constraints and focus on features.

[0066] (2) Feedforward network and layer normalization are used for nonlinear feature transformation and stabilization.

[0067] (3) Physical state update module, which is used for ship dynamic state estimation and correction.

[0068] (4) Fossen physical residual calculation is used to verify the consistency of physical laws.

[0069] (5) Physical guidance signal generation, which is used for cross-layer physical information transmission.

[0070] Output: (1) Updated features: The feature representation after physical constraint optimization.

[0071] (2) Update status: The corrected physical condition of the ship.

[0072] (3) Physical residuals: This quantifies the consistency between the current state and physical laws.

[0073] (4) Guiding signal: This guides the physical attention of the next layer.

[0074] Below, we will explain in detail the five core processing steps in the physical sensing encoder layer.

[0075] (1) Physical perception self-attention mechanism Query-key-value projection:

[0076] in, , represents the learnable projection matrix. For the dimension of attention head, usually h represents the number of attention heads.

[0077] Physics-guided attention calculation:

[0078] in, This represents the attention weight matrix after physical correction. This indicates a physical guidance signal from the upper layer, with the shape of... , This is the physical guidance intensity coefficient, a learnable parameter.

[0079] The role of the physical perception self-attention mechanism is: physical guidance signal As an attention bias, it deeply integrates physical prior knowledge into the standard self-attention mechanism, guiding the model to focus on physically reasonable spatiotemporal relationships and suppressing attention patterns that violate kinematic continuity.

[0080] (2) Feedforward network and layer normalization Two-layer feedforward network:

[0081] in, , This is the weight matrix. Let b be the dimension of the hidden layer of the feedforward network, and b be the bias term. This is the activation function for the rectified linear unit.

[0082] Residual connectivity and layer normalization:

[0083] This step helps to alleviate the vanishing gradient problem in deep networks through residual connections, and layer normalization can accelerate training convergence and improve model stability.

[0084] (3) Physical state update module State increment estimation:

[0085] in, f state This represents a state estimation network, typically a multilayer perceptron state estimation network. These are the state projection weights. This is for state increment estimation.

[0086] f stateIt is a neural network that is responsible for extracting information from features rich in contextual information. In this process, the information most relevant to the state change is extracted. A high-dimensional, abstract feature vector is output, which can be understood as the "cause or trend of the state change." This vector is then passed through a linear layer (weights...). and bias This is mapped to a specific, physically meaningful 6-dimensional state space.

[0087] Status Update:

[0088] Physical significance: By gradually correcting the ship's motion state through feature learning, the state estimation can better conform to the actual physical evolution law.

[0089] (4) Fossen physical residual calculation Processing procedure: Actual acceleration calculation (numerical derivative):

[0090] Calculation method: Use automatic differentiation or finite difference method to calculate speed Regarding time The derivative of .

[0091] Theoretical acceleration calculation (based on Fossen's ship dynamics equations):

[0092] Physical meaning of each term in the Fossen equation: ① Generalized mass matrix (including ship mass and added mass)

[0093] Includes ship mass m, moment of inertia I z and hydrodynamic added mass item ;

[0094] ② Coriolis centripetal force matrix

[0095] Describe the inertial effects generated by the rotational motion of a ship.

[0096] ③ Damping matrix

[0097] Physical residual calculation:

[0098] Physical meaning: Quantifies the degree of consistency between the current network prediction and physical laws; the smaller the value, the more consistent it is with ship dynamics.

[0099] It is important to note that the physical residual calculations described in this section include not only linear acceleration residuals, but also angular acceleration residuals. This key characteristic stems from the state vector definition of the Fossen three-degree-of-freedom model:

[0100] in, These represent the longitudinal and lateral linear velocities, respectively. This indicates the angular velocity of the head rotation.

[0101] (5) Physical guidance signal generation Processing procedure:

[0102] in, To flatten the state sequence into a vector. represents the learnable parameters that map the concatenated features to a guiding signal. tanh is the activation function that limits the output to the range [-1, 1].

[0103] Function: Generates a physical guidance signal for the next layer of attention mechanism, with the shape of... .

[0104] Output: Updated features:

[0105] Update status:

[0106] Physical residuals:

[0107] Physical guidance signal:

[0108] IV. Physical Constraint Decoder Layer

[0109] The physical constraint decoder layer, through deep integration of ship kinematic priors, ensures that the generated trajectory prediction results are both data-driven and physically reasonable while maintaining the powerful sequence modeling capabilities of the Transformer, significantly improving the model's generalization ability and extrapolation performance.

[0110] enter: (1) Encoder characteristics: The context feature representation of the encoder output (2) Encoder status: The sequence of ship physical states output by the encoder (3) Decoding features: The features output by the previous decoding layer (the first layer is the initial input). (4) Predicted state: The state prediction results of the previous layer (the first layer is extrapolated based on the encoder state). Intermediate process: The physical constraint decoder layer executes the following three core processing steps in sequence: (1) Masked self-attention mechanism, autoregressive attention within the decoding sequence.

[0111] (2) Encoder-decoder cross attention, spatiotemporal alignment of historical and future information.

[0112] (3) Physically guided state prediction and dynamically constrained state recursive generation.

[0113] Output data: (1) Decoding features: The feature representation of the current layer; (2) Predicted state: Updated ship status prediction; Masked self-attention mechanism Functional purpose: To ensure the causality of the decoding process, prevent future information leakage, and establish temporal dependencies within the decoding sequence.

[0114] Specific implementation: (1) Query-key-value projection transformation:

[0115] in, : Trainable projection matrix of decoder self-attention (2) Mask attention calculation:

[0116] Masking mechanism: through That is, the upper triangular mask matrix (the elements on the diagonal and above are...) (The following is 0), ensure the first Only the front of the position can be focused on. Each position maintains the temporal causal relationship.

[0117] Encoder-decoder cross-attention Functional purpose: To establish the correlation between encoder historical information and decoder prediction target, and to achieve effective transmission of contextual information.

[0118] Specific implementation: (1) Query-key-value projection transformation:

[0119] Query Q comes from the decoder's self-attention output. ; The key K and value V come from the encoder's final output. ; Enables information exchange between the encoding and decoding sequences.

[0120] (2) Cross-attention calculation:

[0121] in, This represents the output of encoder-decoder cross-attention, which includes historical context information (from the encoder), internal dependencies of future sequences (from decoder self-attention), and spatiotemporal alignment between history and future.

[0122] Significance: Through attention weights The decoder can selectively focus on the most relevant historical information in the encoder at each prediction position to achieve dynamic matching of spatiotemporal patterns.

[0123] Physical state prediction Functional purpose: To generate reasonable state increments under physical and dynamic constraints, and to realize the recursive prediction of ship motion trajectory.

[0124] Specific implementation: (1) State increment prediction network:

[0125] Network structure: : Multilayer perceptron state prediction network; : Projected weights of the state dimension; : The predicted change in state.

[0126] (2) Physical constraint state update:

[0127] (3) Feedforward network and feature normalization:

[0128] in, , This is the weight matrix of the feedforward network.

[0129] Residual connections and layer normalization ensure training stability and gradient flow.

[0130] V. Output and Loss Calculation Layer The output and loss calculation layer is responsible for converting the model's internal representation into the final usable prediction result, and simultaneously optimizing the data fitting accuracy and consistency with physical laws through a multi-objective loss function, thus realizing a complete closed loop of deep learning of physical information.

[0131] enter: (1) Final decoding features: The high-level feature representation after processing by all decoder layers; (2) Final predicted state: The decoder recursively generates a complete sequence of ship states; Intermediate process: The output and loss calculation module consists of two core components: (1) Final output generation: Convert the internal representation of the network into actual usable state and trajectory output; (2) Multi-objective loss calculation: Output data of dual optimization objectives based on integrated data fitting and physical constraints; Final output generation (1) Status output projection Functional purpose: To map the high-level feature representation of the decoder back to the physical state space, thereby obtaining directly usable state variable predictions.

[0132] (2) Trajectory coordinate transformation Functional purpose: To convert the physical state representation inside the model back to the standard geographic coordinate system and generate the final usable trajectory prediction results.

[0133] Specific implementation: ; ; ;

[0134] Parameter description: Latitude and longitude coordinates of the reference point Earth's radius Cartesian coordinates : Converted latitude and longitude coordinates Output dimensions: (Longitude, Latitude) Multi-objective loss function (1) Data loss (supervised learning term) Functional Purpose: To measure the difference between the model's predicted state and the actual observed state, and to ensure that the model accurately fits the training data.

[0135] Mathematical expression:

[0136] Calculation details: ① Point-by-point comparison: Calculate the error for each time step of each sample in the batch.

[0137] ② L2 norm: Uses Euclidean distance to measure the difference between the prediction and the actual value.

[0138] ③ Normalization: Divide by the product of batch size and sequence length to obtain the average error.

[0139] Physical meaning: To ensure the accuracy of the model's predictions on known data points.

[0140] (2) Physical loss (physical constraint) Functional purpose: To enhance the model's adherence to physical laws and improve the physical rationality and generalization ability of prediction results.

[0141] Mathematical expression:

[0142] Detailed component analysis: ① Encoder physical residual term:

[0143] Source: Sum of Fossen equation residuals for all N encoder layers.

[0144] ② Decoder state increment item:

[0145] in, The state increment predicted by the decoder at layer m is... The state increment is calculated from the real state sequence. The weighting coefficient adjusts the relative importance of this item in the physical loss.

[0146] Through the above mechanism, the physical constraint layer can adapt to different ship types and dynamic environments, ensuring the model's generalization ability.

[0147] The physical residual gradient is propagated backward to the attention weight matrix via backpropagation. The gradient signal dynamically adjusts the distribution of attention weights, enabling it to actively avoid physically infeasible regions during feature extraction, thereby achieving closed-loop optimization of physical constraints.

[0148] Workflow using this model: (1) Input processing stage: Historical AIS trajectories are encoded and input into the Transformer encoder, which captures the spatiotemporal interactions between ships through a self-attention mechanism.

[0149] (2) Physical constraint injection stage: The kinematic feasibility of the initial attention weights A is verified using a ship motion model:

[0150] in, This is a feasibility judgment function built based on the ship motion model, where k is a projection factor used to map violation weights to the physical feasible region.

[0151] (3) Feature generation and prediction stage: Corrected weights This is used to calculate the physical weighted feature Z, and a preliminary trajectory prediction is output through a feedforward network. :

[0152] (4) Residual feedback and optimization stage: The residual between the predicted trajectory calculated by the physical feasibility verification layer and the ship motion model The gradient signal is generated and backpropagated to the encoder to achieve iterative parameter updates and further enhancement of physical constraints.

[0153] Compiling the above methods and steps into a program and storing it on a hard disk or other non-transitory storage medium constitutes an embodiment of the present invention's "a non-transitory readable recording medium"; while connecting the storage medium electrically to a computer processor and enabling the establishment of a ship trajectory prediction model through data processing constitutes an embodiment of the present invention's "a system for establishing a ship trajectory prediction model".

[0154] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computers or available storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0155] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0156] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0157] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0158] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for establishing a ship trajectory prediction model, characterized in that, Includes the following steps: S1. A layered fusion design is adopted, with an input layer: real-time data from the model input end is obtained through the Automatic Identification System (AIS), including ship position, heading, speed, draft, and ship type parameters; S2. Based on the Transformer framework which contains a multi-head self-attention mechanism, the spatiotemporal interaction relationship between ships is extracted through the self-attention mechanism, and an initial attention weight matrix is ​​generated. S3. Set up a physical feasibility verification layer: Introduce a ship motion model, determine the residual constraints between theoretical and predicted physical quantities through the ship motion model, and apply them to the total loss function under the Transformer framework. Then, indirectly correct the attention weights through the influence of the ship motion model. S4. After multiple rounds of training, based on the corrected attention weight matrix, the encoder in the Transformer can generate feature representations that conform to ship dynamics, and the decoder can predict future ship trajectories that conform to ship dynamics, thus completing the construction of the ship trajectory prediction model.

2. The method for establishing a ship trajectory prediction model according to claim 1, characterized in that, Based on the physical meaning of the ship motion model, three types of constraints are set: ground speed, heading, and bow angle acceleration constraints.

3. The method for establishing a ship trajectory prediction model according to claim 2, characterized in that, The predicted angular acceleration and angular velocity are obtained by calculating the time derivative contained in the predicted trajectory through automatic differentiation. These are then used to calculate the residuals between the predicted angular acceleration and the theoretical physical quantities determined by the ship motion model.

4. The method for establishing a ship trajectory prediction model according to claim 3, characterized in that, The total loss function is a weighted sum of the data-driven loss function and the physics-driven loss function. The data-driven loss function is used to ensure the fitting accuracy between the predicted trajectory and the actual observation data. The physics-driven loss function is constrained by the residuals of the ship motion model and then back-passed to the attention weight matrix through gradient calculation.

5. A non-transitory readable recording medium for storing one or more programs containing multiple instructions, characterized in that, When the instruction is executed, the processing circuit will perform a method for establishing a ship trajectory prediction model according to any one of claims 1-4.

6. A system for establishing a ship trajectory prediction model, comprising a processing circuit and a memory electrically coupled thereto, characterized in that, The memory is configured to store at least one program, the program containing multiple instructions, and the processing circuit runs the program to execute a method for establishing a ship trajectory prediction model according to any one of claims 1-4.