A ship-bridge active anti-collision early warning method and system based on space-time trajectory prediction and anomaly detection

By combining a trajectory prediction model based on multi-head attention mechanism and long short-term memory network, along with an enhanced autoencoder and dynamic time warping algorithm, the problems of high resource consumption and insufficient information in the monitoring of ship navigation in inland river bridge areas are solved, and high-precision ship-bridge collision avoidance early warning is achieved.

CN122392355APending Publication Date: 2026-07-14WUHAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610554818.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-24
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing technologies for monitoring vessel navigation in inland waterway bridge areas suffer from problems such as high resource consumption, poor real-time performance, incomplete information acquisition, and insufficient model adaptability, making it difficult to effectively prevent ship-bridge collisions.

Method used

A bridge collision avoidance early warning system is constructed by employing a multi-head attention mechanism based on AIS data and a trajectory prediction model using a long short-term memory network, combined with an enhanced autoencoder and a dynamic time warping algorithm for unsupervised anomaly detection.

Benefits of technology

It achieves high-precision prediction and anomaly detection of vessel trajectories in inland waterway bridge areas, reduces the risk of ship-bridge collisions, provides real-time collision avoidance early warning capabilities, and adapts to complex aquatic environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122392355A_ABST
    Figure CN122392355A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of ship-bridge active collision avoidance early warning, and discloses a ship-bridge active collision avoidance early warning method based on space-time trajectory prediction and anomaly detection. The application designs an enhanced auto-encoder structure containing a space encoder and a dynamic behavior encoder, which can effectively extract potential feature expressions of trajectories. In combination with a dynamic time warping (DTW) distance and a time series clustering algorithm, unsupervised detection and classification of abnormal trajectories are realized. In addition, a high-risk abnormal trajectory dataset in a real bridge area navigation scene is constructed based on an NT-PRO5000 full-task ship maneuvering simulator, further enhancing the generalization ability and early warning practicality of the model. Experimental results show that the proposed method has high accuracy and stability in trajectory prediction and anomaly detection tasks, and can realize real-time identification and active early warning of ship-bridge collision risks, providing effective technical support for intelligent navigation and risk management of inland waterway ships.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of active collision avoidance and early warning technology for ship bridges, and particularly relates to an active collision avoidance and early warning method and system for ship bridges based on spatiotemporal trajectory prediction and anomaly detection. Background Technology

[0002] Collision avoidance between ships and bridges has always been a core research topic in maritime science and navigation safety. Since the 1970s, this topic has received widespread attention from maritime researchers worldwide. To achieve dynamic monitoring of vessels in bridge-adjacent waters, identify potential collision risks in advance, and provide real-time warnings of emergencies, various monitoring and safety early warning technologies have emerged. Vessel Traffic Services (VTS) employs technologies such as traffic situational awareness, analysis, and monitoring to effectively monitor vessel movement, greatly reducing the probability of traffic accidents. However, the inland waterway navigation environment is more complex than that of open sea waters, including coastal structures, bridges across rivers, and navigation aids within the waterway, posing significant challenges to safe vessel navigation.

[0003] Acquiring and analyzing vessel navigation information is crucial for preventing collisions. Currently, various surveillance methods, including patrol boats, synthetic aperture radar (SAR), closed-circuit television (CCTV), maritime radar, and automatic identification systems (AIS), are widely used to acquire vessel navigation information. While patrol boats provide the most direct vessel navigation information, they require significant manpower and financial resources from maritime authorities. SAR images are unaffected by weather conditions and can operate continuously day and night, but their significant time lag makes them unsuitable for real-time monitoring of inland waterway traffic. CCTV provides richer visual information about vessels compared to SAR, allowing for a more intuitive understanding of traffic conditions on the water, but it cannot acquire spatial information or other intrinsic attributes such as vessel dimensions, speed, and heading. AIS is a surveillance system that autonomously reports both dynamic and static vessel information, providing both simultaneously. According to the International Maritime Organization's Convention for the Safety of Life at Sea (SOLAS), all international vessels of 300 gross tons and above, as well as all passenger ships, are required to install AIS (Air Traffic Control System) equipment. With its advantages of high practicality, high automation, and easy access, AIS provides valuable information for ship navigation.

[0004] When ships navigate through bridge-adjacent waterways, collisions can cause damage to both the vessel and the bridge, or even result in shipwreck and loss of life. Therefore, to avoid or minimize the damage caused by ship-bridge collisions, many scholars have proposed various probabilistic models to quantify the probability of such events. Representative models include those from the Association of State Highway and Transportation Officials (AASHTO), European standard models, and the Kunz model. While these models are largely based on statistical or physical modeling methods and possess some applicability, they still require adaptation and optimization using actual navigation data and machine learning methods in scenarios involving variable flow fields, complex navigation behaviors, and sensors in inland waterway bridge areas.

[0005] As early as the last century, numerous researchers began systematically studying ship-bridge collision behavior, proposing a series of theoretical models and subsequently designing various pier protection structures and facilities. Many transportation authorities have explicitly required effective collision protection measures for important bridges, especially large piers, which can be mainly divided into passive and active methods. Currently common passive collision protection methods mainly include constructing artificial islands and pier structures, placing bridges in locations difficult for ships to approach, building independent protective structures, and adding buffer energy-absorbing devices at pier locations. In summary, passive bridge collision protection methods are diverse, and their core lies in mitigating the impact of ship collisions with bridges and isolating and protecting the bridge structure through structural layout, material selection, and energy dissipation mechanisms. These measures have good adaptability and engineering application prospects in complex navigation environments.

[0006] However, passive collision avoidance measures primarily mitigate the consequences of impacts and reduce damage to bridges or ship hulls, but they cannot fundamentally reduce or prevent collisions. In contrast, active collision avoidance methods effectively reduce the probability of ship-bridge collisions and other ship-collision events by detecting and identifying potentially impact-risk vessels in advance and issuing warnings. In data mining and modeling-based research, trajectory prediction and abnormal trajectory detection are core components for improving the predictive capabilities of active collision avoidance systems. Regarding ship trajectory prediction, early prediction models mainly relied on ship kinematic equations, such as Kalman filtering, particle filtering, and Markov chains. These models, based on physical modeling principles, fully consider ship maneuvering parameters and dead reckoning theory to accurately predict the future motion of the ship. However, ship trajectory prediction methods based on ship dynamics equations are only suitable for short-term prediction tasks. In scenarios lacking continuous observation data or requiring long-term predictions, these methods have significant limitations.

[0007] Ships are subject to numerous uncertainties during actual navigation, such as wind and currents. Furthermore, inland waterways typically contain numerous navigation aids, bridges, and crossing vessels, increasing the difficulty of ship trajectory prediction. Recurrent Neural Networks (RNNs), due to their powerful ability to process sequential information and predict information over longer periods, have been widely developed and successfully applied in fields such as speech recognition and text processing. To stably predict ship trajectories over long periods, researchers have begun to introduce RNNs into ship trajectory prediction modeling. The RNN structure can recursively model the dynamic changes in the time dimension using historical states, making it particularly suitable for modeling the continuous motion state of ships. Building upon this, excellent recurrent structures such as Long Short-Term Memory Networks (LSTM) and Gated Recurrent Units (GRUs) further alleviate the gradient vanishing and exponential explosion problems inherent in traditional RNNs for long-sequence prediction, significantly improving the model's ability to predict long-term dependent trajectories. The above research provides valuable insights for the research of the ship collision warning method of this invention.

[0008] Furthermore, anomaly trajectory detection, as a key means to assist in risk identification and early warning, has received widespread attention in recent years. Anomaly identification methods based on clustering analysis are suitable for trajectory segmentation and anomaly detection in unsupervised scenarios. Representative methods, such as the Density-Based Spatial Clustering of Applications with Noise (DBSCAN) algorithm and its improved models, have performed well in multiple application areas. Statistical modeling-based methods focus on constructing probability distribution models of normal trajectories and using them to identify deviation behaviors, such as kernel density estimation and nonparametric Bayesian models. Research based on neural networks fully utilizes the strong modeling capabilities of deep learning models for complex trajectory time-series data; in particular, the introduction of LSTM, GRU, and attention mechanisms has significantly improved detection accuracy. In addition, research based on traditional machine learning has also been widely applied; for example, Kalman filtering, support vector machines, and autoregressive models still have practical engineering value in trajectory modeling and prediction. Although existing methods have achieved certain results in terms of accuracy, real-time performance, and adaptability, problems such as strong sample dependence, ambiguous definitions of anomaly trajectories, and poor model generalization ability still exist. Especially when facing multi-ship interactions, complex environments, and unknown target behavior patterns, existing methods still face challenges. Therefore, introducing efficient trajectory spatiotemporal feature learning mechanisms and improving the model's adaptability to dynamic environments, and deeply integrating trajectory modeling with anomaly recognition, has become an important trend in building active collision avoidance systems between bridges and ships, and will be a key research direction in the future.

[0009] Based on the above analysis, the problems and shortcomings of the existing technology are as follows:

[0010] While patrol boats provide the most direct information on vessel navigation, they require significant manpower and financial resources from maritime authorities. SAR imagery is unaffected by weather conditions and can operate continuously day and night, but its significant time lag makes it unsuitable for real-time monitoring of inland waterway traffic. CCTV offers richer visual information about vessels compared to SAR, providing a more intuitive understanding of traffic conditions on the water, but it cannot acquire information about the spatial state and other attributes of vessels, such as dimensions, speed, and heading. Summary of the Invention

[0011] To address the problems existing in the prior art, this invention provides an active collision avoidance and early warning method for ship bridges based on spatiotemporal trajectory prediction and anomaly detection.

[0012] This invention is implemented as follows: A ship-bridge active collision avoidance and early warning method based on spatiotemporal trajectory prediction and anomaly detection includes:

[0013] Step 1: Obtain data from the automatic identification system;

[0014] Step 2: Input the acquired automatic recognition system data into the trajectory prediction model to obtain the predicted trajectory. The trajectory prediction model integrates multi-head attention mechanism and long short-term memory network.

[0015] Step 3: Extract latent trajectory features for the predicted trajectory by combining spatial feature encoding and dynamic feature encoding through an enhanced autoencoder network;

[0016] Step 4: Use dynamic time warping algorithm and time series clustering to perform unsupervised anomaly detection and classification on potential trajectory features, and output ship-bridge collision avoidance warning information based on the classification results.

[0017] Furthermore, the trajectory prediction model, based on the current longitude, latitude, speed to ground, and heading to ground, combined with historical navigation behavior data, calculates the ship's navigation behavior at future moments through a nonlinear mapping function.

[0018] Mathematical model for ship trajectory prediction:

[0019] Suppose a set of AIS data is a time series at certain time intervals. Then the ship at time navigation behavior It can be represented as:

[0020] (1)

[0021] (2)

[0022] in: , , and The ship was at the time of The longitude, latitude, speed over ground (SOG), and course over ground (COG) of the vessel; generally speaking, the vessel's navigation behavior at future moments. Current behavior With historical behavior The result of their combined effects is that their mathematical model can be expressed as:

[0023] (3)

[0024] In equation (3), It is a non-linear mapping function.

[0025] Furthermore, the computational process of Long Short-Term Memory (LSTM) networks includes:

[0026] The input gate receives the current state of the network input unit and the hidden state of the previous time step, and calculates the amount of input information at the current time step.

