Water traffic accident ship trajectory reconstruction method based on physical neural network architecture

By embedding ship motion mathematical knowledge and water traffic collision avoidance rules in physical neural network architecture, the problems of ship trajectory reconstruction accuracy and data requirements in water traffic accident scenarios are solved, and high-precision trajectory reconstruction and algorithm interpretability are achieved.

CN120014122APending Publication Date: 2025-05-16SHANGHAI MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411871185.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The existing ship trajectory reconstruction methods are limited in water traffic accident scenarios, especially due to the scarcity and incompleteness of AIS data, resulting in a decrease in reconstruction accuracy and an increase in data demand.

Method used

A method based on physical neural network architecture is designed to reconstruct the ship trajectory without AIS data through the denoising diffusion probability model module, and combine the knowledge of ship motion mathematical knowledge and knowledge of water traffic collision avoidance rules to embed loss terms to improve reconstruction accuracy and interpretability.

Benefits of technology

It realizes high-precision ship trajectory reconstruction with limited input information, reduces the demand for training data, and improves the interpretability and scope of application of the algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120014122A_ABST
    Figure CN120014122A_ABST
Patent Text Reader

Abstract

The invention discloses a water traffic accident ship trajectory reconstruction method based on a physical neural network architecture, and belongs to the technical field of ship trajectory prediction. Comprising the following steps: constructing an improved BERT-Base-Channel model, extracting water traffic accident report information, and combining a ship motion mathematical model to obtain a data set; according to the method, a physical neural network model is constructed, a Diffusion-TS model is taken as a basic framework to perform water traffic accident ship trajectory reconstruction, an encoder part is changed into a double-encoder interaction mode, and meanwhile, loss based on a ship motion mathematical model and loss based on a water traffic collision avoidance rule are introduced into a loss function. According to the method, under the condition that input information is limited, domain knowledge is embedded into the neural network, the requirement of the model for training data is effectively reduced, the application range and precision of the model in ship trajectory reconstruction of the water traffic accident are remarkably improved, and the algorithm interpretability is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of ship trajectory prediction, and in particular to a method for reconstructing ship trajectories in water traffic accidents based on a physical neural network architecture. Background Art

[0002] Ship trajectory reconstruction is to infer and reconstruct the complete trajectory of the ship during the unobserved period based on incomplete or sparse trajectory data. Since the collection of ship trajectory data is usually intermittent or discontinuous, there is an urgent need for ship trajectory reconstruction. This technology plays an important role in improving the efficiency and safety of water traffic management, and has been widely used in navigation safety assessment, maritime accident investigation and other fields. Therefore, trajectory reconstruction technology has become an important research direction in the field of water intelligent transportation.

[0003] Existing trajectory reconstruction methods can be mainly divided into interpolation methods and machine learning methods. Interpolation methods are based on mathematical models and infer the unobserved position of ships by extrapolating between known trajectory points. Common interpolation methods include linear interpolation and spline interpolation, which assume that the ship moves between two known points according to a certain rule (such as uniform linear motion or smooth curve). A core feature of interpolation methods is their high dependence on data density, that is, when the interval between trajectory points is small, interpolation methods can provide more accurate reconstruction results; however, when the data is sparse or the interval is too large, the reconstruction accuracy of interpolation methods decreases significantly, and may not be able to capture the actual motion trajectory of the ship in an unknown time period. In contrast, machine learning methods adopt a data-driven model to capture the motion laws of ships through training with a large amount of historical trajectory data. This type of method can achieve more accurate ship trajectory reconstruction under sparse data conditions through the learned ship motion mode, and its requirements for data sampling rate are relatively low. However, the effectiveness of machine learning methods depends on the quantity and quality of training data. If the training data is insufficient or unrepresentative, the model may not be able to effectively capture the complex features in the trajectory, resulting in large reconstruction errors. In addition, model training of machine learning methods usually requires large computing resources, and their generalization ability in specific environments may be limited.

[0004] At the same time, the above methods also have a common problem, that is, they all have a common basic assumption, that is, they rely on the ship's Automatic Identification System (AIS) data. As an important ship navigation equipment, AIS provides relatively stable and reliable trajectory data support in most navigation and monitoring scenarios. However, in the special scenario of water traffic accidents, the availability of AIS data is limited in many aspects. First, some small cargo ships with a gross tonnage lower than the minimum value specified by the International Convention for the Safety of Life at Sea (SOLAS) are not equipped with AIS equipment; secondly, some ships may be missing data due to equipment failure, non-compliance with regulations, or even deliberately shutting down the AIS system to evade supervision. In addition, the trajectory data of water traffic accidents is relatively scarce, and the AIS data at the time of the accident is often difficult to obtain or incomplete. This severely limits the application of existing ship trajectory reconstruction methods based on AIS data in accident scenarios. Summary of the invention