[0027] The forget gate receives the current network input cell state and the hidden state from the previous time step, and determines the amount of cell state information from the previous time step to be retained in the current cell state.

[0028] The output gate receives the current network input cell state and the hidden layer state of the previous time step, calculates the cell state information output at the current time step;

[0029] The current cell state is formed by multiplying the output of the forget gate by the cell state of the previous time step element by element, plus the output of the input gate by the cell state of the current input step element by element.

[0030] The final output of the network is obtained by element-wise multiplying the output of the output gate with the current cell state after processing by the activation function;

[0031] All the above gating and cell state calculations are completed based on the corresponding weight matrix, bias term, activation function and vector inner product operation;

[0032] Long Short-Term Memory Network Structure:

[0033] Let the network input be The hidden state is The transmission of information between network units can then be represented as:

[0034] (4)

[0035] (5)

[0036] (6)

[0037] (7)

[0038] (8)

[0039] (9)

[0040] Among them, the input gate The current cell state; forget gate It is mainly used to retain the cell state information from the previous time step. Current cell state Information content; output gate This determines the output of the cell's state information at the current moment; For the final output of the network, This represents the current input cell state. This represents the current state of the cell. , , , These are the weight matrices for the three gates and the unit states, respectively; , , , For the corresponding bias term; For the sigmoid function, For activation function, For vector dot product, This indicates element-wise multiplication.

[0041] Furthermore, the computational process of the multi-head attention mechanism includes:

[0042] For the input feature sequence, a linear transformation is performed to generate the query matrix, key matrix, and value matrix corresponding to each attention head;

[0043] After performing a dot product operation on the query matrix and the key matrix, the result is scaled by dividing by the square root of the number of attention heads, and then processed by a normalized exponential function to obtain the weight matrix of each attention head.

[0044] Multiplying the weight matrix by the value matrix yields the output of each attention head;

[0045] The outputs of all attention points are concatenated and then subjected to a linear transformation with learnable weight parameters for dimensionality reduction, resulting in output sequences with different degrees of attention.

[0046] By introducing a multi-head attention mechanism into the LSTM model, the ability of the model to express information at different time steps is improved through parallel computation.

[0047] The multi-head attention mechanism achieves multi-dimensional learning of the input sequence through parallel computing. Each attention head independently focuses on different subspaces of the input sequence, and a weight allocation mechanism is used to enable the model to integrate multi-view information.

[0048] In an n-head attention structure, for the input feature sequence First, a linear transformation is performed to generate the corresponding head for each ( )Query( ), Key( ) and Value( ), and then through The function is normalized and subjected to dot product operation to obtain each weight matrix Finally, all of them By concatenating the sequences and performing a learnable linear transformation for dimensionality reduction, output sequences with different levels of interest can be obtained. The specific calculations are as follows:

[0049] (10)

[0050] (11)

[0051] (12)

[0052] in, , and Each head The weight matrix in the linear transformation process. To focus on the number of heads, Scaling is performed in a manner that ensures the stability of the weights. For splicing operations, The weights in the dimensionality reduction operation are denoted by [symbol]. This represents matrix multiplication.

[0053] Another objective of this invention is to provide a model training method for an active collision avoidance and early warning method for ship bridges based on spatiotemporal trajectory prediction and anomaly detection, comprising:

[0054] The abnormal navigation patterns in the bridge area were simulated using a full-mission ship handling simulator to generate abnormal trajectory data.

[0055] The automatic identification system data and abnormal trajectory data are combined to construct a sample set for training;

[0056] The trajectory prediction model is trained based on massive amounts of real ship automatic identification system data, and the hyperparameters of the trajectory prediction model are fine-tuned using a collaborative optimization strategy.

[0057] An enhanced autoencoder network is trained using anomalous trajectory data, enabling it to combine spatial and dynamic feature encoding to extract latent trajectory features.

[0058] Furthermore, a collaborative optimization strategy is adopted to fine-tune the hyperparameters of the trajectory prediction model, including automatically adjusting the number of hidden layer nodes and the learning rate parameter in the long short-term memory network based on prediction error feedback.

[0059] Another objective of this invention is to provide a ship-bridge active collision avoidance and early warning system based on spatiotemporal trajectory prediction and anomaly detection, comprising:

[0060] The data acquisition module is used to acquire data from the automatic identification system;

[0061] The trajectory prediction module is used to input the acquired automatic recognition system data into the trajectory prediction model to obtain the predicted trajectory. The trajectory prediction model integrates multi-head attention mechanism and long short-term memory network.

[0062] The feature extraction module is used to extract latent trajectory features for the predicted trajectory by combining spatial feature coding and dynamic feature coding through an enhanced autoencoder network.

[0063] The anomaly detection and early warning module is used to perform unsupervised anomaly detection and classification on potential trajectory features using dynamic time warping algorithm and time series clustering, and outputs ship-bridge collision avoidance early warning information based on the classification results.

[0064] Furthermore, the trajectory prediction model in the trajectory prediction module calculates the ship's future navigation behavior based on the current longitude, latitude, speed to ground, and heading to ground, combined with historical navigation behavior data, through a nonlinear mapping function.

[0065] Furthermore, the current cell state in the Long Short-Term Memory network is formed by multiplying the output of the forget gate by the cell state of the previous time step, plus the output of the input gate by the cell state of the current input step; the final output of the network is obtained by multiplying the output of the output gate by the cell state of the current time step after processing by the activation function.

[0066] Furthermore, the multi-head attention mechanism performs a dot product operation on the query matrix and key matrix of each attention head, scales it by the square root of the number of attention heads, and then processes it through a normalized exponential function to obtain a weight matrix. The outputs of each attention head, obtained by multiplying the weight matrix and the value matrix, are then concatenated and dimensionality reduced to obtain the output sequence.

[0067] Based on the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solution to be protected by this invention are as follows:

[0068] This invention proposes an active collision avoidance and early warning method for bridges based on spatiotemporal trajectory prediction and anomaly detection. First, a trajectory prediction model integrating multi-head attention and a Long Short-Term Memory (LSTM) network is constructed based on Automatic Identification System (AIS) data. A collaborative optimization strategy is employed to fine-tune the model's hyperparameters, significantly improving its predictive performance for complex spatiotemporal sequences. Second, to address the challenge of identifying abnormal ship trajectories, an enhanced autoencoder network is designed, combining spatial feature encoding with dynamic feature encoding to more effectively extract latent trajectory features. Simultaneously, dynamic time warping (DTW) and time series clustering are combined to achieve unsupervised anomaly detection and classification. Finally, a full-mission ship maneuvering simulator is used to simulate typical abnormal navigation patterns in bridge area waters, generating high-quality abnormal trajectory data to improve the model's generalization and early warning capabilities. Experimental results demonstrate that the proposed early warning method achieves excellent performance in both trajectory prediction and anomaly detection. This provides a reliable and practical solution for intelligent ship navigation and proactive risk warning in complex bridge areas of inland waterways.

[0069] This invention addresses the high risk and regulatory challenges of ship-bridge collisions in complex inland waterway navigation environments, proposing an active collision avoidance and early warning method based on trajectory prediction and abnormal trajectory detection. This method integrates AIS data, deep learning, and unsupervised clustering techniques to construct a complete technical framework suitable for real-time dynamic monitoring and risk identification. Specifically, this invention constructs an LSTM trajectory prediction model incorporating a multi-head attention mechanism (MHA) and introduces a genetic algorithm and improved particle swarm optimization (GA-EPSO) to jointly optimize the network structure parameters, significantly improving the model's ability to model and predict complex spatiotemporal sequences. For abnormal trajectory identification, this invention designs an enhanced autoencoder structure including a spatial encoder and a dynamic behavior encoder, which can effectively extract latent feature representations of the trajectory. Combining dynamic time warping (DTW) distance and temporal clustering algorithms, unsupervised detection and classification of abnormal trajectories are achieved. Furthermore, a high-risk abnormal trajectory dataset under real bridge navigation scenarios is constructed using the NT-PRO5000 full-mission ship maneuvering simulator, further enhancing the model's generalization ability and early warning practicality. Experimental results show that the proposed method exhibits high accuracy and stability in both trajectory prediction and anomaly detection tasks, enabling real-time identification and proactive early warning of ship-bridge collision risks, and providing effective technical support for intelligent navigation and risk management of vessels in inland waterways.

[0070] (1) The expected benefits and commercial value of the technical solution of this invention after transformation are as follows:

[0071] This invention is expected to have high economic benefits and commercial value, and has broad market prospects for application in enterprises and government maritime departments, as specifically shown below:

[0072] (a) Reducing accident costs and improving safety benefits: Ship-bridge collisions often lead to huge losses of life and property, waterway paralysis, and bridge repair costs. This invention, through high-precision spatiotemporal trajectory prediction and active collision avoidance early warning, can significantly reduce the incidence of ship-bridge collision accidents, saving shipping companies human and financial resources and reducing maintenance costs for bridge management departments.

[0073] (b) Commercialization of integrated software and hardware products: This invention can be transformed into an intelligent traffic monitoring and early warning system for bridge-area waterways. Its application in maritime bureaus, waterway bureaus, and large inland waterway shipping companies, either through software licensing or integrated software and hardware solutions, will yield significant direct economic benefits.

[0074] (c) Empowering the Smart Shipping Industry: With the development of unmanned vessels and smart shipping, high-precision trajectory prediction and anomaly detection are indispensable core modules. This invention can be licensed as a core algorithm to ship manufacturers and autonomous driving system suppliers, possessing extremely high value in empowering industrial upgrading. Attached Figure Description

[0075] Figure 1 This is a flowchart of the active collision avoidance and early warning method for ship-bridge based on spatiotemporal trajectory prediction and anomaly detection provided in an embodiment of the present invention.

[0076] Figure 2 This is a structural block diagram of a ship-bridge active collision avoidance and early warning system based on spatiotemporal trajectory prediction and anomaly detection provided in an embodiment of the present invention.

[0077] Figure 3 This is a framework diagram of real-time early warning for ship-bridge collision avoidance provided in an embodiment of the present invention.

[0078] Figure 4 This is a diagram of the LSTM network structure provided in an embodiment of the present invention.

[0079] Figure 5 This is a diagram of the multi-head attention mechanism provided in an embodiment of the present invention.

[0080] Figure 6 This is a flowchart of the GPA-LSTM trajectory prediction model provided in an embodiment of the present invention.

[0081] Figure 7 This is a map showing the distribution of the research area and historical ship trajectories provided in an embodiment of the present invention.

[0082] Figure 8 The present invention provides an analysis of the navigation characteristics of vessels in the research waters; (a) navigation characteristics of vessels traveling upstream; (b) navigation characteristics of vessels traveling downstream.

[0083] Figure 9 The following is a comparison of the importance of input features of trajectory prediction models based on SHAP analysis provided in the embodiments of the present invention: (a) LSTM model; (b) MHA combined with LSTM model.

[0084] Figure 10 These are fitness function change curves provided in the embodiments of the present invention; (a) Upward trajectory dataset (b) Downward trajectory dataset.

[0085] Figure 11 These are the loss function variation curves of the model training and validation sets provided in this embodiment of the invention; (a) uplink trajectory dataset, (b) downlink trajectory dataset.

[0086] Figure 12 These are the ship trajectory prediction results and distance error diagrams provided in the embodiments of the present invention; (a) SVM, (b) RNN, (c) LSTM, (d) GRU, (e) GPA-LSTM, (f) distance error.

[0087] Figure 13These are the ship trajectory prediction results and distance error diagrams provided in the embodiments of the present invention; (a) SVM, (b) RNN, (c) LSTM, (d) GRU, (e) GPA-LSTM, (f) distance error.

[0088] Figure 14 These are the ship trajectory prediction results and distance error diagrams provided in the embodiments of the present invention; (a) SVM, (b) RNN, (c) LSTM, (d) GRU, (e) GPA-LSTM, (f) distance error.

[0089] Figure 15 These are the ship trajectory prediction results and distance error diagrams provided in the embodiments of the present invention; (a) SVM, (b) RNN, (c) LSTM, (d) GRU, (e) GPA-LSTM, (f) distance error.

[0090] Figure 16 These are the research water area and real-scene modeling diagrams provided in the embodiments of the present invention; (a) bridge in real condition (b) NT-PRO5000 simulator real-scene modeling.

[0091] Figure 17 These are the representative ship types for the simulation experiment provided in the embodiments of the present invention; (a) a representative ship type of 10,000 tons and (b) a representative ship type of 5,000 tons.

[0092] Figure 18 These are diagrams of abnormal navigation patterns of ships in bridge area waters based on full-task simulator simulation provided in this embodiment of the invention; (a) Abnormal navigation pattern 1; (b) Abnormal navigation pattern 2; (c) Abnormal navigation pattern 3.

[0093] Figure 19 This is a diagram of the autoencoder network structure provided in an embodiment of the present invention.

[0094] Figure 20 This is a visualization of the trajectory clustering results provided in an embodiment of the present invention.

[0095] Figure 21 These are examples of ship-bridge collision avoidance early warning provided in this embodiment of the invention; (a) normal ship trajectory; (b) abnormal ship trajectory. Detailed Implementation

[0096] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0097] like Figure 1 As shown, the active collision avoidance and early warning method for ship bridges based on spatiotemporal trajectory prediction and anomaly detection provided by this embodiment of the invention includes the following steps:

[0098] S101, Obtain data from the automatic identification system;

[0099] S102, The acquired automatic recognition system data is input into the trajectory prediction model to obtain the predicted trajectory. The trajectory prediction model integrates multi-head attention mechanism and long short-term memory network.

[0100] S103 extracts latent trajectory features for the predicted trajectory by combining spatial feature coding and dynamic feature coding through an enhanced autoencoder network.

[0101] S104 utilizes dynamic time warping algorithm and time series clustering to perform unsupervised anomaly detection and classification of potential trajectory features, and outputs bridge collision avoidance warning information based on the classification results.

[0102] The trajectory prediction model provided in this embodiment of the invention is based on the current longitude, latitude, speed to ground, and heading to ground, combined with historical navigation behavior data, and calculates the ship's navigation behavior at future times through a nonlinear mapping function.

[0103] The computation process of the Long Short-Term Memory (LSTM) network provided in this embodiment of the invention includes:

[0104] The input gate receives the current state of the network input unit and the hidden state of the previous time step, and calculates the amount of input information at the current time step.

[0105] The forget gate receives the current network input cell state and the hidden state from the previous time step, and determines the amount of cell state information from the previous time step to be retained in the current cell state.

[0106] The output gate receives the current network input cell state and the hidden layer state of the previous time step, calculates the cell state information output at the current time step;

[0107] The current cell state is formed by multiplying the output of the forget gate by the cell state of the previous time step element by element, plus the output of the input gate by the cell state of the current input step element by element.

[0108] The final output of the network is obtained by element-wise multiplying the output of the output gate with the current cell state after processing by the activation function;

[0109] All the above gating and cell state calculations are based on the corresponding weight matrix, bias term, activation function and vector inner product operation.

[0110] The calculation process of the multi-head attention mechanism provided in this embodiment of the invention includes:

[0111] For the input feature sequence, a linear transformation is performed to generate the query matrix, key matrix, and value matrix corresponding to each attention head;

[0112] After performing a dot product operation on the query matrix and the key matrix, the result is scaled by dividing by the square root of the number of attention heads, and then processed by a normalized exponential function to obtain the weight matrix of each attention head.

[0113] Multiplying the weight matrix by the value matrix yields the output of each attention head;

[0114] The outputs of all attention points are concatenated and then subjected to a linear transformation with learnable weight parameters for dimensionality reduction, resulting in output sequences with different levels of attention.

[0115] An embodiment of the present invention provides a model training method, comprising:

[0116] The abnormal navigation patterns in the bridge area were simulated using a full-mission ship handling simulator to generate abnormal trajectory data.

[0117] The automatic identification system data and abnormal trajectory data are combined to construct a sample set for training;

[0118] The trajectory prediction model is trained based on massive amounts of real ship automatic identification system data, and the hyperparameters of the trajectory prediction model are fine-tuned using a collaborative optimization strategy.

[0119] An enhanced autoencoder network is trained using anomalous trajectory data, enabling it to combine spatial and dynamic feature encoding to extract latent trajectory features.

[0120] The embodiment of the present invention provides a collaborative optimization strategy for fine-tuning the hyperparameters of a trajectory prediction model, including automatically adjusting the number of hidden layer nodes and the learning rate parameter in the long short-term memory network based on prediction error feedback.

[0121] An embodiment of the present invention provides a method for active collision avoidance and early warning of ship bridges based on spatiotemporal trajectory prediction and anomaly detection, comprising the following steps:

[0122] A trajectory prediction model integrating multi-head attention mechanism and long short-term memory network is constructed based on data from an automatic recognition system; and a collaborative optimization strategy is used to fine-tune the hyperparameters of the model.

[0123] By combining spatial feature encoding with dynamic feature encoding through an enhanced autoencoder network, latent trajectory features are extracted; at the same time, dynamic time warping and time series clustering are combined to achieve unsupervised anomaly detection and classification.

[0124] The full-mission ship handling simulator was used to simulate typical abnormal navigation patterns in the bridge area waters, generating high-quality abnormal trajectory data.

[0125] like Figure 2 As shown in the figure, an active collision avoidance and early warning system for ship bridges based on spatiotemporal trajectory prediction and anomaly detection provided by an embodiment of the present invention includes:

[0126] The data acquisition module is used to acquire data from the automatic identification system;

[0127] The trajectory prediction module is used to input the acquired automatic recognition system data into the trajectory prediction model to obtain the predicted trajectory. The trajectory prediction model integrates multi-head attention mechanism and long short-term memory network.

[0128] The feature extraction module is used to extract latent trajectory features for the predicted trajectory by combining spatial feature coding and dynamic feature coding through an enhanced autoencoder network.

[0129] The anomaly detection and early warning module is used to perform unsupervised anomaly detection and classification on potential trajectory features using dynamic time warping algorithm and time series clustering, and outputs ship-bridge collision avoidance early warning information based on the classification results.

[0130] The trajectory prediction model in the trajectory prediction module provided in this embodiment of the invention is based on the current longitude, latitude, speed to ground, and heading to ground, combined with historical navigation behavior data, and calculates the ship's navigation behavior at future times through a nonlinear mapping function.

[0131] In the Long Short-Term Memory network provided in this embodiment of the invention, the current cell state is formed by multiplying the output of the forget gate by the cell state of the previous time step element by element, plus the output of the input gate by the cell state of the current input step element by element; the final output of the network is obtained by multiplying the output of the output gate by the cell state of the current time step after the activation function.

[0132] The multi-head attention mechanism provided in this embodiment of the invention performs a dot product operation on the query matrix and key matrix of each attention head, scales it by the square root of the number of attention heads, and then processes it with a normalized exponential function to obtain a weight matrix. The outputs of each attention head based on the multiplication of the weight matrix and the value matrix are then concatenated and dimensionality reduced to obtain the output sequence.

[0133] The system provided in this invention first utilizes a full-mission ship maneuvering simulator to simulate typical abnormal navigation patterns in bridge-area waters (such as uncontrolled drifting and yaw approaching bridge piers), generating high-quality labeled abnormal trajectories in batches to compensate for the scarcity of abnormal samples in real AIS data. Based on this, a trajectory prediction model integrating a multi-head attention mechanism and a long short-term memory network is constructed: LSTM captures the temporal dependencies of ship motion, while multi-head attention extracts the correlation weights of different time steps and multiple feature dimensions (heading, speed, turning rate) in parallel. A collaborative optimization strategy is employed to jointly fine-tune the model's hyperparameters (number of layers, number of attention heads, learning rate, etc.), avoiding local optima caused by isolated parameter tuning and significantly improving prediction accuracy and generalization ability.

[0134] The predicted trajectory is input into an enhanced autoencoder network, which simultaneously performs spatial feature encoding (trajectory geometry, distance to pier) and dynamic feature encoding (speed change rate, heading angle variance, acceleration spectrum). The resulting fusion forms a compact latent trajectory feature vector, achieving dimensionality reduction and noise reduction. Subsequently, within the latent feature space, the similarity distance between the current trajectory and historical normal trajectory clusters is calculated using a Dynamic Time Warping (DTW) algorithm, which is insensitive to trajectory length and speed differences. Then, combined with time series clustering (such as hierarchical clustering or DBSCAN), the trajectory is automatically classified into categories such as "normal," "generally abnormal," and "high-risk abnormal." This unsupervised process requires no manual labeling and can adaptively discover unknown abnormal patterns.

[0135] Based on the clustering classification results, the system outputs tiered early warnings according to preset thresholds: general anomalies push attention prompts to the VTS system, while high-risk anomalies trigger shipboard / shore-based audible and visual alarms and broadcast avoidance instructions and estimated collision times. The early warning information is simultaneously transmitted back to the model library for incremental updates to the cluster centers and autoencoder parameters, forming a closed loop of "detection-early warning-feedback-optimization." This method can be deployed on various entities: computer devices (processors executing stored programs), computer-readable storage media (fixed code), and information data processing terminals (independently connected to AIS data streams), achieving a technological leap from "post-event alarms" to "active collision avoidance." Specific implementation of this invention:

[0136] 1. Ship bridge anti-collision warning frame

[0137] like Figure 3 As shown, in order to achieve real-time monitoring of ship navigation status and ensure navigation safety, this invention proposes a reliable bridge collision avoidance early warning framework. This framework deeply integrates data mining, trajectory modeling, future state prediction, and abnormal trajectory detection technologies, aiming to assist maritime management departments in real-time assessment of ship navigation status and provide real-time early warnings for potential collision risks.

[0138] 2. The main contributions of this invention are summarized as follows:

[0139] (1) A reliable ship-bridge collision avoidance early warning framework combining spatiotemporal trajectory prediction and anomaly detection is proposed to provide active monitoring and decision support for safe navigation of ships in inland bridge areas.

[0140] (2) A GPA-LSTM trajectory prediction model was constructed. Based on the traditional LSTM network, the model introduces a multi-head attention (MHA) mechanism to enhance the model's ability to extract information at key moments, and adopts a collaborative optimization strategy to optimize it, which significantly improves the accuracy of long-term prediction.

[0141] (3) An abnormal trajectory detection model based on an enhanced autoencoder and a time-series clustering algorithm was designed. This model integrates spatial feature encoding and dynamic temporal encoding to extract latent trajectory representations. Combined with an adaptive temporal clustering algorithm, unsupervised abnormal trajectory detection was achieved.