[0005] In view of the defects of the prior art, the present invention designs a physical neural network architecture that embeds the mathematical knowledge of ship motion and the knowledge of water traffic collision avoidance rules in the denoised diffusion probability model. The architecture reconstructs the trajectory of ships in water traffic accidents through the denoised diffusion probability model module, and restores the real trajectory coordinate points from the random noise coordinate points without relying on the ship AIS data as input. At the same time, combined with the knowledge loss term in the field of water traffic, the difference between the generated results of the denoised diffusion probability model and the physical mechanism and traffic rules is quantified, thereby realizing the embedding of knowledge into the neural network, reducing data requirements, improving accuracy, and enhancing the interpretability of the algorithm.

[0006] In order to achieve the above object, the present invention provides a method for reconstructing ship trajectories in water traffic accidents based on a physical neural network, which is characterized by comprising the following steps:

[0007] (1) Build an improved BERT-Base-Chinese model, extract historical water traffic accident report information, and combine it with the mathematical model of ship motion to obtain a data set;

[0008] (2) Construct a physical neural network model, use the Diffusion-TS model as the basic framework to reconstruct the trajectory of ships involved in water traffic accidents, and change its Transformer encoder part to a dual encoder interaction mode. At the same time, introduce the loss based on the mathematical model of ship motion and the loss based on water traffic collision avoidance rules into the loss function.

[0009] (3) Based on the data set, training the physical neural network model;

[0010] (4) Obtain the water traffic accident report to be reconstructed and reconstruct the trajectory of the ship involved in the water traffic accident.

[0011] Furthermore, the improved BERT-Base-Chinese model is a method of partially updating the high-dimensional parameter matrix of the BERT-Base-Chinese model using the LoRA technology to obtain a new fine-tuned parameter matrix W:

[0012] W=W0+△W=W0+BA

[0013] in: represents the initial parameter matrix; Represents the offset of the model parameter matrix during the LoRA fine-tuning process. LoRA fine-tuning uses low-rank decomposition technology to decompose the offset matrix △W into the product of two smaller dimensional matrices B and A. And r< <min(m,n)。

[0014] Furthermore, the step (1) is specifically as follows:

[0015] (1.1) Obtain historical water traffic accident reports and extract information based on the trained improved BERT-Base-Chinese model;

[0016] (1.2) Based on the extracted information, the corresponding accident scenario is constructed in the Unity environment, and trajectory data consistent with the accident report is generated based on the mathematical model of ship motion;

[0017] (1.3) For accident types with relatively few historical reports of water traffic accidents, the trajectory of such accidents is simulated and constructed in the Unity environment based on the mathematical model of ship motion, and multiple trajectory data of similar accidents are synthesized by adjusting parameters;

[0018] (1.4) The trajectory data based on steps (1.2) and (1.3) together constitute the data set.

[0019] Furthermore, the encoder part of the Diffusion-TS model uses two independent encoders to encode the two ship trajectories with interactive relationships respectively, and then extracts their respective features through two independent fully connected layers, and concatenates the extracted feature vectors as the final output of the encoder:

[0020]

[0021] in: is the concatenated feature vector output by the encoder part of the Diffusion-TS model; concat(·) is the vector concatenation function, W i and b i are the weights and biases of two independent fully connected layers, and They are the outputs of the two ship trajectories after passing through the original encoder.

[0022] Furthermore, the loss function of the physical neural network model is:

[0023] L train =L trajectory +l ship L ship +l rule L rule

[0024]

[0025]

[0026] Where: L trajectory is the original trajectory error loss function, L ship is the loss function of the mathematical model of ship motion, L rule is the loss function of the water traffic collision avoidance rule; is the target trajectory data, is the output trajectory data predicted by the model, which contains n accident trajectory data samples. Each trajectory data contains m time points, and each time point contains d-dimensional trajectory data. is the initial condition of the trajectory data predicted by the model at the initial moment; MMG(·) is the calculation function of the mathematical model of ship motion, L1(·) is the mean absolute error loss function, and the function Rule(·) is the calculation function of the water traffic collision avoidance rules, which is used to determine whether the collision avoidance action in the accident trajectory complies with the collision avoidance rules under the corresponding encounter form, thereby generating the compliance matrix Rule(Y)∈{0,1} n×m and The compliance labels of the collision avoidance actions corresponding to the target trajectory and the predicted trajectory, respectively, where 0 indicates compliance and 1 indicates non-compliance; BCE(·) is the binary cross entropy loss function.