[0142] (4) A series of abnormal ship trajectory datasets were generated using a full-mission ship maneuvering simulator, realistically reproducing high-risk navigation behavior in inland waterway bridge areas. This dataset provides strong support for the training and validation of anomaly detection models.

[0143] (5) Comprehensive experiments based on real AIS data and simulated scenarios show that the method proposed in this invention exhibits high accuracy and strong robustness in both trajectory prediction and anomaly detection, laying a practical application foundation for collision avoidance early warning in inland river bridge areas.

[0144] 3. Overview of relevant methods

[0145] 3.1 Mathematical Model for Ship Trajectory Prediction

[0146] AIS provides real-time information on ship navigation. Based on the ship's navigation status, the device broadcasts information at regular intervals and is widely used for collision avoidance, navigational situation monitoring, traffic flow prediction, and maritime accident investigation. In actual navigation, the ship's position directly reflects its motion trend, while its course and speed represent its actual physical navigation state. Changes in these states derive from changes in the ship's position and dynamic characteristics. Therefore, ship navigation behavior is mainly reflected in changes in characteristic variables such as position, course, and speed, exhibiting strong nonlinear characteristics.

[0147] Suppose a set of AIS data is a time series at certain time intervals. Then the ship at time navigation behavior It can be represented as:

[0148] (1)

[0149] (2)

[0150] in: , , and The ship was at the time of The longitude, latitude, speed over ground (SOG), and course over ground (COG) of the vessel. Generally, this refers to the vessel's navigation behavior at future moments. Current behavior With historical behavior The result of their combined effects is that their mathematical model can be expressed as:

[0151] (3)

[0152] In equation (3), It is a non-linear mapping function.

[0153] For example, in order to predict The ship's position within a time period, the present invention with Historical trajectories in the sequence are used as input features for the model, and predicted values ​​are output sequentially. .

[0154] 3.2 LSTM Model

[0155] LSTM alleviates the gradient vanishing and exploding problems inherent in the chain-like structure of traditional recurrent neural networks, effectively improving the learning ability of time-series data. It exhibits strong advantages in handling time series prediction and nonlinear mapping problems. LSTM uses a memory cell structure to store past information and adds three gate structures—input gate, output gate, and forget gate—to control the transmission of historical information. Its network structure is as follows: Figure 4 As shown.

[0156] Let the network input be The hidden state is The transmission of information between network units can then be represented as:

[0157] (4)

[0158] (5)

[0159] (6)

[0160] (7)

[0161] (8)

[0162] (9)

[0163] Among them, the input gate The current cell state; forget gate It is mainly used to retain the cell state information from the previous time step. Current cell state Information content; output gate This determines the output of the cell's state information at the current moment; For the final output of the network, This represents the current input cell state. This represents the current state of the cell. , , , These are the weight matrices for the three gates and the unit states, respectively; , , , For the corresponding bias term; For the sigmoid function, For activation function, For vector dot product, This indicates element-wise multiplication.

[0164] 3.3 Multi-head attention mechanism

[0165] The combination of attention mechanisms and traditional neural networks has been proven to focus on the essential features of the model and improve network performance. LSTM attempts to capture long-term dependencies in temporal information through gating units, but when processing long sequences, it may suffer from information loss or disrupted information flow. Attention mechanisms, through weight allocation, enable the model to focus on the importance of different parts of the information, thereby better capturing key information in the sequence and improving model performance and efficiency.

[0166] While self-attention mechanisms consider the correlation between overall information in the input sequence, they neglect the importance of positional information. In other words, when processing information at the current position, the model may overemphasize its own position, reducing its ability to extract effective information. To overcome this problem, this invention introduces multi-head attention (MHA) into the LSTM model, improving the model's ability to represent information at different time steps through parallel computation.

[0167] MHA achieves multi-dimensional learning of the input sequence through parallel computation. Each attention head independently focuses on different subspaces of the input sequence, and a weight allocation mechanism enables the model to integrate multi-perspective information, providing richer and more diverse data representations. Figure 5 As shown, in the n-head attention structure, for the input feature sequence First, a linear transformation is performed to generate the corresponding head for each ( )Query( ), Key( ) and Value( ), and then through The function is normalized and subjected to dot product operation to obtain each weight matrix Finally, all of them By concatenating the sequences and performing a learnable linear transformation for dimensionality reduction, output sequences with different levels of interest can be obtained. The specific calculations are as follows:

[0168] (10)

[0169] (11)

[0170] (12)

[0171] in, , and Each head The weight matrix in the linear transformation process. To focus on the number of heads, Scaling is performed in a manner that ensures the stability of the weights. For splicing operations, The weights in the dimensionality reduction operation are denoted by [symbol]. This represents matrix multiplication.

[0172] 3.4 GA-EPSO: A Collaborative Optimization Method

[0173] Although LSTM has been widely used in many fields, the selection of key hyperparameters in the model involves considerable randomness. Among these, the number of hidden layer neurons plays a decisive role in the model's nonlinear fitting ability, while the learning rate directly affects the model's convergence speed and computation time. These hyperparameters directly control the model's topology; that is, network models built with different hyperparameters exhibit significant differences in overall performance, directly impacting the model's overall prediction or classification performance. Therefore, choosing appropriate parameters is crucial for model building. To address this issue, this invention employs a collaborative heuristic algorithm to determine the key parameters of LSTM, overcoming the drawbacks of poor performance and high workload associated with manually setting network parameters.

[0174] 3.4.1 Genetic Algorithm

[0175] Genetic algorithm (GA) is a computer-simulated algorithm for biological research based on Darwin's theory of evolution. It was proposed by J. Holland et al. in 1975. Its core idea is to use chromosomes as the main carrier of population inheritance. Through various random operations such as gene selection, gene crossover, and gene mutation, a new set of solutions is continuously evolved. The optimal individuals in the population are retained based on their fitness and the value of the selection function, which is the optimal solution to the optimization problem in GA.

[0176] (1) Chromosome Encoding. The GA algorithm uses chromosome encoding for related calculations. If binary encoding is used, the chromosome length increases dramatically, leading to significant computational pressure. Therefore, in the experiment, real-number encoding is used to initialize the optimization object, and the range of the number of hidden layer neurons is... The learning rate range is .

[0177] (2) Selection, crossover and mutation operators

[0178] The selection operator selects individuals with good fitness from the current population as parents and passes their genetic information to offspring. This invention employs a tournament selection algorithm for optimal individual selection. This algorithm is characterized by high execution efficiency and ease of implementation. Its algorithm complexity is much lower than other selection strategies and it is easily parallelized. It is less prone to getting trapped in local optima during the selection process and does not require sorting the fitness values ​​of all individuals.

[0179] The crossover operator generates new offspring by averaging the number of hidden nodes and the learning rate of the parent individuals, ensuring that the offspring inherit intermediate characteristics from the parents and reducing widespread genetic mutations. During the mutation operation, if the randomly generated number is less than the given mutation rate, the learning rate and the number of hidden nodes are slightly adjusted randomly. The mutation rules are as follows:

[0180] (13)

[0181] (14)

[0182] in, and These represent the number of hidden neurons in the population and the learning rate, respectively.

[0183] 3.4.2 Enhanced Particle Swarm Optimization Algorithm

[0184] Particle swarm optimization (PSO) originated from research on avian social behavior. It achieves group evolution through mutual assistance and information sharing among individuals. Its core idea is: assuming a... In the 3D search space, by Each particle constitutes a population. ,in: ,but time The feature information can be represented as:

[0185] Location ,

[0186] speed ,

[0187] Individual optimal position ,

[0188] Global optimal position ,

[0189] Then the particle is in The rules for updating the speed and position information at any given time are as follows:

[0190] (15)

[0191] (16)

[0192] in: Inertial weights are used to adjust the effective balance between global and local searches of particles; and The step size is adjusted as a learning factor for the particle's movement towards itself and the globally optimal direction, respectively. and for Random numbers are uniformly distributed between the given values ​​to increase the randomness of the search. To reduce the time and computational cost of particle search, the values ​​of their velocity and position are typically limited to a range of values. and Interval.

[0193] In the PSO algorithm, inertia weight The value of the learning factor directly affects the algorithm's optimization ability. and The individual particle experience and the collective experience of the particles are controlled separately to influence the particle's trajectory. Under normal circumstances... Furthermore, the fixed value limits the global optimization capability and convergence speed of the PSO algorithm. To improve algorithm performance, considering that the PSO algorithm focuses on extensive search in the early stage of iteration and fast convergence in the later stage, this invention proposes to optimize the update rule of particle feature information using nonlinear inertial weights and adaptive learning factors, effectively improving the algorithm's optimization capability.

[0194] In the Enhanced PSO (EPSO) algorithm proposed in this invention, Defined as:

[0195] (17)

[0196] In the formula: and They are respectively The maximum and minimum values; This represents the current iteration number of the algorithm. This represents the maximum number of iterations for the algorithm. When... When smaller, close to ,and The rate of decrease is also relatively slow, which effectively guarantees the algorithm's global optimization capability; as Gradually increase Decrease in a non-linear manner, and The speed reduction was rapidly increased, which effectively ensured the algorithm's local optimization ability. This allowed the algorithm to flexibly adjust its global and local optimization capabilities, overcome the rigidity of linear adjustment, and achieve a smooth transition.

[0197] and The adaptively adjusted asynchronous learning factor is defined as follows:

[0198] (18)

[0199] (19)

[0200] In the formula: This represents the initial population size. , and , Learning factors and The initial value and the value of the last iteration are used to adaptively and dynamically adjust the learning factor to ensure that the particles disperse to search for the global optimum in the early stage of the algorithm, and concentrate on breaking through the local optimum in the later stage.

[0201] 3.4.3 Collaborative Optimization Method and Flowchart

[0202] Global Algorithm (GA) excels at searching for the global optimum over a large area, but its search for local optima is somewhat blind, leading to slow model convergence. The EPSO algorithm, on the other hand, has the ability to remember local optima and is relatively stable during the optimization process, but its limited population diversity restricts its search capabilities. Therefore, this invention combines the global search capability of GA with the local optimization capability of EPSO to establish a collaborative optimization algorithm, GA-EPSO, to more effectively and quickly find the optimal parameter configuration for the LSTM model, improving prediction accuracy and generalization ability. The specific process can be described as follows:

[0203] Step 1: Initialize parameters, including population size. Maximum number of iterations Variation rate Cross rate number of particles The inertia weights are respectively and The learning factors are respectively , , and This ensures that the algorithm encourages individual search in the early stages and accelerates group convergence in the later stages.

[0204] Step 2: Establish the fitness function

[0205] The choice of fitness function is crucial for the optimization performance of GA-EPSO, determining which individuals in the population can participate in the next generation of genetic operations, reflecting a "survival of the fittest" selection mechanism. Its design rules not only affect the optimized network performance but also further influence the prediction accuracy of ship positions. In the experiment, the fitness function was constructed based on the overall fit between the estimated and actual ship positions. To make the network parameters obtained from GA-EPSO more suitable for the LSTM model, the AIS data was randomly divided into training, validation, and test sets. After multiple iterations of training, the LSTM output values ​​were obtained. and validation set output values Based on this, the fitness function is defined. for:

[0206] (20)

[0207] in: and These are the expected output values ​​for the training set and the validation set, respectively. and These represent the sample sizes of the training and validation sets, respectively. The error on the validation set directly reflects the model's prediction performance, while the fitness function... The fitness value is calculated by using a weighted sum of the fitting errors of the training and validation sets.