[0027] Furthermore, the ship motion mathematical model adopts the MMG ship motion mathematical model:

[0028]

[0029] Where: X I and Y I are the components of the fluid inertia force acting on the bare hull along the Gx and Gy directions respectively; NI is the fluid inertia moment acting on the bare hull; X H and Y H are the components of the fluid viscosity force acting on the bare hull along the Gx and Gy directions respectively; N H is the fluid viscous moment acting on the bare hull; X P and Y P are the components of the fluid dynamics acting on the open water propeller along the Gx and Gy directions respectively; N P is the fluid dynamic moment acting on the open water propeller; X R and Y R are the components of the fluid dynamics acting on the open water rudder along the Gx and Gy directions respectively; N R is the fluid dynamic moment acting on the open water rudder.

[0030] Furthermore, the marine traffic collision avoidance rules refer to calculating the collision risk using the closest approach distance and the closest approach time when two ships meet;

[0031]

[0032]

[0033] CRI=0.6×f(DCPA)+0.4×f(TCPA),CRI∈[0,1]

[0034] Where: DCPA is the closest approach distance, TCPA is the closest approach time, and CRI is the collision risk;

[0035] When the CRI is greater than the threshold, it is considered that there is a collision risk at the current trajectory point. According to the International Regulations for Preventing Collisions at Sea, the calculation function of the water traffic collision avoidance rules is obtained. If the rules are met, the output is 0, and if the rules are not met, the output is 1.

[0036] The present invention also provides a device for reconstructing ship tracks in water traffic accidents based on a physical neural network, comprising:

[0037] The collection module is used to collect historical water traffic accident reports, build an improved BERT-Base-Chinese model, extract historical water traffic accident report information, and combine it with the ship motion mathematical model to obtain a data set;

[0038] The model building module is used to build a physical neural network model, which uses the Diffusion-TS model as the basic framework to reconstruct the trajectory of ships in water traffic accidents, and changes its Transformer encoder part to a dual encoder interaction mode. At the same time, the loss based on the mathematical model of ship motion and the loss based on water traffic collision avoidance rules are introduced into the loss function;

[0039] A model training module, used to train the physical neural network model based on the data set;

[0040] The reconstruction module is used to obtain the water traffic accident report to be reconstructed and reconstruct the trajectory of the ship involved in the water traffic accident.

[0041] Beneficial effects of the present invention:

[0042] The present invention embeds the mathematical knowledge of ship motion and the knowledge of water traffic collision avoidance rules into the denoising diffusion probability model, and constructs a physical neural network architecture. The architecture reconstructs the trajectory of ships in water traffic accidents through the denoising diffusion probability model module, and restores the real trajectory coordinate points from the random noise coordinate points, without relying on the ship AIS data as input. At the same time, combined with the knowledge loss term in the field of water traffic, the difference between the generated results of the denoising diffusion probability model and the physical mechanism and traffic rules is quantified, thereby realizing the embedding of knowledge into the neural network, reducing data requirements, improving accuracy, and enhancing the interpretability of the algorithm.

[0043] Under the condition of limited input information, the method of the present invention embeds domain knowledge into the neural network, effectively reduces the model's demand for training data, and significantly improves the model's applicability and accuracy in reconstructing ship trajectories in water traffic accidents. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 The present invention is a flowchart of a method for reconstructing ship trajectories in a water traffic accident based on a physical neural network according to an embodiment of the present invention.

[0045] Figure 2 It is a schematic diagram of the plane motion description of the mathematical model of ship motion according to an embodiment of the present invention.

[0046] Figure 3 This is a diagram describing a method for identifying ship encounter patterns according to an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0048] like Figure 1 As shown, the embodiment of the present invention provides a method for reconstructing the trajectory of a ship in a water traffic accident based on a physical neural network, comprising the following steps:

[0049] S101. Build an improved BERT-Base-Chinese model, extract water traffic accident report information, and combine it with the mathematical model of ship motion to obtain a training data set.

[0050] An embodiment of the present invention provides an improved BERT-Base-Chinese model. This model is based on the Transformer structure of Bidirectional Encoder Representations from Transformers (BERT) and has been pre-trained on a large-scale Chinese corpus. The BERT-Base-Chinese model can convert the input text into a high-dimensional vector representation through a bidirectional encoding strategy from left to right and from right to left to capture semantic and contextual information in the text, thereby having the ability to extract information from the target text. The improved BERT-Base-Chinese model uses the LoRA technique to partially update the high-dimensional parameter matrix of the BERT-Base-Chinese model to obtain a new fine-tuned parameter matrix W, as follows:

[0051] W = W0 + ΔW = W0 + BA

[0052] Wherein, represents the initial parameter matrix of the BERT-Base-Chinese model; represents the offset of the model parameter matrix during the LoRA fine-tuning process. To reduce the dimensional complexity during fine-tuning and save video memory space and learning costs, the LoRA fine-tuning decomposes the offset matrix ΔW into the product of two smaller-dimensional matrices B and A through the low-rank decomposition technique, and r << min(m, n). In this way, the LoRA technique avoids the "catastrophic forgetting" phenomenon while retaining the core capabilities of the original BERT-Base-Chinese model. The final parameter matrix is represents the new model applicable to the water traffic accident report text dataset after LoRA fine-tuning. This fine-tuned model endows the BERT-Base-Chinese model with the ability to perform specific tasks through LoRA, significantly improving the accuracy and efficiency of the model in the information extraction task of water traffic accident reports.

[0053] The embodiment of the present invention uses the Unity 3D game engine to create synthetic data. First, the improved BERT-Base-Chinese model is used to extract information from 614 water traffic accident reports provided by the China MSA, and combined with manual processing methods, the corresponding accident scenarios are constructed in the Unity environment. In addition, based on the mathematical knowledge of ship motion, it is ensured that the accident trajectories of the ships are as consistent as possible with the descriptions in the accident reports while conforming to the physical laws. Through this method, the present invention finally generates 313 double-ship collision accident trajectories and 301 single-ship accident trajectories. Single-ship accidents include grounding, stranding, collision, fire, wind damage, and self-sinking, etc.

[0054] For the types of accidents with less reported water traffic accidents, although these accidents are rare in reality, given the severity of the consequences of the accidents, these data are crucial for training the model. Therefore, based on the mathematical model of ship motion, the trajectory of such accidents is simulated and constructed in the Unity environment, and a large amount of similar accident trajectory data is synthesized through parameter adjustment to expand the data set.

[0055] The final generated dataset contains 2456 time series data and is divided into a training set and a validation set in a ratio of 8:2.

[0056] S102. Construct a physical neural network model, use the Diffusion-TS model as the basic framework to reconstruct the trajectory of ships involved in water traffic accidents, and change its Transformer encoder part to a dual encoder interaction mode. At the same time, introduce losses based on the mathematical model of ship motion and losses based on water traffic collision avoidance rules into the loss function.

[0057] An embodiment of the present invention proposes a physical neural network model for reconstructing the trajectory of ships in water traffic accidents. The model embeds the mathematical knowledge loss term of ship motion and the knowledge loss term of water traffic collision avoidance rules in the diffusion time series generation model Diffusion-TS, which limits the gradient optimization to a narrower solution space that conforms to the laws of physics, effectively reduces the data demand of the model in the task of reconstructing the trajectory of ships in water traffic accidents, and improves the accuracy and interpretability of the model.

[0058] Diffusion-TS extracts high-level features from the missing time series data input through the Transformer encoder, and uses these features as conditional inputs to generate latent space vectors, and finally decodes and restores the unobserved time series data through the denoising diffusion probability model. However, in the task of reconstructing the trajectory of ships in water traffic accidents, it usually involves a double-ship collision accident, and the navigation status of one ship will affect the navigation trajectory of the other ship. Existing encoders cannot consider the interaction between two ships at the same time. To solve this problem, the encoder part of the Diffusion-TS model in an embodiment of the present invention uses two independent encoders to encode the two ship trajectories with an interactive relationship respectively, and then extracts their respective features through two independent fully connected layers, and splices the extracted feature vectors as the final output of the encoder, thereby providing support for subsequent compliance judgment of water traffic collision avoidance rules and reconstruction of double-ship interactive trajectories.

[0059]

[0060] in: is the concatenated feature vector output by the water dual-ship interactive encoder in the present invention, concat(·) is the vector concatenation function, Wi and b i are the weights and biases of two independent fully connected layers, and They are the outputs of the two ship trajectories after passing through the original encoder.

[0061] Prior knowledge is an important domain knowledge, and the deep learning model is a data-driven method. Therefore, the essence of embedding domain knowledge into the deep learning model to construct a physical neural network lies in how to fuse the symbolic semantic space with the vector feature space. The embodiment of the present invention mainly embeds the mathematical knowledge of ship motion and the knowledge of water traffic collision avoidance rules into the neural network by introducing the difference between the prediction results and the physical mechanism in the loss function, thereby constructing a physical neural network.