[0208] Step 3: Based on Select the optimal individual

[0209] according to Calculate the fitness value of each individual in the initial population, select individuals with better performance to enter the next generation, that is, individuals with lower loss as the elite in the population, and use them as the basis for the next generation GA-EPSO optimization algorithm.

[0210] Step 4: Apply GA-EPSO for iterative optimization

[0211] In the optimization process of GA, selection operators are used to select well-performing individuals from the current population for crossover and mutation operations. The crossover operator combines the genes (learning rate and number of hidden nodes) of the parent individual to generate offspring individuals. The mutation operator randomly perturbs the genes of the individuals to increase the diversity of the population. Based on the new population generated by GA, EPSO updates the position and velocity of the particles according to equations (15) and (16), calculates the fitness value of each particle, and updates its individual best position and global best position.

[0212] Step 5: Iterate and find the optimal solution

[0213] Repeat Step 3 and Step 4 until the maximum number of iterations is reached or the early termination condition is met, and finally output the optimal hyperparameter configuration.

[0214] 3.5 GPA-LSTM: Enhanced Ship Trajectory Prediction Model

[0215] To improve the accuracy of ship trajectory prediction, this invention proposes a robust prediction method for inland waterway bridge area ship monitoring systems, named GPA-LSTM. This method is based on the LSTM model and enhances the modeling ability of key sequence features at different time scales by dynamically introducing MHA (Multi-Hypertext Optimization), thereby improving the model's ability to express long-sequence information and perceive target movement trends. Simultaneously, to overcome the difficulty in determining key hyperparameters in the LSTM model, this invention proposes a collaborative optimization strategy (GA-EPSO) to automatically search for key hyperparameters in the LSTM network structure, including the number of hidden layer neurons and the learning rate. Furthermore, the optimization process employs transfer learning, using the optimal model weights obtained in previous optimization processes as initialization, which can significantly improve convergence speed and reduce training overhead.

[0216] The overall process of GPA-LSTM trajectory prediction is as follows: Figure 6 As shown, the main components include AIS data preprocessing, multi-head attention mechanism design, model prediction framework construction, hybrid optimization algorithm GA-EPSO design, and model prediction and evaluation. By combining MHA and the hybrid optimization algorithm, not only is the model's feature representation capability improved, but the difficulty of manually setting hyperparameters is also effectively solved. It exhibits superior trajectory prediction performance in the complex water environment of bridge areas, laying a solid foundation for subsequent abnormal ship trajectory detection and bridge collision early warning.

[0217] 4. Trajectory Prediction Experiment Details

[0218] 4.1 Experimental Setup

[0219] This invention employs a GPU version of the PyTorch framework to implement a ship trajectory prediction algorithm. The hardware configuration of the computer used is shown in Table 1. To prevent overfitting during the training phase, a Dropout mechanism is introduced at the output of the LSTM layer. Simultaneously, an Adam optimizer with a decay coefficient of 0.00005 is used to optimize the network weights. Considering the limitations of the computer's hardware computing power, the batch size for model training is set to 64.

[0220] Table 1 Computer hardware parameters and software environment

[0221]

[0222] 4.2 AIS Data Preprocessing

[0223] To delve deeper into the challenges and problems of AIS data in practical applications, it is necessary to effectively model and analyze ship trajectory data and construct a spatiotemporal trajectory representation structure for ships. Based on this, this invention focuses on the continuous bridge group along the Yangtze River main channel as the primary research area, and takes the Wuhan Yangtze River Bridge No. 2 as an example to conduct comprehensive ship trajectory mining and feature analysis. Regarding the research content and questions, the invention primarily collected ship AIS message data (approximately 122,000 location information reports) within the bridge area of ​​the Wuhan Yangtze River Bridge No. 2 in January 2022. Figure 7 As shown.

[0224] In bridge-area waterways with complex inland traffic flow, vessels are highly susceptible to disturbances from water currents, limitations imposed by navigation openings, and improper operation when passing through bridge areas. If not properly controlled, collisions between vessels and bridge piers or between vessels themselves can easily occur. Therefore, conducting in-depth and systematic analysis of vessel movement behavior within bridge-area waterways, and uncovering their operational patterns and navigational patterns, has significant theoretical and practical value for improving navigation safety and constructing proactive collision avoidance and early warning systems. In this experiment, vessels in the study area were divided into upstream and downstream vessels based on their course to gain a more comprehensive understanding of navigational patterns within bridge-area waterways. Figure 8 As shown, the navigation behavior of vessels in both directions exhibits a clear trend of divergence and high stability. Vessel speeds are relatively concentrated, which is more conducive to modeling and prediction. However, vessel headings show significant directional differences. Therefore, vessel operators must accurately assess the traffic situation and make timely and accurate maneuvers to ensure the safe passage of vessels through the bridge area.

[0225] The raw data contains various information about ship navigation and has a very fine time granularity. However, due to the influence of the AIS equipment's transmission and reception mechanism, the data contains a significant amount of noise and outliers. Therefore, this invention performs a series of data processing steps, including:

[0226] (1) Trajectory Extraction. The MMSI is used as the unique identifier for each vessel. Each trajectory is identified by extracting the MMSI from the AIS data entries, and the following information is extracted from the raw data: MMSI, time, latitude, longitude, ground speed, and heading. At the same time, in accordance with the regulations for inland waterway vessel navigation, the speed range [2, 15] knots and the heading range [0, 360] degrees are set.

[0227] (2) Trajectory segmentation. For each ship's navigation trajectory, when the time interval between two consecutive points is greater than 1000s, the original trajectory is divided into several consecutive trajectory segments using these two points as breakpoints.

[0228] (3) Data denoising. Due to the navigation environment and the ship's own maneuverability, the original data exhibits trajectory point drift. To address this issue, this invention employs... The criteria eliminate outliers. Specifically, taking COG (Cost of Gauge) as an example, in specific waters, the distribution of COG is relatively concentrated. For abnormal COG data, the following rules can be used for processing:

[0229] (twenty one)

[0230] (twenty two)

[0231] in, and Let be the mean and standard deviation of COG, respectively. If a data point is identified as an outlier, it will be deleted.

[0232] (4) Data resampling. Since this work considers trajectory prediction tasks with equal time intervals, it is expected that each trajectory has the same sampling frequency. This invention uses a linear interpolation algorithm to resample the denoised data, and the time interval between adjacent points is set to 60s.

[0233] (5) Normalization. To improve the accuracy of trajectory prediction, the deviation method was used to normalize the AIS data in the experiment. The normalization operation is shown in equation (23):

[0234] (twenty three)

[0235] in, and For the minimum and maximum values ​​of a certain attribute data (such as LON), The original data, This is the data after normalization.

[0236] 4.3 Evaluation Indicators

[0237] To verify the effectiveness of the proposed trajectory prediction method, this invention uses four metrics—mean absolute error (MAE), root mean square error (RMSE), average displacement error (ADE), and final displacement error (FDE)—to evaluate the prediction results.

[0238] (twenty four)

[0239] (25)

[0240] (26)

[0241] (27)

[0242] in, Indicates the first The trajectory in the first The actual latitude and longitude of each time step For the predicted latitude and longitude, The total number of trajectory points, This indicates the number of predicted points for each trajectory.

[0243] Meanwhile, using the Haversine formula to calculate the actual distance between the predicted point and the true point, it can be expressed as:

[0244] (28)

[0245] in, For the Earth's radius, This is the actual distance, and .

[0246] 5. Experimental Results and Analysis of Trajectory Prediction

[0247] 5.1 Model Interpretability Analysis

[0248] SHapley Additive exPlanations (SHAP), as a model interpretability analysis method, quantifies the importance of each feature variable in every output sample to visualize the model's decision-making process. The SHAP method takes a global and local perspective, using SHAP values ​​as a unified measure of feature importance to assess the contribution of each feature to the final prediction, which is more reliable than simple feature importance analysis. SHAP interprets the model's prediction results as a linear function of the features, which can be described as:

[0249] (29)

[0250] in, The model's prediction results, This serves as the baseline value for the model's predictions. For the first The SHAP value corresponding to each feature quantity. The calculation process is as follows:

[0251] (30)

[0252] in, Not included Feature set, , They are included and excluded respectively. The SHAP value represents the predicted value. A positive or negative SHAP value indicates the positive or negative impact of the feature on the trajectory prediction result, while its absolute value measures the strength of the impact. Therefore, by analyzing the distribution of feature values ​​and their corresponding SHAP values, we can not only quantify the contribution of different input features to the prediction results but also reveal their influence patterns, thus gaining a more intuitive understanding of the role of each feature in the trajectory prediction process.

[0253] To gain a deeper understanding of the impact of different input features and time step information on the trajectory prediction model output, and to evaluate the performance improvement effect of MHA, this invention uses the SHAP method to analyze the importance of its input features, and further explores the contribution and influence of different navigation features in trajectory prediction. Figure 9 In this study, the trained LSTM model and its MHA-optimized model are used as the objects. The feature importance of the model in the two output dimensions of longitude (Output 0) and latitude (Output 1) is visualized and analyzed. Each input sample contains a sequence of ship motion states for 5 consecutive time steps.

[0254] It can be observed that, regarding the impact of time steps on prediction results, the features corresponding to time steps closer to the current time are... and The importance of earlier time steps to the prediction results is significantly higher than that of earlier time steps. This indicates that when predicting trajectory, the model relies more on recent historical information and utilizes less historical information from earlier time steps, exhibiting a clear short-term dependency characteristic. This phenomenon is particularly evident in the original LSTM model, reflecting its limited long-term memory capacity and inability to fully exploit the trajectory evolution patterns contained in earlier time steps. However, after introducing MHA, the model's attention to features from earlier time steps is improved, indicating that MHA alleviates the shortcomings of LSTM in modeling long-term dependencies to some extent. Regarding feature dimension contributions, the LSTM model... and The importance of information is significantly higher than and The latter two factors made almost no significant contribution to the model's predictions, suggesting that their representational capabilities were not fully utilized by the model. After introducing MHA, and The improved SHAP value distribution for dynamic features indicates that MHA helps enhance the model's ability to focus on complex dynamic features, thereby improving feature extraction and modeling performance. Specifically, the SHAP value also provides the positive or negative relationship between feature values ​​and predicted outputs; the figure shows the relationship at different time steps. and The different directions of influence of features on the output under high or low values ​​indicate that the model has captured the dynamic changing trend of spatial trajectory to a certain extent.

[0255] In summary, SHAP not only reveals the model's focus on different feature dimensions, but also confirms that the MHA mechanism can enhance the model's ability to model time series features, especially the effective activation and utilization of low-contribution features in complex navigation scenarios. Furthermore, it provides strong theoretical support for subsequent model structure optimization and input feature selection.

[0256] 5.2 Comparative Analysis of Trajectory Prediction Results

[0257] To verify the effectiveness of the proposed trajectory prediction method (GPA-LSTM), this invention conducted a series of comparative experiments on the actual AIS dataset, including RNN and its variants LSTM, GRU, and support vector machines (SVM) models, and performed qualitative and quantitative evaluations on the results.

[0258] After preprocessing the raw trajectory data, this invention divides and establishes upstream and downstream vessel trajectory datasets based on heading, and divides them into training, validation, and test sets in an 8:1:1 ratio. Specifically, to ensure experimental fairness, the number of hidden layer neurons in the RNN, LSTM, and GRU models is set to 30, the number of iterations to 100, and the learning rate to 0.01. In the SVM model, a radial basis function is selected. As a kernel function, where the kernel function parameters and penalty coefficient The values ​​are respectively , .

[0259] In the experiment, this invention uses the Cooperative Optimization Algorithm (GA-EPSO) to determine the optimal parameter combination of the number of hidden layer neurons and the learning rate of the MHA combined with the LSTM network. After algorithm iteration, the optimal parameter combinations for the uplink and downlink trajectory prediction models are as follows: , During the optimization process, the fitness value change curve is as follows: Figure 10 As shown, it can be observed that the fitness function converges rapidly after the sixth generation of search iterations, and the model reaches a stable state in a short time, indicating that the GA-EPSO algorithm has good global and local search capabilities in the parameter optimization process.

[0260] Furthermore, the obtained optimal hyperparameter combination is used to construct and train the GPA-LSTM model. Figure 11The loss function curves of the model on the training and validation sets are plotted separately. The results show that the model loss value drops rapidly in the early stage of training and tends to stabilize after about 10 rounds. The loss on the validation set is highly consistent with the loss on the training set, indicating that the constructed model not only converges quickly but also has good generalization ability, which also illustrates the advantages of the training strategy based on the transfer learning approach.

[0261] 5.2.1 Qualitative Analysis

[0262] To verify the effectiveness of the GPA-LSTM method, the prediction results were visualized and compared in the experiment. The prediction results of different models are shown below. Figures 12 to 15 As shown. Figure 12 As shown in (a)-(e), for trajectories with obvious turning characteristics, SVM exhibits significant prediction bias in curved sections. While RNN has some ability to capture temporal features, its overall bias is quite pronounced. GRU and LSTM outperform the original RNN, but still exhibit trajectory deviation. In contrast, GPA-LSTM models ship turning trends more accurately, with the predicted trajectory highly consistent with the actual trajectory. Figure 13 and Figure 14 In this scenario, the ship's trajectory approximates a straight line, with closely distributed track points in the same direction. The ship travels at a stable speed along a fixed channel within this segment. Despite this, the prediction performance of SVM is still relatively poor. LSTM performs well in the early and middle stages, but exhibits severe divergence in the later stages. RNN and GRU show slight offsets at some time steps. GPA-LSTM performs relatively well, maintaining high consistency and continuity throughout the entire trajectory prediction. Figure 15 In the analysis, ship trajectories exhibit a discontinuous, jump-like distribution with large intervals between trajectory points, reflecting either long AIS signal intervals or high-speed straight-line navigation. This places higher demands on the time-dependent modeling capabilities of the prediction model. The prediction results show that SVM exhibits severe trajectory deviation throughout the prediction process. RNN, LSTM, and GRU only show good prediction results for some time steps, and their overall performance is not ideal. In contrast, the GPA-LSTM method demonstrates a strong advantage, capable of accurately modeling and predicting ship trajectories under different navigation conditions.

[0263] Meanwhile, to more accurately evaluate the trajectory prediction performance of the model, the Haversine formula was used to calculate and statistically analyze the geographical distance error between each predicted point and the actual point under different navigation conditions. Figure 12As shown in (f) to 15(f), it can be seen that SVM consistently exhibits the highest distance error throughout the prediction process, with significant fluctuations, indicating that this model struggles to effectively capture the temporal dependencies of trajectories with complex dynamic characteristics. While RNN and LSTM can characterize trajectory evolution trends to some extent, their errors gradually accumulate over time, exhibiting insufficient stability, especially over longer prediction periods. In contrast, GRU demonstrates good accuracy in most cases, with a relatively stable error curve. Notably, the GPA-LSTM method proposed in this invention maintains the lowest distance error across all time steps, with an overall error level significantly lower than other comparative models, and a relatively stable error curve, demonstrating stronger temporal modeling and generalization capabilities. This result fully validates that the GPA-LSTM method possesses superior prediction performance across various navigation scenarios, enabling more stable and accurate prediction of future ship trajectories, providing strong support for intelligent navigation and risk warning in complex waters.

[0264] Figure 12 Ship trajectory prediction results and distance errors. The overall ship trajectory shows an upward trend, with a significant rightward turn in certain segments, reflecting typical large-scale directional changes in bridge-area waters.

[0265] Figure 13 Ship trajectory prediction results and distance errors. The trajectory in the figure shows a smooth and continuous upward path, gradually deflecting to the right, reflecting the characteristics of stable navigation of the ship in the river bridge area.

[0266] Figure 14 Ship trajectory prediction results and distance error. The trajectory exhibits relatively stable navigation characteristics, with closely distributed track points in consistent direction, indicating that the ship is traveling at a stable speed along a fixed channel within this segment.

[0267] Figure 15 Ship trajectory prediction results and distance errors. The ship's position exhibits a discontinuous, jump-like distribution, with large intervals between trajectory points. The ship is traveling at high speed in a straight line, which places higher demands on the time-dependent modeling capabilities of the prediction model.

[0268] 5.2.2 Quantitative Analysis

[0269] To comprehensively evaluate the performance of different models in trajectory prediction, this invention calculates the ADE and FDE indices in both angle (°) and distance (km) units. Angle units directly reflect the model's prediction accuracy at the latitude and longitude level, demonstrating its fitting ability in a spatial coordinate system; smaller errors indicate lower deviations in the predicted geographical location, helping to maintain the geometric shape of the track. ADE and FDE in distance units are calculated using the Haversine formula, more closely resembling the ship's navigation path on the real Earth surface, and more accurately quantifying the model's performance in spatial trajectory prediction. Therefore, this invention calculates and displays the error indices in both units simultaneously to provide a more comprehensive and reliable performance evaluation. Furthermore, MAE and RMSE indices are also used to evaluate the model's predictive performance; specific results are shown in Tables 2 and 3.

[0270] The experimental results show that the GPA-LSTM method achieves the best performance across all metrics and performs very satisfactorily under different navigation modes. In the uphill trajectory, the MAE and RMSE for ship 1 are 0.000088 and 0.000128, respectively, while the ADE and FDE in angular units are 0.000139 and 0.00005, respectively, which translate to 0.014308 and 0.004948 in physical distance units. Similarly, the prediction results for ship 2 are also quite ideal, indicating that the GPA-LSTM method can not only accurately predict the ship's position in angular coordinates but also effectively control actual spatial offsets, significantly outperforming other models. In particular, the downhill trajectory typically involves high-speed motion, increasing the prediction difficulty, but the GPA-LSTM method still achieved the top ranking across the four metrics, demonstrating good robustness and generalization ability. Its error control capability is particularly outstanding during sharp turns, accelerations, or dense areas, further validating the effectiveness and versatility of the GPA-LSTM method in complex real-world navigation environments.

[0271] Table 2. Prediction performance analysis of different models on the uplink trajectory dataset

[0272]

[0273] Table 3. Prediction performance analysis of different models on the downlink trajectory dataset

[0274]

[0275] 5.3 Abnormal trajectory detection and active collision avoidance warning for the bridge

[0276] 5.3.1 Abnormal Trajectory Generation Strategy

[0277] Anomaly trajectory detection is a core technology for preventing ship-bridge collisions. Analysis of historical ship trajectories reveals that most ship movements are within normal limits, while anomalous trajectories posing a high risk of collision constitute a very small percentage of the total historical trajectories, occurring only once every few weeks or months. This extremely limited number of anomalous trajectories cannot provide sufficient data support for data-driven ship-bridge collision early warning systems. Based on the basic information of the Wuhan Yangtze River Bridge No. 2, this invention utilizes the NT-PRO 5000 full-mission large-scale ship maneuvering simulator to perform 3D modeling and real-world reconstruction of the waters near the Wuhan Yangtze River Bridge No. 2. Figure 16 As shown. Based on the management regulations of the Wuhan Maritime Safety Administration and actual navigation conditions, key simulation parameters such as route path, initial vessel position, and speed range were reasonably set, and two typical representative simulated vessel types were constructed, including a 5,000-ton river-sea vessel and a 10,000-ton inland waterway vessel, such as... Figure 17 As shown.

[0278] Based on the above work, this invention simulates and generates three typical high-risk abnormal behavior patterns under two typical hydrological scenarios: flood season and dry season. Figure 18 As shown, each mode simulates 300 ship trajectories, mainly including:

[0279] (1) Abnormal trajectory pattern 1: Figure 18 In (a), a simulated vessel, under the influence of operational errors or equipment failures, enters an unauthorized passageway, thereby bypassing navigational markers and traversing a narrow passageway with a high risk of collision.

[0280] (2) Abnormal trajectory pattern 2: Figure 18 In (b), although the simulated ship passed through the correct navigation channel, its path deviated from the centerline of the upstream channel and was too close to the piers near the upstream channel, reflecting the risk of failure to correct the course deviation in a timely manner.

[0281] (3) Abnormal trajectory pattern 3: Figure 18 In (c), the simulated vessel is required to pass through the bridge via the upstream channel in the navigation hole. However, due to a failure in course control or operational error, it mistakenly enters the downstream channel, resulting in a conflict with the vessel traveling in the opposite direction or even deviating from the main channel.

[0282] During the experiment, each type of abnormal trajectory was controlled by experienced ship operators. Multiple rounds of testing and adjustments were conducted to ensure the trajectory scenarios were realistic and reliable. High-precision trajectory data was acquired using equipment such as AIS, radar, and Electronic Chart Display and Information System (ECDIS), ultimately forming a structured abnormal trajectory sample library. This data will be used for subsequent abnormal trajectory identification and the training and validation of bridge collision warning models.

[0283] 5.3.2 Anomaly Trajectory Detection Evaluation Indicators

[0284] Ship anomaly trajectory detection is a typical binary classification problem. It evaluates the results based on the true and predicted labels of the trajectory data. To more accurately assess algorithm efficiency and accuracy, accuracy (Accuracy, Acc), precision (Precision, P), recall (Recall, R), F1 score, and false positive rate (FPR) are used to measure the detection results. The formulas for each metric are as follows:

[0285] (31)

[0286] In equation (31): , , and These represent the true, false positive, false negative, and true negative classes for anomaly detection, respectively: when something is actually abnormal, it is judged as abnormal; when something is actually normal, it is judged as abnormal; when something is actually abnormal, it is judged as normal; and when something is actually normal, it is judged as normal.

[0287] 5.4 Enhanced Self-Encoder Structure

[0288] Ship anomaly trajectory detection is an effective means to assist in maritime traffic supervision and prevent ship-bridge collisions. In anomaly identification methods based on clustering analysis, such as DBSCAN, only spatial density is relied upon for point clustering, ignoring the temporal continuity of ship motion and the overall trajectory structure, making it difficult to accurately characterize ship behavior. To extract representative spatiotemporal features from historical ship trajectories, this invention constructs an enhanced autoencoder structure. This structure combines spatial and dynamic feature modeling, performing deep encoding and reconstruction learning on key features such as longitude, latitude, speed, and heading of the trajectory, extracting a unified trajectory representation vector to provide a reliable low-dimensional representation for subsequent clustering. The entire model follows an Encoder-Decoder structure, mainly composed of a spatial encoder (SE), a dynamic encoder (DE), a joint encoding layer (Feature Fusion Encoder, FFE), and a decoder. The overall network structure is as follows: Figure 19 As shown.