[0062] The mathematical model of ship motion is the core of ship motion simulation and control, and is the key content of mathematical knowledge of ship motion. The mathematical model of ship motion adopted in this invention is established based on the inertial coordinate system O0-x0y0z0 and the attached coordinate system G-xyz, where the inertial coordinate system is fixed on the earth and is regarded as stationary, and the attached coordinate system is fixed on the ship and changes with the movement of the ship, such as Figure 2 shown.

[0063] According to Newton's momentum theorem and momentum theorem about the center of mass motion, in order to describe the motion law of the ship in the inertial coordinate system, the embodiment of the present invention decomposes the plane motion of the ship into several parts: the linear motion along the x0 direction and the y0 direction along the center of gravity G, and the yaw motion around the z0 axis. The decomposition process can be described by the following formula.

[0064]

[0065] Where: m is the mass of the ship and attached water; are the point-line acceleration components of the center of gravity G along the directions of O0x0 and O0y0; X0 and Y0 are the components of the external force acting on the ship along the directions of O0x0 and O0y0 respectively; I z is the moment of inertia of the ship about the Gz axis; is the angular acceleration of the ship rotating around the fixed axis Gz; N is the turning moment exerted on the ship.

[0066] Convert the forces X0 and Y0 of the ship in the inertial coordinate system O0-x0y0z0 to the forces X and Y in the attached coordinate system G-xyz:

[0067]

[0068] Convert the ship's speed u and v in the attached coordinate system G-xyz to the speed in the inertial coordinate system O0-x0y0z0

[0069]

[0070] After differentiating both sides with respect to time, first substitute the above formula to obtain the motion law of the ship in the attached coordinate system G-xyz:

[0071]

[0072] Where: u and v are the instantaneous velocity components of the center of gravity G along the Gx and Gy directions respectively; is the angular velocity of the ship rotating around the fixed axis Gz.

[0073] In order to concisely represent the interference effect between the hull, propeller and rudder in the mathematical model of ship motion, and reasonably describe the various fluid dynamics acting on the hull, the embodiment of the present invention adopts the separation model method proposed by the Japanese Ship Maneuvering Mathematical Model Group (MMG). Specifically, the fluid dynamics and torque acting on the hull are physically decomposed into the fluid dynamic components of the bare hull, open water propeller and open water rudder, as well as the mutual interference fluid dynamics and torques between them. The basic form of the MMG ship motion mathematical model obtained in this way is as follows:

[0074]

[0075] Where: X I and Y I are the components of the fluid inertia force acting on the bare hull along the Gx and Gy directions respectively; N I is the fluid inertia moment acting on the bare hull; X H and Y H are the components of the fluid viscosity force acting on the bare hull along the Gx and Gy directions respectively; N H is the fluid viscous moment acting on the bare hull; X P and Y P are the components of the fluid dynamics acting on the open water propeller along the Gx and Gy directions respectively; N P is the fluid dynamic moment acting on the open water propeller; X R and Y R are the components of the fluid dynamics acting on the open water rudder along the Gx and Gy directions respectively; N R is the hydrodynamic moment acting on the open water rudder. The sub-terms and their hydrodynamic derivatives in the formula are determined by referring to the previous empirical formulas and numerically solved by the fourth-order Runge-Kutta method. Finally, the mathematical model of ship motion can be used to predict the maneuverability of the ship.

[0076] The calculation function of the MMG ship motion mathematical model is as follows:

[0077] 1. Calculation function of fluid inertia force acting on the bare hull:

[0078]

[0079] Where: ij is the fluid inertia force in the j direction when the ship moves at unit (angular) velocity in the i direction; are the flow field velocity potential when the ship moves in the i and j degrees of freedom directions, p, q, r are the heel angular velocity, pitch angular velocity and turning angular velocity of the ship in the appendage coordinate system, u, v, w are the longitudinal velocity, lateral velocity and vertical velocity of the ship in the appendage coordinate system, respectively.

[0080] 2. Calculation function of fluid viscosity acting on the bare hull:

[0081]

[0082]

[0083] X vr =C m ·m 22 -m 22

[0084]

[0085]

[0086]

[0087]

[0088]

[0089]

[0090]

[0091]

[0092]

[0093]

[0094]

[0095]

[0096]

[0097] Where: Xuu u 2 is the longitudinal resistance, X c is the distance from the center of gravity of the ship to the center of the hull, L, B, T, C b are the length, width, depth and square coefficient of the ship respectively, ρ is the water density, V is the water velocity, m 22 is the additional longitudinal mass of the ship, is the hull aspect ratio, τ=d a -d f The difference in draft between the bow and stern.

[0098] 3. Calculation function of fluid dynamics acting on open water propeller:

[0099]

[0100]

[0101]