[0289] The input to this autoencoder is a series of ship trajectory data. Each trajectory contains the motion sequence of the corresponding ship. In this model, the spatial encoder (SE) focuses on modeling the latitude and longitude variations in the trajectory sequence. Specifically, the latitude and longitude sequences of each trajectory are first... Flattened inputs are fed into convolutional and pooling layers to capture key spatial locations and trends of change, enhancing the model's ability to perceive complex behavioral patterns such as "turning".

[0290] The Dynamic Encoder (DE) module is used to extract the dynamic features of speed and heading evolution over time in the trajectory. This module employs a two-layer LSTM network. The features are modeled, and the hidden state at the last moment is taken as the representation of dynamic behavior. The dynamic encoder structure can effectively capture the time dependence of ship speed and steering mode, and is an important part of trajectory feature modeling.

[0291] The Feature Fusion and Encoding (FFE) module outputs the spatial location features and dynamic behavior features from the SE and DE encoders, respectively. These features are concatenated and then input into a linear layer to compress them into a Latent Space (LS) vector. The LS vector is the final embedded representation of the trajectory, which contains both structural information about positional changes and incorporates ship behavior dynamics, providing a high-quality, low-dimensional input basis for clustering.

[0292] To enhance the feature extraction capability of the established encoder, a two-layer fully connected network is used during model training to construct the decoder to reconstruct the original trajectory. The mean squared error (MSE) between the original and reconstructed trajectories is used as the loss function.

[0293] (32)

[0294] in, This represents the reconstructed trajectory. This represents the original trajectory.

[0295] 5.5 Cluster-based Anomaly Trajectory Detection

[0296] After completing the trajectory depth feature encoding, this invention uses the extracted latent vector (LE) as clustering input to perform unsupervised clustering analysis on the ship trajectory. The main process is as follows:

[0297] Step 1: Latent Feature Extraction. Using a trained autoencoder model, all trajectories are encoded to extract their low-dimensional latent representation vectors. These latent representation vectors not only preserve the spatiotemporal structure of the trajectories but also possess good separability, providing a more robust representation foundation for downstream clustering.

[0298] Step 2: Time Series Clustering Model Construction. To adapt to the temporal characteristics of trajectory data, TimeSeriesKMeans, based on Dynamic Time Warping (DTW) distance from the tslearn library, was selected as the clusterer. DTW can calculate the similarity of trajectories of different lengths and alignments, making it suitable for sequence data with non-linear time shifts, such as ship trajectories. To ensure the continuity of trajectory structure, a Sakoe-Chiba distance constraint window was added to the clustering to further enhance the temporal consistency of the clustering.

[0299] Step 3: Optimal Number of Clusters Selection. To automatically determine the optimal number of clusters, this invention introduces the Silhouette Coefficient (SC), Davies-Bouldin Index (DBI), and Calinski-Harabaz Index (CHI) to measure cluster quality. The calculation formulas are as follows:

[0300] (33)

[0301] in, The inter-cluster scatter matrix is... The cluster scatter matrix is ​​the matrix of scatter within the cluster. and These are the traces of the inter-cluster and intra-cluster scatter matrices, respectively. For the total sample size, For the number of clusters, For the first The number of samples in each cluster For the first The center of each cluster, It serves as the global center of the dataset.

[0302] In the clustering process, DBI focuses on the separation between clusters, SC provides a sample-level measure of clustering confidence, and CHI focuses on the overall dispersion between and within clusters. Therefore, using DBI, SC, and CHI in combination can comprehensively reflect the separation and compactness of the clustering results. The comprehensive score calculation in the experiment is shown in Equation (34), which is used to encourage the discovery of meaningful navigation patterns. The model automatically selects the cluster with the highest score by traversing different numbers of clusters of K and calculating the comprehensive evaluation index value for each K value, as shown in Table 4.

[0303] (34)

[0304] Table 4 Clustering scores under different K values

[0305]

[0306] Step 4: Complete trajectory clustering. Based on the selected optimal number of clusters, call TimeSeriesKMeans to perform clustering calculations on all latent vectors (LEs) and generate a cluster label for each trajectory. This label represents the navigation mode or behavior cluster to which the trajectory belongs, providing a reliable basis for subsequent ship behavior analysis, anomaly detection, and risk warning.

[0307] like Figure 20 As shown, the clustering results demonstrate that the proposed model can effectively distinguish between different types of ship trajectories. Category 0 and Category 1 (represented by orange and blue, respectively) correspond to normal navigation trajectories, characterized by stable headings, smooth paths, and dense trajectory distribution. In contrast, Category 2 (green) trajectories exhibit significant deviations in both spatial orientation and distribution density, reflecting abnormal navigation behaviors such as unstable headings, deviations from the main channel, or track jumps. This clustering structure validates the model's effective ability to extract spatiotemporal features and provides a reliable foundation for abnormal trajectory detection in complex inland waterways.

[0308] Based on the clustering results, this invention randomly selected 100 trajectories as test samples for anomaly detection, including 75 normal trajectories and 25 abnormal trajectories. Each trajectory to be detected is first input into a trained autoencoder model to extract its corresponding latent feature representation vector. Subsequently, the similarity between the trajectory and each cluster center is calculated using DTW (Deep Distance Wave). The cluster with the smallest DTW distance is used as the predicted category for the trajectory. Furthermore, an in-class confidence calculation mechanism is introduced, combining the minimum distance value with the overall distance distribution to evaluate the degree of matching between the trajectory and the cluster structure. When the confidence level is lower than a preset threshold or the distance distribution deviates significantly from the cluster center, the trajectory is determined to be an abnormal trajectory. This mechanism not only considers the proximity of the trajectory to the cluster center but also integrates its similarity distribution characteristics throughout the entire cluster structure, thereby achieving a more robust anomaly detection judgment.

[0309] As shown in Table 5, the anomaly detection method proposed in this invention outperforms the benchmark method DBSCAN in all evaluation metrics. Its Acc reaches 94.05%, significantly higher than DBSCAN's 62%, indicating high reliability in distinguishing between normal and anomalous trajectories. Meanwhile, P and R reach 88.89% and 95.5% respectively, demonstrating not only high confidence in detecting real anomalies but also a low FPR of only 2.25%. In contrast, DBSCAN's low recall rate limits its practical application value. Furthermore, the F1 score of this invention is 90.92%, while DBSCAN's is only 39.29%, further validating the good balance between P and R. Although DBSCAN has a lower FPR, this comes at the cost of a significant decrease in R and F1 scores, meaning it misses a large number of real anomalous trajectories. In contrast, the method of this invention maintains high R and P while only slightly increasing FPR. This trade-off result indicates that the method not only has high accuracy but also high reliability and robustness in practical anomaly trajectory detection.

[0310] Overall, these detection results demonstrate that the method of this invention, combining spatiotemporal coding, dynamic feature modeling, and optimal clustering, achieves relatively accurate, reliable, and robust performance in detecting abnormal vessel trajectories. Once an abnormal trajectory is detected, a collision risk alarm is triggered based on the deviation from normal motion patterns, providing early warning of potential ship-bridge collisions. This anomaly detection provides a practical basis for establishing early warning methods for inland waterway bridge areas, enhancing proactive risk management in water transportation.

[0311] Table 5. Anomaly trajectory detection results of different models

[0312]

[0313] 5.6 Real-time collision avoidance warning for ship bridge

[0314] Based on the proposed spatiotemporal trajectory prediction and anomaly detection method, this invention designs a real-time early warning method for ship-bridge collision avoidance and applies it to the Wuhan Yangtze River Bridge No. 2. As mentioned earlier, when a vessel is detected entering the bridge area, the system extracts real-time navigation status information based on its MMSI, including position, speed at ground level (SOG), and heading at ground level (COG). This information is continuously monitored and used as input to a trained GPA-LSTM prediction model to predict the vessel's position information for the next 10 minutes in real time. Then, a trained deep learning-based clustering model is applied to the predicted trajectory to evaluate its navigation pattern. If the system predicts that the vessel will deviate from the safe channel or exhibit abnormal behavior (e.g., a significant deviation from the expected route or abnormal motion characteristics), it will immediately trigger an early warning.

[0315] Example of bridge collision avoidance warning Figure 21As shown, in Figure 21 In (a), when a vessel passes through the bridge area waterway according to its normal navigation pattern, it maintains a stable course and speed, and the predicted trajectory closely matches the actual trajectory. In this case, the anomaly detection module in the early warning framework classifies the trajectory as a normal navigation pattern with high confidence, and no early warning is triggered. This indicates that the proposed early warning method can effectively distinguish between normal and potentially dangerous navigation trajectories, minimizing false alarms while ensuring regulatory reliability. Conversely, in Figure 21 In (b), the predicted ship trajectory deviates significantly from the expected navigation channel range. The warning method determines the trajectory pattern as abnormal based on potential feature representation and confidence score, indicating that the ship has a potential risk of colliding with the bridge. At this time, a collision warning can be triggered to prompt the ship's pilots to make timely and correct ship handling instructions.

[0316] These application examples demonstrate that the proposed real-time collision avoidance early warning method for bridges can accurately identify the trajectories of vessels with navigational risks and provide reliable early warnings, enabling maritime regulatory authorities to proactively respond to maritime traffic situations and ensure navigation safety in bridge areas.

[0317] Example 1: Basic Active Collision Avoidance Warning Method

[0318] This embodiment provides a basic end-to-end active collision avoidance warning process. The system receives real-time data from the target vessel's Automatic Identification System (AIS), extracts and cleans its latitude, longitude, speed, and heading features, and inputs this data into a fusion multi-head attention mechanism and long short-term memory network model with hyperparameters fine-tuned through a collaborative optimization strategy. The system then outputs the vessel's future trajectory. Subsequently, an enhanced autoencoder encodes the trajectory's features, extracting the latent space and dynamic vector. Finally, the system inputs the feature vector of the predicted trajectory into a time-series clustering model, using a dynamic time warping algorithm to calculate its distance from normal navigation clusters. Through unsupervised anomaly detection, once the predicted future trajectory is determined to belong to an abnormal pattern, a collision avoidance warning is immediately triggered, completing the transition from passive response to active prevention.

[0319] Example 2: High-precision trajectory prediction model mechanism

[0320] First, the Long Short-Term Memory (LSTM) network precisely controls the retention of historical navigation state information and the output of the current state through its internal forgetting and input gates, overcoming the memory loss problem of traditional networks in long sequences. Second, a multi-head attention mechanism is introduced, transforming the input ship trajectory features into a query, key, and value matrix, and calculating weights through normalization and dot product operations. Multiple attention heads extract multi-dimensional trajectory features in parallel and perform concatenation and dimensionality reduction, enhancing the model's ability to extract information at critical moments. In particular, to overcome the subjectivity and randomness of manually setting key hyperparameters, a collaborative optimization strategy coupling genetic algorithms and enhanced particle swarm optimization algorithms is adopted to automatically determine the optimal parameter combination of the network. This deep collaborative mechanism enables the model to accurately capture the nonlinear motion laws of ships in complex water flow fields, significantly improving the accuracy and robustness of long-term predictions.

[0321] Example 3: Core Mechanism for Unsupervised Anomaly Detection

[0322] This solution employs a unique enhanced autoencoder to compress and reconstruct trajectory features. Internally, it utilizes a spatial encoder to extract the ship's latitude and longitude variations, while simultaneously employing a dynamic encoder to capture the time dependence of speed and heading. These two are then concatenated and dimensionality-reduced to generate a unified latent feature vector. For ship trajectories of varying lengths, the system introduces a dynamic time warping algorithm to find the optimal matching path to measure trajectory similarity. Combined with a comprehensive evaluation index, it automatically determines the optimal number of clusters and uses a time series clustering algorithm to automatically divide the trajectories into normal navigation trajectory clusters and abnormal deviation trajectory clusters. In real-time detection, the system calculates the minimum DTW distance between the predicted trajectory and each cluster center, and performs a dual evaluation using built-in class confidence. This approach cleverly avoids reliance on large amounts of hazard labeling data, accurately identifying unknown risks without manual intervention, demonstrating strong creativity and engineering practical value.

[0323] Example 4: Co-optimization of model training parameters and data augmentation strategies

[0324] To address the difficulty of manually tuning trajectory prediction models, this embodiment constructs a collaborative optimization strategy based on genetic algorithms and enhanced particle swarm optimization. This strategy utilizes massive amounts of real-world data from automatic identification systems for training, constructing a fitness function based on prediction errors. Through global and local collaborative optimization, it automatically determines the optimal number of hidden layer nodes and learning rate, among other hyperparameters, of the prediction network. Addressing the severe lack of training data for extreme emergencies in the industry, this embodiment introduces a data augmentation strategy combining virtual and real-world data. A full-mission large-scale ship maneuvering simulator is used to realistically simulate typical abnormal navigation patterns in bridge-area waters. These generated high-quality abnormal trajectories are used to construct a structured sample library for verifying the anomaly detection model and setting thresholds. This strategy, which optimizes prediction based on real data and compensates for anomaly detection shortcomings with simulation data, significantly enhances the model's generalization ability and the robustness of the early warning system.

[0325] Example 5: Deployment Scheme of Modular Early Warning System

[0326] The system comprises four microservice modules: data acquisition, trajectory prediction, feature extraction, and anomaly early warning. The data acquisition module is responsible for cleaning, smoothing, and imputing missing data before high-speed distribution. The early warning module not only outputs intelligent audible and visual alarms but also visualizes predicted ship drift routes in real-time on electronic nautical charts. All modules operate collaboratively and efficiently, ensuring microsecond-level low-latency response, meeting the safety monitoring needs of high-frequency, high-volume vessels in major bridge areas, and providing scientific decision support.

[0327] Example 6: Practical Application in Complex Hydrological Environments

[0328] In a navigation bridge area with strong crosswinds and currents, a heavily loaded cargo ship began to veer slightly due to the pressure difference between the wind and current. Traditional systems based on fixed warning waters would not respond at this time. This system, however, uses an attention mechanism to keenly detect the subtle physical anomalies in its course and speed, accurately predicting its trajectory as it would deviate from the channel and collide with the bridge pier. The clustering module then identifies this as a high-risk situation, and the system automatically sends avoidance instructions several minutes in advance and coordinates with the traffic control center, completely averting the potential danger.

[0329] It should be noted that embodiments of the present invention can be implemented in hardware, software, or a combination of both. The hardware portion can be implemented using dedicated logic; the software portion can be stored in memory and executed by a suitable instruction execution system, such as a microprocessor or dedicated-design hardware. Those skilled in the art will understand that the above-described devices and methods can be implemented using computer-executable instructions and / or included in processor control code, for example, such code provided on a carrier medium such as a disk, CD, or DVD-ROM, a programmable memory such as read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The devices and modules of the present invention can be implemented by hardware circuitry such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field-programmable gate arrays, programmable logic devices, etc., or by software executed by various types of processors, or by a combination of the above-described hardware circuitry and software, such as firmware.

[0330] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications, equivalent substitutions, and improvements made by those skilled in the art within the scope of the technology disclosed in the present invention, and within the spirit and principles of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for active collision avoidance and early warning of ship bridges based on spatiotemporal trajectory prediction and anomaly detection, characterized in that, include: Step 1: Obtain data from the automatic identification system; Step 2: Input the acquired automatic recognition system data into the trajectory prediction model to obtain the predicted trajectory. The trajectory prediction model integrates multi-head attention mechanism and long short-term memory network. Step 3: Extract latent trajectory features for the predicted trajectory by combining spatial feature encoding and dynamic feature encoding through an enhanced autoencoder network; Step 4: Use dynamic time warping algorithm and time series clustering to perform unsupervised anomaly detection and classification on potential trajectory features, and output ship-bridge collision avoidance warning information based on the classification results.

2. The active collision avoidance and early warning method for ship-bridge based on spatiotemporal trajectory prediction and anomaly detection as described in claim 1, characterized in that, The trajectory prediction model is based on the current longitude, latitude, speed to ground, and heading to ground, combined with historical navigation behavior data, and calculates the ship's navigation behavior at future moments through a nonlinear mapping function. Mathematical model for ship trajectory prediction: Suppose a set of AIS data is a time series at certain time intervals. Then the ship at time navigation behavior It can be represented as: (1) (2) in: , , and The ship was at the time of The longitude, latitude, speed over ground (SOG), and course over ground (COG) of the vessel; generally speaking, the vessel's navigation behavior at future moments. Current behavior With historical behavior The result of their combined effects is that their mathematical model can be expressed as: (3) In equation (3), It is a non-linear mapping function.

3. The active collision avoidance and early warning method for ship bridges based on spatiotemporal trajectory prediction and anomaly detection as described in claim 2, characterized in that, The computational process of a Long Short-Term Memory (LSTM) network includes: The input gate receives the current state of the network input unit and the hidden state of the previous time step, and calculates the amount of input information at the current time step. The forget gate receives the current network input cell state and the hidden state from the previous time step, and determines the amount of cell state information from the previous time step to be retained in the current cell state. The output gate receives the current network input cell state and the hidden layer state of the previous time step, calculates the cell state information output at the current time step; The current cell state is formed by multiplying the output of the forget gate by the cell state of the previous time step element by element, plus the output of the input gate by the cell state of the current input step element by element. The final output of the network is obtained by element-wise multiplying the output of the output gate with the current cell state after processing by the activation function; All the above gating and cell state calculations are completed based on the corresponding weight matrix, bias term, activation function and vector inner product operation; Long Short-Term Memory Network Structure: Let the network input be The hidden state is The transmission of information between network units can then be represented as: (4) (5) (6) (7) (8) (9) Among them, the input gate The current cell state; forget gate It is mainly used to retain the cell state information from the previous time step. Current cell state Information content; output gate This determines the output of the cell's state information at the current moment; For the final output of the network, This represents the current input cell state. This represents the current state of the cell. , , , These are the weight matrices for the three gates and the unit states, respectively; , , , For the corresponding bias term; For the sigmoid function, For activation function, For vector dot product, This indicates element-wise multiplication.

4. The active collision avoidance and early warning method for ship bridges based on spatiotemporal trajectory prediction and anomaly detection as described in claim 2, characterized in that, The computational process of the multi-head attention mechanism includes: For the input feature sequence, a linear transformation is performed to generate the query matrix, key matrix, and value matrix corresponding to each attention head; After performing a dot product operation on the query matrix and the key matrix, the result is scaled by dividing by the square root of the number of attention heads, and then processed by a normalized exponential function to obtain the weight matrix of each attention head. Multiplying the weight matrix by the value matrix yields the output of each attention head; The outputs of all attention points are concatenated and then subjected to a linear transformation with learnable weight parameters for dimensionality reduction, resulting in output sequences with different degrees of attention. By introducing a multi-head attention mechanism into the LSTM model, the ability of the model to express information at different time steps is improved through parallel computation. The multi-head attention mechanism achieves multi-dimensional learning of the input sequence through parallel computing. Each attention head independently focuses on different subspaces of the input sequence, and a weight allocation mechanism is used to enable the model to integrate multi-view information. In an n-head attention structure, for the input feature sequence First, a linear transformation is performed to generate the corresponding head for each ( )Query( ), Key( ) and Value( ), and then through The function is normalized and subjected to dot product operation to obtain each weight matrix Finally, all of them By concatenating the sequences and performing a learnable linear transformation for dimensionality reduction, output sequences with different levels of interest can be obtained. The specific calculations are as follows: (10) (11) (12) in, , and Each head The weight matrix in the linear transformation process. To focus on the number of heads, Scaling is performed in a manner that ensures the stability of the weights. For splicing operations, The weights in the dimensionality reduction operation are denoted by [symbol]. This represents matrix multiplication.

5. A model training method for the active collision avoidance and early warning method for ship bridges based on spatiotemporal trajectory prediction and anomaly detection as described in claim 1, characterized in that, include: The abnormal navigation patterns in the bridge area were simulated using a full-mission ship handling simulator to generate abnormal trajectory data. The automatic identification system data and abnormal trajectory data are combined to construct a sample set for training; The trajectory prediction model is trained based on massive amounts of real ship automatic identification system data, and the hyperparameters of the trajectory prediction model are fine-tuned using a collaborative optimization strategy. An enhanced autoencoder network is trained using anomalous trajectory data, enabling it to combine spatial and dynamic feature encoding to extract latent trajectory features.

6. The model training method as described in claim 5, characterized in that, A collaborative optimization strategy is used to fine-tune the hyperparameters of the trajectory prediction model, including automatically adjusting the number of hidden layer nodes and the learning rate parameter in the long short-term memory network based on prediction error feedback.

7. A ship-bridge active collision avoidance and early warning system based on spatiotemporal trajectory prediction and anomaly detection, implementing the ship-bridge active collision avoidance and early warning method based on spatiotemporal trajectory prediction and anomaly detection as described in any one of claims 1-6, characterized in that, include: The data acquisition module is used to acquire data from the automatic identification system; The trajectory prediction module is used to input the acquired automatic recognition system data into the trajectory prediction model to obtain the predicted trajectory. The trajectory prediction model integrates multi-head attention mechanism and long short-term memory network. The feature extraction module is used to extract latent trajectory features for the predicted trajectory by combining spatial feature coding and dynamic feature coding through an enhanced autoencoder network. The anomaly detection and early warning module is used to perform unsupervised anomaly detection and classification on potential trajectory features using dynamic time warping algorithm and time series clustering, and outputs ship-bridge collision avoidance early warning information based on the classification results.

8. The active collision avoidance and early warning system for ship bridges based on spatiotemporal trajectory prediction and anomaly detection as described in claim 7, characterized in that, The trajectory prediction module uses a trajectory prediction model based on the current longitude, latitude, speed to ground, and heading to ground, combined with historical navigation behavior data, to calculate the ship's navigation behavior in the future using a nonlinear mapping function.

9. The active collision avoidance and early warning system for ship bridges based on spatiotemporal trajectory prediction and anomaly detection as described in claim 7, characterized in that, The current cell state in the Long Short-Term Memory network is formed by multiplying the output of the forget gate by the cell state of the previous time step, plus the output of the input gate by the cell state of the current input step. The final output of the network is obtained by multiplying the output of the output gate by the cell state of the current time step after processing by the activation function.

10. The active collision avoidance and early warning system for ship bridges based on spatiotemporal trajectory prediction and anomaly detection as described in claim 7, characterized in that, The multi-head attention mechanism performs a dot product operation on the query matrix and key matrix of each attention head, scales it by the square root of the number of attention heads, and then processes it with a normalized exponential function to obtain a weight matrix. The outputs of each attention head, based on the multiplication of the weight matrix and the value matrix, are then concatenated and dimensionality-reduced to obtain the output sequence.