[0102] Where: T is the thrust of the propeller, J is the propulsion coefficient, ω p ,t p are the wake fraction and thrust reduction factor at the propeller, D p is the propeller diameter, n is the main engine speed, k T is the propeller thrust coefficient.

[0103] 4. Calculation function of fluid dynamics acting on open water rudder:

[0104]

[0105]

[0106]

[0107]

[0108]

[0109] Among them: F N is the positive pressure on the rudder, δ is the rudder angle (the right rudder is positive), t R is the rudder force reduction coefficient, a H is the correction factor for the lateral force induced by steering, X H X is the distance from the center of action of the lateral force induced by steering to the center of the ship, R is the x-direction coordinate of the lateral force acting on the rudder, A R is the rudder blade area, f a is the rudder lift coefficient C LThe slope at angle of attack a = 0, α R is the effective angle of attack of the incoming flow at the rudder, λ is the rudder aspect ratio, U R is the effective flow velocity at the rudder, u R 、v R are its longitudinal and transverse components respectively.

[0110] The present invention embeds the MMG ship motion mathematical model into the Unity ship motion simulation, and designs a ship motion mathematical knowledge loss term L in the algorithm. ship .in It is the output trajectory data tensor predicted by the model, which contains n accident trajectory data samples. Each trajectory data contains m time points, and each time point contains d-dimensional trajectory data. is the initial condition of the trajectory data predicted by the model at the initial moment. MMG(·) is the calculation function of the MMG ship dynamic mathematical model, which is used to derive the trajectory sequence from the initial conditions of the ship's navigation. L1(·) is the mean absolute error loss function, which is used to quantify the consistency between the reconstructed trajectory output by the model and the MMG ship motion model. This method not only generates a synthetic data set of ship trajectories that conform to the ship's design performance and navigation hydrodynamic characteristics, but also further guides Diffusion-TS to reconstruct the ship accident trajectory to make it consistent with physical reality.

[0111]

[0112] During the navigation of ships, especially in complex situations such as encounters, cross encounters or overtaking, the risk of collision between ships is particularly prominent. In order to reduce the probability of collision accidents and improve the efficiency of response, the crew must take appropriate collision avoidance actions according to the specific encounter situation. As an important regulation in the field of water traffic accidents, the "International Regulations for Preventing Collisions at Sea, 1972" clearly stipulates the collision avoidance measures that ships should take in different encounter situations. The rules provide scientific and standardized operating guidelines for crew members, effectively reducing the uncertainty of collision avoidance behavior of ships in complex navigation situations. The present invention designs a loss item for water traffic collision avoidance rules for the accurate identification and analysis of ship collision avoidance behaviors, aiming to optimize the performance of Diffusion-TS in the reconstruction of ship trajectories in water traffic accidents. Through this loss item, the effective collision avoidance behavior and the uncoordinated or erroneous collision avoidance behavior reflected in the trajectory of ships in water traffic accidents can be accurately captured. This innovation not only improves the speed of trajectory reconstruction, but also significantly improves the accuracy of the reconstruction process.

[0113] Specifically, when using gradient descent to optimize the model, the model parameters of Diffusion-TS are updated along the gradient direction of the loss function. If the loss function does not contain the constraints of the collision avoidance rules, the model only aims to minimize the traditional error, which may cause the model to explore trajectories that do not conform to the actual collision avoidance behavior. During the gradient descent process, the error may stay in a local minimum that does not conform to the laws of physics. After introducing the loss term containing the collision avoidance rules, the optimization process guides the model to converge towards a relatively narrow solution space. In this process, the gradient not only updates the parameters according to the trajectory error, but also needs to be adjusted according to whether the trajectory conforms to the actual collision avoidance behavior of water traffic accidents. This additional constraint makes each gradient update move in the direction that conforms to the actual physical laws, thereby accelerating the convergence of the model in the correct trajectory space.

[0114] The water traffic collision avoidance rule embedding of the embodiment of the present invention starts from judging whether there is a collision risk in the trajectory of the double-ship accident, and uses the distance of closest point of approach (DCPA) and time to close point of approach (TCPA) when the two ships meet to calculate the collision risk index (CRI), and the process is shown in the following formula:

[0115]

[0116]

[0117] CRI=0.6×f(DCPA)+0.4×f(TCPA),CRI∈[0,1]

[0118] When CRI>0.5, it is considered that there is a collision risk at the current trajectory point, and the ship encounter form is further identified, such as Figure 3 With the ship as the true north, the azimuth of the other ship is α az The value is between 0 and 360 degrees. The collision avoidance behaviors corresponding to different encounter forms in the International Regulations for Preventing Collisions at Sea, 1972 are shown in Table 1.

[0119] Table 1

[0120]

[0121] The loss item L of the water traffic collision avoidance rule in the embodiment of the present invention rule Finally, it is calculated according to the following formula:

[0122]

[0123] in is the target trajectory data tensor, is the output trajectory data tensor predicted by the model. The function Rule(·) is the collision avoidance action compliance calculation function, which is used to determine whether the collision avoidance action in the accident trajectory complies with the collision avoidance rules under the corresponding encounter form, thereby generating the compliance matrix Rule(Y)∈{0,1} n×m and The compliance labels of the collision avoidance actions corresponding to the target trajectory and the predicted trajectory, respectively, where 0 indicates compliance and 1 indicates non-compliance. BCE(·) is the binary cross entropy loss function, which is used to measure the difference between the two compliance matrices.

[0124] The final objective function is:

[0125] L train =L trajectory +l ship L ship +l rule L rule

[0126] Where: ship and λ rule are learnable weight parameters.

[0127] S103: Based on the training data set, the physical neural network model is trained.

[0128] Based on the data set in step S101, the physical neural network model is trained. During the training process, the number of noise coordinate points generated is set to 50,000, the sequence length is 120, the number of encoder and decoder layers is set to 2, the number of attention heads is set to 4, the number of hidden layers is set to 4, the batch size is set to 64, and the basic learning rate is set to 1.0×10 -5 , the threshold of the learning rate scheduler is set to 2000, the learning rate decay coefficient is set to 0.5, and the maximum number of iterations is set to 20000.

[0129] S104: Obtain a water traffic accident report to be reconstructed, and reconstruct the trajectory of the ship involved in the water traffic accident.

[0130] In the process of reconstructing the ship trajectory of a water traffic accident, first, the water accident report is input into the fine-tuned large language model of the present invention to obtain the standardized trajectory information of the ship at the starting point and the end point of the accident; secondly, the feature vector of the accident trajectory is extracted through the water dual-ship interactive encoder; finally, the feature vector and the randomly initialized noise coordinate points are input into the denoising diffusion probability model decoder, and after gradual denoising, high-quality accident trajectory data is restored under the condition of only very little information.

[0131] The present invention also provides a device for reconstructing ship tracks in water traffic accidents based on a physical neural network, comprising:

[0132] The collection module is used to collect historical water traffic accident reports, build an improved BERT-Base-Chinese model, extract historical water traffic accident report information, and combine it with the ship motion mathematical model to obtain a data set;

[0133] The model building module is used to build a physical neural network model, which uses the Diffusion-TS model as the basic framework to reconstruct the trajectory of ships in water traffic accidents, and changes its Transformer encoder part to a dual encoder interaction mode. At the same time, the loss based on the mathematical model of ship motion and the loss based on water traffic collision avoidance rules are introduced into the loss function;

[0134] A model training module, used to train the physical neural network model based on the data set;

[0135] The reconstruction module is used to obtain the water traffic accident report to be reconstructed and reconstruct the trajectory of the ship involved in the water traffic accident.

[0136] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement and improvement made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A method for reconstructing ship trajectories in water traffic accidents based on physical neural networks, characterized in that: The steps include: (1) Build an improved BERT-Base-Chinese model, extract historical water traffic accident report information, and combine it with the mathematical model of ship motion to obtain a data set; (2) Construct a physical neural network model, use the Diffusion-TS model as the basic framework to reconstruct the trajectory of ships involved in water traffic accidents, and change its Transformer encoder part to a dual encoder interaction mode. At the same time, introduce the loss based on the mathematical model of ship motion and the loss based on water traffic collision avoidance rules into the loss function. (3) Based on the data set, training the physical neural network model; (4) Obtain the water traffic accident report to be reconstructed and reconstruct the trajectory of the ship involved in the water traffic accident.

2. The method for reconstructing ship trajectories in water traffic accidents based on physical neural networks according to claim 1 is characterized in that: The improved BERT-Base-Chinese model is a method of partially updating the high-dimensional parameter matrix of the BERT-Base-Chinese model using the LoRA technology to obtain a new fine-tuned parameter matrix W: W=W0+△W=W0+BA in: represents the initial parameter matrix; Represents the offset of the model parameter matrix during the LoRA fine-tuning process. LoRA fine-tuning uses low-rank decomposition technology to decompose the offset matrix △W into the product of two smaller dimensional matrices B and A. And r< <min(m,n)。 3. The method for reconstructing ship trajectories in water traffic accidents based on physical neural networks according to claim 1 is characterized in that: The step (1) is specifically: (1.1) Obtain historical water traffic accident reports and extract information based on the trained improved BERT-Base-Chinese model; (1.2) Based on the extracted information, the corresponding accident scenario is constructed in the Unity environment, and trajectory data consistent with the accident report is generated based on the mathematical model of ship motion; (1.3) For accident types with relatively few historical reports of water traffic accidents, the trajectory of such accidents is simulated and constructed in the Unity environment based on the mathematical model of ship motion, and multiple trajectory data of similar accidents are synthesized by adjusting parameters; (1.4) The trajectory data based on steps (1.2) and (1.3) together constitute the data set.

4. The method for reconstructing ship trajectories in water traffic accidents based on physical neural networks according to claim 1, characterized in that: The encoder part of the Diffusion-TS model uses two independent encoders to encode the two ship trajectories with interactive relationships respectively, and then extracts their respective features through two independent fully connected layers, and concatenates the extracted feature vectors as the final output of the encoder: in: is the concatenated feature vector output by the encoder part of the Diffusion-TS model; concat(·) is the vector concatenation function, W i and b i are the weights and biases of two independent fully connected layers, and They are the outputs of the two ship trajectories after passing through the original encoder.

5. The method for reconstructing ship trajectories in water traffic accidents based on physical neural networks according to claim 1, characterized in that: The loss function of the physical neural network model is: L train =L trajectory +l ship L ship +l rule L rule Where: L trajectory is the original trajectory error loss function, L ship is the loss function of the mathematical model of ship motion, L rule is the loss function of the water traffic collision avoidance rule; is the target trajectory data, is the output trajectory data predicted by the model, which contains n accident trajectory data samples. Each trajectory data contains m time points, and each time point contains d-dimensional trajectory data. is the initial condition of the trajectory data predicted by the model at the initial moment; MMG(·) is the calculation function of the mathematical model of ship motion, L1(·) is the mean absolute error loss function, and the function Rule(·) is the calculation function of the water traffic collision avoidance rules, which is used to determine whether the collision avoidance action in the accident trajectory complies with the collision avoidance rules under the corresponding encounter form, thereby generating the compliance matrix Rule(Y)∈{0,1} n×m and The compliance labels of the collision avoidance actions corresponding to the target trajectory and the predicted trajectory, respectively, where 0 indicates compliance and 1 indicates non-compliance; BCE(·) is the binary cross entropy loss function.

6. The method for reconstructing ship trajectories in water traffic accidents based on physical neural networks according to claim 5 is characterized in that: The ship motion mathematical model adopts the MMG ship motion mathematical model: Where: X I and Y I are the components of the fluid inertia force acting on the bare hull along the Gx and Gy directions respectively; N I is the fluid inertia moment acting on the bare hull; X H and Y H are the components of the fluid viscosity force acting on the bare hull along the Gx and Gy directions respectively; N H is the fluid viscous moment acting on the bare hull; X P and Y P are the components of the fluid dynamics acting on the open water propeller along the Gx and Gy directions respectively; N P is the fluid dynamic moment acting on the open water propeller; X R and Y R are the components of the fluid dynamics acting on the open water rudder along the Gx and Gy directions respectively; N R is the fluid dynamic moment acting on the open water rudder.

7. The method for reconstructing ship trajectories in water traffic accidents based on physical neural networks according to claim 5 is characterized in that: The water traffic collision avoidance rules refer to calculating the collision risk using the closest approach distance and the closest approach time when two ships meet; CRI=0.6×f(DCPA)+0.4×f(TCPA),CRI∈[0,1] Where: DCPA is the closest approach distance, TCPA is the closest approach time, and CRI is the collision risk; When the CRI is greater than the threshold, it is considered that there is a collision risk at the current trajectory point. According to the International Regulations for Preventing Collisions at Sea, the calculation function of the water traffic collision avoidance rules is obtained. If the rules are met, the output is 0, and if the rules are not met, the output is 1.

8. A device for reconstructing ship trajectories in water traffic accidents based on physical neural networks, characterized in that: include: The collection module is used to collect historical water traffic accident reports, build an improved BERT-Base-Chinese model, extract historical water traffic accident report information, and combine it with the ship motion mathematical model to obtain a data set; The model building module is used to build a physical neural network model, which uses the Diffusion-TS model as the basic framework to reconstruct the trajectory of ships in water traffic accidents, and changes its Transformer encoder part to a dual encoder interaction mode. At the same time, the loss based on the mathematical model of ship motion and the loss based on water traffic collision avoidance rules are introduced into the loss function; A model training module, used to train the physical neural network model based on the data set; The reconstruction module is used to obtain the water traffic accident report to be reconstructed and reconstruct the trajectory of the ship involved in the water traffic accident.